This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[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 Wed Aug  2 13:20:07 CEST 2006 [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 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_c99_variadic_macros=''
363 d_casti32=''
364 castflags=''
365 d_castneg=''
366 d_chown=''
367 d_chroot=''
368 d_chsize=''
369 d_class=''
370 d_clearenv=''
371 d_closedir=''
372 d_void_closedir=''
373 d_cmsghdr_s=''
374 d_const=''
375 d_copysignl=''
376 d_cplusplus=''
377 cryptlib=''
378 d_crypt=''
379 crypt_r_proto=''
380 d_crypt_r=''
381 d_csh=''
382 full_csh=''
383 ctermid_r_proto=''
384 d_ctermid_r=''
385 ctime_r_proto=''
386 d_ctime_r=''
387 d_cuserid=''
388 d_dbl_dig=''
389 d_dbminitproto=''
390 d_difftime=''
391 d_dirfd=''
392 d_dlerror=''
393 d_dlopen=''
394 d_dlsymun=''
395 d_dosuid=''
396 d_suidsafe=''
397 d_drand48_r=''
398 drand48_r_proto=''
399 d_drand48proto=''
400 d_dup2=''
401 d_eaccess=''
402 d_endgrent=''
403 d_endgrent_r=''
404 endgrent_r_proto=''
405 d_endhent=''
406 d_endhostent_r=''
407 endhostent_r_proto=''
408 d_endnent=''
409 d_endnetent_r=''
410 endnetent_r_proto=''
411 d_endpent=''
412 d_endprotoent_r=''
413 endprotoent_r_proto=''
414 d_endpwent=''
415 d_endpwent_r=''
416 endpwent_r_proto=''
417 d_endsent=''
418 d_endservent_r=''
419 endservent_r_proto=''
420 d_faststdio=''
421 d_fchdir=''
422 d_fchmod=''
423 d_fchown=''
424 d_fcntl=''
425 d_fcntl_can_lock=''
426 d_fd_macros=''
427 d_fd_set=''
428 d_fds_bits=''
429 d_fgetpos=''
430 d_finite=''
431 d_finitel=''
432 d_flexfnam=''
433 d_flock=''
434 d_flockproto=''
435 d_fork=''
436 d_fp_class=''
437 d_fpclass=''
438 d_fpclassify=''
439 d_fpclassl=''
440 d_fpos64_t=''
441 d_frexpl=''
442 d_fs_data_s=''
443 d_fseeko=''
444 d_fsetpos=''
445 d_fstatfs=''
446 d_fsync=''
447 d_ftello=''
448 d_ftime=''
449 d_gettimeod=''
450 d_futimes=''
451 d_Gconvert=''
452 d_getcwd=''
453 d_getespwnam=''
454 d_getfsstat=''
455 d_getgrent=''
456 d_getgrent_r=''
457 getgrent_r_proto=''
458 d_getgrgid_r=''
459 getgrgid_r_proto=''
460 d_getgrnam_r=''
461 getgrnam_r_proto=''
462 d_getgrps=''
463 d_gethbyaddr=''
464 d_gethbyname=''
465 d_gethent=''
466 aphostname=''
467 d_gethname=''
468 d_phostname=''
469 d_uname=''
470 d_gethostbyaddr_r=''
471 gethostbyaddr_r_proto=''
472 d_gethostbyname_r=''
473 gethostbyname_r_proto=''
474 d_gethostent_r=''
475 gethostent_r_proto=''
476 d_gethostprotos=''
477 d_getitimer=''
478 d_getlogin=''
479 d_getlogin_r=''
480 getlogin_r_proto=''
481 d_getmnt=''
482 d_getmntent=''
483 d_getnbyaddr=''
484 d_getnbyname=''
485 d_getnent=''
486 d_getnetbyaddr_r=''
487 getnetbyaddr_r_proto=''
488 d_getnetbyname_r=''
489 getnetbyname_r_proto=''
490 d_getnetent_r=''
491 getnetent_r_proto=''
492 d_getnetprotos=''
493 d_getpagsz=''
494 d_getpent=''
495 d_getpgid=''
496 d_getpgrp2=''
497 d_bsdgetpgrp=''
498 d_getpgrp=''
499 d_getppid=''
500 d_getprior=''
501 d_getpbyname=''
502 d_getpbynumber=''
503 d_getprotobyname_r=''
504 getprotobyname_r_proto=''
505 d_getprotobynumber_r=''
506 getprotobynumber_r_proto=''
507 d_getprotoent_r=''
508 getprotoent_r_proto=''
509 d_getprotoprotos=''
510 d_getprpwnam=''
511 d_getpwent=''
512 d_getpwent_r=''
513 getpwent_r_proto=''
514 d_getpwnam_r=''
515 getpwnam_r_proto=''
516 d_getpwuid_r=''
517 getpwuid_r_proto=''
518 d_getsent=''
519 d_getservbyname_r=''
520 getservbyname_r_proto=''
521 d_getservbyport_r=''
522 getservbyport_r_proto=''
523 d_getservent_r=''
524 getservent_r_proto=''
525 d_getservprotos=''
526 d_getspnam=''
527 d_getspnam_r=''
528 getspnam_r_proto=''
529 d_getsbyname=''
530 d_getsbyport=''
531 d_gmtime_r=''
532 gmtime_r_proto=''
533 d_gnulibc=''
534 gnulibc_version=''
535 d_hasmntopt=''
536 d_htonl=''
537 d_ilogbl=''
538 d_inetaton=''
539 d_int64_t=''
540 d_isascii=''
541 d_isfinite=''
542 d_isinf=''
543 d_isnan=''
544 d_isnanl=''
545 d_killpg=''
546 d_lchown=''
547 d_ldbl_dig=''
548 d_libm_lib_version=''
549 d_link=''
550 d_localtime_r=''
551 localtime_r_proto=''
552 d_locconv=''
553 d_lockf=''
554 d_longdbl=''
555 longdblsize=''
556 d_longlong=''
557 longlongsize=''
558 d_lseekproto=''
559 d_lstat=''
560 d_madvise=''
561 d_malloc_good_size=''
562 d_malloc_size=''
563 d_mblen=''
564 d_mbstowcs=''
565 d_mbtowc=''
566 d_memchr=''
567 d_memcmp=''
568 d_memcpy=''
569 d_memmove=''
570 d_memset=''
571 d_mkdir=''
572 d_mkdtemp=''
573 d_mkfifo=''
574 d_mkstemp=''
575 d_mkstemps=''
576 d_mktime=''
577 d_mmap=''
578 mmaptype=''
579 d_modfl=''
580 d_modfl_pow32_bug=''
581 d_modflproto=''
582 d_mprotect=''
583 d_msg=''
584 d_msgctl=''
585 d_msgget=''
586 d_msghdr_s=''
587 d_msgrcv=''
588 d_msgsnd=''
589 d_msync=''
590 d_munmap=''
591 d_nice=''
592 d_nl_langinfo=''
593 d_off64_t=''
594 d_open3=''
595 d_fpathconf=''
596 d_pathconf=''
597 d_pause=''
598 d_pipe=''
599 d_poll=''
600 d_portable=''
601 d_procselfexe=''
602 procselfexe=''
603 d_old_pthread_create_joinable=''
604 old_pthread_create_joinable=''
605 d_pthread_atfork=''
606 d_pthread_attr_setscope=''
607 d_pthread_yield=''
608 d_sched_yield=''
609 sched_yield=''
610 d_qgcvt=''
611 d_random_r=''
612 random_r_proto=''
613 d_readdir64_r=''
614 readdir64_r_proto=''
615 d_readdir=''
616 d_rewinddir=''
617 d_seekdir=''
618 d_telldir=''
619 d_readdir_r=''
620 readdir_r_proto=''
621 d_readlink=''
622 d_readv=''
623 d_recvmsg=''
624 d_rename=''
625 d_rmdir=''
626 d_safebcpy=''
627 d_safemcpy=''
628 d_sanemcmp=''
629 d_sbrkproto=''
630 d_scalbnl=''
631 d_select=''
632 d_sem=''
633 d_semctl=''
634 d_semget=''
635 d_semop=''
636 d_sendmsg=''
637 d_setegid=''
638 d_seteuid=''
639 d_setgrent=''
640 d_setgrent_r=''
641 setgrent_r_proto=''
642 d_setgrps=''
643 d_sethent=''
644 d_sethostent_r=''
645 sethostent_r_proto=''
646 d_setitimer=''
647 d_setlinebuf=''
648 d_setlocale=''
649 d_setlocale_r=''
650 setlocale_r_proto=''
651 d_setnent=''
652 d_setnetent_r=''
653 setnetent_r_proto=''
654 d_setpent=''
655 d_setpgid=''
656 d_setpgrp2=''
657 d_bsdsetpgrp=''
658 d_setpgrp=''
659 d_setprior=''
660 d_setproctitle=''
661 d_setprotoent_r=''
662 setprotoent_r_proto=''
663 d_setpwent=''
664 d_setpwent_r=''
665 setpwent_r_proto=''
666 d_setregid=''
667 d_setresgid=''
668 d_setresuid=''
669 d_setreuid=''
670 d_setrgid=''
671 d_setruid=''
672 d_setsent=''
673 d_setservent_r=''
674 setservent_r_proto=''
675 d_setsid=''
676 d_setvbuf=''
677 d_sfio=''
678 usesfio=''
679 d_shm=''
680 d_shmat=''
681 d_shmatprototype=''
682 shmattype=''
683 d_shmctl=''
684 d_shmdt=''
685 d_shmget=''
686 d_sigaction=''
687 d_sigprocmask=''
688 d_sigsetjmp=''
689 usesitecustomize=''
690 d_snprintf=''
691 d_vsnprintf=''
692 d_sockatmark=''
693 d_sockatmarkproto=''
694 d_msg_ctrunc=''
695 d_msg_dontroute=''
696 d_msg_oob=''
697 d_msg_peek=''
698 d_msg_proxy=''
699 d_oldsock=''
700 d_scm_rights=''
701 d_socket=''
702 d_sockpair=''
703 sockethdr=''
704 socketlib=''
705 d_socklen_t=''
706 d_socks5_init=''
707 d_sprintf_returns_strlen=''
708 d_sqrtl=''
709 d_srand48_r=''
710 srand48_r_proto=''
711 d_srandom_r=''
712 srandom_r_proto=''
713 d_sresgproto=''
714 d_sresuproto=''
715 d_statblks=''
716 d_statfs_f_flags=''
717 d_statfs_s=''
718 d_fstatvfs=''
719 d_statvfs=''
720 d_stdio_cnt_lval=''
721 d_stdio_ptr_lval=''
722 d_stdio_ptr_lval_nochange_cnt=''
723 d_stdio_ptr_lval_sets_cnt=''
724 d_stdiobase=''
725 d_stdstdio=''
726 stdio_base=''
727 stdio_bufsiz=''
728 stdio_cnt=''
729 stdio_filbuf=''
730 stdio_ptr=''
731 d_index=''
732 d_strchr=''
733 d_strcoll=''
734 d_strctcpy=''
735 d_strerrm=''
736 d_strerror=''
737 d_sysernlst=''
738 d_syserrlst=''
739 d_strerror_r=''
740 strerror_r_proto=''
741 d_strftime=''
742 d_strlcat=''
743 d_strlcpy=''
744 d_strtod=''
745 d_strtol=''
746 d_strtold=''
747 d_strtoll=''
748 d_strtoq=''
749 d_strtoul=''
750 d_strtoull=''
751 d_strtouq=''
752 d_strxfrm=''
753 d_symlink=''
754 d_syscall=''
755 d_syscallproto=''
756 d_sysconf=''
757 d_system=''
758 d_tcgetpgrp=''
759 d_tcsetpgrp=''
760 d_telldirproto=''
761 d_time=''
762 timetype=''
763 clocktype=''
764 d_times=''
765 d_tmpnam_r=''
766 tmpnam_r_proto=''
767 d_truncate=''
768 d_ttyname_r=''
769 ttyname_r_proto=''
770 d_tzname=''
771 d_u32align=''
772 d_ualarm=''
773 d_umask=''
774 d_semctl_semid_ds=''
775 d_semctl_semun=''
776 d_union_semun=''
777 d_unordered=''
778 d_unsetenv=''
779 d_usleep=''
780 d_usleepproto=''
781 d_ustat=''
782 d_vfork=''
783 usevfork=''
784 d_voidsig=''
785 signal_t=''
786 d_volatile=''
787 d_charvspr=''
788 d_vprintf=''
789 d_wait4=''
790 d_waitpid=''
791 d_wcstombs=''
792 d_wctomb=''
793 d_writev=''
794 dlext=''
795 cccdlflags=''
796 ccdlflags=''
797 dlsrc=''
798 ld=''
799 lddlflags=''
800 usedl=''
801 doublesize=''
802 ebcdic=''
803 fflushNULL=''
804 fflushall=''
805 fpossize=''
806 fpostype=''
807 gccansipedantic=''
808 gccosandvers=''
809 gccversion=''
810 gidformat=''
811 gidsign=''
812 gidsize=''
813 gidtype=''
814 groupstype=''
815 h_fcntl=''
816 h_sysfile=''
817 html1dir=''
818 html1direxp=''
819 installhtml1dir=''
820 html3dir=''
821 html3direxp=''
822 installhtml3dir=''
823 i_arpainet=''
824 i_crypt=''
825 db_hashtype=''
826 db_prefixtype=''
827 db_version_major=''
828 db_version_minor=''
829 db_version_patch=''
830 i_db=''
831 i_dbm=''
832 i_rpcsvcdbm=''
833 d_dirnamlen=''
834 direntrytype=''
835 i_dirent=''
836 i_dld=''
837 i_dlfcn=''
838 i_fcntl=''
839 i_float=''
840 i_fp=''
841 i_fp_class=''
842 i_gdbm=''
843 d_grpasswd=''
844 i_grp=''
845 i_ieeefp=''
846 i_inttypes=''
847 i_langinfo=''
848 i_libutil=''
849 i_limits=''
850 i_locale=''
851 i_machcthr=''
852 i_malloc=''
853 i_math=''
854 i_memory=''
855 i_mntent=''
856 i_ndbm=''
857 i_netdb=''
858 i_neterrno=''
859 i_netinettcp=''
860 i_niin=''
861 i_sysin=''
862 i_poll=''
863 i_prot=''
864 i_pthread=''
865 d_pwage=''
866 d_pwchange=''
867 d_pwclass=''
868 d_pwcomment=''
869 d_pwexpire=''
870 d_pwgecos=''
871 d_pwpasswd=''
872 d_pwquota=''
873 i_pwd=''
874 i_sfio=''
875 i_shadow=''
876 i_socks=''
877 i_stddef=''
878 i_stdlib=''
879 i_string=''
880 strings=''
881 i_sunmath=''
882 i_sysaccess=''
883 i_sysdir=''
884 i_sysfile=''
885 d_voidtty=''
886 i_bsdioctl=''
887 i_sysfilio=''
888 i_sysioctl=''
889 i_syssockio=''
890 i_syslog=''
891 i_sysmman=''
892 i_sysmode=''
893 i_sysmount=''
894 i_sysndir=''
895 i_sysparam=''
896 i_sysresrc=''
897 i_syssecrt=''
898 i_sysselct=''
899 i_sysstat=''
900 i_sysstatfs=''
901 i_sysstatvfs=''
902 i_systimes=''
903 i_systypes=''
904 i_sysuio=''
905 i_sysun=''
906 i_sysutsname=''
907 i_sysvfs=''
908 i_syswait=''
909 i_sgtty=''
910 i_termio=''
911 i_termios=''
912 d_tm_tm_gmtoff=''
913 d_tm_tm_zone=''
914 i_systime=''
915 i_systimek=''
916 i_time=''
917 timeincl=''
918 i_unistd=''
919 i_ustat=''
920 i_utime=''
921 i_values=''
922 i_stdarg=''
923 i_varargs=''
924 i_varhdr=''
925 i_vfork=''
926 d_inc_version_list=''
927 inc_version_list=''
928 inc_version_list_init=''
929 installprefix=''
930 installprefixexp=''
931 installstyle=''
932 installusrbinperl=''
933 intsize=''
934 longsize=''
935 shortsize=''
936 issymlink=''
937 libc=''
938 ldlibpthname=''
939 libperl=''
940 shrpenv=''
941 useshrplib=''
942 glibpth=''
943 libpth=''
944 loclibpth=''
945 plibpth=''
946 xlibpth=''
947 ignore_versioned_solibs=''
948 libs=''
949 libsdirs=''
950 libsfiles=''
951 libsfound=''
952 libspath=''
953 lns=''
954 d_PRIEUldbl=''
955 d_PRIFUldbl=''
956 d_PRIGUldbl=''
957 d_PRIeldbl=''
958 d_PRIfldbl=''
959 d_PRIgldbl=''
960 d_SCNfldbl=''
961 sPRIEUldbl=''
962 sPRIFUldbl=''
963 sPRIGUldbl=''
964 sPRIeldbl=''
965 sPRIfldbl=''
966 sPRIgldbl=''
967 sSCNfldbl=''
968 lseeksize=''
969 lseektype=''
970 mad=''
971 madlyh=''
972 madlyobj=''
973 madlysrc=''
974 make_set_make=''
975 d_mymalloc=''
976 freetype=''
977 mallocobj=''
978 mallocsrc=''
979 malloctype=''
980 usemallocwrap=''
981 usemymalloc=''
982 installman1dir=''
983 man1dir=''
984 man1direxp=''
985 man1ext=''
986 installman3dir=''
987 man3dir=''
988 man3direxp=''
989 man3ext=''
990 modetype=''
991 multiarch=''
992 mydomain=''
993 myhostname=''
994 phostname=''
995 c=''
996 n=''
997 d_eofnblk=''
998 eagain=''
999 o_nonblock=''
1000 rd_nodata=''
1001 need_va_copy=''
1002 netdb_hlen_type=''
1003 netdb_host_type=''
1004 netdb_name_type=''
1005 netdb_net_type=''
1006 groupcat=''
1007 hostcat=''
1008 passcat=''
1009 orderlib=''
1010 ranlib=''
1011 d_perl_otherlibdirs=''
1012 otherlibdirs=''
1013 package=''
1014 spackage=''
1015 pager=''
1016 api_revision=''
1017 api_subversion=''
1018 api_version=''
1019 api_versionstring=''
1020 patchlevel=''
1021 perl_patchlevel=''
1022 revision=''
1023 subversion=''
1024 version=''
1025 version_patchlevel_string=''
1026 perl5=''
1027 perladmin=''
1028 perlpath=''
1029 d_nv_preserves_uv=''
1030 d_nv_zero_is_allbits_zero=''
1031 i16size=''
1032 i16type=''
1033 i32size=''
1034 i32type=''
1035 i64size=''
1036 i64type=''
1037 i8size=''
1038 i8type=''
1039 ivsize=''
1040 ivtype=''
1041 nv_preserves_uv_bits=''
1042 nvsize=''
1043 nvtype=''
1044 u16size=''
1045 u16type=''
1046 u32size=''
1047 u32type=''
1048 u64size=''
1049 u64type=''
1050 u8size=''
1051 u8type=''
1052 uvsize=''
1053 uvtype=''
1054 ivdformat=''
1055 nvEUformat=''
1056 nvFUformat=''
1057 nvGUformat=''
1058 nveformat=''
1059 nvfformat=''
1060 nvgformat=''
1061 uvXUformat=''
1062 uvoformat=''
1063 uvuformat=''
1064 uvxformat=''
1065 pidtype=''
1066 prefix=''
1067 prefixexp=''
1068 installprivlib=''
1069 privlib=''
1070 privlibexp=''
1071 prototype=''
1072 ptrsize=''
1073 d_PRIXU64=''
1074 d_PRId64=''
1075 d_PRIi64=''
1076 d_PRIo64=''
1077 d_PRIu64=''
1078 d_PRIx64=''
1079 sPRIXU64=''
1080 sPRId64=''
1081 sPRIi64=''
1082 sPRIo64=''
1083 sPRIu64=''
1084 sPRIx64=''
1085 d_quad=''
1086 quadkind=''
1087 quadtype=''
1088 uquadtype=''
1089 drand01=''
1090 randbits=''
1091 randfunc=''
1092 randseedtype=''
1093 seedfunc=''
1094 installscript=''
1095 scriptdir=''
1096 scriptdirexp=''
1097 selectminbits=''
1098 selecttype=''
1099 sh=''
1100 sig_count=''
1101 sig_name=''
1102 sig_name_init=''
1103 sig_num=''
1104 sig_num_init=''
1105 sig_size=''
1106 d_sitearch=''
1107 installsitearch=''
1108 sitearch=''
1109 sitearchexp=''
1110 installsitebin=''
1111 sitebin=''
1112 sitebinexp=''
1113 installsitehtml1dir=''
1114 sitehtml1dir=''
1115 sitehtml1direxp=''
1116 installsitehtml3dir=''
1117 sitehtml3dir=''
1118 sitehtml3direxp=''
1119 installsitelib=''
1120 sitelib=''
1121 sitelib_stem=''
1122 sitelibexp=''
1123 installsiteman1dir=''
1124 siteman1dir=''
1125 siteman1direxp=''
1126 installsiteman3dir=''
1127 siteman3dir=''
1128 siteman3direxp=''
1129 siteprefix=''
1130 siteprefixexp=''
1131 installsitescript=''
1132 sitescript=''
1133 sitescriptexp=''
1134 sizesize=''
1135 sizetype=''
1136 so=''
1137 socksizetype=''
1138 sharpbang=''
1139 shsharp=''
1140 spitshell=''
1141 src=''
1142 ssizetype=''
1143 startperl=''
1144 startsh=''
1145 stdchar=''
1146 d_stdio_stream_array=''
1147 stdio_stream_array=''
1148 sysman=''
1149 trnl=''
1150 uidformat=''
1151 uidsign=''
1152 uidsize=''
1153 uidtype=''
1154 archname64=''
1155 use64bitall=''
1156 use64bitint=''
1157 usefaststdio=''
1158 ccflags_uselargefiles=''
1159 ldflags_uselargefiles=''
1160 libswanted_uselargefiles=''
1161 uselargefiles=''
1162 uselongdouble=''
1163 usemorebits=''
1164 usemultiplicity=''
1165 nm_opt=''
1166 nm_so_opt=''
1167 runnm=''
1168 usenm=''
1169 useperlio=''
1170 usesocks=''
1171 d_oldpthreads=''
1172 use5005threads=''
1173 useithreads=''
1174 usereentrant=''
1175 usethreads=''
1176 incpath=''
1177 mips_type=''
1178 usrinc=''
1179 d_vendorarch=''
1180 installvendorarch=''
1181 vendorarch=''
1182 vendorarchexp=''
1183 d_vendorbin=''
1184 installvendorbin=''
1185 vendorbin=''
1186 vendorbinexp=''
1187 installvendorhtml1dir=''
1188 vendorhtml1dir=''
1189 vendorhtml1direxp=''
1190 installvendorhtml3dir=''
1191 vendorhtml3dir=''
1192 vendorhtml3direxp=''
1193 d_vendorlib=''
1194 installvendorlib=''
1195 vendorlib=''
1196 vendorlib_stem=''
1197 vendorlibexp=''
1198 installvendorman1dir=''
1199 vendorman1dir=''
1200 vendorman1direxp=''
1201 installvendorman3dir=''
1202 vendorman3dir=''
1203 vendorman3direxp=''
1204 usevendorprefix=''
1205 vendorprefix=''
1206 vendorprefixexp=''
1207 d_vendorscript=''
1208 installvendorscript=''
1209 vendorscript=''
1210 vendorscriptexp=''
1211 versiononly=''
1212 defvoidused=''
1213 voidflags=''
1214 yacc=''
1215 yaccflags=''
1216 CONFIG=''
1217
1218 define='define'
1219 undef='undef'
1220 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1221 rmlist=''
1222
1223 : We must find out about Eunice early
1224 eunicefix=':'
1225 if test -f /etc/unixtovms; then
1226         eunicefix=/etc/unixtovms
1227 fi
1228 if test -f /etc/unixtovms.exe; then
1229         eunicefix=/etc/unixtovms.exe
1230 fi
1231
1232 : Set executable suffix now -- needed before hints available
1233 if test -f "/libs/version.library"; then
1234 : Amiga OS
1235     _exe=""
1236 elif test -f "/system/gnu_library/bin/ar.pm"; then
1237 : Stratus VOS
1238     _exe=".pm"
1239 elif test -n "$DJGPP"; then
1240 : DOS DJGPP
1241     _exe=".exe"
1242 elif test -d c:/. -o -n "$is_os2" ; then
1243 : OS/2 or cygwin
1244     _exe=".exe"
1245 fi
1246
1247 i_whoami=''
1248 ccname=''
1249 ccversion=''
1250 perllibs=''
1251 : set useposix=false in your hint file to disable the POSIX extension.
1252 useposix=true
1253 : set useopcode=false in your hint file to disable the Opcode extension.
1254 useopcode=true
1255 : Trailing extension.  Override this in a hint file, if needed.
1256 : Extra object files, if any, needed on this platform.
1257 archobjs=''
1258 archname=''
1259 : Possible local include directories to search.
1260 : Set locincpth to "" in a hint file to defeat local include searches.
1261 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1262 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1263 :
1264 : no include file wanted by default
1265 inclwanted=''
1266
1267 : Enable -DEBUGGING and -DDEBUGGING from the command line
1268 EBUGGING=''
1269 DEBUGGING=old
1270
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
1285 : Private path used by Configure to find libraries.  Its value
1286 : is prepended to libpth. This variable takes care of special
1287 : machines, like the mips.  Usually, it should be empty.
1288 plibpth=''
1289
1290 : default library list
1291 libswanted=''
1292 : some systems want to use only the non-versioned libso:s
1293 ignore_versioned_solibs=''
1294 siteman1dir=''
1295 siteman3dir=''
1296 sitescript=''
1297 archname64=''
1298 ccflags_uselargefiles=''
1299 ldflags_uselargefiles=''
1300 libswanted_uselargefiles=''
1301 : set usemultiplicity on the Configure command line to enable multiplicity.
1302 : set usesocks on the Configure command line to enable socks.
1303 : set usethreads on the Configure command line to enable threads.
1304 usereentrant='undef'
1305 : full support for void wanted by default
1306 defvoidused=15
1307
1308 : List of libraries we want.
1309 : If anyone needs extra -lxxx, put those in a hint file.
1310 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1311 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1312 : We probably want to search /usr/shlib before most other libraries.
1313 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1314 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1315 glibpth="/usr/shlib $glibpth"
1316 : Do not use vfork unless overridden by a hint file.
1317 usevfork=false
1318
1319 : Find the basic shell for Bourne shell scripts
1320 case "$sh" in
1321 '')
1322         case "$SYSTYPE" in
1323         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1324         *) xxx='/bin/sh';;
1325         esac
1326         if test -f "$xxx"; then
1327                 sh="$xxx"
1328         else
1329                 : Build up a list and do a single loop so we can 'break' out.
1330                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1331                 for xxx in sh bash ksh pdksh ash; do
1332                         for p in $pth; do
1333                                 try="$try ${p}/${xxx}"
1334                         done
1335                 done
1336                 for xxx in $try; do
1337                         if test -f "$xxx"; then
1338                                 sh="$xxx";
1339                                 break
1340                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1341                                 sh="$xxx";
1342                                 break
1343                         elif test -f "$xxx.exe"; then
1344                                 sh="$xxx";
1345                                 break
1346                         fi
1347                 done
1348         fi
1349         ;;
1350 esac
1351
1352 case "$sh" in
1353 '')     cat >&2 <<EOM
1354 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1355
1356 Usually it's in /bin/sh.  How did you even get this far?
1357 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1358 we'll try to straighten this all out.
1359 EOM
1360         exit 1
1361         ;;
1362 esac
1363
1364 : see if sh knows # comments
1365 if `$sh -c '#' >/dev/null 2>&1`; then
1366         shsharp=true
1367         spitshell=cat
1368         xcat=/bin/cat
1369         test -f $xcat$_exe || xcat=/usr/bin/cat
1370         if test ! -f $xcat$_exe; then
1371                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1372                         if test -f $p/cat$_exe; then
1373                                 xcat=$p/cat
1374                                 break
1375                         fi
1376                 done
1377                 if test ! -f $xcat$_exe; then
1378                         echo "Can't find cat anywhere!"
1379                         exit 1
1380                 fi
1381         fi
1382         echo "#!$xcat" >sharp
1383         $eunicefix sharp
1384         chmod +x sharp
1385         ./sharp > today
1386         if test -s today; then
1387                 sharpbang='#!'
1388         else
1389                 echo "#! $xcat" > sharp
1390                 $eunicefix sharp
1391                 chmod +x sharp
1392                 ./sharp > today
1393                 if test -s today; then
1394                         sharpbang='#! '
1395                 else
1396                         sharpbang=': use '
1397                 fi
1398         fi
1399 else
1400         echo " "
1401         echo "Your $sh doesn't grok # comments--I will strip them later on."
1402         shsharp=false
1403         cd ..
1404         echo "exec grep -v '^[  ]*#'" >spitshell
1405         chmod +x spitshell
1406         $eunicefix spitshell
1407         spitshell=`pwd`/spitshell
1408         cd UU
1409         echo "I presume that if # doesn't work, #! won't work either!"
1410         sharpbang=': use '
1411 fi
1412 rm -f sharp today
1413
1414 : figure out how to guarantee sh startup
1415 case "$startsh" in
1416 '') startsh=${sharpbang}${sh} ;;
1417 *)
1418 esac
1419 cat >sharp <<EOSS
1420 $startsh
1421 set abc
1422 test "$?abc" != 1
1423 EOSS
1424
1425 chmod +x sharp
1426 $eunicefix sharp
1427 if ./sharp; then
1428         : echo "Yup, it does."
1429 else
1430         echo "Hmm... '$startsh' does not guarantee sh startup..."
1431         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1432 fi
1433 rm -f sharp
1434
1435
1436 : Save command line options in file UU/cmdline.opt for later use in
1437 : generating config.sh.
1438 cat > cmdline.opt <<EOSH
1439 # Configure command line arguments.
1440 config_arg0='$0'
1441 config_args='$*'
1442 config_argc=$#
1443 EOSH
1444 argn=1
1445 args_exp=''
1446 args_sep=''
1447 for arg in "$@"; do
1448         cat >>cmdline.opt <<EOSH
1449 config_arg$argn='$arg'
1450 EOSH
1451         # Extreme backslashitis: replace each ' by '"'"'
1452         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1453 $arg
1454 EOC
1455         arg_exp=`cat cmdl.opt`
1456         args_exp="$args_exp$args_sep'$arg_exp'"
1457         argn=`expr $argn + 1`
1458         args_sep=' '
1459 done
1460 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1461 # used by ./hints/os2.sh
1462 rm -f cmdl.opt
1463
1464 : produce awk script to parse command line options
1465 cat >options.awk <<'EOF'
1466 BEGIN {
1467         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1468
1469         len = length(optstr);
1470         for (i = 1; i <= len; i++) {
1471                 c = substr(optstr, i, 1);
1472                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1473                 if (a == ":") {
1474                         arg[c] = 1;
1475                         i++;
1476                 }
1477                 opt[c] = 1;
1478         }
1479 }
1480 {
1481         expect = 0;
1482         str = $0;
1483         if (substr(str, 1, 1) != "-") {
1484                 printf("'%s'\n", str);
1485                 next;
1486         }
1487         len = length($0);
1488         for (i = 2; i <= len; i++) {
1489                 c = substr(str, i, 1);
1490                 if (!opt[c]) {
1491                         printf("-%s\n", substr(str, i));
1492                         next;
1493                 }
1494                 printf("-%s\n", c);
1495                 if (arg[c]) {
1496                         if (i < len)
1497                                 printf("'%s'\n", substr(str, i + 1));
1498                         else
1499                                 expect = 1;
1500                         next;
1501                 }
1502         }
1503 }
1504 END {
1505         if (expect)
1506                 print "?";
1507 }
1508 EOF
1509
1510 : process the command line options
1511 set X `for arg in "$@"; do echo "X$arg"; done |
1512         sed -e s/X// | awk -f options.awk`
1513 eval "set $*"
1514 shift
1515 rm -f options.awk
1516
1517 : set up default values
1518 fastread=''
1519 reuseval=false
1520 config_sh=''
1521 alldone=''
1522 error=''
1523 silent=''
1524 extractsh=''
1525 override=''
1526 knowitall=''
1527 rm -f optdef.sh posthint.sh
1528 cat >optdef.sh <<EOS
1529 $startsh
1530 EOS
1531
1532
1533 : option parsing
1534 while test $# -gt 0; do
1535         case "$1" in
1536         -d) shift; fastread=yes;;
1537         -e) shift; alldone=cont;;
1538         -f)
1539                 shift
1540                 cd ..
1541                 if test -r "$1"; then
1542                         config_sh="$1"
1543                 else
1544                         echo "$me: cannot read config file $1." >&2
1545                         error=true
1546                 fi
1547                 cd UU
1548                 shift;;
1549         -h) shift; error=true;;
1550         -r) shift; reuseval=true;;
1551         -s) shift; silent=true; realsilent=true;;
1552         -E) shift; alldone=exit;;
1553         -K) shift; knowitall=true;;
1554         -O) shift; override=true;;
1555         -S) shift; silent=true; extractsh=true;;
1556         -D)
1557                 shift
1558                 case "$1" in
1559                 *=)
1560                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1561                         echo "$me: ignoring -D $1" >&2
1562                         ;;
1563                 *=*) echo "$1" | \
1564                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1565                 *) echo "$1='define'" >> optdef.sh;;
1566                 esac
1567                 shift
1568                 ;;
1569         -U)
1570                 shift
1571                 case "$1" in
1572                 *=) echo "$1" >> optdef.sh;;
1573                 *=*)
1574                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1575                         echo "$me: ignoring -U $1" >&2
1576                         ;;
1577                 *) echo "$1='undef'" >> optdef.sh;;
1578                 esac
1579                 shift
1580                 ;;
1581         -A)
1582             shift
1583             xxx=''
1584             yyy="$1"
1585             zzz=''
1586             uuu=undef
1587             case "$yyy" in
1588             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1589                  case "$zzz" in
1590                  *:*) zzz='' ;;
1591                  *)   xxx=append
1592                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1593                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1594                  esac
1595                  ;;
1596             esac
1597             case "$xxx" in
1598             '')  case "$yyy" in
1599                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1600                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1601                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1602                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1603                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1604                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1605                  esac
1606                  ;;       
1607             esac
1608             case "$xxx" in
1609             append)
1610                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1611             clear)
1612                 echo "$yyy=''"                  >> posthint.sh ;;
1613             define)
1614                 case "$zzz" in
1615                 '') zzz=define ;;
1616                 esac
1617                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1618             eval)
1619                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1620             prepend)
1621                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1622             undef)
1623                 case "$zzz" in
1624                 '') zzz="$uuu" ;;
1625                 esac
1626                 echo "$yyy=$zzz"                >> posthint.sh ;;
1627             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1628             esac
1629             shift
1630             ;;
1631         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1632             exit 0;;
1633         --) break;;
1634         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1635         *) break;;
1636         esac
1637 done
1638
1639 case "$error" in
1640 true)
1641         cat >&2 <<EOM
1642 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1643                  [-U symbol] [-U symbol=] [-A command:symbol...]
1644   -d : use defaults for all answers.
1645   -e : go on without questioning past the production of config.sh.
1646   -f : specify an alternate default configuration file.
1647   -h : print this help message and exit (with an error status).
1648   -r : reuse C symbols value if possible (skips costly nm extraction).
1649   -s : silent mode, only echoes questions and essential information.
1650   -D : define symbol to have some value:
1651          -D symbol         symbol gets the value 'define'
1652          -D symbol=value   symbol gets the value 'value'
1653   -E : stop at the end of questions, after having produced config.sh.
1654   -K : do not use unless you know what you are doing.
1655   -O : let -D and -U override definitions from loaded configuration file.
1656   -S : perform variable substitutions on all .SH files (can mix with -f)
1657   -U : undefine symbol:
1658          -U symbol    symbol gets the value 'undef'
1659          -U symbol=   symbol gets completely empty
1660   -A : manipulate symbol after the platform specific hints have been applied:
1661          -A symbol=value                append " "value to symbol
1662          -A append:symbol=value         append value to symbol
1663          -A define:symbol=value         define symbol to have value
1664          -A clear:symbol                define symbol to be ''
1665          -A define:symbol               define symbol to be 'define'
1666          -A eval:symbol=value           define symbol to be eval of value
1667          -A prepend:symbol=value        prepend value to symbol
1668          -A undef:symbol                define symbol to be 'undef'
1669          -A undef:symbol=               define symbol to be ''
1670   -V : print version number and exit (with a zero status).
1671 EOM
1672         exit 1
1673         ;;
1674 esac
1675
1676 : Sanity checks
1677 case "$fastread$alldone" in
1678 yescont|yesexit) ;;
1679 *)
1680         case "$extractsh" in
1681         true) ;;
1682         *)
1683                 if test ! -t 0; then
1684                         echo "Say 'sh Configure', not 'sh <Configure'"
1685                         exit 1
1686                 fi
1687                 ;;
1688         esac
1689         ;;
1690 esac
1691
1692 exec 4>&1
1693 case "$silent" in
1694 true) exec 1>/dev/null;;
1695 esac
1696
1697 : run the defines and the undefines, if any, but leave the file out there...
1698 touch optdef.sh
1699 . ./optdef.sh
1700 : create the posthint manipulation script and leave the file out there...
1701 touch posthint.sh
1702
1703 : set package name
1704 package=perl5
1705 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1706 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1707 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1708 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1709 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1710 esac
1711
1712 : Some greps do not return status, grrr.
1713 echo "grimblepritz" >grimble
1714 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1715         contains=contains
1716 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1717         contains=grep
1718 else
1719         contains=contains
1720 fi
1721 rm -f grimble
1722 : the following should work in any shell
1723 case "$contains" in
1724 contains*)
1725         echo " "
1726         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1727         cat >contains <<'EOSS'
1728 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1729 EOSS
1730 chmod +x contains
1731 esac
1732
1733 : Find the path to the source tree
1734 case "$src" in
1735 '') case "$0" in
1736     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1737          case "$src" in
1738          /*)    ;;
1739          .)     ;;
1740          *)     src=`cd ../$src && pwd` ;;
1741          esac
1742          ;;
1743     *)   src='.';;
1744     esac;;
1745 esac
1746 case "$src" in
1747 '')     src=/
1748         rsrc=/
1749         ;;
1750 /*) rsrc="$src";;
1751 *) rsrc="../$src";;
1752 esac
1753 if test -f $rsrc/Configure && \
1754         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1755 then
1756    : found it, so we are ok.
1757 else
1758         rsrc=''
1759         for src in . .. ../.. ../../.. ../../../..; do
1760                 if test -f ../$src/Configure && \
1761                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1762                 then
1763                         rsrc=../$src
1764                         break
1765                 fi
1766         done
1767 fi
1768 case "$rsrc" in
1769 '')
1770         cat <<EOM >&4
1771
1772 Sorry, I can't seem to locate the source dir for $package.  Please start
1773 Configure with an explicit path -- i.e. /some/path/Configure.
1774
1775 EOM
1776         exit 1
1777         ;;
1778 ../.)   rsrc='..';;
1779 *)
1780         echo " "
1781         echo "Sources for $package found in \"$src\"." >&4
1782         ;;
1783 esac
1784
1785 : script used to extract .SH files with variable substitutions
1786 cat >extract <<'EOS'
1787 PERL_CONFIG_SH=true
1788 echo "Doing variable substitutions on .SH files..."
1789 if test -f MANIFEST; then
1790         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1791 else
1792         echo "(Looking for .SH files under the source directory.)"
1793         set x `(cd "$src"; find . -name "*.SH" -print)`
1794 fi
1795 shift
1796 case $# in
1797 0) set x `(cd "$src"; echo *.SH)`; shift;;
1798 esac
1799 if test ! -f "$src/$1"; then
1800         shift
1801 fi
1802 mkdir_p='
1803 name=$1;
1804 create="";
1805 while test $name; do
1806         if test ! -d "$name"; then
1807                 create="$name $create";
1808                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1809                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1810         else
1811                 name="";
1812         fi;
1813 done;
1814 for file in $create; do
1815         mkdir $file;
1816 done
1817 '
1818 for file in $*; do
1819         case "$src" in
1820         ".")
1821                 case "$file" in
1822                 */*)
1823                         dir=`expr X$file : 'X\(.*\)/'`
1824                         file=`expr X$file : 'X.*/\(.*\)'`
1825                         (cd "$dir" && . ./$file)
1826                         ;;
1827                 *)
1828                         . ./$file
1829                         ;;
1830                 esac
1831                 ;;
1832         *)
1833                 case "$file" in
1834                 */*)
1835                         dir=`expr X$file : 'X\(.*\)/'`
1836                         file=`expr X$file : 'X.*/\(.*\)'`
1837                         (set x $dir; shift; eval $mkdir_p)
1838                         sh <"$src/$dir/$file"
1839                         ;;
1840                 *)
1841                         sh <"$src/$file"
1842                         ;;
1843                 esac
1844                 ;;
1845         esac
1846 done
1847 if test -f "$src/config_h.SH"; then
1848         if test ! -f config.h; then
1849         : oops, they left it out of MANIFEST, probably, so do it anyway.
1850         . "$src/config_h.SH"
1851         fi
1852 fi
1853 EOS
1854
1855 : extract files and exit if asked to do so
1856 case "$extractsh" in
1857 true)
1858         case "$realsilent" in
1859         true) ;;
1860         *) exec 1>&4;;
1861         esac
1862         case "$config_sh" in
1863         '') config_sh='config.sh';;
1864         esac
1865         echo " "
1866         echo "Fetching answers from $config_sh..."
1867         cd ..
1868         . $config_sh
1869         test "$override" && . ./optdef.sh
1870         echo " "
1871         . UU/extract
1872         rm -rf UU
1873         echo "Extraction done."
1874         exit 0
1875         ;;
1876 esac
1877
1878 : Eunice requires " " instead of "", can you believe it
1879 echo " "
1880 : Here we go...
1881 echo "Beginning of configuration questions for $package."
1882
1883 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1884
1885 : first determine how to suppress newline on echo command
1886 echo " "
1887 echo "Checking echo to see how to suppress newlines..."
1888 (echo "hi there\c" ; echo " ") >.echotmp
1889 if $contains c .echotmp >/dev/null 2>&1 ; then
1890         echo "...using -n."
1891         n='-n'
1892         c=''
1893 else
1894         cat <<'EOM'
1895 ...using \c
1896 EOM
1897         n=''
1898         c='\c'
1899 fi
1900 echo $n "The star should be here-->$c"
1901 echo '*'
1902 rm -f .echotmp
1903
1904 : Now test for existence of everything in MANIFEST
1905 echo " "
1906 if test -f "$rsrc/MANIFEST"; then
1907         echo "First let's make sure your kit is complete.  Checking..." >&4
1908         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1909         rm -f missing
1910         tmppwd=`pwd`
1911         for filelist in x??; do
1912                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1913         done
1914         if test -s missing; then
1915                 cat missing >&4
1916                 cat >&4 <<'EOM'
1917
1918 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1919
1920 You have the option of continuing the configuration process, despite the
1921 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1922 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1923 and contact the author (perlbug@perl.org).
1924
1925 EOM
1926                 echo $n "Continue? [n] $c" >&4
1927                 read ans
1928                 case "$ans" in
1929                 y*)
1930                         echo "Continuing..." >&4
1931                         rm -f missing
1932                         ;;
1933                 *)
1934                         echo "ABORTING..." >&4
1935                         kill $$
1936                         ;;
1937                 esac
1938         else
1939                 echo "Looks good..."
1940         fi
1941 else
1942         echo "There is no MANIFEST file.  I hope your kit is complete !"
1943 fi
1944 rm -f missing x??
1945
1946 echo " "
1947 : Find the appropriate value for a newline for tr
1948 if test -n "$DJGPP"; then
1949        trnl='\012'
1950 fi
1951 if test X"$trnl" = X; then
1952         case "`echo foo|tr '\n' x 2>/dev/null`" in
1953         foox) trnl='\n' ;;
1954         esac
1955 fi
1956 if test X"$trnl" = X; then
1957         case "`echo foo|tr '\012' x 2>/dev/null`" in
1958         foox) trnl='\012' ;;
1959         esac
1960 fi
1961 if test X"$trnl" = X; then
1962        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1963        fooxy) trnl='\n\r' ;;
1964        esac
1965 fi
1966 if test X"$trnl" = X; then
1967         cat <<EOM >&2
1968
1969 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1970
1971 EOM
1972         exit 1
1973 fi
1974
1975 : compute the number of columns on the terminal for proper question formatting
1976 case "$COLUMNS" in
1977 '') COLUMNS='80';;
1978 esac
1979
1980 : set up the echo used in my read
1981 myecho="case \"\$xxxm\" in
1982 '') echo $n \"\$rp $c\" >&4;;
1983 *) case \"\$rp\" in
1984         '') echo $n \"[\$xxxm] $c\";;
1985         *)
1986                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1987                         echo \"\$rp\" >&4
1988                         echo $n \"[\$xxxm] $c\" >&4
1989                 else
1990                         echo $n \"\$rp [\$xxxm] $c\" >&4
1991                 fi
1992                 ;;
1993         esac;;
1994 esac"
1995
1996 : now set up to do reads with possible shell escape and default assignment
1997 cat <<EOSC >myread
1998 $startsh
1999 xxxm=\$dflt
2000 $myecho
2001 ans='!'
2002 case "\$fastread" in
2003 yes) case "\$dflt" in
2004         '') ;;
2005         *) ans='';
2006                 case "\$silent-\$rp" in
2007                 true-) ;;
2008                 *) echo " " >&4;;
2009                 esac;;
2010         esac;;
2011 *) case "\$silent" in
2012         true) case "\$rp" in
2013                 '') ans='';;
2014                 esac;;
2015         esac;;
2016 esac
2017 while expr "X\$ans" : "X!" >/dev/null; do
2018         read answ
2019         set x \$xxxm
2020         shift
2021         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2022         case  "\$answ" in
2023         "!")
2024                 sh 1>&4
2025                 echo " "
2026                 $myecho
2027                 ;;
2028         !*)
2029                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2030                 shift
2031                 sh 1>&4 -c "\$*"
2032                 echo " "
2033                 $myecho
2034                 ;;
2035         "\$ans")
2036                 case "\$ans" in
2037                 \\&*)
2038                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2039                         shift
2040                         case "\$1" in
2041                         -d)
2042                                 fastread=yes
2043                                 echo "(OK, I'll run with -d after this question.)" >&4
2044                                 ;;
2045                         -*)
2046                                 echo "*** Sorry, \$1 not supported yet." >&4
2047                                 ;;
2048                         esac
2049                         $myecho
2050                         ans=!
2051                         ;;
2052                 esac;;
2053         *)
2054                 case "\$aok" in
2055                 y)
2056                         echo "*** Substitution done -- please confirm."
2057                         xxxm="\$ans"
2058                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2059                         xxxm="\$ans"
2060                         ans=!
2061                         ;;
2062                 *)
2063                         echo "*** Error -- try again."
2064                         ans=!
2065                         ;;
2066                 esac
2067                 $myecho
2068                 ;;
2069         esac
2070         case "\$ans\$xxxm\$nostick" in
2071         '')
2072                 ans=!
2073                 $myecho
2074                 ;;
2075         esac
2076 done
2077 case "\$ans" in
2078 '') ans="\$xxxm";;
2079 esac
2080 EOSC
2081
2082 : create .config dir to save info across Configure sessions
2083 test -d ../.config || mkdir ../.config
2084 cat >../.config/README <<EOF
2085 This directory created by Configure to save information that should
2086 persist across sessions for $package.
2087
2088 You may safely delete it if you wish.
2089 EOF
2090
2091 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2092 case "$usedevel" in
2093 $define|true|[yY]*) ;;
2094 *) case "$xversion" in
2095    *[13579])
2096         cat >&4 <<EOH
2097 *** WHOA THERE!!! ***
2098
2099     This is an UNSTABLE DEVELOPMENT release.
2100     The version of this $package distribution is $xversion, that is, odd,
2101     (as opposed to even) and that signifies a development release.
2102     If you want a maintenance release, you want an even-numbered version.
2103
2104     Do ***NOT*** install this into production use.
2105     Data corruption and crashes are possible.
2106
2107     It is most seriously suggested that you do not continue any further
2108     unless you want to help in developing and debugging Perl.
2109
2110     If you *still* want to build perl, you can answer 'y' now,
2111     or pass -Dusedevel to Configure.
2112
2113 EOH
2114         rp='Do you really want to continue?'
2115         dflt='n'
2116         . ./myread
2117         case "$ans" in
2118         [yY]) echo >&4 "Okay, continuing."
2119               usedevel="$define" ;;
2120         *) echo >&4 "Okay, bye."
2121            exit 1
2122            ;;
2123         esac
2124         ;;
2125     esac
2126     ;;
2127 esac
2128 case "$usedevel" in
2129 $define|true|[yY]*)
2130         case "$versiononly" in
2131         '') versiononly="$define" ;;
2132         esac
2133         case "$installusrbinperl" in
2134         '') installusrbinperl="$undef" ;;
2135         esac
2136         ;;
2137 esac
2138
2139 : general instructions
2140 needman=true
2141 firsttime=true
2142 user=`(logname) 2>/dev/null`
2143 case "$user" in
2144 '') user=`whoami 2>&1`;;
2145 esac
2146 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2147         firsttime=false
2148         echo " "
2149         rp='Would you like to see the instructions?'
2150         dflt=n
2151         . ./myread
2152         case "$ans" in
2153         [yY]*) ;;
2154         *) needman=false;;
2155         esac
2156 fi
2157 if $needman; then
2158         cat <<EOH
2159
2160 This installation shell script will examine your system and ask you questions
2161 to determine how the perl5 package should be installed. If you get
2162 stuck on a question, you may use a ! shell escape to start a subshell or
2163 execute a command.  Many of the questions will have default answers in square
2164 brackets; typing carriage return will give you the default.
2165
2166 On some of the questions which ask for file or directory names you are allowed
2167 to use the ~name construct to specify the login directory belonging to "name",
2168 even if you don't have a shell which knows about that.  Questions where this is
2169 allowed will be marked "(~name ok)".
2170
2171 EOH
2172         rp=''
2173         dflt='Type carriage return to continue'
2174         . ./myread
2175         cat <<'EOH'
2176
2177 The prompter used in this script allows you to use shell variables and
2178 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2179 in the default answer, as if the default line was a set of arguments given to a
2180 script shell.  This means you may also use $* to repeat the whole default line,
2181 so you do not have to re-type everything to add something to the default.
2182
2183 Everytime there is a substitution, you will have to confirm.  If there is an
2184 error (e.g. an unmatched backtick), the default answer will remain unchanged
2185 and you will be prompted again.
2186
2187 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2188 the questions and use the computed defaults (or the previous answers if there
2189 was already a config.sh file). Type 'Configure -h' for a list of options.
2190 You may also start interactively and then answer '& -d' at any prompt to turn
2191 on the non-interactive behaviour for the remainder of the execution.
2192
2193 EOH
2194         . ./myread
2195         cat <<EOH
2196
2197 Much effort has been expended to ensure that this shell script will run on any
2198 Unix system.  If despite that it blows up on yours, your best bet is to edit
2199 Configure and run it again.  If you can't run Configure for some reason,
2200 you'll have to generate a config.sh file by hand.  Whatever problems you
2201 have, let me (perlbug@perl.org) know how I blew it.
2202
2203 This installation script affects things in two ways:
2204
2205 1) it may do direct variable substitutions on some of the files included
2206    in this kit.
2207 2) it builds a config.h file for inclusion in C programs.  You may edit
2208    any of these files as the need arises after running this script.
2209
2210 If you make a mistake on a question, there is no easy way to back up to it
2211 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2212 files.  Configure will offer to let you do this before it runs the SH files.
2213
2214 EOH
2215         dflt='Type carriage return to continue'
2216         . ./myread
2217         case "$firsttime" in
2218         true) echo $user >>../.config/instruct;;
2219         esac
2220 fi
2221
2222 : find out where common programs are
2223 echo " "
2224 echo "Locating common programs..." >&4
2225 cat <<EOSC >loc
2226 $startsh
2227 case \$# in
2228 0) exit 1;;
2229 esac
2230 thing=\$1
2231 shift
2232 dflt=\$1
2233 shift
2234 for dir in \$*; do
2235         case "\$thing" in
2236         .)
2237         if test -d \$dir/\$thing; then
2238                 echo \$dir
2239                 exit 0
2240         fi
2241         ;;
2242         *)
2243         for thisthing in \$dir/\$thing; do
2244                 : just loop through to pick last item
2245         done
2246         if test -f \$thisthing; then
2247                 echo \$thisthing
2248                 exit 0
2249         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2250                 echo \$thisthing
2251                 exit 0
2252         elif test -f \$dir/\$thing.exe; then
2253                 if test -n "$DJGPP"; then
2254                         echo \$dir/\$thing.exe
2255                 elif test "$eunicefix" != ":"; then
2256                         : on Eunice apparently
2257                         echo \$dir/\$thing
2258                         exit 0
2259                 fi
2260                 exit 0
2261         fi
2262         ;;
2263         esac
2264 done
2265 echo \$dflt
2266 exit 1
2267 EOSC
2268 chmod +x loc
2269 $eunicefix loc
2270 loclist="
2271 awk
2272 cat
2273 chmod
2274 comm
2275 cp
2276 echo
2277 expr
2278 grep
2279 ls
2280 mkdir
2281 rm
2282 sed
2283 sort
2284 touch
2285 tr
2286 uniq
2287 "
2288 trylist="
2289 Mcc
2290 ar
2291 bison
2292 byacc
2293 cpp
2294 csh
2295 date
2296 egrep
2297 gmake
2298 gzip
2299 less
2300 ln
2301 make
2302 more
2303 nm
2304 nroff
2305 pg
2306 test
2307 uname
2308 zip
2309 "
2310 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2311 pth="$pth /lib /usr/lib"
2312 for file in $loclist; do
2313         eval xxx=\$$file
2314         case "$xxx" in
2315         /*|?:[\\/]*)
2316                 if test -f "$xxx"; then
2317                         : ok
2318                 else
2319                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2320                         xxx=`./loc $file $file $pth`
2321                 fi
2322                 ;;
2323         '') xxx=`./loc $file $file $pth`;;
2324         *) xxx=`./loc $xxx $xxx $pth`;;
2325         esac
2326         eval $file=$xxx$_exe
2327         eval _$file=$xxx
2328         case "$xxx" in
2329         /*)
2330                 echo $file is in $xxx.
2331                 ;;
2332         ?:[\\/]*)
2333                 echo $file is in $xxx.
2334                 ;;
2335         *)
2336                 echo "I don't know where '$file' is, and my life depends on it." >&4
2337                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2338                 exit 1
2339                 ;;
2340         esac
2341 done
2342 echo " "
2343 echo "Don't worry if any of the following aren't found..."
2344 say=offhand
2345 for file in $trylist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't see $file out there, $say."
2370                 say=either
2371                 ;;
2372         esac
2373 done
2374 case "$egrep" in
2375 egrep)
2376         echo "Substituting grep for egrep."
2377         egrep=$grep
2378         _egrep=$grep
2379         ;;
2380 esac
2381 case "$ln" in
2382 ln)
2383         echo "Substituting cp for ln."
2384         ln=$cp
2385         _ln=$cp
2386         ;;
2387 esac
2388 case "$make" in
2389 make)   
2390         case "$gmake" in
2391         gmake)
2392         echo "I can't find make or gmake, and my life depends on it." >&4
2393         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2394         exit 1
2395         ;;
2396         esac
2397         ;;
2398 esac    
2399 case "$gmake" in
2400 gmake)  ;;
2401 *)      # We can't have osname yet.
2402         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2403                 # Assume that gmake, if found, is definitely GNU make
2404                 # and prefer it over the system make.
2405                 echo "Substituting gmake for make."
2406                 make=$gmake
2407                 _make=$gmake
2408         fi
2409         ;;
2410 esac
2411 case "$test" in
2412 test)
2413         echo "Hopefully test is built into your sh."
2414         ;;
2415 *)
2416         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2417                 echo "Using the test built into your sh."
2418                 test=test
2419                 _test=test
2420         fi
2421         ;;
2422 esac
2423 case "$echo" in
2424 echo)
2425         echo "Hopefully echo is built into your sh."
2426         ;;
2427 '') ;;
2428 *)
2429         echo " "
2430 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2431         $echo $n "hi there$c" >foo1
2432         echo $n "hi there$c" >foo2
2433         if cmp foo1 foo2 >/dev/null 2>&1; then
2434                 echo "They are compatible.  In fact, they may be identical."
2435         else
2436                 case "$n" in
2437                 '-n') n='' c='\c';;
2438                 *) n='-n' c='';;
2439                 esac
2440                 cat <<FOO
2441 They are not compatible!  You are probably running ksh on a non-USG system.
2442 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2443 have echo built in and we may have to run some Bourne shell scripts.  That
2444 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2445
2446 FOO
2447                 $echo $n "The star should be here-->$c"
2448                 $echo "*"
2449         fi
2450         $rm -f foo1 foo2
2451         ;;
2452 esac
2453
2454 cat <<EOS >trygcc
2455 $startsh
2456 EOS
2457 cat <<'EOSC' >>trygcc
2458 case "$cc" in
2459 '') ;;
2460 *)  $rm -f try try.*
2461     $cat >try.c <<EOM
2462 int main(int argc, char *argv[]) {
2463   return 0;
2464 }
2465 EOM
2466     if $cc -o try $ccflags $ldflags try.c; then
2467        :
2468     else
2469         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2470         despair=yes
2471         trygcc=yes
2472         case "$cc" in
2473         *gcc*) trygcc=no ;;
2474         esac
2475         case "`$cc -v -c try.c 2>&1`" in
2476         *gcc*) trygcc=no ;;
2477         esac
2478         if $test X"$trygcc" = Xyes; then
2479             if gcc -o try -c try.c; then
2480                 echo " "
2481                 echo "You seem to have a working gcc, though." >&4
2482                 rp="Would you like to use it?"
2483                 dflt=y
2484                 if $test -f myread; then
2485                     . ./myread
2486                 else
2487                     if $test -f UU/myread; then
2488                         . ./UU/myread
2489                     else
2490                         echo "Cannot find myread, sorry.  Aborting." >&2
2491                         exit 1
2492                     fi
2493                 fi  
2494                 case "$ans" in
2495                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2496                        if $test -f usethreads.cbu; then
2497                            $cat >&4 <<EOM 
2498
2499 *** However, any setting of the C compiler flags (e.g. for thread support)
2500 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2501 *** (together with e.g. -Dusethreads).
2502
2503 EOM
2504                        fi;;
2505                 esac
2506             fi
2507         fi
2508     fi
2509     $rm -f try try.*
2510     ;;
2511 esac
2512 EOSC
2513
2514 cat <<EOS >checkcc
2515 $startsh
2516 EOS
2517 cat <<'EOSC' >>checkcc
2518 case "$cc" in        
2519 '') ;;
2520 *)  $rm -f try try.*              
2521     $cat >try.c <<EOM
2522 int main(int argc, char *argv[]) {
2523   return 0;
2524 }
2525 EOM
2526     if $cc -o try $ccflags $ldflags try.c; then
2527        :
2528     else
2529         if $test X"$despair" = Xyes; then
2530            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2531         fi
2532         $cat >&4 <<EOM         
2533 You need to find a working C compiler.
2534 Either (purchase and) install the C compiler supplied by your OS vendor,
2535 or for a free C compiler try http://gcc.gnu.org/
2536 I cannot continue any further, aborting.
2537 EOM
2538         exit 1
2539     fi
2540     $rm -f try try.*
2541     ;;
2542 esac
2543 EOSC
2544
2545 : determine whether symbolic links are supported
2546 echo " "
2547 $touch blurfl
2548 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2549         echo "Symbolic links are supported." >&4
2550         lns="$ln -s"
2551 else
2552         echo "Symbolic links are NOT supported." >&4
2553         lns="$ln"
2554 fi
2555 $rm -f blurfl sym
2556
2557 : determine whether symbolic links are supported
2558 echo " "
2559 case "$lns" in
2560 *"ln"*" -s")
2561         echo "Checking how to test for symbolic links..." >&4
2562         $lns blurfl sym
2563         if $test "X$issymlink" = X; then
2564                 case "$newsh" in
2565                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2567                 esac
2568                 if test $? = 0; then
2569                         issymlink="test -h"
2570                 else
2571                         echo "Your builtin 'test -h' may be broken." >&4
2572                         case "$test" in
2573                         /*)     ;;
2574                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2575                                 for p in $pth
2576                                 do
2577                                         if test -f "$p/$test"; then
2578                                                 test="$p/$test"
2579                                                 break
2580                                         fi
2581                                 done
2582                                 ;;
2583                         esac
2584                         case "$test" in
2585                         /*)
2586                                 echo "Trying external '$test -h'." >&4
2587                                 issymlink="$test -h"
2588                                 if $test ! -h sym >/dev/null 2>&1; then
2589                                         echo "External '$test -h' is broken, too." >&4
2590                                         issymlink=''
2591                                 fi
2592                                 ;;
2593                         *)      issymlink='' ;;
2594                         esac
2595                 fi              
2596         fi
2597         if $test "X$issymlink" = X; then
2598                 if $test -L sym 2>/dev/null; then
2599                         issymlink="$test -L"
2600                         echo "The builtin '$test -L' worked." >&4
2601                 fi
2602         fi
2603         if $test "X$issymlink" != X; then
2604                 echo "You can test for symbolic links with '$issymlink'." >&4
2605         else
2606                 echo "I do not know how you can test for symbolic links." >&4
2607         fi
2608         $rm -f blurfl sym
2609         ;;
2610 *)      echo "No symbolic links, so not testing for their testing..." >&4
2611         ;;
2612 esac
2613 echo " "
2614
2615
2616 case "$mksymlinks" in
2617 $define|true|[yY]*)
2618         case "$src" in
2619         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2620                 exit 1
2621                 ;;
2622         *)      case "$lns:$issymlink" in
2623                 *"ln"*" -s:"*"test -"?)
2624                         echo "Creating the symbolic links..." >&4
2625                         echo "(First creating the subdirectories...)" >&4
2626                         cd ..
2627                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2628                                 read directory
2629                                 test -z "$directory" && break
2630                                 mkdir -p $directory
2631                         done
2632                         # Sanity check 1.
2633                         if test ! -d t/base; then
2634                                 echo "Failed to create the subdirectories.  Aborting." >&4
2635                                 exit 1
2636                         fi
2637                         echo "(Then creating the symlinks...)" >&4
2638                         awk '{print $1}' $src/MANIFEST | while true; do
2639                                 read filename
2640                                 test -z "$filename" && break
2641                                 if test -f $filename; then
2642                                         if $issymlink $filename; then
2643                                                 rm -f $filename
2644                                         fi
2645                                 fi
2646                                 if test -f $filename; then
2647                                         echo "$filename already exists, not symlinking."
2648                                 else
2649                                         ln -s $src/$filename $filename
2650                                 fi
2651                         done
2652                         # Sanity check 2.
2653                         if test ! -f t/base/lex.t; then
2654                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2655                                 exit 1
2656                         fi
2657                         cd UU
2658                         ;;
2659                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2660                         ;;
2661                 esac
2662                 ;;
2663         esac
2664         ;;
2665 esac
2666
2667
2668 case "$usecrosscompile" in
2669 $define|true|[yY]*)
2670         $echo "Cross-compiling..."
2671         croak=''
2672         case "$cc" in
2673         *-*-gcc) # A cross-compiling gcc, probably.
2674             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2675             ar=$targetarch-ar
2676             # leave out ld, choosing it is more complex
2677             nm=$targetarch-nm
2678             ranlib=$targetarch-ranlib
2679             $echo 'extern int foo;' > try.c
2680             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2681             shift
2682             if $test $# -gt 0; then
2683                 incpth="$incpth $*"
2684                 incpth="`$echo $incpth|$sed 's/^ //'`"
2685                 echo "Guessing incpth '$incpth'." >&4
2686                 for i in $*; do
2687                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2688                     if $test -d $j; then
2689                         libpth="$libpth $j"
2690                     fi
2691                 done   
2692                 libpth="`$echo $libpth|$sed 's/^ //'`"
2693                 echo "Guessing libpth '$libpth'." >&4
2694             fi
2695             $rm -f try.c
2696             ;;
2697         esac
2698         case "$targetarch" in
2699         '') echo "Targetarch not defined." >&4; croak=y ;;
2700         *)  echo "Using targetarch $targetarch." >&4 ;;
2701         esac
2702         case "$incpth" in
2703         '') echo "Incpth not defined." >&4; croak=y ;;
2704         *)  echo "Using incpth '$incpth'." >&4 ;;
2705         esac
2706         case "$libpth" in
2707         '') echo "Libpth not defined." >&4; croak=y ;;
2708         *)  echo "Using libpth '$libpth'." >&4 ;;
2709         esac
2710         case "$usrinc" in
2711         '') for i in $incpth; do
2712                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2713                     usrinc=$i
2714                     echo "Guessing usrinc $usrinc." >&4
2715                     break
2716                 fi
2717             done
2718             case "$usrinc" in
2719             '') echo "Usrinc not defined." >&4; croak=y ;;
2720             esac
2721             ;;
2722         *)  echo "Using usrinc $usrinc." >&4 ;;
2723         esac
2724         case "$targethost" in
2725         '') echo "Targethost not defined." >&4; croak=y ;;
2726         *)  echo "Using targethost $targethost." >&4
2727         esac
2728         locincpth=' '
2729         loclibpth=' '
2730         case "$croak" in
2731         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2732         esac
2733         case "$src" in
2734         /*) run=$src/Cross/run
2735             targetmkdir=$src/Cross/mkdir
2736             to=$src/Cross/to
2737             from=$src/Cross/from
2738             ;;
2739         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2740             run=$pwd/Cross/run
2741             targetmkdir=$pwd/Cross/mkdir
2742             to=$pwd/Cross/to
2743             from=$pwd/Cross/from
2744             ;;
2745         esac
2746         case "$targetrun" in
2747         '') targetrun=ssh ;;
2748         esac
2749         case "$targetto" in
2750         '') targetto=scp ;;
2751         esac
2752         case "$targetfrom" in
2753         '') targetfrom=scp ;;
2754         esac
2755         run=$run-$targetrun
2756         to=$to-$targetto
2757         from=$from-$targetfrom
2758         case "$targetdir" in
2759         '')  targetdir=/tmp
2760              echo "Guessing targetdir $targetdir." >&4
2761              ;;
2762         esac
2763         case "$targetuser" in
2764         '')  targetuser=root
2765              echo "Guessing targetuser $targetuser." >&4
2766              ;;
2767         esac
2768         case "$targetfrom" in
2769         scp)    q=-q ;;
2770         *)      q='' ;;
2771         esac
2772         case "$targetrun" in
2773         ssh|rsh)
2774             cat >$run <<EOF
2775 #!/bin/sh
2776 case "\$1" in
2777 -cwd)
2778   shift
2779   cwd=\$1
2780   shift
2781   ;;
2782 esac
2783 case "\$cwd" in
2784 '') cwd=$targetdir ;;
2785 esac
2786 exe=\$1
2787 shift
2788 if $test ! -f \$exe.xok; then
2789   $to \$exe
2790   $touch \$exe.xok
2791 fi
2792 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2793 EOF
2794             ;;
2795         *)  echo "Unknown targetrun '$targetrun'" >&4
2796             exit 1
2797             ;;
2798         esac
2799         case "$targetmkdir" in
2800         */Cross/mkdir)
2801             cat >$targetmkdir <<EOF
2802 #!/bin/sh
2803 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2804 EOF
2805             $chmod a+rx $targetmkdir
2806             ;;
2807         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2808             exit 1
2809             ;;
2810         esac
2811         case "$targetto" in
2812         scp|rcp)
2813             cat >$to <<EOF
2814 #!/bin/sh
2815 for f in \$@
2816 do
2817   case "\$f" in
2818   /*)
2819     $targetmkdir \`dirname \$f\`
2820     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2821     ;;
2822   *)
2823     $targetmkdir $targetdir/\`dirname \$f\`
2824     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2825     ;;
2826   esac
2827 done
2828 exit 0
2829 EOF
2830             ;;
2831         cp) cat >$to <<EOF
2832 #!/bin/sh
2833 for f in \$@
2834 do
2835   case "\$f" in
2836   /*)
2837     $mkdir -p $targetdir/\`dirname \$f\`
2838     $cp \$f $targetdir/\$f || exit 1
2839     ;;
2840   *)
2841     $targetmkdir $targetdir/\`dirname \$f\`
2842     $cp \$f $targetdir/\$f || exit 1
2843     ;;
2844   esac
2845 done
2846 exit 0
2847 EOF
2848             ;;
2849         *)  echo "Unknown targetto '$targetto'" >&4
2850             exit 1
2851             ;;
2852         esac
2853         case "$targetfrom" in
2854         scp|rcp)
2855           cat >$from <<EOF
2856 #!/bin/sh
2857 for f in \$@
2858 do
2859   $rm -f \$f
2860   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2861 done
2862 exit 0
2863 EOF
2864             ;;
2865         cp) cat >$from <<EOF
2866 #!/bin/sh
2867 for f in \$@
2868 do
2869   $rm -f \$f
2870   cp $targetdir/\$f . || exit 1
2871 done
2872 exit 0
2873 EOF
2874             ;;
2875         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2876             exit 1
2877             ;;
2878         esac
2879         if $test ! -f $run; then
2880             echo "Target 'run' script '$run' not found." >&4
2881         else
2882             $chmod a+rx $run
2883         fi
2884         if $test ! -f $to; then
2885             echo "Target 'to' script '$to' not found." >&4
2886         else
2887             $chmod a+rx $to
2888         fi
2889         if $test ! -f $from; then
2890             echo "Target 'from' script '$from' not found." >&4
2891         else
2892             $chmod a+rx $from
2893         fi
2894         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2895             exit 1
2896         fi
2897         cat >&4 <<EOF
2898 Using '$run' for remote execution,
2899 and '$from' and '$to'
2900 for remote file transfer.
2901 EOF
2902         ;;
2903 *)      run=''
2904         to=:
2905         from=:
2906         usecrosscompile='undef'
2907         targetarch=''
2908         ;;
2909 esac
2910
2911 : see whether [:lower:] and [:upper:] are supported character classes
2912 echo " "
2913 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2914 ABYZ)
2915         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2916         up='[:upper:]'
2917         low='[:lower:]'
2918         ;;
2919 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2920         # (0xd9 and 0xe2), therefore that is a nice testing point.
2921         if test "X$up" = X -o "X$low" = X; then
2922             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2923             rs) up='[A-Z]'
2924                 low='[a-z]'
2925                 ;;
2926             esac
2927         fi
2928         if test "X$up" = X -o "X$low" = X; then
2929             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2930             rs) up='A-Z'
2931                 low='a-z'
2932                 ;;
2933             esac
2934         fi
2935         if test "X$up" = X -o "X$low" = X; then
2936             case "`echo RS | od -x 2>/dev/null`" in
2937             *D9E2*|*d9e2*)
2938                 echo "Hey, this might be EBCDIC." >&4
2939                 if test "X$up" = X -o "X$low" = X; then
2940                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2941                     rs) up='[A-IJ-RS-Z]'
2942                         low='[a-ij-rs-z]'
2943                         ;;
2944                     esac
2945                 fi
2946                 if test "X$up" = X -o "X$low" = X; then
2947                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2948                     rs) up='A-IJ-RS-Z'
2949                         low='a-ij-rs-z'
2950                         ;;
2951                     esac
2952                 fi
2953                 ;;
2954             esac
2955         fi
2956 esac
2957 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2958 rs)
2959     echo "Using $up and $low to convert case." >&4
2960     ;;
2961 *)
2962     echo "I don't know how to translate letters from upper to lower case." >&4
2963     echo "Your tr is not acting any way I know of." >&4
2964     exit 1
2965     ;;
2966 esac
2967 : set up the translation script tr, must be called with ./tr of course
2968 cat >tr <<EOSC
2969 $startsh
2970 case "\$1\$2" in
2971 '[A-Z][a-z]') exec $tr '$up' '$low';;
2972 '[a-z][A-Z]') exec $tr '$low' '$up';;
2973 esac
2974 exec $tr "\$@"
2975 EOSC
2976 chmod +x tr
2977 $eunicefix tr
2978
2979 : Try to determine whether config.sh was made on this system
2980 case "$config_sh" in
2981 '')
2982 myuname=`$uname -a 2>/dev/null`
2983 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2984 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2985 # because the A-Z/a-z are not consecutive.
2986 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2987         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2988 newmyuname="$myuname"
2989 dflt=n
2990 case "$knowitall" in
2991 '')
2992         if test -f ../config.sh; then
2993                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2994                         eval "`grep myuname= ../config.sh`"
2995                 fi
2996                 if test "X$myuname" = "X$newmyuname"; then
2997                         dflt=y
2998                 fi
2999         fi
3000         ;;
3001 *) dflt=y;;
3002 esac
3003
3004 : Get old answers from old config file if Configure was run on the
3005 : same system, otherwise use the hints.
3006 hint=default
3007 cd ..
3008 if test -f config.sh; then
3009         echo " "
3010         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3011         . UU/myread
3012         case "$ans" in
3013         n*|N*) echo "OK, I'll ignore it."
3014                 mv config.sh config.sh.old
3015                 myuname="$newmyuname"
3016                 ;;
3017         *)  echo "Fetching default answers from your old config.sh file..." >&4
3018                 tmp_n="$n"
3019                 tmp_c="$c"
3020                 tmp_sh="$sh"
3021                 . ./config.sh
3022                 cp config.sh UU
3023                 n="$tmp_n"
3024                 c="$tmp_c"
3025                 : Older versions did not always set $sh.  Catch re-use of such
3026                 : an old config.sh.
3027                 case "$sh" in
3028                 '') sh="$tmp_sh" ;;
3029                 esac
3030                 hint=previous
3031                 ;;
3032         esac
3033 fi
3034 . ./UU/checkcc
3035 if test ! -f config.sh; then
3036         $cat <<EOM
3037
3038 First time through, eh?  I have some defaults handy for some systems
3039 that need some extra help getting the Configure answers right:
3040
3041 EOM
3042         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3043         dflt=''
3044         : Half the following guesses are probably wrong... If you have better
3045         : tests or hints, please send them to perlbug@perl.org
3046         : The metaconfig authors would also appreciate a copy...
3047         $test -f /irix && osname=irix
3048         $test -f /xenix && osname=sco_xenix
3049         $test -f /dynix && osname=dynix
3050         $test -f /dnix && osname=dnix
3051         $test -f /lynx.os && osname=lynxos
3052         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3053         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3055         $test -f /bin/mips && /bin/mips && osname=mips
3056         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3057                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3058         $test -d /usr/apollo/bin && osname=apollo
3059         $test -f /etc/saf/_sactab && osname=svr4
3060         $test -d /usr/include/minix && osname=minix
3061         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3062         if $test -d /MachTen -o -d /MachTen_Folder; then
3063                 osname=machten
3064                 if $test -x /sbin/version; then
3065                         osvers=`/sbin/version | $awk '{print $2}' |
3066                         $sed -e 's/[A-Za-z]$//'`
3067                 elif $test -x /usr/etc/version; then
3068                         osvers=`/usr/etc/version | $awk '{print $2}' |
3069                         $sed -e 's/[A-Za-z]$//'`
3070                 else
3071                         osvers="$2.$3"
3072                 fi
3073         fi
3074
3075         $test -f /sys/posix.dll &&
3076                 $test -f /usr/bin/what &&
3077                 set X `/usr/bin/what /sys/posix.dll` &&
3078                 $test "$3" = UWIN &&
3079                 osname=uwin &&
3080                 osvers="$5"
3081
3082         if $test -f $uname; then
3083                 set X $myuname
3084                 shift
3085
3086                 case "$5" in
3087                 fps*) osname=fps ;;
3088                 mips*)
3089                         case "$4" in
3090                         umips) osname=umips ;;
3091                         *) osname=mips ;;
3092                         esac;;
3093                 [23]100) osname=mips ;;
3094                 next*) osname=next ;;
3095                 i386*)
3096                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3097                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3098                                 osname='sco'
3099                                 osvers=$tmp
3100                         elif $test -f /etc/kconfig; then
3101                                 osname=isc
3102                                 if test "$lns" = "$ln -s"; then
3103                                         osvers=4
3104                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3105                                         osvers=3
3106                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3107                                         osvers=2
3108                                 fi
3109                         fi
3110                         tmp=''
3111                         ;;
3112                 pc*)
3113                         if test -n "$DJGPP"; then
3114                                 osname=dos
3115                                 osvers=djgpp
3116                         fi
3117                         ;;
3118                 esac
3119
3120                 case "$1" in
3121                 aix) osname=aix
3122                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3123                         case "$tmp" in
3124                         # oslevel can fail with:
3125                         # oslevel: Unable to acquire lock.
3126                         *not\ found) osvers="$4"."$3" ;;
3127                         '<3240'|'<>3240') osvers=3.2.0 ;;
3128                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3129                         '=3250'|'>3250') osvers=3.2.5 ;;
3130                         *) osvers=$tmp;;
3131                         esac
3132                         ;;
3133                 bsd386) osname=bsd386
3134                         osvers=`$uname -r`
3135                         ;;
3136                 cygwin*) osname=cygwin
3137                         osvers="$3"
3138                         ;;
3139                 *dc.osx) osname=dcosx
3140                         osvers="$3"
3141                         ;;
3142                 dnix) osname=dnix
3143                         osvers="$3"
3144                         ;;
3145                 domainos) osname=apollo
3146                         osvers="$3"
3147                         ;;
3148                 dgux)   osname=dgux
3149                         osvers="$3"
3150                         ;;
3151                 dragonfly) osname=dragonfly
3152                         osvers="$3"
3153                         ;;
3154                 dynixptx*) osname=dynixptx
3155                         osvers=`echo "$4"|sed 's/^v//'`
3156                         ;;
3157                 freebsd) osname=freebsd
3158                         osvers="$3" ;;
3159                 genix)  osname=genix ;;
3160                 gnu)    osname=gnu
3161                         osvers="$3" ;;
3162                 hp*)    osname=hpux
3163                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3164                         ;;
3165                 irix*)  osname=irix
3166                         case "$3" in
3167                         4*) osvers=4 ;;
3168                         5*) osvers=5 ;;
3169                         *)      osvers="$3" ;;
3170                         esac
3171                         ;;
3172                 linux)  osname=linux
3173                         case "$3" in
3174                         *)      osvers="$3" ;;
3175                         esac
3176                         ;;
3177                 MiNT)   osname=mint
3178                         ;;
3179                 netbsd*) osname=netbsd
3180                         osvers="$3"
3181                         ;;
3182                 news-os) osvers="$3"
3183                         case "$3" in
3184                         4*) osname=newsos4 ;;
3185                         *) osname=newsos ;;
3186                         esac
3187                         ;;
3188                 next*) osname=next ;;
3189                 nonstop-ux) osname=nonstopux ;;
3190                 openbsd) osname=openbsd
3191                         osvers="$3"
3192                         ;;
3193                 os2)    osname=os2
3194                         osvers="$4"
3195                         ;;
3196                 POSIX-BC | posix-bc ) osname=posix-bc
3197                         osvers="$3"
3198                         ;;
3199                 powerux | power_ux | powermax_os | powermaxos | \
3200                 powerunix | power_unix) osname=powerux
3201                         osvers="$3"
3202                         ;;
3203                 qnx) osname=qnx
3204                         osvers="$4"
3205                         ;;
3206                 solaris) osname=solaris
3207                         case "$3" in
3208                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3209                         *)      osvers="$3" ;;
3210                         esac
3211                         ;;
3212                 sunos) osname=sunos
3213                         case "$3" in
3214                         5*) osname=solaris
3215                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3216                         *)      osvers="$3" ;;
3217                         esac
3218                         ;;
3219                 titanos) osname=titanos
3220                         case "$3" in
3221                         1*) osvers=1 ;;
3222                         2*) osvers=2 ;;
3223                         3*) osvers=3 ;;
3224                         4*) osvers=4 ;;
3225                         *)      osvers="$3" ;;
3226                         esac
3227                         ;;
3228                 ultrix) osname=ultrix
3229                         osvers="$3"
3230                         ;;
3231                 osf1|mls+)      case "$5" in
3232                                 alpha)
3233                                         osname=dec_osf
3234                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3235                                         case "$osvers" in
3236                                         [1-9].[0-9]*) ;;
3237                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3238                                         esac
3239                                         ;;
3240                         hp*)    osname=hp_osf1  ;;
3241                         mips)   osname=mips_osf1 ;;
3242                         esac
3243                         ;;
3244                 # UnixWare 7.1.2 is known as Open UNIX 8
3245                 openunix|unixware) osname=svr5
3246                         osvers="$4"
3247                         ;;
3248                 uts)    osname=uts
3249                         osvers="$3"
3250                         ;;
3251                 vos) osvers="$3"
3252                         ;;
3253                 $2) case "$osname" in
3254                         *isc*) ;;
3255                         *freebsd*) ;;
3256                         svr*)
3257                                 : svr4.x or possibly later
3258                                 case "svr$3" in
3259                                 ${osname}*)
3260                                         osname=svr$3
3261                                         osvers=$4
3262                                         ;;
3263                                 esac
3264                                 case "$osname" in
3265                                 svr4.0)
3266                                         : Check for ESIX
3267                                         if test -f /stand/boot ; then
3268                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3269                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3270                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3271                                                         if test -n "$isesix"; then
3272                                                                 osname=esix4
3273                                                         fi
3274                                                 fi
3275                                         fi
3276                                         ;;
3277                                 esac
3278                                 ;;
3279                         *)      if test -f /etc/systemid; then
3280                                         osname=sco
3281                                         set `echo $3 | $sed 's/\./ /g'` $4
3282                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3283                                                 osvers=$1.$2.$3
3284                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3285                                                 osvers=$1.$2
3286                                         elif $test -f $src/hints/sco_$1.sh; then
3287                                                 osvers=$1
3288                                         fi
3289                                 else
3290                                         case "$osname" in
3291                                         '') : Still unknown.  Probably a generic Sys V.
3292                                                 osname="sysv"
3293                                                 osvers="$3"
3294                                                 ;;
3295                                         esac
3296                                 fi
3297                                 ;;
3298                         esac
3299                         ;;
3300                 *)      case "$osname" in
3301                         '') : Still unknown.  Probably a generic BSD.
3302                                 osname="$1"
3303                                 osvers="$3"
3304                                 ;;
3305                         esac
3306                         ;;
3307                 esac
3308         else
3309                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3310                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3311                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3312                                 osname=news_os
3313                         fi
3314                         $rm -f UU/kernel.what
3315                 elif test -d c:/. -o -n "$is_os2" ; then
3316                         set X $myuname
3317                         osname=os2
3318                         osvers="$5"
3319                 fi
3320         fi
3321
3322         case "$targetarch" in
3323         '') ;;
3324         *)  hostarch=$osname
3325             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3326             osvers=''
3327             ;;
3328         esac
3329
3330         : Now look for a hint file osname_osvers, unless one has been
3331         : specified already.
3332         case "$hintfile" in
3333         ''|' ')
3334                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3335                 : Also try without trailing minor version numbers.
3336                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3337                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3339                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3340                 case "$file" in
3341                 '') dflt=none ;;
3342                 *)  case "$osvers" in
3343                         '') dflt=$file
3344                                 ;;
3345                         *)  if $test -f $src/hints/$file.sh ; then
3346                                         dflt=$file
3347                                 elif $test -f $src/hints/$xfile.sh ; then
3348                                         dflt=$xfile
3349                                 elif $test -f $src/hints/$xxfile.sh ; then
3350                                         dflt=$xxfile
3351                                 elif $test -f $src/hints/$xxxfile.sh ; then
3352                                         dflt=$xxxfile
3353                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3354                                         dflt=$xxxxfile
3355                                 elif $test -f "$src/hints/${osname}.sh" ; then
3356                                         dflt="${osname}"
3357                                 else
3358                                         dflt=none
3359                                 fi
3360                                 ;;
3361                         esac
3362                         ;;
3363                 esac
3364                 if $test -f Policy.sh ; then
3365                         case "$dflt" in
3366                         *Policy*) ;;
3367                         none) dflt="Policy" ;;
3368                         *) dflt="Policy $dflt" ;;
3369                         esac
3370                 fi
3371                 ;;
3372         *)
3373                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3374                 ;;
3375         esac
3376
3377         if $test -f Policy.sh ; then
3378                 $cat <<EOM
3379
3380 There's also a Policy hint file available, which should make the
3381 site-specific (policy) questions easier to answer.
3382 EOM
3383
3384         fi
3385
3386         $cat <<EOM
3387
3388 You may give one or more space-separated answers, or "none" if appropriate.
3389 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3390 previous run of Configure, you may specify it as well as or instead of
3391 OS-specific hints.  If hints are provided for your OS, you should use them:
3392 although Perl can probably be built without hints on many platforms, using
3393 hints often improve performance and may enable features that Configure can't
3394 set up on its own. If there are no hints that match your OS, specify "none";
3395 DO NOT give a wrong version or a wrong OS.
3396
3397 EOM
3398
3399         rp="Which of these apply, if any?"
3400         . UU/myread
3401         tans=$ans
3402         for file in $tans; do
3403                 if $test X$file = XPolicy -a -f Policy.sh; then
3404                         . Policy.sh
3405                         $cat Policy.sh >> UU/config.sh
3406                 elif $test -f $src/hints/$file.sh; then
3407                         . $src/hints/$file.sh
3408                         $cat $src/hints/$file.sh >> UU/config.sh
3409                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3410                         : nothing
3411                 else
3412                         : Give one chance to correct a possible typo.
3413                         echo "$file.sh does not exist"
3414                         dflt=$file
3415                         rp="hint to use instead?"
3416                         . UU/myread
3417                         for file in $ans; do
3418                                 if $test -f "$src/hints/$file.sh"; then
3419                                         . $src/hints/$file.sh
3420                                         $cat $src/hints/$file.sh >> UU/config.sh
3421                                 elif $test X$ans = X -o X$ans = Xnone ; then
3422                                         : nothing
3423                                 else
3424                                         echo "$file.sh does not exist -- ignored."
3425                                 fi
3426                         done
3427                 fi
3428         done
3429
3430         hint=recommended
3431         : Remember our hint file for later.
3432         if $test -f "$src/hints/$file.sh" ; then
3433                 hintfile="$file"
3434         else
3435                 hintfile=''
3436         fi
3437 fi
3438 cd UU
3439 ;;
3440 *)
3441         echo " "
3442         echo "Fetching default answers from $config_sh..." >&4
3443         tmp_n="$n"
3444         tmp_c="$c"
3445         cd ..
3446         cp $config_sh config.sh 2>/dev/null
3447         chmod +w config.sh
3448         . ./config.sh
3449         cd UU
3450         cp ../config.sh .
3451         n="$tmp_n"
3452         c="$tmp_c"
3453         hint=previous
3454         ;;
3455 esac
3456 test "$override" && . ./optdef.sh
3457
3458 : Restore computed paths
3459 for file in $loclist $trylist; do
3460         eval $file="\$_$file"
3461 done
3462
3463 cat << EOM
3464
3465 Configure uses the operating system name and version to set some defaults.
3466 The default value is probably right if the name rings a bell. Otherwise,
3467 since spelling matters for me, either accept the default or answer "none"
3468 to leave it blank.
3469
3470 EOM
3471 case "$osname" in
3472         ''|' ')
3473                 case "$hintfile" in
3474                 ''|' '|none) dflt=none ;;
3475                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3476                 esac
3477                 ;;
3478         *) dflt="$osname" ;;
3479 esac
3480 rp="Operating system name?"
3481 . ./myread
3482 case "$ans" in
3483 none)  osname='' ;;
3484 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3485 esac
3486 echo " "
3487 case "$osvers" in
3488         ''|' ')
3489                 case "$hintfile" in
3490                 ''|' '|none) dflt=none ;;
3491                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3492                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3493                         case "$dflt" in
3494                         ''|' ') dflt=none ;;
3495                         esac
3496                         ;;
3497                 esac
3498                 ;;
3499         *) dflt="$osvers" ;;
3500 esac
3501 rp="Operating system version?"
3502 . ./myread
3503 case "$ans" in
3504 none)  osvers='' ;;
3505 *) osvers="$ans" ;;
3506 esac
3507
3508
3509 . ./posthint.sh
3510
3511 : who configured the system
3512 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3513 case "$cf_by" in
3514 "")
3515         cf_by=`(logname) 2>/dev/null`
3516         case "$cf_by" in
3517         "")
3518                 cf_by=`(whoami) 2>/dev/null`
3519                 case "$cf_by" in
3520                 "") cf_by=unknown ;;
3521                 esac ;;
3522         esac ;;
3523 esac
3524
3525 : decide how portable to be.  Allow command line overrides.
3526 case "$d_portable" in
3527 "$undef") ;;
3528 *)      d_portable="$define" ;;
3529 esac
3530
3531 : set up shell script to do ~ expansion
3532 cat >filexp <<EOSS
3533 $startsh
3534 : expand filename
3535 case "\$1" in
3536  ~/*|~)
3537         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3538         ;;
3539  ~*)
3540         if $test -f /bin/csh; then
3541                 /bin/csh -f -c "glob \$1"
3542                 failed=\$?
3543                 echo ""
3544                 exit \$failed
3545         else
3546                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3547                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3548                 if $test ! -d "\$dir"; then
3549                         me=\`basename \$0\`
3550                         echo "\$me: can't locate home directory for: \$name" >&2
3551                         exit 1
3552                 fi
3553                 case "\$1" in
3554                 */*)
3555                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3556                         ;;
3557                 *)
3558                         echo \$dir
3559                         ;;
3560                 esac
3561         fi
3562         ;;
3563 *)
3564         echo \$1
3565         ;;
3566 esac
3567 EOSS
3568 chmod +x filexp
3569 $eunicefix filexp
3570
3571 : now set up to get a file name
3572 cat <<EOS >getfile
3573 $startsh
3574 EOS
3575 cat <<'EOSC' >>getfile
3576 tilde=''
3577 fullpath=''
3578 already=''
3579 skip=''
3580 none_ok=''
3581 exp_file=''
3582 nopath_ok=''
3583 orig_rp="$rp"
3584 orig_dflt="$dflt"
3585 case "$gfpth" in
3586 '') gfpth='.' ;;
3587 esac
3588
3589 case "$fn" in
3590 *\(*)
3591         : getfile will accept an answer from the comma-separated list
3592         : enclosed in parentheses even if it does not meet other criteria.
3593         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3594         fn=`echo $fn | sed 's/(.*)//'`
3595         ;;
3596 esac
3597
3598 case "$fn" in
3599 *:*)
3600         loc_file=`expr $fn : '.*:\(.*\)'`
3601         fn=`expr $fn : '\(.*\):.*'`
3602         ;;
3603 esac
3604
3605 case "$fn" in
3606 *~*) tilde=true;;
3607 esac
3608 case "$fn" in
3609 */*) fullpath=true;;
3610 esac
3611 case "$fn" in
3612 *+*) skip=true;;
3613 esac
3614 case "$fn" in
3615 *n*) none_ok=true;;
3616 esac
3617 case "$fn" in
3618 *e*) exp_file=true;;
3619 esac
3620 case "$fn" in
3621 *p*) nopath_ok=true;;
3622 esac
3623
3624 case "$fn" in
3625 *f*) type='File';;
3626 *d*) type='Directory';;
3627 *l*) type='Locate';;
3628 esac
3629
3630 what="$type"
3631 case "$what" in
3632 Locate) what='File';;
3633 esac
3634
3635 case "$exp_file" in
3636 '')
3637         case "$d_portable" in
3638         "$define") ;;
3639         *) exp_file=true;;
3640         esac
3641         ;;
3642 esac
3643
3644 cd ..
3645 while test "$type"; do
3646         redo=''
3647         rp="$orig_rp"
3648         dflt="$orig_dflt"
3649         case "$tilde" in
3650         true) rp="$rp (~name ok)";;
3651         esac
3652         . UU/myread
3653         if test -f UU/getfile.ok && \
3654                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3655         then
3656                 value="$ans"
3657                 ansexp="$ans"
3658                 break
3659         fi
3660         case "$ans" in
3661         none)
3662                 value=''
3663                 ansexp=''
3664                 case "$none_ok" in
3665                 true) type='';;
3666                 esac
3667                 ;;
3668         *)
3669                 case "$tilde" in
3670                 '') value="$ans"
3671                         ansexp="$ans";;
3672                 *)
3673                         value=`UU/filexp $ans`
3674                         case $? in
3675                         0)
3676                                 if test "$ans" != "$value"; then
3677                                         echo "(That expands to $value on this system.)"
3678                                 fi
3679                                 ;;
3680                         *) value="$ans";;
3681                         esac
3682                         ansexp="$value"
3683                         case "$exp_file" in
3684                         '') value="$ans";;
3685                         esac
3686                         ;;
3687                 esac
3688                 case "$fullpath" in
3689                 true)
3690                         case "$ansexp" in
3691                         /*) value="$ansexp" ;;
3692                         [a-zA-Z]:/*) value="$ansexp" ;;
3693                         *)
3694                                 redo=true
3695                                 case "$already" in
3696                                 true)
3697                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3698                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3699                                         ;;
3700                                 *)
3701                                 echo "Please give a full path name, starting with slash." >&4
3702                                         case "$tilde" in
3703                                         true)
3704                                 echo "Note that using ~name is ok provided it expands well." >&4
3705                                                 already=true
3706                                                 ;;
3707                                         esac
3708                                 esac
3709                                 ;;
3710                         esac
3711                         ;;
3712                 esac
3713                 case "$redo" in
3714                 '')
3715                         case "$type" in
3716                         File)
3717                                 for fp in $gfpth; do
3718                                         if test "X$fp" = X.; then
3719                                             pf="$ansexp"
3720                                         else    
3721                                             pf="$fp/$ansexp"
3722                                         fi
3723                                         if test -f "$pf"; then
3724                                                 type=''
3725                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3726                                         then
3727                                                 echo "($value is not a plain file, but that's ok.)"
3728                                                 type=''
3729                                         fi
3730                                         if test X"$type" = X; then
3731                                             value="$pf"
3732                                             break
3733                                         fi
3734                                 done
3735                                 ;;
3736                         Directory)
3737                                 for fp in $gfpth; do
3738                                         if test "X$fp" = X.; then
3739                                             dir="$ans"
3740                                             direxp="$ansexp"
3741                                         else    
3742                                             dir="$fp/$ansexp"
3743                                             direxp="$fp/$ansexp"
3744                                         fi
3745                                         if test -d "$direxp"; then
3746                                                 type=''
3747                                                 value="$dir"
3748                                                 break
3749                                         fi
3750                                 done
3751                                 ;;
3752                         Locate)
3753                                 if test -d "$ansexp"; then
3754                                         echo "(Looking for $loc_file in directory $value.)"
3755                                         value="$value/$loc_file"
3756                                         ansexp="$ansexp/$loc_file"
3757                                 fi
3758                                 if test -f "$ansexp"; then
3759                                         type=''
3760                                 fi
3761                                 case "$nopath_ok" in
3762                                 true)   case "$value" in
3763                                         */*) ;;
3764                                         *)      echo "Assuming $value will be in people's path."
3765                                                 type=''
3766                                                 ;;
3767                                         esac
3768                                         ;;
3769                                 esac
3770                                 ;;
3771                         esac
3772
3773                         case "$skip" in
3774                         true) type='';
3775                         esac
3776
3777                         case "$type" in
3778                         '') ;;
3779                         *)
3780                                 if test "$fastread" = yes; then
3781                                         dflt=y
3782                                 else
3783                                         dflt=n
3784                                 fi
3785                                 rp="$what $value doesn't exist.  Use that name anyway?"
3786                                 . UU/myread
3787                                 dflt=''
3788                                 case "$ans" in
3789                                 y*) type='';;
3790                                 *) echo " ";;
3791                                 esac
3792                                 ;;
3793                         esac
3794                         ;;
3795                 esac
3796                 ;;
3797         esac
3798 done
3799 cd UU
3800 ans="$value"
3801 rp="$orig_rp"
3802 dflt="$orig_dflt"
3803 rm -f getfile.ok
3804 test "X$gfpthkeep" != Xy && gfpth=""
3805 EOSC
3806
3807 : determine root of directory hierarchy where package will be installed.
3808 case "$prefix" in
3809 '')
3810         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3811         ;;
3812 *?/)
3813         dflt=`echo "$prefix" | sed 's/.$//'`
3814         ;;
3815 *)
3816         dflt="$prefix"
3817         ;;
3818 esac
3819 $cat <<EOM
3820
3821 By default, $package will be installed in $dflt/bin, manual pages
3822 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3823 installation directories. Typically this is something like /usr/local.
3824 If you wish to have binaries under /usr/bin but other parts of the
3825 installation under /usr/local, that's ok: you will be prompted
3826 separately for each of the installation directories, the prefix being
3827 only used to set the defaults.
3828
3829 EOM
3830 fn=d~
3831 rp='Installation prefix to use?'
3832 . ./getfile
3833 oldprefix=''
3834 case "$prefix" in
3835 '') ;;
3836 *)
3837         case "$ans" in
3838         "$prefix") ;;
3839         *) oldprefix="$prefix";;
3840         esac
3841         ;;
3842 esac
3843 prefix="$ans"
3844 prefixexp="$ansexp"
3845
3846 case "$afsroot" in
3847 '')     afsroot=/afs ;;
3848 *)      afsroot=$afsroot ;;
3849 esac
3850
3851 : is AFS running?
3852 echo " "
3853 case "$afs" in
3854 $define|true)   afs=true ;;
3855 $undef|false)   afs=false ;;
3856 *)      if test -d $afsroot; then
3857                 afs=true
3858         else
3859                 afs=false
3860         fi
3861         ;;
3862 esac
3863 if $afs; then
3864         echo "AFS may be running... I'll be extra cautious then..." >&4
3865 else
3866         echo "AFS does not seem to be running..." >&4
3867 fi
3868
3869 : determine installation prefix for where package is to be installed.
3870 if $afs; then 
3871 $cat <<EOM
3872
3873 Since you are running AFS, I need to distinguish the directory in which
3874 files will reside from the directory in which they are installed (and from
3875 which they are presumably copied to the former directory by occult means).
3876
3877 EOM
3878         case "$installprefix" in
3879         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3880         *) dflt="$installprefix";;
3881         esac
3882 else
3883 $cat <<EOM
3884
3885 In some special cases, particularly when building $package for distribution,
3886 it is convenient to distinguish the directory in which files should be
3887 installed from the directory ($prefix) in which they will
3888 eventually reside.  For most users, these two directories are the same.
3889
3890 EOM
3891         case "$installprefix" in
3892         '') dflt=$prefix ;;
3893         *) dflt=$installprefix;;
3894         esac
3895 fi
3896 fn=d~
3897 rp='What installation prefix should I use for installing files?'
3898 . ./getfile
3899 installprefix="$ans"
3900 installprefixexp="$ansexp"
3901
3902 : Perform the prefixexp/installprefixexp correction if necessary
3903 cat <<EOS >installprefix
3904 $startsh
3905 EOS
3906 cat <<'EOSC' >>installprefix
3907 : Change installation prefix, if necessary.
3908 if $test X"$prefix" != X"$installprefix"; then
3909     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3910 else
3911     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3912 fi
3913 EOSC
3914 chmod +x installprefix
3915 $eunicefix installprefix
3916
3917 : Set variables such as privlib and privlibexp from the output of ./getfile
3918 : performing the prefixexp/installprefixexp correction if necessary.
3919 cat <<EOS >setprefixvar
3920 $startsh
3921 EOS
3922 cat <<'EOSC' >>setprefixvar
3923 eval "${prefixvar}=\"\$ans\""
3924 eval "${prefixvar}exp=\"\$ansexp\""
3925 . ./installprefix
3926 EOSC
3927 chmod +x setprefixvar
3928 $eunicefix setprefixvar
3929
3930 : set up the script used to warn in case of inconsistency
3931 cat <<EOS >whoa
3932 $startsh
3933 EOS
3934 cat <<'EOSC' >>whoa
3935 dflt=y
3936 echo " "
3937 echo "*** WHOA THERE!!! ***" >&4
3938 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3939 rp="    Keep the $hint value?"
3940 . ./myread
3941 case "$ans" in
3942 y) td=$was; tu=$was;;
3943 esac
3944 EOSC
3945
3946 : function used to set $1 to $val
3947 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3948 case "$val$was" in
3949 $define$undef) . ./whoa; eval "$var=\$td";;
3950 $undef$define) . ./whoa; eval "$var=\$tu";;
3951 *) eval "$var=$val";;
3952 esac'
3953
3954 case "$usesocks" in
3955 $define|true|[yY]*)     dflt='y';;
3956 *) dflt='n';;
3957 esac
3958 cat <<EOM
3959
3960 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3961 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3962 to use the PerlIO abstraction layer, this will be implicitly selected.
3963
3964 If this doesn't make any sense to you, just accept the default '$dflt'.
3965 EOM
3966 rp='Build Perl for SOCKS?'
3967 . ./myread
3968 case "$ans" in
3969 y|Y)    val="$define" ;;     
3970 *)      val="$undef" ;;
3971 esac
3972 set usesocks
3973 eval $setvar
3974
3975 case "$usesocks" in
3976 $define|true|[yY]*) useperlio="$define";;
3977 esac
3978
3979 case "$useperlio" in
3980 $define|true|[yY]*|'')  dflt='y';;
3981 *) dflt='n';;
3982 esac
3983 cat <<EOM
3984
3985 Previous version of $package used the standard IO mechanisms as
3986 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3987 alternate IO mechanisms via the PerlIO abstraction layer, but the
3988 stdio mechanism is still available if needed.  The abstraction layer
3989 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3990 Using PerlIO with sfio may cause problems with some extension modules.
3991
3992 If this doesn't make any sense to you, just accept the default '$dflt'.
3993 EOM
3994 rp='Use the PerlIO abstraction layer?'
3995 . ./myread
3996 case "$ans" in
3997 y|Y) 
3998         val="$define"
3999         ;;
4000 *)      
4001         echo "Ok, doing things the stdio way."
4002         val="$undef"
4003         ;;
4004 esac
4005 set useperlio
4006 eval $setvar 
4007
4008 case "$usesocks" in
4009 $define|true|[yY]*)
4010         case "$useperlio" in
4011         $define|true|[yY]*) ;;
4012         *)      cat >&4 <<EOM
4013
4014 You are using the SOCKS proxy protocol library which means that you
4015 should also use the PerlIO layer.  You may be headed for trouble.
4016
4017 EOM
4018                 ;;
4019         esac
4020         ;;
4021 esac
4022
4023         
4024 case "$usethreads" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *)     # Catch case where user specified ithreads or 5005threads but
4027        # forgot -Dusethreads (A.D. 4/2002)
4028        case "$useithreads$use5005threads" in
4029        *$define*)      
4030                 case "$useperlio" in
4031                 "$define")      dflt='y' ;;
4032                 *)              dflt='n' ;;
4033                 esac
4034                 ;;
4035        *)       dflt='n';;
4036        esac
4037        ;;
4038 esac
4039 cat <<EOM
4040
4041 Perl can be built to take advantage of threads on some systems.
4042 To do so, Configure can be run with -Dusethreads.
4043
4044 Note that Perl built with threading support runs slightly slower
4045 and uses more memory than plain Perl. The current implementation
4046 is believed to be stable, but it is fairly new, and so should be
4047 treated with caution.
4048
4049 If this doesn't make any sense to you, just accept the default '$dflt'.
4050 EOM
4051 rp='Build a threading Perl?'
4052 . ./myread
4053 case "$ans" in
4054 y|Y)    val="$define" ;;
4055 *)      val="$undef" ;;
4056 esac
4057 set usethreads
4058 eval $setvar
4059
4060 case "$usethreads" in
4061 $define)
4062         $cat <<EOM
4063
4064 Since release 5.6, Perl has had two different threading implementations,
4065 the newer interpreter-based version (ithreads) with one interpreter per
4066 thread, and the older 5.005 version (5005threads).
4067 The 5005threads version is effectively unmaintained and will probably be
4068 removed in Perl 5.10, so there should be no need to build a Perl using it
4069 unless needed for backwards compatibility with some existing 5.005threads
4070 code.
4071
4072 EOM
4073         : Default to ithreads unless overridden on command line or with
4074         : old config.sh
4075         dflt='y'
4076         case "$use5005threads" in
4077                 $define|true|[yY]*) dflt='n';;
4078         esac
4079         case "$useithreads" in
4080                 $undef|false|[nN]*) dflt='n';;
4081         esac
4082         rp='Use the newer interpreter-based ithreads?'
4083         . ./myread
4084         case "$ans" in
4085         y|Y)    val="$define" ;;
4086         *)      val="$undef" ;;
4087         esac
4088         set useithreads
4089         eval $setvar
4090         : Now set use5005threads to the opposite value.
4091         case "$useithreads" in
4092         $define) val="$undef" ;;
4093         *) val="$define" ;;
4094         esac
4095         set use5005threads
4096         eval $setvar
4097         ;;
4098 *)
4099         useithreads="$undef"
4100         use5005threads="$undef"
4101         ;;
4102 esac
4103
4104 case "$useithreads$use5005threads" in
4105 "$define$define")
4106         $cat >&4 <<EOM
4107
4108 You cannot have both the ithreads and the 5.005 threads enabled
4109 at the same time.  Disabling the 5.005 threads since they are
4110 much less stable than the ithreads.
4111
4112 EOM
4113         use5005threads="$undef"
4114         ;;
4115 esac
4116
4117 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4118         cat >&4 <<EOF
4119 ***
4120 *** To build with ithreads you must also use the PerlIO layer.
4121 *** Cannot continue, aborting.
4122 ***
4123 EOF
4124         exit 1
4125 fi
4126
4127 case "$d_oldpthreads" in
4128 '')     : Configure tests would be welcome here.  For now, assume undef.
4129         val="$undef" ;;
4130 *)      val="$d_oldpthreads" ;;
4131 esac
4132 set d_oldpthreads
4133 eval $setvar
4134
4135
4136 : Look for a hint-file generated 'call-back-unit'.  If the
4137 : user has specified that a threading perl is to be built,
4138 : we may need to set or change some other defaults.
4139 if $test -f usethreads.cbu; then
4140     echo "Your platform has some specific hints regarding threaded builds, using them..."
4141     . ./usethreads.cbu
4142 else
4143     case "$usethreads" in
4144         "$define"|true|[yY]*)
4145                 $cat <<EOM
4146 (Your platform does not have any specific hints for threaded builds.
4147  Assuming POSIX threads, then.)
4148 EOM
4149         ;;
4150     esac
4151 fi
4152
4153 cat <<EOM
4154
4155 Perl can be built so that multiple Perl interpreters can coexist
4156 within the same Perl executable.
4157 EOM
4158
4159 case "$useithreads" in
4160 $define)
4161         cat <<EOM
4162 This multiple interpreter support is required for interpreter-based threads.
4163 EOM
4164         val="$define"
4165         ;;
4166 *)      case "$usemultiplicity" in
4167         $define|true|[yY]*)     dflt='y';;
4168         *) dflt='n';;
4169         esac
4170         echo " "
4171         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4172         rp='Build Perl for multiplicity?'
4173         . ./myread
4174         case "$ans" in
4175         y|Y)    val="$define" ;;
4176         *)      val="$undef" ;;
4177         esac
4178         ;;
4179 esac
4180 set usemultiplicity
4181 eval $setvar
4182
4183
4184 case "$usemorebits" in
4185 "$define"|true|[yY]*)
4186         use64bitint="$define"
4187         uselongdouble="$define"
4188         usemorebits="$define"
4189         ;;
4190 *)      usemorebits="$undef"
4191         ;;
4192 esac
4193
4194 : make some quick guesses about what we are up against
4195 echo " "
4196 $echo $n "Hmm...  $c"
4197 echo exit 1 >bsd
4198 echo exit 1 >usg
4199 echo exit 1 >v7
4200 echo exit 1 >osf1
4201 echo exit 1 >eunice
4202 echo exit 1 >xenix
4203 echo exit 1 >venix
4204 echo exit 1 >os2
4205 d_bsd="$undef"
4206 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4207 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4208 then
4209         echo "Looks kind of like an OSF/1 system, but we'll see..."
4210         echo exit 0 >osf1
4211 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4212         xxx=`./loc addbib blurfl $pth`
4213         if $test -f $xxx; then
4214         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4215                 echo exit 0 >bsd
4216                 echo exit 0 >usg
4217         else
4218                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4219                         echo "Looks kind of like an extended USG system, but we'll see..."
4220                 else
4221                         echo "Looks kind of like a USG system, but we'll see..."
4222                 fi
4223                 echo exit 0 >usg
4224         fi
4225 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4226         echo "Looks kind of like a BSD system, but we'll see..."
4227         d_bsd="$define"
4228         echo exit 0 >bsd
4229 else
4230         echo "Looks kind of like a Version 7 system, but we'll see..."
4231         echo exit 0 >v7
4232 fi
4233 case "$eunicefix" in
4234 *unixtovms*)
4235         $cat <<'EOI'
4236 There is, however, a strange, musty smell in the air that reminds me of
4237 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4238 EOI
4239         echo exit 0 >eunice
4240         d_eunice="$define"
4241 : it so happens the Eunice I know will not run shell scripts in Unix format
4242         ;;
4243 *)
4244         echo " "
4245         echo "Congratulations.  You aren't running Eunice."
4246         d_eunice="$undef"
4247         ;;
4248 esac
4249 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4250 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4251 : semicolon as a patch separator
4252 case "$p_" in
4253 :) ;;
4254 *)
4255         $cat <<'EOI'
4256 I have the feeling something is not exactly right, however...don't tell me...
4257 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4258 (Or you may be running DOS with DJGPP.)
4259 EOI
4260         echo exit 0 >os2
4261         ;;
4262 esac
4263 if test -f /xenix; then
4264         echo "Actually, this looks more like a XENIX system..."
4265         echo exit 0 >xenix
4266         d_xenix="$define"
4267 else
4268         echo " "
4269         echo "It's not Xenix..."
4270         d_xenix="$undef"
4271 fi
4272 chmod +x xenix
4273 $eunicefix xenix
4274 if test -f /venix; then
4275         echo "Actually, this looks more like a VENIX system..."
4276         echo exit 0 >venix
4277 else
4278         echo " "
4279         if ./xenix; then
4280                 : null
4281         else
4282                 echo "Nor is it Venix..."
4283         fi
4284 fi
4285 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4286 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4287 $rm -f foo
4288
4289 case "$cc" in
4290 '') dflt=cc;;
4291 *) dflt="$cc";;
4292 esac
4293 rp="Use which C compiler?"
4294 . ./myread
4295 cc="$ans"
4296
4297 : See if they have not cc but they do have gcc
4298 . ./trygcc
4299 : Look for a hint-file generated 'call-back-unit'.  Now that the
4300 : user has specified the compiler, we may need to set or change some
4301 : other defaults.
4302 if $test -f cc.cbu; then
4303     . ./cc.cbu
4304 fi
4305 . ./checkcc
4306
4307 echo " "
4308 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4309 $cat >try.c <<EOM
4310 #include <stdio.h>
4311 int main() {
4312 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4313 #ifdef __VERSION__
4314         printf("%s\n", __VERSION__);
4315 #else
4316         printf("%s\n", "1");
4317 #endif
4318 #endif
4319         return(0);
4320 }
4321 EOM
4322 if $cc -o try $ccflags $ldflags try.c; then
4323         gccversion=`$run ./try`
4324         case "$gccversion" in
4325         '') echo "You are not using GNU cc." ;;
4326         *)  echo "You are using GNU cc $gccversion."
4327             ccname=gcc
4328             ;;
4329         esac
4330 else
4331         echo " "
4332         echo "*** WHOA THERE!!! ***" >&4
4333         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4334         case "$knowitall" in
4335         '')
4336         echo "    You'd better start hunting for one and let me know about it." >&4
4337                 exit 1
4338                 ;;
4339         esac
4340 fi
4341 $rm -f try try.*
4342 case "$gccversion" in
4343 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4344 esac
4345 case "$gccversion" in
4346 '') gccosandvers='' ;;
4347 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4348    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4349    gccshortvers=''
4350    case "$gccosandvers" in
4351    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4352    $osname$osvers) ;; # looking good
4353    $osname*) cat <<EOM >&4
4354
4355 *** WHOA THERE!!! ***
4356
4357     Your gcc has not been compiled for the exact release of
4358     your operating system ($gccosandvers versus $osname$osvers).
4359
4360     In general it is a good idea to keep gcc synchronized with
4361     the operating system because otherwise serious problems
4362     may ensue when trying to compile software, like Perl.
4363
4364     I'm trying to be optimistic here, though, and will continue.
4365     If later during the configuration and build icky compilation
4366     problems appear (headerfile conflicts being the most common
4367     manifestation), I suggest reinstalling the gcc to match
4368     your operating system release.
4369
4370 EOM
4371       ;;
4372    *) gccosandvers='' ;; # failed to parse, better be silent
4373    esac
4374    ;;
4375 esac
4376 case "$ccname" in
4377 '') ccname="$cc" ;;
4378 esac
4379
4380 # gcc 3.* complain about adding -Idirectories that they already know about,
4381 # so we will take those off from locincpth.
4382 case "$gccversion" in
4383 3*)
4384     echo "main(){}">try.c
4385     for incdir in $locincpth; do
4386        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4387              grep '^c[cp]p*[01]: warning: changing search order '`
4388        if test "X$warn" != X; then
4389            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4390        fi
4391     done
4392     $rm -f try try.*
4393 esac
4394
4395 : What should the include directory be ?
4396 echo " "
4397 $echo $n "Hmm...  $c"
4398 dflt='/usr/include'
4399 incpath=''
4400 mips_type=''
4401 if $test -f /bin/mips && /bin/mips; then
4402         echo "Looks like a MIPS system..."
4403         $cat >usr.c <<'EOCP'
4404 #ifdef SYSTYPE_BSD43
4405 /bsd43
4406 #endif
4407 EOCP
4408         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4409                 dflt='/bsd43/usr/include'
4410                 incpath='/bsd43'
4411                 mips_type='BSD 4.3'
4412         else
4413                 mips_type='System V'
4414         fi
4415         $rm -f usr.c usr.out
4416         echo "and you're compiling with the $mips_type compiler and libraries."
4417         xxx_prompt=y
4418         echo "exit 0" >mips
4419 else
4420         echo "Doesn't look like a MIPS system."
4421         xxx_prompt=n
4422         echo "exit 1" >mips
4423 fi
4424 chmod +x mips
4425 $eunicefix mips
4426 case "$usrinc" in
4427 '') ;;
4428 *) dflt="$usrinc";;
4429 esac
4430 case "$xxx_prompt" in
4431 y)      fn=d/
4432         echo " "
4433         rp='Where are the include files you want to use?'
4434         . ./getfile
4435         usrinc="$ans"
4436         ;;
4437 *)      usrinc="$dflt"
4438         ;;
4439 esac
4440
4441 : see how we invoke the C preprocessor
4442 echo " "
4443 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4444 cat <<'EOT' >testcpp.c
4445 #define ABC abc
4446 #define XYZ xyz
4447 ABC.XYZ
4448 EOT
4449 cd ..
4450 if test ! -f cppstdin; then
4451         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4452                 # AIX cc -E doesn't show the absolute headerfile
4453                 # locations but we'll cheat by using the -M flag.
4454                 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
4455         else
4456                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4457         fi
4458 else
4459         echo "Keeping your $hint cppstdin wrapper."
4460 fi
4461 chmod 755 cppstdin
4462 wrapper=`pwd`/cppstdin
4463 ok='false'
4464 cd UU
4465
4466 if $test "X$cppstdin" != "X" && \
4467         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4468         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4469 then
4470         echo "You used to use $cppstdin $cppminus so we'll use that again."
4471         case "$cpprun" in
4472         '') echo "But let's see if we can live without a wrapper..." ;;
4473         *)
4474                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4475                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4476                 then
4477                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4478                         ok='true'
4479                 else
4480                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4481                 fi
4482                 ;;
4483         esac
4484 else
4485         case "$cppstdin" in
4486         '') ;;
4487         *)
4488                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4489                 ;;
4490         esac
4491 fi
4492
4493 if $ok; then
4494         : nothing
4495 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4496         $cc -E <testcpp.c >testcpp.out 2>&1; \
4497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4498         echo "Yup, it does."
4499         x_cpp="$cc -E"
4500         x_minus='';
4501 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4502         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4504         echo "Yup, it does."
4505         x_cpp="$cc -E"
4506         x_minus='-';
4507 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4508         $cc -P <testcpp.c >testcpp.out 2>&1; \
4509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4510         echo "Yipee, that works!"
4511         x_cpp="$cc -P"
4512         x_minus='';
4513 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4514         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4516         echo "At long last!"
4517         x_cpp="$cc -P"
4518         x_minus='-';
4519 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4520         $cpp <testcpp.c >testcpp.out 2>&1; \
4521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4522         echo "It works!"
4523         x_cpp="$cpp"
4524         x_minus='';
4525 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4526         $cpp - <testcpp.c >testcpp.out 2>&1; \
4527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4528         echo "Hooray, it works!  I was beginning to wonder."
4529         x_cpp="$cpp"
4530         x_minus='-';
4531 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4532         $wrapper <testcpp.c >testcpp.out 2>&1; \
4533         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4534         x_cpp="$wrapper"
4535         x_minus=''
4536         echo "Eureka!"
4537 else
4538         dflt=''
4539         rp="No dice.  I can't find a C preprocessor.  Name one:"
4540         . ./myread
4541         x_cpp="$ans"
4542         x_minus=''
4543         $x_cpp <testcpp.c >testcpp.out 2>&1
4544         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4545                 echo "OK, that will do." >&4
4546         else
4547 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4548                 exit 1
4549         fi
4550 fi
4551
4552 case "$ok" in
4553 false)
4554         cppstdin="$x_cpp"
4555         cppminus="$x_minus"
4556         cpprun="$x_cpp"
4557         cpplast="$x_minus"
4558         set X $x_cpp
4559         shift
4560         case "$1" in
4561         "$cpp")
4562                 echo "Perhaps can we force $cc -E using a wrapper..."
4563                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4564                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4565                 then
4566                         echo "Yup, we can."
4567                         cppstdin="$wrapper"
4568                         cppminus='';
4569                 else
4570                         echo "Nope, we'll have to live without it..."
4571                 fi
4572                 ;;
4573         esac
4574         case "$cpprun" in
4575         "$wrapper")
4576                 cpprun=''
4577                 cpplast=''
4578                 ;;
4579         esac
4580         ;;
4581 esac
4582
4583 case "$cppstdin" in
4584 "$wrapper"|'cppstdin') ;;
4585 *) $rm -f $wrapper;;
4586 esac
4587 $rm -f testcpp.c testcpp.out
4588
4589 : Set private lib path
4590 case "$plibpth" in
4591 '') if ./mips; then
4592                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4593         fi;;
4594 esac
4595 case "$libpth" in
4596 ' ') dlist='';;
4597 '') dlist="$loclibpth $plibpth $glibpth";;
4598 *) dlist="$libpth";;
4599 esac
4600
4601 : Now check and see which directories actually exist, avoiding duplicates
4602 libpth=''
4603 for xxx in $dlist
4604 do
4605     if $test -d $xxx; then
4606                 case " $libpth " in
4607                 *" $xxx "*) ;;
4608                 *) libpth="$libpth $xxx";;
4609                 esac
4610     fi
4611 done
4612 $cat <<'EOM'
4613
4614 Some systems have incompatible or broken versions of libraries.  Among
4615 the directories listed in the question below, please remove any you
4616 know not to be holding relevant libraries, and add any that are needed.
4617 Say "none" for none.
4618
4619 EOM
4620 case "$libpth" in
4621 '') dflt='none';;
4622 *)
4623         set X $libpth
4624         shift
4625         dflt=${1+"$@"}
4626         ;;
4627 esac
4628 rp="Directories to use for library searches?"
4629 . ./myread
4630 case "$ans" in
4631 none) libpth=' ';;
4632 *) libpth="$ans";;
4633 esac
4634
4635 : compute shared library extension
4636 case "$so" in
4637 '')
4638         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4639                 dflt='sl'
4640         else
4641                 dflt='so'
4642         fi
4643         ;;
4644 *) dflt="$so";;
4645 esac
4646 $cat <<EOM
4647
4648 On some systems, shared libraries may be available.  Answer 'none' if
4649 you want to suppress searching of shared libraries for the remainder
4650 of this configuration.
4651
4652 EOM
4653 rp='What is the file extension used for shared libraries?'
4654 . ./myread
4655 so="$ans"
4656
4657 : Define several unixisms.
4658 : Hints files or command line option can be used to override them.
4659 : The convoluted testing is in case hints files set either the old
4660 : or the new name.
4661 case "$_exe" in
4662 '')     case "$exe_ext" in
4663         '')     ;;
4664         *)      _exe="$exe_ext" ;;
4665         esac
4666         ;;
4667 esac
4668 case "$_a" in
4669 '')     case "$lib_ext" in
4670     '') _a='.a';;
4671         *)      _a="$lib_ext" ;;
4672         esac
4673         ;;
4674 esac
4675 case "$_o" in
4676 '') case "$obj_ext" in
4677         '')     _o='.o';;
4678         *)      _o="$obj_ext";;
4679         esac
4680         ;;
4681 esac
4682 case "$p_" in
4683 '') case "$path_sep" in
4684         '')     p_=':';;
4685         *)      p_="$path_sep";;
4686         esac
4687         ;;
4688 esac
4689 exe_ext=$_exe
4690 lib_ext=$_a
4691 obj_ext=$_o
4692 path_sep=$p_
4693
4694 : Which makefile gets called first.  This is used by make depend.
4695 case "$firstmakefile" in
4696 '') firstmakefile='makefile';;
4697 esac
4698
4699 case "$ccflags" in
4700 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4701 esac
4702
4703 case "$uselongdouble" in
4704 $define|true|[yY]*)     dflt='y';;
4705 *) dflt='n';;
4706 esac
4707 cat <<EOM
4708
4709 Perl can be built to take advantage of long doubles which
4710 (if available) may give more accuracy and range for floating point numbers.
4711
4712 If this doesn't make any sense to you, just accept the default '$dflt'.
4713 EOM
4714 rp='Try to use long doubles if available?'
4715 . ./myread
4716 case "$ans" in
4717 y|Y)    val="$define"   ;;
4718 *)      val="$undef"    ;;
4719 esac
4720 set uselongdouble
4721 eval $setvar
4722
4723 case "$uselongdouble" in
4724 true|[yY]*) uselongdouble="$define" ;;
4725 esac
4726
4727 : Look for a hint-file generated 'call-back-unit'.  If the
4728 : user has specified that long doubles should be used,
4729 : we may need to set or change some other defaults.
4730 if $test -f uselongdouble.cbu; then
4731     echo "Your platform has some specific hints regarding long doubles, using them..."
4732     . ./uselongdouble.cbu
4733 else
4734     case "$uselongdouble" in
4735         $define)
4736                 $cat <<EOM
4737 (Your platform does not have any specific hints for long doubles.)
4738 EOM
4739         ;;
4740     esac
4741 fi
4742
4743 : Looking for optional libraries
4744 echo " "
4745 echo "Checking for optional libraries..." >&4
4746 case "$libs" in
4747 ' '|'') dflt='';;
4748 *) dflt="$libs";;
4749 esac
4750 case "$libswanted" in
4751 '') libswanted='c_s';;
4752 esac
4753 case "$usesocks" in
4754 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4755 esac
4756 libsfound=''
4757 libsfiles=''
4758 libsdirs=''
4759 libspath=''
4760 for thisdir in $libpth $xlibpth; do
4761   test -d $thisdir && libspath="$libspath $thisdir"
4762 done
4763 for thislib in $libswanted; do
4764         for thisdir in $libspath; do
4765             xxx=''
4766             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4767                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4768                 $test -f "$xxx" && eval $libscheck
4769                 $test -f "$xxx" && libstyle=shared
4770             fi
4771             if test ! -f "$xxx"; then
4772                 xxx=$thisdir/lib$thislib.$so
4773                 $test -f "$xxx" && eval $libscheck
4774                 $test -f "$xxx" && libstyle=shared
4775             fi  
4776             if test ! -f "$xxx"; then
4777                 xxx=$thisdir/lib$thislib$_a
4778                 $test -f "$xxx" && eval $libscheck
4779                 $test -f "$xxx" && libstyle=static
4780             fi
4781             if test ! -f "$xxx"; then
4782                 xxx=$thisdir/$thislib$_a
4783                 $test -f "$xxx" && eval $libscheck
4784                 $test -f "$xxx" && libstyle=static
4785             fi
4786             if test ! -f "$xxx"; then
4787                 xxx=$thisdir/lib${thislib}_s$_a
4788                 $test -f "$xxx" && eval $libscheck
4789                 $test -f "$xxx" && libstyle=static
4790                 $test -f "$xxx" && thislib=${thislib}_s
4791             fi
4792             if test ! -f "$xxx"; then
4793                 xxx=$thisdir/Slib$thislib$_a
4794                 $test -f "$xxx" && eval $libscheck
4795                 $test -f "$xxx" && libstyle=static
4796             fi
4797             if $test -f "$xxx"; then
4798                 case "$libstyle" in
4799                 shared) echo "Found -l$thislib (shared)." ;;
4800                 static) echo "Found -l$thislib." ;;
4801                 *)      echo "Found -l$thislib ($libstyle)." ;;
4802                 esac
4803                 case " $dflt " in
4804                 *"-l$thislib "*);;
4805                 *) dflt="$dflt -l$thislib"
4806                    libsfound="$libsfound $xxx"
4807                    yyy=`basename $xxx`
4808                    libsfiles="$libsfiles $yyy"
4809                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4810                    case " $libsdirs " in
4811                    *" $yyy "*) ;;
4812                    *) libsdirs="$libsdirs $yyy" ;;
4813                    esac
4814                    ;;
4815                 esac
4816                 break
4817             fi  
4818         done
4819         if $test ! -f "$xxx"; then
4820             echo "No -l$thislib."
4821         fi
4822 done
4823 set X $dflt
4824 shift
4825 dflt="$*"
4826 case "$libs" in
4827 '') dflt="$dflt";;
4828 *) dflt="$libs";;
4829 esac
4830 case "$dflt" in
4831 ' '|'') dflt='none';;
4832 esac
4833
4834 $cat <<EOM
4835
4836 In order to compile $package on your machine, a number of libraries
4837 are usually needed.  Include any other special libraries here as well.
4838 Say "none" for none.  The default list is almost always right.
4839 EOM
4840
4841 echo " "
4842 rp="What libraries to use?"
4843 . ./myread
4844 case "$ans" in
4845 none) libs=' ';;
4846 *) libs="$ans";;
4847 esac
4848
4849 : determine optimization, if desired, or use for debug flag also
4850 case "$optimize" in
4851 ' '|$undef) dflt='none';;
4852 '') dflt='-O';;
4853 *) dflt="$optimize";;
4854 esac
4855 $cat <<EOH
4856
4857 By default, $package compiles with the -O flag to use the optimizer.
4858 Alternately, you might want to use the symbolic debugger, which uses
4859 the -g flag (on traditional Unix systems).  Either flag can be
4860 specified here.  To use neither flag, specify the word "none".
4861
4862 EOH
4863 rp="What optimizer/debugger flag should be used?"
4864 . ./myread
4865 optimize="$ans"
4866 case "$optimize" in
4867 'none') optimize=" ";;
4868 esac
4869
4870 : Check what DEBUGGING is required from the command line
4871 : -DEBUGGING      or -DDEBUGGING or
4872 : -DEBUGGING=both                       = -g + -DDEBUGGING
4873 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4874 : -DEBUGGING=none or -UDEBUGGING        =
4875 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4876 case "$EBUGGING" in
4877 '')     ;;
4878 *)      DEBUGGING=$EBUGGING ;;
4879 esac
4880
4881 case "$DEBUGGING" in
4882 -g|$define)
4883     case "$optimize" in
4884         *-g*) ;;
4885         *)    optimize="$optimize -g" ;;
4886     esac ;;
4887 none|$undef)
4888     case "$optimize" in
4889         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4890                 shift
4891                 optimize="$*"
4892                 ;;
4893     esac ;;
4894 esac
4895
4896 dflt=''
4897 case "$DEBUGGING" in
4898 both|$define) dflt='-DDEBUGGING'
4899 esac
4900
4901 : We will not override a previous value, but we might want to
4902 : augment a hint file
4903 case "$hint" in
4904 default|recommended)
4905         case "$gccversion" in
4906         1*) dflt="$dflt -fpcc-struct-return" ;;
4907         esac
4908         case "$optimize:$DEBUGGING" in
4909         *-g*:old) dflt="$dflt -DDEBUGGING";;
4910         esac
4911         case "$gccversion" in
4912         2*) if test -d /etc/conf/kconfig.d &&
4913                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4914                 then
4915                         # Interactive Systems (ISC) POSIX mode.
4916                         dflt="$dflt -posix"
4917                 fi
4918                 ;;
4919         esac
4920         case "$gccversion" in
4921         1*) ;;
4922         2.[0-8]*) ;;
4923         ?*)     echo " "
4924                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4925                 echo 'int main(void) { return 0; }' > gcctest.c
4926                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4927                         echo "Yes, it does." 2>&1
4928                         case "$ccflags" in
4929                         *strict-aliasing*)
4930                                 echo "Leaving current flags $ccflags alone." 2>&1
4931                                 ;;
4932                         *) dflt="$dflt -fno-strict-aliasing" ;;
4933                         esac
4934                 else
4935                         echo "Nope, it doesn't, but that's ok." 2>&1
4936                 fi
4937                 ;;
4938         esac
4939         # For gcc, adding -pipe speeds up compilations for some, but apparently
4940         # some assemblers can't read from stdin.  (It also slows down compilations
4941         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4942         case "$gccversion" in
4943         ?*)     echo " "
4944                 echo "Checking if your compiler accepts -pipe" 2>&1
4945                 echo 'int main(void) { return 0; }' > gcctest.c
4946                 if $cc -pipe -o gcctest gcctest.c; then
4947                         echo "Yes, it does." 2>&1
4948                         case "$ccflags" in
4949                         *-pipe*)
4950                                 echo "Leaving current flags $ccflags alone." 2>&1
4951                                 ;;
4952                         *) dflt="$dflt -pipe" ;;
4953                         esac
4954                 else
4955                         echo "Nope, it doesn't, but that's ok." 2>&1
4956                 fi
4957
4958                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4959                 echo 'int main(void) { return 0; }' > gcctest.c
4960                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4961                         echo "Yes, it does." 2>&1
4962                         case "$ccflags" in
4963                         *-Wdeclaration-after-statement*)
4964                                 echo "Leaving current flags $ccflags alone." 2>&1
4965                                 ;;
4966                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4967                         esac
4968                 else
4969                         echo "Nope, it doesn't, but that's ok." 2>&1
4970                 fi
4971                 ;;
4972         esac
4973         ;;
4974 esac
4975
4976 case "$mips_type" in
4977 *BSD*|'') inclwanted="$locincpth $usrinc";;
4978 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4979 esac
4980 for thisincl in $inclwanted; do
4981         if $test -d $thisincl; then
4982                 if $test x$thisincl != x$usrinc; then
4983                         case "$dflt" in
4984                         *" -I$thisincl "*);;
4985                         *) dflt="$dflt -I$thisincl ";;
4986                         esac
4987                 fi
4988         fi
4989 done
4990
4991 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4992         xxx=true;
4993 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4994         xxx=true;
4995 else
4996         xxx=false;
4997 fi;
4998 if $xxx; then
4999         case "$dflt" in
5000         *$2*);;
5001         *) dflt="$dflt -D$2";;
5002         esac;
5003 fi'
5004
5005 set signal.h LANGUAGE_C; eval $inctest
5006
5007 case "$usesocks" in
5008 $define)
5009         ccflags="$ccflags -DSOCKS"
5010         ;;
5011 esac
5012
5013 case "$hint" in
5014 default|recommended) dflt="$ccflags $dflt" ;;
5015 *) dflt="$ccflags";;
5016 esac
5017
5018 case "$dflt" in
5019 ''|' ') dflt=none;;
5020 esac
5021
5022 $cat <<EOH
5023
5024 Your C compiler may want other flags.  For this question you should include
5025 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5026 but you should NOT include libraries or ld flags like -lwhatever.  If you
5027 want $package to honor its debug switch, you should include -DDEBUGGING here.
5028 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5029
5030 To use no flags, specify the word "none".
5031
5032 EOH
5033 set X $dflt
5034 shift
5035 dflt=${1+"$@"}
5036 rp="Any additional cc flags?"
5037 . ./myread
5038 case "$ans" in
5039 none) ccflags='';;
5040 *) ccflags="$ans";;
5041 esac
5042
5043 : the following weeds options from ccflags that are of no interest to cpp
5044 case "$cppflags" in
5045 '') cppflags="$ccflags" ;;
5046 *)  cppflags="$cppflags $ccflags" ;;
5047 esac
5048 case "$gccversion" in
5049 1*) cppflags="$cppflags -D__GNUC__"
5050 esac
5051 case "$mips_type" in
5052 '');;
5053 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5054 esac
5055 case "$cppflags" in
5056 '');;
5057 *)
5058         echo " "
5059         echo "Let me guess what the preprocessor flags are..." >&4
5060         set X $cppflags
5061         shift
5062         cppflags=''
5063         $cat >cpp.c <<'EOM'
5064 #define BLURFL foo
5065
5066 BLURFL xx LFRULB
5067 EOM
5068         previous=''
5069         for flag in $*
5070         do
5071                 case "$flag" in
5072                 -*) ftry="$flag";;
5073                 *) ftry="$previous $flag";;
5074                 esac
5075                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5076                         >cpp1.out 2>/dev/null && \
5077                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5078                         >cpp2.out 2>/dev/null && \
5079                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5080                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5081                 then
5082                         cppflags="$cppflags $ftry"
5083                         previous=''
5084                 else
5085                         previous="$flag"
5086                 fi
5087         done
5088         set X $cppflags
5089         shift
5090         cppflags=${1+"$@"}
5091         case "$cppflags" in
5092         *-*)  echo "They appear to be: $cppflags";;
5093         esac
5094         $rm -f cpp.c cpp?.out
5095         ;;
5096 esac
5097
5098 : flags used in final linking phase
5099 case "$ldflags" in
5100 '') if ./venix; then
5101                 dflt='-i -z'
5102         else
5103                 dflt=''
5104         fi
5105         case "$ccflags" in
5106         *-posix*) dflt="$dflt -posix" ;;
5107         esac
5108         ;;
5109 *) dflt="$ldflags";;
5110 esac
5111
5112 : Try to guess additional flags to pick up local libraries.
5113 for thislibdir in $libpth; do
5114         case " $loclibpth " in
5115         *" $thislibdir "*)
5116                 case "$dflt " in
5117                 *"-L$thislibdir "*) ;;
5118                 *)  dflt="$dflt -L$thislibdir" ;;
5119                 esac
5120                 ;;
5121         esac
5122 done
5123
5124 case "$dflt" in
5125 '') dflt='none' ;;
5126 esac
5127
5128 $cat <<EOH
5129
5130 Your C linker may need flags.  For this question you should
5131 include -L/whatever and any other flags used by the C linker, but you
5132 should NOT include libraries like -lwhatever.
5133
5134 Make sure you include the appropriate -L/path flags if your C linker
5135 does not normally search all of the directories you specified above,
5136 namely
5137         $libpth
5138 To use no flags, specify the word "none".
5139
5140 EOH
5141
5142 rp="Any additional ld flags (NOT including libraries)?"
5143 . ./myread
5144 case "$ans" in
5145 none) ldflags='';;
5146 *) ldflags="$ans";;
5147 esac
5148 rmlist="$rmlist pdp11"
5149
5150 : coherency check
5151 echo " "
5152 echo "Checking your choice of C compiler and flags for coherency..." >&4
5153 $cat > try.c <<'EOF'
5154 #include <stdio.h>
5155 int main() { printf("Ok\n"); return(0); }
5156 EOF
5157 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5158 shift
5159 $cat >try.msg <<'EOM'
5160 I've tried to compile and run the following simple program:
5161
5162 EOM
5163 $cat try.c >> try.msg
5164
5165 $cat >> try.msg <<EOM
5166
5167 I used the command:
5168
5169         $*
5170         $run ./try
5171
5172 and I got the following output:
5173
5174 EOM
5175 dflt=y
5176 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5177         if $sh -c "$run ./try" >>try.msg 2>&1; then
5178                 xxx=`$run ./try`
5179                 case "$xxx" in
5180                 "Ok") dflt=n ;;
5181                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5182                         case " $libs " in
5183                         *" -lsfio "*)
5184                                 cat >> try.msg <<'EOQS'
5185 If $libs contains -lsfio, and sfio is mis-configured, then it
5186 sometimes (apparently) runs and exits with a 0 status, but with no
5187 output!  It may have to do with sfio's use of _exit vs. exit.
5188
5189 EOQS
5190                                 rp="You have a big problem.  Shall I abort Configure"
5191                                 dflt=y
5192                                 ;;
5193                         esac
5194                         ;;
5195                 esac
5196         else
5197                 echo "The program compiled OK, but exited with status $?." >>try.msg
5198                 rp="You have a problem.  Shall I abort Configure"
5199                 dflt=y
5200         fi
5201 else
5202         echo "I can't compile the test program." >>try.msg
5203         rp="You have a BIG problem.  Shall I abort Configure"
5204         dflt=y
5205 fi
5206 case "$dflt" in
5207 y)
5208         $cat try.msg >&4
5209         case "$knowitall" in
5210         '')
5211                 echo "(The supplied flags or libraries might be incorrect.)"
5212                 ;;
5213         *) dflt=n;;
5214         esac
5215         echo " "
5216         . ./myread
5217         case "$ans" in
5218         n*|N*) ;;
5219         *)      echo "Ok.  Stopping Configure." >&4
5220                 exit 1
5221                 ;;
5222         esac
5223         ;;
5224 n) echo "OK, that should do.";;
5225 esac
5226 $rm -f try try.* core
5227
5228 : define a shorthand compile call
5229 compile='
5230 mc_file=$1;
5231 shift;
5232 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5233 : define a shorthand compile call for compilations that should be ok.
5234 compile_ok='
5235 mc_file=$1;
5236 shift;
5237 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5238
5239 : determine filename position in cpp output
5240 echo " "
5241 echo "Computing filename position in cpp output for #include directives..." >&4
5242 case "$osname" in
5243 vos) testaccess=-e ;;
5244 *)   testaccess=-r ;;
5245 esac
5246 echo '#include <stdio.h>' > foo.c
5247 $cat >fieldn <<EOF
5248 $startsh
5249 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5250 $grep '^[       ]*#.*stdio\.h' | \
5251 while read cline; do
5252         pos=1
5253         set \$cline
5254         while $test \$# -gt 0; do
5255                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5256                         echo "\$pos"
5257                         exit 0
5258                 fi
5259                 shift
5260                 pos=\`expr \$pos + 1\`
5261         done
5262 done
5263 EOF
5264 chmod +x fieldn
5265 fieldn=`./fieldn`
5266 $rm -f foo.c fieldn
5267 case $fieldn in
5268 '') pos='???';;
5269 1) pos=first;;
5270 2) pos=second;;
5271 3) pos=third;;
5272 *) pos="${fieldn}th";;
5273 esac
5274 echo "Your cpp writes the filename in the $pos field of the line."
5275
5276 case "$osname" in
5277 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5278 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5279 *)   cppfilter='' ;;
5280 esac
5281 : locate header file
5282 $cat >findhdr <<EOF
5283 $startsh
5284 wanted=\$1
5285 name=''
5286 for usrincdir in $usrinc
5287 do
5288         if test -f \$usrincdir/\$wanted; then
5289                 echo "\$usrincdir/\$wanted"
5290                 exit 0
5291         fi
5292 done
5293 awkprg='{ print \$$fieldn }'
5294 echo "#include <\$wanted>" > foo\$\$.c
5295 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5296 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5297 while read cline; do
5298         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5299         case "\$name" in
5300         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5301         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5302         *) exit 2;;
5303         esac;
5304 done;
5305 #
5306 # status = 0: grep returned 0 lines, case statement not executed
5307 # status = 1: headerfile found
5308 # status = 2: while loop executed, no headerfile found
5309 #
5310 status=\$?
5311 $rm -f foo\$\$.c;
5312 if test \$status -eq 1; then
5313         exit 0;
5314 fi
5315 exit 1
5316 EOF
5317 chmod +x findhdr
5318
5319 : define an alternate in-header-list? function
5320 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5321 cont=true; xxf="echo \"<\$1> found.\" >&4";
5322 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5323 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5324 esac;
5325 case $# in 4) instead=instead;; *) instead="at last";; esac;
5326 while $test "$cont"; do
5327         xxx=`./findhdr $1`
5328         var=$2; eval "was=\$$2";
5329         if $test "$xxx" && $test -r "$xxx";
5330         then eval $xxf;
5331         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5332                 cont="";
5333         else eval $xxnf;
5334         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5335         set $yyy; shift; shift; yyy=$@;
5336         case $# in 0) cont="";;
5337         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5338                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5339         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5340                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5341         esac;
5342 done;
5343 while $test "$yyy";
5344 do set $yyy; var=$2; eval "was=\$$2";
5345         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5346         set $yyy; shift; shift; yyy=$@;
5347 done'
5348
5349 : see if stdlib is available
5350 set stdlib.h i_stdlib
5351 eval $inhdr
5352
5353 : check for lengths of integral types
5354 echo " "
5355 case "$intsize" in
5356 '')
5357         echo "Checking to see how big your integers are..." >&4
5358         $cat >try.c <<EOCP
5359 #include <stdio.h>
5360 #$i_stdlib I_STDLIB
5361 #ifdef I_STDLIB
5362 #include <stdlib.h>
5363 #endif
5364 int main()
5365 {
5366         printf("intsize=%d;\n", (int)sizeof(int));
5367         printf("longsize=%d;\n", (int)sizeof(long));
5368         printf("shortsize=%d;\n", (int)sizeof(short));
5369         exit(0);
5370 }
5371 EOCP
5372         set try
5373         if eval $compile_ok && $run ./try > /dev/null; then
5374                 eval `$run ./try`
5375                 echo "Your integers are $intsize bytes long."
5376                 echo "Your long integers are $longsize bytes long."
5377                 echo "Your short integers are $shortsize bytes long."
5378         else
5379                 $cat >&4 <<EOM
5380 !
5381 Help! I can't compile and run the intsize test program: please enlighten me!
5382 (This is probably a misconfiguration in your system or libraries, and
5383 you really ought to fix it.  Still, I'll try anyway.)
5384 !
5385 EOM
5386                 dflt=4
5387                 rp="What is the size of an integer (in bytes)?"
5388                 . ./myread
5389                 intsize="$ans"
5390                 dflt=$intsize
5391                 rp="What is the size of a long integer (in bytes)?"
5392                 . ./myread
5393                 longsize="$ans"
5394                 dflt=2
5395                 rp="What is the size of a short integer (in bytes)?"
5396                 . ./myread
5397                 shortsize="$ans"
5398         fi
5399         ;;
5400 esac
5401 $rm -f try try.*
5402
5403 : check for long long
5404 echo " "
5405 echo "Checking to see if you have long long..." >&4
5406 echo 'int main() { long long x = 7; return 0; }' > try.c
5407 set try
5408 if eval $compile; then
5409         val="$define"
5410         echo "You have long long."
5411 else
5412         val="$undef"
5413         echo "You do not have long long."
5414 fi
5415 $rm try.*
5416 set d_longlong
5417 eval $setvar
5418
5419 : check for length of long long
5420 case "${d_longlong}${longlongsize}" in
5421 $define)
5422         echo " "
5423         echo "Checking to see how big your long longs are..." >&4
5424         $cat >try.c <<'EOCP'
5425 #include <stdio.h>
5426 int main()
5427 {
5428     printf("%d\n", (int)sizeof(long long));
5429     return(0);
5430 }
5431 EOCP
5432         set try
5433         if eval $compile_ok; then
5434                 longlongsize=`$run ./try`
5435                 echo "Your long longs are $longlongsize bytes long."
5436         else
5437                 dflt='8'
5438                 echo " "
5439                 echo "(I can't seem to compile the test program.  Guessing...)"
5440                 rp="What is the size of a long long (in bytes)?"
5441                 . ./myread
5442                 longlongsize="$ans"
5443         fi
5444         if $test "X$longsize" = "X$longlongsize"; then
5445                 echo "(That isn't any different from an ordinary long.)"
5446         fi      
5447         ;;
5448 esac
5449 $rm -f try.* try
5450
5451 : see if inttypes.h is available
5452 : we want a real compile instead of Inhdr because some systems
5453 : have an inttypes.h which includes non-existent headers
5454 echo " "
5455 $cat >try.c <<EOCP
5456 #include <inttypes.h>
5457 int main() {
5458         static int32_t foo32 = 0x12345678;
5459 }
5460 EOCP
5461 set try
5462 if eval $compile; then
5463         echo "<inttypes.h> found." >&4
5464         val="$define"
5465 else
5466         echo "<inttypes.h> NOT found." >&4
5467         val="$undef"
5468 fi
5469 $rm -f try.c try
5470 set i_inttypes
5471 eval $setvar
5472
5473 : check for int64_t
5474 echo " "
5475 echo "Checking to see if you have int64_t..." >&4
5476 $cat >try.c <<EOCP
5477 #include <sys/types.h>
5478 #$i_inttypes I_INTTYPES
5479 #ifdef I_INTTYPES
5480 #include <inttypes.h>
5481 #endif
5482 int main() { int64_t x = 7; }
5483 EOCP
5484 set try
5485 if eval $compile; then
5486         val="$define"
5487         echo "You have int64_t."
5488 else
5489         val="$undef"
5490         echo "You do not have int64_t."
5491 fi
5492 $rm -f try try.*
5493 set d_int64_t
5494 eval $setvar
5495
5496
5497 echo " "
5498 echo "Checking which 64-bit integer type we could use..." >&4
5499
5500 case "$intsize" in
5501 8) val=int
5502    set quadtype
5503    eval $setvar
5504    val='"unsigned int"'
5505    set uquadtype
5506    eval $setvar
5507    quadkind=1
5508    ;;
5509 *) case "$longsize" in
5510    8) val=long
5511       set quadtype
5512       eval $setvar
5513       val='"unsigned long"'
5514       set uquadtype
5515       eval $setvar
5516       quadkind=2
5517       ;;
5518    *) case "$d_longlong:$longlongsize" in
5519       define:8)
5520         val='"long long"'
5521         set quadtype
5522         eval $setvar
5523         val='"unsigned long long"'
5524         set uquadtype
5525         eval $setvar
5526         quadkind=3
5527         ;;
5528       *) case "$d_int64_t" in
5529          define)
5530            val=int64_t
5531            set quadtype
5532            eval $setvar
5533            val=uint64_t
5534            set uquadtype
5535            eval $setvar
5536            quadkind=4
5537            ;;
5538          esac
5539          ;;
5540       esac
5541       ;;
5542    esac
5543    ;;
5544 esac
5545
5546 case "$quadtype" in
5547 '')     echo "Alas, no 64-bit integer types in sight." >&4
5548         d_quad="$undef"
5549         ;;
5550 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5551         d_quad="$define"
5552         ;;
5553 esac
5554
5555
5556 case "$uselonglong" in
5557 "$define"|true|[yY]*)
5558         cat <<EOM >&4
5559
5560 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5561 EOM
5562         use64bitint="$define"
5563         ;;
5564 esac                          
5565 case "$use64bits" in
5566 "$define"|true|[yY]*)
5567         cat <<EOM >&4
5568
5569 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5570 EOM
5571         use64bitint="$define"
5572         ;;
5573 esac                          
5574 case "$use64bitints" in
5575 "$define"|true|[yY]*)
5576         cat <<EOM >&4
5577
5578 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5579 EOM
5580         use64bitint="$define"
5581         ;;
5582 esac                          
5583 case "$use64bitsint" in
5584 "$define"|true|[yY]*)
5585         cat <<EOM >&4
5586
5587 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5588 EOM
5589         use64bitint="$define"
5590         ;;
5591 esac                          
5592 case "$uselonglongs" in
5593 "$define"|true|[yY]*)
5594         cat <<EOM >&4
5595
5596 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5597 EOM
5598         use64bitint="$define"
5599         ;;
5600 esac                          
5601 case "$use64bitsall" in
5602 "$define"|true|[yY]*)
5603         cat <<EOM >&4
5604
5605 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5606 EOM
5607         use64bitall="$define"
5608         ;;
5609 esac                          
5610
5611 case "$ccflags" in
5612 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5613 esac
5614 case "$use64bitall" in
5615 "$define"|true|[yY]*) use64bitint="$define" ;;
5616 esac
5617
5618 case "$longsize" in
5619 8) cat <<EOM
5620
5621 You have natively 64-bit long integers.
5622 EOM
5623    val="$define"
5624    ;;
5625 *) case "$use64bitint" in
5626    "$define"|true|[yY]*) dflt='y';;
5627    *) dflt='n';;
5628    esac
5629    case "$d_quad" in
5630    "$define") ;;
5631    *) dflt='n' ;;
5632    esac
5633    cat <<EOM
5634
5635 Perl can be built to take advantage of 64-bit integer types
5636 on some systems.  To do so, Configure can be run with -Duse64bitint.
5637 Choosing this option will most probably introduce binary incompatibilities.
5638
5639 If this doesn't make any sense to you, just accept the default '$dflt'.
5640 (The default has been chosen based on your configuration.)
5641 EOM
5642    rp='Try to use 64-bit integers, if available?'
5643    . ./myread
5644    case "$ans" in
5645    [yY]*) val="$define" ;;
5646    *)     val="$undef"  ;;
5647    esac
5648    ;;
5649 esac
5650 set use64bitint
5651 eval $setvar
5652
5653 case "$use64bitall" in
5654 "$define"|true|[yY]*) dflt='y' ;;
5655 *) case "$longsize" in
5656    8) dflt='y' ;;
5657    *) dflt='n' ;;
5658    esac
5659    ;;
5660 esac    
5661 cat <<EOM
5662
5663 You may also choose to try maximal 64-bitness.  It means using as much
5664 64-bitness as possible on the platform.  This in turn means even more
5665 binary incompatibilities.  On the other hand, your platform may not
5666 have any more 64-bitness available than what you already have chosen.
5667
5668 If this doesn't make any sense to you, just accept the default '$dflt'.
5669 (The default has been chosen based on your configuration.)
5670 EOM
5671 rp='Try to use maximal 64-bit support, if available?'
5672 . ./myread
5673 case "$ans" in
5674 [yY]*) val="$define" ;;
5675 *)     val="$undef"  ;;
5676 esac
5677 set use64bitall
5678 eval $setvar
5679 case "$use64bitall" in
5680 "$define")
5681         case "$use64bitint" in
5682         "$undef")
5683                 cat <<EOM
5684
5685 Since you have chosen a maximally 64-bit build, I'm also turning on
5686 the use of 64-bit integers.
5687 EOM
5688                 use64bitint="$define" ;;
5689         esac
5690         ;;
5691 esac
5692
5693 : Look for a hint-file generated 'call-back-unit'.  If the
5694 : user has specified that a 64-bit perl is to be built,
5695 : we may need to set or change some other defaults.
5696 if $test -f use64bitint.cbu; then
5697         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5698         . ./use64bitint.cbu
5699 fi
5700 case "$use64bitint" in
5701 "$define"|true|[yY]*)
5702         case "$longsize" in
5703         4) case "$archname64" in
5704            '') archname64=64int ;;
5705            esac
5706            ;;
5707         esac
5708         ;;
5709 esac
5710
5711 : Look for a hint-file generated 'call-back-unit'.  If the
5712 : user has specified that a maximally 64-bit perl is to be built,
5713 : we may need to set or change some other defaults.
5714 if $test -f use64bitall.cbu; then
5715         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5716         . ./use64bitall.cbu
5717 fi
5718 case "$use64bitall" in
5719 "$define"|true|[yY]*)
5720         case "$longsize" in
5721         4) case "$archname64" in
5722            ''|64int) archname64=64all ;;
5723            esac
5724            ;;
5725         esac
5726         ;;
5727 esac
5728
5729 case "$d_quad:$use64bitint" in
5730 $undef:$define)
5731         cat >&4 <<EOF
5732
5733 *** You have chosen to use 64-bit integers,
5734 *** but none can be found.
5735 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5736 *** Cannot continue, aborting.
5737
5738 EOF
5739         exit 1
5740         ;;
5741 esac
5742
5743 : check for length of double
5744 echo " "
5745 case "$doublesize" in
5746 '')
5747         echo "Checking to see how big your double precision numbers are..." >&4
5748         $cat >try.c <<EOCP
5749 #include <stdio.h>
5750 #$i_stdlib I_STDLIB
5751 #ifdef I_STDLIB
5752 #include <stdlib.h>
5753 #endif
5754 int main()
5755 {
5756     printf("%d\n", (int)sizeof(double));
5757     exit(0);
5758 }
5759 EOCP
5760         set try
5761         if eval $compile_ok; then
5762                 doublesize=`$run ./try`
5763                 echo "Your double is $doublesize bytes long."
5764         else
5765                 dflt='8'
5766                 echo "(I can't seem to compile the test program.  Guessing...)"
5767                 rp="What is the size of a double precision number (in bytes)?"
5768                 . ./myread
5769                 doublesize="$ans"
5770         fi
5771         ;;
5772 esac
5773 $rm -f try.c try
5774
5775 : check for long doubles
5776 echo " "
5777 echo "Checking to see if you have long double..." >&4
5778 echo 'int main() { long double x = 7.0; }' > try.c
5779 set try
5780 if eval $compile; then
5781         val="$define"
5782         echo "You have long double."
5783 else
5784         val="$undef"
5785         echo "You do not have long double."
5786 fi
5787 $rm try.*
5788 set d_longdbl
5789 eval $setvar
5790
5791 : check for length of long double
5792 case "${d_longdbl}${longdblsize}" in
5793 $define)
5794         echo " "
5795         echo "Checking to see how big your long doubles are..." >&4
5796         $cat >try.c <<'EOCP'
5797 #include <stdio.h>
5798 int main()
5799 {
5800         printf("%d\n", sizeof(long double));
5801 }
5802 EOCP
5803         set try
5804         set try
5805         if eval $compile; then
5806                 longdblsize=`$run ./try`
5807                 echo "Your long doubles are $longdblsize bytes long."
5808         else
5809                 dflt='8'
5810                 echo " "
5811                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5812                 rp="What is the size of a long double (in bytes)?"
5813                 . ./myread
5814                 longdblsize="$ans"
5815         fi
5816         if $test "X$doublesize" = "X$longdblsize"; then
5817                 echo "That isn't any different from an ordinary double."
5818                 echo "I'll keep your setting anyway, but you may see some"
5819                 echo "harmless compilation warnings."
5820         fi      
5821         ;;
5822 esac
5823 $rm -f try.* try
5824
5825 : determine the architecture name
5826 echo " "
5827 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5828         tarch=`arch`"-$osname"
5829 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5830         if uname -m > tmparch 2>&1 ; then
5831                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5832                         -e 's/$/'"-$osname/" tmparch`
5833         else
5834                 tarch="$osname"
5835         fi
5836         $rm -f tmparch
5837 else
5838         tarch="$osname"
5839 fi
5840 case "$myarchname" in
5841 ''|"$tarch") ;;
5842 *)
5843         echo "(Your architecture name used to be $myarchname.)"
5844         archname=''
5845         ;;
5846 esac
5847 case "$targetarch" in
5848 '') ;;
5849 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5850 esac
5851 myarchname="$tarch"
5852 case "$archname" in
5853 '') dflt="$tarch";;
5854 *) dflt="$archname";;
5855 esac
5856 rp='What is your architecture name'
5857 . ./myread
5858 archname="$ans"
5859 case "$usethreads" in
5860 $define)
5861         echo "Threads selected." >&4
5862         case "$archname" in
5863         *-thread*) echo "...and architecture name already has -thread." >&4
5864                 ;;
5865         *)      archname="$archname-thread"
5866                 echo "...setting architecture name to $archname." >&4
5867                 ;;
5868         esac
5869         ;;
5870 esac
5871 case "$usemultiplicity" in
5872 $define)
5873         echo "Multiplicity selected." >&4
5874         case "$archname" in
5875         *-multi*) echo "...and architecture name already has -multi." >&4
5876                 ;;
5877         *)      archname="$archname-multi"
5878                 echo "...setting architecture name to $archname." >&4
5879                 ;;
5880         esac
5881         ;;
5882 esac
5883 case "$use64bitint$use64bitall" in
5884 *"$define"*)
5885         case "$archname64" in
5886         '')
5887                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5888                 ;;
5889         *)
5890                 case "$use64bitint" in
5891                 "$define") echo "64 bit integers selected." >&4 ;;
5892                 esac
5893                 case "$use64bitall" in
5894                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5895                 esac
5896                 case "$archname" in
5897                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5898                         ;;
5899                 *)      archname="$archname-$archname64"
5900                         echo "...setting architecture name to $archname." >&4
5901                         ;;
5902                 esac
5903                 ;;
5904         esac
5905 esac
5906 case "$uselongdouble" in
5907 $define)
5908         echo "Long doubles selected." >&4
5909         case "$longdblsize" in
5910         $doublesize)
5911                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5912                 ;;
5913         *)
5914                 case "$archname" in
5915                 *-ld*) echo "...and architecture name already has -ld." >&4
5916                         ;;
5917                 *)      archname="$archname-ld"
5918                         echo "...setting architecture name to $archname." >&4
5919                         ;;
5920                 esac
5921                 ;;
5922         esac
5923         ;;
5924 esac
5925 case "$useperlio" in
5926 $define)
5927         echo "Perlio selected." >&4
5928         ;;
5929 *)
5930         echo "Perlio not selected, using stdio." >&4
5931         case "$archname" in
5932         *-stdio*) echo "...and architecture name already has -stdio." >&4
5933                 ;;
5934         *)      archname="$archname-stdio"
5935                 echo "...setting architecture name to $archname." >&4
5936                 ;;
5937         esac
5938         ;;
5939 esac
5940 if $test -f archname.cbu; then
5941         echo "Your platform has some specific hints for architecture name, using them..."
5942         . ./archname.cbu
5943 fi
5944
5945 : set the prefixit variable, to compute a suitable default value
5946 prefixit='case "$3" in
5947 ""|none)
5948         case "$oldprefix" in
5949         "") eval "$1=\"\$$2\"";;
5950         *)
5951                 case "$3" in
5952                 "") eval "$1=";;
5953                 none)
5954                         eval "tp=\"\$$2\"";
5955                         case "$tp" in
5956                         ""|" ") eval "$1=\"\$$2\"";;
5957                         *) eval "$1=";;
5958                         esac;;
5959                 esac;;
5960         esac;;
5961 *)
5962         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5963         case "$tp" in
5964         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5965         /*-$oldprefix/*|\~*-$oldprefix/*)
5966                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5967         *) eval "$1=\"\$$2\"";;
5968         esac;;
5969 esac'
5970
5971 : get the patchlevel
5972 echo " "
5973 echo "Getting the current patchlevel..." >&4
5974 if $test -r $rsrc/patchlevel.h;then
5975         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5976         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5977         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5978         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5979         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5980         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5981         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5982 else
5983         revision=0
5984         patchlevel=0
5985         subversion=0
5986         api_revision=0
5987         api_version=0
5988         api_subversion=0
5989         perl_patchlevel=0
5990         $echo "(You do not have patchlevel.h.  Eek.)"
5991 fi
5992 if $test -r $rsrc/.patch ; then
5993         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5994                 perl_patchlevel=`cat $rsrc/.patch`
5995         fi
5996 fi
5997 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5998 version_patchlevel_string="version $patchlevel subversion $subversion"
5999 case "$perl_patchlevel" in
6000 0|'') ;;
6001 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6002 esac
6003
6004 $echo "(You have $package $version_patchlevel_string.)"
6005
6006 case "$osname" in
6007 dos|vms)
6008         : XXX Should be a Configure test for double-dots in filenames.
6009         version=`echo $revision $patchlevel $subversion | \
6010                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6011         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6012                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6013         ;;
6014 *)
6015         version=`echo $revision $patchlevel $subversion | \
6016                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6017         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6018                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6019         ;;
6020 esac
6021 : Special case the 5.005_xx maintenance series, which used 5.005
6022 : without any subversion label as a subdirectory in $sitelib
6023 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6024         api_versionstring='5.005'
6025 fi
6026
6027 : determine installation style
6028 : For now, try to deduce it from prefix unless it is already set.
6029 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6030 case "$installstyle" in
6031 '')     case "$prefix" in
6032                 *perl*) dflt='lib';;
6033                 *) dflt='lib/perl5' ;;
6034         esac
6035         ;;
6036 *)      dflt="$installstyle" ;;
6037 esac
6038 : Probably not worth prompting for this since we prompt for all
6039 : the directories individually, and the prompt would be too long and
6040 : confusing anyway.
6041 installstyle=$dflt
6042
6043 : determine where public executables go
6044 echo " "
6045 set dflt bin bin
6046 eval $prefixit
6047 fn=d~
6048 rp='Pathname where the public executables will reside?'
6049 . ./getfile
6050 if $test "X$ansexp" != "X$binexp"; then
6051         installbin=''
6052 fi
6053 prefixvar=bin
6054 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6055 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6056 :     this via initialinstalllocation
6057 . ./setprefixvar
6058
6059 case "$userelocatableinc" in
6060 $define|true|[yY]*)     dflt='y' ;;
6061 *)                      dflt='n' ;;
6062 esac
6063 cat <<EOM
6064
6065 Would you like to build Perl so that the installation is relocatable, so that
6066 library paths in @INC are determined relative to the path of the perl binary?
6067 This is not advised for system Perl installs, or if you need to run setid
6068 scripts or scripts under taint mode.
6069
6070 If this doesn't make any sense to you, just accept the default '$dflt'.
6071 EOM
6072 rp='Use relocatable @INC?'
6073 . ./myread
6074 case "$ans" in
6075 y|Y)    val="$define" ;;
6076 *)      val="$undef"  ;;
6077 esac
6078 set userelocatableinc
6079 eval $setvar
6080
6081 initialinstalllocation="$binexp"
6082 : Default prefix is now "up one level from where the binaries are"
6083 case "$userelocatableinc" in
6084 $define|true|[yY]*)
6085     bin=".../"
6086     binexp=".../"
6087     prefix=".../.."
6088     prefixexp=".../.."
6089     installprefixexp=".../.."
6090     ;;
6091 esac
6092
6093 : determine where private library files go
6094 : Usual default is /usr/local/lib/perl5/$version.
6095 : Also allow things like /opt/perl/lib/$version, since
6096 : /opt/perl/lib/perl5... would be redundant.
6097 : The default "style" setting is made in installstyle.U
6098 case "$installstyle" in
6099 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6100 *)       set dflt privlib lib/$version ;;
6101 esac
6102 eval $prefixit
6103 $cat <<EOM
6104
6105 There are some auxiliary files for $package that need to be put into a
6106 private library directory that is accessible by everyone.
6107
6108 EOM
6109 fn=$binexp
6110 fn=d~+
6111 rp='Pathname where the private library files will reside?'
6112 . ./getfile
6113 prefixvar=privlib
6114 . ./setprefixvar
6115
6116 : set the prefixup variable, to restore leading tilda escape
6117 prefixup='case "$prefixexp" in
6118 "$prefix") ;;
6119 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6120 esac'
6121
6122 : determine where public architecture dependent libraries go
6123 set archlib archlib
6124 eval $prefixit
6125 : privlib default is /usr/local/lib/$package/$version
6126 : archlib default is /usr/local/lib/$package/$version/$archname
6127 : privlib may have an optional trailing /share.
6128 tdflt=`echo $privlib | $sed 's,/share$,,'`
6129 tdflt=$tdflt/$archname
6130 case "$archlib" in
6131 '')     dflt=$tdflt
6132         ;;
6133 *)      dflt="$archlib"
6134     ;;
6135 esac
6136 $cat <<EOM
6137
6138 $spackage contains architecture-dependent library files.  If you are
6139 sharing libraries in a heterogeneous environment, you might store
6140 these files in a separate location.  Otherwise, you can just include
6141 them with the rest of the public library files.
6142
6143 EOM
6144 fn=$binexp
6145 fn=d+~
6146 rp='Where do you want to put the public architecture-dependent libraries?'
6147 . ./getfile
6148 prefixvar=archlib
6149 . ./setprefixvar
6150 if $test X"$archlib" = X"$privlib"; then
6151         d_archlib="$undef"
6152 else
6153         d_archlib="$define"
6154 fi
6155
6156 : see if setuid scripts can be secure
6157 $cat <<EOM
6158
6159 Some kernels have a bug that prevents setuid #! scripts from being
6160 secure.  Some sites have disabled setuid #! scripts because of this.
6161
6162 First let's decide if your kernel supports secure setuid #! scripts.
6163 (If setuid #! scripts would be secure but have been disabled anyway,
6164 don't say that they are secure if asked.)
6165
6166 EOM
6167
6168 val="$undef"
6169 if $test -d /dev/fd; then
6170         echo "#!$ls" >reflect
6171         chmod +x,u+s reflect
6172         ./reflect >flect 2>&1
6173         if $contains "/dev/fd" flect >/dev/null; then
6174                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6175                 val="$define"
6176         else
6177                 $cat <<EOM
6178 If you are not sure if they are secure, I can check but I'll need a
6179 username and password different from the one you are using right now.
6180 If you don't have such a username or don't want me to test, simply
6181 enter 'none'.
6182
6183 EOM
6184                 rp='Other username to test security of setuid scripts with?'
6185                 dflt='none'
6186                 . ./myread
6187                 case "$ans" in
6188                 n|none)
6189                         case "$d_suidsafe" in
6190                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6191                                 dflt=n;;
6192                         "$undef")
6193                                 echo "Well, the $hint value is *not* secure." >&4
6194                                 dflt=n;;
6195                         *)      echo "Well, the $hint value *is* secure." >&4
6196                                 dflt=y;;
6197                         esac
6198                         ;;
6199                 *)
6200                         $rm -f reflect flect
6201                         echo "#!$ls" >reflect
6202                         chmod +x,u+s reflect
6203                         echo >flect
6204                         chmod a+w flect
6205                         echo '"su" will (probably) prompt you for '"$ans's password."
6206                         su $ans -c './reflect >flect'
6207                         if $contains "/dev/fd" flect >/dev/null; then
6208                                 echo "Okay, it looks like setuid scripts are secure." >&4
6209                                 dflt=y
6210                         else
6211                                 echo "I don't think setuid scripts are secure." >&4
6212                                 dflt=n
6213                         fi
6214                         ;;
6215                 esac
6216                 rp='Does your kernel have *secure* setuid scripts?'
6217                 . ./myread
6218                 case "$ans" in
6219                 [yY]*)  val="$define";;
6220                 *)      val="$undef";;
6221                 esac
6222         fi
6223 else
6224         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6225         echo "(That's for file descriptors, not floppy disks.)"
6226         val="$undef"
6227 fi
6228 set d_suidsafe
6229 eval $setvar
6230
6231 $rm -f reflect flect
6232
6233 : now see if they want to do setuid emulation
6234 echo " "
6235 val="$undef"
6236 case "$d_suidsafe" in
6237 "$define")
6238         val="$undef"
6239         echo "No need to emulate SUID scripts since they are secure here." >&4
6240         ;;
6241 *)
6242         $cat <<EOM
6243 Some systems have disabled setuid scripts, especially systems where
6244 setuid scripts cannot be secure.  On systems where setuid scripts have
6245 been disabled, the setuid/setgid bits on scripts are currently
6246 useless.  It is possible for $package to detect those bits and emulate
6247 setuid/setgid in a secure fashion.  This emulation will only work if
6248 setuid scripts have been disabled in your kernel.
6249
6250 EOM
6251         case "$d_dosuid" in
6252         "$define") dflt=y ;;
6253         *) dflt=n ;;
6254         esac
6255         rp="Do you want to do setuid/setgid emulation?"
6256         . ./myread
6257         case "$ans" in
6258         [yY]*)  val="$define";;
6259         *)      val="$undef";;
6260         esac
6261         ;;
6262 esac
6263 set d_dosuid
6264 eval $setvar
6265
6266 : Find perl5.005 or later.
6267 echo "Looking for a previously installed perl5.005 or later... "
6268 case "$perl5" in
6269 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6270                 : Check if this perl is recent and can load a simple module
6271                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6272                         perl5=$tdir/perl
6273                         break;
6274                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6275                         perl5=$tdir/perl5
6276                         break;
6277                 fi
6278         done
6279         ;;
6280 *)      perl5="$perl5"
6281         ;;
6282 esac
6283 case "$perl5" in
6284 '')     echo "None found.  That's ok.";;
6285 *)      echo "Using $perl5." ;;
6286 esac
6287
6288 $cat <<EOM
6289
6290 After $package is installed, you may wish to install various
6291 add-on modules and utilities.  Typically, these add-ons will
6292 be installed under $prefix with the rest
6293 of this package.  However, you may wish to install such add-ons
6294 elsewhere under a different prefix.
6295
6296 If you do not wish to put everything under a single prefix, that's
6297 ok.  You will be prompted for the individual locations; this siteprefix
6298 is only used to suggest the defaults.
6299
6300 The default should be fine for most people.
6301
6302 EOM
6303 fn=d~+
6304 rp='Installation prefix to use for add-on modules and utilities?'
6305 : XXX Here might be another good place for an installstyle setting.
6306 case "$siteprefix" in
6307 '') dflt=$prefix ;;
6308 *)  dflt=$siteprefix ;;
6309 esac
6310 . ./getfile
6311 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6312 oldsiteprefix=''
6313 case "$siteprefix" in
6314 '') ;;
6315 *)      case "$ans" in
6316         "$prefix") ;;
6317         *) oldsiteprefix="$prefix";;
6318         esac
6319         ;;
6320 esac
6321 siteprefix="$ans"
6322 siteprefixexp="$ansexp"
6323
6324 : determine where site specific libraries go.
6325 : Usual default is /usr/local/lib/perl5/site_perl/$version
6326 : The default "style" setting is made in installstyle.U
6327 : XXX No longer works with Prefixit stuff.
6328 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6329 case "$sitelib" in
6330 '') case "$installstyle" in
6331         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6332         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6333         esac
6334         ;;
6335 *)      dflt="$sitelib"
6336         ;;
6337 esac
6338 $cat <<EOM
6339
6340 The installation process will create a directory for
6341 site-specific extensions and modules.  Most users find it convenient
6342 to place all site-specific files in this directory rather than in the
6343 main distribution directory.
6344
6345 EOM
6346 fn=d~+
6347 rp='Pathname for the site-specific library files?'
6348 . ./getfile
6349 prefixvar=sitelib
6350 . ./setprefixvar
6351 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6352
6353 : Determine list of previous versions to include in @INC
6354 $cat > getverlist <<EOPL
6355 #!$perl5 -w
6356 use File::Basename;
6357 \$api_versionstring = "$api_versionstring";
6358 \$version = "$version";
6359 \$stem = "$sitelib_stem";
6360 \$archname = "$archname";
6361 EOPL
6362         $cat >> getverlist <<'EOPL'
6363 # Can't have leading @ because metaconfig interprets it as a command!
6364 ;@inc_version_list=();
6365 # XXX Redo to do opendir/readdir?
6366 if (-d $stem) {
6367     chdir($stem);
6368     ;@candidates = glob("5.*");
6369 }
6370 else {
6371     ;@candidates = ();
6372 }
6373
6374 # XXX ToDo:  These comparisons must be reworked when two-digit
6375 # subversions come along, so that 5.7.10 compares as greater than
6376 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6377 # widespread that we can use the built-in version vectors rather
6378 # than reinventing them here.  For 5.6.0, however, we must
6379 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6380 foreach $d (@candidates) {
6381     if ($d lt $version) {
6382         if ($d ge $api_versionstring) {
6383             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6384         }
6385         elsif ($d ge "5.005") {
6386             unshift(@inc_version_list, grep { -d } $d);
6387         }
6388     }
6389     else {
6390         # Skip newer version.  I.e. don't look in
6391         # 5.7.0 if we're installing 5.6.1.
6392     }
6393 }
6394
6395 if (@inc_version_list) {
6396     print join(' ', @inc_version_list);
6397 }
6398 else {
6399     # Blank space to preserve value for next Configure run.
6400     print " ";
6401 }
6402 EOPL
6403 chmod +x getverlist
6404 case "$inc_version_list" in
6405 '')     if test -x "$perl5$exe_ext"; then
6406                 dflt=`$perl5 getverlist`
6407         else
6408                 dflt='none'
6409         fi
6410         ;;
6411 $undef) dflt='none' ;;
6412 *)  eval dflt=\"$inc_version_list\" ;;
6413 esac
6414 case "$dflt" in
6415 ''|' ') dflt=none ;;
6416 esac
6417 case "$dflt" in
6418 5.005) dflt=none ;;
6419 esac
6420 $cat <<EOM
6421
6422 In order to ease the process of upgrading, this version of perl
6423 can be configured to use modules built and installed with earlier
6424 versions of perl that were installed under $prefix.  Specify here
6425 the list of earlier versions that this version of perl should check.
6426 If Configure detected no earlier versions of perl installed under
6427 $prefix, then the list will be empty.  Answer 'none' to tell perl
6428 to not search earlier versions.
6429
6430 The default should almost always be sensible, so if you're not sure,
6431 just accept the default.
6432 EOM
6433
6434 rp='List of earlier versions to include in @INC?'
6435 . ./myread
6436 case "$ans" in
6437 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6438 *) inc_version_list="$ans" ;;
6439 esac
6440 case "$inc_version_list" in
6441 ''|' ')
6442         inc_version_list_init='0'
6443         d_inc_version_list="$undef"
6444         ;;
6445 *)      inc_version_list_init=`echo $inc_version_list |
6446                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6447         d_inc_version_list="$define"
6448         ;;
6449 esac
6450 $rm -f getverlist
6451
6452 : see if this is a malloc.h system
6453 : we want a real compile instead of Inhdr because some systems have a
6454 : malloc.h that just gives a compile error saying to use stdlib.h instead
6455 echo " "
6456 $cat >try.c <<EOCP
6457 #include <stdlib.h>
6458 #include <malloc.h>
6459 int main () { return 0; }
6460 EOCP
6461 set try
6462 if eval $compile; then
6463     echo "<malloc.h> found." >&4
6464     val="$define"
6465 else
6466     echo "<malloc.h> NOT found." >&4
6467     val="$undef"
6468 fi
6469 $rm -f try.c try
6470 set i_malloc
6471 eval $setvar
6472
6473 : check for void type
6474 echo " "
6475 echo "Checking to see how well your C compiler groks the void type..." >&4
6476 case "$voidflags" in
6477 '')
6478         $cat >try.c <<EOCP
6479 #$i_stdlib I_STDLIB
6480 #ifdef I_STDLIB
6481 #include <stdlib.h>
6482 #endif
6483 #if TRY & 1
6484 void sub() {
6485 #else
6486 sub() {
6487 #endif
6488         extern void moo();      /* function returning void */
6489         void (*goo)();          /* ptr to func returning void */
6490 #if TRY & 8
6491         void *hue;              /* generic ptr */
6492 #endif
6493 #if TRY & 2
6494         void (*foo[10])();
6495 #endif
6496
6497 #if TRY & 4
6498         if(goo == moo) {
6499                 exit(0);
6500         }
6501 #endif
6502         exit(0);
6503 }
6504 int main() { sub(); }
6505 EOCP
6506         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6507                 voidflags=$defvoidused
6508         echo "Good.  It appears to support void to the level $package wants.">&4
6509                 if $contains warning .out >/dev/null 2>&1; then
6510                         echo "However, you might get some warnings that look like this:"
6511                         $cat .out
6512                 fi
6513         else
6514 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6515                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6516                         echo "It supports 1..."
6517                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6518                                 echo "It also supports 2..."
6519                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6520                                         voidflags=7
6521                                         echo "And it supports 4 but not 8 definitely."
6522                                 else
6523                                         echo "It doesn't support 4..."
6524                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6525                                                 voidflags=11
6526                                                 echo "But it supports 8."
6527                                         else
6528                                                 voidflags=3
6529                                                 echo "Neither does it support 8."
6530                                         fi
6531                                 fi
6532                         else
6533                                 echo "It does not support 2..."
6534                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6535                                         voidflags=13
6536                                         echo "But it supports 4 and 8."
6537                                 else
6538                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6539                                                 voidflags=5
6540                                                 echo "And it supports 4 but has not heard about 8."
6541                                         else
6542                                                 echo "However it supports 8 but not 4."
6543                                         fi
6544                                 fi
6545                         fi
6546                 else
6547                         echo "There is no support at all for void."
6548                         voidflags=0
6549                 fi
6550         fi
6551 esac
6552 case "$voidflags" in
6553 "$defvoidused") ;;
6554 *)      $cat >&4 <<'EOM'
6555   Support flag bits are:
6556     1: basic void declarations.
6557     2: arrays of pointers to functions returning void.
6558     4: operations between pointers to and addresses of void functions.
6559     8: generic void pointers.
6560 EOM
6561         dflt="$voidflags";
6562         rp="Your void support flags add up to what?"
6563         . ./myread
6564         voidflags="$ans"
6565         ;;
6566 esac
6567 $rm -f try.* .out
6568
6569 : check for length of pointer
6570 echo " "
6571 case "$ptrsize" in
6572 '')
6573         echo "Checking to see how big your pointers are..." >&4
6574         if test "$voidflags" -gt 7; then
6575                 echo '#define VOID_PTR char *' > try.c
6576         else
6577                 echo '#define VOID_PTR void *' > try.c
6578         fi
6579         $cat >>try.c <<EOCP
6580 #include <stdio.h>
6581 #$i_stdlib I_STDLIB
6582 #ifdef I_STDLIB
6583 #include <stdlib.h>
6584 #endif
6585 int main()
6586 {
6587     printf("%d\n", (int)sizeof(VOID_PTR));
6588     exit(0);
6589 }
6590 EOCP
6591         set try
6592         if eval $compile_ok; then
6593                 ptrsize=`$run ./try`
6594                 echo "Your pointers are $ptrsize bytes long."
6595         else
6596                 dflt='4'
6597                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6598                 rp="What is the size of a pointer (in bytes)?"
6599                 . ./myread
6600                 ptrsize="$ans"
6601         fi
6602         ;;
6603 esac
6604 $rm -f try.c try
6605 case "$use64bitall" in
6606 "$define"|true|[yY]*)
6607         case "$ptrsize" in
6608         4)      cat <<EOM >&4
6609
6610 *** You have chosen a maximally 64-bit build,
6611 *** but your pointers are only 4 bytes wide.
6612 *** Please rerun Configure without -Duse64bitall.
6613 EOM
6614                 case "$d_quad" in
6615                 define)
6616                         cat <<EOM >&4
6617 *** Since you have quads, you could possibly try with -Duse64bitint.
6618 EOM
6619                         ;;
6620                 esac
6621                 cat <<EOM >&4
6622 *** Cannot continue, aborting.
6623
6624 EOM
6625
6626                 exit 1
6627                 ;;
6628         esac
6629         ;;
6630 esac
6631
6632
6633 : determine whether to use malloc wrapping
6634 echo " "
6635 case "$usemallocwrap" in
6636 [yY]*|true|$define)     dflt='y' ;;
6637 [nN]*|false|$undef)     dflt='n' ;;
6638 *)      case "$usedevel" in
6639         [yY]*|true|$define)     dflt='y' ;;
6640         *) dflt='n' ;;
6641         esac
6642         ;;
6643 esac
6644 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6645 . ./myread
6646 usemallocwrap="$ans"
6647 case "$ans" in
6648 y*|true)
6649         usemallocwrap="$define" ;;
6650 *)
6651         usemallocwrap="$undef" ;;
6652 esac
6653
6654 : determine which malloc to compile in
6655 echo " "
6656 case "$usemymalloc" in
6657 [yY]*|true|$define)     dflt='y' ;;
6658 [nN]*|false|$undef)     dflt='n' ;;
6659 *)      case "$ptrsize" in
6660         4) dflt='y' ;;
6661         *) dflt='n' ;;
6662         esac
6663         ;;
6664 esac
6665 rp="Do you wish to attempt to use the malloc that comes with $package?"
6666 . ./myread
6667 usemymalloc="$ans"
6668 case "$ans" in
6669 y*|true)
6670         usemymalloc='y'
6671         mallocsrc='malloc.c'
6672         mallocobj="malloc$_o"
6673         d_mymalloc="$define"
6674         case "$libs" in
6675         *-lmalloc*)
6676                 : Remove malloc from list of libraries to use
6677                 echo "Removing unneeded -lmalloc from library list" >&4
6678                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6679                 shift
6680                 libs="$*"
6681                 echo "libs = $libs" >&4
6682                 ;;
6683         esac
6684         ;;
6685 *)
6686         usemymalloc='n'
6687         mallocsrc=''
6688         mallocobj=''
6689         d_mymalloc="$undef"
6690         ;;
6691 esac
6692
6693 : compute the return types of malloc and free
6694 echo " "
6695 $cat >malloc.c <<END
6696 #$i_malloc I_MALLOC
6697 #$i_stdlib I_STDLIB
6698 #include <stdio.h>
6699 #include <sys/types.h>
6700 #ifdef I_MALLOC
6701 #include <malloc.h>
6702 #endif
6703 #ifdef I_STDLIB
6704 #include <stdlib.h>
6705 #endif
6706 #ifdef TRY_MALLOC
6707 void *malloc();
6708 #endif
6709 #ifdef TRY_FREE
6710 void free();
6711 #endif
6712 END
6713 case "$malloctype" in
6714 '')
6715         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6716                 malloctype='void *'
6717         else
6718                 malloctype='char *'
6719         fi
6720         ;;
6721 esac
6722 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6723
6724 case "$freetype" in
6725 '')
6726         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6727                 freetype='void'
6728         else
6729                 freetype='int'
6730         fi
6731         ;;
6732 esac
6733 echo "Your system uses $freetype free(), it would seem." >&4
6734 $rm -f malloc.[co]
6735 : determine where site specific architecture-dependent libraries go.
6736 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6737 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6738 : sitelib may have an optional trailing /share.
6739 case "$sitearch" in
6740 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6741         dflt="$dflt/$archname"
6742         ;;
6743 *)      dflt="$sitearch"
6744         ;;
6745 esac
6746 set sitearch sitearch none
6747 eval $prefixit
6748 $cat <<EOM
6749
6750 The installation process will also create a directory for
6751 architecture-dependent site-specific extensions and modules.
6752
6753 EOM
6754 fn=d~+
6755 rp='Pathname for the site-specific architecture-dependent library files?'
6756 . ./getfile
6757 prefixvar=sitearch
6758 . ./setprefixvar
6759 if $test X"$sitearch" = X"$sitelib"; then
6760         d_sitearch="$undef"
6761 else
6762         d_sitearch="$define"
6763 fi
6764
6765 $cat <<EOM
6766
6767 The installation process will also create a directory for
6768 vendor-supplied add-ons.  Vendors who supply perl with their system
6769 may find it convenient to place all vendor-supplied files in this
6770 directory rather than in the main distribution directory.  This will
6771 ease upgrades between binary-compatible maintenance versions of perl.
6772
6773 Of course you may also use these directories in whatever way you see
6774 fit.  For example, you might use them to access modules shared over a
6775 company-wide network.
6776
6777 The default answer should be fine for most people.
6778 This causes further questions about vendor add-ons to be skipped
6779 and no vendor-specific directories will be configured for perl.
6780
6781 EOM
6782 rp='Do you want to configure vendor-specific add-on directories?'
6783 case "$usevendorprefix" in
6784 define|true|[yY]*) dflt=y ;;
6785 *)      : User may have set vendorprefix directly on Configure command line.
6786         case "$vendorprefix" in
6787         ''|' ') dflt=n ;;
6788         *)      dflt=y ;;
6789         esac
6790         ;;
6791 esac
6792 . ./myread
6793 case "$ans" in
6794 [yY]*)  fn=d~+
6795         rp='Installation prefix to use for vendor-supplied add-ons?'
6796         case "$vendorprefix" in
6797         '') dflt='' ;;
6798         *)  dflt=$vendorprefix ;;
6799         esac
6800         . ./getfile
6801         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6802         oldvendorprefix=''
6803         case "$vendorprefix" in
6804         '') ;;
6805         *)      case "$ans" in
6806                 "$prefix") ;;
6807                 *) oldvendorprefix="$prefix";;
6808                 esac
6809                 ;;
6810         esac
6811         usevendorprefix="$define"
6812         vendorprefix="$ans"
6813         vendorprefixexp="$ansexp"
6814         ;;
6815 *)      usevendorprefix="$undef"
6816         vendorprefix=''
6817         vendorprefixexp=''
6818         ;;
6819 esac
6820
6821 case "$vendorprefix" in
6822 '')     d_vendorlib="$undef"
6823         vendorlib=''
6824         vendorlibexp=''
6825         ;;
6826 *)      d_vendorlib="$define"
6827         : determine where vendor-supplied modules go.
6828         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6829         case "$vendorlib" in
6830         '')
6831                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6832                 case "$installstyle" in
6833                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6834                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6835                 esac
6836                 ;;
6837         *)      dflt="$vendorlib"
6838                 ;;
6839         esac
6840         fn=d~+
6841         rp='Pathname for the vendor-supplied library files?'
6842         . ./getfile
6843         vendorlib="$ans"
6844         vendorlibexp="$ansexp"
6845         ;;
6846 esac
6847 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6848 prefixvar=vendorlib
6849 . ./installprefix
6850
6851 case "$vendorprefix" in
6852 '')     d_vendorarch="$undef"
6853         vendorarch=''
6854         vendorarchexp=''
6855         ;;
6856 *)      d_vendorarch="$define"
6857         : determine where vendor-supplied architecture-dependent libraries go.
6858         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6859         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6860         : vendorlib may have an optional trailing /share.
6861         case "$vendorarch" in
6862         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6863                 dflt="$dflt/$archname"
6864                 ;;
6865         *)      dflt="$vendorarch" ;;
6866         esac
6867         fn=d~+
6868         rp='Pathname for vendor-supplied architecture-dependent files?'
6869         . ./getfile
6870         vendorarch="$ans"
6871         vendorarchexp="$ansexp"
6872         ;;
6873 esac
6874 prefixvar=vendorarch
6875 . ./installprefix
6876
6877 : Final catch-all directories to search
6878 $cat <<EOM
6879
6880 Lastly, you can have perl look in other directories for extensions and
6881 modules in addition to those already specified.
6882 These directories will be searched after 
6883         $sitearch 
6884         $sitelib 
6885 EOM
6886 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6887 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6888 echo ' '
6889 case "$otherlibdirs" in
6890 ''|' ') dflt='none' ;;
6891 *)      dflt="$otherlibdirs" ;;
6892 esac
6893 $cat <<EOM
6894 Enter a colon-separated set of extra paths to include in perl's @INC
6895 search path, or enter 'none' for no extra paths.
6896
6897 EOM
6898
6899 rp='Colon-separated list of additional directories for perl to search?'
6900 . ./myread
6901 case "$ans" in
6902 ' '|''|none)    otherlibdirs=' ' ;;     
6903 *)      otherlibdirs="$ans" ;;
6904 esac
6905 case "$otherlibdirs" in
6906 ' ') val=$undef ;;
6907 *)      val=$define ;;
6908 esac
6909 set d_perl_otherlibdirs
6910 eval $setvar
6911
6912 : Cruising for prototypes
6913 echo " "
6914 echo "Checking out function prototypes..." >&4
6915 $cat >prototype.c <<EOCP
6916 #$i_stdlib I_STDLIB
6917 #ifdef I_STDLIB
6918 #include <stdlib.h>
6919 #endif
6920 int main(int argc, char *argv[]) {
6921         exit(0);}
6922 EOCP
6923 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6924         echo "Your C compiler appears to support function prototypes."
6925         val="$define"
6926 else
6927         echo "Your C compiler doesn't seem to understand function prototypes."
6928         val="$undef"
6929 fi
6930 set prototype
6931 eval $setvar
6932 $rm -f prototype*
6933
6934 case "$prototype" in
6935 "$define") ;;
6936 *)      ansi2knr='ansi2knr'
6937         echo " "
6938         cat <<EOM >&4
6939
6940 $me:  FATAL ERROR:
6941 This version of $package can only be compiled by a compiler that 
6942 understands function prototypes.  Unfortunately, your C compiler 
6943         $cc $ccflags
6944 doesn't seem to understand them.  Sorry about that.
6945
6946 If GNU cc is available for your system, perhaps you could try that instead.  
6947
6948 Eventually, we hope to support building Perl with pre-ANSI compilers.
6949 If you would like to help in that effort, please contact <perlbug@perl.org>.
6950
6951 Aborting Configure now.
6952 EOM
6953         exit 2
6954         ;;
6955 esac
6956
6957 echo " "
6958 case "$extras" in
6959 '') dflt='n';;
6960 *) dflt='y';;
6961 esac
6962 cat <<EOM
6963 Perl can be built with extra modules or bundles of modules which
6964 will be fetched from the CPAN and installed alongside Perl.
6965
6966 Notice that you will need access to the CPAN; either via the Internet,
6967 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6968 be asked later to configure the CPAN.pm module which will in turn do
6969 the installation of the rest of the extra modules or bundles.)
6970
6971 Notice also that if the modules require any external software such as
6972 libraries and headers (the libz library and the zlib.h header for the
6973 Compress::Zlib module, for example) you MUST have any such software
6974 already installed, this configuration process will NOT install such
6975 things for you.
6976
6977 If this doesn't make any sense to you, just accept the default '$dflt'.
6978 EOM
6979 rp='Install any extra modules (y or n)?'
6980 . ./myread
6981 case "$ans" in
6982 y|Y)
6983         cat <<EOM
6984
6985 Please list any extra modules or bundles to be installed from CPAN,
6986 with spaces between the names.  The names can be in any format the
6987 'install' command of CPAN.pm will understand.  (Answer 'none',
6988 without the quotes, to install no extra modules or bundles.)
6989 EOM
6990         rp='Extras?'
6991         dflt="$extras"
6992         . ./myread
6993         extras="$ans"
6994 esac
6995 case "$extras" in
6996 ''|'none')
6997         val=''
6998         $rm -f ../extras.lst
6999         ;;
7000 *)      echo "(Saving the list of extras for later...)"
7001         echo "$extras" > ../extras.lst
7002         val="'$extras'"
7003         ;;
7004 esac
7005 set extras
7006 eval $setvar
7007 echo " "
7008
7009 : determine where html pages for programs go
7010 set html1dir html1dir none
7011 eval $prefixit
7012 $cat <<EOM
7013
7014 If you wish to install html files for programs in $spackage, indicate
7015 the appropriate directory here.  To skip installing html files,
7016 answer "none".
7017 EOM
7018 case "$html1dir" in
7019 ''|none|$undef|' ') dflt=none ;;
7020 *) dflt=$html1dir ;;
7021 esac
7022 fn=dn+~
7023 rp="Directory for the main $spackage html pages?"
7024 . ./getfile
7025 prefixvar=html1dir
7026 . ./setprefixvar
7027 : Use ' ' for none so value is preserved next time through Configure
7028 $test X"$html1dir" = "X" && html1dir=' '
7029
7030 : determine where html pages for libraries and modules go
7031 set html3dir html3dir none
7032 eval $prefixit
7033 $cat <<EOM
7034
7035 If you wish to install html files for modules associated with $spackage,
7036 indicate the appropriate directory here.  To skip installing html files,
7037 answer "none".
7038 EOM
7039 : There is no obvious default.  If they have specified html1dir, then
7040 : try to key off that, possibly changing .../html1 into .../html3.
7041 case "$html3dir" in
7042 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7043 *) dflt=$html3dir ;;
7044 esac
7045 fn=dn+~
7046 rp="Directory for the $spackage module html pages?"
7047 . ./getfile
7048 prefixvar=html3dir
7049 . ./setprefixvar
7050 : Use ' ' for none so value is preserved next time through Configure
7051 $test X"$html3dir" = "X" && html3dir=' '
7052
7053 : determine whether to install perl also as /usr/bin/perl
7054
7055 echo " "
7056 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7057         $cat <<EOM
7058 Many scripts expect perl to be installed as /usr/bin/perl.
7059
7060 If you want to, I can install the perl you are about to compile
7061 as /usr/bin/perl (in addition to $bin/perl).
7062 EOM
7063         if test -f /usr/bin/perl; then
7064             $cat <<EOM
7065
7066 However, please note that because you already have a /usr/bin/perl,
7067 overwriting that with a new Perl would very probably cause problems.
7068 Therefore I'm assuming you don't want to do that (unless you insist).
7069
7070 EOM
7071             case "$installusrbinperl" in
7072             "$define"|[yY]*)    dflt='y';;
7073             *)                  dflt='n';;
7074             esac
7075         else
7076             $cat <<EOM
7077
7078 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7079
7080 EOM
7081             case "$installusrbinperl" in
7082             "$undef"|[nN]*)     dflt='n';;
7083             *)                  dflt='y';;
7084             esac
7085         fi
7086         rp="Do you want to install perl as /usr/bin/perl?"
7087         . ./myread
7088         case "$ans" in
7089         [yY]*)  val="$define";;
7090         *)      val="$undef" ;;
7091         esac
7092 else
7093         val="$undef"
7094 fi
7095 set installusrbinperl
7096 eval $setvar
7097
7098 echo " "
7099 echo "Checking for GNU C Library..." >&4
7100 cat >try.c <<'EOCP'
7101 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7102    alone are insufficient to distinguish different versions, such as
7103    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7104    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7105 */
7106 #include <stdio.h>
7107 int main(void)
7108 {
7109 #ifdef __GLIBC__
7110 #   ifdef __GLIBC_MINOR__
7111 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7112 #           include <gnu/libc-version.h>
7113             printf("%s\n",  gnu_get_libc_version());
7114 #       else
7115             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7116 #       endif
7117 #   else
7118         printf("%d\n",  __GLIBC__);
7119 #   endif
7120     return 0;
7121 #else
7122     return 1;
7123 #endif
7124 }
7125 EOCP
7126 set try
7127 if eval $compile_ok && $run ./try > glibc.ver; then
7128         val="$define"
7129         gnulibc_version=`$cat glibc.ver`
7130         echo "You are using the GNU C Library version $gnulibc_version"
7131 else
7132         val="$undef"
7133         gnulibc_version=''
7134         echo "You are not using the GNU C Library"
7135 fi
7136 $rm -f try try.* glibc.ver
7137 set d_gnulibc
7138 eval $setvar
7139
7140 echo " "
7141 echo "Checking for C++..." >&4
7142 cat >try.c <<'EOCP'
7143 #include <stdio.h>
7144 int main(void)
7145 {
7146 #ifdef __cplusplus
7147     printf("define\n");
7148 #else
7149     printf("undef\n");
7150 #endif
7151     return 0;
7152 }
7153 EOCP
7154 set try
7155 if eval $compile_ok && $run ./try > cplusplus; then
7156         val=`$cat cplusplus`
7157         echo "You are using a C++ compiler."
7158 else
7159         val="$undef"
7160         echo "You are not using a C++ compiler."
7161 fi
7162 $rm -f try try.* cplusplus
7163 set d_cplusplus
7164 eval $setvar
7165
7166 : see if nm is to be used to determine whether a symbol is defined or not
7167 case "$usenm" in
7168 '')
7169         dflt=''
7170         case "$d_gnulibc" in
7171         "$define")
7172                 echo " "
7173                 echo "nm probably won't work on the GNU C Library." >&4
7174                 dflt=n
7175                 ;;
7176         esac
7177         case "$dflt" in
7178         '') 
7179                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7180                         echo " "
7181                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7182                         echo "'nm' won't be sufficient on this sytem." >&4
7183                         dflt=n
7184                 fi
7185                 ;;
7186         esac
7187         case "$dflt" in
7188         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7189                 if $test $dflt -gt 20; then
7190                         dflt=y
7191                 else
7192                         dflt=n
7193                 fi
7194                 ;;
7195         esac
7196         ;;
7197 *)
7198         case "$usenm" in
7199         true|$define) dflt=y;;
7200         *) dflt=n;;
7201         esac
7202         ;;
7203 esac
7204 $cat <<EOM
7205
7206 I can use $nm to extract the symbols from your C libraries. This
7207 is a time consuming task which may generate huge output on the disk (up
7208 to 3 megabytes) but that should make the symbols extraction faster. The
7209 alternative is to skip the 'nm' extraction part and to compile a small
7210 test program instead to determine whether each symbol is present. If
7211 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7212 this may be the best solution.
7213
7214 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7215
7216 EOM
7217 rp="Shall I use $nm to extract C symbols from the libraries?"
7218 . ./myread
7219 case "$ans" in
7220 [Nn]*) usenm=false;;
7221 *) usenm=true;;
7222 esac
7223
7224 runnm=$usenm
7225 case "$reuseval" in
7226 true) runnm=false;;
7227 esac
7228
7229 : nm options which may be necessary
7230 case "$nm_opt" in
7231 '') if $test -f /mach_boot; then
7232                 nm_opt=''       # Mach
7233         elif $test -d /usr/ccs/lib; then
7234                 nm_opt='-p'     # Solaris (and SunOS?)
7235         elif $test -f /dgux; then
7236                 nm_opt='-p'     # DG-UX
7237         elif $test -f /lib64/rld; then
7238                 nm_opt='-p'     # 64-bit Irix
7239         else
7240                 nm_opt=''
7241         fi;;
7242 esac
7243
7244 : nm options which may be necessary for shared libraries but illegal
7245 : for archive libraries.  Thank you, Linux.
7246 case "$nm_so_opt" in
7247 '')     case "$myuname" in
7248         *linux*|gnu*)
7249                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7250                         nm_so_opt='--dynamic'
7251                 fi
7252                 ;;
7253         esac
7254         ;;
7255 esac
7256
7257 case "$runnm" in
7258 true)
7259 : get list of predefined functions in a handy place
7260 echo " "
7261 case "$libc" in
7262 '') libc=unknown
7263         case "$libs" in
7264         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7265         esac
7266         ;;
7267 esac
7268 case "$libs" in
7269 '') ;;
7270 *)  for thislib in $libs; do
7271         case "$thislib" in
7272         -lc|-lc_s)
7273                 : Handle C library specially below.
7274                 ;;
7275         -l*)
7276                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7277                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7278                         :
7279                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7280                         :
7281                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7282                         :
7283                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7284                         :
7285                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7286                         :
7287                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7288                         :
7289                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7290                         :
7291                 else
7292                         try=''
7293                 fi
7294                 libnames="$libnames $try"
7295                 ;;
7296         *) libnames="$libnames $thislib" ;;
7297         esac
7298         done
7299         ;;
7300 esac
7301 xxx=normal
7302 case "$libc" in
7303 unknown)
7304         set /lib/libc.$so
7305         for xxx in $libpth; do
7306                 $test -r $1 || set $xxx/libc.$so
7307                 : The messy sed command sorts on library version numbers.
7308                 $test -r $1 || \
7309                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7310                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7311                                 h
7312                                 s/[0-9][0-9]*/0000&/g
7313                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7314                                 G
7315                                 s/\n/ /' | \
7316                          $sort | $sed -e 's/^.* //'`
7317                 eval set \$$#
7318         done
7319         $test -r $1 || set /usr/ccs/lib/libc.$so
7320         $test -r $1 || set /lib/libsys_s$_a
7321         ;;
7322 *)
7323         set blurfl
7324         ;;
7325 esac
7326 if $test -r "$1"; then
7327         echo "Your (shared) C library seems to be in $1."
7328         libc="$1"
7329 elif $test -r /lib/libc && $test -r /lib/clib; then
7330         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7331         xxx=apollo
7332         libc='/lib/clib /lib/libc'
7333         if $test -r /lib/syslib; then
7334                 echo "(Your math library is in /lib/syslib.)"
7335                 libc="$libc /lib/syslib"
7336         fi
7337 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7338         echo "Your C library seems to be in $libc, as you said before."
7339 elif $test -r $incpath/usr/lib/libc$_a; then
7340         libc=$incpath/usr/lib/libc$_a;
7341         echo "Your C library seems to be in $libc.  That's fine."
7342 elif $test -r /lib/libc$_a; then
7343         libc=/lib/libc$_a;
7344         echo "Your C library seems to be in $libc.  You're normal."
7345 else
7346         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7347                 :
7348         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7349                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7350         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7351                 :
7352         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7353                 :
7354         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7355                 :
7356         else
7357                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7358         fi
7359         if $test -r "$tans"; then
7360                 echo "Your C library seems to be in $tans, of all places."
7361                 libc=$tans
7362         else
7363                 libc='blurfl'
7364         fi
7365 fi
7366 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7367         dflt="$libc"
7368         cat <<EOM
7369
7370 If the guess above is wrong (which it might be if you're using a strange
7371 compiler, or your machine supports multiple models), you can override it here.
7372
7373 EOM
7374 else
7375         dflt=''
7376         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7377         cat >&4 <<EOM
7378 I can't seem to find your C library.  I've looked in the following places:
7379
7380 EOM
7381         $sed 's/^/      /' libpath
7382         cat <<EOM
7383
7384 None of these seems to contain your C library. I need to get its name...
7385
7386 EOM
7387 fi
7388 fn=f
7389 rp='Where is your C library?'
7390 . ./getfile
7391 libc="$ans"
7392
7393 echo " "
7394 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7395 set X `cat libnames`
7396 shift
7397 xxx=files
7398 case $# in 1) xxx=file; esac
7399 echo "Extracting names from the following $xxx for later perusal:" >&4
7400 echo " "
7401 $sed 's/^/      /' libnames >&4
7402 echo " "
7403 $echo $n "This may take a while...$c" >&4
7404
7405 for file in $*; do
7406         case $file in
7407         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7408         *) $nm $nm_opt $file 2>/dev/null;;
7409         esac
7410 done >libc.tmp
7411
7412 $echo $n ".$c"
7413 $grep fprintf libc.tmp > libc.ptf
7414 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7415 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7416 xxx='[ADTSIW]'
7417 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7418         eval $xscan;\
7419         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7420                 eval $xrun
7421 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7422         eval $xscan;\
7423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7424                 eval $xrun
7425 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7426         eval $xscan;\
7427         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7428                 eval $xrun
7429 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7430         eval $xscan;\
7431         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7432                 eval $xrun
7433 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7434         eval $xscan;\
7435         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7436                 eval $xrun
7437 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7438         eval $xscan;\
7439         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7440                 eval $xrun
7441 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7442                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7443         eval $xscan;\
7444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7445                 eval $xrun
7446 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7447         eval $xscan;\
7448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449                 eval $xrun
7450 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7451         eval $xscan;\
7452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7453                 eval $xrun
7454 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7455         eval $xscan;\
7456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457                 eval $xrun
7458 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7459         eval $xscan;\
7460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7461                 eval $xrun
7462 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7463         eval $xscan;\
7464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7465                 eval $xrun
7466 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7467         eval $xscan;\
7468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469                 eval $xrun
7470 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7471         eval $xscan;\
7472         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7473                 eval $xrun
7474 else
7475         $nm -p $* 2>/dev/null >libc.tmp
7476         $grep fprintf libc.tmp > libc.ptf
7477         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7478                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7479         then
7480                 nm_opt='-p'
7481                 eval $xrun
7482         else
7483                 echo " "
7484                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7485                 com=''
7486                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7487                         for thisname in $libnames $libc; do
7488                                 $ar t $thisname >>libc.tmp
7489                         done
7490                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7491                         echo "Ok." >&4
7492                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7493                         # Repeat libc to extract forwarders to DLL entries too
7494                         for thisname in $libnames $libc; do
7495                                 $ar tv $thisname >>libc.tmp
7496                                 # Revision 50 of EMX has bug in $ar.
7497                                 # it will not extract forwarders to DLL entries
7498                                 # Use emximp which will extract exactly them.
7499                                 emximp -o tmp.imp $thisname \
7500                                     2>/dev/null && \
7501                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7502                                     < tmp.imp >>libc.tmp
7503                                 $rm tmp.imp
7504                         done
7505                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7506                         echo "Ok." >&4
7507                 else
7508                         echo "$ar didn't seem to work right." >&4
7509                         echo "Maybe this is a Cray...trying bld instead..." >&4
7510                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7511                         then
7512                                 for thisname in $libnames; do
7513                                         bld t $libnames | \
7514                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7515                                         $ar t $thisname >>libc.tmp
7516                                 done
7517                                 echo "Ok." >&4
7518                         else
7519                                 echo "That didn't work either.  Giving up." >&4
7520                                 exit 1
7521                         fi
7522                 fi
7523         fi
7524 fi
7525 nm_extract="$com"
7526 case "$PASE" in
7527 define)
7528     echo " "
7529     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7530     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7531     ;;
7532 *)  if $test -f /lib/syscalls.exp; then
7533         echo " "
7534         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7535         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7536     fi
7537     ;;
7538 esac
7539 ;;
7540 esac
7541 $rm -f libnames libpath
7542
7543 : see if dld is available
7544 set dld.h i_dld
7545 eval $inhdr
7546
7547 : is a C symbol defined?
7548 csym='tlook=$1;
7549 case "$3" in
7550 -v) tf=libc.tmp; tdc="";;
7551 -a) tf=libc.tmp; tdc="[]";;
7552 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7553 esac;
7554 tx=yes;
7555 case "$reuseval-$4" in
7556 true-) ;;
7557 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7558 esac;
7559 case "$tx" in
7560 yes)
7561         tval=false;
7562         if $test "$runnm" = true; then
7563                 if $contains $tlook $tf >/dev/null 2>&1; then
7564                         tval=true;
7565                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7566                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7567                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7568                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7569                         $rm -f try$_exe try.c core core.* try.core;
7570                 fi;
7571         else
7572                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7573                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7574                 $rm -f try$_exe try.c;
7575         fi;
7576         ;;
7577 *)
7578         case "$tval" in
7579         $define) tval=true;;
7580         *) tval=false;;
7581         esac;
7582         ;;
7583 esac;
7584 eval "$2=$tval"'
7585
7586 : define an is-in-libc? function
7587 inlibc='echo " "; td=$define; tu=$undef;
7588 sym=$1; var=$2; eval "was=\$$2";
7589 tx=yes;
7590 case "$reuseval$was" in
7591 true) ;;
7592 true*) tx=no;;
7593 esac;
7594 case "$tx" in
7595 yes)
7596         set $sym tres -f;
7597         eval $csym;
7598         case "$tres" in
7599         true)
7600                 echo "$sym() found." >&4;
7601                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7602         *)
7603                 echo "$sym() NOT found." >&4;
7604                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7605         esac;;
7606 *)
7607         case "$was" in
7608         $define) echo "$sym() found." >&4;;
7609         *) echo "$sym() NOT found." >&4;;
7610         esac;;
7611 esac'
7612
7613 : see if dlopen exists
7614 xxx_runnm="$runnm"
7615 xxx_ccflags="$ccflags"
7616 runnm=false
7617 : with g++ one needs -shared to get is-in-libc to work for dlopen
7618 case "$gccversion" in
7619 '')     ;;
7620 *)      case "$d_cplusplus" in
7621         "$define") ccflags="$ccflags -shared" ;;
7622         esac
7623         ;;
7624 esac
7625 set dlopen d_dlopen
7626 eval $inlibc
7627 runnm="$xxx_runnm"
7628 ccflags="$xxx_ccflags"
7629
7630 : see if this is a unistd.h system
7631 set unistd.h i_unistd
7632 eval $inhdr
7633
7634 : determine which dynamic loading, if any, to compile in
7635 echo " "
7636 dldir="ext/DynaLoader"
7637 case "$usedl" in
7638 $define|y|true)
7639         dflt='y'
7640         usedl="$define"
7641         ;;
7642 $undef|n|false)
7643         dflt='n'
7644         usedl="$undef"
7645         ;;
7646 *) 
7647         dflt='n'
7648         case "$d_dlopen" in
7649             $define) dflt='y' ;;
7650         esac
7651         case "$i_dld" in
7652             $define) dflt='y' ;;
7653         esac
7654         : Does a dl_xxx.xs file exist for this operating system
7655         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7656         ;;
7657 esac
7658 rp="Do you wish to use dynamic loading?"
7659 . ./myread
7660 usedl="$ans"
7661 case "$ans" in
7662 y*) usedl="$define"
7663         case "$dlsrc" in
7664         '')
7665                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7666                         dflt="$dldir/dl_${osname}.xs"
7667                 elif $test "$d_dlopen" = "$define" ; then
7668                         dflt="$dldir/dl_dlopen.xs"
7669                 elif $test "$i_dld" = "$define" ; then
7670                         dflt="$dldir/dl_dld.xs"
7671                 else
7672                         dflt=''
7673                 fi
7674                 ;;
7675         *)      dflt="$dldir/$dlsrc"
7676                 ;;
7677         esac
7678     echo "The following dynamic loading files are available:"
7679         : Can not go over to $dldir because getfile has path hard-coded in.
7680         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7681         rp="Source file to use for dynamic loading"
7682         fn="fne"
7683         gfpth="$src"
7684         . ./getfile
7685         usedl="$define"
7686         : emulate basename
7687         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7688
7689         $cat << EOM
7690
7691 Some systems may require passing special flags to $cc -c to
7692 compile modules that will be used to create a shared library.
7693 To use no flags, say "none".
7694
7695 EOM
7696     case "$cccdlflags" in
7697     '') case "$gccversion" in
7698                 '') case "$osname" in
7699                         hpux)   dflt='+z' ;;
7700                         next)   dflt='none' ;;
7701                         irix*)  dflt='-KPIC' ;;
7702                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7703                         sunos)  dflt='-pic' ;;
7704                         *)      dflt='none' ;;
7705                     esac
7706                         ;;
7707                 *)  case "$osname" in
7708                         darwin) dflt='none' ;;
7709                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7710                         *)      dflt='-fpic' ;;
7711                     esac ;;
7712             esac ;;
7713         ' ') dflt='none' ;;
7714     *)  dflt="$cccdlflags" ;;
7715     esac
7716     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7717     . ./myread
7718     case "$ans" in
7719     none) cccdlflags=' ' ;;
7720     *) cccdlflags="$ans" ;;
7721     esac
7722
7723     cat << EOM
7724
7725 Some systems use ld to create libraries that can be dynamically loaded,
7726 while other systems (such as those using ELF) use $cc.
7727
7728 EOM
7729         case "$ld" in
7730         '')     $cat >try.c <<EOM
7731 /* Test for whether ELF binaries are produced */
7732 #include <fcntl.h>
7733 #$i_stdlib I_STDLIB
7734 #ifdef I_STDLIB
7735 #include <stdlib.h>
7736 #endif
7737 #$i_unistd I_UNISTD
7738 #ifdef I_UNISTD
7739 #include <unistd.h>
7740 #endif
7741 int main() {
7742         char b[4];
7743         int i = open("a.out",O_RDONLY);
7744         if(i == -1) 
7745                 exit(1); /* fail */
7746         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7747                 exit(0); /* succeed (yes, it's ELF) */
7748         else
7749                 exit(1); /* fail */
7750 }
7751 EOM
7752                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7753                         cat <<EOM
7754 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7755 EOM
7756                         dflt="$cc"
7757                 else
7758                         echo "I'll use ld to build dynamic libraries."
7759                         dflt='ld'
7760                 fi
7761                 rm -f try.c a.out
7762                 ;;
7763         *)      dflt="$ld"
7764                 ;;
7765         esac
7766
7767     rp="What command should be used to create dynamic libraries?"
7768     . ./myread
7769         ld="$ans"
7770
7771     cat << EOM
7772
7773 Some systems may require passing special flags to $ld to create a
7774 library that can be dynamically loaded.  If your ld flags include
7775 -L/other/path options to locate libraries outside your loader's normal
7776 search path, you may need to specify those -L options here as well.  To
7777 use no flags, say "none".
7778
7779 EOM
7780     case "$lddlflags" in
7781     '') case "$osname" in
7782                         beos) dflt='-nostart' ;;
7783                         hpux) dflt='-b';
7784                               case "$gccversion" in
7785                               '') dflt="$dflt +vnocompatwarnings" ;;
7786                               esac
7787                               ;;        
7788                         linux|irix*|gnu*)       dflt='-shared' ;;
7789                         next)  dflt='none' ;;
7790                         solaris) dflt='-G' ;;
7791                         sunos) dflt='-assert nodefinitions' ;;
7792                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7793                 *)     dflt='none' ;;
7794                         esac
7795                         ;;
7796     *) dflt="$lddlflags" ;;
7797     esac
7798
7799         : Try to guess additional flags to pick up local libraries.
7800         : Be careful not to append to a plain 'none'
7801         case "$dflt" in
7802         none) dflt='' ;;
7803         esac
7804         for thisflag in $ldflags; do
7805                 case "$thisflag" in
7806                 -L*|-R*|-Wl,-R*)
7807                         case " $dflt " in
7808                         *" $thisflag "*) ;;
7809                         *) dflt="$dflt $thisflag" ;;
7810                         esac
7811                         ;;
7812                 esac
7813         done
7814
7815         case "$dflt" in
7816         ''|' ') dflt='none' ;;
7817         esac
7818
7819     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7820     . ./myread
7821     case "$ans" in
7822     none) lddlflags=' ' ;;
7823     *) lddlflags="$ans" ;;
7824     esac
7825
7826         cat <<EOM
7827
7828 Some systems may require passing special flags to $cc to indicate that
7829 the resulting executable will use dynamic linking.  To use no flags,
7830 say "none".
7831
7832 EOM
7833     case "$ccdlflags" in
7834     '') case "$osname" in
7835             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7836             next|sunos) dflt='none' ;;
7837             *)          dflt='none' ;;
7838             esac ;;
7839     ' ')  dflt='none' ;;
7840     *)  dflt="$ccdlflags" ;;
7841     esac
7842     rp="Any special flags to pass to $cc to use dynamic linking?"
7843     . ./myread
7844     case "$ans" in
7845     none) ccdlflags=' ' ;;
7846     *) ccdlflags="$ans" ;;
7847     esac
7848     ;;
7849 *)  usedl="$undef"
7850         ld='ld'
7851     dlsrc='dl_none.xs'
7852     lddlflags=''
7853     ccdlflags=''
7854     ;;
7855 esac
7856
7857 also=''
7858 case "$usedl" in
7859 $undef)
7860         # No dynamic loading being used, so don't bother even to prompt.
7861         useshrplib='false'
7862         ;;
7863 *)      case "$useshrplib" in
7864         '')     case "$osname" in
7865                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7866                         dflt=y
7867                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7868                         ;;
7869                 next*)
7870                         case "$osvers" in
7871                         4*)     dflt=y
7872                                 also='Building a shared libperl is needed for MAB support.'
7873                                 ;;
7874                         *)      dflt=n
7875                                 ;;
7876                         esac
7877                         ;;
7878                 *)      dflt=n
7879                         ;;
7880                 esac
7881                 ;;
7882         $define|true|[Yy]*)
7883                 dflt=y
7884                 ;;
7885         *)      dflt=n
7886                 ;;
7887         esac
7888         $cat << EOM
7889
7890 The perl executable is normally obtained by linking perlmain.c with
7891 libperl${_a}, any static extensions (usually just DynaLoader), and
7892 any other libraries needed on this system (such as -lm, etc.).  Since
7893 your system supports dynamic loading, it is probably possible to build
7894 a shared libperl.$so.  If you will have more than one executable linked
7895 to libperl.$so, this will significantly reduce the size of each
7896 executable, but it may have a noticeable effect on performance.  The
7897 default is probably sensible for your system.
7898 $also
7899
7900 EOM
7901         rp="Build a shared libperl.$so (y/n)"
7902         . ./myread
7903         case "$ans" in
7904         true|$define|[Yy]*)
7905                 useshrplib='true'  ;;
7906         *)      useshrplib='false' ;;
7907         esac
7908         ;;
7909 esac
7910
7911 case "$useshrplib" in
7912 true)
7913         case "$libperl" in
7914         '')
7915                 # Figure out a good name for libperl.so.  Since it gets stored in
7916                 # a version-specific architecture-dependent library, the version
7917                 # number isn't really that important, except for making cc/ld happy.
7918                 #
7919                 # A name such as libperl.so.3.1
7920                 majmin="libperl.$so.$patchlevel.$subversion"
7921                 # A name such as libperl.so.301
7922                 majonly=`echo $patchlevel $subversion |
7923                         $awk '{printf "%d%02d", $1, $2}'`
7924                 majonly=libperl.$so.$majonly
7925                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7926                 # rely on figuring it out from the naming of libc.
7927                 case "${osname}${osvers}" in
7928                 next4*)
7929                         dflt=libperl.5.$so
7930                         # XXX How handle the --version stuff for MAB?
7931                         ;;
7932                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7933                         dflt=libperl.$so
7934                         ;;
7935                 cygwin*) # ld links against an importlib
7936                         dflt=libperl$lib_ext
7937                         ;;
7938                 *)      # Try to guess based on whether libc has major.minor.
7939                         case "$libc" in
7940                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7941                         *libc.$so.[0-9]*) dflt=$majonly ;;
7942                         *)      dflt=libperl.$so ;;
7943                         esac
7944                         ;;
7945                 esac
7946                 ;;
7947         *)      dflt=$libperl
7948                 ;;
7949         esac
7950         cat << EOM
7951
7952 I need to select a good name for the shared libperl.  If your system uses
7953 library names with major and minor numbers, then you might want something
7954 like $majmin.  Alternatively, if your system uses a single version
7955 number for shared libraries, then you might want to use $majonly.
7956 Or, your system might be quite happy with a simple libperl.$so.
7957
7958 Since the shared libperl will get installed into a version-specific
7959 architecture-dependent directory, the version number of the shared perl
7960 library probably isn't important, so the default should be o.k.
7961
7962 EOM
7963         rp='What name do you want to give to the shared libperl?'
7964         . ./myread
7965         libperl=$ans
7966         echo "Ok, I'll use $libperl"
7967         ;;
7968 *)
7969         libperl="libperl${_a}"
7970         ;;
7971 esac
7972
7973 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7974 case "$shrpdir" in
7975 '') ;;
7976 *)      $cat >&4 <<EOM
7977 WARNING:  Use of the shrpdir variable for the installation location of
7978 the shared $libperl is not supported.  It was never documented and
7979 will not work in this version.  Let me (perlbug@perl.org)
7980 know of any problems this may cause.
7981
7982 EOM
7983         case "$shrpdir" in
7984         "$archlibexp/CORE")
7985                 $cat >&4 <<EOM
7986 But your current setting of $shrpdir is
7987 the default anyway, so it's harmless.
7988 EOM
7989                 ;;
7990         *)
7991                 $cat >&4 <<EOM
7992 Further, your current attempted setting of $shrpdir
7993 conflicts with the value of $archlibexp/CORE
7994 that installperl will use.
7995 EOM
7996                 ;;
7997         esac
7998         ;;
7999 esac
8000
8001 # How will the perl executable find the installed shared $libperl?
8002 # Add $xxx to ccdlflags.
8003 # If we can't figure out a command-line option, use $shrpenv to
8004 # set env LD_RUN_PATH.  The main perl makefile uses this.
8005 shrpdir=$archlibexp/CORE
8006 xxx=''
8007 tmp_shrpenv=''
8008 if "$useshrplib"; then
8009     case "$osname" in 
8010         aix)
8011                 # We'll set it in Makefile.SH...
8012                 ;;
8013         solaris)
8014                 xxx="-R $shrpdir"
8015                 ;;
8016         freebsd|netbsd|openbsd|interix|dragonfly)
8017                 xxx="-Wl,-R$shrpdir"
8018                 ;;
8019         bsdos|linux|irix*|dec_osf|gnu*)
8020                 xxx="-Wl,-rpath,$shrpdir"
8021                 ;;
8022         next)
8023                 # next doesn't like the default...
8024                 ;;
8025         beos)
8026                 # beos doesn't like the default, either.
8027                 ;;
8028         hpux*)
8029                 # hpux doesn't like the default, either.
8030                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8031                 ;;
8032         *)
8033                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8034                 ;;
8035         esac
8036         case "$xxx" in
8037         '') ;;
8038         *)      
8039                 # Only add $xxx if it isn't already in ccdlflags.
8040                 case " $ccdlflags " in
8041                 *" $xxx "*)     ;;
8042                 *)      ccdlflags="$ccdlflags $xxx"
8043                         cat <<EOM >&4
8044
8045 Adding $xxx to the flags
8046 passed to $ld so that the perl executable will find the 
8047 installed shared $libperl.
8048
8049 EOM
8050                         ;;
8051                 esac
8052                 ;;
8053         esac
8054 fi
8055 # Fix ccdlflags in AIX for building external extensions.
8056 # (For building Perl itself bare -bE:perl.exp is needed,
8057 #  Makefile.SH takes care of this.)
8058 case "$osname" in
8059 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8060 esac
8061 # Respect a hint or command-line value.
8062 case "$shrpenv" in
8063 '') shrpenv="$tmp_shrpenv" ;;
8064 esac
8065 case "$ldlibpthname" in
8066 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8067 none)   ldlibpthname='' ;;
8068 esac
8069
8070 : determine where manual pages are on this system
8071 echo " "
8072 case "$sysman" in
8073 '') 
8074         syspath='/usr/share/man/man1 /usr/man/man1'
8075         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8076         syspath="$syspath /usr/man/u_man/man1"
8077         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8078         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8079         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8080         sysman=`./loc . /usr/man/man1 $syspath`
8081         ;;
8082 esac
8083 if $test -d "$sysman"; then
8084         echo "System manual is in $sysman." >&4
8085 else
8086         echo "Could not find manual pages in source form." >&4
8087 fi
8088
8089 : determine where manual pages go
8090 set man1dir man1dir none
8091 eval $prefixit
8092 $cat <<EOM
8093
8094 $spackage has manual pages available in source form.
8095 EOM
8096 case "$nroff" in
8097 nroff)
8098         echo "However, you don't have nroff, so they're probably useless to you."
8099         case "$man1dir" in
8100         '') man1dir="none";;
8101         esac;;
8102 esac
8103 echo "If you don't want the manual sources installed, answer 'none'."
8104 case "$man1dir" in
8105 ' ') dflt=none
8106         ;;
8107 '')
8108         lookpath="$prefixexp/share/man/man1"
8109         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8110         lookpath="$lookpath $prefixexp/man/p_man/man1"
8111         lookpath="$lookpath $prefixexp/man/u_man/man1"
8112         lookpath="$lookpath $prefixexp/man/man.1"
8113         case "$sysman" in
8114         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8115         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8116         esac
8117         set dflt
8118         eval $prefixup
8119         ;;
8120 *)  dflt="$man1dir"
8121         ;;
8122 esac
8123 echo " "
8124 fn=dn+~
8125 rp="Where do the main $spackage manual pages (source) go?"
8126 . ./getfile
8127 if $test "X$man1direxp" != "X$ansexp"; then
8128         installman1dir=''
8129 fi
8130 prefixvar=man1dir
8131 . ./setprefixvar
8132
8133 case "$man1dir" in
8134 '')     man1dir=' '
8135         installman1dir='';;
8136 esac
8137
8138 : What suffix to use on installed man pages
8139
8140 case "$man1dir" in
8141 ' ')
8142         man1ext='0'
8143         ;;
8144 *)
8145         rp="What suffix should be used for the main $spackage man pages?"
8146         case "$man1ext" in
8147         '')     case "$man1dir" in
8148                 *1)  dflt=1 ;;
8149                 *1p) dflt=1p ;;
8150                 *1pm) dflt=1pm ;;
8151                 *l) dflt=l;;
8152                 *n) dflt=n;;
8153                 *o) dflt=o;;
8154                 *p) dflt=p;;
8155                 *C) dflt=C;;
8156                 *L) dflt=L;;
8157                 *L1) dflt=L1;;
8158                 *) dflt=1;;
8159                 esac
8160                 ;;
8161         *)      dflt="$man1ext";;
8162         esac
8163         . ./myread
8164         man1ext="$ans"
8165         ;;
8166 esac
8167
8168 : see if we can have long filenames
8169 echo " "
8170 first=123456789abcdef
8171 $rm -f $first
8172 if (echo hi >$first) 2>/dev/null; then
8173         if $test -f 123456789abcde; then
8174                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8175                 val="$undef"
8176         else
8177                 echo 'You can have filenames longer than 14 characters.'>&4
8178                 val="$define"
8179         fi
8180 else
8181         $cat <<'EOM'
8182 You can't have filenames longer than 14 chars.
8183 You can't even think about them!
8184 EOM
8185         val="$undef"
8186 fi 
8187 set d_flexfnam
8188 eval $setvar
8189 $rm -rf 123456789abcde*
8190
8191 : determine where library module manual pages go
8192 set man3dir man3dir none
8193 eval $prefixit
8194 $cat <<EOM
8195
8196 $spackage has manual pages for many of the library modules.
8197 EOM
8198
8199 case "$nroff" in
8200 nroff)
8201         $cat <<'EOM'
8202 However, you don't have nroff, so they're probably useless to you.
8203 EOM
8204         case "$man3dir" in
8205         '') man3dir="none";;
8206         esac;;
8207 esac
8208
8209 case "$d_flexfnam" in
8210 undef)
8211         $cat <<'EOM'
8212 However, your system can't handle the long file names like File::Basename.3.
8213 EOM
8214         case "$man3dir" in
8215         '') man3dir="none";;
8216         esac;;
8217 esac
8218
8219 echo "If you don't want the manual sources installed, answer 'none'."
8220 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8221 case "$man3dir" in
8222 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8223         if $test -d "$privlib/man/man3"; then
8224                 cat <<EOM >&4
8225
8226 WARNING:  Previous versions of perl installed man3 pages into
8227 $privlib/man/man3.  This version will suggest a
8228 new default of $dflt.
8229 EOM
8230                 tdflt=$dflt
8231                 dflt='n'
8232                 rp='Do you wish to preserve the old behavior?(y/n)'
8233                 . ./myread
8234                 case "$ans" in
8235                 y*) dflt="$privlib/man/man3" ;;
8236                 *)  dflt=$tdflt ;;
8237                 esac
8238     fi
8239         ;;
8240 *)      dflt="$man3dir" ;;
8241 esac
8242 case "$dflt" in
8243 ' ') dflt=none ;;
8244 esac
8245 echo " "
8246 fn=dn+~
8247 rp="Where do the $package library man pages (source) go?"
8248 . ./getfile
8249 prefixvar=man3dir
8250 . ./setprefixvar
8251
8252 case "$man3dir" in
8253 '')     man3dir=' '
8254         installman3dir='';;
8255 esac
8256
8257 : What suffix to use on installed man pages
8258 case "$man3dir" in
8259 ' ')
8260         man3ext='0'
8261         ;;
8262 *)
8263         rp="What suffix should be used for the $package library man pages?"
8264         case "$man3ext" in
8265         '')     case "$man3dir" in
8266                 *3)  dflt=3 ;;
8267                 *3p) dflt=3p ;;
8268                 *3pm) dflt=3pm ;;
8269                 *l) dflt=l;;
8270                 *n) dflt=n;;
8271                 *o) dflt=o;;
8272                 *p) dflt=p;;
8273                 *C) dflt=C;;
8274                 *L) dflt=L;;
8275                 *L3) dflt=L3;;
8276                 *) dflt=3;;
8277                 esac
8278                 ;;
8279         *)      dflt="$man3ext";;
8280         esac
8281         . ./myread
8282         man3ext="$ans"
8283         ;;
8284 esac
8285
8286 : see if we have to deal with yellow pages, now NIS.
8287 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8288         if $test -f /usr/etc/nibindd; then
8289                 echo " "
8290                 echo "I'm fairly confident you're on a NeXT."
8291                 echo " "
8292                 rp='Do you get the hosts file via NetInfo?'
8293                 dflt=y
8294                 case "$hostcat" in
8295                 nidump*) ;;
8296                 '') ;;
8297                 *) dflt=n;;
8298                 esac
8299                 . ./myread
8300                 case "$ans" in
8301                 y*) hostcat='nidump hosts .';;
8302                 *)      case "$hostcat" in
8303                         nidump*) hostcat='';;
8304                         esac
8305                         ;;
8306                 esac
8307         fi
8308         case "$hostcat" in
8309         nidump*) ;;
8310         *)
8311                 case "$hostcat" in
8312                 *ypcat*) dflt=y;;
8313                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8314                                 dflt=y
8315                         else
8316                                 dflt=n
8317                         fi;;
8318                 *) dflt=n;;
8319                 esac
8320                 echo " "
8321                 rp='Are you getting the hosts file via yellow pages?'
8322                 . ./myread
8323                 case "$ans" in
8324                 y*) hostcat='ypcat hosts';;
8325                 *) hostcat='cat /etc/hosts';;
8326                 esac
8327                 ;;
8328         esac
8329 fi
8330 case "$hostcat" in
8331 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8332 esac
8333 case "$groupcat" in
8334 '') test -f /etc/group && groupcat='cat /etc/group';;
8335 esac
8336 case "$passcat" in
8337 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8338 esac
8339
8340 : now get the host name
8341 echo " "
8342 echo "Figuring out host name..." >&4
8343 case "$myhostname" in
8344 '') cont=true
8345         echo 'Maybe "hostname" will work...'
8346         if tans=`sh -c hostname 2>&1` ; then
8347                 myhostname=$tans
8348                 phostname=hostname
8349                 cont=''
8350         fi
8351         ;;
8352 *) cont='';;
8353 esac
8354 if $test "$cont"; then
8355         if ./xenix; then
8356                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8357                 if tans=`cat /etc/systemid 2>&1` ; then
8358                         myhostname=$tans
8359                         phostname='cat /etc/systemid'
8360                         echo "Whadyaknow.  Xenix always was a bit strange..."
8361                         cont=''
8362                 fi
8363         elif $test -r /etc/systemid; then
8364                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8365         fi
8366 fi
8367 if $test "$cont"; then
8368         echo 'No, maybe "uuname -l" will work...'
8369         if tans=`sh -c 'uuname -l' 2>&1` ; then
8370                 myhostname=$tans
8371                 phostname='uuname -l'
8372         else
8373                 echo 'Strange.  Maybe "uname -n" will work...'
8374                 if tans=`sh -c 'uname -n' 2>&1` ; then
8375                         myhostname=$tans
8376                         phostname='uname -n'
8377                 else
8378                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8379                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8380                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8381                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8382                         else
8383                                 case "$myhostname" in
8384                                 '') echo "Does this machine have an identity crisis or something?"
8385                                         phostname='';;
8386                                 *)
8387                                         echo "Well, you said $myhostname before..."
8388                                         phostname='echo $myhostname';;
8389                                 esac
8390                         fi
8391                 fi
8392         fi
8393 fi
8394 case "$myhostname" in
8395 '') myhostname=noname ;;
8396 esac
8397 : you do not want to know about this
8398 set $myhostname
8399 myhostname=$1
8400
8401 : verify guess
8402 if $test "$myhostname" ; then
8403         dflt=y
8404         rp='Your host name appears to be "'$myhostname'".'" Right?"
8405         . ./myread
8406         case "$ans" in
8407         y*) ;;
8408         *) myhostname='';;
8409         esac
8410 fi
8411
8412 : bad guess or no guess
8413 while $test "X$myhostname" = X ; do
8414         dflt=''
8415         rp="Please type the (one word) name of your host:"
8416         . ./myread
8417         myhostname="$ans"
8418 done
8419
8420 : translate upper to lower if necessary
8421 case "$myhostname" in
8422 *[A-Z]*)
8423         echo "(Normalizing case in your host name)"
8424         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8425         ;;
8426 esac
8427
8428 case "$myhostname" in
8429 *.*)
8430         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8431         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8432         echo "(Trimming domain name from host name--host name is now $myhostname)"
8433         ;;
8434 *) case "$mydomain" in
8435         '')
8436                 {
8437                         test "X$hostcat" = "Xypcat hosts" &&
8438                         ypmatch "$myhostname" hosts 2>/dev/null |\
8439                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8440                         $test -s hosts
8441                 } || {
8442                         test "X$hostcat" != "X" &&
8443                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8444                                         /[       ]$myhostname[  . ]/p" > hosts
8445                 }
8446                 tmp_re="[       . ]"
8447                 if $test -f hosts; then
8448                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8449                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8450                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8451                                 hosts | $sort | $uniq | \
8452                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8453                         case `$echo X$dflt` in
8454                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8455                                 dflt=.
8456                                 ;;
8457                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8458                                 ;;
8459                         esac
8460                 else
8461                         echo "(I cannot locate a hosts database anywhere)"
8462                         dflt=.
8463                 fi
8464                 case "$dflt" in
8465                 .)
8466                         tans=`./loc resolv.conf X /etc /usr/etc`
8467                         if $test -f "$tans"; then
8468                                 echo "(Attempting domain name extraction from $tans)"
8469                                 dflt=.`$sed -n -e 's/   / /g' \
8470                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8471                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8472                                 case "$dflt" in
8473                                 .) dflt=.`$sed -n -e 's/        / /g' \
8474                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8475                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8476                                         ;;
8477                                 esac
8478                         fi
8479                         ;;
8480                 esac
8481                 case "$dflt" in
8482                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8483                         dflt=.`sh -c domainname 2>/dev/null`
8484                         case "$dflt" in
8485                         '') dflt='.';;
8486                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8487                         esac
8488                         ;;
8489                 esac
8490                 case "$dflt$osname" in
8491                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8492                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8493                         ;;
8494                 esac
8495                 case "$dflt" in
8496                 .) echo "(Lost all hope -- silly guess then)"
8497                         dflt='.nonet'
8498                         ;;
8499                 esac
8500                 $rm -f hosts
8501                 ;;
8502         *) dflt="$mydomain";;
8503         esac;;
8504 esac
8505 echo " "
8506 rp="What is your domain name?"
8507 . ./myread
8508 tans="$ans"
8509 case "$ans" in
8510 '') ;;
8511 .*) ;;
8512 *) tans=".$tans";;
8513 esac
8514 mydomain="$tans"
8515
8516 : translate upper to lower if necessary
8517 case "$mydomain" in
8518 *[A-Z]*)
8519         echo "(Normalizing case in your domain name)"
8520         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8521         ;;
8522 esac
8523
8524 : a little sanity check here
8525 case "$phostname" in
8526 '') ;;
8527 *)
8528         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8529         $myhostname$mydomain|$myhostname) ;;
8530         *)
8531                 case "$phostname" in
8532                 sed*)
8533                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8534                         ;;
8535                 *)
8536                         echo "(That doesn't agree with your $phostname command, by the way.)"
8537                         ;;
8538                 esac
8539         ;;
8540         esac
8541         ;;
8542 esac
8543
8544 $cat <<EOM
8545
8546 I need to get your e-mail address in Internet format if possible, i.e.
8547 something like user@host.domain. Please answer accurately since I have
8548 no easy means to double check it. The default value provided below
8549 is most probably close to reality but may not be valid from outside
8550 your organization...
8551
8552 EOM
8553 cont=x
8554 while test "$cont"; do
8555         case "$cf_email" in
8556         '') dflt="$cf_by@$myhostname$mydomain";;
8557         *) dflt="$cf_email";;
8558         esac
8559         rp='What is your e-mail address?'
8560         . ./myread
8561         cf_email="$ans"
8562         case "$cf_email" in
8563         *@*.*) cont='' ;;
8564         *)
8565                 rp='Address does not look like an Internet one.  Use it anyway?'
8566                 case "$fastread" in
8567                 yes) dflt=y ;;
8568                 *) dflt=n ;;
8569                 esac
8570                 . ./myread
8571                 case "$ans" in
8572                 y*) cont='' ;;
8573                 *) echo " " ;;
8574                 esac
8575                 ;;
8576         esac
8577 done
8578
8579 $cat <<EOM
8580
8581 If you or somebody else will be maintaining perl at your site, please
8582 fill in the correct e-mail address here so that they may be contacted
8583 if necessary. Currently, the "perlbug" program included with perl
8584 will send mail to this address in addition to perlbug@perl.org. You may
8585 enter "none" for no administrator.
8586
8587 EOM
8588 case "$perladmin" in
8589 '') dflt="$cf_email";;
8590 *) dflt="$perladmin";;
8591 esac
8592 rp='Perl administrator e-mail address'
8593 . ./myread
8594 perladmin="$ans"
8595
8596 : determine whether to only install version-specific parts.
8597 echo " "
8598 $cat <<EOM
8599 Do you want to install only the version-specific parts of the perl
8600 distribution?  Usually you do *not* want to do this.
8601 EOM
8602 case "$versiononly" in
8603 "$define"|[Yy]*|true) dflt='y' ;;
8604 *) dflt='n';
8605 esac
8606 rp="Do you want to install only the version-specific parts of perl?"
8607 . ./myread
8608 case "$ans" in
8609 [yY]*)  val="$define";;
8610 *)      val="$undef" ;;
8611 esac
8612 set versiononly
8613 eval $setvar
8614
8615 case "$versiononly" in
8616 "$define") inc_version_list=''
8617            inc_version_list_init=0
8618            ;;
8619 esac
8620
8621 : figure out how to guarantee perl startup
8622 : XXX Note that this currently takes advantage of the bug that binexp ignores
8623 :     the Configure -Dinstallprefix setting, which in turn means that under
8624 :     relocatable @INC, initialinstalllocation is what binexp started as.
8625 case "$startperl" in
8626 '')
8627         case "$sharpbang" in
8628         *!)
8629                 $cat <<EOH
8630
8631 I can use the #! construct to start perl on your system. This will
8632 make startup of perl scripts faster, but may cause problems if you
8633 want to share those scripts and perl is not in a standard place
8634 ($initialinstalllocation/perl) on all your platforms. The alternative
8635 is to force a shell by starting the script with a single ':' character.
8636
8637 EOH
8638                 case "$versiononly" in
8639                 "$define")      dflt="$initialinstalllocation/perl$version";;
8640                 *)              dflt="$initialinstalllocation/perl";;
8641                 esac
8642                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8643                 . ./myread
8644                 case "$ans" in
8645                 none)   startperl=": # use perl";;
8646                 *)      startperl="#!$ans"
8647                         if $test 30 -lt `echo "$ans" | wc -c`; then
8648                                 $cat >&4 <<EOM
8649
8650 WARNING:  Some systems limit the #! command to 32 characters.
8651 If you experience difficulty running Perl scripts with #!, try
8652 installing Perl in a directory with a shorter pathname.
8653
8654 EOM
8655                         fi ;;
8656                 esac
8657                 ;;
8658         *) startperl=": # use perl"
8659                 ;;
8660         esac
8661         ;;
8662 esac
8663 echo "I'll use $startperl to start perl scripts."
8664
8665 : figure best path for perl in scripts
8666 case "$perlpath" in
8667 '')
8668         case "$versiononly" in
8669         "$define")      perlpath="$initialinstalllocation/perl$version";;
8670         *)              perlpath="$initialinstalllocation/perl";;
8671         esac
8672         case "$startperl" in
8673         *!*) ;;
8674         *)
8675                 $cat <<EOH
8676
8677 I will use the "eval 'exec'" idiom to start Perl on your system.
8678 I can use the full path of your Perl binary for this purpose, but
8679 doing so may cause problems if you want to share those scripts and
8680 Perl is not always in a standard place ($initialinstalllocation/perl).
8681
8682 EOH
8683                 dflt="$initialinstalllocation/perl"
8684                 rp="What path shall I use in \"eval 'exec'\"?"
8685                 . ./myread
8686                 perlpath="$ans"
8687                 ;;
8688         esac
8689         ;;
8690 esac
8691 case "$startperl" in
8692 *!*)    ;;
8693 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8694 esac
8695
8696 : determine where public executable scripts go
8697 set scriptdir scriptdir
8698 eval $prefixit
8699 case "$scriptdir" in
8700 '')
8701         dflt="$bin"
8702         : guess some guesses
8703         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8704         $test -d /usr/share/bin     && dflt=/usr/share/bin
8705         $test -d /usr/local/script  && dflt=/usr/local/script
8706         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8707         $test -d $prefixexp/script  && dflt=$prefixexp/script
8708         set dflt
8709         eval $prefixup
8710         ;;
8711 *)  dflt="$scriptdir"
8712         ;;
8713 esac
8714 $cat <<EOM
8715
8716 Some installations have a separate directory just for executable scripts so
8717 that they can mount it across multiple architectures but keep the scripts in
8718 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8719 Or you might just lump your scripts in with all your other executables.
8720
8721 EOM
8722 fn=d~
8723 rp='Where do you keep publicly executable scripts?'
8724 . ./getfile
8725 if $test "X$ansexp" != "X$scriptdirexp"; then
8726         installscript=''
8727 fi
8728 installscriptdir=''
8729 prefixvar=scriptdir
8730 . ./setprefixvar
8731 : A little fix up for an irregularly named variable.
8732 installscript="$installscriptdir"
8733
8734 : determine where add-on public executables go
8735 case "$sitebin" in
8736 '')     dflt=$siteprefix/bin ;;
8737 *)      dflt=$sitebin ;;
8738 esac
8739 fn=d~
8740 rp='Pathname where the add-on public executables should be installed?'
8741 . ./getfile
8742 prefixvar=sitebin
8743 . ./setprefixvar
8744
8745 : determine where add-on html pages go
8746 : There is no standard location, so try to copy the previously-selected
8747 : directory structure for the core html pages.
8748 case "$sitehtml1dir" in
8749 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8750 *)     dflt=$sitehtml1dir ;;
8751 esac
8752 case "$dflt" in
8753 ''|' ') dflt=none ;;
8754 esac
8755 fn=dn+~
8756 rp='Pathname where the site-specific html pages should be installed?'
8757 . ./getfile
8758 prefixvar=sitehtml1dir
8759 . ./setprefixvar
8760
8761 : determine where add-on library html pages go
8762 : There is no standard location, so try to copy the previously-selected
8763 : directory structure for the core html pages.
8764 case "$sitehtml3dir" in
8765 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8766 *)     dflt=$sitehtml3dir ;;
8767 esac
8768 case "$dflt" in
8769 ''|' ') dflt=none ;;
8770 esac
8771 fn=dn+~
8772 rp='Pathname where the site-specific library html pages should be installed?'
8773 . ./getfile
8774 prefixvar=sitehtml3dir
8775 . ./setprefixvar
8776
8777 : determine where add-on manual pages go
8778 case "$siteman1dir" in
8779 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8780 *)      dflt=$siteman1dir ;;
8781 esac
8782 case "$dflt" in
8783 ''|' ') dflt=none ;;
8784 esac
8785 fn=dn+~
8786 rp='Pathname where the site-specific manual pages should be installed?'
8787 . ./getfile
8788 prefixvar=siteman1dir
8789 . ./setprefixvar
8790
8791 : determine where add-on library man pages go
8792 case "$siteman3dir" in
8793 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8794 *)      dflt=$siteman3dir ;;
8795 esac
8796 case "$dflt" in
8797 ''|' ') dflt=none ;;
8798 esac
8799 fn=dn+~
8800 rp='Pathname where the site-specific library manual pages should be installed?'
8801 . ./getfile
8802 prefixvar=siteman3dir
8803 . ./setprefixvar
8804
8805 : determine where add-on public executable scripts go
8806 case "$sitescript" in
8807 '')     dflt=$siteprefix/script
8808         $test -d $dflt || dflt=$sitebin ;;
8809 *)  dflt="$sitescript" ;;
8810 esac
8811 fn=d~+
8812 rp='Pathname where add-on public executable scripts should be installed?'
8813 . ./getfile
8814 prefixvar=sitescript
8815 . ./setprefixvar
8816
8817 case "$usefaststdio" in
8818 $define|true|[yY]*|'')
8819         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8820         case "$xversion" in
8821         [68])   dflt='y' ;;
8822         *)      dflt='n' ;;
8823         esac
8824         ;;
8825 *) dflt='n';;
8826 esac
8827 cat <<EOM
8828
8829 Perl can be built to use 'fast stdio', which means using the stdio
8830 library but also directly manipulating the stdio buffers to enable
8831 faster I/O.  Using stdio is better for backward compatibility (especially
8832 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8833 interface has been preferred instead of stdio.
8834
8835 If this doesn't make any sense to you, just accept the default '$dflt'.
8836 EOM
8837 rp='Use the "fast stdio" if available?'
8838 . ./myread
8839 case "$ans" in
8840 y|Y)    val="$define" ;;     
8841 *)      val="$undef" ;;
8842 esac
8843 set usefaststdio
8844 eval $setvar
8845
8846
8847 : define an is-a-typedef? function
8848 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8849 case "$inclist" in
8850 "") inclist="sys/types.h";;
8851 esac;
8852 eval "varval=\$$var";
8853 case "$varval" in
8854 "")
8855         $rm -f temp.c;
8856         for inc in $inclist; do
8857                 echo "#include <$inc>" >>temp.c;
8858         done;
8859         echo "#ifdef $type" >> temp.c;
8860         echo "printf(\"We have $type\");" >> temp.c;
8861         echo "#endif" >> temp.c;
8862         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8863         if $contains $type temp.E >/dev/null 2>&1; then
8864                 eval "$var=\$type";
8865         else
8866                 eval "$var=\$def";
8867         fi;
8868         $rm -f temp.?;;
8869 *) eval "$var=\$varval";;
8870 esac'
8871
8872 : define an is-a-typedef? function that prompts if the type is not available.
8873 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8874 case "$inclist" in
8875 "") inclist="sys/types.h";;
8876 esac;
8877 eval "varval=\$$var";
8878 case "$varval" in
8879 "")
8880         $rm -f temp.c;
8881         for inc in $inclist; do
8882                 echo "#include <$inc>" >>temp.c;
8883         done;
8884         echo "#ifdef $type" >> temp.c;
8885         echo "printf(\"We have $type\");" >> temp.c;
8886         echo "#endif" >> temp.c;
8887         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8888         echo " " ;
8889         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8890         if $contains $type temp.E >/dev/null 2>&1; then
8891                 echo "$type found." >&4;
8892                 eval "$var=\$type";
8893         else
8894                 echo "$type NOT found." >&4;
8895                 dflt="$def";
8896                 . ./myread ;
8897                 eval "$var=\$ans";
8898         fi;
8899         $rm -f temp.?;;
8900 *) eval "$var=\$varval";;
8901 esac'
8902
8903 : see what type lseek is declared as in the kernel
8904 rp="What is the type used for lseek's offset on this system?"
8905 set off_t lseektype long stdio.h sys/types.h
8906 eval $typedef_ask
8907
8908 echo " "
8909 echo "Checking to see how big your file offsets are..." >&4
8910 $cat >try.c <<EOCP
8911 #include <sys/types.h>
8912 #include <stdio.h>
8913 int main()
8914 {
8915     printf("%d\n", (int)sizeof($lseektype));
8916     return(0); 
8917 }
8918 EOCP
8919 set try
8920 if eval $compile_ok; then
8921         lseeksize=`$run ./try`
8922         echo "Your file offsets are $lseeksize bytes long."
8923 else
8924         dflt=$longsize
8925         echo " "
8926         echo "(I can't seem to compile the test program.  Guessing...)"
8927         rp="What is the size of your file offsets (in bytes)?"
8928         . ./myread
8929         lseeksize="$ans"
8930 fi
8931 $rm -f try.c try
8932
8933 : see what type file positions are declared as in the library
8934 rp="What is the type for file position used by fsetpos()?"
8935 set fpos_t fpostype long stdio.h sys/types.h
8936 eval $typedef_ask
8937
8938 echo " "
8939 case "$fpostype" in
8940 *_t) zzz="$fpostype"    ;;
8941 *)   zzz="fpos_t"       ;;
8942 esac
8943 echo "Checking the size of $zzz..." >&4 
8944 cat > try.c <<EOCP
8945 #include <sys/types.h>
8946 #include <stdio.h>
8947 #$i_stdlib I_STDLIB
8948 #ifdef I_STDLIB
8949 #include <stdlib.h>
8950 #endif
8951 int main() {
8952     printf("%d\n", (int)sizeof($fpostype));
8953     exit(0);
8954 }
8955 EOCP
8956 set try
8957 if eval $compile_ok; then
8958         yyy=`$run ./try`
8959         case "$yyy" in
8960         '')     fpossize=4
8961                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8962                 ;;
8963         *)      fpossize=$yyy
8964                 echo "Your $zzz is $fpossize bytes long."
8965                 ;;
8966         esac
8967 else
8968         dflt="$longsize"
8969         echo " " >&4
8970         echo "(I can't compile the test program.  Guessing...)" >&4
8971         rp="What is the size of your file positions (in bytes)?"
8972         . ./myread
8973         fpossize="$ans"
8974 fi
8975
8976 # Backward compatibility (uselfs is deprecated).
8977 case "$uselfs" in
8978 "$define"|true|[yY]*)
8979         cat <<EOM >&4
8980
8981 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8982 EOM
8983         uselargefiles="$define"
8984         ;;
8985 esac                          
8986
8987 case "$lseeksize:$fpossize" in
8988 8:8) cat <<EOM
8989
8990 You can have files larger than 2 gigabytes.
8991 EOM
8992    val="$define" ;;
8993 *)    case "$uselargefiles" in
8994    "$undef"|false|[nN]*) dflt='n' ;;
8995    *)   dflt='y' ;;
8996    esac
8997    cat <<EOM
8998
8999 Perl can be built to understand large files (files larger than 2 gigabytes)
9000 on some systems.  To do so, Configure can be run with -Duselargefiles.
9001
9002 If this doesn't make any sense to you, just accept the default '$dflt'.
9003 EOM
9004    rp='Try to understand large files, if available?'
9005    . ./myread
9006    case "$ans" in
9007    y|Y)         val="$define" ;;
9008    *)           val="$undef"  ;;
9009    esac
9010    ;;
9011 esac
9012 set uselargefiles
9013 eval $setvar
9014 : Look for a hint-file generated 'call-back-unit'.  If the
9015 : user has specified that a large files perl is to be built,
9016 : we may need to set or change some other defaults.
9017 if $test -f uselargefiles.cbu; then
9018         echo "Your platform has some specific hints regarding large file builds, using them..."
9019         . ./uselargefiles.cbu
9020 fi
9021 case "$uselargefiles" in
9022 "$define")
9023         if $test -f uselargefiles.cbu; then
9024                 echo " "
9025                 echo "Rechecking to see how big your file offsets are..." >&4
9026                 $cat >try.c <<EOCP
9027 #include <sys/types.h>
9028 #include <stdio.h>
9029 int main()
9030 {
9031     printf("%d\n", (int)sizeof($lseektype));
9032     return(0); 
9033 }
9034 EOCP
9035                 set try
9036                 if eval $compile_ok; then
9037                         lseeksize=`$run ./try`
9038                         $echo "Your file offsets are now $lseeksize bytes long."
9039                 else
9040                         dflt="$lseeksize"
9041                         echo " "
9042                         echo "(I can't seem to compile the test program.  Guessing...)"
9043                         rp="What is the size of your file offsets (in bytes)?"
9044                         . ./myread
9045                         lseeksize="$ans"
9046                 fi
9047                 case "$fpostype" in
9048                 *_t) zzz="$fpostype"    ;;
9049                 *)   zzz="fpos_t"       ;;
9050                 esac
9051                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9052                 $cat > try.c <<EOCP
9053 #include <sys/types.h>
9054 #include <stdio.h>
9055 #$i_stdlib I_STDLIB
9056 #ifdef I_STDLIB
9057 #include <stdlib.h>
9058 #endif
9059 int main() {
9060     printf("%d\n", (int)sizeof($fpostype));
9061     return(0);
9062 }
9063 EOCP
9064                 set try
9065                 if eval $compile_ok; then
9066                         yyy=`$run ./try`
9067                         dflt="$lseeksize"
9068                         case "$yyy" in
9069                         '')     echo " "
9070                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9071                                 ;;
9072                         *)      fpossize=$yyy
9073                                 echo " $fpossize bytes." >&4
9074                                 ;;
9075                         esac
9076                 else
9077                         dflt="$fpossize"
9078                         echo " "
9079                         echo "(I can't compile the test program.  Guessing...)" >&4
9080                         rp="What is the size of your file positions (in bytes)?"
9081                         . ./myread
9082                         fpossize="$ans"
9083                 fi
9084                 $rm -f try.c try
9085         fi
9086         ;;
9087 esac
9088
9089 case "$vendorprefix" in
9090 '')     d_vendorbin="$undef"
9091         vendorbin=''
9092         vendorbinexp=''
9093         ;;
9094 *)      d_vendorbin="$define"
9095         : determine where vendor-supplied executables go.
9096         case "$vendorbin" in
9097         '') dflt=$vendorprefix/bin ;;
9098         *)      dflt="$vendorbin" ;;
9099         esac
9100         fn=d~+
9101         rp='Pathname for the vendor-supplied executables directory?'
9102         . ./getfile
9103         vendorbin="$ans"
9104         vendorbinexp="$ansexp"
9105         ;;
9106 esac
9107 prefixvar=vendorbin
9108 . ./installprefix
9109
9110 case "$vendorprefix" in
9111 '')     vendorhtml1dir=''
9112         vendorhtml1direxp=''
9113         ;;
9114 *)      : determine where vendor-supplied html pages go.
9115         : There is no standard location, so try to copy the previously-selected
9116         : directory structure for the core html pages.
9117         : XXX Better default suggestions would be welcome.
9118         case "$vendorhtml1dir" in
9119         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9120         *)      dflt=$vendorhtml1dir ;;
9121         esac
9122         case "$dflt" in
9123         ''|' ') dflt=none ;;
9124         esac
9125         fn=dn+~
9126         rp='Pathname for the vendor-supplied html pages?'
9127         . ./getfile
9128         vendorhtml1dir="$ans"
9129         vendorhtml1direxp="$ansexp"
9130         ;;
9131 esac
9132 : Use ' ' for none so value is preserved next time through Configure
9133 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9134 prefixvar=vendorhtml1dir
9135 . ./installprefix
9136
9137 case "$vendorprefix" in
9138 '')     vendorhtml3dir=''
9139         vendorhtml3direxp=''
9140         ;;
9141 *)      : determine where vendor-supplied module html pages go.
9142         : There is no standard location, so try to copy the previously-selected
9143         : directory structure for the core html pages.
9144         : XXX Better default suggestions would be welcome.
9145         case "$vendorhtml3dir" in
9146         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9147         *)      dflt=$vendorhtml3dir ;;
9148         esac
9149         case "$dflt" in
9150         ''|' ') dflt=none ;;
9151         esac
9152         fn=dn+~
9153         rp='Pathname for the vendor-supplied html pages?'
9154         . ./getfile
9155         vendorhtml3dir="$ans"
9156         vendorhtml3direxp="$ansexp"
9157         ;;
9158 esac
9159 : Use ' ' for none so value is preserved next time through Configure
9160 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9161 prefixvar=vendorhtml3dir
9162 . ./installprefix
9163
9164 case "$vendorprefix" in
9165 '')     vendorman1dir=''
9166         vendorman1direxp=''
9167         ;;
9168 *)      : determine where vendor-supplied manual pages go.
9169         case "$vendorman1dir" in
9170         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9171         *)      dflt=$vendorman1dir ;;
9172         esac
9173         case "$dflt" in
9174         ''|' ') dflt=none ;;
9175         esac
9176         fn=nd~+
9177         rp='Pathname for the vendor-supplied manual section 1 pages?'
9178         . ./getfile
9179         vendorman1dir="$ans"
9180         vendorman1direxp="$ansexp"
9181         ;;
9182 esac
9183 : Use ' ' for none so value is preserved next time through Configure
9184 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9185 prefixvar=vendorman1dir
9186 . ./installprefix
9187
9188 case "$vendorprefix" in
9189 '')     vendorman3dir=''
9190         vendorman3direxp=''
9191         ;;
9192 *)      : determine where vendor-supplied module manual pages go.
9193         case "$vendorman3dir" in
9194         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9195         *)      dflt=$vendorman3dir ;;
9196         esac
9197         case "$dflt" in
9198         ''|' ') dflt=none ;;
9199         esac
9200         fn=nd~+
9201         rp='Pathname for the vendor-supplied manual section 3 pages?'
9202         . ./getfile
9203         vendorman3dir="$ans"
9204         vendorman3direxp="$ansexp"
9205         ;;
9206 esac
9207 : Use ' ' for none so value is preserved next time through Configure
9208 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9209 prefixvar=vendorman3dir
9210 . ./installprefix
9211
9212 case "$vendorprefix" in
9213 '')     d_vendorscript="$undef"
9214         vendorscript=''
9215         vendorscriptexp=''
9216         ;;
9217 *)      d_vendorscript="$define"
9218         : determine where vendor-supplied scripts go.
9219         case "$vendorscript" in
9220         '')     dflt=$vendorprefix/script
9221                 $test -d $dflt || dflt=$vendorbin ;;
9222         *)  dflt="$vendorscript" ;;
9223         esac
9224         $cat <<EOM
9225
9226 The installation process will create a directory for
9227 vendor-supplied scripts.
9228
9229 EOM
9230         fn=d~+
9231         rp='Pathname for the vendor-supplied scripts directory?'
9232         . ./getfile
9233         vendorscript="$ans"
9234         vendorscriptexp="$ansexp"
9235         ;;
9236 esac
9237 prefixvar=vendorscript
9238 . ./installprefix
9239
9240 : see if qgcvt exists
9241 set qgcvt d_qgcvt
9242 eval $inlibc
9243
9244 echo " "
9245
9246 if $test X"$d_longdbl" = X"$define"; then
9247
9248 echo "Checking how to print long doubles..." >&4
9249
9250 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9251         $cat >try.c <<'EOCP'
9252 #include <sys/types.h>
9253 #include <stdio.h>
9254 int main() {
9255   double d = 123.456;
9256   printf("%.3f\n", d);
9257 }
9258 EOCP
9259         set try
9260         if eval $compile; then
9261                 yyy=`$run ./try`
9262                 case "$yyy" in
9263                 123.456)
9264                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9265                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9266                         echo "We will use %f."
9267                         ;;
9268                 esac
9269         fi
9270 fi
9271
9272 if $test X"$sPRIfldbl" = X; then
9273         $cat >try.c <<'EOCP'
9274 #include <sys/types.h>
9275 #include <stdio.h>
9276 int main() {
9277   long double d = 123.456;
9278   printf("%.3Lf\n", d);
9279 }
9280 EOCP
9281         set try
9282         if eval $compile; then
9283                 yyy=`$run ./try`
9284                 case "$yyy" in
9285                 123.456)
9286                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9287                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9288                         echo "We will use %Lf."
9289                         ;;
9290                 esac
9291         fi
9292 fi
9293
9294 if $test X"$sPRIfldbl" = X; then
9295         $cat >try.c <<'EOCP'
9296 #include <sys/types.h>
9297 #include <stdio.h>
9298 int main() {
9299   long double d = 123.456;
9300   printf("%.3llf\n", d);
9301 }
9302 EOCP
9303         set try
9304         if eval $compile; then
9305                 yyy=`$run ./try`
9306                 case "$yyy" in
9307                 123.456)
9308                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9309                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9310                         echo "We will use %llf."
9311                         ;;
9312                 esac
9313         fi
9314 fi
9315
9316 if $test X"$sPRIfldbl" = X; then
9317         $cat >try.c <<'EOCP'
9318 #include <sys/types.h>
9319 #include <stdio.h>
9320 int main() {
9321   long double d = 123.456;
9322   printf("%.3lf\n", d);
9323 }
9324 EOCP
9325         set try
9326         if eval $compile; then
9327                 yyy=`$run ./try`
9328                 case "$yyy" in
9329                 123.456)
9330                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9331                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9332                         echo "We will use %lf."
9333                         ;;
9334                 esac
9335         fi
9336 fi
9337
9338 if $test X"$sPRIfldbl" = X; then
9339         echo "Cannot figure out how to print long doubles." >&4
9340 else
9341         sSCNfldbl=$sPRIfldbl    # expect consistency
9342 fi
9343
9344 $rm -f try try.*
9345
9346 fi # d_longdbl
9347
9348 case "$sPRIfldbl" in
9349 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9350         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9351         d_SCNfldbl="$undef";
9352         ;;
9353 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9354         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9355         d_SCNfldbl="$define";
9356         ;;
9357 esac
9358
9359 : Check how to convert floats to strings.
9360
9361 if test "X$d_Gconvert" = X; then
9362
9363 echo " "
9364 echo "Checking for an efficient way to convert floats to strings."
9365 echo " " > try.c
9366 case "$uselongdouble" in
9367 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9368 esac
9369 case "$d_longdbl" in
9370 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9371 esac
9372 case "$d_PRIgldbl" in
9373 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9374 esac
9375 $cat >>try.c <<EOP
9376 #ifdef TRY_gconvert
9377 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9378 char *myname = "gconvert";
9379 #endif
9380 #ifdef TRY_gcvt
9381 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9382 char *myname = "gcvt";
9383 #endif
9384 #ifdef TRY_qgcvt
9385 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9386 char *myname = "qgcvt";
9387 #define DOUBLETYPE long double
9388 #endif
9389 #ifdef TRY_sprintf
9390 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9391 #ifdef HAS_PRIgldbl
9392 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9393 #else
9394 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9395 #endif
9396 #else
9397 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9398 #endif
9399 char *myname = "sprintf";
9400 #endif
9401
9402 #ifndef DOUBLETYPE
9403 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9404 #define DOUBLETYPE long double
9405 #else
9406 #define DOUBLETYPE double
9407 #endif
9408 #endif
9409
9410 #include <stdio.h>
9411
9412 #define I_STDLIB $i_stdlib
9413 #ifdef I_STDLIB
9414 #include <stdlib.h>
9415 #endif
9416
9417 int
9418 checkit(expect, got)
9419 char *expect;
9420 char *got;
9421 {
9422     if (strcmp(expect, got)) {
9423                 printf("%s oddity:  Expected %s, got %s\n",
9424                         myname, expect, got);
9425                 exit(1);
9426         }
9427 }
9428
9429 int main()
9430
9431         char buf[64]; 
9432         buf[63] = '\0';
9433
9434         /* This must be 1st test on (which?) platform */
9435         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9436         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9437         checkit("0.1", buf);
9438
9439         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9440         checkit("0.01", buf);
9441
9442         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9443         checkit("0.001", buf);
9444
9445         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9446         checkit("0.0001", buf);
9447
9448         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9449         if (strlen(buf) > 5)
9450             checkit("9e-005", buf); /* for Microsoft ?? */
9451         else
9452             checkit("9e-05", buf);
9453
9454         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9455         checkit("1", buf);
9456
9457         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9458         checkit("1.1", buf);
9459
9460         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9461         checkit("1.01", buf);
9462
9463         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9464         checkit("1.001", buf);
9465
9466         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9467         checkit("1.0001", buf);
9468
9469         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9470         checkit("1.00001", buf);
9471
9472         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9473         checkit("1.000001", buf);
9474
9475         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9476         checkit("0", buf);
9477
9478         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9479         checkit("-1", buf);
9480
9481         /* Some Linux gcvt's give 1.e+5 here. */
9482         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9483         checkit("100000", buf);
9484         
9485         /* Some Linux gcvt's give -1.e+5 here. */
9486         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9487         checkit("-100000", buf);
9488
9489         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9490         checkit("123.456", buf);
9491
9492         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9493         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9494         /* 34 should be enough to scare even long double
9495          * places into using the e notation. */
9496         if (strlen(buf) > 5)
9497             checkit("1e+034", buf); /* for Microsoft */
9498         else
9499             checkit("1e+34", buf);
9500
9501         /* For Perl, if you add additional tests here, also add them to
9502          * t/base/num.t for benefit of platforms not using Configure or
9503          * overriding d_Gconvert */
9504
9505         exit(0);
9506 }
9507 EOP
9508 : first add preferred functions to our list
9509 xxx_list=""
9510 for xxx_convert in $gconvert_preference; do
9511     case $xxx_convert in
9512     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9513     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9514     esac 
9515 done
9516 : then add any others
9517 for xxx_convert in gconvert gcvt sprintf; do
9518     case "$xxx_list" in
9519     *$xxx_convert*) ;;
9520     *) xxx_list="$xxx_list $xxx_convert" ;;
9521     esac 
9522 done
9523
9524 case "$d_longdbl$uselongdouble" in
9525 "$define$define")
9526     : again, add prefered functions to our list first
9527     xxx_ld_list=""
9528     for xxx_convert in $gconvert_ld_preference; do
9529         case $xxx_convert in
9530         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9531         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9532         esac
9533     done
9534     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9535     for xxx_convert in qgcvt sprintf $xxx_list; do
9536         case "$xxx_ld_list" in
9537         $xxx_convert*|*" $xxx_convert"*) ;;
9538         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9539         esac
9540     done
9541     : if sprintf cannot do long doubles, move it to the end
9542     if test "$d_PRIgldbl" != "$define"; then
9543         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9544     fi
9545     : if no qgcvt, remove it
9546     if test "$d_qgcvt" != "$define"; then
9547         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9548     fi
9549     : use the ld_list
9550     xxx_list="$xxx_ld_list"
9551     ;;
9552 esac
9553
9554 for xxx_convert in $xxx_list; do
9555         echo "Trying $xxx_convert..."
9556         $rm -f try try$_o
9557         set try -DTRY_$xxx_convert
9558         if eval $compile; then
9559                 echo "$xxx_convert() found." >&4
9560                 if $run ./try; then
9561                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9562                         break;
9563                 else
9564                         echo "...But $xxx_convert didn't work as I expected."
9565                         xxx_convert=''
9566                 fi
9567         else
9568                 echo "$xxx_convert NOT found." >&4
9569         fi
9570 done
9571
9572 if test X$xxx_convert = X; then
9573     echo "*** WHOA THERE!!! ***" >&4
9574     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9575     xxx_convert=sprintf
9576 fi
9577
9578 case "$xxx_convert" in
9579 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9580 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9581 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9582 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9583    "$define$define$define")
9584       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9585    "$define$define$undef")
9586       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9587    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9588    esac
9589    ;;  
9590 esac
9591
9592 fi
9593
9594 : see if _fwalk exists
9595 set fwalk d__fwalk
9596 eval $inlibc
9597
9598 : Initialize h_fcntl
9599 h_fcntl=false
9600
9601 : Initialize h_sysfile
9602 h_sysfile=false
9603
9604 : access call always available on UNIX
9605 set access d_access
9606 eval $inlibc
9607
9608 : locate the flags for 'access()'
9609 case "$d_access" in
9610 "$define")
9611         echo " "
9612         $cat >access.c <<EOCP
9613 #include <sys/types.h>
9614 #ifdef I_FCNTL
9615 #include <fcntl.h>
9616 #endif
9617 #ifdef I_SYS_FILE
9618 #include <sys/file.h>
9619 #endif
9620 #ifdef I_UNISTD
9621 #include <unistd.h>
9622 #endif
9623 #$i_stdlib I_STDLIB
9624 #ifdef I_STDLIB
9625 #include <stdlib.h>
9626 #endif
9627 int main() {
9628         exit(R_OK);
9629 }
9630 EOCP
9631         : check sys/file.h first, no particular reason here
9632         if $test `./findhdr sys/file.h` && \
9633                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9634                 h_sysfile=true;
9635                 echo "<sys/file.h> defines the *_OK access constants." >&4
9636         elif $test `./findhdr fcntl.h` && \
9637                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9638                 h_fcntl=true;
9639                 echo "<fcntl.h> defines the *_OK access constants." >&4
9640         elif $test `./findhdr unistd.h` && \
9641                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9642                 echo "<unistd.h> defines the *_OK access constants." >&4
9643         else
9644                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9645         fi
9646         ;;
9647 esac
9648 $rm -f access*
9649
9650 : see if accessx exists
9651 set accessx d_accessx
9652 eval $inlibc
9653
9654 : see if aintl exists
9655 set aintl d_aintl
9656 eval $inlibc
9657
9658 : see if alarm exists
9659 set alarm d_alarm
9660 eval $inlibc
9661
9662 : see if POSIX threads are available
9663 set pthread.h i_pthread
9664 eval $inhdr
9665
9666 : define a fucntion to check prototypes
9667 $cat > protochk <<EOSH
9668 $startsh
9669 cc="$cc"
9670 optimize="$optimize"
9671 ccflags="$ccflags"
9672 prototype="$prototype"
9673 define="$define"
9674 rm=$rm
9675 usethreads=$usethreads
9676 i_pthread=$i_pthread
9677 pthread_h_first=$pthread_h_first
9678 EOSH
9679
9680 $cat >> protochk <<'EOSH'
9681
9682 $rm -f try.c
9683 foo="$1"
9684 shift
9685 while test $# -ge 2; do
9686         case "$1" in
9687                 $define) echo "#include <$2>" >> try.c ;;
9688                 literal) echo "$2" >> try.c ;;
9689         esac
9690     # Extra magic for the benefit of systems that need pthread.h
9691     # to be included early to correctly detect threadsafe functions.
9692     # Such functions must guarantee themselves, though, that the usethreads
9693     # and i_pthread have been defined, before calling protochk.
9694     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9695         echo "#include <pthread.h>" >> try.c
9696         pthread_h_done=yes
9697     fi
9698     shift 2
9699 done
9700 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9701 cat >> try.c <<'EOCP'
9702 #ifdef CAN_PROTOTYPE
9703 #define _(args) args
9704 #else
9705 #define _(args) ()
9706 #endif
9707 EOCP
9708 echo "$foo" >> try.c
9709 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9710 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9711 status=$?
9712 $rm -f try.[co]
9713 exit $status
9714 EOSH
9715 chmod +x protochk
9716 $eunicefix protochk
9717
9718 hasproto='varname=$1; func=$2; shift; shift;
9719 while $test $# -ge 2; do
9720         case "$1" in
9721         $define) echo "#include <$2>";;
9722         esac ;
9723     shift 2;
9724 done > try.c;
9725 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9726 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9727         echo "$func() prototype found.";
9728         val="$define";
9729 else
9730         echo "$func() prototype NOT found.";
9731         val="$undef";
9732 fi;
9733 set $varname;
9734 eval $setvar;
9735 $rm -f try.c tryout.c'
9736
9737 : see if sys/types.h has to be included
9738 set sys/types.h i_systypes
9739 eval $inhdr
9740
9741 : see if sys/select.h has to be included
9742 set sys/select.h i_sysselct
9743 eval $inhdr
9744
9745 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9746 while $test $# -ge 2; do
9747         case "$1" in
9748         $define) echo "#include <$2>";;
9749         esac ;
9750     shift 2;
9751 done > try.c;
9752 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9753 set try;
9754 if eval $compile; then
9755         val="$define";
9756 else
9757         val="$undef";
9758 fi;
9759 set $varname;
9760 eval $setvar;
9761 $rm -f try.c try.o'
9762
9763 : see if we should include time.h, sys/time.h, or both
9764 echo " "
9765 if test "X$timeincl" = X; then
9766         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9767         $echo $n "I'm now running the test program...$c"
9768         $cat >try.c <<EOCP
9769 #include <sys/types.h>
9770 #ifdef I_TIME
9771 #include <time.h>
9772 #endif
9773 #ifdef I_SYSTIME
9774 #ifdef SYSTIMEKERNEL
9775 #define KERNEL
9776 #endif
9777 #include <sys/time.h>
9778 #endif
9779 #ifdef I_SYSSELECT
9780 #include <sys/select.h>
9781 #endif
9782 #$i_stdlib I_STDLIB
9783 #ifdef I_STDLIB
9784 #include <stdlib.h>
9785 #endif
9786 int main()
9787 {
9788         struct tm foo;
9789 #ifdef S_TIMEVAL
9790         struct timeval bar;
9791 #endif
9792 #ifdef S_TIMEZONE
9793         struct timezone tzp;
9794 #endif
9795         if (foo.tm_sec == foo.tm_sec)
9796                 exit(0);
9797 #ifdef S_TIMEVAL
9798         if (bar.tv_sec == bar.tv_sec)
9799                 exit(0);
9800 #endif
9801         exit(1);
9802 }
9803 EOCP
9804         flags=''
9805         for s_timezone in '-DS_TIMEZONE' ''; do
9806         sysselect=''
9807         for s_timeval in '-DS_TIMEVAL' ''; do
9808         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9809         for i_time in '' '-DI_TIME'; do
9810         for i_systime in '-DI_SYSTIME' ''; do
9811                 case "$flags" in
9812                 '') $echo $n ".$c"
9813                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9814                         if eval $compile; then
9815                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9816                                 shift
9817                                 flags="$*"
9818                                 echo " "
9819                                 $echo $n "Succeeded with $flags$c"
9820                         fi
9821                         ;;
9822                 esac
9823         done
9824         done
9825         done
9826         done
9827         done
9828         timeincl=''
9829         echo " "
9830         case "$flags" in
9831         *SYSTIMEKERNEL*) i_systimek="$define"
9832                 timeincl=`./findhdr sys/time.h`
9833                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9834         *) i_systimek="$undef";;
9835         esac
9836         case "$flags" in
9837         *I_TIME*) i_time="$define"
9838                 timeincl=`./findhdr time.h`" $timeincl"
9839                 echo "We'll include <time.h>." >&4;;
9840         *) i_time="$undef";;
9841         esac
9842         case "$flags" in
9843         *I_SYSTIME*) i_systime="$define"
9844                 timeincl=`./findhdr sys/time.h`" $timeincl"
9845                 echo "We'll include <sys/time.h>." >&4;;
9846         *) i_systime="$undef";;
9847         esac
9848         $rm -f try.c try
9849 fi
9850 : see if struct tm knows about tm_zone
9851 case "$i_systime$i_time" in
9852 *$define*) 
9853         echo " "
9854         echo "Checking to see if your struct tm has tm_zone field..." >&4
9855         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9856         eval $hasfield
9857         ;;
9858 *)      val="$undef"
9859         set d_tm_tm_zone
9860         eval $setvar
9861         ;;
9862 esac
9863 case "$d_tm_tm_zone" in
9864 "$define")      echo "Yes, it does."   ;;
9865 *)              echo "No, it doesn't." ;;
9866 esac
9867 : see if struct tm knows about tm_gmtoff
9868 case "$i_systime$i_time" in
9869 *$define*) 
9870         echo " "
9871         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9872         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9873         eval $hasfield
9874         ;;
9875 *)      val="$undef"
9876         set d_tm_tm_gmtoff
9877         eval $setvar
9878         ;;
9879 esac
9880 case "$d_tm_tm_gmtoff" in
9881 "$define")      echo "Yes, it does."   ;;
9882 *)              echo "No, it doesn't." ;;
9883 esac
9884
9885 : see if asctime_r exists
9886 set asctime_r d_asctime_r
9887 eval $inlibc
9888 case "$d_asctime_r" in
9889 "$define")
9890         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9891         case "$d_asctime_r_proto:$usethreads" in
9892         ":define")      d_asctime_r_proto=define
9893                 set d_asctime_r_proto asctime_r $hdrs
9894                 eval $hasproto ;;
9895         *)      ;;
9896         esac
9897         case "$d_asctime_r_proto" in
9898         define)
9899         case "$asctime_r_proto" in
9900         ''|0) try='char* asctime_r(const struct tm*, char*);'
9901         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9902         esac
9903         case "$asctime_r_proto" in
9904         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9905         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9906         esac
9907         case "$asctime_r_proto" in
9908         ''|0) try='int asctime_r(const struct tm*, char*);'
9909         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9910         esac
9911         case "$asctime_r_proto" in
9912         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9913         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9914         esac
9915         case "$asctime_r_proto" in
9916         ''|0)   d_asctime_r=undef
9917                 asctime_r_proto=0
9918                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9919         * )     case "$asctime_r_proto" in
9920                 REENTRANT_PROTO*) ;;
9921                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9922                 esac
9923                 echo "Prototype: $try" ;;
9924         esac
9925         ;;
9926         *)      case "$usethreads" in
9927                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9928                 esac
9929                 d_asctime_r=undef
9930                 asctime_r_proto=0
9931                 ;;
9932         esac
9933         ;;
9934 *)      asctime_r_proto=0
9935         ;;
9936 esac
9937
9938 : see if atolf exists
9939 set atolf d_atolf
9940 eval $inlibc
9941
9942 : see if atoll exists
9943 set atoll d_atoll
9944 eval $inlibc
9945
9946 : Look for GCC-style attribute format
9947 case "$d_attribute_format" in
9948 '')
9949 echo " "
9950 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9951 $cat >attrib.c <<'EOCP'
9952 #include <stdio.h>
9953 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9954 EOCP
9955 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9956         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9957                 echo "Your C compiler doesn't support __attribute__((format))."
9958                 val="$undef"
9959         else
9960                 echo "Your C compiler supports __attribute__((format))."
9961                 val="$define"
9962         fi
9963 else
9964         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9965         val="$undef"
9966 fi
9967 ;;
9968 *) val="$d_attribute_format" ;;
9969 esac
9970 set d_attribute_format
9971 eval $setvar
9972 $rm -f attrib*
9973
9974 : Look for GCC-style attribute malloc
9975 case "$d_attribute_malloc" in
9976 '')
9977 echo " "
9978 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9979 $cat >attrib.c <<'EOCP'
9980 #include <stdio.h>
9981 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9982 EOCP
9983 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9984         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9985                 echo "Your C compiler doesn't support __attribute__((malloc))."
9986                 val="$undef"
9987         else
9988                 echo "Your C compiler supports __attribute__((malloc))."
9989                 val="$define"
9990         fi
9991 else
9992         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9993         val="$undef"
9994 fi
9995 ;;
9996 *) val="$d_attribute_malloc" ;;
9997 esac
9998 set d_attribute_malloc
9999 eval $setvar
10000 $rm -f attrib*
10001
10002 : Look for GCC-style attribute nonnull
10003 case "$d_attribute_nonnull" in
10004 '')
10005 echo " "
10006 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10007 $cat >attrib.c <<'EOCP'
10008 #include <stdio.h>
10009 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10010 EOCP
10011 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10012         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10013                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10014                 val="$undef"
10015         else
10016                 echo "Your C compiler supports __attribute__((nonnull))."
10017                 val="$define"
10018         fi
10019 else
10020         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10021         val="$undef"
10022 fi
10023 ;;
10024 *) val="$d_attribute_nonnull" ;;
10025 esac
10026 set d_attribute_nonnull
10027 eval $setvar
10028 $rm -f attrib*
10029
10030 : Look for GCC-style attribute noreturn
10031 case "$d_attribute_noreturn" in
10032 '')
10033 echo " "
10034 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10035 $cat >attrib.c <<'EOCP'
10036 #include <stdio.h>
10037 void fall_over_dead( void ) __attribute__((noreturn));
10038 EOCP
10039 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10040         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10041                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10042                 val="$undef"
10043         else
10044                 echo "Your C compiler supports __attribute__((noreturn))."
10045                 val="$define"
10046         fi
10047 else
10048         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10049         val="$undef"
10050 fi
10051 ;;
10052 *) val="$d_attribute_noreturn" ;;
10053 esac
10054 set d_attribute_noreturn
10055 eval $setvar
10056 $rm -f attrib*
10057
10058 : Look for GCC-style attribute pure
10059 case "$d_attribute_pure" in
10060 '')
10061 echo " "
10062 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10063 $cat >attrib.c <<'EOCP'
10064 #include <stdio.h>
10065 int square( int n ) __attribute__((pure));
10066 EOCP
10067 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10068         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10069                 echo "Your C compiler doesn't support __attribute__((pure))."
10070                 val="$undef"
10071         else
10072                 echo "Your C compiler supports __attribute__((pure))."
10073                 val="$define"
10074         fi
10075 else
10076         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10077         val="$undef"
10078 fi
10079 ;;
10080 *) val="$d_attribute_pure" ;;
10081 esac
10082 set d_attribute_pure
10083 eval $setvar
10084 $rm -f attrib*
10085
10086 : Look for GCC-style attribute unused
10087 case "$d_attribute_unused" in
10088 '')
10089 echo " "
10090 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10091 $cat >attrib.c <<'EOCP'
10092 #include <stdio.h>
10093 int do_something( int dummy __attribute__((unused)), int n );
10094 EOCP
10095 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10096         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10097                 echo "Your C compiler doesn't support __attribute__((unused))."
10098                 val="$undef"
10099         else
10100                 echo "Your C compiler supports __attribute__((unused))."
10101                 val="$define"
10102         fi
10103 else
10104         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10105         val="$undef"
10106 fi
10107 ;;
10108 *) val="$d_attribute_unused" ;;
10109 esac
10110 set d_attribute_unused
10111 eval $setvar
10112 $rm -f attrib*
10113
10114 : Look for GCC-style attribute warn_unused_result
10115 case "$d_attribute_warn_unused_result" in
10116 '')
10117 echo " "
10118 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10119 $cat >attrib.c <<'EOCP'
10120 #include <stdio.h>
10121 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10122 EOCP
10123 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10124         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10125                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10126                 val="$undef"
10127         else
10128                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10129                 val="$define"
10130         fi
10131 else
10132         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10133         val="$undef"
10134 fi
10135 ;;
10136 *) val="$d_attribute_warn_unused_result" ;;
10137 esac
10138 set d_attribute_warn_unused_result
10139 eval $setvar
10140 $rm -f attrib*
10141
10142 : see if bcmp exists
10143 set bcmp d_bcmp
10144 eval $inlibc
10145
10146 : see if bcopy exists
10147 set bcopy d_bcopy
10148 eval $inlibc
10149
10150 : see if getpgrp exists
10151 set getpgrp d_getpgrp
10152 eval $inlibc
10153
10154 case "$d_getpgrp" in
10155 "$define")
10156         echo " "
10157         echo "Checking to see which flavor of getpgrp is in use..."
10158         $cat >try.c <<EOP
10159 #$i_unistd I_UNISTD
10160 #include <sys/types.h>
10161 #ifdef I_UNISTD
10162 #  include <unistd.h>
10163 #endif
10164 #$i_stdlib I_STDLIB
10165 #ifdef I_STDLIB
10166 #include <stdlib.h>
10167 #endif
10168 int main()
10169 {
10170         if (getuid() == 0) {
10171                 printf("(I see you are running Configure as super-user...)\n");
10172                 setuid(1);
10173         }
10174 #ifdef TRY_BSD_PGRP
10175         if (getpgrp(1) == 0)
10176                 exit(0);
10177 #else
10178         if (getpgrp() > 0)
10179                 exit(0);
10180 #endif
10181         exit(1);
10182 }
10183 EOP
10184         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10185                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10186                 val="$define"
10187         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10188                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10189                 val="$undef"
10190         else
10191                 echo "I can't seem to compile and run the test program."
10192                 if ./usg; then
10193                         xxx="a USG one, i.e. you use getpgrp()."
10194                 else
10195                         # SVR4 systems can appear rather BSD-ish.
10196                         case "$i_unistd" in
10197                         $undef)
10198                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10199                                 val="$define"
10200                                 ;;
10201                         $define)
10202                                 xxx="probably a USG one, i.e. you use getpgrp()."
10203                                 val="$undef"
10204                                 ;;
10205                         esac
10206                 fi
10207                 echo "Assuming your getpgrp is $xxx" >&4
10208         fi
10209         ;;
10210 *) val="$undef";;
10211 esac
10212 set d_bsdgetpgrp
10213 eval $setvar
10214 $rm -f try try.*
10215
10216 : see if setpgrp exists
10217 set setpgrp d_setpgrp
10218 eval $inlibc
10219
10220 case "$d_setpgrp" in
10221 "$define")
10222         echo " "
10223         echo "Checking to see which flavor of setpgrp is in use..."
10224         $cat >try.c <<EOP
10225 #$i_unistd I_UNISTD
10226 #include <sys/types.h>
10227 #ifdef I_UNISTD
10228 #  include <unistd.h>
10229 #endif
10230 #$i_stdlib I_STDLIB
10231 #ifdef I_STDLIB
10232 #include <stdlib.h>
10233 #endif
10234 int main()
10235 {
10236         if (getuid() == 0) {
10237                 printf("(I see you are running Configure as super-user...)\n");
10238                 setuid(1);
10239         }
10240 #ifdef TRY_BSD_PGRP
10241         if (-1 == setpgrp(1, 1))
10242                 exit(0);
10243 #else
10244         if (setpgrp() != -1)
10245                 exit(0);
10246 #endif
10247         exit(1);
10248 }
10249 EOP
10250         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10251                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10252                 val="$define"
10253         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10254                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10255                 val="$undef"
10256         else
10257                 echo "(I can't seem to compile and run the test program.)"
10258                 if ./usg; then
10259                         xxx="a USG one, i.e. you use setpgrp()."
10260                 else
10261                         # SVR4 systems can appear rather BSD-ish.
10262                         case "$i_unistd" in
10263                         $undef)
10264                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10265                                 val="$define"
10266                                 ;;
10267                         $define)
10268                                 xxx="probably a USG one, i.e. you use setpgrp()."
10269                                 val="$undef"
10270                                 ;;
10271                         esac
10272                 fi
10273                 echo "Assuming your setpgrp is $xxx" >&4
10274         fi
10275         ;;
10276 *) val="$undef";;
10277 esac
10278 set d_bsdsetpgrp
10279 eval $setvar
10280 $rm -f try try.*
10281 : Look for GCC-style __builtin_choose_expr
10282 case "$d_builtin_choose_expr" in
10283 '')
10284     echo " "
10285     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10286     $cat >try.c <<'EOCP'
10287 #include <assert.h>
10288 #include <stdlib.h>
10289 #include <stdio.h>
10290
10291 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10292
10293 int main(void) {
10294     assert( SYRINX(1) == 2112 );
10295     assert( SYRINX(1) != 5150 );
10296     assert( SYRINX(0) == 5150 );
10297     assert( SYRINX(0) != 2112 );
10298     puts( "All good!" );
10299     exit(0);
10300 }
10301
10302 EOCP
10303     set try
10304     if eval $compile; then
10305         echo "Your C compiler supports __builtin_choose_expr."
10306         val="$define"
10307     else
10308         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10309         val="$undef"
10310     fi
10311 ;;
10312 *) val="$d_builtin_choose_expr" ;;
10313 esac
10314
10315 set d_builtin_choose_expr
10316 eval $setvar
10317 $rm -f try.* try core core.try.*
10318
10319 : Look for GCC-style __builtin_expect
10320 case "$d_builtin_expect" in
10321 '')
10322     echo " "
10323     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10324     $cat >builtin.c <<'EOCP'
10325 int main(void) {
10326     int n = 50;
10327     if ( __builtin_expect(n, 0) ) n = 1;
10328 }
10329 EOCP
10330     set try
10331     if eval $compile; then
10332         echo "Your C compiler supports __builtin_choose_expr."
10333         val="$define"
10334     else
10335         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10336         val="$undef"
10337     fi
10338     ;;
10339 *) val="$d_builtin_expect" ;;
10340 esac
10341
10342 set d_builtin_expect
10343 eval $setvar
10344 $rm -f try.* try core core.try.*
10345
10346 : see if bzero exists
10347 set bzero d_bzero
10348 eval $inlibc
10349
10350 : see if stdarg is available
10351 echo " "
10352 if $test `./findhdr stdarg.h`; then
10353         echo "<stdarg.h> found." >&4
10354         valstd="$define"
10355 else
10356         echo "<stdarg.h> NOT found." >&4
10357         valstd="$undef"
10358 fi
10359
10360 : see if varags is available
10361 echo " "
10362 if $test `./findhdr varargs.h`; then
10363         echo "<varargs.h> found." >&4
10364 else
10365         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10366 fi
10367
10368 : set up the varargs testing programs
10369 $cat > varargs.c <<EOP
10370 #ifdef I_STDARG
10371 #include <stdarg.h>
10372 #endif
10373 #ifdef I_VARARGS
10374 #include <varargs.h>
10375 #endif
10376
10377 #ifdef I_STDARG
10378 int f(char *p, ...)
10379 #else
10380 int f(va_alist)
10381 va_dcl
10382 #endif
10383 {
10384         va_list ap;
10385 #ifndef I_STDARG
10386         char *p;
10387 #endif
10388 #ifdef I_STDARG
10389         va_start(ap,p);
10390 #else
10391         va_start(ap);
10392         p = va_arg(ap, char *);
10393 #endif
10394         va_end(ap);
10395         return 0;
10396 }
10397 EOP
10398 $cat > varargs <<EOP
10399 $startsh
10400 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10401         echo "true"
10402 else
10403         echo "false"
10404 fi
10405 $rm -f varargs$_o
10406 EOP
10407 chmod +x varargs
10408
10409 : now check which varargs header should be included
10410 echo " "
10411 i_varhdr=''
10412 case "$valstd" in
10413 "$define")
10414         if `./varargs I_STDARG`; then
10415                 val='stdarg.h'
10416         elif `./varargs I_VARARGS`; then
10417                 val='varargs.h'
10418         fi
10419         ;;
10420 *)
10421         if `./varargs I_VARARGS`; then
10422                 val='varargs.h'
10423         fi
10424         ;;
10425 esac
10426 case "$val" in
10427 '')
10428 echo "I could not find the definition for va_dcl... You have problems..." >&4
10429         val="$undef"; set i_stdarg; eval $setvar
10430         val="$undef"; set i_varargs; eval $setvar
10431         ;;
10432 *) 
10433         set i_varhdr
10434         eval $setvar
10435         case "$i_varhdr" in
10436         stdarg.h)
10437                 val="$define"; set i_stdarg; eval $setvar
10438                 val="$undef"; set i_varargs; eval $setvar
10439                 ;;
10440         varargs.h)
10441                 val="$undef"; set i_stdarg; eval $setvar
10442                 val="$define"; set i_varargs; eval $setvar
10443                 ;;
10444         esac
10445         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10446 esac
10447 $rm -f varargs*
10448
10449 : see if the Compiler supports C99 variadic macros
10450 case "$i_stdarg$i_stdlib" in
10451     "$define$define")
10452     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10453     $cat >try.c <<EOCP
10454 #include <stdio.h>
10455 #include <stdarg.h>
10456
10457 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10458
10459 int main() {
10460   char buf[20];
10461   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10462   puts(buf);
10463   return 0;
10464 }
10465 EOCP
10466     set try
10467     if eval $compile && $run ./try 2>&1 >/dev/null; then
10468         case "`$run ./try`" in
10469             "123 456 789")
10470             echo "You have C99 variadic macros." >&4
10471             d_c99_variadic_macros="$define"
10472             ;;
10473             *)
10474             echo "You don't have functional C99 variadic macros." >&4
10475             d_c99_variadic_macros="$undef"
10476             ;;
10477         esac
10478     else
10479         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10480         d_c99_variadic_macros="$undef"
10481     fi
10482     $rm -f try.* try core core.try.*
10483     ;;
10484     *)
10485     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10486     d_c99_variadic_macros="$undef"
10487     ;;
10488 esac
10489
10490 : see if signal is declared as pointer to function returning int or void
10491 echo " "
10492 xxx=`./findhdr signal.h`
10493 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10494 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10495         echo "You have int (*signal())() instead of void." >&4
10496         val="$undef"
10497 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10498         echo "You have void (*signal())()." >&4
10499         val="$define"
10500 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10501         echo "You have int (*signal())() instead of void." >&4
10502         val="$undef"
10503 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10504         echo "You have void (*signal())()." >&4
10505         val="$define"
10506 else
10507         case "$d_voidsig" in
10508         '')
10509         echo "I can't determine whether signal handler returns void or int..." >&4
10510                 dflt=void
10511                 rp="What type does your signal handler return?"
10512                 . ./myread
10513                 case "$ans" in
10514                 v*) val="$define";;
10515                 *) val="$undef";;
10516                 esac;;
10517         "$define")
10518                 echo "As you already told me, signal handler returns void." >&4
10519                 val="$define"
10520                 ;;
10521         *)      echo "As you already told me, signal handler returns int." >&4
10522                 val="$undef"
10523                 ;;
10524         esac
10525 fi
10526 set d_voidsig
10527 eval $setvar
10528 case "$d_voidsig" in
10529 "$define") signal_t="void";;
10530 *) signal_t="int";;
10531 esac
10532 $rm -f $$.tmp
10533
10534 : check for ability to cast large floats to 32-bit ints.
10535 echo " "
10536 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10537 if $test "$intsize" -ge 4; then
10538         xxx=int
10539 else
10540         xxx=long
10541 fi
10542 $cat >try.c <<EOCP
10543 #include <stdio.h>
10544 #$i_stdlib I_STDLIB
10545 #ifdef I_STDLIB
10546 #include <stdlib.h>
10547 #endif
10548 #include <sys/types.h>
10549 #include <signal.h>
10550 $signal_t blech(int s) { exit(3); }
10551 int main()
10552 {
10553         $xxx i32;
10554         double f, g;
10555         int result = 0;
10556         char str[16];
10557         signal(SIGFPE, blech);
10558
10559         /* Don't let compiler optimize the test away.  Store the number 
10560            in a writable string for gcc to pass to sscanf under HP/UX.
10561         */
10562         sprintf(str, "2147483647");
10563         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10564         g = 10 * f;
10565         i32  = ($xxx) g;
10566
10567         /* x86 processors will probably give 0x8000 0000, which is a
10568            sign change.  We don't want that.  We want to mimic SPARC
10569            behavior here, which is to preserve the sign and give
10570            back 0x7fff ffff.
10571         */
10572         if (i32 != ($xxx) f)
10573                 result |= 1;
10574         exit(result);
10575 }
10576 EOCP
10577 set try
10578 if eval $compile_ok; then
10579         $run ./try
10580         yyy=$?
10581 else
10582         echo "(I can't seem to compile the test program--assuming it can't)"
10583         yyy=1
10584 fi
10585 case "$yyy" in
10586 0)      val="$define"
10587         echo "Yup, it can."
10588         ;;
10589 *)      val="$undef"
10590         echo "Nope, it can't."
10591         ;;
10592 esac
10593 set d_casti32
10594 eval $setvar
10595 $rm -f try try.*
10596
10597 : check for ability to cast negative floats to unsigned
10598 echo " "
10599 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10600 $cat >try.c <<EOCP
10601 #include <stdio.h>
10602 #$i_stdlib I_STDLIB
10603 #ifdef I_STDLIB
10604 #include <stdlib.h>
10605 #endif
10606 #include <sys/types.h>
10607 #include <signal.h>
10608 $signal_t blech(int s) { exit(7); }
10609 $signal_t blech_in_list(int s) { exit(4); }
10610 unsigned long dummy_long(unsigned long p) { return p; }
10611 unsigned int dummy_int(unsigned int p) { return p; }
10612 unsigned short dummy_short(unsigned short p) { return p; }
10613 int main()
10614 {
10615         double f;
10616         unsigned long along;
10617         unsigned int aint;
10618         unsigned short ashort;
10619         int result = 0;
10620         char str[16];
10621         
10622         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10623            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10624            optimized the whole file away
10625         */
10626         /* Store the number in a writable string for gcc to pass to 
10627            sscanf under HP/UX.
10628         */
10629         sprintf(str, "-123");
10630         sscanf(str, "%lf", &f);  /* f = -123.; */
10631
10632         signal(SIGFPE, blech);
10633         along = (unsigned long)f;
10634         aint = (unsigned int)f;
10635         ashort = (unsigned short)f;
10636         if (along != (unsigned long)-123)
10637                 result |= 1;
10638         if (aint != (unsigned int)-123)
10639                 result |= 1;
10640         if (ashort != (unsigned short)-123)
10641                 result |= 1;
10642         sprintf(str, "1073741824.");
10643         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10644         f = f + f;
10645         along = 0;
10646         along = (unsigned long)f;
10647         if (along != 0x80000000)
10648                 result |= 2;
10649         f -= 1.;
10650         along = 0;
10651         along = (unsigned long)f;
10652         if (along != 0x7fffffff)
10653                 result |= 1;
10654         f += 2.;
10655         along = 0;
10656         along = (unsigned long)f;
10657         if (along != 0x80000001)
10658                 result |= 2;
10659         if (result)
10660                 exit(result);
10661         signal(SIGFPE, blech_in_list);
10662         sprintf(str, "123.");
10663         sscanf(str, "%lf", &f);  /* f = 123.; */
10664         along = dummy_long((unsigned long)f);
10665         aint = dummy_int((unsigned int)f);
10666         ashort = dummy_short((unsigned short)f);
10667         if (along != (unsigned long)123)
10668                 result |= 4;
10669         if (aint != (unsigned int)123)
10670                 result |= 4;
10671         if (ashort != (unsigned short)123)
10672                 result |= 4;
10673         exit(result);
10674
10675 }
10676 EOCP
10677 set try
10678 if eval $compile_ok; then
10679         $run ./try
10680         castflags=$?
10681 else
10682         echo "(I can't seem to compile the test program--assuming it can't)"
10683         castflags=7
10684 fi
10685 case "$castflags" in
10686 0)      val="$define"
10687         echo "Yup, it can."
10688         ;;
10689 *)      val="$undef"
10690         echo "Nope, it can't."
10691         ;;
10692 esac
10693 set d_castneg
10694 eval $setvar
10695 $rm -f try.*
10696
10697 : see if vprintf exists
10698 echo " "
10699 if set vprintf val -f d_vprintf; eval $csym; $val; then
10700         echo 'vprintf() found.' >&4
10701         val="$define"
10702         $cat >try.c <<EOF
10703 #include <varargs.h>
10704 #$i_stdlib I_STDLIB
10705 #ifdef I_STDLIB
10706 #include <stdlib.h>
10707 #endif
10708
10709 int main() { xxx("foo"); }
10710
10711 xxx(va_alist)
10712 va_dcl
10713 {
10714         va_list args;
10715         char buf[10];
10716
10717         va_start(args);
10718         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10719 }
10720 EOF
10721         set try
10722         if eval $compile && $run ./try; then
10723                 echo "Your vsprintf() returns (int)." >&4
10724                 val2="$undef"
10725         else
10726                 echo "Your vsprintf() returns (char*)." >&4
10727                 val2="$define"
10728         fi
10729 else
10730         echo 'vprintf() NOT found.' >&4
10731                 val="$undef"
10732                 val2="$undef"
10733 fi
10734 $rm -f try try.*
10735 set d_vprintf
10736 eval $setvar
10737 val=$val2
10738 set d_charvspr
10739 eval $setvar
10740
10741 : see if chown exists
10742 set chown d_chown
10743 eval $inlibc
10744
10745 : see if chroot exists
10746 set chroot d_chroot
10747 eval $inlibc
10748
10749 : see if chsize exists
10750 set chsize d_chsize
10751 eval $inlibc
10752
10753 : see if class exists
10754 set class d_class
10755 eval $inlibc
10756
10757 : see if clearenv exists
10758 set clearenv d_clearenv
10759 eval $inlibc
10760
10761 hasstruct='varname=$1; struct=$2; shift; shift;
10762 while $test $# -ge 2; do
10763         case "$1" in
10764         $define) echo "#include <$2>";;
10765         esac ;
10766     shift 2;
10767 done > try.c;
10768 echo "int main () { struct $struct foo; }" >> try.c;
10769 set try;
10770 if eval $compile; then
10771         val="$define";
10772 else
10773         val="$undef";
10774 fi;
10775 set $varname;
10776 eval $setvar;
10777 $rm -f try.c try.o'
10778
10779 socketlib=''
10780 sockethdr=''
10781 : see whether socket exists
10782 echo " "
10783 $echo $n "Hmm... $c" >&4
10784 if set socket val -f d_socket; eval $csym; $val; then
10785         echo "Looks like you have Berkeley networking support." >&4
10786         d_socket="$define"
10787         if set setsockopt val -f; eval $csym; $val; then
10788                 d_oldsock="$undef"
10789         else
10790                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10791                 d_oldsock="$define"
10792         fi
10793 else
10794         if $contains socklib libc.list >/dev/null 2>&1; then
10795                 echo "Looks like you have Berkeley networking support." >&4
10796                 d_socket="$define"
10797                 : we will have to assume that it supports the 4.2 BSD interface
10798                 d_oldsock="$undef"
10799         else
10800                 echo "You don't have Berkeley networking in libc$_a..." >&4
10801                 if test "X$d_socket" = "X$define"; then
10802                    echo "...but you seem to believe that you have sockets." >&4
10803                 else
10804                         for net in net socket
10805                         do
10806                                 if test -f /usr/lib/lib$net$_a; then
10807                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10808                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10809                                         if $contains socket libc.list >/dev/null 2>&1; then
10810                                                 d_socket="$define"
10811                                                 socketlib="-l$net"
10812                                                 case "$net" in
10813                                                 net)
10814                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10815                                                         sockethdr="-I/usr/netinclude"
10816                                                         ;;
10817                                                 esac
10818                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10819                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10820                                                         d_oldsock="$undef"
10821                                                 else
10822                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10823                                                         d_oldsock="$define"
10824                                                 fi
10825                                                 break
10826                                         fi
10827                                 fi
10828                         done
10829                         if test "X$d_socket" != "X$define"; then
10830                            echo "or anywhere else I see." >&4
10831                            d_socket="$undef"
10832                            d_oldsock="$undef"
10833                         fi
10834                 fi
10835         fi
10836 fi
10837
10838 : see if socketpair exists
10839 set socketpair d_sockpair
10840 eval $inlibc
10841
10842
10843 echo " "
10844 echo "Checking the availability of certain socket constants..." >&4
10845 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10846         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10847         $cat >try.c <<EOF
10848 #include <sys/types.h>
10849 #include <sys/socket.h>
10850 int main() {
10851     int i = $ENUM;
10852 }
10853 EOF
10854         val="$undef"
10855         set try; if eval $compile; then
10856                 val="$define"
10857         fi
10858         set d_${enum}; eval $setvar
10859         $rm -f try.c try
10860 done
10861
10862 : see if this is a sys/uio.h system
10863 set sys/uio.h i_sysuio
10864 eval $inhdr
10865
10866
10867 echo " "
10868 echo "Checking to see if your system supports struct cmsghdr..." >&4
10869 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10870 eval $hasstruct
10871 case "$d_cmsghdr_s" in
10872 "$define")      echo "Yes, it does."   ;;
10873 *)              echo "No, it doesn't." ;;
10874 esac
10875
10876
10877 : check for const keyword
10878 echo " "
10879 echo 'Checking to see if your C compiler knows about "const"...' >&4
10880 $cat >const.c <<'EOCP'
10881 typedef struct spug { int drokk; } spug;
10882 int main()
10883 {
10884         const char *foo;
10885         const spug y = { 0 };
10886 }
10887 EOCP
10888 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10889         val="$define"
10890         echo "Yup, it does."
10891 else
10892         val="$undef"
10893         echo "Nope, it doesn't."
10894 fi
10895 set d_const
10896 eval $setvar
10897
10898 : see if copysignl exists
10899 set copysignl d_copysignl
10900 eval $inlibc
10901
10902 : see if crypt exists
10903 echo " "
10904 set crypt d_crypt
10905 eval $inlibc
10906 case "$d_crypt" in
10907 $define) cryptlib='' ;;
10908 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10909                 echo 'crypt() found.' >&4
10910                 val="$define"
10911                 cryptlib=''
10912         else
10913                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10914                 if $test -z "$cryptlib"; then
10915                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10916                 else
10917                         cryptlib=-lcrypt
10918                 fi
10919                 if $test -z "$cryptlib"; then
10920                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10921                 else
10922                         cryptlib=-lcrypt
10923                 fi
10924                 if $test -z "$cryptlib"; then
10925                         cryptlib=`./loc libcrypt$_a "" $libpth`
10926                 else
10927                         cryptlib=-lcrypt
10928                 fi
10929                 if $test -z "$cryptlib"; then
10930                         echo 'crypt() NOT found.' >&4
10931                         val="$undef"
10932                 else
10933                         val="$define"
10934                 fi
10935         fi
10936         set d_crypt
10937         eval $setvar
10938         ;;
10939 esac
10940
10941 : see if this is a crypt.h system
10942 set crypt.h i_crypt
10943 eval $inhdr
10944
10945 : see if crypt_r exists
10946 set crypt_r d_crypt_r
10947 eval $inlibc
10948 case "$d_crypt_r" in
10949 "$define")
10950         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10951         case "$d_crypt_r_proto:$usethreads" in
10952         ":define")      d_crypt_r_proto=define
10953                 set d_crypt_r_proto crypt_r $hdrs
10954                 eval $hasproto ;;
10955         *)      ;;
10956         esac
10957         case "$d_crypt_r_proto" in
10958         define)
10959         case "$crypt_r_proto" in
10960         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10961         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10962         esac
10963         case "$crypt_r_proto" in
10964         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10965         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10966         esac
10967         case "$crypt_r_proto" in
10968         ''|0)   d_crypt_r=undef
10969                 crypt_r_proto=0
10970                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10971         * )     case "$crypt_r_proto" in
10972                 REENTRANT_PROTO*) ;;
10973                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10974                 esac
10975                 echo "Prototype: $try" ;;
10976         esac
10977         ;;
10978         *)      case "$usethreads" in
10979                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10980                 esac
10981                 d_crypt_r=undef
10982                 crypt_r_proto=0
10983                 ;;
10984         esac
10985         ;;
10986 *)      crypt_r_proto=0
10987         ;;
10988 esac
10989
10990 : get csh whereabouts
10991 case "$csh" in
10992 'csh') val="$undef" ;;
10993 *) val="$define" ;;
10994 esac
10995 set d_csh
10996 eval $setvar
10997 : Respect a hint or command line value for full_csh.
10998 case "$full_csh" in
10999 '') full_csh=$csh ;;
11000 esac
11001
11002 : see if ctermid_r exists
11003 set ctermid_r d_ctermid_r
11004 eval $inlibc
11005 case "$d_ctermid_r" in
11006 "$define")
11007         hdrs="$i_systypes sys/types.h define stdio.h "
11008         case "$d_ctermid_r_proto:$usethreads" in
11009         ":define")      d_ctermid_r_proto=define
11010                 set d_ctermid_r_proto ctermid_r $hdrs
11011                 eval $hasproto ;;
11012         *)      ;;
11013         esac
11014         case "$d_ctermid_r_proto" in
11015         define)
11016         case "$ctermid_r_proto" in
11017         ''|0) try='char* ctermid_r(char*);'
11018         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11019         esac
11020         case "$ctermid_r_proto" in
11021         ''|0)   d_ctermid_r=undef
11022                 ctermid_r_proto=0
11023                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11024         * )     case "$ctermid_r_proto" in
11025                 REENTRANT_PROTO*) ;;
11026                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11027                 esac
11028                 echo "Prototype: $try" ;;
11029         esac
11030         ;;
11031         *)      case "$usethreads" in
11032                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11033                 esac
11034                 d_ctermid_r=undef
11035                 ctermid_r_proto=0
11036                 ;;
11037         esac
11038         ;;
11039 *)      ctermid_r_proto=0
11040         ;;
11041 esac
11042
11043 : see if ctime_r exists
11044 set ctime_r d_ctime_r
11045 eval $inlibc
11046 case "$d_ctime_r" in
11047 "$define")
11048         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11049         case "$d_ctime_r_proto:$usethreads" in
11050         ":define")      d_ctime_r_proto=define
11051                 set d_ctime_r_proto ctime_r $hdrs
11052                 eval $hasproto ;;
11053         *)      ;;
11054         esac
11055         case "$d_ctime_r_proto" in
11056         define)
11057         case "$ctime_r_proto" in
11058         ''|0) try='char* ctime_r(const time_t*, char*);'
11059         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11060         esac
11061         case "$ctime_r_proto" in
11062         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11063         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11064         esac
11065         case "$ctime_r_proto" in
11066         ''|0) try='int ctime_r(const time_t*, char*);'
11067         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11068         esac
11069         case "$ctime_r_proto" in
11070         ''|0) try='int ctime_r(const time_t*, char*, int);'
11071         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11072         esac
11073         case "$ctime_r_proto" in
11074         ''|0)   d_ctime_r=undef
11075                 ctime_r_proto=0
11076                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11077         * )     case "$ctime_r_proto" in
11078                 REENTRANT_PROTO*) ;;
11079                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11080                 esac
11081                 echo "Prototype: $try" ;;
11082         esac
11083         ;;
11084         *)      case "$usethreads" in
11085                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11086                 esac
11087                 d_ctime_r=undef
11088                 ctime_r_proto=0
11089                 ;;
11090         esac
11091         ;;
11092 *)      ctime_r_proto=0
11093         ;;
11094 esac
11095
11096 : see if cuserid exists
11097 set cuserid d_cuserid
11098 eval $inlibc
11099
11100 : see if this is a limits.h system
11101 set limits.h i_limits
11102 eval $inhdr
11103
11104 : see if this is a float.h system
11105 set float.h i_float
11106 eval $inhdr
11107
11108 : See if number of significant digits in a double precision number is known
11109 echo " "
11110 $cat >dbl_dig.c <<EOM
11111 #$i_limits I_LIMITS
11112 #$i_float I_FLOAT
11113 #ifdef I_LIMITS
11114 #include <limits.h>
11115 #endif
11116 #ifdef I_FLOAT
11117 #include <float.h>
11118 #endif
11119 #ifdef DBL_DIG
11120 printf("Contains DBL_DIG");
11121 #endif
11122 EOM
11123 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11124 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11125         echo "DBL_DIG found." >&4
11126         val="$define"
11127 else
11128         echo "DBL_DIG NOT found." >&4
11129         val="$undef"
11130 fi
11131 $rm -f dbl_dig.?
11132 set d_dbl_dig
11133 eval $setvar
11134
11135 : see if dbm.h is available
11136 : see if dbmclose exists
11137 set dbmclose d_dbmclose
11138 eval $inlibc
11139
11140 case "$d_dbmclose" in
11141 $define)
11142         set dbm.h i_dbm
11143         eval $inhdr
11144         case "$i_dbm" in
11145         $define)
11146                 val="$undef"
11147                 set i_rpcsvcdbm
11148                 eval $setvar
11149                 ;;
11150         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11151                 eval $inhdr
11152                 ;;
11153         esac
11154         ;;
11155 *)      echo "We won't be including <dbm.h>"
11156         val="$undef"
11157         set i_dbm
11158         eval $setvar
11159         val="$undef"
11160         set i_rpcsvcdbm
11161         eval $setvar
11162         ;;
11163 esac
11164
11165 : see if prototype for dbminit is available
11166 echo " "
11167 set d_dbminitproto dbminit $i_dbm dbm.h
11168 eval $hasproto
11169
11170 : see if difftime exists
11171 set difftime d_difftime
11172 eval $inlibc
11173
11174 : see if this is a dirent system
11175 echo " "
11176 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11177         val="$define"
11178         echo "<dirent.h> found." >&4
11179 else
11180         val="$undef"
11181         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11182                 echo "<sys/dir.h> found." >&4
11183                 echo " "
11184         else
11185                 xinc=`./findhdr sys/ndir.h`
11186         fi
11187         echo "<dirent.h> NOT found." >&4
11188 fi
11189 set i_dirent
11190 eval $setvar
11191
11192 : Look for type of directory structure.
11193 echo " "
11194 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11195
11196 case "$direntrytype" in
11197 ''|' ')
11198         case "$i_dirent" in
11199         $define) guess1='struct dirent' ;;
11200         *) guess1='struct direct'  ;;
11201         esac
11202         ;;
11203 *)      guess1="$direntrytype"
11204         ;;
11205 esac
11206
11207 case "$guess1" in
11208 'struct dirent') guess2='struct direct' ;;
11209 *) guess2='struct dirent' ;;
11210 esac
11211                 
11212 if $contains "$guess1" try.c >/dev/null 2>&1; then
11213         direntrytype="$guess1"
11214         echo "Your directory entries are $direntrytype." >&4
11215 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11216         direntrytype="$guess2"
11217         echo "Your directory entries seem to be $direntrytype." >&4
11218 else
11219         echo "I don't recognize your system's directory entries." >&4
11220         rp="What type is used for directory entries on this system?"
11221         dflt="$guess1"
11222         . ./myread
11223         direntrytype="$ans"
11224 fi
11225 $rm -f try.c
11226
11227
11228 : see if the directory entry stores field length
11229 echo " "
11230 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11231 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11232         echo "Good, your directory entry keeps length information in d_namlen." >&4
11233         val="$define"
11234 else
11235         echo "Your directory entry does not know about the d_namlen field." >&4
11236         val="$undef"
11237 fi
11238 set d_dirnamlen
11239 eval $setvar
11240 $rm -f try.c
11241
11242 : see if this is an sysdir system
11243 set sys/dir.h i_sysdir
11244 eval $inhdr
11245
11246 : see if this is an sysndir system
11247 set sys/ndir.h i_sysndir
11248 eval $inhdr
11249
11250 : Look for dirfd
11251 echo " "
11252 $cat >dirfd.c <<EOM
11253 #include <stdio.h>
11254 #$i_stdlib I_STDLIB
11255 #ifdef I_STDLIB
11256 #include <stdlib.h>
11257 #endif
11258 #$i_dirent I_DIRENT             /**/
11259 #$i_sysdir I_SYS_DIR            /**/
11260 #$i_sysndir I_SYS_NDIR          /**/
11261 #$i_systypes I_SYS_TYPES        /**/
11262 #if defined(I_SYS_TYPES)
11263 #include <sys/types.h>
11264 #endif
11265 #if defined(I_DIRENT)
11266 #include <dirent.h>
11267 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11268 #include <sys/dir.h>
11269 #endif
11270 #else
11271 #ifdef I_SYS_NDIR
11272 #include <sys/ndir.h>
11273 #else
11274 #ifdef I_SYS_DIR
11275 #ifdef hp9000s500
11276 #include <ndir.h>       /* may be wrong in the future */
11277 #else
11278 #include <sys/dir.h>
11279 #endif
11280 #endif
11281 #endif
11282 #endif 
11283 int main() {
11284         DIR *dirp = opendir(".");
11285         if (dirfd(dirp) >= 0)
11286                 exit(0);
11287         else
11288                 exit(1);
11289 }
11290 EOM
11291 val=$undef
11292 set dirfd
11293 if eval $compile; then
11294         val="$define"
11295 fi
11296 case "$val" in
11297 $define)        echo "dirfd() found." >&4       ;;
11298 *)              echo "dirfd() NOT found." >&4   ;;
11299 esac
11300 set d_dirfd
11301 eval $setvar
11302 $rm -f dirfd*
11303
11304 : see if dlerror exists
11305 xxx_runnm="$runnm"
11306 runnm=false
11307 set dlerror d_dlerror
11308 eval $inlibc
11309 runnm="$xxx_runnm"
11310
11311 : see if dlfcn is available
11312 set dlfcn.h i_dlfcn
11313 eval $inhdr
11314
11315 case "$usedl" in
11316 $define|y|true)
11317         $cat << EOM
11318
11319 On a few systems, the dynamically loaded modules that perl generates and uses
11320 will need a different extension than shared libs. The default will probably
11321 be appropriate.
11322
11323 EOM
11324         case "$dlext" in
11325         '')     dflt="$so" ;;
11326         *)      dflt="$dlext" ;;
11327         esac
11328         rp='What is the extension of dynamically loaded modules'
11329         . ./myread
11330         dlext="$ans"
11331         ;;
11332 *)
11333         dlext="none"
11334         ;;
11335 esac
11336
11337 : Check if dlsym need a leading underscore
11338 echo " "
11339 val="$undef"
11340
11341 case "$dlsrc" in
11342 dl_dlopen.xs)
11343         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11344         $cat >dyna.c <<'EOM'
11345 fred () { }
11346 EOM
11347
11348 $cat >fred.c<<EOM
11349
11350 #include <stdio.h>
11351 #$i_stdlib I_STDLIB
11352 #ifdef I_STDLIB
11353 #include <stdlib.h>
11354 #endif
11355 #$i_dlfcn I_DLFCN
11356 #ifdef I_DLFCN
11357 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11358 #else
11359 #include <sys/types.h>
11360 #include <nlist.h>
11361 #include <link.h>
11362 #endif
11363
11364 extern int fred() ;
11365
11366 int main()
11367 {
11368     void * handle ;
11369     void * symbol ;
11370 #ifndef RTLD_LAZY
11371     int mode = 1 ;
11372 #else
11373     int mode = RTLD_LAZY ;
11374 #endif
11375     handle = dlopen("./dyna.$dlext", mode) ;
11376     if (handle == NULL) {
11377         printf ("1\n") ;
11378         fflush (stdout) ;
11379         exit(0);
11380     }
11381     symbol = dlsym(handle, "fred") ;
11382     if (symbol == NULL) {
11383         /* try putting a leading underscore */
11384         symbol = dlsym(handle, "_fred") ;
11385         if (symbol == NULL) {
11386             printf ("2\n") ;
11387             fflush (stdout) ;
11388             exit(0);
11389         }
11390         printf ("3\n") ;
11391     }
11392     else
11393         printf ("4\n") ;
11394     fflush (stdout) ;
11395     exit(0);
11396 }
11397 EOM
11398         : Call the object file tmp-dyna.o in case dlext=o.
11399         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11400                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11401                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11402                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11403                 xxx=`$run ./fred`
11404                 case $xxx in
11405                 1)      echo "Test program failed using dlopen." >&4
11406                         echo "Perhaps you should not use dynamic loading." >&4;;
11407                 2)      echo "Test program failed using dlsym." >&4
11408                         echo "Perhaps you should not use dynamic loading." >&4;;
11409                 3)      echo "dlsym needs a leading underscore" >&4
11410                         val="$define" ;;
11411                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11412                 esac
11413         else
11414                 echo "I can't compile and run the test program." >&4
11415                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11416         fi
11417         ;;
11418 esac
11419                 
11420 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11421
11422 set d_dlsymun
11423 eval $setvar
11424
11425 : see if drand48_r exists
11426 set drand48_r d_drand48_r
11427 eval $inlibc
11428 case "$d_drand48_r" in
11429 "$define")
11430         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11431         case "$d_drand48_r_proto:$usethreads" in
11432         ":define")      d_drand48_r_proto=define
11433                 set d_drand48_r_proto drand48_r $hdrs
11434                 eval $hasproto ;;
11435         *)      ;;
11436         esac
11437         case "$d_drand48_r_proto" in
11438         define)
11439         case "$drand48_r_proto" in
11440         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11441         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11442         esac
11443         case "$drand48_r_proto" in
11444         ''|0)   d_drand48_r=undef
11445                 drand48_r_proto=0
11446                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11447         * )     case "$drand48_r_proto" in
11448                 REENTRANT_PROTO*) ;;
11449                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11450                 esac
11451                 echo "Prototype: $try" ;;
11452         esac
11453         ;;
11454         *)      case "$usethreads" in
11455                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11456                 esac
11457                 d_drand48_r=undef
11458                 drand48_r_proto=0
11459                 ;;
11460         esac
11461         ;;
11462 *)      drand48_r_proto=0
11463         ;;
11464 esac
11465
11466 : see if prototype for drand48 is available
11467 echo " "
11468 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11469 eval $hasproto
11470
11471 : see if dup2 exists
11472 set dup2 d_dup2
11473 eval $inlibc
11474
11475 : see if eaccess exists
11476 set eaccess d_eaccess
11477 eval $inlibc
11478
11479 : see if endgrent exists
11480 set endgrent d_endgrent
11481 eval $inlibc
11482
11483 : see if this is an grp system
11484 set grp.h i_grp
11485 eval $inhdr
11486
11487 case "$i_grp" in
11488 $define)
11489         xxx=`./findhdr grp.h`
11490         $cppstdin $cppflags $cppminus < $xxx >$$.h
11491
11492         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11493                 val="$define"
11494         else
11495                 val="$undef"
11496         fi
11497         set d_grpasswd
11498         eval $setvar
11499
11500         $rm -f $$.h
11501         ;;
11502 *)
11503         val="$undef";
11504         set d_grpasswd; eval $setvar
11505         ;;
11506 esac
11507
11508 : see if endgrent_r exists
11509 set endgrent_r d_endgrent_r
11510 eval $inlibc
11511 case "$d_endgrent_r" in
11512 "$define")
11513         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11514         case "$d_endgrent_r_proto:$usethreads" in
11515         ":define")      d_endgrent_r_proto=define
11516                 set d_endgrent_r_proto endgrent_r $hdrs
11517                 eval $hasproto ;;
11518         *)      ;;
11519         esac
11520         case "$d_endgrent_r_proto" in
11521         define)
11522         case "$endgrent_r_proto" in
11523         ''|0) try='int endgrent_r(FILE**);'
11524         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11525         esac
11526         case "$endgrent_r_proto" in
11527         ''|0) try='void endgrent_r(FILE**);'
11528         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11529         esac
11530         case "$endgrent_r_proto" in
11531         ''|0)   d_endgrent_r=undef
11532                 endgrent_r_proto=0
11533                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11534         * )     case "$endgrent_r_proto" in
11535                 REENTRANT_PROTO*) ;;
11536                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11537                 esac
11538                 echo "Prototype: $try" ;;
11539         esac
11540         ;;
11541         *)      case "$usethreads" in
11542                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11543                 esac
11544                 d_endgrent_r=undef
11545                 endgrent_r_proto=0
11546                 ;;
11547         esac
11548         ;;
11549 *)      endgrent_r_proto=0
11550         ;;
11551 esac
11552
11553 : see if endhostent exists
11554 set endhostent d_endhent
11555 eval $inlibc
11556
11557 : see if this is a netdb.h system
11558 set netdb.h i_netdb
11559 eval $inhdr
11560
11561 : see if endhostent_r exists
11562 set endhostent_r d_endhostent_r
11563 eval $inlibc
11564 case "$d_endhostent_r" in
11565 "$define")
11566         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11567         case "$d_endhostent_r_proto:$usethreads" in
11568         ":define")      d_endhostent_r_proto=define
11569                 set d_endhostent_r_proto endhostent_r $hdrs
11570                 eval $hasproto ;;
11571         *)      ;;
11572         esac
11573         case "$d_endhostent_r_proto" in
11574         define)
11575         case "$endhostent_r_proto" in
11576         ''|0) try='int endhostent_r(struct hostent_data*);'
11577         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11578         esac
11579         case "$endhostent_r_proto" in
11580         ''|0) try='void endhostent_r(struct hostent_data*);'
11581         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11582         esac
11583         case "$endhostent_r_proto" in
11584         ''|0)   d_endhostent_r=undef
11585                 endhostent_r_proto=0
11586                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11587         * )     case "$endhostent_r_proto" in
11588                 REENTRANT_PROTO*) ;;
11589                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11590                 esac
11591                 echo "Prototype: $try" ;;
11592         esac
11593         ;;
11594         *)      case "$usethreads" in
11595                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11596                 esac
11597                 d_endhostent_r=undef
11598                 endhostent_r_proto=0
11599                 ;;
11600         esac
11601         ;;
11602 *)      endhostent_r_proto=0
11603         ;;
11604 esac
11605
11606 : see if endnetent exists
11607 set endnetent d_endnent
11608 eval $inlibc
11609
11610 : see if endnetent_r exists
11611 set endnetent_r d_endnetent_r
11612 eval $inlibc
11613 case "$d_endnetent_r" in
11614 "$define")
11615         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11616         case "$d_endnetent_r_proto:$usethreads" in
11617         ":define")      d_endnetent_r_proto=define
11618                 set d_endnetent_r_proto endnetent_r $hdrs
11619                 eval $hasproto ;;
11620         *)      ;;
11621         esac
11622         case "$d_endnetent_r_proto" in
11623         define)
11624         case "$endnetent_r_proto" in
11625         ''|0) try='int endnetent_r(struct netent_data*);'
11626         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11627         esac
11628         case "$endnetent_r_proto" in
11629         ''|0) try='void endnetent_r(struct netent_data*);'
11630         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11631         esac
11632         case "$endnetent_r_proto" in
11633         ''|0)   d_endnetent_r=undef
11634                 endnetent_r_proto=0
11635                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11636         * )     case "$endnetent_r_proto" in
11637                 REENTRANT_PROTO*) ;;
11638                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11639                 esac
11640                 echo "Prototype: $try" ;;
11641         esac
11642         ;;
11643         *)      case "$usethreads" in
11644                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11645                 esac
11646                 d_endnetent_r=undef
11647                 endnetent_r_proto=0
11648                 ;;
11649         esac
11650         ;;
11651 *)      endnetent_r_proto=0
11652         ;;
11653 esac
11654
11655 : see if endprotoent exists
11656 set endprotoent d_endpent
11657 eval $inlibc
11658
11659 : see if endprotoent_r exists
11660 set endprotoent_r d_endprotoent_r
11661 eval $inlibc
11662 case "$d_endprotoent_r" in
11663 "$define")
11664         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11665         case "$d_endprotoent_r_proto:$usethreads" in
11666         ":define")      d_endprotoent_r_proto=define
11667                 set d_endprotoent_r_proto endprotoent_r $hdrs
11668                 eval $hasproto ;;
11669         *)      ;;
11670         esac
11671         case "$d_endprotoent_r_proto" in
11672         define)
11673         case "$endprotoent_r_proto" in
11674         ''|0) try='int endprotoent_r(struct protoent_data*);'
11675         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11676         esac
11677         case "$endprotoent_r_proto" in
11678         ''|0) try='void endprotoent_r(struct protoent_data*);'
11679         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11680         esac
11681         case "$endprotoent_r_proto" in
11682         ''|0)   d_endprotoent_r=undef
11683                 endprotoent_r_proto=0
11684                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11685         * )     case "$endprotoent_r_proto" in
11686                 REENTRANT_PROTO*) ;;
11687                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11688                 esac
11689                 echo "Prototype: $try" ;;
11690         esac
11691         ;;
11692         *)      case "$usethreads" in
11693                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11694                 esac
11695                 d_endprotoent_r=undef
11696                 endprotoent_r_proto=0
11697                 ;;
11698         esac
11699         ;;
11700 *)      endprotoent_r_proto=0
11701         ;;
11702 esac
11703
11704 : see if endpwent exists
11705 set endpwent d_endpwent
11706 eval $inlibc
11707
11708 : see if this is a pwd.h system
11709 set pwd.h i_pwd
11710 eval $inhdr
11711
11712 case "$i_pwd" in
11713 $define)
11714         xxx=`./findhdr pwd.h`
11715         $cppstdin $cppflags $cppminus < $xxx >$$.h
11716
11717         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11718                 val="$define"
11719         else
11720                 val="$undef"
11721         fi
11722         set d_pwquota
11723         eval $setvar
11724
11725         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11726                 val="$define"
11727         else
11728                 val="$undef"
11729         fi
11730         set d_pwage
11731         eval $setvar
11732
11733         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11734                 val="$define"
11735         else
11736                 val="$undef"
11737         fi
11738         set d_pwchange
11739         eval $setvar
11740
11741         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11742                 val="$define"
11743         else
11744                 val="$undef"
11745         fi
11746         set d_pwclass
11747         eval $setvar
11748
11749         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11750                 val="$define"
11751         else
11752                 val="$undef"
11753         fi
11754         set d_pwexpire
11755         eval $setvar
11756
11757         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11758                 val="$define"
11759         else
11760                 val="$undef"
11761         fi
11762         set d_pwcomment
11763         eval $setvar
11764
11765         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11766                 val="$define"
11767         else
11768                 val="$undef"
11769         fi
11770         set d_pwgecos
11771         eval $setvar
11772
11773         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11774                 val="$define"
11775         else
11776                 val="$undef"
11777         fi
11778         set d_pwpasswd
11779         eval $setvar
11780
11781         $rm -f $$.h
11782         ;;
11783 *)
11784         val="$undef"; 
11785         set d_pwquota; eval $setvar
11786         set d_pwage; eval $setvar
11787         set d_pwchange; eval $setvar
11788         set d_pwclass; eval $setvar
11789         set d_pwexpire; eval $setvar
11790         set d_pwcomment; eval $setvar
11791         set d_pwgecos; eval $setvar
11792         set d_pwpasswd; eval $setvar
11793         ;;
11794 esac
11795
11796 : see if endpwent_r exists
11797 set endpwent_r d_endpwent_r
11798 eval $inlibc
11799 case "$d_endpwent_r" in
11800 "$define")
11801         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11802         case "$d_endpwent_r_proto:$usethreads" in
11803         ":define")      d_endpwent_r_proto=define
11804                 set d_endpwent_r_proto endpwent_r $hdrs
11805                 eval $hasproto ;;
11806         *)      ;;
11807         esac
11808         case "$d_endpwent_r_proto" in
11809         define)
11810         case "$endpwent_r_proto" in
11811         ''|0) try='int endpwent_r(FILE**);'
11812         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11813         esac
11814         case "$endpwent_r_proto" in
11815         ''|0) try='void endpwent_r(FILE**);'
11816         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11817         esac
11818         case "$endpwent_r_proto" in
11819         ''|0)   d_endpwent_r=undef
11820                 endpwent_r_proto=0
11821                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11822         * )     case "$endpwent_r_proto" in
11823                 REENTRANT_PROTO*) ;;
11824                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11825                 esac
11826                 echo "Prototype: $try" ;;
11827         esac
11828         ;;
11829         *)      case "$usethreads" in
11830                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11831                 esac
11832                 d_endpwent_r=undef
11833                 endpwent_r_proto=0
11834                 ;;
11835         esac
11836         ;;
11837 *)      endpwent_r_proto=0
11838         ;;
11839 esac
11840
11841 : see if endservent exists
11842 set endservent d_endsent
11843 eval $inlibc
11844
11845 : see if endservent_r exists
11846 set endservent_r d_endservent_r
11847 eval $inlibc
11848 case "$d_endservent_r" in
11849 "$define")
11850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11851         case "$d_endservent_r_proto:$usethreads" in
11852         ":define")      d_endservent_r_proto=define
11853                 set d_endservent_r_proto endservent_r $hdrs
11854                 eval $hasproto ;;
11855         *)      ;;
11856         esac
11857         case "$d_endservent_r_proto" in
11858         define)
11859         case "$endservent_r_proto" in
11860         ''|0) try='int endservent_r(struct servent_data*);'
11861         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11862         esac
11863         case "$endservent_r_proto" in
11864         ''|0) try='void endservent_r(struct servent_data*);'
11865         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11866         esac
11867         case "$endservent_r_proto" in
11868         ''|0)   d_endservent_r=undef
11869                 endservent_r_proto=0
11870                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11871         * )     case "$endservent_r_proto" in
11872                 REENTRANT_PROTO*) ;;
11873                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11874                 esac
11875                 echo "Prototype: $try" ;;
11876         esac
11877         ;;
11878         *)      case "$usethreads" in
11879                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11880                 esac
11881                 d_endservent_r=undef
11882                 endservent_r_proto=0
11883                 ;;
11884         esac
11885         ;;
11886 *)      endservent_r_proto=0
11887         ;;
11888 esac
11889
11890 : Locate the flags for 'open()'
11891 echo " "
11892 $cat >try.c <<EOCP
11893 #include <sys/types.h>
11894 #ifdef I_FCNTL
11895 #include <fcntl.h>
11896 #endif
11897 #ifdef I_SYS_FILE
11898 #include <sys/file.h>
11899 #endif
11900 #$i_stdlib I_STDLIB
11901 #ifdef I_STDLIB
11902 #include <stdlib.h>
11903 #endif
11904 int main() {
11905         if(O_RDONLY);
11906 #ifdef O_TRUNC
11907         exit(0);
11908 #else
11909         exit(1);
11910 #endif
11911 }
11912 EOCP
11913 : check sys/file.h first to get FREAD on Sun
11914 if $test `./findhdr sys/file.h` && \
11915                 set try -DI_SYS_FILE && eval $compile; then
11916         h_sysfile=true;
11917         echo "<sys/file.h> defines the O_* constants..." >&4
11918         if $run ./try; then
11919                 echo "and you have the 3 argument form of open()." >&4
11920                 val="$define"
11921         else
11922                 echo "but not the 3 argument form of open().  Oh, well." >&4
11923                 val="$undef"
11924         fi
11925 elif $test `./findhdr fcntl.h` && \
11926                 set try -DI_FCNTL && eval $compile; then
11927         h_fcntl=true;
11928         echo "<fcntl.h> defines the O_* constants..." >&4
11929         if $run ./try; then
11930                 echo "and you have the 3 argument form of open()." >&4
11931                 val="$define"
11932         else
11933                 echo "but not the 3 argument form of open().  Oh, well." >&4
11934                 val="$undef"
11935         fi
11936 else
11937         val="$undef"
11938         echo "I can't find the O_* constant definitions!  You got problems." >&4
11939 fi
11940 set d_open3
11941 eval $setvar
11942 $rm -f try try.*
11943
11944 : see which of string.h or strings.h is needed
11945 echo " "
11946 strings=`./findhdr string.h`
11947 if $test "$strings" && $test -r "$strings"; then
11948         echo "Using <string.h> instead of <strings.h>." >&4
11949         val="$define"
11950 else
11951         val="$undef"
11952         strings=`./findhdr strings.h`
11953         if $test "$strings" && $test -r "$strings"; then
11954                 echo "Using <strings.h> instead of <string.h>." >&4
11955         else
11956                 echo "No string header found -- You'll surely have problems." >&4
11957         fi
11958 fi
11959 set i_string
11960 eval $setvar
11961 case "$i_string" in
11962 "$undef") strings=`./findhdr strings.h`;;
11963 *)        strings=`./findhdr string.h`;;
11964 esac
11965
11966 : see if this is a sys/file.h system
11967 val=''
11968 set sys/file.h val
11969 eval $inhdr
11970
11971 : do we need to include sys/file.h ?
11972 case "$val" in
11973 "$define")
11974         echo " "
11975         if $h_sysfile; then
11976                 val="$define"
11977                 echo "We'll be including <sys/file.h>." >&4
11978         else
11979                 val="$undef"
11980                 echo "We won't be including <sys/file.h>." >&4
11981         fi
11982         ;;
11983 *)
11984         h_sysfile=false
11985         ;;
11986 esac
11987 set i_sysfile
11988 eval $setvar
11989
11990 : see if fcntl.h is there
11991 val=''
11992 set fcntl.h val
11993 eval $inhdr
11994
11995 : see if we can include fcntl.h
11996 case "$val" in
11997 "$define")
11998         echo " "
11999         if $h_fcntl; then
12000                 val="$define"
12001                 echo "We'll be including <fcntl.h>." >&4
12002         else
12003                 val="$undef"
12004                 if $h_sysfile; then
12005         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12006                 else
12007                         echo "We won't be including <fcntl.h>." >&4
12008                 fi
12009         fi
12010         ;;
12011 *)
12012         h_fcntl=false
12013         val="$undef"
12014         ;;
12015 esac
12016 set i_fcntl
12017 eval $setvar
12018
12019 : check for non-blocking I/O stuff
12020 case "$h_sysfile" in
12021 true) echo "#include <sys/file.h>" > head.c;;
12022 *)
12023        case "$h_fcntl" in
12024        true) echo "#include <fcntl.h>" > head.c;;
12025        *) echo "#include <sys/fcntl.h>" > head.c;;
12026        esac
12027        ;;
12028 esac
12029 echo " "
12030 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12031 case "$o_nonblock" in
12032 '')
12033         $cat head.c > try.c
12034         $cat >>try.c <<EOCP
12035 #include <stdio.h>
12036 #$i_stdlib I_STDLIB
12037 #ifdef I_STDLIB
12038 #include <stdlib.h>
12039 #endif
12040 #$i_fcntl I_FCNTL
12041 #ifdef I_FCNTL
12042 #include <fcntl.h>
12043 #endif
12044 int main() {
12045 #ifdef O_NONBLOCK
12046         printf("O_NONBLOCK\n");
12047         exit(0);
12048 #endif
12049 #ifdef O_NDELAY
12050         printf("O_NDELAY\n");
12051         exit(0);
12052 #endif
12053 #ifdef FNDELAY
12054         printf("FNDELAY\n");
12055         exit(0);
12056 #endif
12057         exit(0);
12058 }
12059 EOCP
12060         set try
12061         if eval $compile_ok; then
12062                 o_nonblock=`$run ./try`
12063                 case "$o_nonblock" in
12064                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12065                 *) echo "Seems like we can use $o_nonblock.";;
12066                 esac
12067         else
12068                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12069         fi
12070         ;;
12071 *) echo "Using $hint value $o_nonblock.";;
12072 esac
12073 $rm -f try try.* .out core
12074
12075 echo " "
12076 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12077 case "$eagain" in
12078 '')
12079         $cat head.c > try.c
12080         $cat >>try.c <<EOCP
12081 #include <errno.h>
12082 #include <sys/types.h>
12083 #include <signal.h>
12084 #include <stdio.h> 
12085 #$i_stdlib I_STDLIB
12086 #ifdef I_STDLIB
12087 #include <stdlib.h>
12088 #endif
12089 #$i_fcntl I_FCNTL
12090 #ifdef I_FCNTL
12091 #include <fcntl.h>
12092 #endif
12093 #define MY_O_NONBLOCK $o_nonblock
12094 #ifndef errno  /* XXX need better Configure test */
12095 extern int errno;
12096 #endif
12097 #$i_unistd I_UNISTD
12098 #ifdef I_UNISTD
12099 #include <unistd.h>
12100 #endif
12101 #$i_string I_STRING
12102 #ifdef I_STRING
12103 #include <string.h>
12104 #else
12105 #include <strings.h>
12106 #endif
12107 $signal_t blech(int x) { exit(3); }
12108 EOCP
12109         $cat >> try.c <<'EOCP'
12110 int main()
12111 {
12112         int pd[2];
12113         int pu[2];
12114         char buf[1];
12115         char string[100];
12116
12117         pipe(pd);       /* Down: child -> parent */
12118         pipe(pu);       /* Up: parent -> child */
12119         if (0 != fork()) {
12120                 int ret;
12121                 close(pd[1]);   /* Parent reads from pd[0] */
12122                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12123 #ifdef F_SETFL
12124                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12125                         exit(1);
12126 #else
12127                 exit(4);
12128 #endif
12129                 signal(SIGALRM, blech);
12130                 alarm(5);
12131                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12132                         exit(2);
12133                 sprintf(string, "%d\n", ret);
12134                 write(2, string, strlen(string));
12135                 alarm(0);
12136 #ifdef EAGAIN
12137                 if (errno == EAGAIN) {
12138                         printf("EAGAIN\n");
12139                         goto ok;
12140                 }
12141 #endif
12142 #ifdef EWOULDBLOCK
12143                 if (errno == EWOULDBLOCK)
12144                         printf("EWOULDBLOCK\n");
12145 #endif
12146         ok:
12147                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12148                 sleep(2);                               /* Give it time to close our pipe */
12149                 alarm(5);
12150                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12151                 alarm(0);
12152                 sprintf(string, "%d\n", ret);
12153                 write(4, string, strlen(string));
12154                 exit(0);
12155         }
12156
12157         close(pd[0]);                   /* We write to pd[1] */
12158         close(pu[1]);                   /* We read from pu[0] */
12159         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12160         close(pd[1]);                   /* Pipe pd is now fully closed! */
12161         exit(0);                                /* Bye bye, thank you for playing! */
12162 }
12163 EOCP
12164         set try
12165         if eval $compile_ok; then
12166                 echo "$startsh" >mtry
12167                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12168                 chmod +x mtry
12169                 ./mtry >/dev/null 2>&1
12170                 case $? in
12171                 0) eagain=`$cat try.out`;;
12172                 1) echo "Could not perform non-blocking setting!";;
12173                 2) echo "I did a successful read() for something that was not there!";;
12174                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12175                 4) echo "Could not find F_SETFL!";;
12176                 *) echo "Something terribly wrong happened during testing.";;
12177                 esac
12178                 rd_nodata=`$cat try.ret`
12179                 echo "A read() system call with no data present returns $rd_nodata."
12180                 case "$rd_nodata" in
12181                 0|-1) ;;
12182                 *)
12183                         echo "(That's peculiar, fixing that to be -1.)"
12184                         rd_nodata=-1
12185                         ;;
12186                 esac
12187                 case "$eagain" in
12188                 '')
12189                         echo "Forcing errno EAGAIN on read() with no data available."
12190                         eagain=EAGAIN
12191                         ;;
12192                 *)
12193                         echo "Your read() sets errno to $eagain when no data is available."
12194                         ;;
12195                 esac
12196                 status=`$cat try.err`
12197                 case "$status" in
12198                 0) echo "And it correctly returns 0 to signal EOF.";;
12199                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12200                 *) echo "However, your read() returns '$status' on EOF??";;
12201                 esac
12202                 val="$define"
12203                 if test "$status" = "$rd_nodata"; then
12204                         echo "WARNING: you can't distinguish between EOF and no data!"
12205                         val="$undef"
12206                 fi
12207         else
12208                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12209                 eagain=EAGAIN
12210         fi
12211         set d_eofnblk
12212         eval $setvar
12213         ;;
12214 *)
12215         echo "Using $hint value $eagain."
12216         echo "Your read() returns $rd_nodata when no data is present."
12217         case "$d_eofnblk" in
12218         "$define") echo "And you can see EOF because read() returns 0.";;
12219         "$undef") echo "But you can't see EOF status from read() returned value.";;
12220         *)
12221                 echo "(Assuming you can't see EOF status from read anyway.)"
12222                 d_eofnblk=$undef
12223                 ;;
12224         esac
12225         ;;
12226 esac
12227 $rm -f try try.* .out core head.c mtry
12228
12229 : see if _ptr and _cnt from stdio act std
12230 echo " "
12231
12232 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12233         echo "(Looks like you have stdio.h from BSD.)"
12234         case "$stdio_ptr" in
12235         '') stdio_ptr='((fp)->_p)'
12236                 ptr_lval=$define
12237                 ;;
12238         *)      ptr_lval=$d_stdio_ptr_lval;;
12239         esac
12240         case "$stdio_cnt" in
12241         '') stdio_cnt='((fp)->_r)'
12242                 cnt_lval=$define
12243                 ;;
12244         *)      cnt_lval=$d_stdio_cnt_lval;;
12245         esac
12246         case "$stdio_base" in
12247         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12248         esac
12249         case "$stdio_bufsiz" in
12250         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12251         esac
12252 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12253         echo "(Looks like you have stdio.h from Linux.)"
12254         case "$stdio_ptr" in
12255         '') stdio_ptr='((fp)->_IO_read_ptr)'
12256                 ptr_lval=$define
12257                 ;;
12258         *)      ptr_lval=$d_stdio_ptr_lval;;
12259         esac
12260         case "$stdio_cnt" in
12261         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12262                 cnt_lval=$undef
12263                 ;;
12264         *)      cnt_lval=$d_stdio_cnt_lval;;
12265         esac
12266         case "$stdio_base" in
12267         '') stdio_base='((fp)->_IO_read_base)';;
12268         esac
12269         case "$stdio_bufsiz" in
12270         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12271         esac
12272 else
12273         case "$stdio_ptr" in
12274         '') stdio_ptr='((fp)->_ptr)'
12275                 ptr_lval=$define
12276                 ;;
12277         *)      ptr_lval=$d_stdio_ptr_lval;;
12278         esac
12279         case "$stdio_cnt" in
12280         '') stdio_cnt='((fp)->_cnt)'
12281                 cnt_lval=$define
12282                 ;;
12283         *)      cnt_lval=$d_stdio_cnt_lval;;
12284         esac
12285         case "$stdio_base" in
12286         '') stdio_base='((fp)->_base)';;
12287         esac
12288         case "$stdio_bufsiz" in
12289         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12290         esac
12291 fi
12292
12293 : test whether _ptr and _cnt really work
12294 echo "Checking how std your stdio is..." >&4
12295 $cat >try.c <<EOP
12296 #include <stdio.h>
12297 #$i_stdlib I_STDLIB
12298 #ifdef I_STDLIB
12299 #include <stdlib.h>
12300 #endif
12301 #define FILE_ptr(fp)    $stdio_ptr
12302 #define FILE_cnt(fp)    $stdio_cnt
12303 int main() {
12304         FILE *fp = fopen("try.c", "r");
12305         char c = getc(fp);
12306         if (
12307                 18 <= FILE_cnt(fp) &&
12308                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12309         )
12310                 exit(0);
12311         exit(1);
12312 }
12313 EOP
12314 val="$undef"
12315 set try
12316 if eval $compile && $to try.c; then
12317         if $run ./try; then
12318                 echo "Your stdio acts pretty std."
12319                 val="$define"
12320         else
12321                 echo "Your stdio isn't very std."
12322         fi
12323 else
12324         echo "Your stdio doesn't appear very std."
12325 fi
12326 $rm -f try.c try
12327
12328 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12329 # direct buffer manipulation no longer works.  The Configure tests
12330 # should be changed to correctly detect this, but until then,
12331 # the following check should at least let perl compile and run.
12332 # (This quick fix should be updated before 5.8.1.)
12333 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12334 # A. Dougherty, June 3, 2002.
12335 case "$d_gnulibc" in
12336 $define)
12337         case "$gnulibc_version" in
12338         2.[01]*)  ;;
12339         2.2) ;;
12340         2.2.[0-9]) ;;
12341         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12342                 val="$undef"
12343                 ;;
12344         esac
12345         ;;
12346 esac
12347 set d_stdstdio
12348 eval $setvar
12349
12350 : Can _ptr be used as an lvalue?
12351 case "$d_stdstdio$ptr_lval" in
12352 $define$define) val=$define ;;
12353 *) val=$undef ;;
12354 esac
12355 set d_stdio_ptr_lval
12356 eval $setvar
12357
12358 : Can _cnt be used as an lvalue?
12359 case "$d_stdstdio$cnt_lval" in
12360 $define$define) val=$define ;;
12361 *) val=$undef ;;
12362 esac
12363 set d_stdio_cnt_lval
12364 eval $setvar
12365
12366
12367 : test whether setting _ptr sets _cnt as a side effect
12368 d_stdio_ptr_lval_sets_cnt="$undef"
12369 d_stdio_ptr_lval_nochange_cnt="$undef"
12370 case "$d_stdio_ptr_lval$d_stdstdio" in
12371 $define$define)
12372         echo "Checking to see what happens if we set the stdio ptr..." >&4
12373 $cat >try.c <<EOP
12374 #include <stdio.h>
12375 /* Can we scream? */
12376 /* Eat dust sed :-) */
12377 /* In the buffer space, no one can hear you scream. */
12378 #$i_stdlib I_STDLIB
12379 #ifdef I_STDLIB
12380 #include <stdlib.h>
12381 #endif
12382 #define FILE_ptr(fp)    $stdio_ptr
12383 #define FILE_cnt(fp)    $stdio_cnt
12384 #include <sys/types.h>
12385 int main() {
12386         FILE *fp = fopen("try.c", "r");
12387         int c;
12388         char *ptr;
12389         size_t cnt;
12390         if (!fp) {
12391             puts("Fail even to read");
12392             exit(1);
12393         }
12394         c = getc(fp); /* Read away the first # */
12395         if (c == EOF) {
12396             puts("Fail even to read");
12397             exit(1);
12398         }
12399         if (!(
12400                 18 <= FILE_cnt(fp) &&
12401                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12402         )) {
12403                 puts("Fail even to read");
12404                 exit (1);
12405         }
12406         ptr = (char*) FILE_ptr(fp);
12407         cnt = (size_t)FILE_cnt(fp);
12408
12409         FILE_ptr(fp) += 42;
12410
12411         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12412                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12413                 exit (1);
12414         }
12415         if (FILE_cnt(fp) <= 20) {
12416                 printf ("Fail (<20 chars to test)");
12417                 exit (1);
12418         }
12419         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12420                 puts("Fail compare");
12421                 exit (1);
12422         }
12423         if (cnt == FILE_cnt(fp)) {
12424                 puts("Pass_unchanged");
12425                 exit (0);
12426         }       
12427         if (FILE_cnt(fp) == (cnt - 42)) {
12428                 puts("Pass_changed");
12429                 exit (0);
12430         }
12431         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12432         return 1;
12433
12434 }
12435 EOP
12436         set try
12437         if eval $compile && $to try.c; then
12438                 case `$run ./try` in
12439                 Pass_changed)
12440                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12441                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12442                 Pass_unchanged)
12443                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12444                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12445                 Fail*)
12446                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12447                 *)
12448                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12449         esac
12450         else
12451                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12452         fi
12453         $rm -f try.c try
12454         ;;
12455 esac
12456
12457 : see if _base is also standard
12458 val="$undef"
12459 case "$d_stdstdio" in
12460 $define)
12461         $cat >try.c <<EOP
12462 #include <stdio.h>
12463 #$i_stdlib I_STDLIB
12464 #ifdef I_STDLIB
12465 #include <stdlib.h>
12466 #endif
12467 #define FILE_base(fp)   $stdio_base
12468 #define FILE_bufsiz(fp) $stdio_bufsiz
12469 int main() {
12470         FILE *fp = fopen("try.c", "r");
12471         char c = getc(fp);
12472         if (
12473                 19 <= FILE_bufsiz(fp) &&
12474                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12475         )
12476                 exit(0);
12477         exit(1);
12478 }
12479 EOP
12480         set try
12481         if eval $compile && $to try.c; then
12482                 if $run ./try; then
12483                         echo "And its _base field acts std."
12484                         val="$define"
12485                 else
12486                         echo "But its _base field isn't std."
12487                 fi
12488         else
12489                 echo "However, it seems to be lacking the _base field."
12490         fi
12491         $rm -f try.c try
12492         ;;
12493 esac
12494 set d_stdiobase
12495 eval $setvar
12496
12497 : see if fast_stdio exists
12498 val="$undef"
12499 case "$d_stdstdio:$d_stdio_ptr_lval" in
12500 "$define:$define")
12501         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12502         *$define*)
12503                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12504                 val="$define"
12505                 ;;
12506         esac
12507         ;;
12508 esac
12509 set d_faststdio
12510 eval $setvar
12511
12512
12513
12514 : see if fchdir exists
12515 set fchdir d_fchdir
12516 eval $inlibc
12517
12518 : see if fchmod exists
12519 set fchmod d_fchmod
12520 eval $inlibc
12521
12522 : see if fchown exists
12523 set fchown d_fchown
12524 eval $inlibc
12525
12526 : see if this is an fcntl system
12527 set fcntl d_fcntl
12528 eval $inlibc
12529
12530 echo " "
12531 : See if fcntl-based locking works.
12532 $cat >try.c <<EOCP
12533 #$i_stdlib I_STDLIB
12534 #ifdef I_STDLIB
12535 #include <stdlib.h>
12536 #endif
12537 #include <unistd.h>
12538 #include <fcntl.h>
12539 #include <signal.h>
12540 $signal_t blech(int x) { exit(3); }
12541 int main() {
12542 #if defined(F_SETLK) && defined(F_SETLKW)
12543      struct flock flock;
12544      int retval, fd;
12545      fd = open("try.c", O_RDONLY);
12546      flock.l_type = F_RDLCK;
12547      flock.l_whence = SEEK_SET;
12548      flock.l_start = flock.l_len = 0;
12549      signal(SIGALRM, blech);
12550      alarm(10);
12551      retval = fcntl(fd, F_SETLK, &flock);
12552      close(fd);
12553      (retval < 0 ? exit(2) : exit(0));
12554 #else
12555      exit(2);
12556 #endif
12557 }
12558 EOCP
12559 echo "Checking if fcntl-based file locking works... "
12560 case "$d_fcntl" in
12561 "$define")
12562         set try
12563         if eval $compile_ok; then
12564                 if $run ./try; then
12565                         echo "Yes, it seems to work."
12566                         val="$define"
12567                 else
12568                         echo "Nope, it didn't work."
12569                         val="$undef"
12570                         case "$?" in
12571                         3) $cat >&4 <<EOM
12572 ***
12573 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12574 *** This is (almost) impossible.
12575 *** If your NFS lock daemons are not feeling well, something like
12576 *** this may happen, please investigate.  Cannot continue, aborting.
12577 ***
12578 EOM
12579                                 exit 1
12580                                 ;;
12581                         esac
12582                 fi
12583         else
12584                 echo "I'm unable to compile the test program, so I'll assume not."
12585                 val="$undef"
12586         fi
12587         ;;
12588 *) val="$undef";
12589         echo "Nope, since you don't even have fcntl()."
12590         ;;
12591 esac
12592 set d_fcntl_can_lock
12593 eval $setvar
12594 $rm -f try*
12595
12596
12597 : check for fd_set items
12598 $cat <<EOM
12599
12600 Checking to see how well your C compiler handles fd_set and friends ...
12601 EOM
12602 $cat >try.c <<EOCP
12603 #$i_stdlib I_STDLIB
12604 #ifdef I_STDLIB
12605 #include <stdlib.h>
12606 #endif
12607 #$i_systime I_SYS_TIME
12608 #$i_sysselct I_SYS_SELECT
12609 #$d_socket HAS_SOCKET
12610 #include <sys/types.h>
12611 #ifdef HAS_SOCKET
12612 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12613 #endif
12614 #ifdef I_SYS_TIME
12615 #include <sys/time.h>
12616 #endif
12617 #ifdef I_SYS_SELECT
12618 #include <sys/select.h>
12619 #endif
12620 int main() {
12621         fd_set fds;
12622
12623 #ifdef TRYBITS
12624         if(fds.fds_bits);
12625 #endif
12626
12627 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12628         exit(0);
12629 #else
12630         exit(1);
12631 #endif
12632 }
12633 EOCP
12634 set try -DTRYBITS
12635 if eval $compile; then
12636         d_fds_bits="$define"
12637         d_fd_set="$define"
12638         echo "Well, your system knows about the normal fd_set typedef..." >&4
12639         if $run ./try; then
12640                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12641                 d_fd_macros="$define"
12642         else
12643                 $cat >&4 <<'EOM'
12644 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12645 EOM
12646                 d_fd_macros="$undef"
12647         fi
12648 else
12649         $cat <<'EOM'
12650 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12651 EOM
12652         set try
12653         if eval $compile; then
12654                 d_fds_bits="$undef"
12655                 d_fd_set="$define"
12656                 echo "Well, your system has some sort of fd_set available..." >&4
12657                 if $run ./try; then
12658                         echo "and you have the normal fd_set macros." >&4
12659                         d_fd_macros="$define"
12660                 else
12661                         $cat <<'EOM'
12662 but not the normal fd_set macros!  Gross!  More work for me...
12663 EOM
12664                         d_fd_macros="$undef"
12665                 fi
12666         else
12667         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12668                 d_fd_set="$undef"
12669                 d_fds_bits="$undef"
12670                 d_fd_macros="$undef"
12671         fi
12672 fi
12673 $rm -f try try.*
12674
12675 : see if fgetpos exists
12676 set fgetpos d_fgetpos
12677 eval $inlibc
12678
12679 : see if finite exists
12680 set finite d_finite
12681 eval $inlibc
12682
12683 : see if finitel exists
12684 set finitel d_finitel
12685 eval $inlibc
12686
12687 : see if flock exists
12688 set flock d_flock
12689 eval $inlibc
12690
12691 : see if prototype for flock is available
12692 echo " "
12693 set d_flockproto flock $i_sysfile sys/file.h
12694 eval $hasproto
12695
12696 : see if fork exists
12697 set fork d_fork
12698 eval $inlibc
12699
12700 : see if fp_class exists
12701 set fp_class d_fp_class
12702 eval $inlibc
12703
12704 : see if pathconf exists
12705 set pathconf d_pathconf
12706 eval $inlibc
12707
12708 : see if fpathconf exists
12709 set fpathconf d_fpathconf
12710 eval $inlibc
12711
12712 : see if fpclass exists
12713 set fpclass d_fpclass
12714 eval $inlibc
12715
12716 : see if fpclassify exists
12717 set fpclassify d_fpclassify
12718 eval $inlibc
12719
12720 : see if fpclassl exists
12721 set fpclassl d_fpclassl
12722 eval $inlibc
12723
12724
12725 : check for fpos64_t
12726 echo " "
12727 echo "Checking to see if you have fpos64_t..." >&4
12728 $cat >try.c <<EOCP
12729 #include <stdio.h>
12730 int main() { fpos64_t x = 7; }
12731 EOCP
12732 set try
12733 if eval $compile; then
12734         val="$define"
12735         echo "You have fpos64_t."
12736 else
12737         val="$undef"
12738         echo "You do not have fpos64_t."
12739         case "$fpossize" in
12740         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12741         esac
12742 fi
12743 $rm -f try.* try
12744 set d_fpos64_t
12745 eval $setvar
12746
12747 : see if frexpl exists
12748 set frexpl d_frexpl
12749 eval $inlibc
12750
12751 : see if this is a sys/param system
12752 set sys/param.h i_sysparam
12753 eval $inhdr
12754
12755 : see if this is a sys/mount.h system
12756 set sys/mount.h i_sysmount
12757 eval $inhdr
12758
12759
12760 echo " "
12761 echo "Checking to see if your system supports struct fs_data..." >&4
12762 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12763 eval $hasstruct
12764 case "$d_fs_data_s" in
12765 "$define")      echo "Yes, it does."   ;;
12766 *)              echo "No, it doesn't." ;;
12767 esac
12768
12769 : see if fseeko exists
12770 set fseeko d_fseeko
12771 eval $inlibc
12772 case "$longsize" in
12773 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12774 esac
12775
12776 : see if fsetpos exists
12777 set fsetpos d_fsetpos
12778 eval $inlibc
12779
12780
12781 : see if fstatfs exists
12782 set fstatfs d_fstatfs
12783 eval $inlibc
12784
12785
12786 : see if statvfs exists
12787 set statvfs d_statvfs
12788 eval $inlibc
12789
12790 : see if fstatvfs exists
12791 set fstatvfs d_fstatvfs
12792 eval $inlibc
12793
12794
12795 : see if fsync exists
12796 set fsync d_fsync
12797 eval $inlibc
12798
12799 : see if ftello exists
12800 set ftello d_ftello
12801 eval $inlibc
12802 case "$longsize" in
12803 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12804 esac
12805
12806 d_futimes="$undef"
12807 : check for a working futimes
12808 echo " "
12809 echo "Checking for a working futimes()" >&4
12810 $cat >try.c <<EOCP
12811 #include <stdio.h>
12812 #include <sys/time.h>
12813 #include <errno.h>
12814 #include <fcntl.h>
12815
12816 int main ()
12817 {
12818     int fd, rv;
12819     fd = open ("try.c", O_RDWR);
12820     if (-1 == fd) exit (1);
12821     rv = futimes (fd, NULL);
12822     exit (rv == -1 ? errno : 0);
12823 }
12824 EOCP
12825 set try
12826 if eval $compile; then
12827     `$run ./try`
12828     rc=$?
12829     case "$rc" in
12830         0)  echo "Yes, it does" >&4
12831             d_futimes="$define"
12832             ;;
12833         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12834             ;;
12835     esac
12836 else
12837     echo "No, it does not (probably harmless)\n" >&4
12838 fi
12839 $rm -f try.* try core core.try.*
12840
12841 : see if getcwd exists
12842 set getcwd d_getcwd
12843 eval $inlibc
12844
12845 : see if getespwnam exists
12846 set getespwnam d_getespwnam
12847 eval $inlibc
12848
12849
12850 : see if getfsstat exists
12851 set getfsstat d_getfsstat
12852 eval $inlibc
12853
12854 : see if getgrent exists
12855 set getgrent d_getgrent
12856 eval $inlibc
12857
12858 : see if getgrent_r exists
12859 set getgrent_r d_getgrent_r
12860 eval $inlibc
12861 case "$d_getgrent_r" in
12862 "$define")
12863         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12864         case "$d_getgrent_r_proto:$usethreads" in
12865         ":define")      d_getgrent_r_proto=define
12866                 set d_getgrent_r_proto getgrent_r $hdrs
12867                 eval $hasproto ;;
12868         *)      ;;
12869         esac
12870         case "$d_getgrent_r_proto" in
12871         define)
12872         case "$getgrent_r_proto" in
12873         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12874         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12875         esac
12876         case "$getgrent_r_proto" in
12877         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12878         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12879         esac
12880         case "$getgrent_r_proto" in
12881         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12882         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12883         esac
12884         case "$getgrent_r_proto" in
12885         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12886         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12887         esac
12888         case "$getgrent_r_proto" in
12889         ''|0) try='int getgrent_r(struct group*, char*, int);'
12890         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12891         esac
12892         case "$getgrent_r_proto" in
12893         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12894         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12895         esac
12896         case "$getgrent_r_proto" in
12897         ''|0)   d_getgrent_r=undef
12898                 getgrent_r_proto=0
12899                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12900         * )     case "$getgrent_r_proto" in
12901                 REENTRANT_PROTO*) ;;
12902                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12903                 esac
12904                 echo "Prototype: $try" ;;
12905         esac
12906         ;;
12907         *)      case "$usethreads" in
12908                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12909                 esac
12910                 d_getgrent_r=undef
12911                 getgrent_r_proto=0
12912                 ;;
12913         esac
12914         ;;
12915 *)      getgrent_r_proto=0
12916         ;;
12917 esac
12918
12919 : see if getgrgid_r exists
12920 set getgrgid_r d_getgrgid_r
12921 eval $inlibc
12922 case "$d_getgrgid_r" in
12923 "$define")
12924         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12925         case "$d_getgrgid_r_proto:$usethreads" in
12926         ":define")      d_getgrgid_r_proto=define
12927                 set d_getgrgid_r_proto getgrgid_r $hdrs
12928                 eval $hasproto ;;
12929         *)      ;;
12930         esac
12931         case "$d_getgrgid_r_proto" in
12932         define)
12933         case "$getgrgid_r_proto" in
12934         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12935         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12936         esac
12937         case "$getgrgid_r_proto" in
12938         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12939         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12940         esac
12941         case "$getgrgid_r_proto" in
12942         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12943         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12944         esac
12945         case "$getgrgid_r_proto" in
12946         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12947         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12948         esac
12949         case "$getgrgid_r_proto" in
12950         ''|0)   d_getgrgid_r=undef
12951                 getgrgid_r_proto=0
12952                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12953         * )     case "$getgrgid_r_proto" in
12954                 REENTRANT_PROTO*) ;;
12955                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12956                 esac
12957                 echo "Prototype: $try" ;;
12958         esac
12959         ;;
12960         *)      case "$usethreads" in
12961                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12962                 esac
12963                 d_getgrgid_r=undef
12964                 getgrgid_r_proto=0
12965                 ;;
12966         esac
12967         ;;
12968 *)      getgrgid_r_proto=0
12969         ;;
12970 esac
12971
12972 : see if getgrnam_r exists
12973 set getgrnam_r d_getgrnam_r
12974 eval $inlibc
12975 case "$d_getgrnam_r" in
12976 "$define")
12977         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12978         case "$d_getgrnam_r_proto:$usethreads" in
12979         ":define")      d_getgrnam_r_proto=define
12980                 set d_getgrnam_r_proto getgrnam_r $hdrs
12981                 eval $hasproto ;;
12982         *)      ;;
12983         esac
12984         case "$d_getgrnam_r_proto" in
12985         define)
12986         case "$getgrnam_r_proto" in
12987         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12988         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12989         esac
12990         case "$getgrnam_r_proto" in
12991         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12992         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12993         esac
12994         case "$getgrnam_r_proto" in
12995         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12996         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12997         esac
12998         case "$getgrnam_r_proto" in
12999         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13000         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13001         esac
13002         case "$getgrnam_r_proto" in
13003         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13004         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13005         esac
13006         case "$getgrnam_r_proto" in
13007         ''|0)   d_getgrnam_r=undef
13008                 getgrnam_r_proto=0
13009                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13010         * )     case "$getgrnam_r_proto" in
13011                 REENTRANT_PROTO*) ;;
13012                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13013                 esac
13014                 echo "Prototype: $try" ;;
13015         esac
13016         ;;
13017         *)      case "$usethreads" in
13018                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13019                 esac
13020                 d_getgrnam_r=undef
13021                 getgrnam_r_proto=0
13022                 ;;
13023         esac
13024         ;;
13025 *)      getgrnam_r_proto=0
13026         ;;
13027 esac
13028
13029 : see if gethostbyaddr exists
13030 set gethostbyaddr d_gethbyaddr
13031 eval $inlibc
13032
13033 : see if gethostbyname exists
13034 set gethostbyname d_gethbyname
13035 eval $inlibc
13036
13037 : see if gethostent exists
13038 set gethostent d_gethent
13039 eval $inlibc
13040
13041 : see how we will look up host name
13042 echo " "
13043 call=''
13044 if set gethostname val -f d_gethname; eval $csym; $val; then
13045         echo 'gethostname() found.' >&4
13046         d_gethname="$define"
13047         call=gethostname
13048 fi
13049 if set uname val -f d_uname; eval $csym; $val; then
13050         if ./xenix; then
13051                 $cat <<'EOM'
13052 uname() was found, but you're running xenix, and older versions of xenix
13053 have a broken uname(). If you don't really know whether your xenix is old
13054 enough to have a broken system call, use the default answer.
13055
13056 EOM
13057                 dflt=y
13058                 case "$d_uname" in
13059                 "$define") dflt=n;;
13060                 esac
13061                 rp='Is your uname() broken?'
13062                 . ./myread
13063                 case "$ans" in
13064                 n*) d_uname="$define"; call=uname;;
13065                 esac
13066         else
13067                 echo 'uname() found.' >&4
13068                 d_uname="$define"
13069                 case "$call" in
13070                 '') call=uname ;;
13071                 esac
13072         fi
13073 fi
13074 case "$d_gethname" in
13075 '') d_gethname="$undef";;
13076 esac
13077 case "$d_uname" in
13078 '') d_uname="$undef";;
13079 esac
13080 case "$d_uname$d_gethname" in
13081 *define*)
13082         dflt=n
13083         cat <<EOM
13084  
13085 Every now and then someone has a $call() that lies about the hostname
13086 but can't be fixed for political or economic reasons.  If you wish, I can
13087 pretend $call() isn't there and maybe compute hostname at run-time
13088 thanks to the '$phostname' command.
13089
13090 EOM
13091         rp="Shall I ignore $call() from now on?"
13092         . ./myread
13093         case "$ans" in
13094         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13095         esac;;
13096 esac
13097 case "$phostname" in
13098 '') aphostname='';;
13099 *) case "$aphostname" in
13100         /*) ;;
13101         *) set X $phostname
13102                 shift
13103                 file=$1
13104                 shift
13105                 file=`./loc $file $file $pth`
13106                 aphostname=`echo $file $*`
13107                 ;;
13108         esac
13109         ;;
13110 esac
13111 case "$d_uname$d_gethname" in
13112 *define*) ;;
13113 *)
13114         case "$phostname" in
13115         '')
13116                 echo "There will be no way for $package to get your hostname." >&4;;
13117         *)
13118         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13119                 ;;
13120         esac;;
13121 esac
13122 case "$d_phostname" in
13123 '') d_phostname="$undef";;
13124 esac
13125
13126 : see if gethostbyaddr_r exists
13127 set gethostbyaddr_r d_gethostbyaddr_r
13128 eval $inlibc
13129 case "$d_gethostbyaddr_r" in
13130 "$define")
13131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13132         case "$d_gethostbyaddr_r_proto:$usethreads" in
13133         ":define")      d_gethostbyaddr_r_proto=define
13134                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13135                 eval $hasproto ;;
13136         *)      ;;
13137         esac
13138         case "$d_gethostbyaddr_r_proto" in
13139         define)
13140         case "$gethostbyaddr_r_proto" in
13141         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13142         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13143         esac
13144         case "$gethostbyaddr_r_proto" in
13145         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13146         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13147         esac
13148         case "$gethostbyaddr_r_proto" in
13149         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13150         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13151         esac
13152         case "$gethostbyaddr_r_proto" in
13153         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13154         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13155         esac
13156         case "$gethostbyaddr_r_proto" in
13157         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13158         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13159         esac
13160         case "$gethostbyaddr_r_proto" in
13161         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13162         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13163         esac
13164         case "$gethostbyaddr_r_proto" in
13165         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13166         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13167         esac
13168         case "$gethostbyaddr_r_proto" in
13169         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13170         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13171         esac
13172         case "$gethostbyaddr_r_proto" in
13173         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13174         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13175         esac
13176         case "$gethostbyaddr_r_proto" in
13177         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13178         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13179         esac
13180         case "$gethostbyaddr_r_proto" in
13181         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13182         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13183         esac
13184         case "$gethostbyaddr_r_proto" in
13185         ''|0)   d_gethostbyaddr_r=undef
13186                 gethostbyaddr_r_proto=0
13187                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13188         * )     case "$gethostbyaddr_r_proto" in
13189                 REENTRANT_PROTO*) ;;
13190                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13191                 esac
13192                 echo "Prototype: $try" ;;
13193         esac
13194         ;;
13195         *)      case "$usethreads" in
13196                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13197                 esac
13198                 d_gethostbyaddr_r=undef
13199                 gethostbyaddr_r_proto=0
13200                 ;;
13201         esac
13202         ;;
13203 *)      gethostbyaddr_r_proto=0
13204         ;;
13205 esac
13206
13207 : see if gethostbyname_r exists
13208 set gethostbyname_r d_gethostbyname_r
13209 eval $inlibc
13210 case "$d_gethostbyname_r" in
13211 "$define")
13212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13213         case "$d_gethostbyname_r_proto:$usethreads" in
13214         ":define")      d_gethostbyname_r_proto=define
13215                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13216                 eval $hasproto ;;
13217         *)      ;;
13218         esac
13219         case "$d_gethostbyname_r_proto" in
13220         define)
13221         case "$gethostbyname_r_proto" in
13222         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13223         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13224         esac
13225         case "$gethostbyname_r_proto" in
13226         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13227         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13228         esac
13229         case "$gethostbyname_r_proto" in
13230         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13231         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13232         esac
13233         case "$gethostbyname_r_proto" in
13234         ''|0)   d_gethostbyname_r=undef
13235                 gethostbyname_r_proto=0
13236                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13237         * )     case "$gethostbyname_r_proto" in
13238                 REENTRANT_PROTO*) ;;
13239                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13240                 esac
13241                 echo "Prototype: $try" ;;
13242         esac
13243         ;;
13244         *)      case "$usethreads" in
13245                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13246                 esac
13247                 d_gethostbyname_r=undef
13248                 gethostbyname_r_proto=0
13249                 ;;
13250         esac
13251         ;;
13252 *)      gethostbyname_r_proto=0
13253         ;;
13254 esac
13255
13256 : see if gethostent_r exists
13257 set gethostent_r d_gethostent_r
13258 eval $inlibc
13259 case "$d_gethostent_r" in
13260 "$define")
13261         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13262         case "$d_gethostent_r_proto:$usethreads" in
13263         ":define")      d_gethostent_r_proto=define
13264                 set d_gethostent_r_proto gethostent_r $hdrs
13265                 eval $hasproto ;;
13266         *)      ;;
13267         esac
13268         case "$d_gethostent_r_proto" in
13269         define)
13270         case "$gethostent_r_proto" in
13271         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13272         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13273         esac
13274         case "$gethostent_r_proto" in
13275         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13276         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13277         esac
13278         case "$gethostent_r_proto" in
13279         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13280         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13281         esac
13282         case "$gethostent_r_proto" in
13283         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13284         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13285         esac
13286         case "$gethostent_r_proto" in
13287         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13288         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13289         esac
13290         case "$gethostent_r_proto" in
13291         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13292         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13293         esac
13294         case "$gethostent_r_proto" in
13295         ''|0)   d_gethostent_r=undef
13296                 gethostent_r_proto=0
13297                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13298         * )     case "$gethostent_r_proto" in
13299                 REENTRANT_PROTO*) ;;
13300                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13301                 esac
13302                 echo "Prototype: $try" ;;
13303         esac
13304         ;;
13305         *)      case "$usethreads" in
13306                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13307                 esac
13308                 d_gethostent_r=undef
13309                 gethostent_r_proto=0
13310                 ;;
13311         esac
13312         ;;
13313 *)      gethostent_r_proto=0
13314         ;;
13315 esac
13316
13317 : see if prototypes for various gethostxxx netdb.h functions are available
13318 echo " "
13319 set d_gethostprotos gethostent $i_netdb netdb.h
13320 eval $hasproto
13321
13322 : see if getitimer exists
13323 set getitimer d_getitimer
13324 eval $inlibc
13325
13326 : see if getlogin exists
13327 set getlogin d_getlogin
13328 eval $inlibc
13329
13330 : see if getlogin_r exists
13331 set getlogin_r d_getlogin_r
13332 eval $inlibc
13333 case "$d_getlogin_r" in
13334 "$define")
13335         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13336         case "$d_getlogin_r_proto:$usethreads" in
13337         ":define")      d_getlogin_r_proto=define
13338                 set d_getlogin_r_proto getlogin_r $hdrs
13339                 eval $hasproto ;;
13340         *)      ;;
13341         esac
13342         case "$d_getlogin_r_proto" in
13343         define)
13344         case "$getlogin_r_proto" in
13345         ''|0) try='int getlogin_r(char*, size_t);'
13346         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13347         esac
13348         case "$getlogin_r_proto" in
13349         ''|0) try='int getlogin_r(char*, int);'
13350         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13351         esac
13352         case "$getlogin_r_proto" in
13353         ''|0) try='char* getlogin_r(char*, size_t);'
13354         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13355         esac
13356         case "$getlogin_r_proto" in
13357         ''|0) try='char* getlogin_r(char*, int);'
13358         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13359         esac
13360         case "$getlogin_r_proto" in
13361         ''|0)   d_getlogin_r=undef
13362                 getlogin_r_proto=0
13363                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13364         * )     case "$getlogin_r_proto" in
13365                 REENTRANT_PROTO*) ;;
13366                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13367                 esac
13368                 echo "Prototype: $try" ;;
13369         esac
13370         ;;
13371         *)      case "$usethreads" in
13372                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13373                 esac
13374                 d_getlogin_r=undef
13375                 getlogin_r_proto=0
13376                 ;;
13377         esac
13378         ;;
13379 *)      getlogin_r_proto=0
13380         ;;
13381 esac
13382
13383 : see if getmnt exists
13384 set getmnt d_getmnt
13385 eval $inlibc
13386
13387 : see if getmntent exists
13388 set getmntent d_getmntent
13389 eval $inlibc
13390
13391 : see if getnetbyaddr exists
13392 set getnetbyaddr d_getnbyaddr
13393 eval $inlibc
13394
13395 : see if getnetbyname exists
13396 set getnetbyname d_getnbyname
13397 eval $inlibc
13398
13399 : see if getnetent exists
13400 set getnetent d_getnent
13401 eval $inlibc
13402
13403 : see if getnetbyaddr_r exists
13404 set getnetbyaddr_r d_getnetbyaddr_r
13405 eval $inlibc
13406 case "$d_getnetbyaddr_r" in
13407 "$define")
13408         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13409         case "$d_getnetbyaddr_r_proto:$usethreads" in
13410         ":define")      d_getnetbyaddr_r_proto=define
13411                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13412                 eval $hasproto ;;
13413         *)      ;;
13414         esac
13415         case "$d_getnetbyaddr_r_proto" in
13416         define)
13417         case "$getnetbyaddr_r_proto" in
13418         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13419         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13420         esac
13421         case "$getnetbyaddr_r_proto" in
13422         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13423         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13424         esac
13425         case "$getnetbyaddr_r_proto" in
13426         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13427         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13428         esac
13429         case "$getnetbyaddr_r_proto" in
13430         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13431         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13432         esac
13433         case "$getnetbyaddr_r_proto" in
13434         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13435         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13436         esac
13437         case "$getnetbyaddr_r_proto" in
13438         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13439         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13440         esac
13441         case "$getnetbyaddr_r_proto" in
13442         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13443         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13444         esac
13445         case "$getnetbyaddr_r_proto" in
13446         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13447         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13448         esac
13449         case "$getnetbyaddr_r_proto" in
13450         ''|0)   d_getnetbyaddr_r=undef
13451                 getnetbyaddr_r_proto=0
13452                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13453         * )     case "$getnetbyaddr_r_proto" in
13454                 REENTRANT_PROTO*) ;;
13455                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13456                 esac
13457                 echo "Prototype: $try" ;;
13458         esac
13459         ;;
13460         *)      case "$usethreads" in
13461                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13462                 esac
13463                 d_getnetbyaddr_r=undef
13464                 getnetbyaddr_r_proto=0
13465                 ;;
13466         esac
13467         ;;
13468 *)      getnetbyaddr_r_proto=0
13469         ;;
13470 esac
13471
13472 : see if getnetbyname_r exists
13473 set getnetbyname_r d_getnetbyname_r
13474 eval $inlibc
13475 case "$d_getnetbyname_r" in
13476 "$define")
13477         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13478         case "$d_getnetbyname_r_proto:$usethreads" in
13479         ":define")      d_getnetbyname_r_proto=define
13480                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13481                 eval $hasproto ;;
13482         *)      ;;
13483         esac
13484         case "$d_getnetbyname_r_proto" in
13485         define)
13486         case "$getnetbyname_r_proto" in
13487         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13488         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13489         esac
13490         case "$getnetbyname_r_proto" in
13491         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13492         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13493         esac
13494         case "$getnetbyname_r_proto" in
13495         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13496         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13497         esac
13498         case "$getnetbyname_r_proto" in
13499         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13500         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13501         esac
13502         case "$getnetbyname_r_proto" in
13503         ''|0)   d_getnetbyname_r=undef
13504                 getnetbyname_r_proto=0
13505                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13506         * )     case "$getnetbyname_r_proto" in
13507                 REENTRANT_PROTO*) ;;
13508                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13509                 esac
13510                 echo "Prototype: $try" ;;
13511         esac
13512         ;;
13513         *)      case "$usethreads" in
13514                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13515                 esac
13516                 d_getnetbyname_r=undef
13517                 getnetbyname_r_proto=0
13518                 ;;
13519         esac
13520         ;;
13521 *)      getnetbyname_r_proto=0
13522         ;;
13523 esac
13524
13525 : see if getnetent_r exists
13526 set getnetent_r d_getnetent_r
13527 eval $inlibc
13528 case "$d_getnetent_r" in
13529 "$define")
13530         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13531         case "$d_getnetent_r_proto:$usethreads" in
13532         ":define")      d_getnetent_r_proto=define
13533                 set d_getnetent_r_proto getnetent_r $hdrs
13534                 eval $hasproto ;;
13535         *)      ;;
13536         esac
13537         case "$d_getnetent_r_proto" in
13538         define)
13539         case "$getnetent_r_proto" in
13540         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13541         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13542         esac
13543         case "$getnetent_r_proto" in
13544         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13545         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13546         esac
13547         case "$getnetent_r_proto" in
13548         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13549         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13550         esac
13551         case "$getnetent_r_proto" in
13552         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13553         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13554         esac
13555         case "$getnetent_r_proto" in
13556         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13557         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13558         esac
13559         case "$getnetent_r_proto" in
13560         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13561         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13562         esac
13563         case "$getnetent_r_proto" in
13564         ''|0)   d_getnetent_r=undef
13565                 getnetent_r_proto=0
13566                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13567         * )     case "$getnetent_r_proto" in
13568                 REENTRANT_PROTO*) ;;
13569                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13570                 esac
13571                 echo "Prototype: $try" ;;
13572         esac
13573         ;;
13574         *)      case "$usethreads" in
13575                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13576                 esac
13577                 d_getnetent_r=undef
13578                 getnetent_r_proto=0
13579                 ;;
13580         esac
13581         ;;
13582 *)      getnetent_r_proto=0
13583         ;;
13584 esac
13585
13586 : see if prototypes for various getnetxxx netdb.h functions are available
13587 echo " "
13588 set d_getnetprotos getnetent $i_netdb netdb.h
13589 eval $hasproto
13590
13591 : see if getpagesize exists
13592 set getpagesize d_getpagsz
13593 eval $inlibc
13594
13595
13596 : see if getprotobyname exists
13597 set getprotobyname d_getpbyname
13598 eval $inlibc
13599
13600 : see if getprotobynumber exists
13601 set getprotobynumber d_getpbynumber
13602 eval $inlibc
13603
13604 : see if getprotoent exists
13605 set getprotoent d_getpent
13606 eval $inlibc
13607
13608 : see if getpgid exists
13609 set getpgid d_getpgid
13610 eval $inlibc
13611
13612 : see if getpgrp2 exists
13613 set getpgrp2 d_getpgrp2
13614 eval $inlibc
13615
13616 : see if getppid exists
13617 set getppid d_getppid
13618 eval $inlibc
13619
13620 : see if getpriority exists
13621 set getpriority d_getprior
13622 eval $inlibc
13623
13624 : see if getprotobyname_r exists
13625 set getprotobyname_r d_getprotobyname_r
13626 eval $inlibc
13627 case "$d_getprotobyname_r" in
13628 "$define")
13629         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13630         case "$d_getprotobyname_r_proto:$usethreads" in
13631         ":define")      d_getprotobyname_r_proto=define
13632                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13633                 eval $hasproto ;;
13634         *)      ;;
13635         esac
13636         case "$d_getprotobyname_r_proto" in
13637         define)
13638         case "$getprotobyname_r_proto" in
13639         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13640         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13641         esac
13642         case "$getprotobyname_r_proto" in
13643         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13644         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13645         esac
13646         case "$getprotobyname_r_proto" in
13647         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13648         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13649         esac
13650         case "$getprotobyname_r_proto" in
13651         ''|0)   d_getprotobyname_r=undef
13652                 getprotobyname_r_proto=0
13653                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13654         * )     case "$getprotobyname_r_proto" in
13655                 REENTRANT_PROTO*) ;;
13656                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13657                 esac
13658                 echo "Prototype: $try" ;;
13659         esac
13660         ;;
13661         *)      case "$usethreads" in
13662                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13663                 esac
13664                 d_getprotobyname_r=undef
13665                 getprotobyname_r_proto=0
13666                 ;;
13667         esac
13668         ;;
13669 *)      getprotobyname_r_proto=0
13670         ;;
13671 esac
13672
13673 : see if getprotobynumber_r exists
13674 set getprotobynumber_r d_getprotobynumber_r
13675 eval $inlibc
13676 case "$d_getprotobynumber_r" in
13677 "$define")
13678         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13679         case "$d_getprotobynumber_r_proto:$usethreads" in
13680         ":define")      d_getprotobynumber_r_proto=define
13681                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13682                 eval $hasproto ;;
13683         *)      ;;
13684         esac
13685         case "$d_getprotobynumber_r_proto" in
13686         define)
13687         case "$getprotobynumber_r_proto" in
13688         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13689         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13690         esac
13691         case "$getprotobynumber_r_proto" in
13692         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13693         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13694         esac
13695         case "$getprotobynumber_r_proto" in
13696         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13697         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13698         esac
13699         case "$getprotobynumber_r_proto" in
13700         ''|0)   d_getprotobynumber_r=undef
13701                 getprotobynumber_r_proto=0
13702                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13703         * )     case "$getprotobynumber_r_proto" in
13704                 REENTRANT_PROTO*) ;;
13705                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13706                 esac
13707                 echo "Prototype: $try" ;;
13708         esac
13709         ;;
13710         *)      case "$usethreads" in
13711                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13712                 esac
13713                 d_getprotobynumber_r=undef
13714                 getprotobynumber_r_proto=0
13715                 ;;
13716         esac
13717         ;;
13718 *)      getprotobynumber_r_proto=0
13719         ;;
13720 esac
13721
13722 : see if getprotoent_r exists
13723 set getprotoent_r d_getprotoent_r
13724 eval $inlibc
13725 case "$d_getprotoent_r" in
13726 "$define")
13727         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13728         case "$d_getprotoent_r_proto:$usethreads" in
13729         ":define")      d_getprotoent_r_proto=define
13730                 set d_getprotoent_r_proto getprotoent_r $hdrs
13731                 eval $hasproto ;;
13732         *)      ;;
13733         esac
13734         case "$d_getprotoent_r_proto" in
13735         define)
13736         case "$getprotoent_r_proto" in
13737         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13738         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13739         esac
13740         case "$getprotoent_r_proto" in
13741         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13742         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13743         esac
13744         case "$getprotoent_r_proto" in
13745         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13746         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13747         esac
13748         case "$getprotoent_r_proto" in
13749         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13750         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13751         esac
13752         case "$getprotoent_r_proto" in
13753         ''|0)   d_getprotoent_r=undef
13754                 getprotoent_r_proto=0
13755                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13756         * )     case "$getprotoent_r_proto" in
13757                 REENTRANT_PROTO*) ;;
13758                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13759                 esac
13760                 echo "Prototype: $try" ;;
13761         esac
13762         ;;
13763         *)      case "$usethreads" in
13764                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13765                 esac
13766                 d_getprotoent_r=undef
13767                 getprotoent_r_proto=0
13768                 ;;
13769         esac
13770         ;;
13771 *)      getprotoent_r_proto=0
13772         ;;
13773 esac
13774
13775 : see if prototypes for various getprotoxxx netdb.h functions are available
13776 echo " "
13777 set d_getprotoprotos getprotoent $i_netdb netdb.h
13778 eval $hasproto
13779
13780 : see if getprpwnam exists
13781 set getprpwnam d_getprpwnam
13782 eval $inlibc
13783
13784 : see if getpwent exists
13785 set getpwent d_getpwent
13786 eval $inlibc
13787
13788 : see if getpwent_r exists
13789 set getpwent_r d_getpwent_r
13790 eval $inlibc
13791 case "$d_getpwent_r" in
13792 "$define")
13793         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13794         case "$d_getpwent_r_proto:$usethreads" in
13795         ":define")      d_getpwent_r_proto=define
13796                 set d_getpwent_r_proto getpwent_r $hdrs
13797                 eval $hasproto ;;
13798         *)      ;;
13799         esac
13800         case "$d_getpwent_r_proto" in
13801         define)
13802         case "$getpwent_r_proto" in
13803         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13804         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13805         esac
13806         case "$getpwent_r_proto" in
13807         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13808         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13809         esac
13810         case "$getpwent_r_proto" in
13811         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13812         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13813         esac
13814         case "$getpwent_r_proto" in
13815         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13816         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13817         esac
13818         case "$getpwent_r_proto" in
13819         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13820         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13821         esac
13822         case "$getpwent_r_proto" in
13823         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13824         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13825         esac
13826         case "$getpwent_r_proto" in
13827         ''|0)   d_getpwent_r=undef
13828                 getpwent_r_proto=0
13829                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13830         * )     case "$getpwent_r_proto" in
13831                 REENTRANT_PROTO*) ;;
13832                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13833                 esac
13834                 echo "Prototype: $try" ;;
13835         esac
13836         ;;
13837         *)      case "$usethreads" in
13838                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13839                 esac
13840                 d_getpwent_r=undef
13841                 getpwent_r_proto=0
13842                 ;;
13843         esac
13844         ;;
13845 *)      getpwent_r_proto=0
13846         ;;
13847 esac
13848
13849 : see if getpwnam_r exists
13850 set getpwnam_r d_getpwnam_r
13851 eval $inlibc
13852 case "$d_getpwnam_r" in
13853 "$define")
13854         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13855         case "$d_getpwnam_r_proto:$usethreads" in
13856         ":define")      d_getpwnam_r_proto=define
13857                 set d_getpwnam_r_proto getpwnam_r $hdrs
13858                 eval $hasproto ;;
13859         *)      ;;
13860         esac
13861         case "$d_getpwnam_r_proto" in
13862         define)
13863         case "$getpwnam_r_proto" in
13864         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13865         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13866         esac
13867         case "$getpwnam_r_proto" in
13868         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13869         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13870         esac
13871         case "$getpwnam_r_proto" in
13872         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13873         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13874         esac
13875         case "$getpwnam_r_proto" in
13876         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13877         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13878         esac
13879         case "$getpwnam_r_proto" in
13880         ''|0)   d_getpwnam_r=undef
13881                 getpwnam_r_proto=0
13882                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13883         * )     case "$getpwnam_r_proto" in
13884                 REENTRANT_PROTO*) ;;
13885                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13886                 esac
13887                 echo "Prototype: $try" ;;
13888         esac
13889         ;;
13890         *)      case "$usethreads" in
13891                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13892                 esac
13893                 d_getpwnam_r=undef
13894                 getpwnam_r_proto=0
13895                 ;;
13896         esac
13897         ;;
13898 *)      getpwnam_r_proto=0
13899         ;;
13900 esac
13901
13902 : see if getpwuid_r exists
13903 set getpwuid_r d_getpwuid_r
13904 eval $inlibc
13905 case "$d_getpwuid_r" in
13906 "$define")
13907         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13908         case "$d_getpwuid_r_proto:$usethreads" in
13909         ":define")      d_getpwuid_r_proto=define
13910                 set d_getpwuid_r_proto getpwuid_r $hdrs
13911                 eval $hasproto ;;
13912         *)      ;;
13913         esac
13914         case "$d_getpwuid_r_proto" in
13915         define)
13916         case "$getpwuid_r_proto" in
13917         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13918         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13919         esac
13920         case "$getpwuid_r_proto" in
13921         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13922         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13923         esac
13924         case "$getpwuid_r_proto" in
13925         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13926         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13927         esac
13928         case "$getpwuid_r_proto" in
13929         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13930         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13931         esac
13932         case "$getpwuid_r_proto" in
13933         ''|0)   d_getpwuid_r=undef
13934                 getpwuid_r_proto=0
13935                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13936         * )     case "$getpwuid_r_proto" in
13937                 REENTRANT_PROTO*) ;;
13938                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13939                 esac
13940                 echo "Prototype: $try" ;;
13941         esac
13942         ;;
13943         *)      case "$usethreads" in
13944                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13945                 esac
13946                 d_getpwuid_r=undef
13947                 getpwuid_r_proto=0
13948                 ;;
13949         esac
13950         ;;
13951 *)      getpwuid_r_proto=0
13952         ;;
13953 esac
13954
13955
13956 : see if getservbyname exists
13957 set getservbyname d_getsbyname
13958 eval $inlibc
13959
13960 : see if getservbyport exists
13961 set getservbyport d_getsbyport
13962 eval $inlibc
13963
13964 : see if getservent exists
13965 set getservent d_getsent
13966 eval $inlibc
13967
13968 : see if getservbyname_r exists
13969 set getservbyname_r d_getservbyname_r
13970 eval $inlibc
13971 case "$d_getservbyname_r" in
13972 "$define")
13973         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13974         case "$d_getservbyname_r_proto:$usethreads" in
13975         ":define")      d_getservbyname_r_proto=define
13976                 set d_getservbyname_r_proto getservbyname_r $hdrs
13977                 eval $hasproto ;;
13978         *)      ;;
13979         esac
13980         case "$d_getservbyname_r_proto" in
13981         define)
13982         case "$getservbyname_r_proto" in
13983         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13984         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13985         esac
13986         case "$getservbyname_r_proto" in
13987         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13988         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13989         esac
13990         case "$getservbyname_r_proto" in
13991         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13992         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13993         esac
13994         case "$getservbyname_r_proto" in
13995         ''|0)   d_getservbyname_r=undef
13996                 getservbyname_r_proto=0
13997                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13998         * )     case "$getservbyname_r_proto" in
13999                 REENTRANT_PROTO*) ;;
14000                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14001                 esac
14002                 echo "Prototype: $try" ;;
14003         esac
14004         ;;
14005         *)      case "$usethreads" in
14006                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14007                 esac
14008                 d_getservbyname_r=undef
14009                 getservbyname_r_proto=0
14010                 ;;
14011         esac
14012         ;;
14013 *)      getservbyname_r_proto=0
14014         ;;
14015 esac
14016
14017 : see if getservbyport_r exists
14018 set getservbyport_r d_getservbyport_r
14019 eval $inlibc
14020 case "$d_getservbyport_r" in
14021 "$define")
14022         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14023         case "$d_getservbyport_r_proto:$usethreads" in
14024         ":define")      d_getservbyport_r_proto=define
14025                 set d_getservbyport_r_proto getservbyport_r $hdrs
14026                 eval $hasproto ;;
14027         *)      ;;
14028         esac
14029         case "$d_getservbyport_r_proto" in
14030         define)
14031         case "$getservbyport_r_proto" in
14032         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14033         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14034         esac
14035         case "$getservbyport_r_proto" in
14036         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14037         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14038         esac
14039         case "$getservbyport_r_proto" in
14040         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14041         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14042         esac
14043         case "$getservbyport_r_proto" in
14044         ''|0)   d_getservbyport_r=undef
14045                 getservbyport_r_proto=0
14046                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14047         * )     case "$getservbyport_r_proto" in
14048                 REENTRANT_PROTO*) ;;
14049                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14050                 esac
14051                 echo "Prototype: $try" ;;
14052         esac
14053         ;;
14054         *)      case "$usethreads" in
14055                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14056                 esac
14057                 d_getservbyport_r=undef
14058                 getservbyport_r_proto=0
14059                 ;;
14060         esac
14061         ;;
14062 *)      getservbyport_r_proto=0
14063         ;;
14064 esac
14065
14066 : see if getservent_r exists
14067 set getservent_r d_getservent_r
14068 eval $inlibc
14069 case "$d_getservent_r" in
14070 "$define")
14071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14072         case "$d_getservent_r_proto:$usethreads" in
14073         ":define")      d_getservent_r_proto=define
14074                 set d_getservent_r_proto getservent_r $hdrs
14075                 eval $hasproto ;;
14076         *)      ;;
14077         esac
14078         case "$d_getservent_r_proto" in
14079         define)
14080         case "$getservent_r_proto" in
14081         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14082         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14083         esac
14084         case "$getservent_r_proto" in
14085         ''|0) try='int getservent_r(struct servent*, char*, int);'
14086         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14087         esac
14088         case "$getservent_r_proto" in
14089         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14090         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14091         esac
14092         case "$getservent_r_proto" in
14093         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14094         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14095         esac
14096         case "$getservent_r_proto" in
14097         ''|0)   d_getservent_r=undef
14098                 getservent_r_proto=0
14099                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14100         * )     case "$getservent_r_proto" in
14101                 REENTRANT_PROTO*) ;;
14102                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14103                 esac
14104                 echo "Prototype: $try" ;;
14105         esac
14106         ;;
14107         *)      case "$usethreads" in
14108                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14109                 esac
14110                 d_getservent_r=undef
14111                 getservent_r_proto=0
14112                 ;;
14113         esac
14114         ;;
14115 *)      getservent_r_proto=0
14116         ;;
14117 esac
14118
14119 : see if prototypes for various getservxxx netdb.h functions are available
14120 echo " "
14121 set d_getservprotos getservent $i_netdb netdb.h
14122 eval $hasproto
14123
14124 : see if getspnam exists
14125 set getspnam d_getspnam
14126 eval $inlibc
14127
14128 : see if this is a shadow.h system
14129 set shadow.h i_shadow
14130 eval $inhdr
14131
14132 : see if getspnam_r exists
14133 set getspnam_r d_getspnam_r
14134 eval $inlibc
14135 case "$d_getspnam_r" in
14136 "$define")
14137         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14138         case "$d_getspnam_r_proto:$usethreads" in
14139         ":define")      d_getspnam_r_proto=define
14140                 set d_getspnam_r_proto getspnam_r $hdrs
14141                 eval $hasproto ;;
14142         *)      ;;
14143         esac
14144         case "$d_getspnam_r_proto" in
14145         define)
14146         case "$getspnam_r_proto" in
14147         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14148         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14149         esac
14150         case "$getspnam_r_proto" in
14151         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14152         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14153         esac
14154         case "$getspnam_r_proto" in
14155         ''|0)   d_getspnam_r=undef
14156                 getspnam_r_proto=0
14157                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14158         * )     case "$getspnam_r_proto" in
14159                 REENTRANT_PROTO*) ;;
14160                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14161                 esac
14162                 echo "Prototype: $try" ;;
14163         esac
14164         ;;
14165         *)      case "$usethreads" in
14166                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14167                 esac
14168                 d_getspnam_r=undef
14169                 getspnam_r_proto=0
14170                 ;;
14171         esac
14172         ;;
14173 *)      getspnam_r_proto=0
14174         ;;
14175 esac
14176
14177 : see if gettimeofday or ftime exists
14178 set gettimeofday d_gettimeod
14179 eval $inlibc
14180 case "$d_gettimeod" in
14181 "$undef")
14182         set ftime d_ftime 
14183         eval $inlibc
14184         ;;
14185 *)
14186         val="$undef"; set d_ftime; eval $setvar
14187         ;;
14188 esac
14189 case "$d_gettimeod$d_ftime" in
14190 "$undef$undef")
14191         echo " "
14192         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14193         ;;
14194 esac
14195
14196 : see if gmtime_r exists
14197 set gmtime_r d_gmtime_r
14198 eval $inlibc
14199 case "$d_gmtime_r" in
14200 "$define")
14201         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14202         case "$d_gmtime_r_proto:$usethreads" in
14203         ":define")      d_gmtime_r_proto=define
14204                 set d_gmtime_r_proto gmtime_r $hdrs
14205                 eval $hasproto ;;
14206         *)      ;;
14207         esac
14208         case "$d_gmtime_r_proto" in
14209         define)
14210         case "$gmtime_r_proto" in
14211         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14212         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14213         esac
14214         case "$gmtime_r_proto" in
14215         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14216         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14217         esac
14218         case "$gmtime_r_proto" in
14219         ''|0)   d_gmtime_r=undef
14220                 gmtime_r_proto=0
14221                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14222         * )     case "$gmtime_r_proto" in
14223                 REENTRANT_PROTO*) ;;
14224                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14225                 esac
14226                 echo "Prototype: $try" ;;
14227         esac
14228         ;;
14229         *)      case "$usethreads" in
14230                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14231                 esac
14232                 d_gmtime_r=undef
14233                 gmtime_r_proto=0
14234                 ;;
14235         esac
14236         ;;
14237 *)      gmtime_r_proto=0
14238         ;;
14239 esac
14240
14241 : see if hasmntopt exists
14242 set hasmntopt d_hasmntopt
14243 eval $inlibc
14244
14245 : see if this is a netinet/in.h or sys/in.h system
14246 set netinet/in.h i_niin sys/in.h i_sysin
14247 eval $inhdr
14248
14249 : see if arpa/inet.h has to be included
14250 set arpa/inet.h i_arpainet
14251 eval $inhdr
14252
14253 : see if htonl --and friends-- exists
14254 val=''
14255 set htonl val
14256 eval $inlibc
14257
14258 : Maybe they are macros.
14259 case "$val" in
14260 $undef)
14261         $cat >htonl.c <<EOM
14262 #include <stdio.h>
14263 #include <sys/types.h>
14264 #$i_niin I_NETINET_IN
14265 #$i_sysin I_SYS_IN
14266 #$i_arpainet I_ARPA_INET
14267 #ifdef I_NETINET_IN
14268 #include <netinet/in.h>
14269 #endif
14270 #ifdef I_SYS_IN
14271 #include <sys/in.h>
14272 #endif
14273 #ifdef I_ARPA_INET
14274 #include <arpa/inet.h>
14275 #endif
14276 #ifdef htonl
14277 printf("Defined as a macro.");
14278 #endif
14279 EOM
14280         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14281         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14282                 val="$define"
14283                 echo "But it seems to be defined as a macro." >&4
14284         fi
14285         $rm -f htonl.?
14286         ;;
14287 esac
14288 set d_htonl
14289 eval $setvar
14290
14291 : see if ilogbl exists
14292 set ilogbl d_ilogbl
14293 eval $inlibc
14294
14295 : index or strchr
14296 echo " "
14297 if set index val -f; eval $csym; $val; then
14298         if set strchr val -f d_strchr; eval $csym; $val; then
14299                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14300                         val="$define"
14301                         vali="$undef"
14302                         echo "strchr() found." >&4
14303                 else
14304                         val="$undef"
14305                         vali="$define"
14306                         echo "index() found." >&4
14307                 fi
14308         else
14309                 val="$undef"
14310                 vali="$define"
14311                 echo "index() found." >&4
14312         fi
14313 else
14314         if set strchr val -f d_strchr; eval $csym; $val; then
14315                 val="$define"
14316                 vali="$undef"
14317                 echo "strchr() found." >&4
14318         else
14319                 echo "No index() or strchr() found!" >&4
14320                 val="$undef"
14321                 vali="$undef"
14322         fi
14323 fi
14324 set d_strchr; eval $setvar
14325 val="$vali"
14326 set d_index; eval $setvar
14327
14328 : check whether inet_aton exists
14329 set inet_aton d_inetaton
14330 eval $inlibc
14331
14332 : Look for isascii
14333 echo " "
14334 $cat >isascii.c <<EOCP
14335 #include <stdio.h>
14336 #include <ctype.h>
14337 #$i_stdlib I_STDLIB
14338 #ifdef I_STDLIB
14339 #include <stdlib.h>
14340 #endif
14341 int main() {
14342         int c = 'A';
14343         if (isascii(c))
14344                 exit(0);
14345         else
14346                 exit(1);
14347 }
14348 EOCP
14349 set isascii
14350 if eval $compile; then
14351         echo "isascii() found." >&4
14352         val="$define"
14353 else
14354         echo "isascii() NOT found." >&4
14355         val="$undef"
14356 fi
14357 set d_isascii
14358 eval $setvar
14359 $rm -f isascii*
14360
14361 : see if isfinite exists
14362 set isfinite d_isfinite
14363 eval $inlibc
14364
14365 : see if isinf exists
14366 set isinf d_isinf
14367 eval $inlibc
14368
14369 : see if isnan exists
14370 set isnan d_isnan
14371 eval $inlibc
14372
14373 : see if isnanl exists
14374 set isnanl d_isnanl
14375 eval $inlibc
14376
14377 : see if killpg exists
14378 set killpg d_killpg
14379 eval $inlibc
14380
14381 : see if lchown exists
14382 echo " "
14383 $cat > try.c <<'EOCP'
14384 /* System header to define __stub macros and hopefully few prototypes,
14385     which can conflict with char lchown(); below.  */
14386 #include <assert.h>
14387 /* Override any gcc2 internal prototype to avoid an error.  */
14388 /* We use char because int might match the return type of a gcc2
14389    builtin and then its argument prototype would still apply.  */
14390 char lchown();
14391 int main() {
14392     /*  The GNU C library defines this for functions which it implements
14393         to always fail with ENOSYS.  Some functions are actually named
14394         something starting with __ and the normal name is an alias.  */
14395 #if defined (__stub_lchown) || defined (__stub___lchown)
14396 choke me
14397 #else
14398 lchown();
14399 #endif
14400 ; return 0; }
14401 EOCP
14402 set try
14403 if eval $compile; then
14404     $echo "lchown() found." >&4
14405     val="$define"
14406 else
14407     $echo "lchown() NOT found." >&4
14408     val="$undef"
14409 fi
14410 set d_lchown
14411 eval $setvar
14412
14413 : See if number of significant digits in a double precision number is known
14414 echo " "
14415 $cat >ldbl_dig.c <<EOM
14416 #$i_limits I_LIMITS
14417 #$i_float I_FLOAT
14418 #ifdef I_LIMITS
14419 #include <limits.h>
14420 #endif
14421 #ifdef I_FLOAT
14422 #include <float.h>
14423 #endif
14424 #ifdef LDBL_DIG
14425 printf("Contains LDBL_DIG");
14426 #endif
14427 EOM
14428 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14429 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14430         echo "LDBL_DIG found." >&4
14431         val="$define"
14432 else
14433         echo "LDBL_DIG NOT found." >&4
14434         val="$undef"
14435 fi
14436 $rm -f ldbl_dig.?
14437 set d_ldbl_dig
14438 eval $setvar
14439
14440 : see if this is a math.h system
14441 set math.h i_math
14442 eval $inhdr
14443
14444 d_libm_lib_version="$undef"
14445 case $i_math in
14446     $define)
14447         : check to see if math.h defines _LIB_VERSION
14448         echo " "
14449         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14450         $cat >try.c <<EOCP
14451 #include <unistd.h>
14452 #include <math.h>
14453 int main (int argc, char *argv[])
14454 {
14455     printf ("%d\n", _LIB_VERSION);
14456     return (0);
14457     } /* main */
14458 EOCP
14459         set try
14460         if eval $compile; then
14461             foo=`$run ./try`
14462             echo "Yes, it does ($foo)" >&4
14463             d_libm_lib_version="$define"
14464         else
14465             echo "No, it does not (probably harmless)\n" >&4
14466             fi
14467         $rm -f try.* try core core.try.*
14468         ;;
14469
14470     esac
14471
14472 : see if link exists
14473 set link d_link
14474 eval $inlibc
14475
14476 : see if localtime_r exists
14477 set localtime_r d_localtime_r
14478 eval $inlibc
14479 case "$d_localtime_r" in
14480 "$define")
14481         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14482         case "$d_localtime_r_proto:$usethreads" in
14483         ":define")      d_localtime_r_proto=define
14484                 set d_localtime_r_proto localtime_r $hdrs
14485                 eval $hasproto ;;
14486         *)      ;;
14487         esac
14488         case "$d_localtime_r_proto" in
14489         define)
14490         case "$localtime_r_proto" in
14491         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14492         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14493         esac
14494         case "$localtime_r_proto" in
14495         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14496         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14497         esac
14498         case "$localtime_r_proto" in
14499         ''|0)   d_localtime_r=undef
14500                 localtime_r_proto=0
14501                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14502         * )     case "$localtime_r_proto" in
14503                 REENTRANT_PROTO*) ;;
14504                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14505                 esac
14506                 echo "Prototype: $try" ;;
14507         esac
14508         ;;
14509         *)      case "$usethreads" in
14510                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14511                 esac
14512                 d_localtime_r=undef
14513                 localtime_r_proto=0
14514                 ;;
14515         esac
14516         ;;
14517 *)      localtime_r_proto=0
14518         ;;
14519 esac
14520
14521 : see if localeconv exists
14522 set localeconv d_locconv
14523 eval $inlibc
14524
14525 : see if lockf exists
14526 set lockf d_lockf
14527 eval $inlibc
14528
14529 : see if prototype for lseek is available
14530 echo " "
14531 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14532 eval $hasproto
14533
14534 : see if lstat exists
14535 set lstat d_lstat
14536 eval $inlibc
14537
14538 : see if madvise exists
14539 set madvise d_madvise
14540 eval $inlibc
14541
14542 : see if malloc_size exists
14543 set malloc_size d_malloc_size
14544 eval $inlibc
14545
14546 : see if malloc_size_good exists
14547 set malloc_good_size d_malloc_good_size
14548 eval $inlibc
14549
14550 : see if mblen exists
14551 set mblen d_mblen
14552 eval $inlibc
14553
14554 : see if mbstowcs exists
14555 set mbstowcs d_mbstowcs
14556 eval $inlibc
14557
14558 : see if mbtowc exists
14559 set mbtowc d_mbtowc
14560 eval $inlibc
14561
14562 : see if memchr exists
14563 set memchr d_memchr
14564 eval $inlibc
14565
14566 : see if memcmp exists
14567 set memcmp d_memcmp
14568 eval $inlibc
14569
14570 : see if memcpy exists
14571 set memcpy d_memcpy
14572 eval $inlibc
14573
14574 : see if memmove exists
14575 set memmove d_memmove
14576 eval $inlibc
14577
14578 : see if memset exists
14579 set memset d_memset
14580 eval $inlibc
14581
14582 : see if mkdir exists
14583 set mkdir d_mkdir
14584 eval $inlibc
14585
14586 : see if mkdtemp exists
14587 set mkdtemp d_mkdtemp
14588 eval $inlibc
14589
14590 : see if mkfifo exists
14591 set mkfifo d_mkfifo
14592 eval $inlibc
14593
14594 : see if mkstemp exists
14595 set mkstemp d_mkstemp
14596 eval $inlibc
14597
14598 : see if mkstemps exists
14599 set mkstemps d_mkstemps
14600 eval $inlibc
14601
14602 : see if mktime exists
14603 set mktime d_mktime
14604 eval $inlibc
14605
14606 : see if this is a sys/mman.h system
14607 set sys/mman.h i_sysmman
14608 eval $inhdr
14609
14610 : see if mmap exists
14611 set mmap d_mmap
14612 eval $inlibc
14613 : see what shmat returns
14614 : default to something harmless
14615 mmaptype='void *'
14616 case "$i_sysmman$d_mmap" in
14617 "$define$define")
14618         $cat >mmap.c <<'END'
14619 #include <sys/mman.h>
14620 void *mmap();
14621 END
14622         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14623                 mmaptype='void *'
14624         else
14625                 mmaptype='caddr_t'
14626         fi
14627         echo "and it returns ($mmaptype)." >&4
14628         ;;
14629 esac
14630
14631
14632
14633 : see if sqrtl exists
14634 set sqrtl d_sqrtl
14635 eval $inlibc
14636
14637 : see if scalbnl exists
14638 set scalbnl d_scalbnl
14639 eval $inlibc
14640
14641 : see if modfl exists
14642 set modfl d_modfl
14643 eval $inlibc
14644
14645 : see if prototype for modfl is available
14646 echo " "
14647 set d_modflproto modfl $i_math math.h
14648 eval $hasproto
14649
14650 d_modfl_pow32_bug="$undef"
14651
14652 case "$d_longdbl$d_modfl" in
14653 $define$define)
14654         $cat <<EOM
14655 Checking to see whether your modfl() is okay for large values...
14656 EOM
14657 $cat >try.c <<EOCP
14658 #include <math.h> 
14659 #include <stdio.h>
14660 EOCP
14661 if $test "X$d_modflproto" != "X$define"; then
14662         $cat >>try.c <<EOCP
14663 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14664 long double modfl (long double, long double *);
14665 EOCP
14666 fi
14667 $cat >>try.c <<EOCP
14668 int main() {
14669     long double nv = 4294967303.15;
14670     long double v, w;
14671     v = modfl(nv, &w);         
14672 #ifdef __GLIBC__
14673     printf("glibc");
14674 #endif
14675     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14676     return 0;
14677 }
14678 EOCP
14679         case "$osname:$gccversion" in
14680         aix:)   saveccflags="$ccflags"
14681                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14682         esac
14683         set try
14684         if eval $compile; then
14685                 foo=`$run ./try`
14686                 case "$foo" in
14687                 *" 4294967303.150000 1.150000 4294967302.000000")
14688                         echo >&4 "Your modfl() is broken for large values."
14689                         d_modfl_pow32_bug="$define"
14690                         case "$foo" in
14691                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14692                         ;;
14693                         esac
14694                         ;;
14695                 *" 4294967303.150000 0.150000 4294967303.000000")
14696                         echo >&4 "Your modfl() seems okay for large values."
14697                         ;;
14698                 *)      echo >&4 "I don't understand your modfl() at all."
14699                         d_modfl="$undef"
14700                         ;;
14701                 esac
14702                 $rm -f try.* try core core.try.*
14703         else
14704                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14705                 d_modfl="$undef"
14706         fi
14707         case "$osname:$gccversion" in
14708         aix:)   ccflags="$saveccflags" ;; # restore
14709         esac
14710         ;;
14711 esac
14712
14713 if $test "$uselongdouble" = "$define"; then
14714     message=""
14715     if $test "$d_sqrtl" != "$define"; then
14716         message="$message sqrtl"
14717     fi
14718     if $test "$d_modfl" != "$define"; then
14719         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14720             echo "You have both aintl and copysignl, so I can emulate modfl."
14721         else
14722             message="$message modfl"
14723         fi
14724     fi
14725     if $test "$d_frexpl" != "$define"; then
14726         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14727             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14728         else
14729             message="$message frexpl"
14730         fi
14731     fi
14732
14733     if $test "$message" != ""; then
14734         $cat <<EOM >&4
14735
14736 *** You requested the use of long doubles but you do not seem to have
14737 *** the following mathematical functions needed for long double support:
14738 ***    $message
14739 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14740 *** Cannot continue, aborting.
14741
14742 EOM
14743
14744         exit 1
14745     fi
14746 fi
14747
14748 : see if mprotect exists
14749 set mprotect d_mprotect
14750 eval $inlibc
14751
14752 : see if msgctl exists
14753 set msgctl d_msgctl
14754 eval $inlibc
14755
14756 : see if msgget exists
14757 set msgget d_msgget
14758 eval $inlibc
14759
14760 : see if msgsnd exists
14761 set msgsnd d_msgsnd
14762 eval $inlibc
14763
14764 : see if msgrcv exists
14765 set msgrcv d_msgrcv
14766 eval $inlibc
14767
14768 : see how much of the 'msg*(2)' library is present.
14769 h_msg=true
14770 echo " "
14771 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14772 *"$undef"*) h_msg=false;;
14773 esac
14774 case "$osname" in
14775 freebsd)
14776     case "`ipcs 2>&1`" in
14777     "SVID messages"*"not configured"*)
14778         echo "Your $osname does not have the msg*(2) configured." >&4
14779         h_msg=false
14780         val="$undef"
14781         set msgctl d_msgctl
14782         eval $setvar
14783         set msgget d_msgget
14784         eval $setvar
14785         set msgsnd d_msgsnd
14786         eval $setvar
14787         set msgrcv d_msgrcv
14788         eval $setvar
14789         ;;
14790     esac
14791     ;;
14792 esac
14793 : we could also check for sys/ipc.h ...
14794 if $h_msg && $test `./findhdr sys/msg.h`; then
14795         echo "You have the full msg*(2) library." >&4
14796         val="$define"
14797 else
14798         echo "You don't have the full msg*(2) library." >&4
14799         val="$undef"
14800 fi
14801 set d_msg
14802 eval $setvar
14803
14804
14805 echo " "
14806 echo "Checking to see if your system supports struct msghdr..." >&4
14807 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14808 eval $hasstruct
14809 case "$d_msghdr_s" in
14810 "$define")      echo "Yes, it does."   ;;
14811 *)              echo "No, it doesn't." ;;
14812 esac
14813
14814
14815 : see if msync exists
14816 set msync d_msync
14817 eval $inlibc
14818
14819 : see if munmap exists
14820 set munmap d_munmap
14821 eval $inlibc
14822
14823 : see if nice exists
14824 set nice d_nice
14825 eval $inlibc
14826
14827 : see if this is a langinfo.h system
14828 set langinfo.h i_langinfo
14829 eval $inhdr
14830
14831 : see if nl_langinfo exists
14832 set nl_langinfo d_nl_langinfo
14833 eval $inlibc
14834
14835 : check for length of character
14836 echo " "
14837 case "$charsize" in
14838 '')
14839         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14840         $cat >try.c <<EOCP
14841 #include <stdio.h>
14842 #$i_stdlib I_STDLIB
14843 #ifdef I_STDLIB
14844 #include <stdlib.h>
14845 #endif
14846 int main()
14847 {
14848     printf("%d\n", (int)sizeof(char));
14849     exit(0);
14850 }
14851 EOCP
14852         set try
14853         if eval $compile_ok; then
14854                 dflt=`$run ./try`
14855         else
14856                 dflt='1'
14857                 echo "(I can't seem to compile the test program.  Guessing...)"
14858         fi
14859         ;;
14860 *)
14861         dflt="$charsize"
14862         ;;
14863 esac
14864 rp="What is the size of a character (in bytes)?"
14865 . ./myread
14866 charsize="$ans"
14867 $rm -f try.c try
14868
14869 : check for volatile keyword
14870 echo " "
14871 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14872 $cat >try.c <<'EOCP'
14873 int main()
14874 {
14875         typedef struct _goo_struct goo_struct;
14876         goo_struct * volatile goo = ((goo_struct *)0);
14877         struct _goo_struct {
14878                 long long_int;
14879                 int reg_int;
14880                 char char_var;
14881         };
14882         typedef unsigned short foo_t;
14883         char *volatile foo;
14884         volatile int bar;
14885         volatile foo_t blech;
14886         foo = foo;
14887 }
14888 EOCP
14889 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14890         val="$define"
14891         echo "Yup, it does."
14892 else
14893         val="$undef"
14894         echo "Nope, it doesn't."
14895 fi
14896 set d_volatile
14897 eval $setvar
14898 $rm -f try.*
14899
14900
14901 echo " "
14902 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14903
14904 case "$use64bitint:$d_quad:$quadtype" in
14905 define:define:?*)
14906         ivtype="$quadtype"
14907         uvtype="$uquadtype"
14908         ivsize=8
14909         uvsize=8
14910         ;;
14911 *)      ivtype="long"
14912         uvtype="unsigned long"
14913         ivsize=$longsize
14914         uvsize=$longsize
14915         ;;
14916 esac
14917
14918 case "$uselongdouble:$d_longdbl" in
14919 define:define)
14920         nvtype="long double"
14921         nvsize=$longdblsize
14922         ;;
14923 *)      nvtype=double
14924         nvsize=$doublesize
14925         ;;
14926 esac
14927
14928 $echo "(IV will be "$ivtype", $ivsize bytes)"
14929 $echo "(UV will be "$uvtype", $uvsize bytes)"
14930 $echo "(NV will be "$nvtype", $nvsize bytes)"
14931
14932 $cat >try.c <<EOCP
14933 #$i_inttypes I_INTTYPES
14934 #ifdef I_INTTYPES
14935 #include <inttypes.h>
14936 #endif
14937 #include <stdio.h>
14938 int main() {
14939 #ifdef INT8
14940    int8_t i =  INT8_MAX;
14941   uint8_t u = UINT8_MAX;
14942   printf("int8_t\n");
14943 #endif
14944 #ifdef INT16
14945    int16_t i =  INT16_MAX;
14946   uint16_t i = UINT16_MAX;
14947   printf("int16_t\n");
14948 #endif
14949 #ifdef INT32
14950    int32_t i =  INT32_MAX;
14951   uint32_t u = UINT32_MAX;
14952   printf("int32_t\n");
14953 #endif
14954 }
14955 EOCP
14956
14957 case "$i8type" in
14958 '')     case "$charsize" in
14959         1)      i8type=char
14960                 u8type="unsigned char"
14961                 i8size=$charsize
14962                 u8size=$charsize
14963                 ;;
14964         esac
14965         ;;
14966 esac
14967 case "$i8type" in
14968 '')     set try -DINT8
14969         if eval $compile; then
14970                 case "`$run ./try`" in
14971                 int8_t) i8type=int8_t
14972                         u8type=uint8_t
14973                         i8size=1
14974                         u8size=1
14975                         ;;
14976                 esac
14977         fi
14978         ;;
14979 esac
14980 case "$i8type" in
14981 '')     if $test $charsize -ge 1; then
14982                 i8type=char
14983                 u8type="unsigned char"
14984                 i8size=$charsize
14985                 u8size=$charsize
14986         fi
14987         ;;
14988 esac
14989
14990 case "$i16type" in
14991 '')     case "$shortsize" in
14992         2)      i16type=short
14993                 u16type="unsigned short"
14994                 i16size=$shortsize
14995                 u16size=$shortsize
14996                 ;;
14997         esac
14998         ;;
14999 esac
15000 case "$i16type" in
15001 '')     set try -DINT16
15002         if eval $compile; then
15003                 case "`$run ./try`" in
15004                 int16_t)
15005                         i16type=int16_t
15006                         u16type=uint16_t
15007                         i16size=2
15008                         u16size=2
15009                         ;;
15010                 esac
15011         fi
15012         ;;
15013 esac
15014 case "$i16type" in
15015 '')     if $test $shortsize -ge 2; then
15016                 i16type=short
15017                 u16type="unsigned short"
15018                 i16size=$shortsize
15019                 u16size=$shortsize
15020         fi
15021         ;;
15022 esac
15023
15024 case "$i32type" in
15025 '')     case "$longsize" in
15026         4)      i32type=long
15027                 u32type="unsigned long"
15028                 i32size=$longsize
15029                 u32size=$longsize
15030                 ;;
15031         *)      case "$intsize" in
15032                 4)      i32type=int
15033                         u32type="unsigned int"
15034                         i32size=$intsize
15035                         u32size=$intsize
15036                         ;;
15037                 esac
15038                 ;;
15039         esac
15040         ;;
15041 esac
15042 case "$i32type" in
15043 '')     set try -DINT32
15044         if eval $compile; then
15045                 case "`$run ./try`" in
15046                 int32_t)
15047                         i32type=int32_t
15048                         u32type=uint32_t
15049                         i32size=4
15050                         u32size=4
15051                         ;;
15052                 esac
15053         fi
15054         ;;
15055 esac
15056 case "$i32type" in
15057 '')     if $test $intsize -ge 4; then
15058                 i32type=int
15059                 u32type="unsigned int"
15060                 i32size=$intsize
15061                 u32size=$intsize
15062         fi
15063         ;;
15064 esac
15065
15066 case "$i64type" in
15067 '')     case "$d_quad:$quadtype" in
15068         define:?*)
15069                 i64type="$quadtype"
15070                 u64type="$uquadtype"
15071                 i64size=8
15072                 u64size=8
15073                 ;;
15074         esac
15075         ;;
15076 esac
15077
15078 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15079 : volatile so that the compiler has to store it out to memory.
15080 if test X"$d_volatile" = X"$define"; then
15081         volatile=volatile
15082 fi
15083 $cat <<EOP >try.c
15084 #include <stdio.h>
15085 #$i_stdlib I_STDLIB
15086 #ifdef I_STDLIB
15087 #include <stdlib.h>
15088 #endif
15089 #include <sys/types.h>
15090 #include <signal.h>
15091 #ifdef SIGFPE
15092 $volatile int bletched = 0;
15093 $signal_t blech(int s) { bletched = 1; }
15094 #endif
15095 int main() {
15096     $uvtype u = 0;
15097     $nvtype d;
15098     int     n = 8 * $uvsize;
15099     int     i;
15100 #ifdef SIGFPE
15101     signal(SIGFPE, blech);
15102 #endif
15103
15104     for (i = 0; i < n; i++) {
15105       u = u << 1 | ($uvtype)1;
15106       d = ($nvtype)u;
15107       if (($uvtype)d != u)
15108         break;
15109       if (d <= 0)
15110         break;
15111       d = ($nvtype)(u - 1);
15112       if (($uvtype)d != (u - 1))
15113         break;
15114 #ifdef SIGFPE
15115       if (bletched) {
15116         break;
15117 #endif
15118       } 
15119     }
15120     printf("%d\n", ((i == n) ? -n : i));
15121     exit(0);
15122 }
15123 EOP
15124 set try
15125
15126 d_nv_preserves_uv="$undef"
15127 if eval $compile; then
15128         nv_preserves_uv_bits="`$run ./try`"
15129 fi
15130 case "$nv_preserves_uv_bits" in
15131 \-[1-9]*)       
15132         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15133         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15134         d_nv_preserves_uv="$define"
15135         ;;
15136 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15137         d_nv_preserves_uv="$undef" ;;
15138 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15139         nv_preserves_uv_bits="$undef" ;;
15140 esac
15141
15142 $rm -f try.* try
15143
15144 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15145 : volatile so that the compiler has to store it out to memory.
15146 if test X"$d_volatile" = X"$define"; then
15147         volatile=volatile
15148 fi
15149 $cat <<EOP >try.c
15150 #include <stdio.h>
15151 #$i_stdlib I_STDLIB
15152 #ifdef I_STDLIB
15153 #include <stdlib.h>
15154 #endif
15155 #$i_string I_STRING
15156 #ifdef I_STRING
15157 #  include <string.h>
15158 #else
15159 #  include <strings.h>
15160 #endif
15161 #include <sys/types.h>
15162 #include <signal.h>
15163 #ifdef SIGFPE
15164 $volatile int bletched = 0;
15165 $signal_t blech(int s) { bletched = 1; }
15166 #endif
15167
15168 int checkit($nvtype d, char *where) {
15169     unsigned char *p = (char *)&d;
15170     unsigned char *end = p + sizeof(d);
15171     int fail = 0;
15172
15173     while (p < end)
15174         fail += *p++;
15175
15176     if (!fail)
15177         return 0;
15178
15179     p = (char *)&d;
15180     printf("No - %s: 0x", where);
15181     while (p < end)
15182         printf ("%02X", *p++);
15183     printf("\n");
15184     return 1;
15185 }
15186
15187 int main(int argc, char **argv) {
15188     $nvtype d = 0.0;
15189     int fail = 0;
15190     fail += checkit(d, "0.0");
15191
15192     /* The compiler shouldn't be assuming that bletched is 0  */
15193     d = bletched;
15194
15195     fail += checkit(d, "bleched");
15196
15197 #ifdef SIGFPE
15198     signal(SIGFPE, blech);
15199 #endif
15200
15201     /* Paranoia - the compiler should have no way of knowing that ANSI says
15202        that argv[argc] will always be NULL.  Actually, if it did assume this it
15203        would be buggy, as this is C and main() can be called from elsewhere in
15204        the program.  */
15205     d = argv[argc] ? 1 : 0;
15206
15207     if (d) {
15208         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15209     }
15210
15211     fail += checkit(d, "ternary");
15212
15213     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15214
15215     if (d != 0.0) {
15216         printf("No - memset doesn't give 0.0\n");
15217         /* This might just blow up:  */
15218         printf("(gives %g)\n", d);
15219         return 1;
15220     }
15221     
15222 #ifdef SIGFPE
15223     if (bletched) {
15224         printf("No - something bleched\n");
15225         return 1;
15226     }
15227 #endif
15228     if (fail) {
15229       printf("No - %d fail(s)\n", fail);
15230       return 1;
15231     }
15232     printf("Yes\n");
15233     return 0;
15234 }
15235 EOP
15236 set try
15237
15238 d_nv_zero_is_allbits_zero="$undef"
15239 if eval $compile; then
15240     xxx="`$run ./try`"
15241     case "$?" in
15242         0)
15243             case "$xxx" in
15244                 Yes)  cat >&4 <<EOM
15245 0.0 is represented as all bits zero in memory
15246 EOM
15247                     d_nv_zero_is_allbits_zero="$define"
15248                     ;;
15249                 *)  cat >&4 <<EOM
15250 0.0 is not represented as all bits zero in memory
15251 EOM
15252                     d_nv_zero_is_allbits_zero="$undef"
15253                     ;;
15254             esac
15255             ;;
15256         *)  cat >&4 <<EOM
15257 0.0 is not represented as all bits zero in memory
15258 EOM
15259             d_nv_zero_is_allbits_zero="$undef"
15260             ;;
15261     esac
15262 fi
15263
15264 $rm -f try.* try
15265
15266
15267 : check for off64_t
15268 echo " "
15269 echo "Checking to see if you have off64_t..." >&4
15270 $cat >try.c <<EOCP
15271 #include <sys/types.h>
15272 #include <unistd.h>
15273 int main() { off64_t x = 7; }
15274 EOCP
15275 set try
15276 if eval $compile; then
15277         val="$define"
15278         echo "You have off64_t."
15279 else
15280         val="$undef"
15281         echo "You do not have off64_t."
15282         case "$lseeksize" in
15283         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15284         esac
15285 fi
15286 $rm -f try.* try
15287 set d_off64_t
15288 eval $setvar
15289
15290 : how to create joinable pthreads
15291 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15292         echo " "
15293         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15294         $cat >try.c <<'EOCP'
15295 #include <pthread.h>
15296 int main() {
15297     int detachstate = JOINABLE;
15298 }
15299 EOCP
15300         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15301         if eval $compile; then
15302                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15303                 val="$undef" # Yes, undef.
15304                 set d_old_pthread_create_joinable
15305                 eval $setvar
15306                 val=""
15307                 set old_pthread_create_joinable
15308                 eval $setvar
15309         else
15310                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15311                 if eval $compile; then
15312                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15313                         val="$define"
15314                         set d_old_pthread_create_joinable
15315                         eval $setvar
15316                         val=PTHREAD_CREATE_UNDETACHED
15317                         set old_pthread_create_joinable
15318                         eval $setvar
15319                 else            
15320                         set try -DJOINABLE=__UNDETACHED
15321                         if eval $compile; then
15322                                 echo "You seem to use __UNDETACHED." >&4
15323                                 val="$define"
15324                                 set d_old_pthread_create_joinable
15325                                 eval $setvar
15326                                 val=__UNDETACHED
15327                                 set old_pthread_create_joinable
15328                                 eval $setvar
15329                         else
15330                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15331                                 val="$define"
15332                                 set d_old_pthread_create_joinable
15333                                 eval $setvar
15334                                 val=0
15335                                 set old_pthread_create_joinable
15336                                 eval $setvar
15337                         fi
15338                 fi
15339         fi
15340         $rm -f try try.*
15341 else
15342     d_old_pthread_create_joinable="$undef"
15343     old_pthread_create_joinable=""
15344 fi
15345
15346 : see if pause exists
15347 set pause d_pause
15348 eval $inlibc
15349
15350 : see if pipe exists
15351 set pipe d_pipe
15352 eval $inlibc
15353
15354 : see if poll exists
15355 set poll d_poll
15356 eval $inlibc
15357
15358 : see if readlink exists
15359 set readlink d_readlink
15360 eval $inlibc
15361
15362 echo " "
15363 procselfexe=''
15364 val="$undef"
15365 case "$d_readlink" in
15366 "$define")
15367         if $issymlink /proc/self/exe ; then
15368                 $ls -l /proc/self/exe > reflect
15369                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15370                         echo "You have Linux-like /proc/self/exe."
15371                         procselfexe='"/proc/self/exe"'
15372                         val="$define"
15373                 fi
15374         fi
15375         if $issymlink /proc/curproc/file ; then
15376                 $ls -l /proc/curproc/file > reflect
15377                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15378                         echo "You have BSD-like /proc/curproc/file."
15379                         procselfexe='"/proc/curproc/file"'
15380                         val="$define"
15381                 fi
15382         fi
15383         ;;
15384 esac
15385 $rm -f reflect
15386 set d_procselfexe
15387 eval $setvar
15388
15389 : see whether the pthread_atfork exists
15390 $cat >try.c <<EOP
15391 #include <pthread.h>
15392 #include <stdio.h>
15393 int main() {
15394 #ifdef  PTHREAD_ATFORK
15395         pthread_atfork(NULL,NULL,NULL);
15396 #endif
15397 }
15398 EOP
15399
15400 : see if pthread_atfork exists
15401 set try -DPTHREAD_ATFORK
15402 if eval $compile; then
15403     val="$define"
15404 else
15405     val="$undef"
15406 fi
15407 case "$usethreads" in
15408 $define)
15409         case "$val" in
15410         $define) echo 'pthread_atfork found.' >&4        ;;
15411         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15412         esac
15413 esac
15414 set d_pthread_atfork
15415 eval $setvar
15416
15417 : see if pthread_attr_setscope exists
15418 set pthread_attr_setscope d_pthread_attr_setscope
15419 eval $inlibc
15420
15421
15422 : see whether the various POSIXish _yields exist
15423 $cat >try.c <<EOP
15424 #include <pthread.h>
15425 #include <stdio.h>
15426 int main() {
15427 #ifdef SCHED_YIELD
15428         sched_yield();
15429 #else
15430 #ifdef PTHREAD_YIELD
15431         pthread_yield();
15432 #else
15433 #ifdef PTHREAD_YIELD_NULL
15434         pthread_yield(NULL);
15435 #endif
15436 #endif
15437 #endif
15438 }
15439 EOP
15440 : see if sched_yield exists
15441 set try -DSCHED_YIELD
15442 if eval $compile; then
15443     val="$define"
15444     sched_yield='sched_yield()'
15445 else
15446     val="$undef"
15447 fi
15448 case "$usethreads" in
15449 $define)
15450         case "$val" in
15451         $define) echo 'sched_yield() found.' >&4        ;;
15452         *)       echo 'sched_yield() NOT found.' >&4    ;;
15453         esac
15454 esac
15455 set d_sched_yield
15456 eval $setvar
15457
15458 : see if pthread_yield exists
15459 set try -DPTHREAD_YIELD
15460 if eval $compile; then
15461     val="$define"
15462     case "$sched_yield" in
15463     '') sched_yield='pthread_yield()' ;;
15464     esac
15465 else
15466     set try -DPTHREAD_YIELD_NULL
15467     if eval $compile; then
15468         val="$define"
15469         case "$sched_yield" in
15470         '') sched_yield='pthread_yield(NULL)' ;;
15471         esac
15472     else
15473         val="$undef"
15474     fi
15475 fi
15476 case "$usethreads" in
15477 $define)
15478         case "$val" in
15479         $define) echo 'pthread_yield() found.' >&4      ;;
15480         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15481         esac
15482         ;;
15483 esac
15484 set d_pthread_yield
15485 eval $setvar
15486
15487 case "$sched_yield" in
15488 '') sched_yield=undef ;;
15489 esac
15490
15491 $rm -f try try.*
15492
15493 : see if random_r exists
15494 set random_r d_random_r
15495 eval $inlibc
15496 case "$d_random_r" in
15497 "$define")
15498         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15499         case "$d_random_r_proto:$usethreads" in
15500         ":define")      d_random_r_proto=define
15501                 set d_random_r_proto random_r $hdrs
15502                 eval $hasproto ;;
15503         *)      ;;
15504         esac
15505         case "$d_random_r_proto" in
15506         define)
15507         case "$random_r_proto" in
15508         ''|0) try='int random_r(int*, struct random_data*);'
15509         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15510         esac
15511         case "$random_r_proto" in
15512         ''|0) try='int random_r(long*, struct random_data*);'
15513         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15514         esac
15515         case "$random_r_proto" in
15516         ''|0) try='int random_r(struct random_data*, int32_t*);'
15517         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15518         esac
15519         case "$random_r_proto" in
15520         ''|0)   d_random_r=undef
15521                 random_r_proto=0
15522                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15523         * )     case "$random_r_proto" in
15524                 REENTRANT_PROTO*) ;;
15525                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15526                 esac
15527                 echo "Prototype: $try" ;;
15528         esac
15529         ;;
15530         *)      case "$usethreads" in
15531                 define) echo "random_r has no prototype, not using it." >&4 ;;
15532                 esac
15533                 d_random_r=undef
15534                 random_r_proto=0
15535                 ;;
15536         esac
15537         ;;
15538 *)      random_r_proto=0
15539         ;;
15540 esac
15541
15542 : see if readdir and friends exist
15543 set readdir d_readdir
15544 eval $inlibc
15545 set seekdir d_seekdir
15546 eval $inlibc
15547 set telldir d_telldir
15548 eval $inlibc
15549 set rewinddir d_rewinddir
15550 eval $inlibc
15551
15552 : see if readdir64_r exists
15553 set readdir64_r d_readdir64_r
15554 eval $inlibc
15555 case "$d_readdir64_r" in
15556 "$define")
15557         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15558         case "$d_readdir64_r_proto:$usethreads" in
15559         ":define")      d_readdir64_r_proto=define
15560                 set d_readdir64_r_proto readdir64_r $hdrs
15561                 eval $hasproto ;;
15562         *)      ;;
15563         esac
15564         case "$d_readdir64_r_proto" in
15565         define)
15566         case "$readdir64_r_proto" in
15567         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15568         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15569         esac
15570         case "$readdir64_r_proto" in
15571         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15572         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15573         esac
15574         case "$readdir64_r_proto" in
15575         ''|0)   d_readdir64_r=undef
15576                 readdir64_r_proto=0
15577                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15578         * )     case "$readdir64_r_proto" in
15579                 REENTRANT_PROTO*) ;;
15580                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15581                 esac
15582                 echo "Prototype: $try" ;;
15583         esac
15584         ;;
15585         *)      case "$usethreads" in
15586                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15587                 esac
15588                 d_readdir64_r=undef
15589                 readdir64_r_proto=0
15590                 ;;
15591         esac
15592         ;;
15593 *)      readdir64_r_proto=0
15594         ;;
15595 esac
15596
15597 : see if readdir_r exists
15598 set readdir_r d_readdir_r
15599 eval $inlibc
15600 case "$d_readdir_r" in
15601 "$define")
15602         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15603         case "$d_readdir_r_proto:$usethreads" in
15604         ":define")      d_readdir_r_proto=define
15605                 set d_readdir_r_proto readdir_r $hdrs
15606                 eval $hasproto ;;
15607         *)      ;;
15608         esac
15609         case "$d_readdir_r_proto" in
15610         define)
15611         case "$readdir_r_proto" in
15612         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15613         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15614         esac
15615         case "$readdir_r_proto" in
15616         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15617         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15618         esac
15619         case "$readdir_r_proto" in
15620         ''|0)   d_readdir_r=undef
15621                 readdir_r_proto=0
15622                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15623         * )     case "$readdir_r_proto" in
15624                 REENTRANT_PROTO*) ;;
15625                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15626                 esac
15627                 echo "Prototype: $try" ;;
15628         esac
15629         ;;
15630         *)      case "$usethreads" in
15631                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15632                 esac
15633                 d_readdir_r=undef
15634                 readdir_r_proto=0
15635                 ;;
15636         esac
15637         ;;
15638 *)      readdir_r_proto=0
15639         ;;
15640 esac
15641
15642 : see if readv exists
15643 set readv d_readv
15644 eval $inlibc
15645
15646 : see if recvmsg exists
15647 set recvmsg d_recvmsg
15648 eval $inlibc
15649
15650 : see if rename exists
15651 set rename d_rename
15652 eval $inlibc
15653
15654 : see if rmdir exists
15655 set rmdir d_rmdir
15656 eval $inlibc
15657
15658 : see if memory.h is available.
15659 val=''
15660 set memory.h val
15661 eval $inhdr
15662
15663 : See if it conflicts with string.h
15664 case "$val" in
15665 $define)
15666         case "$strings" in
15667         '') ;;
15668         *)
15669                 $cppstdin $cppflags $cppminus < $strings > mem.h
15670                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15671                         echo " "
15672                         echo "We won't be including <memory.h>."
15673                         val="$undef"
15674                 fi
15675                 $rm -f mem.h
15676                 ;;
15677         esac
15678 esac
15679 set i_memory
15680 eval $setvar
15681
15682 : can bcopy handle overlapping blocks?
15683 echo " "
15684 val="$undef"
15685 case "$d_memmove" in
15686 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15687 *)      case "$d_bcopy" in
15688         "$define")
15689                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15690                 $cat >try.c <<EOCP
15691 #$i_memory I_MEMORY
15692 #$i_stdlib I_STDLIB
15693 #$i_string I_STRING
15694 #$i_unistd I_UNISTD
15695 EOCP
15696         $cat >>try.c <<'EOCP'
15697 #include <stdio.h>
15698 #ifdef I_MEMORY
15699 #  include <memory.h>
15700 #endif
15701 #ifdef I_STDLIB
15702 #  include <stdlib.h>
15703 #endif
15704 #ifdef I_STRING
15705 #  include <string.h>
15706 #else
15707 #  include <strings.h>
15708 #endif
15709 #ifdef I_UNISTD
15710 #  include <unistd.h>  /* Needed for NetBSD */
15711 #endif
15712 int main()
15713 {
15714 char buf[128], abc[128];
15715 char *b;
15716 int len;
15717 int off;
15718 int align;
15719
15720 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15721    try to store the string in read-only memory. */
15722 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15723
15724 for (align = 7; align >= 0; align--) {
15725         for (len = 36; len; len--) {
15726                 b = buf+align;
15727                 bcopy(abc, b, len);
15728                 for (off = 1; off <= len; off++) {
15729                         bcopy(b, b+off, len);
15730                         bcopy(b+off, b, len);
15731                         if (bcmp(b, abc, len))
15732                                 exit(1);
15733                 }
15734         }
15735 }
15736 exit(0);
15737 }
15738 EOCP
15739                 set try
15740                 if eval $compile_ok; then
15741                         if ./try 2>/dev/null; then
15742                                 echo "Yes, it can."
15743                                 val="$define"
15744                         else
15745                                 echo "It can't, sorry."
15746                         fi
15747                 else
15748                         echo "(I can't compile the test program, so we'll assume not...)"
15749                 fi
15750                 ;;
15751         esac
15752         $rm -f try.* try core
15753         ;;
15754 esac
15755 set d_safebcpy
15756 eval $setvar
15757
15758 : can memcpy handle overlapping blocks?
15759 echo " "
15760 val="$undef"
15761 case "$d_memmove" in
15762 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15763 *)      case "$d_memcpy" in
15764         "$define")
15765                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15766                 $cat >try.c <<EOCP
15767 #$i_memory I_MEMORY
15768 #$i_stdlib I_STDLIB
15769 #$i_string I_STRING
15770 #$i_unistd I_UNISTD
15771 EOCP
15772         $cat >>try.c <<'EOCP'
15773 #include <stdio.h>
15774 #ifdef I_MEMORY
15775 #  include <memory.h>
15776 #endif
15777 #ifdef I_STDLIB
15778 #  include <stdlib.h>
15779 #endif
15780 #ifdef I_STRING
15781 #  include <string.h>
15782 #else
15783 #  include <strings.h>
15784 #endif
15785 #ifdef I_UNISTD
15786 #  include <unistd.h>  /* Needed for NetBSD */
15787 #endif
15788 int main()
15789 {
15790 char buf[128], abc[128];
15791 char *b;
15792 int len;
15793 int off;
15794 int align;
15795
15796 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15797    try to store the string in read-only memory. */
15798 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15799
15800 for (align = 7; align >= 0; align--) {
15801         for (len = 36; len; len--) {
15802                 b = buf+align;
15803                 memcpy(b, abc, len);
15804                 for (off = 1; off <= len; off++) {
15805                         memcpy(b+off, b, len);
15806                         memcpy(b, b+off, len);
15807                         if (memcmp(b, abc, len))
15808                                 exit(1);
15809                 }
15810         }
15811 }
15812 exit(0);
15813 }
15814 EOCP
15815                 set try
15816                 if eval $compile_ok; then
15817                         if ./try 2>/dev/null; then
15818                                 echo "Yes, it can."
15819                                 val="$define"
15820                         else
15821                                 echo "It can't, sorry."
15822                         fi
15823                 else
15824                         echo "(I can't compile the test program, so we'll assume not...)"
15825                 fi
15826                 ;;
15827         esac
15828         $rm -f try.* try core
15829         ;;
15830 esac
15831 set d_safemcpy
15832 eval $setvar
15833
15834 : can memcmp be trusted to compare relative magnitude?
15835 val="$undef"
15836 case "$d_memcmp" in
15837 "$define")
15838         echo " "
15839         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15840         $cat >try.c <<EOCP
15841 #$i_memory I_MEMORY
15842 #$i_stdlib I_STDLIB
15843 #$i_string I_STRING
15844 #$i_unistd I_UNISTD
15845 EOCP
15846         $cat >>try.c <<'EOCP'
15847 #include <stdio.h>
15848 #ifdef I_MEMORY
15849 #  include <memory.h>
15850 #endif
15851 #ifdef I_STDLIB
15852 #  include <stdlib.h>
15853 #endif
15854 #ifdef I_STRING
15855 #  include <string.h>
15856 #else
15857 #  include <strings.h>
15858 #endif
15859 #ifdef I_UNISTD
15860 #  include <unistd.h>  /* Needed for NetBSD */
15861 #endif
15862 int main()
15863 {
15864 char a = -1;
15865 char b = 0;
15866 if ((a < b) && memcmp(&a, &b, 1) < 0)
15867         exit(1);
15868 exit(0);
15869 }
15870 EOCP
15871         set try
15872         if eval $compile_ok; then
15873                 if $run ./try 2>/dev/null; then
15874                         echo "Yes, it can."
15875                         val="$define"
15876                 else
15877                         echo "No, it can't (it uses signed chars)."
15878                 fi
15879         else
15880                 echo "(I can't compile the test program, so we'll assume not...)"
15881         fi
15882         ;;
15883 esac
15884 $rm -f try.* try core
15885 set d_sanemcmp
15886 eval $setvar
15887
15888 : see if prototype for sbrk is available
15889 echo " "
15890 set d_sbrkproto sbrk $i_unistd unistd.h
15891 eval $hasproto
15892
15893 : see if select exists
15894 set select d_select
15895 eval $inlibc
15896
15897 : see if semctl exists
15898 set semctl d_semctl
15899 eval $inlibc
15900
15901 : see if semget exists
15902 set semget d_semget
15903 eval $inlibc
15904
15905 : see if semop exists
15906 set semop d_semop
15907 eval $inlibc
15908
15909 : see how much of the 'sem*(2)' library is present.
15910 h_sem=true
15911 echo " "
15912 case "$d_semctl$d_semget$d_semop" in
15913 *"$undef"*) h_sem=false;;
15914 esac
15915 case "$osname" in
15916 freebsd)
15917     case "`ipcs 2>&1`" in
15918     "SVID messages"*"not configured"*)
15919         echo "Your $osname does not have the sem*(2) configured." >&4
15920         h_sem=false
15921         val="$undef"
15922         set semctl d_semctl
15923         eval $setvar
15924         set semget d_semget
15925         eval $setvar
15926         set semop d_semop
15927         eval $setvar
15928         ;;
15929     esac
15930     ;;
15931 esac
15932 : we could also check for sys/ipc.h ...
15933 if $h_sem && $test `./findhdr sys/sem.h`; then
15934         echo "You have the full sem*(2) library." >&4
15935         val="$define"
15936 else
15937         echo "You don't have the full sem*(2) library." >&4
15938         val="$undef"
15939 fi
15940 set d_sem
15941 eval $setvar
15942
15943 : see whether sys/sem.h defines union semun
15944 echo " "
15945 $cat > try.c <<'END'
15946 #include <sys/types.h>
15947 #include <sys/ipc.h>
15948 #include <sys/sem.h>
15949 int main () { union semun semun; semun.buf = 0; }
15950 END
15951 set try
15952 if eval $compile; then
15953     echo "You have union semun in <sys/sem.h>." >&4
15954     val="$define"
15955 else
15956     echo "You do not have union semun in <sys/sem.h>." >&4
15957     val="$undef"
15958 fi
15959 $rm -f try try.c
15960 set d_union_semun
15961 eval $setvar
15962
15963 : see how to do semctl IPC_STAT
15964 case "$d_sem" in
15965 $define)
15966     echo " "
15967     $cat > try.h <<END
15968 #ifndef S_IRUSR
15969 #   ifdef S_IREAD
15970 #       define S_IRUSR S_IREAD
15971 #       define S_IWUSR S_IWRITE
15972 #       define S_IXUSR S_IEXEC
15973 #   else
15974 #       define S_IRUSR 0400
15975 #       define S_IWUSR 0200
15976 #       define S_IXUSR 0100
15977 #   endif
15978 #   define S_IRGRP (S_IRUSR>>3)
15979 #   define S_IWGRP (S_IWUSR>>3)
15980 #   define S_IXGRP (S_IXUSR>>3)
15981 #   define S_IROTH (S_IRUSR>>6)
15982 #   define S_IWOTH (S_IWUSR>>6)
15983 #   define S_IXOTH (S_IXUSR>>6)
15984 #endif
15985 #ifndef S_IRWXU
15986 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15987 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15988 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15989 #endif
15990 END
15991     : see whether semctl IPC_STAT can use union semun
15992     case "$d_semctl_semun" in
15993     '')
15994       val="$undef"
15995       $cat > try.c <<END
15996 #include <sys/types.h>
15997 #include <sys/ipc.h>
15998 #include <sys/sem.h>
15999 #include <sys/stat.h>
16000 #include <stdio.h>
16001 #include <errno.h>
16002 #include "try.h"
16003 #ifndef errno
16004 extern int errno;
16005 #endif
16006 #$d_union_semun HAS_UNION_SEMUN
16007 int main() {
16008     union semun
16009 #ifndef HAS_UNION_SEMUN
16010     {
16011         int val;
16012         struct semid_ds *buf;
16013         unsigned short *array;
16014     }
16015 #endif
16016     arg;
16017     int sem, st;
16018
16019 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16020     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16021     if (sem > -1) {
16022         struct semid_ds argbuf;
16023         arg.buf = &argbuf;
16024 #       ifdef IPC_STAT
16025         st = semctl(sem, 0, IPC_STAT, arg);
16026         if (st == 0)
16027             printf("semun\n");
16028         else
16029 #       endif /* IPC_STAT */
16030             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16031 #       ifdef IPC_RMID
16032         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16033 #       endif /* IPC_RMID */
16034             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16035     } else
16036 #endif /* IPC_PRIVATE && ... */
16037         printf("semget failed: errno = %d\n", errno);
16038   return 0;
16039 }
16040 END
16041       set try
16042       if eval $compile; then
16043           xxx=`$run ./try`
16044           case "$xxx" in
16045           semun) val="$define" ;;
16046           esac
16047       fi
16048       $rm -f try try.c
16049       set d_semctl_semun
16050       eval $setvar
16051       ;;
16052     esac
16053     case "$d_semctl_semun" in
16054     $define)
16055         echo "You can use union semun for semctl IPC_STAT." >&4
16056         also='also'
16057         ;;
16058     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16059         also=''
16060         ;;
16061     esac
16062
16063     : see whether semctl IPC_STAT can use struct semid_ds pointer
16064     case "$d_semctl_semid_ds" in
16065     '')
16066       val="$undef"
16067       $cat > try.c <<'END'
16068 #include <sys/types.h>
16069 #include <sys/ipc.h>
16070 #include <sys/sem.h>
16071 #include <sys/stat.h>
16072 #include "try.h"
16073 #include <stdio.h>
16074 #include <errno.h>
16075 #ifndef errno
16076 extern int errno;
16077 #endif
16078 int main() {
16079     struct semid_ds arg;
16080     int sem, st;
16081
16082 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16083     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16084     if (sem > -1) {
16085 #       ifdef IPC_STAT
16086         st = semctl(sem, 0, IPC_STAT, &arg);
16087         if (st == 0)
16088             printf("semid_ds\n");
16089         else
16090 #       endif /* IPC_STAT */
16091             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16092 #       ifdef IPC_RMID
16093         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16094 #       endif /* IPC_RMID */
16095             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16096     } else
16097 #endif /* IPC_PRIVATE && ... */
16098         printf("semget failed: errno = %d\n", errno);
16099
16100     return 0;
16101 }
16102 END
16103       set try
16104       if eval $compile; then
16105           xxx=`$run ./try`
16106           case "$xxx" in
16107           semid_ds) val="$define" ;;
16108           esac
16109       fi
16110       $rm -f try try.c
16111       set d_semctl_semid_ds
16112       eval $setvar
16113       ;;
16114     esac
16115     case "$d_semctl_semid_ds" in
16116     $define)
16117         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16118         ;;
16119     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16120         ;;
16121     esac
16122     $rm -f try.h
16123     ;;
16124 *)  val="$undef"
16125
16126     # We do not have the full sem*(2) library, so assume we can not
16127     # use either.
16128
16129     set d_semctl_semun
16130     eval $setvar
16131
16132     set d_semctl_semid_ds
16133     eval $setvar
16134     ;;
16135 esac
16136
16137 : see if sendmsg exists
16138 set sendmsg d_sendmsg
16139 eval $inlibc
16140
16141 : see if setegid exists
16142 set setegid d_setegid
16143 eval $inlibc
16144
16145 : see if seteuid exists
16146 set seteuid d_seteuid
16147 eval $inlibc
16148
16149 : see if setgrent exists
16150 set setgrent d_setgrent
16151 eval $inlibc
16152
16153 : see if setgrent_r exists
16154 set setgrent_r d_setgrent_r
16155 eval $inlibc
16156 case "$d_setgrent_r" in
16157 "$define")
16158         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16159         case "$d_setgrent_r_proto:$usethreads" in
16160         ":define")      d_setgrent_r_proto=define
16161                 set d_setgrent_r_proto setgrent_r $hdrs
16162                 eval $hasproto ;;
16163         *)      ;;
16164         esac
16165         case "$d_setgrent_r_proto" in
16166         define)
16167         case "$setgrent_r_proto" in
16168         ''|0) try='int setgrent_r(FILE**);'
16169         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16170         esac
16171         case "$setgrent_r_proto" in
16172         ''|0) try='void setgrent_r(FILE**);'
16173         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16174         esac
16175         case "$setgrent_r_proto" in
16176         ''|0)   d_setgrent_r=undef
16177                 setgrent_r_proto=0
16178                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16179         * )     case "$setgrent_r_proto" in
16180                 REENTRANT_PROTO*) ;;
16181                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16182                 esac
16183                 echo "Prototype: $try" ;;
16184         esac
16185         ;;
16186         *)      case "$usethreads" in
16187                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16188                 esac
16189                 d_setgrent_r=undef
16190                 setgrent_r_proto=0
16191                 ;;
16192         esac
16193         ;;
16194 *)      setgrent_r_proto=0
16195         ;;
16196 esac
16197
16198 : see if sethostent exists
16199 set sethostent d_sethent
16200 eval $inlibc
16201
16202 : see if sethostent_r exists
16203 set sethostent_r d_sethostent_r
16204 eval $inlibc
16205 case "$d_sethostent_r" in
16206 "$define")
16207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16208         case "$d_sethostent_r_proto:$usethreads" in
16209         ":define")      d_sethostent_r_proto=define
16210                 set d_sethostent_r_proto sethostent_r $hdrs
16211                 eval $hasproto ;;
16212         *)      ;;
16213         esac
16214         case "$d_sethostent_r_proto" in
16215         define)
16216         case "$sethostent_r_proto" in
16217         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16218         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16219         esac
16220         case "$sethostent_r_proto" in
16221         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16222         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16223         esac
16224         case "$sethostent_r_proto" in
16225         ''|0)   d_sethostent_r=undef
16226                 sethostent_r_proto=0
16227                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16228         * )     case "$sethostent_r_proto" in
16229                 REENTRANT_PROTO*) ;;
16230                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16231                 esac
16232                 echo "Prototype: $try" ;;
16233         esac
16234         ;;
16235         *)      case "$usethreads" in
16236                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16237                 esac
16238                 d_sethostent_r=undef
16239                 sethostent_r_proto=0
16240                 ;;
16241         esac
16242         ;;
16243 *)      sethostent_r_proto=0
16244         ;;
16245 esac
16246
16247 : see if setitimer exists
16248 set setitimer d_setitimer
16249 eval $inlibc
16250
16251 : see if setlinebuf exists
16252 set setlinebuf d_setlinebuf
16253 eval $inlibc
16254
16255 : see if setlocale exists
16256 set setlocale d_setlocale
16257 eval $inlibc
16258
16259 : see if locale.h is available
16260 set locale.h i_locale
16261 eval $inhdr
16262
16263 : see if setlocale_r exists
16264 set setlocale_r d_setlocale_r
16265 eval $inlibc
16266 case "$d_setlocale_r" in
16267 "$define")
16268         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16269         case "$d_setlocale_r_proto:$usethreads" in
16270         ":define")      d_setlocale_r_proto=define
16271                 set d_setlocale_r_proto setlocale_r $hdrs
16272                 eval $hasproto ;;
16273         *)      ;;
16274         esac
16275         case "$d_setlocale_r_proto" in
16276         define)
16277         case "$setlocale_r_proto" in
16278         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16279         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16280         esac
16281         case "$setlocale_r_proto" in
16282         ''|0)   d_setlocale_r=undef
16283                 setlocale_r_proto=0
16284                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16285         * )     case "$setlocale_r_proto" in
16286                 REENTRANT_PROTO*) ;;
16287                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16288                 esac
16289                 echo "Prototype: $try" ;;
16290         esac
16291         ;;
16292         *)      case "$usethreads" in
16293                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16294                 esac
16295                 d_setlocale_r=undef
16296                 setlocale_r_proto=0
16297                 ;;
16298         esac
16299         ;;
16300 *)      setlocale_r_proto=0
16301         ;;
16302 esac
16303
16304 : see if setnetent exists
16305 set setnetent d_setnent
16306 eval $inlibc
16307
16308 : see if setnetent_r exists
16309 set setnetent_r d_setnetent_r
16310 eval $inlibc
16311 case "$d_setnetent_r" in
16312 "$define")
16313         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16314         case "$d_setnetent_r_proto:$usethreads" in
16315         ":define")      d_setnetent_r_proto=define
16316                 set d_setnetent_r_proto setnetent_r $hdrs
16317                 eval $hasproto ;;
16318         *)      ;;
16319         esac
16320         case "$d_setnetent_r_proto" in
16321         define)
16322         case "$setnetent_r_proto" in
16323         ''|0) try='int setnetent_r(int, struct netent_data*);'
16324         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16325         esac
16326         case "$setnetent_r_proto" in
16327         ''|0) try='void setnetent_r(int, struct netent_data*);'
16328         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16329         esac
16330         case "$setnetent_r_proto" in
16331         ''|0)   d_setnetent_r=undef
16332                 setnetent_r_proto=0
16333                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16334         * )     case "$setnetent_r_proto" in
16335                 REENTRANT_PROTO*) ;;
16336                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16337                 esac
16338                 echo "Prototype: $try" ;;
16339         esac
16340         ;;
16341         *)      case "$usethreads" in
16342                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16343                 esac
16344                 d_setnetent_r=undef
16345                 setnetent_r_proto=0
16346                 ;;
16347         esac
16348         ;;
16349 *)      setnetent_r_proto=0
16350         ;;
16351 esac
16352
16353 : see if setprotoent exists
16354 set setprotoent d_setpent
16355 eval $inlibc
16356
16357 : see if setpgid exists
16358 set setpgid d_setpgid
16359 eval $inlibc
16360
16361 : see if setpgrp2 exists
16362 set setpgrp2 d_setpgrp2
16363 eval $inlibc
16364
16365 : see if setpriority exists
16366 set setpriority d_setprior
16367 eval $inlibc
16368
16369 : see if setproctitle exists
16370 set setproctitle d_setproctitle
16371 eval $inlibc
16372
16373 : see if setprotoent_r exists
16374 set setprotoent_r d_setprotoent_r
16375 eval $inlibc
16376 case "$d_setprotoent_r" in
16377 "$define")
16378         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16379         case "$d_setprotoent_r_proto:$usethreads" in
16380         ":define")      d_setprotoent_r_proto=define
16381                 set d_setprotoent_r_proto setprotoent_r $hdrs
16382                 eval $hasproto ;;
16383         *)      ;;
16384         esac
16385         case "$d_setprotoent_r_proto" in
16386         define)
16387         case "$setprotoent_r_proto" in
16388         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16389         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16390         esac
16391         case "$setprotoent_r_proto" in
16392         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16393         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16394         esac
16395         case "$setprotoent_r_proto" in
16396         ''|0)   d_setprotoent_r=undef
16397                 setprotoent_r_proto=0
16398                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16399         * )     case "$setprotoent_r_proto" in
16400                 REENTRANT_PROTO*) ;;
16401                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16402                 esac
16403                 echo "Prototype: $try" ;;
16404         esac
16405         ;;
16406         *)      case "$usethreads" in
16407                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16408                 esac
16409                 d_setprotoent_r=undef
16410                 setprotoent_r_proto=0
16411                 ;;
16412         esac
16413         ;;
16414 *)      setprotoent_r_proto=0
16415         ;;
16416 esac
16417
16418 : see if setpwent exists
16419 set setpwent d_setpwent
16420 eval $inlibc
16421
16422 : see if setpwent_r exists
16423 set setpwent_r d_setpwent_r
16424 eval $inlibc
16425 case "$d_setpwent_r" in
16426 "$define")
16427         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16428         case "$d_setpwent_r_proto:$usethreads" in
16429         ":define")      d_setpwent_r_proto=define
16430                 set d_setpwent_r_proto setpwent_r $hdrs
16431                 eval $hasproto ;;
16432         *)      ;;
16433         esac
16434         case "$d_setpwent_r_proto" in
16435         define)
16436         case "$setpwent_r_proto" in
16437         ''|0) try='int setpwent_r(FILE**);'
16438         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16439         esac
16440         case "$setpwent_r_proto" in
16441         ''|0) try='void setpwent_r(FILE**);'
16442         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16443         esac
16444         case "$setpwent_r_proto" in
16445         ''|0)   d_setpwent_r=undef
16446                 setpwent_r_proto=0
16447                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16448         * )     case "$setpwent_r_proto" in
16449                 REENTRANT_PROTO*) ;;
16450                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16451                 esac
16452                 echo "Prototype: $try" ;;
16453         esac
16454         ;;
16455         *)      case "$usethreads" in
16456                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16457                 esac
16458                 d_setpwent_r=undef
16459                 setpwent_r_proto=0
16460                 ;;
16461         esac
16462         ;;
16463 *)      setpwent_r_proto=0
16464         ;;
16465 esac
16466
16467 : see if setregid exists
16468 set setregid d_setregid
16469 eval $inlibc
16470 set setresgid d_setresgid
16471 eval $inlibc
16472
16473 : see if setreuid exists
16474 set setreuid d_setreuid
16475 eval $inlibc
16476 set setresuid d_setresuid
16477 eval $inlibc
16478
16479 : see if setrgid exists
16480 set setrgid d_setrgid
16481 eval $inlibc
16482
16483 : see if setruid exists
16484 set setruid d_setruid
16485 eval $inlibc
16486
16487 : see if setservent exists
16488 set setservent d_setsent
16489 eval $inlibc
16490
16491 : see if setservent_r exists
16492 set setservent_r d_setservent_r
16493 eval $inlibc
16494 case "$d_setservent_r" in
16495 "$define")
16496         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16497         case "$d_setservent_r_proto:$usethreads" in
16498         ":define")      d_setservent_r_proto=define
16499                 set d_setservent_r_proto setservent_r $hdrs
16500                 eval $hasproto ;;
16501         *)      ;;
16502         esac
16503         case "$d_setservent_r_proto" in
16504         define)
16505         case "$setservent_r_proto" in
16506         ''|0) try='int setservent_r(int, struct servent_data*);'
16507         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16508         esac
16509         case "$setservent_r_proto" in
16510         ''|0) try='void setservent_r(int, struct servent_data*);'
16511         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16512         esac
16513         case "$setservent_r_proto" in
16514         ''|0)   d_setservent_r=undef
16515                 setservent_r_proto=0
16516                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16517         * )     case "$setservent_r_proto" in
16518                 REENTRANT_PROTO*) ;;
16519                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16520                 esac
16521                 echo "Prototype: $try" ;;
16522         esac
16523         ;;
16524         *)      case "$usethreads" in
16525                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16526                 esac
16527                 d_setservent_r=undef
16528                 setservent_r_proto=0
16529                 ;;
16530         esac
16531         ;;
16532 *)      setservent_r_proto=0
16533         ;;
16534 esac
16535
16536 : see if setsid exists
16537 set setsid d_setsid
16538 eval $inlibc
16539
16540 : see if setvbuf exists
16541 set setvbuf d_setvbuf
16542 eval $inlibc
16543
16544 : see if sfio.h is available
16545 set sfio.h i_sfio
16546 eval $inhdr
16547
16548
16549 : see if sfio library is available
16550 case "$i_sfio" in
16551 $define)
16552         val=''
16553         set sfreserve val
16554         eval $inlibc
16555         ;;
16556 *)
16557         val="$undef"
16558         ;;
16559 esac
16560 : Ok, but do we want to use it.
16561 case "$val" in
16562 $define)
16563         case "$usesfio" in
16564         true|$define|[yY]*) dflt='y';;
16565         *) dflt='n';;
16566         esac
16567         echo "$package can use the sfio library, but it is experimental."
16568         case "$useperlio" in
16569         "$undef")
16570             echo "For sfio also the PerlIO abstraction layer is needed."
16571             echo "Earlier you said you wouldn't want that."
16572             ;;
16573         esac
16574         rp="You seem to have sfio available, do you want to try using it?"
16575         . ./myread
16576         case "$ans" in
16577         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16578                 useperlio="$define"
16579                 val="$define"
16580                 ;;
16581         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16582                 val="$undef"
16583                 ;;
16584         esac
16585         ;;
16586 *)      case "$usesfio" in
16587         true|$define|[yY]*)
16588                 echo "Sorry, cannot find sfio on this machine." >&4
16589                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16590                 val="$undef"
16591                 ;;
16592         esac
16593         ;;
16594 esac
16595 set d_sfio
16596 eval $setvar
16597 case "$d_sfio" in
16598 $define) usesfio='true';;
16599 *) usesfio='false';;
16600 esac
16601 case "$d_sfio" in
16602 $define) ;;
16603 *)      : Remove sfio from list of libraries to use
16604         case "$libs" in
16605         *-lsfio*)
16606                 echo "Removing unneeded -lsfio from library list" >&4
16607                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16608                 shift
16609                 libs="$*"
16610                 echo "libs = $libs" >&4
16611                 ;;
16612         esac
16613 ;;
16614 esac
16615
16616
16617 : see if shmctl exists
16618 set shmctl d_shmctl
16619 eval $inlibc
16620
16621 : see if shmget exists
16622 set shmget d_shmget
16623 eval $inlibc
16624
16625 : see if shmat exists
16626 set shmat d_shmat
16627 eval $inlibc
16628 : see what shmat returns
16629 case "$d_shmat" in
16630 "$define")
16631         $cat >shmat.c <<'END'
16632 #include <sys/shm.h>
16633 void *shmat();
16634 END
16635         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16636                 shmattype='void *'
16637         else
16638                 shmattype='char *'
16639         fi
16640         echo "and it returns ($shmattype)." >&4
16641         : see if a prototype for shmat is available
16642         xxx=`./findhdr sys/shm.h`
16643         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16644         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16645                 val="$define"
16646         else
16647                 val="$undef"
16648         fi
16649         $rm -f shmat.[co]
16650         ;;
16651 *)
16652         val="$undef"
16653         ;;
16654 esac
16655 set d_shmatprototype
16656 eval $setvar
16657
16658 : see if shmdt exists
16659 set shmdt d_shmdt
16660 eval $inlibc
16661
16662 : see how much of the 'shm*(2)' library is present.
16663 h_shm=true
16664 echo " "
16665 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16666 *"$undef"*) h_shm=false;;
16667 esac
16668 case "$osname" in
16669 freebsd)
16670     case "`ipcs 2>&1`" in
16671     "SVID shared memory"*"not configured"*)
16672         echo "Your $osname does not have the shm*(2) configured." >&4
16673         h_shm=false
16674         val="$undef"
16675         set shmctl d_shmctl
16676         evat $setvar
16677         set shmget d_shmget
16678         evat $setvar
16679         set shmat d_shmat
16680         evat $setvar
16681         set shmdt d_shmdt
16682         evat $setvar
16683         ;;
16684     esac
16685     ;;
16686 esac
16687 : we could also check for sys/ipc.h ...
16688 if $h_shm && $test `./findhdr sys/shm.h`; then
16689         echo "You have the full shm*(2) library." >&4
16690         val="$define"
16691 else
16692         echo "You don't have the full shm*(2) library." >&4
16693         val="$undef"
16694 fi
16695 set d_shm
16696 eval $setvar
16697
16698 echo " "
16699 : see if we have sigaction
16700 if set sigaction val -f d_sigaction; eval $csym; $val; then
16701         echo 'sigaction() found.' >&4
16702         $cat > try.c <<EOP
16703 #include <stdio.h>
16704 #include <sys/types.h>
16705 #include <signal.h>
16706 #$i_stdlib I_STDLIB
16707 #ifdef I_STDLIB
16708 #include <stdlib.h>
16709 #endif
16710 int main()
16711 {
16712     struct sigaction act, oact;
16713     act.sa_flags = 0;
16714     oact.sa_handler = 0;
16715     /* so that act and oact are used */
16716     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16717 }
16718 EOP
16719         set try
16720         if eval $compile_ok; then
16721                 val="$define"
16722         else
16723                 echo "But you don't seem to have a useable struct sigaction." >&4
16724                 val="$undef"
16725         fi
16726 else
16727         echo 'sigaction NOT found.' >&4
16728         val="$undef"
16729 fi
16730 set d_sigaction; eval $setvar
16731 $rm -f try try$_o try.c
16732
16733 : see if sigprocmask exists
16734 set sigprocmask d_sigprocmask
16735 eval $inlibc
16736
16737 : see if sigsetjmp exists
16738 echo " "
16739 case "$d_sigsetjmp" in
16740 '')
16741         $cat >try.c <<EOP
16742 #include <setjmp.h>
16743 #$i_stdlib I_STDLIB
16744 #ifdef I_STDLIB
16745 #include <stdlib.h>
16746 #endif
16747 sigjmp_buf env;
16748 int set = 1;
16749 int main()
16750 {
16751         if (sigsetjmp(env,1))
16752                 exit(set);
16753         set = 0;
16754         siglongjmp(env, 1);
16755         exit(1);
16756 }
16757 EOP
16758         set try
16759         if eval $compile; then
16760                 if $run ./try >/dev/null 2>&1; then
16761                         echo "POSIX sigsetjmp found." >&4
16762                         val="$define"
16763                 else
16764                         $cat >&4 <<EOM
16765 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16766 I'll ignore them.
16767 EOM
16768                         val="$undef"
16769                 fi
16770         else
16771                 echo "sigsetjmp not found." >&4
16772                 val="$undef"
16773         fi
16774         ;;
16775 *) val="$d_sigsetjmp"
16776         case "$d_sigsetjmp" in
16777         $define) echo "POSIX sigsetjmp found." >&4;;
16778         $undef) echo "sigsetjmp not found." >&4;;
16779         esac
16780         ;;
16781 esac
16782 set d_sigsetjmp
16783 eval $setvar
16784 $rm -f try.c try
16785
16786 : see if snprintf exists
16787 set snprintf d_snprintf
16788 eval $inlibc
16789
16790 : see if vsnprintf exists
16791 set vsnprintf d_vsnprintf
16792 eval $inlibc
16793
16794 case "$d_snprintf-$d_vsnprintf" in
16795 "$define-$define")
16796     $cat <<EOM
16797 Checking whether your snprintf() and vsnprintf() work okay...
16798 EOM
16799     $cat >try.c <<'EOCP'
16800 /* v?snprintf testing logic courtesy of Russ Allbery.
16801  * According to C99:
16802  * - if the buffer is too short it still must be \0-terminated
16803  * - if the buffer is too short the potentially required length
16804  *   must be returned and not -1
16805  * - if the buffer is NULL the potentially required length
16806  *   must be returned and not -1 or core dump
16807  */
16808 #include <stdio.h>
16809 #include <stdarg.h>
16810
16811 char buf[2];
16812
16813 int test (char *format, ...)
16814 {
16815     va_list args;
16816     int count;
16817
16818     va_start (args, format);
16819     count = vsnprintf (buf, sizeof buf, format, args);
16820     va_end (args);
16821     return count;
16822 }
16823
16824 int main ()
16825 {
16826     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16827              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16828 }
16829 EOCP
16830     set try
16831     if eval $compile; then
16832         `$run ./try`
16833         case "$?" in
16834         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16835         *) cat <<EOM >&4
16836 Your snprintf() and snprintf() don't seem to be working okay.
16837 EOM
16838            d_snprintf="$undef"
16839            d_vsnprintf="$undef"
16840            ;;
16841         esac
16842     else
16843         echo "(I can't seem to compile the test program--assuming they don't)"
16844         d_snprintf="$undef"
16845         d_vsnprintf="$undef"
16846     fi
16847     $rm -f try.* try core core.try.*
16848     ;;
16849 esac
16850
16851 : see if sockatmark exists
16852 set sockatmark d_sockatmark
16853 eval $inlibc
16854
16855 : see if prototype for sockatmark is available
16856 echo " "
16857 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16858 eval $hasproto
16859
16860 : see if socks5_init exists
16861 set socks5_init d_socks5_init
16862 eval $inlibc
16863
16864 : see if sprintf returns the length of the string in the buffer as per ANSI
16865 $echo "Checking whether sprintf returns the length of the string..." >&4
16866 $cat <<EOP >try.c
16867 #include <stdio.h>
16868 #$i_stdlib I_STDLIB
16869 #ifdef I_STDLIB
16870 #include <stdlib.h>
16871 #endif
16872 #$i_string I_STRING
16873 #ifdef I_STRING
16874 #  include <string.h>
16875 #else
16876 #  include <strings.h>
16877 #endif
16878 #$i_math I_MATH
16879 #ifdef I_MATH
16880 #include <math.h>
16881 #endif
16882
16883 char buffer[256];
16884
16885 int check (size_t expect, int test) {
16886   size_t got = strlen(buffer);
16887   if (expect == got)
16888     return 0;
16889
16890   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16891        test, buffer);
16892   exit (test);
16893 }
16894
16895 int main(int argc, char **argv) {
16896   int test = 0;
16897
16898   check(sprintf(buffer, ""), ++test);
16899   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16900   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16901
16902   return 0;
16903 }
16904 EOP
16905 set try
16906
16907 d_sprintf_returns_strlen="$undef"
16908 if eval $compile; then
16909     xxx="`$run ./try`"
16910     case "$?" in
16911         0) cat >&4 <<EOM
16912 sprintf returns the length of the string (as ANSI says it should)
16913 EOM
16914         d_sprintf_returns_strlen="$define"
16915         ;;
16916         *) cat >&4 <<EOM
16917 sprintf does not return the length of the string (how old is this system?)
16918 EOM
16919         d_sprintf_returns_strlen="$undef"
16920         ;;
16921     esac
16922 fi
16923
16924 $rm -f try.* try
16925
16926 : see if srand48_r exists
16927 set srand48_r d_srand48_r
16928 eval $inlibc
16929 case "$d_srand48_r" in
16930 "$define")
16931         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16932         case "$d_srand48_r_proto:$usethreads" in
16933         ":define")      d_srand48_r_proto=define
16934                 set d_srand48_r_proto srand48_r $hdrs
16935                 eval $hasproto ;;
16936         *)      ;;
16937         esac
16938         case "$d_srand48_r_proto" in
16939         define)
16940         case "$srand48_r_proto" in
16941         ''|0) try='int srand48_r(long, struct drand48_data*);'
16942         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16943         esac
16944         case "$srand48_r_proto" in
16945         ''|0)   d_srand48_r=undef
16946                 srand48_r_proto=0
16947                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16948         * )     case "$srand48_r_proto" in
16949                 REENTRANT_PROTO*) ;;
16950                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16951                 esac
16952                 echo "Prototype: $try" ;;
16953         esac
16954         ;;
16955         *)      case "$usethreads" in
16956                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16957                 esac
16958                 d_srand48_r=undef
16959                 srand48_r_proto=0
16960                 ;;
16961         esac
16962         ;;
16963 *)      srand48_r_proto=0
16964         ;;
16965 esac
16966
16967 : see if srandom_r exists
16968 set srandom_r d_srandom_r
16969 eval $inlibc
16970 case "$d_srandom_r" in
16971 "$define")
16972         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16973         case "$d_srandom_r_proto:$usethreads" in
16974         ":define")      d_srandom_r_proto=define
16975                 set d_srandom_r_proto srandom_r $hdrs
16976                 eval $hasproto ;;
16977         *)      ;;
16978         esac
16979         case "$d_srandom_r_proto" in
16980         define)
16981         case "$srandom_r_proto" in
16982         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16983         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16984         esac
16985         case "$srandom_r_proto" in
16986         ''|0)   d_srandom_r=undef
16987                 srandom_r_proto=0
16988                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16989         * )     case "$srandom_r_proto" in
16990                 REENTRANT_PROTO*) ;;
16991                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16992                 esac
16993                 echo "Prototype: $try" ;;
16994         esac
16995         ;;
16996         *)      case "$usethreads" in
16997                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16998                 esac
16999                 d_srandom_r=undef
17000                 srandom_r_proto=0
17001                 ;;
17002         esac
17003         ;;
17004 *)      srandom_r_proto=0
17005         ;;
17006 esac
17007
17008 : see if prototype for setresgid is available
17009 echo " "
17010 set d_sresgproto setresgid $i_unistd unistd.h
17011 eval $hasproto
17012
17013 : see if prototype for setresuid is available
17014 echo " "
17015 set d_sresuproto setresuid $i_unistd unistd.h
17016 eval $hasproto
17017
17018 : see if sys/stat.h is available
17019 set sys/stat.h i_sysstat
17020 eval $inhdr
17021
17022
17023 : see if stat knows about block sizes
17024 echo " "
17025 echo "Checking to see if your struct stat has st_blocks field..." >&4
17026 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17027 eval $hasfield
17028
17029
17030 : see if this is a sys/vfs.h system
17031 set sys/vfs.h i_sysvfs
17032 eval $inhdr
17033
17034
17035 : see if this is a sys/statfs.h system
17036 set sys/statfs.h i_sysstatfs
17037 eval $inhdr
17038
17039
17040 echo " "
17041 echo "Checking to see if your system supports struct statfs..." >&4
17042 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
17043 eval $hasstruct
17044 case "$d_statfs_s" in
17045 "$define")      echo "Yes, it does."   ;;
17046 *)              echo "No, it doesn't." ;;
17047 esac
17048
17049
17050
17051 : see if struct statfs knows about f_flags
17052 case "$d_statfs_s" in
17053 define) 
17054         echo " "
17055         echo "Checking to see if your struct statfs has f_flags field..." >&4
17056         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
17057         eval $hasfield
17058         ;;
17059 *)      val="$undef"
17060         set d_statfs_f_flags
17061         eval $setvar
17062         ;;
17063 esac
17064 case "$d_statfs_f_flags" in
17065 "$define")      echo "Yes, it does."   ;;
17066 *)              echo "No, it doesn't." ;;
17067 esac
17068
17069 $cat >&4 <<EOM
17070 Checking how to access stdio streams by file descriptor number...
17071 EOM
17072 case "$stdio_stream_array" in
17073 '')     $cat >try.c <<EOCP
17074 #include <stdio.h>
17075 int main() {
17076   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17077     printf("yes\n");
17078 }
17079 EOCP
17080         for s in _iob __iob __sF
17081         do
17082                 set try -DSTDIO_STREAM_ARRAY=$s
17083                 if eval $compile; then
17084                         case "`$run ./try`" in
17085                         yes)    stdio_stream_array=$s; break ;;
17086                         esac
17087                 fi
17088         done
17089         $rm -f try.* try$exe_ext
17090 esac
17091 case "$stdio_stream_array" in
17092 '')     $cat >&4 <<EOM
17093 I can't figure out how to access stdio streams by file descriptor number.
17094 EOM
17095         d_stdio_stream_array="$undef"
17096         ;;
17097 *)      $cat >&4 <<EOM
17098 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17099 EOM
17100         d_stdio_stream_array="$define"
17101         ;;
17102 esac
17103
17104 : see if strcoll exists
17105 set strcoll d_strcoll
17106 eval $inlibc
17107
17108 : check for structure copying
17109 echo " "
17110 echo "Checking to see if your C compiler can copy structs..." >&4
17111 $cat >try.c <<'EOCP'
17112 int main()
17113 {
17114         struct blurfl {
17115                 int dyick;
17116         } foo, bar;
17117
17118         foo = bar;
17119 }
17120 EOCP
17121 if $cc -c try.c >/dev/null 2>&1 ; then
17122         val="$define"
17123         echo "Yup, it can."
17124 else
17125         val="$undef"
17126         echo "Nope, it can't."
17127 fi
17128 set d_strctcpy
17129 eval $setvar
17130 $rm -f try.*
17131
17132 : see if strerror and/or sys_errlist[] exist
17133 echo " "
17134 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17135     if set strerror val -f d_strerror; eval $csym; $val; then
17136                 echo 'strerror() found.' >&4
17137                 d_strerror="$define"
17138                 d_strerrm='strerror(e)'
17139                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17140                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17141                         d_syserrlst="$define"
17142                 else
17143                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17144                         d_syserrlst="$undef"
17145                 fi
17146     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17147                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17148                 echo 'strerror() found in string header.' >&4
17149                 d_strerror="$define"
17150                 d_strerrm='strerror(e)'
17151                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17152                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17153                                 d_syserrlst="$define"
17154                 else
17155                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17156                         d_syserrlst="$undef"
17157                 fi
17158     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17159                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17160                 d_strerror="$undef"
17161                 d_syserrlst="$define"
17162                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17163     else
17164                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17165                 d_strerror="$undef"
17166                 d_syserrlst="$undef"
17167                 d_strerrm='"unknown"'
17168     fi
17169 fi
17170
17171 : see if strerror_r exists
17172 set strerror_r d_strerror_r
17173 eval $inlibc
17174 case "$d_strerror_r" in
17175 "$define")
17176         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17177         case "$d_strerror_r_proto:$usethreads" in
17178         ":define")      d_strerror_r_proto=define
17179                 set d_strerror_r_proto strerror_r $hdrs
17180                 eval $hasproto ;;
17181         *)      ;;
17182         esac
17183         case "$d_strerror_r_proto" in
17184         define)
17185         case "$strerror_r_proto" in
17186         ''|0) try='int strerror_r(int, char*, size_t);'
17187         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17188         esac
17189         case "$strerror_r_proto" in
17190         ''|0) try='int strerror_r(int, char*, int);'
17191         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17192         esac
17193         case "$strerror_r_proto" in
17194         ''|0) try='char* strerror_r(int, char*, size_t);'
17195         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17196         esac
17197         case "$strerror_r_proto" in
17198         ''|0)   d_strerror_r=undef
17199                 strerror_r_proto=0
17200                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17201         * )     case "$strerror_r_proto" in
17202                 REENTRANT_PROTO*) ;;
17203                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17204                 esac
17205                 echo "Prototype: $try" ;;
17206         esac
17207         ;;
17208         *)      case "$usethreads" in
17209                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17210                 esac
17211                 d_strerror_r=undef
17212                 strerror_r_proto=0
17213                 ;;
17214         esac
17215         ;;
17216 *)      strerror_r_proto=0
17217         ;;
17218 esac
17219
17220 : see if strftime exists
17221 set strftime d_strftime
17222 eval $inlibc
17223
17224 : see if strlcat exists
17225 set strlcat d_strlcat
17226 eval $inlibc
17227
17228 : see if strlcpy exists
17229 set strlcpy d_strlcpy
17230 eval $inlibc
17231
17232 : see if strtod exists
17233 set strtod d_strtod
17234 eval $inlibc
17235
17236 : see if strtol exists
17237 set strtol d_strtol
17238 eval $inlibc
17239
17240 : see if strtold exists
17241 set strtold d_strtold
17242 eval $inlibc
17243
17244 : see if strtoll exists
17245 set strtoll d_strtoll
17246 eval $inlibc
17247
17248 case "$d_longlong-$d_strtoll" in
17249 "$define-$define")
17250         $cat <<EOM
17251 Checking whether your strtoll() works okay...
17252 EOM
17253         $cat >try.c <<'EOCP'
17254 #include <errno.h>
17255 #ifdef __hpux
17256 #define strtoll __strtoll
17257 #endif
17258 #ifdef __EMX__
17259 #define strtoll _strtoll
17260 #endif
17261 #include <stdio.h>
17262 extern long long int strtoll(char *s, char **, int); 
17263 static int bad = 0;
17264 int check(char *s, long long ell, int een) {
17265         long long gll;
17266         errno = 0;
17267         gll = strtoll(s, 0, 10);
17268         if (!((gll == ell) && (errno == een)))
17269                 bad++;
17270 }
17271 int main() {
17272         check(" 1",                                      1LL, 0);
17273         check(" 0",                                      0LL, 0);
17274         check("-1",                                     -1LL, 0);
17275         check("-9223372036854775808", -9223372036854775808LL, 0);
17276         check("-9223372036854775808", -9223372036854775808LL, 0);
17277         check(" 9223372036854775807",  9223372036854775807LL, 0);
17278         check("-9223372036854775808", -9223372036854775808LL, 0);
17279         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17280         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17281         if (!bad)
17282                 printf("ok\n");
17283 }
17284 EOCP
17285         set try
17286         if eval $compile; then
17287                 yyy=`$run ./try`
17288                 case "$yyy" in
17289                 ok) echo "Your strtoll() seems to be working okay." ;;
17290                 *) cat <<EOM >&4
17291 Your strtoll() doesn't seem to be working okay.
17292 EOM
17293                    d_strtoll="$undef"
17294                    ;;
17295                 esac
17296         else
17297                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17298                 d_strtoll="$undef"
17299         fi
17300         ;;
17301 esac
17302
17303 : see if strtoq exists
17304 set strtoq d_strtoq
17305 eval $inlibc
17306
17307 : see if strtoul exists
17308 set strtoul d_strtoul
17309 eval $inlibc
17310
17311 case "$d_strtoul" in
17312 "$define")
17313         $cat <<EOM
17314 Checking whether your strtoul() works okay...
17315 EOM
17316         $cat >try.c <<'EOCP'
17317 #include <errno.h>
17318 #include <stdio.h>
17319 extern unsigned long int strtoul(char *s, char **, int); 
17320 static int bad = 0;
17321 void check(char *s, unsigned long eul, int een) {
17322         unsigned long gul;
17323         errno = 0;
17324         gul = strtoul(s, 0, 10);
17325         if (!((gul == eul) && (errno == een)))
17326                 bad++;
17327 }
17328 int main() {
17329         check(" 1", 1L, 0);
17330         check(" 0", 0L, 0);
17331 EOCP
17332         case "$longsize" in
17333         8)
17334             $cat >>try.c <<'EOCP'
17335         check("18446744073709551615", 18446744073709551615UL, 0);
17336         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17337 #if 0 /* strtoul() for /^-/ strings is undefined. */
17338         check("-1", 18446744073709551615UL, 0);
17339         check("-18446744073709551614", 2, 0);
17340         check("-18446744073709551615", 1, 0);
17341         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17342         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17343 #endif
17344 EOCP
17345                 ;;
17346         4)
17347                     $cat >>try.c <<'EOCP'
17348         check("4294967295", 4294967295UL, 0);
17349         check("4294967296", 4294967295UL, ERANGE);
17350 #if 0 /* strtoul() for /^-/ strings is undefined. */
17351         check("-1", 4294967295UL, 0);
17352         check("-4294967294", 2, 0);
17353         check("-4294967295", 1, 0);
17354         check("-4294967296", 4294967295UL, ERANGE);
17355         check("-4294967297", 4294967295UL, ERANGE);
17356 #endif
17357 EOCP
17358                 ;;
17359         *)
17360 : Should we write these tests to be more portable by sprintf-ing
17361 : ~0 and then manipulating that char string as input for strtol?
17362                 ;;
17363         esac
17364         $cat >>try.c <<'EOCP'
17365         if (!bad)
17366                 printf("ok\n");
17367         return 0;
17368 }
17369 EOCP
17370         set try
17371         if eval $compile; then
17372                 case "`$run ./try`" in
17373                 ok) echo "Your strtoul() seems to be working okay." ;;
17374                 *) cat <<EOM >&4
17375 Your strtoul() doesn't seem to be working okay.
17376 EOM
17377                    d_strtoul="$undef"
17378                    ;;
17379                 esac
17380         fi
17381         ;;
17382 esac
17383
17384 : see if strtoull exists
17385 set strtoull d_strtoull
17386 eval $inlibc
17387
17388 case "$d_longlong-$d_strtoull" in
17389 "$define-$define")
17390         $cat <<EOM
17391 Checking whether your strtoull() works okay...
17392 EOM
17393         $cat >try.c <<'EOCP'
17394 #include <errno.h>
17395 #ifdef __hpux
17396 #define strtoull __strtoull
17397 #endif
17398 #include <stdio.h>
17399 extern unsigned long long int strtoull(char *s, char **, int); 
17400 static int bad = 0;
17401 int check(char *s, long long eull, int een) {
17402         long long gull;
17403         errno = 0;
17404         gull = strtoull(s, 0, 10);
17405         if (!((gull == eull) && (errno == een)))
17406                 bad++;
17407 }
17408 int main() {
17409         check(" 1",                                        1LL, 0);
17410         check(" 0",                                        0LL, 0);
17411         check("18446744073709551615",  18446744073709551615ULL, 0);
17412         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17413 #if 0 /* strtoull() for /^-/ strings is undefined. */
17414         check("-1",                    18446744073709551615ULL, 0);
17415         check("-18446744073709551614",                     2LL, 0);
17416         check("-18446744073709551615",                     1LL, 0);
17417         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17418         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17419 #endif
17420         if (!bad)
17421                 printf("ok\n");
17422 }
17423 EOCP
17424         set try
17425         if eval $compile; then
17426                 case "`$run ./try`" in
17427                 ok) echo "Your strtoull() seems to be working okay." ;;
17428                 *) cat <<EOM >&4
17429 Your strtoull() doesn't seem to be working okay.
17430 EOM
17431                    d_strtoull="$undef"
17432                    ;;
17433                 esac
17434         fi
17435         ;;
17436 esac
17437
17438 : see if strtouq exists
17439 set strtouq d_strtouq
17440 eval $inlibc
17441
17442 case "$d_strtouq" in
17443 "$define")
17444         $cat <<EOM
17445 Checking whether your strtouq() works okay...
17446 EOM
17447         $cat >try.c <<'EOCP'
17448 #include <errno.h>
17449 #include <stdio.h>
17450 extern unsigned long long int strtouq(char *s, char **, int); 
17451 static int bad = 0;
17452 void check(char *s, unsigned long long eull, int een) {
17453         unsigned long long gull;
17454         errno = 0;
17455         gull = strtouq(s, 0, 10);
17456         if (!((gull == eull) && (errno == een)))
17457                 bad++;
17458 }
17459 int main() {
17460         check(" 1",                                        1LL, 0);
17461         check(" 0",                                        0LL, 0);
17462         check("18446744073709551615",  18446744073709551615ULL, 0);
17463         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17464 #if 0 /* strtouq() for /^-/ strings is undefined. */
17465         check("-1",                    18446744073709551615ULL, 0);
17466         check("-18446744073709551614",                     2LL, 0);
17467         check("-18446744073709551615",                     1LL, 0);
17468         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17469         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17470 #endif
17471         if (!bad)
17472                 printf("ok\n");
17473         return 0;
17474 }
17475 EOCP
17476         set try
17477         if eval $compile; then
17478                 case "`$run ./try`" in
17479                 ok) echo "Your strtouq() seems to be working okay." ;;
17480                 *) cat <<EOM >&4
17481 Your strtouq() doesn't seem to be working okay.
17482 EOM
17483                    d_strtouq="$undef"
17484                    ;;
17485                 esac
17486         fi
17487         ;;
17488 esac
17489
17490 : see if strxfrm exists
17491 set strxfrm d_strxfrm
17492 eval $inlibc
17493
17494 : see if symlink exists
17495 set symlink d_symlink
17496 eval $inlibc
17497
17498 : see if syscall exists
17499 set syscall d_syscall
17500 eval $inlibc
17501
17502 : see if prototype for syscall is available
17503 echo " "
17504 set d_syscallproto syscall $i_unistd unistd.h
17505 eval $hasproto
17506
17507 : see if sysconf exists
17508 set sysconf d_sysconf
17509 eval $inlibc
17510
17511 : see if system exists
17512 set system d_system
17513 eval $inlibc
17514
17515 : see if tcgetpgrp exists
17516 set tcgetpgrp d_tcgetpgrp
17517 eval $inlibc
17518
17519 : see if tcsetpgrp exists
17520 set tcsetpgrp d_tcsetpgrp
17521 eval $inlibc
17522
17523 : see if prototype for telldir is available
17524 echo " "
17525 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17526 eval $hasproto
17527
17528 : see if time exists
17529 echo " "
17530 if test "X$d_time" = X -o X"$timetype" = X; then
17531     if set time val -f d_time; eval $csym; $val; then
17532                 echo 'time() found.' >&4
17533                 val="$define"
17534                 rp="What is the type returned by time() on this system?"
17535                 set time_t timetype long stdio.h sys/types.h
17536                 eval $typedef_ask
17537     else
17538                 echo 'time() not found, hope that will do.' >&4
17539                 val="$undef"
17540                 timetype='int';
17541     fi
17542     set d_time
17543     eval $setvar
17544 fi
17545
17546 : see if this is a sys/times.h system
17547 set sys/times.h i_systimes
17548 eval $inhdr
17549
17550 : see if times exists
17551 echo " "
17552 if set times val -f d_times; eval $csym; $val; then
17553         echo 'times() found.' >&4
17554         d_times="$define"
17555         inc=''
17556         case "$i_systimes" in
17557         "$define") inc='sys/times.h';;
17558         esac
17559         rp="What is the type returned by times() on this system?"
17560         set clock_t clocktype long stdio.h sys/types.h $inc
17561         eval $typedef_ask
17562 else
17563         echo 'times() NOT found, hope that will do.' >&4
17564         d_times="$undef"
17565         clocktype='int'
17566 fi
17567
17568 : see if tmpnam_r exists
17569 set tmpnam_r d_tmpnam_r
17570 eval $inlibc
17571 case "$d_tmpnam_r" in
17572 "$define")
17573         hdrs="$i_systypes sys/types.h define stdio.h "
17574         case "$d_tmpnam_r_proto:$usethreads" in
17575         ":define")      d_tmpnam_r_proto=define
17576                 set d_tmpnam_r_proto tmpnam_r $hdrs
17577                 eval $hasproto ;;
17578         *)      ;;
17579         esac
17580         case "$d_tmpnam_r_proto" in
17581         define)
17582         case "$tmpnam_r_proto" in
17583         ''|0) try='char* tmpnam_r(char*);'
17584         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17585         esac
17586         case "$tmpnam_r_proto" in
17587         ''|0)   d_tmpnam_r=undef
17588                 tmpnam_r_proto=0
17589                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17590         * )     case "$tmpnam_r_proto" in
17591                 REENTRANT_PROTO*) ;;
17592                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17593                 esac
17594                 echo "Prototype: $try" ;;
17595         esac
17596         ;;
17597         *)      case "$usethreads" in
17598                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17599                 esac
17600                 d_tmpnam_r=undef
17601                 tmpnam_r_proto=0
17602                 ;;
17603         esac
17604         ;;
17605 *)      tmpnam_r_proto=0
17606         ;;
17607 esac
17608
17609 : see if truncate exists
17610 set truncate d_truncate
17611 eval $inlibc
17612
17613 : see if ttyname_r exists
17614 set ttyname_r d_ttyname_r
17615 eval $inlibc
17616 case "$d_ttyname_r" in
17617 "$define")
17618         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17619         case "$d_ttyname_r_proto:$usethreads" in
17620         ":define")      d_ttyname_r_proto=define
17621                 set d_ttyname_r_proto ttyname_r $hdrs
17622                 eval $hasproto ;;
17623         *)      ;;
17624         esac
17625         case "$d_ttyname_r_proto" in
17626         define)
17627         case "$ttyname_r_proto" in
17628         ''|0) try='int ttyname_r(int, char*, size_t);'
17629         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17630         esac
17631         case "$ttyname_r_proto" in
17632         ''|0) try='int ttyname_r(int, char*, int);'
17633         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17634         esac
17635         case "$ttyname_r_proto" in
17636         ''|0) try='char* ttyname_r(int, char*, int);'
17637         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17638         esac
17639         case "$ttyname_r_proto" in
17640         ''|0)   d_ttyname_r=undef
17641                 ttyname_r_proto=0
17642                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17643         * )     case "$ttyname_r_proto" in
17644                 REENTRANT_PROTO*) ;;
17645                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17646                 esac
17647                 echo "Prototype: $try" ;;
17648         esac
17649         ;;
17650         *)      case "$usethreads" in
17651                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17652                 esac
17653                 d_ttyname_r=undef
17654                 ttyname_r_proto=0
17655                 ;;
17656         esac
17657         ;;
17658 *)      ttyname_r_proto=0
17659         ;;
17660 esac
17661
17662 : see if tzname[] exists
17663 echo " "
17664 if set tzname val -a d_tzname; eval $csym; $val; then
17665         val="$define"
17666         echo 'tzname[] found.' >&4
17667 else
17668         val="$undef"
17669         echo 'tzname[] NOT found.' >&4
17670 fi
17671 set d_tzname
17672 eval $setvar
17673
17674 case "$osname" in
17675 next|rhapsody|darwin) multiarch="$define" ;;
17676 esac
17677 case "$multiarch" in
17678 ''|[nN]*) multiarch="$undef" ;;
17679 esac
17680
17681 : check for ordering of bytes in a UV
17682 echo " "
17683 case "$usecrosscompile$multiarch" in
17684 *$define*)
17685         $cat <<EOM
17686 You seem to be either cross-compiling or doing a multiarchitecture build,
17687 skipping the byteorder check.
17688
17689 EOM
17690         byteorder='ffff'
17691         ;;
17692 *)
17693         case "$byteorder" in
17694         '')
17695                 $cat <<'EOM'
17696 In the following, larger digits indicate more significance.  A big-endian
17697 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17698 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17699 machines may have weird orders like 3412.  A Cray will report 87654321,
17700 an Alpha will report 12345678. If the test program works the default is
17701 probably right.
17702 I'm now running the test program...
17703 EOM
17704                 $cat >try.c <<EOCP
17705 #include <stdio.h>
17706 #$i_stdlib I_STDLIB
17707 #ifdef I_STDLIB
17708 #include <stdlib.h>
17709 #endif
17710 #include <sys/types.h>
17711 typedef $uvtype UV;
17712 int main()
17713 {
17714         int i;
17715         union {
17716                 UV l;
17717                 char c[$uvsize];
17718         } u;
17719
17720         if ($uvsize > 4)
17721                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17722         else
17723                 u.l = (UV)0x04030201;
17724         for (i = 0; i < $uvsize; i++)
17725                 printf("%c", u.c[i]+'0');
17726         printf("\n");
17727         exit(0);
17728 }
17729 EOCP
17730                 xxx_prompt=y
17731                 set try
17732                 if eval $compile && ./try > /dev/null; then
17733                         dflt=`$run ./try`
17734                         case "$dflt" in
17735                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17736                                 echo "(The test program ran ok.)"
17737                                 echo "byteorder=$dflt"
17738                                 xxx_prompt=n
17739                         ;;
17740                         ????|????????) echo "(The test program ran ok.)" ;;
17741                         *) echo "(The test program didn't run right for some reason.)" ;;
17742                         esac
17743                 else
17744                         dflt='4321'
17745                         cat <<'EOM'
17746 (I can't seem to compile the test program.  Guessing big-endian...)
17747 EOM
17748                 fi
17749                 case "$xxx_prompt" in
17750                 y)
17751                         rp="What is the order of bytes in $uvtype?"
17752                         . ./myread
17753                         byteorder="$ans"
17754                         ;;
17755                 *)      byteorder=$dflt
17756                         ;;
17757                 esac
17758                 ;;
17759         esac
17760         $rm -f try.c try
17761         ;;
17762 esac
17763
17764
17765 $cat <<EOM
17766
17767 Checking to see whether you can access character data unalignedly...
17768 EOM
17769 case "$d_u32align" in
17770 '')   $cat >try.c <<EOCP
17771 #include <stdio.h>
17772 #$i_stdlib I_STDLIB
17773 #ifdef I_STDLIB
17774 #include <stdlib.h>
17775 #endif
17776 #define U32 $u32type
17777 #define BYTEORDER 0x$byteorder
17778 #define U8 $u8type
17779 #include <signal.h>
17780 #ifdef SIGBUS
17781 $signal_t bletch(int s) { exit(4); }
17782 #endif
17783 int main() {
17784 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17785     U8 buf[8];
17786     U32 *up;
17787     int i;
17788
17789     if (sizeof(U32) != 4) {
17790         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17791         exit(1);
17792     }
17793
17794     fflush(stdout);
17795
17796 #ifdef SIGBUS
17797     signal(SIGBUS, bletch);
17798 #endif
17799
17800     buf[0] = 0;
17801     buf[1] = 0;
17802     buf[2] = 0;
17803     buf[3] = 1;
17804     buf[4] = 0;
17805     buf[5] = 0;
17806     buf[6] = 0;
17807     buf[7] = 1;
17808
17809     for (i = 0; i < 4; i++) {
17810         up = (U32*)(buf + i);
17811         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17812                (*up == 1 << (8*(3-i)))  /* little-endian */
17813               )
17814            )
17815         {
17816             printf("read failed (%x)\n", *up);
17817             exit(2);
17818         }
17819     }
17820
17821     /* write test */
17822     for (i = 0; i < 4; i++) {
17823         up = (U32*)(buf + i);
17824         *up = 0xBeef;
17825         if (*up != 0xBeef) {
17826             printf("write failed (%x)\n", *up);
17827             exit(3);
17828         }
17829     }
17830
17831     exit(0);
17832 #else
17833     printf("1\n");
17834     exit(1);
17835 #endif
17836     return 0;
17837 }
17838 EOCP
17839 set try
17840 if eval $compile_ok; then
17841         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17842         $run ./try 2>&1 >/dev/null
17843         case "$?" in
17844         0)      cat >&4 <<EOM
17845 You can access character data pretty unalignedly.
17846 EOM
17847                 d_u32align="$undef"
17848                 ;;
17849         *)      cat >&4 <<EOM
17850 It seems that you must access character data in an aligned manner.
17851 EOM
17852                 d_u32align="$define"
17853                 ;;
17854         esac
17855 else
17856         rp='Can you access character data at unaligned addresses?'
17857         dflt='n'
17858         . ./myread
17859         case "$ans" in
17860         [yY]*)  d_u32align="$undef"  ;;
17861         *)      d_u32align="$define" ;;
17862         esac
17863 fi
17864 $rm -f core core.try.* try.core
17865 ;;
17866 esac
17867
17868 : see if ualarm exists
17869 set ualarm d_ualarm
17870 eval $inlibc
17871
17872 : see if umask exists
17873 set umask d_umask
17874 eval $inlibc
17875
17876 : see if unordered exists
17877 set unordered d_unordered
17878 eval $inlibc
17879
17880 : see if unsetenv exists
17881 set unsetenv d_unsetenv
17882 eval $inlibc
17883
17884 : see if usleep exists
17885 set usleep d_usleep
17886 eval $inlibc
17887
17888 : see if prototype for usleep is available
17889 echo " "
17890 set d_usleepproto usleep $i_unistd unistd.h
17891 eval $hasproto
17892
17893 : see if ustat exists
17894 set ustat d_ustat
17895 eval $inlibc
17896
17897 : backward compatibility for d_hvfork
17898 if test X$d_hvfork != X; then
17899         d_vfork="$d_hvfork"
17900         d_hvfork=''
17901 fi
17902 : see if there is a vfork
17903 val=''
17904 set vfork val
17905 eval $inlibc
17906
17907 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17908 : perl on Solaris 2.x, and probably elsewhere.
17909 case "$val" in
17910 $define)
17911         echo " "
17912         case "$usevfork" in
17913         false) dflt='n';;
17914         *) dflt='y';;
17915         esac
17916         cat <<'EOM'
17917  
17918 Perl can only use a vfork() that doesn't suffer from strict
17919 restrictions on calling functions or modifying global data in
17920 the child.  For example, glibc-2.1 contains such a vfork()
17921 that is unsuitable.  If your system provides a proper fork()
17922 call, chances are that you do NOT want perl to use vfork().
17923
17924 EOM
17925         rp="Do you still want to use vfork()?"
17926         . ./myread
17927         case "$ans" in
17928         y|Y) ;;
17929         *)
17930                 echo "Ok, we won't use vfork()."
17931                 val="$undef"
17932                 ;;
17933         esac
17934         ;;
17935 esac
17936 set d_vfork
17937 eval $setvar
17938 case "$d_vfork" in
17939 $define) usevfork='true';;
17940 *) usevfork='false';;
17941 esac
17942
17943 : see if closedir exists
17944 set closedir d_closedir
17945 eval $inlibc
17946
17947 case "$d_closedir" in
17948 "$define")
17949         echo " "
17950         echo "Checking whether closedir() returns a status..." >&4
17951         cat > try.c <<EOM
17952 #$i_dirent I_DIRENT             /**/
17953 #$i_sysdir I_SYS_DIR            /**/
17954 #$i_sysndir I_SYS_NDIR          /**/
17955 #$i_systypes I_SYS_TYPES        /**/
17956
17957 #if defined(I_SYS_TYPES)
17958 #include <sys/types.h>
17959 #endif
17960 #if defined(I_DIRENT)
17961 #include <dirent.h>
17962 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17963 #include <sys/dir.h>
17964 #endif
17965 #else
17966 #ifdef I_SYS_NDIR
17967 #include <sys/ndir.h>
17968 #else
17969 #ifdef I_SYS_DIR
17970 #ifdef hp9000s500
17971 #include <ndir.h>       /* may be wrong in the future */
17972 #else
17973 #include <sys/dir.h>
17974 #endif
17975 #endif
17976 #endif
17977 #endif 
17978 int main() { return closedir(opendir(".")); }
17979 EOM
17980         set try
17981         if eval $compile_ok; then
17982                 if $run ./try > /dev/null 2>&1 ; then
17983                         echo "Yes, it does."
17984                         val="$undef"
17985                 else
17986                         echo "No, it doesn't."
17987                         val="$define"
17988                 fi
17989         else
17990                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17991                 val="$define"
17992         fi
17993         ;;
17994 *)
17995         val="$undef";
17996         ;;
17997 esac
17998 set d_void_closedir
17999 eval $setvar
18000 $rm -f try try.*
18001 : see if there is a wait4
18002 set wait4 d_wait4
18003 eval $inlibc
18004
18005 : see if waitpid exists
18006 set waitpid d_waitpid
18007 eval $inlibc
18008
18009 : see if wcstombs exists
18010 set wcstombs d_wcstombs
18011 eval $inlibc
18012
18013 : see if wctomb exists
18014 set wctomb d_wctomb
18015 eval $inlibc
18016
18017 : see if writev exists
18018 set writev d_writev
18019 eval $inlibc
18020
18021 : preserve RCS keywords in files with variable substitution, grrr
18022 Date='$Date'
18023 Id='$Id'
18024 Log='$Log'
18025 RCSfile='$RCSfile'
18026 Revision='$Revision'
18027
18028 : check for alignment requirements
18029 echo " "
18030 case "$usecrosscompile$multiarch" in
18031 *$define*)
18032         $cat <<EOM
18033 You seem to be either cross-compiling or doing a multiarchitecture build,
18034 skipping the memory alignment check.
18035
18036 EOM
18037         case "$alignbytes" in
18038         '') alignbytes=8 ;;
18039         esac
18040         ;;
18041 *)
18042         case "$alignbytes" in
18043         '') echo "Checking alignment constraints..." >&4
18044                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18045                         $cat >try.c <<'EOCP'
18046 typedef long double NV;
18047 EOCP
18048                 else
18049                         $cat >try.c <<'EOCP'
18050 typedef double NV;
18051 EOCP
18052                 fi
18053                 $cat >>try.c <<'EOCP'
18054 #include <stdio.h>
18055 struct foobar {
18056         char foo;
18057         NV bar;
18058 } try_algn;
18059 int main()
18060 {
18061     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18062     return(0);
18063 }
18064 EOCP
18065                 set try
18066                 if eval $compile_ok; then
18067                         dflt=`$run ./try`
18068                 else
18069                         dflt='8'
18070                         echo "(I can't seem to compile the test program...)"
18071                 fi
18072                 ;;
18073         *) dflt="$alignbytes"
18074                 ;;
18075         esac
18076         rp="Doubles must be aligned on a how-many-byte boundary?"
18077         . ./myread
18078         alignbytes="$ans"
18079         $rm -f try.c try
18080         ;;
18081 esac
18082
18083
18084 : set the base revision
18085 baserev=5.0
18086
18087 : how do we concatenate cpp tokens here?
18088 echo " "
18089 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18090 $cat >cpp_stuff.c <<'EOCP'
18091 #define RCAT(a,b)a/**/b
18092 #define ACAT(a,b)a ## b
18093 RCAT(Rei,ser)
18094 ACAT(Cir,cus)
18095 EOCP
18096 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18097 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18098         echo "Oh!  Smells like ANSI's been here." >&4
18099         echo "We can catify or stringify, separately or together!"
18100         cpp_stuff=42
18101 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18102         echo "Ah, yes!  The good old days!" >&4
18103         echo "However, in the good old days we don't know how to stringify and"
18104         echo "catify at the same time."
18105         cpp_stuff=1
18106 else
18107         $cat >&4 <<EOM
18108 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18109 You're going to have to edit the values of CAT[2-5] in config.h...
18110 EOM
18111         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18112 fi
18113 $rm -f cpp_stuff.*
18114
18115 : see if this is a db.h system
18116 set db.h i_db
18117 eval $inhdr
18118
18119 case "$i_db" in
18120 $define)
18121         : Check db version.
18122         echo " "
18123         echo "Checking Berkeley DB version ..." >&4
18124         $cat >try.c <<EOCP
18125 #$d_const HASCONST
18126 #ifndef HASCONST
18127 #define const
18128 #endif
18129 #include <sys/types.h>
18130 #include <stdio.h>
18131 #$i_stdlib I_STDLIB
18132 #ifdef I_STDLIB
18133 #include <stdlib.h>
18134 #endif
18135 #include <db.h>
18136 int main(int argc, char *argv[])
18137 {
18138 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18139     int Major, Minor, Patch ;
18140     unsigned long Version ;
18141     (void)db_version(&Major, &Minor, &Patch) ;
18142     if (argc == 2) {
18143         printf("%d %d %d %d %d %d\n",
18144                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18145                Major, Minor, Patch);
18146         exit(0);
18147     }
18148     printf("You have Berkeley DB Version 2 or greater.\n");
18149
18150     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18151                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18152     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18153                 Major, Minor, Patch) ;
18154
18155     /* check that db.h & libdb are compatible */
18156     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18157         printf("db.h and libdb are incompatible.\n") ;
18158         exit(3);        
18159     }
18160
18161     printf("db.h and libdb are compatible.\n") ;
18162
18163     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18164                 + DB_VERSION_PATCH ;
18165
18166     /* needs to be >= 2.3.4 */
18167     if (Version < 2003004) {
18168     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18169         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18170         exit(2);        
18171     }
18172
18173     exit(0);
18174 #else
18175 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18176     if (argc == 2) {
18177         printf("1 0 0\n");
18178         exit(0);
18179     }
18180     printf("You have Berkeley DB Version 1.\n");
18181     exit(0);    /* DB version < 2: the coast is clear. */
18182 #else
18183     exit(1);    /* <db.h> not Berkeley DB? */
18184 #endif
18185 #endif
18186 }
18187 EOCP
18188         set try
18189         if eval $compile_ok && $run ./try; then
18190                 echo 'Looks OK.' >&4
18191                 set `$run ./try 1`
18192                 db_version_major=$1
18193                 db_version_minor=$2
18194                 db_version_patch=$3
18195         else
18196                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18197                 i_db=$undef
18198                 case " $libs " in
18199                 *"-ldb "*)
18200                         : Remove db from list of libraries to use
18201                         echo "Removing unusable -ldb from library list" >&4
18202                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18203                         shift
18204                         libs="$*"
18205                         echo "libs = $libs" >&4
18206                         ;;
18207                 esac
18208         fi
18209         $rm -f try.*
18210         ;;
18211 esac
18212
18213 case "$i_db" in
18214 define)
18215         : Check the return type needed for hash 
18216         echo " "
18217         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18218         $cat >try.c <<EOCP
18219 #$d_const HASCONST
18220 #ifndef HASCONST
18221 #define const
18222 #endif
18223 #include <sys/types.h>
18224 #include <db.h>
18225
18226 #ifndef DB_VERSION_MAJOR
18227 u_int32_t hash_cb (ptr, size)
18228 const void *ptr;
18229 size_t size;
18230 {
18231 }
18232 HASHINFO info;
18233 int main()
18234 {
18235         info.hash = hash_cb;
18236 }
18237 #endif
18238 EOCP
18239         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18240                 if $contains warning try.out >>/dev/null 2>&1 ; then
18241                         db_hashtype='int'
18242                 else
18243                         db_hashtype='u_int32_t'
18244                 fi
18245         else
18246                 : XXX Maybe we should just give up here.
18247                 db_hashtype=u_int32_t
18248                 $cat try.out >&4
18249                 echo "Help:  I can't seem to compile the db test program." >&4
18250                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18251         fi
18252         $rm -f try.*
18253         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18254         ;;
18255 *)      db_hashtype=u_int32_t
18256         ;;
18257 esac
18258 case "$i_db" in
18259 define)
18260         : Check the return type needed for prefix 
18261         echo " "
18262         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18263         cat >try.c <<EOCP
18264 #$d_const HASCONST
18265 #ifndef HASCONST
18266 #define const
18267 #endif
18268 #include <sys/types.h>
18269 #include <db.h>
18270
18271 #ifndef DB_VERSION_MAJOR
18272 size_t prefix_cb (key1, key2)
18273 const DBT *key1;
18274 const DBT *key2;
18275 {
18276 }
18277 BTREEINFO info;
18278 int main()
18279 {
18280         info.prefix = prefix_cb;
18281 }
18282 #endif
18283 EOCP
18284         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18285                 if $contains warning try.out >>/dev/null 2>&1 ; then
18286                         db_prefixtype='int'
18287                 else
18288                         db_prefixtype='size_t'
18289                 fi
18290         else
18291                 db_prefixtype='size_t'
18292                 : XXX Maybe we should just give up here.
18293                 $cat try.out >&4
18294                 echo "Help:  I can't seem to compile the db test program." >&4
18295                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18296         fi
18297         $rm -f try.*
18298         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18299         ;;
18300 *)      db_prefixtype='size_t'
18301         ;;
18302 esac
18303
18304
18305 : How can we generate normalized random numbers ?
18306 echo " "
18307 echo "Looking for a random number function..." >&4
18308 case "$randfunc" in
18309 '')
18310         if set drand48 val -f; eval $csym; $val; then
18311                 dflt="drand48"
18312                 echo "Good, found drand48()." >&4
18313         elif set random val -f; eval $csym; $val; then
18314                 dflt="random"
18315                 echo "OK, found random()." >&4
18316         else
18317                 dflt="rand"
18318                 echo "Yick, looks like I have to use rand()." >&4
18319         fi
18320         echo " "
18321         ;;
18322 *)
18323         dflt="$randfunc"
18324         ;;
18325 esac
18326 cont=true
18327
18328 case "$ccflags" in
18329 *-Dmy_rand=*|*-Dmy_srand=*)
18330         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18331         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18332         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18333         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18334         ;;
18335 esac
18336
18337 while $test "$cont"; do
18338         rp="Use which function to generate random numbers?"
18339         . ./myread
18340         if $test "$ans" = "$dflt"; then
18341                 : null
18342         else
18343                 randbits=''
18344         fi
18345         randfunc="$ans"
18346         if set $ans val -f; eval $csym; $val; then
18347                 cont=''
18348         else
18349                 dflt=y
18350                 rp="I cannot find function $ans. Use that name anyway?"
18351                 . ./myread
18352                 dflt=rand
18353                 case "$ans" in
18354                         [yY]*) cont='';;
18355                 esac
18356         fi
18357         case "$cont" in
18358         '')
18359                 case "$randfunc" in
18360                 drand48)
18361                         drand01="drand48()"
18362                         seedfunc="srand48"
18363                         randbits=48
18364                         randseedtype=long
18365                         ;;
18366                 rand|random)
18367                         case "$randbits" in
18368                         '')
18369 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18370                                 $cat >try.c <<EOCP
18371 #$i_unistd I_UNISTD
18372 #$i_stdlib I_STDLIB
18373 #include <stdio.h>
18374 #ifdef I_UNISTD
18375 #  include <unistd.h>
18376 #endif
18377 #ifdef I_STDLIB
18378 #  include <stdlib.h>
18379 #endif
18380 int main()
18381 {
18382         register int i;
18383         register unsigned long tmp;
18384         register unsigned long max = 0L;
18385
18386         for (i = 1000; i; i--) {
18387                 tmp = (unsigned long) $randfunc();
18388                 if (tmp > max) max = tmp;
18389         }
18390         for (i = 0; max; i++)
18391                 max /= 2;
18392         printf("%d\n",i);
18393 }
18394 EOCP
18395                                 set try
18396                                 if eval $compile_ok; then
18397                                         dflt=`try`
18398                                 else
18399                                         dflt='?'
18400                                         echo "(I can't seem to compile the test program...)"
18401                                 fi
18402                                 ;;
18403                         *)
18404                                 dflt="$randbits"
18405                                 ;;
18406                         esac
18407                         rp="How many bits does your $randfunc() function produce?"
18408                         . ./myread
18409                         randbits="$ans"
18410                         $rm -f try.c try
18411                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18412                         seedfunc="s$randfunc"
18413                         randseedtype=unsigned
18414                         ;;
18415                 *)
18416                         dflt="31"
18417                         rp="How many bits does your $randfunc() function produce?"
18418                         . ./myread
18419                         randbits="$ans"
18420                         seedfunc="s$randfunc"
18421                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18422                         if set $seedfunc val -f; eval $csym; $val; then
18423                                 echo "(Using $seedfunc() to seed random generator)"
18424                         else
18425                                 echo "(Warning: no $seedfunc() to seed random generator)"
18426                                 seedfunc=rand
18427                         fi
18428                         randseedtype=unsigned
18429                         ;;
18430                 esac
18431                 ;;
18432         esac
18433 done
18434
18435 echo " "
18436 echo "Determining whether or not we are on an EBCDIC system..." >&4
18437 $cat >try.c <<'EOM'
18438 int main()
18439 {
18440   if ('M'==0xd4) return 0;
18441   return 1;
18442 }
18443 EOM
18444
18445 val=$undef
18446 set try
18447 if eval $compile_ok; then
18448         if $run ./try; then
18449                 echo "You seem to speak EBCDIC." >&4
18450                 val="$define"
18451         else
18452                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18453         fi
18454 else
18455         echo "I'm unable to compile the test program." >&4
18456         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18457 fi
18458 $rm -f try try.*
18459 set ebcdic
18460 eval $setvar
18461
18462 echo " "
18463 $cat >&4 <<EOM
18464 Checking how to flush all pending stdio output...
18465 EOM
18466 # I only know how to find the first 32 possibly open files on SunOS.
18467 # See also hints/sunos_4_1.sh and util.c  --AD
18468 case "$osname" in
18469 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18470 esac
18471 $cat >>try.c <<EOCP
18472 #include <stdio.h>
18473 #$i_stdlib I_STDLIB
18474 #ifdef I_STDLIB
18475 #include <stdlib.h>
18476 #endif
18477 #$i_unistd I_UNISTD
18478 #ifdef I_UNISTD
18479 # include <unistd.h>
18480 #endif
18481 #$d_sysconf HAS_SYSCONF
18482 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18483 #ifdef HAS_STDIO_STREAM_ARRAY
18484 # define STDIO_STREAM_ARRAY $stdio_stream_array
18485 #endif
18486 int main() {
18487   FILE* p;
18488   unlink("try.out");
18489   p = fopen("try.out", "w");
18490 #ifdef TRY_FPUTC
18491   fputc('x', p);
18492 #else
18493 # ifdef TRY_FPRINTF
18494   fprintf(p, "x");
18495 # endif
18496 #endif
18497 #ifdef TRY_FFLUSH_NULL
18498   fflush(NULL);
18499 #endif
18500 #ifdef TRY_FFLUSH_ALL
18501   {
18502     long open_max = -1;
18503 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18504     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18505 # else
18506 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18507     open_max = sysconf(_SC_OPEN_MAX);
18508 #  else
18509 #   ifdef FOPEN_MAX
18510     open_max = FOPEN_MAX;
18511 #   else
18512 #    ifdef OPEN_MAX
18513     open_max = OPEN_MAX;
18514 #    else
18515 #     ifdef _NFILE
18516     open_max = _NFILE;
18517 #     endif
18518 #    endif
18519 #   endif
18520 #  endif
18521 # endif 
18522 # ifdef HAS_STDIO_STREAM_ARRAY
18523     if (open_max > 0) {
18524       long i;
18525       for (i = 0; i < open_max; i++)
18526             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18527                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18528                 STDIO_STREAM_ARRAY[i]._flag)
18529                 fflush(&STDIO_STREAM_ARRAY[i]);
18530     }   
18531   }
18532 # endif
18533 #endif
18534   _exit(42);
18535 }
18536 EOCP
18537 : first we have to find out how _not_ to flush
18538 $to try.c
18539 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18540     output=''
18541     set try -DTRY_FPUTC
18542     if eval $compile; then
18543             $run ./try 2>/dev/null
18544             code="$?"
18545             $from try.out
18546             if $test ! -s try.out -a "X$code" = X42; then
18547                 output=-DTRY_FPUTC
18548             fi
18549     fi
18550     case "$output" in
18551     '')
18552             set try -DTRY_FPRINTF
18553             if eval $compile; then
18554                     $run ./try 2>/dev/null
18555                     code="$?"
18556                     $from try.out
18557                     if $test ! -s try.out -a "X$code" = X42; then
18558                         output=-DTRY_FPRINTF
18559                     fi
18560             fi
18561         ;;
18562     esac
18563 fi
18564 : check for fflush NULL behaviour
18565 case "$fflushNULL" in
18566 '')     set try -DTRY_FFLUSH_NULL $output
18567         if eval $compile; then
18568                 $run ./try 2>/dev/null
18569                 code="$?"
18570                 $from try.out
18571                 if $test -s try.out -a "X$code" = X42; then
18572                         fflushNULL="`$cat try.out`"
18573                 else
18574                         if $test "X$code" != X42; then
18575                                 $cat >&4 <<EOM
18576 (If this test failed, don't worry, we'll try another method shortly.)
18577 EOM
18578                         fi
18579                 fi
18580         fi
18581         $rm -f core try.core core.try.*
18582         case "$fflushNULL" in
18583         x)      $cat >&4 <<EOM
18584 Your fflush(NULL) works okay for output streams.
18585 Let's see if it clobbers input pipes...
18586 EOM
18587 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18588 # bug that improperly flushes the input end of pipes.  So we avoid the
18589 # autoflush on fork/system/exec support for now. :-(
18590 $cat >tryp.c <<EOCP
18591 #include <stdio.h>
18592 int
18593 main(int argc, char **argv)
18594 {
18595     char buf[1024];
18596     int i;
18597     char *bp = buf;
18598     while (1) {
18599         while ((i = getc(stdin)) != -1
18600                && (*bp++ = i) != '\n'
18601                && bp < &buf[1024])
18602         /* DO NOTHING */ ;
18603         *bp = '\0';
18604         fprintf(stdout, "%s", buf);
18605         fflush(NULL);
18606         if (i == -1)
18607             return 0;
18608         bp = buf;
18609     }
18610 }
18611 EOCP
18612                 fflushNULL="$define"
18613                 set tryp
18614                 if eval $compile; then
18615                     $rm -f tryp.out
18616                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18617                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18618                        $cat >&4 <<EOM
18619 fflush(NULL) seems to behave okay with input streams.
18620 EOM
18621                         fflushNULL="$define"
18622                     else
18623                         $cat >&4 <<EOM
18624 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18625 EOM
18626                         fflushNULL="$undef"
18627                     fi
18628                 fi
18629                 $rm -f core tryp.c tryp.core core.tryp.*
18630                 ;;
18631         '')     $cat >&4 <<EOM
18632 Your fflush(NULL) isn't working (contrary to ANSI C).
18633 EOM
18634                 fflushNULL="$undef"
18635                 ;;
18636         *)      $cat >&4 <<EOM
18637 Cannot figure out whether your fflush(NULL) works or not.
18638 I'm assuming it doesn't (contrary to ANSI C).
18639 EOM
18640                 fflushNULL="$undef"
18641                 ;;
18642         esac
18643         ;;
18644 $define|true|[yY]*)
18645         fflushNULL="$define"
18646         ;;
18647 *)
18648         fflushNULL="$undef"
18649         ;;
18650 esac
18651 : check explicit looping only if NULL did not work, and if the pipe
18652 : bug does not show up on an explicit flush too
18653 case "$fflushNULL" in
18654 "$undef")
18655         $cat >tryp.c <<EOCP
18656 #include <stdio.h>
18657 int
18658 main(int argc, char **argv)
18659 {
18660     char buf[1024];
18661     int i;
18662     char *bp = buf;
18663     while (1) {
18664         while ((i = getc(stdin)) != -1
18665                && (*bp++ = i) != '\n'
18666                && bp < &buf[1024])
18667         /* DO NOTHING */ ;
18668         *bp = '\0';
18669         fprintf(stdout, "%s", buf);
18670         fflush(stdin);
18671         if (i == -1)
18672             return 0;
18673         bp = buf;
18674     }
18675 }
18676 EOCP
18677         set tryp
18678         if eval $compile; then
18679             $rm -f tryp.out
18680             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18681             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18682                $cat >&4 <<EOM
18683 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18684 EOM
18685                 : now check for fflushall behaviour
18686                 case "$fflushall" in
18687                 '')     set try -DTRY_FFLUSH_ALL $output
18688                         if eval $compile; then
18689                                 $cat >&4 <<EOM
18690 (Now testing the other method--but note that this also may fail.)
18691 EOM
18692                                 $run ./try 2>/dev/null
18693                                 code=$?
18694                                 $from try.out
18695                                 if $test -s try.out -a "X$code" = X42; then
18696                                         fflushall="`$cat try.out`"
18697                                 fi
18698                         fi
18699                         $rm -f core try.core core.try.*
18700                         case "$fflushall" in
18701                         x)      $cat >&4 <<EOM
18702 Whew. Flushing explicitly all the stdio streams works.
18703 EOM
18704                                 fflushall="$define"
18705                                 ;;
18706                         '')     $cat >&4 <<EOM
18707 Sigh. Flushing explicitly all the stdio streams doesn't work.
18708 EOM
18709                                 fflushall="$undef"
18710                                 ;;
18711                         *)      $cat >&4 <<EOM
18712 Cannot figure out whether flushing stdio streams explicitly works or not.
18713 I'm assuming it doesn't.
18714 EOM
18715                                 fflushall="$undef"
18716                                 ;;
18717                         esac
18718                         ;;
18719                 "$define"|true|[yY]*)
18720                         fflushall="$define"
18721                         ;;
18722                 *)
18723                         fflushall="$undef"
18724                         ;;
18725                 esac
18726             else
18727                 $cat >&4 <<EOM
18728 All is futile.  Even fflush(stdin) clobbers input pipes!
18729 EOM
18730                 fflushall="$undef"
18731             fi
18732         else
18733             fflushall="$undef"
18734         fi
18735         $rm -f core tryp.c tryp.core core.tryp.*
18736         ;;
18737 *)      fflushall="$undef"
18738         ;;
18739 esac
18740
18741 case "$fflushNULL$fflushall" in
18742 undefundef)
18743         $cat <<EOM
18744 OK, I give up.  I cannot figure out how to flush pending stdio output.
18745 We won't be flushing handles at all before fork/exec/popen.
18746 EOM
18747         ;;
18748 esac
18749 $rm -f try.* try$exe_ext
18750
18751 : Store the full pathname to the ar program for use in the C program
18752 : Respect a hint or command line value for full_ar.
18753 case "$full_ar" in
18754 '') full_ar=$ar ;;
18755 esac
18756
18757 : Store the full pathname to the sed program for use in the C program
18758 full_sed=$sed
18759
18760 : see what type gids are declared as in the kernel
18761 echo " "
18762 echo "Looking for the type for group ids returned by getgid()."
18763 set gid_t gidtype xxx stdio.h sys/types.h
18764 eval $typedef
18765 case "$gidtype" in
18766 xxx)
18767         xxx=`./findhdr sys/user.h`
18768         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18769         case $1 in
18770         unsigned) dflt="$1 $2" ;;
18771         *) dflt="$1" ;;
18772         esac
18773         ;;
18774 *) dflt="$gidtype";;
18775 esac
18776 case "$gidtype" in
18777 gid_t) echo "gid_t found." ;;
18778 *)      rp="What is the type for group ids returned by getgid()?"
18779         . ./myread
18780         gidtype="$ans"
18781         ;;
18782 esac
18783
18784 echo " "
18785 case "$gidtype" in
18786 *_t) zzz="$gidtype"     ;;
18787 *)   zzz="gid"          ;;
18788 esac
18789 echo "Checking the size of $zzz..." >&4 
18790 cat > try.c <<EOCP
18791 #include <sys/types.h>
18792 #include <stdio.h>
18793 #$i_stdlib I_STDLIB
18794 #ifdef I_STDLIB
18795 #include <stdlib.h>
18796 #endif
18797 int main() {
18798     printf("%d\n", (int)sizeof($gidtype));
18799     exit(0);
18800 }
18801 EOCP
18802 set try
18803 if eval $compile_ok; then
18804         yyy=`$run ./try`
18805         case "$yyy" in
18806         '')     gidsize=4
18807                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18808                 ;;
18809         *)      gidsize=$yyy
18810                 echo "Your $zzz is $gidsize bytes long."
18811                 ;;
18812         esac
18813 else
18814         gidsize=4
18815         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18816 fi
18817
18818
18819 echo " "
18820 case "$gidtype" in
18821 *_t) zzz="$gidtype"     ;;
18822 *)   zzz="gid"          ;;
18823 esac
18824 echo "Checking the sign of $zzz..." >&4 
18825 cat > try.c <<EOCP
18826 #include <sys/types.h>
18827 #include <stdio.h>
18828 int main() {
18829         $gidtype foo = -1;
18830         if (foo < 0)
18831                 printf("-1\n");
18832         else
18833                 printf("1\n");
18834 }
18835 EOCP
18836 set try
18837 if eval $compile; then
18838         yyy=`$run ./try`
18839         case "$yyy" in
18840         '')     gidsign=1
18841                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18842                 ;;
18843         *)      gidsign=$yyy
18844                 case "$gidsign" in
18845                  1) echo "Your $zzz is unsigned." ;;
18846                 -1) echo "Your $zzz is signed."   ;;
18847                 esac
18848                 ;;
18849         esac
18850 else
18851         gidsign=1
18852         echo "(I can't compile the test program--guessing unsigned.)" >&4
18853 fi
18854
18855
18856 echo " "
18857
18858 if $test X"$quadtype" != X; then
18859
18860 echo "Checking how to print 64-bit integers..." >&4
18861
18862 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18863         $cat >try.c <<'EOCP'
18864 #include <sys/types.h>
18865 #include <stdio.h>
18866 int main() {
18867   int q = 12345678901;
18868   printf("%ld\n", q);
18869 }
18870 EOCP
18871         set try
18872         if eval $compile; then
18873                 yyy=`$run ./try`
18874                 case "$yyy" in
18875                 12345678901)
18876                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18877                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18878                         echo "We will use %d."
18879                         ;;
18880                 esac
18881         fi
18882 fi
18883
18884 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18885         $cat >try.c <<'EOCP'
18886 #include <sys/types.h>
18887 #include <stdio.h>
18888 int main() {
18889   long q = 12345678901;
18890   printf("%ld\n", q);
18891 }
18892 EOCP
18893         set try
18894         if eval $compile; then
18895                 yyy=`$run ./try`
18896                 case "$yyy" in
18897                 12345678901)
18898                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18899                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18900                         echo "We will use %ld."
18901                         ;;
18902                 esac
18903         fi
18904 fi
18905
18906 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18907         $cat >try.c <<'EOCP'
18908 #include <sys/types.h>
18909 #include <inttypes.h>
18910 #include <stdio.h>
18911 int main() {
18912   int64_t q = 12345678901;
18913   printf("%" PRId64 "\n", q);
18914 }
18915 EOCP
18916         set try
18917         if eval $compile; then
18918                 yyy=`$run ./try`
18919                 case "$yyy" in
18920                 12345678901)
18921                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18922                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18923                         echo "We will use the C9X style."
18924                         ;;
18925                 esac
18926         fi
18927 fi
18928
18929 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18930         $cat >try.c <<EOCP
18931 #include <sys/types.h>
18932 #include <stdio.h>
18933 int main() {
18934   $quadtype q = 12345678901;
18935   printf("%Ld\n", q);
18936 }
18937 EOCP
18938         set try
18939         if eval $compile; then
18940                 yyy=`$run ./try`
18941                 case "$yyy" in
18942                 12345678901)
18943                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18944                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18945                         echo "We will use %Ld."
18946                         ;;
18947                 esac
18948         fi
18949 fi
18950
18951 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18952         $cat >try.c <<'EOCP'
18953 #include <sys/types.h>
18954 #include <stdio.h>
18955 int main() {
18956   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18957   printf("%lld\n", q);
18958 }
18959 EOCP
18960         set try
18961         if eval $compile; then
18962                 yyy=`$run ./try`
18963                 case "$yyy" in
18964                 12345678901)
18965                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18966                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18967                         echo "We will use the %lld style."
18968                         ;;
18969                 esac
18970         fi
18971 fi
18972
18973 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18974         $cat >try.c <<EOCP
18975 #include <sys/types.h>
18976 #include <stdio.h>
18977 int main() {
18978   $quadtype q = 12345678901;
18979   printf("%qd\n", q);
18980 }
18981 EOCP
18982         set try
18983         if eval $compile; then
18984                 yyy=`$run ./try`
18985                 case "$yyy" in
18986                 12345678901)
18987                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18988                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18989                         echo "We will use %qd."
18990                         ;;
18991                 esac
18992         fi
18993 fi
18994
18995 if $test X"$sPRId64" = X; then
18996         echo "Cannot figure out how to print 64-bit integers." >&4
18997 fi
18998
18999 $rm -f try try.*
19000
19001 fi
19002
19003 case "$sPRId64" in
19004 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19005         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19006         ;;
19007 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19008         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19009         ;;
19010 esac
19011
19012
19013 echo " "
19014 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19015
19016 if $test X"$ivsize" = X8; then
19017         ivdformat="$sPRId64"
19018         uvuformat="$sPRIu64"
19019         uvoformat="$sPRIo64"
19020         uvxformat="$sPRIx64"
19021         uvXUformat="$sPRIXU64"
19022 else
19023         if $test X"$ivsize" = X"$longsize"; then
19024                 ivdformat='"ld"'
19025                 uvuformat='"lu"'
19026                 uvoformat='"lo"'
19027                 uvxformat='"lx"'
19028                 uvXUformat='"lX"'
19029         else
19030                 if $test X"$ivsize" = X"$intsize"; then
19031                         ivdformat='"d"'
19032                         uvuformat='"u"'
19033                         uvoformat='"o"'
19034                         uvxformat='"x"'
19035                         uvXUformat='"X"'
19036                 else
19037                         : far out
19038                         if $test X"$ivsize" = X"$shortsize"; then
19039                                 ivdformat='"hd"'
19040                                 uvuformat='"hu"'
19041                                 uvoformat='"ho"'
19042                                 uvxformat='"hx"'
19043                                 uvXUformat='"hX"'
19044                         fi
19045                 fi
19046         fi
19047 fi
19048
19049 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19050         nveformat="$sPRIeldbl"
19051         nvfformat="$sPRIfldbl"
19052         nvgformat="$sPRIgldbl"
19053         nvEUformat="$sPRIEUldbl"
19054         nvFUformat="$sPRIFUldbl"
19055         nvGUformat="$sPRIGUldbl"
19056 else
19057         nveformat='"e"'
19058         nvfformat='"f"'
19059         nvgformat='"g"'
19060         nvEUformat='"E"'
19061         nvFUformat='"F"'
19062         nvGUformat='"G"'
19063 fi
19064
19065 case "$ivdformat" in
19066 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19067     exit 1
19068     ;;
19069 esac
19070
19071
19072 echo " "
19073 $echo "Checking the format string to be used for gids..." >&4
19074
19075 case "$gidsign" in
19076 -1)     if $test X"$gidsize" = X"$ivsize"; then
19077                 gidformat="$ivdformat"
19078         else
19079                 if $test X"$gidsize" = X"$longsize"; then
19080                         gidformat='"ld"'
19081                 else
19082                         if $test X"$gidsize" = X"$intsize"; then
19083                                 gidformat='"d"'
19084                         else
19085                                 if $test X"$gidsize" = X"$shortsize"; then
19086                                         gidformat='"hd"'
19087                                 fi
19088                         fi
19089                 fi
19090         fi
19091         ;;
19092 *)      if $test X"$gidsize" = X"$uvsize"; then
19093                 gidformat="$uvuformat"
19094         else
19095                 if $test X"$gidsize" = X"$longsize"; then
19096                         gidformat='"lu"'
19097                 else
19098                         if $test X"$gidsize" = X"$intsize"; then
19099                                 gidformat='"u"'
19100                         else
19101                                 if $test X"$gidsize" = X"$shortsize"; then
19102                                         gidformat='"hu"'
19103                                 fi
19104                         fi
19105                 fi
19106         fi
19107         ;;
19108 esac
19109
19110 : see if getgroups exists
19111 set getgroups d_getgrps
19112 eval $inlibc
19113
19114 : see if setgroups exists
19115 set setgroups d_setgrps
19116 eval $inlibc
19117
19118
19119 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19120 echo " "
19121 case "$d_getgrps$d_setgrps" in
19122 *define*)
19123         case "$groupstype" in
19124         '') dflt="$gidtype" ;;
19125         *)  dflt="$groupstype" ;;
19126         esac
19127         $cat <<EOM
19128 What type of pointer is the second argument to getgroups() and setgroups()?
19129 Usually this is the same as group ids, $gidtype, but not always.
19130
19131 EOM
19132         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19133         . ./myread
19134         groupstype="$ans"
19135         ;;
19136 *)  groupstype="$gidtype";;
19137 esac
19138
19139
19140 if $test $patchlevel -lt 9; then
19141 : MAD is not available in 5.8.x or earlier.
19142     ans=n;
19143 else
19144     case "$mad" in
19145     $define|true|[yY]*) dflt='y' ;;
19146     *)                  dflt='n' ;;
19147     esac
19148     cat <<EOM
19149
19150 Would you like to build with Misc Attribute Decoration? This is development
19151 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19152 overhead on the interpreter.
19153
19154 If this doesn't make any sense to you, just accept the default '$dflt'.
19155 EOM
19156     rp='Build Perl with MAD?'
19157     . ./myread
19158 fi
19159 case "$ans" in
19160 y|Y)    val="$define"
19161         madlyh='madly.h madly.act madly.tab'
19162         madlysrc='madly.c'
19163         madlyobj="madly$_o" ;;
19164 *)      val="$undef"
19165         madlyh=''
19166         madlysrc=''
19167         madlyobj='' ;;
19168 esac
19169 set mad
19170 eval $setvar
19171
19172 echo " "
19173 echo "Checking if your $make program sets \$(MAKE)..." >&4
19174 case "$make_set_make" in
19175 '')
19176         $sed 's/^X //' > testmake.mak << 'EOF'
19177 Xall:
19178 X       @echo 'maketemp="$(MAKE)"'
19179 EOF
19180         case "`$make -f testmake.mak 2>/dev/null`" in
19181         *maketemp=*) make_set_make='#' ;;
19182         *)      make_set_make="MAKE=$make" ;;
19183         esac
19184         $rm -f testmake.mak
19185         ;;
19186 esac
19187 case "$make_set_make" in
19188 '#') echo "Yup, it does.";;
19189 *) echo "Nope, it doesn't.";;
19190 esac
19191
19192 : see what type is used for mode_t
19193 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19194 set mode_t modetype int stdio.h sys/types.h
19195 eval $typedef_ask
19196
19197 : see if we need va_copy
19198 echo " "
19199 case "$i_stdarg" in
19200 "$define")
19201         $cat >try.c <<EOCP
19202 #include <stdarg.h>
19203 #include <stdio.h>
19204 #$i_stdlib I_STDLIB
19205 #ifdef I_STDLIB
19206 #include <stdlib.h>
19207 #endif
19208 #include <signal.h>
19209
19210 int
19211 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19212 {
19213   return vfprintf(f, fmt, *valp);
19214 }
19215  
19216 int    
19217 myvfprintf(FILE *f, const  char *fmt, va_list val)
19218 {
19219   return ivfprintf(f, fmt, &val);
19220 }
19221       
19222 int
19223 myprintf(char *fmt, ...) 
19224 {
19225   va_list val;
19226   va_start(val, fmt);
19227   return myvfprintf(stdout, fmt, val); 
19228 }         
19229
19230 int
19231 main(int ac, char **av)
19232 {
19233   signal(SIGSEGV, exit);
19234
19235   myprintf("%s%cs all right, then\n", "that", '\'');                            
19236   exit(0);      
19237 }
19238 EOCP
19239         set try
19240         if eval $compile && $run ./try 2>&1 >/dev/null; then
19241                 case "`$run ./try`" in
19242                 "that's all right, then")
19243                         okay=yes
19244                         ;;
19245                 esac
19246         fi
19247         case "$okay" in
19248         yes)    echo "It seems that you don't need va_copy()." >&4
19249                 need_va_copy="$undef"
19250                 ;;
19251         *)      echo "It seems that va_copy() or similar will be needed." >&4
19252                 need_va_copy="$define"
19253                 ;;
19254         esac
19255         $rm -f try.* core core.* *.core *.core.*
19256         ;;
19257 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19258         ;;
19259 esac
19260
19261 : see what type is used for size_t
19262 rp="What is the type used for the length parameter for string functions?"
19263 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19264 eval $typedef_ask
19265
19266 : check for type of arguments to gethostbyaddr. 
19267 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19268         case "$d_gethbyaddr" in
19269         $define)
19270                 $cat <<EOM
19271
19272 Checking to see what type of arguments are accepted by gethostbyaddr().
19273 EOM
19274                 hdrs="$define sys/types.h
19275                         $d_socket sys/socket.h 
19276                         $i_niin netinet/in.h 
19277                         $i_netdb netdb.h
19278                         $i_unistd unistd.h"
19279                 : The first arg can 'char *' or 'void *'
19280                 : The second arg is some of integral type
19281                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19282                         for yyy in size_t long int; do
19283                                 case "$netdb_host_type" in
19284                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19285                                         if ./protochk "$try" $hdrs; then
19286                                                 echo "Your system accepts $xxx for the first arg."
19287                                                 echo "...and $yyy for the second arg."
19288                                                 netdb_host_type="$xxx"
19289                                                 netdb_hlen_type="$yyy"
19290                                         fi
19291                                         ;;
19292                                 esac
19293                         done
19294                 done
19295                 : In case none of those worked, prompt the user.
19296                 case "$netdb_host_type" in
19297                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19298                         dflt='char *'
19299                         . ./myread
19300                         netdb_host_type=$ans
19301                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19302                         dflt="$sizetype"
19303                         . ./myread
19304                         netdb_hlen_type=$ans
19305                         ;;
19306                 esac
19307                 ;;
19308         *)      : no gethostbyaddr, so pick harmless defaults
19309                 netdb_host_type='char *'
19310                 netdb_hlen_type="$sizetype"
19311                 ;;
19312         esac
19313         # Remove the "const" if needed. -- but then we'll have a 
19314         # prototype clash!
19315         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19316 fi
19317
19318 : check for type of argument to gethostbyname. 
19319 if test "X$netdb_name_type" = X ; then
19320         case "$d_gethbyname" in
19321         $define)
19322                 $cat <<EOM
19323
19324 Checking to see what type of argument is accepted by gethostbyname().
19325 EOM
19326                 hdrs="$define sys/types.h
19327                         $d_socket sys/socket.h 
19328                         $i_niin netinet/in.h 
19329                         $i_netdb netdb.h
19330                         $i_unistd unistd.h"
19331                 for xxx in "const char *" "char *"; do
19332                         case "$netdb_name_type" in
19333                         '')     try="extern struct hostent *gethostbyname($xxx);"
19334                                 if ./protochk "$try" $hdrs; then
19335                                         echo "Your system accepts $xxx."
19336                                         netdb_name_type="$xxx"
19337                                 fi
19338                                 ;;
19339                         esac
19340                 done
19341                 : In case none of those worked, prompt the user.
19342                 case "$netdb_name_type" in
19343                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19344                         dflt='char *'
19345                         . ./myread
19346                         netdb_name_type=$ans
19347                         ;;
19348                 esac
19349                 ;;
19350         *)      : no gethostbyname, so pick harmless default
19351                 netdb_name_type='char *'
19352                 ;;
19353         esac
19354 fi
19355
19356 : check for type of 1st argument to getnetbyaddr. 
19357 if test "X$netdb_net_type" = X ; then
19358         case "$d_getnbyaddr" in
19359         $define)
19360                 $cat <<EOM
19361
19362 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19363 EOM
19364                 hdrs="$define sys/types.h
19365                         $d_socket sys/socket.h 
19366                         $i_niin netinet/in.h 
19367                         $i_netdb netdb.h
19368                         $i_unistd unistd.h"
19369                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19370                         case "$netdb_net_type" in
19371                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19372                                 if ./protochk "$try" $hdrs; then
19373                                         echo "Your system accepts $xxx."
19374                                         netdb_net_type="$xxx"
19375                                 fi
19376                                 ;;
19377                         esac
19378                 done
19379                 : In case none of those worked, prompt the user.
19380                 case "$netdb_net_type" in
19381                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19382                         dflt='long'
19383                         . ./myread
19384                         netdb_net_type=$ans
19385                         ;;
19386                 esac
19387                 ;;
19388         *)      : no getnetbyaddr, so pick harmless default
19389                 netdb_net_type='long'
19390                 ;;
19391         esac
19392 fi
19393 : locate the preferred pager for this system
19394 fn=f/
19395 case "$pager" in
19396 '')
19397         dflt=''
19398         case "$pg" in
19399         /*) dflt=$pg;;
19400         [a-zA-Z]:/*) dflt=$pg;;
19401         esac
19402         case "$more" in
19403         /*) dflt=$more;;
19404         [a-zA-Z]:/*) dflt=$more;;
19405         esac
19406         case "$less" in
19407         /*) dflt=$less;;
19408         [a-zA-Z]:/*) dflt=$less;;
19409         esac
19410         case "$dflt" in
19411         '') dflt=/usr/ucb/more;;
19412         esac
19413         ;;
19414 *)      dflt="$pager"
19415         : Instruct ./getfile to trust the hinted or previous pager value,
19416         : even if it does not begin with a slash.  For example, on os2,
19417         : pager might be cmd /c more.  See comments in UU/getfile.
19418         fn="f/($pager)"
19419         ;;
19420 esac
19421 echo " "
19422 rp='What pager is used on your system?'
19423 . ./getfile
19424 pager="$ans"
19425
19426 : see what type pids are declared as in the kernel
19427 rp="What is the type of process ids on this system?"
19428 set pid_t pidtype int stdio.h sys/types.h
19429 eval $typedef_ask
19430
19431 : see if ar generates random libraries by itself
19432 echo " "
19433 echo "Checking how to generate random libraries on your machine..." >&4
19434 echo 'int bar1() { return bar2(); }' > bar1.c
19435 echo 'int bar2() { return 2; }' > bar2.c
19436 $cat > foo.c <<EOP
19437 #$i_stdlib I_STDLIB
19438 #ifdef I_STDLIB
19439 #include <stdlib.h>
19440 #endif
19441 int main() { printf("%d\n", bar1()); exit(0); }
19442 EOP
19443 $cc $ccflags -c bar1.c >/dev/null 2>&1
19444 $cc $ccflags -c bar2.c >/dev/null 2>&1
19445 $cc $ccflags -c foo.c >/dev/null 2>&1
19446 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19447 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19448         $run ./foobar >/dev/null 2>&1; then
19449         echo "$ar appears to generate random libraries itself."
19450         orderlib=false
19451         if [ "X$ranlib" = "X" ]; then
19452             ranlib=":"
19453         fi
19454 elif $ar s bar$_a >/dev/null 2>&1 &&
19455         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19456         $run ./foobar >/dev/null 2>&1; then
19457                 echo "a table of contents needs to be added with '$ar s'."
19458                 orderlib=false
19459                 ranlib="$ar s"
19460 elif $ar ts bar$_a >/dev/null 2>&1 &&
19461         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19462         $run ./foobar >/dev/null 2>&1; then
19463                 echo "a table of contents needs to be added with '$ar ts'."
19464                 orderlib=false
19465                 ranlib="$ar ts"
19466 else
19467         case "$ranlib" in
19468         :) ranlib='';;
19469         '')
19470                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19471                 $test -f $ranlib || ranlib=''
19472                 ;;
19473         esac
19474         if $test -n "$ranlib"; then
19475                 echo "your system has '$ranlib'; we'll use that."
19476                 orderlib=false
19477         else
19478                 echo "your system doesn't seem to support random libraries"
19479                 echo "so we'll use lorder and tsort to order the libraries."
19480                 orderlib=true
19481                 ranlib=":"
19482         fi
19483 fi
19484 $rm -f foo* bar*
19485
19486 : check for type of arguments to select. 
19487 case "$selecttype" in
19488 '') case "$d_select" in
19489         $define)
19490                 echo " "
19491                 $cat <<EOM
19492 Checking to see what type of arguments are accepted by select().
19493 EOM
19494                 hdrs="$define sys/types.h
19495                         $i_systime sys/time.h 
19496                         $i_sysselct sys/select.h
19497                         $d_socket sys/socket.h"
19498                 : The first arg can be int, unsigned, or size_t
19499                 : The last arg may or may not be 'const'
19500                 val=''
19501                 : void pointer has been seen but using that
19502                 : breaks the selectminbits test
19503                 for xxx in 'fd_set *' 'int *'; do
19504                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19505                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19506                                         case "$val" in
19507                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19508                                                 if ./protochk "$try" $hdrs; then
19509                                                         echo "Your system accepts $xxx."
19510                                                         val="$xxx"
19511                                                 fi
19512                                                 ;;
19513                                         esac
19514                                 done
19515                         done
19516                 done
19517                 case "$val" in
19518                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19519                         case "$d_fd_set" in
19520                                 $define) dflt="fd_set *" ;;
19521                                 *)              dflt="int *" ;;
19522                         esac
19523                         . ./myread
19524                         val=$ans
19525                         ;;
19526                 esac
19527                 selecttype="$val"
19528                 ;;
19529         *)      : no select, so pick a harmless default
19530                 selecttype='int *'
19531                 ;;
19532         esac
19533         ;;
19534 esac
19535
19536 : check for the select 'width'
19537 case "$selectminbits" in
19538 '') safebits=`expr $ptrsize \* 8`
19539     case "$d_select" in
19540         $define)
19541                 $cat <<EOM
19542
19543 Checking to see on how many bits at a time your select() operates...
19544 EOM
19545                 $cat >try.c <<EOCP
19546 #include <sys/types.h>
19547 #$i_time I_TIME
19548 #$i_systime I_SYS_TIME
19549 #$i_systimek I_SYS_TIME_KERNEL
19550 #ifdef I_TIME
19551 #   include <time.h>
19552 #endif
19553 #ifdef I_SYS_TIME
19554 #   ifdef I_SYS_TIME_KERNEL
19555 #       define KERNEL
19556 #   endif
19557 #   include <sys/time.h>
19558 #   ifdef I_SYS_TIME_KERNEL
19559 #       undef KERNEL
19560 #   endif
19561 #endif
19562 #$i_sysselct I_SYS_SELECT
19563 #ifdef I_SYS_SELECT
19564 #include <sys/select.h>
19565 #endif
19566 #$d_socket HAS_SOCKET
19567 #ifdef HAS_SOCKET
19568 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19569 #endif
19570 #include <stdio.h>
19571 #$i_stdlib I_STDLIB
19572 #ifdef I_STDLIB
19573 #include <stdlib.h>
19574 #endif
19575 $selecttype b;
19576 #define S sizeof(*(b))
19577 #define MINBITS 64
19578 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19579 #define NBITS  (NBYTES * 8)
19580 int main() {
19581     char *s = (char *)malloc(NBYTES);
19582     struct timeval t;
19583     int i;
19584     FILE* fp;
19585     int fd;
19586
19587     if (!s)
19588         exit(1);
19589     fclose(stdin);
19590     fp = fopen("try.c", "r");
19591     if (fp == 0)
19592       exit(2);
19593     fd = fileno(fp);
19594     if (fd < 0)
19595       exit(3);
19596     b = ($selecttype)s;
19597     for (i = 0; i < NBITS; i++)
19598         FD_SET(i, b);
19599     t.tv_sec  = 0;
19600     t.tv_usec = 0;
19601     select(fd + 1, b, 0, 0, &t);
19602     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19603     free(s);
19604     printf("%d\n", i + 1);
19605     return 0;
19606 }
19607 EOCP
19608                 set try
19609                 if eval $compile_ok; then
19610                         selectminbits=`$run ./try`
19611                         case "$selectminbits" in
19612                         '')     cat >&4 <<EOM
19613 Cannot figure out on how many bits at a time your select() operates.
19614 I'll play safe and guess it is $safebits bits.
19615 EOM
19616                                 selectminbits=$safebits
19617                                 bits="$safebits bits"
19618                                 ;;
19619                         1)      bits="1 bit" ;;
19620                         *)      bits="$selectminbits bits" ;;
19621                         esac
19622                         echo "Your select() operates on $bits at a time." >&4
19623                 else
19624                         rp='What is the minimum number of bits your select() operates on?'
19625                         case "$byteorder" in
19626                         12345678)       dflt=64 ;;
19627                         1234)           dflt=32 ;;
19628                         *)              dflt=1  ;;
19629                         esac
19630                         . ./myread
19631                         val=$ans
19632                         selectminbits="$val"
19633                 fi
19634                 $rm -f try.* try
19635                 ;;
19636         *)      : no select, so pick a harmless default
19637                 selectminbits=$safebits
19638                 ;;
19639         esac
19640         ;;
19641 esac
19642
19643 : Trace out the files included by signal.h, then look for SIGxxx names.
19644 : Remove SIGARRAYSIZE used by HPUX.
19645 : Remove SIGSTKSIZE used by Linux.
19646 : Remove SIGSTKSZ used by Posix.
19647 : Remove SIGTYP void lines used by OS2.
19648 : Some cpps, like os390, dont give the file name anywhere
19649 if [ "X$fieldn" = X ]; then
19650         : Just make some guesses.  We check them later.
19651         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19652 else
19653         xxx=`echo '#include <signal.h>' |
19654         $cppstdin $cppminus $cppflags 2>/dev/null |
19655         $grep '^[       ]*#.*include' | 
19656         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19657 fi
19658 : Check this list of files to be sure we have parsed the cpp output ok.
19659 : This will also avoid potentially non-existent files, such 
19660 : as ../foo/bar.h
19661 xxxfiles=''
19662 for xx in $xxx /dev/null ; do
19663         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19664 done
19665 : If we have found no files, at least try signal.h
19666 case "$xxxfiles" in
19667 '')     xxxfiles=`./findhdr signal.h` ;;
19668 esac
19669 xxx=`awk '
19670 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19671         print substr($2, 4, 20)
19672 }
19673 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19674         print substr($3, 4, 20)
19675 }' $xxxfiles`
19676 : Append some common names just in case the awk scan failed.
19677 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19678 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19679 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19680 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19681 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19682
19683 : generate a few handy files for later
19684 $cat > signal.c <<EOCP
19685 #include <sys/types.h>
19686 #include <signal.h>
19687 #$i_stdlib I_STDLIB
19688 #ifdef I_STDLIB
19689 #include <stdlib.h>
19690 #endif
19691 #include <stdio.h>
19692 int main() {
19693
19694 /* Strange style to avoid deeply-nested #if/#else/#endif */
19695 #ifndef NSIG
19696 #  ifdef _NSIG
19697 #    define NSIG (_NSIG)
19698 #  endif
19699 #endif
19700
19701 #ifndef NSIG
19702 #  ifdef SIGMAX
19703 #    define NSIG (SIGMAX+1)
19704 #  endif
19705 #endif
19706
19707 #ifndef NSIG
19708 #  ifdef SIG_MAX
19709 #    define NSIG (SIG_MAX+1)
19710 #  endif
19711 #endif
19712
19713 #ifndef NSIG
19714 #  ifdef _SIG_MAX
19715 #    define NSIG (_SIG_MAX+1)
19716 #  endif
19717 #endif
19718
19719 #ifndef NSIG
19720 #  ifdef MAXSIG
19721 #    define NSIG (MAXSIG+1)
19722 #  endif
19723 #endif
19724
19725 #ifndef NSIG
19726 #  ifdef MAX_SIG
19727 #    define NSIG (MAX_SIG+1)
19728 #  endif
19729 #endif
19730
19731 #ifndef NSIG
19732 #  ifdef SIGARRAYSIZE
19733 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19734 #  endif
19735 #endif
19736
19737 #ifndef NSIG
19738 #  ifdef _sys_nsig
19739 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19740 #  endif
19741 #endif
19742
19743 /* Default to some arbitrary number that's big enough to get most
19744    of the common signals.
19745 */
19746 #ifndef NSIG
19747 #    define NSIG 50
19748 #endif
19749
19750 printf("NSIG %d\n", NSIG);
19751
19752 #ifndef JUST_NSIG
19753
19754 EOCP
19755
19756 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19757 {
19758         printf "#ifdef SIG"; printf $1; printf "\n"
19759         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19760         printf $1; printf ");\n"
19761         printf "#endif\n"
19762 }
19763 END {
19764         printf "#endif /* JUST_NSIG */\n";
19765         printf "exit(0);\n}\n";
19766 }
19767 ' >>signal.c
19768 $cat >signal.awk <<'EOP'
19769 BEGIN { ndups = 0 }
19770 $1 ~ /^NSIG$/ { nsig = $2 }
19771 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19772     if ($2 > maxsig) { maxsig = $2 }
19773     if (sig_name[$2]) {
19774         dup_name[ndups] = $1
19775         dup_num[ndups] = $2
19776         ndups++ 
19777     }
19778     else {
19779         sig_name[$2] = $1
19780         sig_num[$2] = $2
19781     }
19782 }
19783 END { 
19784     if (nsig == 0) {
19785         nsig = maxsig + 1
19786     }
19787     printf("NSIG %d\n", nsig);
19788     for (n = 1; n < nsig; n++) {
19789         if (sig_name[n]) {
19790             printf("%s %d\n", sig_name[n], sig_num[n])
19791         }
19792         else {
19793             printf("NUM%d %d\n", n, n) 
19794         }
19795     }
19796     for (n = 0; n < ndups; n++) {
19797         printf("%s %d\n", dup_name[n], dup_num[n])
19798     }
19799 }
19800 EOP
19801 $cat >signal_cmd <<EOS
19802 $startsh
19803 if $test -s signal.lst; then
19804     echo "Using your existing signal.lst file"
19805         exit 0
19806 fi
19807 xxx="$xxx"
19808 EOS
19809 $cat >>signal_cmd <<'EOS'
19810
19811 set signal
19812 if eval $compile_ok; then
19813         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19814 else
19815         echo "(I can't seem be able to compile the whole test program)" >&4
19816         echo "(I'll try it in little pieces.)" >&4
19817         set signal -DJUST_NSIG
19818         if eval $compile_ok; then
19819                 $run ./signal$_exe > signal.nsg
19820                 $cat signal.nsg
19821         else
19822                 echo "I can't seem to figure out how many signals you have." >&4
19823                 echo "Guessing 50." >&4
19824                 echo 'NSIG 50' > signal.nsg
19825         fi
19826         : Now look at all the signal names, one at a time.
19827         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19828                 $cat > signal.c <<EOCP
19829 #include <sys/types.h>
19830 #include <signal.h>
19831 #include <stdio.h>
19832 int main() {
19833 printf("$xx %d\n", SIG${xx});
19834 return 0;
19835 }
19836 EOCP
19837                 set signal
19838                 if eval $compile; then
19839                         echo "SIG${xx} found."
19840                         $run ./signal$_exe  >> signal.ls1
19841                 else
19842                         echo "SIG${xx} NOT found."
19843                 fi
19844         done
19845         if $test -s signal.ls1; then
19846                 $cat signal.nsg signal.ls1 |
19847                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19848         fi
19849
19850 fi
19851 if $test -s signal.lst; then
19852         :
19853 else
19854         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19855         echo 'kill -l' >signal
19856         set X `csh -f <signal`
19857         $rm -f signal
19858         shift
19859         case $# in
19860         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19861         esac
19862         echo $@ | $tr ' ' $trnl | \
19863             $awk '{ printf "%s %d\n", $1, ++s; }
19864                   END { printf "NSIG %d\n", ++s }' >signal.lst
19865 fi
19866 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19867 EOS
19868 chmod a+x signal_cmd
19869 $eunicefix signal_cmd
19870
19871 : generate list of signal names
19872 echo " "
19873 case "$sig_name_init" in
19874 '') doinit=yes ;;
19875 *)  case "$sig_num_init" in
19876     ''|*,*) doinit=yes ;;
19877     esac ;;
19878 esac
19879 case "$doinit" in
19880 yes)
19881         echo "Generating a list of signal names and numbers..." >&4
19882         . ./signal_cmd
19883         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19884         sig_name=`$awk 'BEGIN { printf "ZERO " }
19885                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19886         sig_num=`$awk  'BEGIN { printf "0 " }
19887                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19888         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19889                              !/^NSIG/   { printf "\"%s\", ", $1 }
19890                              END        { printf "0\n" }' signal.lst`
19891         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19892                              !/^NSIG/   { printf "%d, ", $2}
19893                              END        { printf "0\n"}' signal.lst`
19894         ;;
19895 esac
19896 echo "The following $sig_count signals are available:"
19897 echo " "
19898 echo $sig_name | $awk \
19899 'BEGIN { linelen = 0 }
19900 {
19901         for (i = 1; i <= NF; i++) {
19902                 name = "SIG" $i " "
19903                 linelen = linelen + length(name)
19904                 if (linelen > 70) {
19905                         printf "\n"
19906                         linelen = length(name)
19907                 }
19908                 printf "%s", name
19909         }
19910         printf "\n"
19911 }'
19912 sig_size=`echo $sig_name | awk '{print NF}'`
19913 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19914
19915 echo " "
19916 case "$sizetype" in
19917 *_t) zzz="$sizetype"    ;;
19918 *)   zzz="filesize"     ;;
19919 esac
19920 echo "Checking the size of $zzz..." >&4 
19921 cat > try.c <<EOCP
19922 #include <sys/types.h>
19923 #include <stdio.h>
19924 #$i_stdlib I_STDLIB
19925 #ifdef I_STDLIB
19926 #include <stdlib.h>
19927 #endif
19928 int main() {
19929     printf("%d\n", (int)sizeof($sizetype));
19930     exit(0);
19931 }
19932 EOCP
19933 set try
19934 if eval $compile_ok; then
19935         yyy=`$run ./try`
19936         case "$yyy" in
19937         '')     sizesize=4
19938                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19939                 ;;
19940         *)      sizesize=$yyy
19941                 echo "Your $zzz size is $sizesize bytes."
19942                 ;;
19943         esac
19944 else
19945         sizesize=4
19946         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19947 fi
19948
19949
19950 : check for socklen_t
19951 echo " "
19952 echo "Checking to see if you have socklen_t..." >&4
19953 $cat >try.c <<EOCP
19954 #include <sys/types.h>
19955 #$d_socket HAS_SOCKET
19956 #ifdef HAS_SOCKET
19957 #include <sys/socket.h>
19958 #endif
19959 int main() { socklen_t x = 16; }
19960 EOCP
19961 set try
19962 if eval $compile; then
19963         val="$define"
19964         echo "You have socklen_t."
19965 else
19966         val="$undef"
19967         echo "You do not have socklen_t."
19968         case "$sizetype" in
19969         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19970         esac
19971 fi
19972 $rm -f try try.*
19973 set d_socklen_t
19974 eval $setvar
19975
19976 : see if this is a socks.h system
19977 set socks.h i_socks
19978 eval $inhdr
19979
19980 : check for type of the size argument to socket calls
19981 case "$d_socket" in
19982 "$define")
19983         $cat <<EOM
19984
19985 Checking to see what type is the last argument of accept().
19986 EOM
19987         yyy=''
19988         case "$d_socklen_t" in
19989         "$define") yyy="$yyy socklen_t"
19990         esac
19991         yyy="$yyy $sizetype int long unsigned"
19992         for xxx in $yyy; do
19993                 case "$socksizetype" in
19994                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19995                         case "$usesocks" in
19996                         "$define")
19997                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19998                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19999                                         socksizetype="$xxx"
20000                                 fi
20001                                 ;;
20002                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20003                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20004                                         socksizetype="$xxx"
20005                                 fi
20006                                 ;;
20007                         esac
20008                         ;;
20009                 esac
20010         done
20011 : In case none of those worked, prompt the user.
20012         case "$socksizetype" in
20013         '')     rp='What is the type for socket address structure sizes?'
20014                 dflt='int'
20015                 . ./myread
20016                 socksizetype=$ans
20017                 ;;
20018         esac
20019         ;;
20020 *)      : no sockets, so pick relatively harmless default
20021         socksizetype='int'
20022         ;;
20023 esac
20024
20025 : see what type is used for signed size_t
20026 set ssize_t ssizetype int stdio.h sys/types.h
20027 eval $typedef
20028 dflt="$ssizetype"
20029 $cat > try.c <<EOM
20030 #include <stdio.h>
20031 #$i_stdlib I_STDLIB
20032 #ifdef I_STDLIB
20033 #include <stdlib.h>
20034 #endif
20035 #include <sys/types.h>
20036 #define Size_t $sizetype
20037 #define SSize_t $dflt
20038 int main()
20039 {
20040         if (sizeof(Size_t) == sizeof(SSize_t))
20041                 printf("$dflt\n");
20042         else if (sizeof(Size_t) == sizeof(int))
20043                 printf("int\n");
20044         else 
20045                 printf("long\n");
20046         exit(0);
20047 }
20048 EOM
20049 echo " "
20050 set try
20051 if eval $compile_ok && $run ./try > /dev/null; then
20052         ssizetype=`$run ./try`
20053         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20054 else
20055         $cat >&4 <<EOM
20056 Help! I can't compile and run the ssize_t test program: please enlighten me!
20057 (This is probably a misconfiguration in your system or libraries, and
20058 you really ought to fix it.  Still, I'll try anyway.)
20059
20060 I need a type that is the same size as $sizetype, but is guaranteed to
20061 be signed.  Common values are ssize_t, int and long.
20062
20063 EOM
20064         rp="What signed type is the same size as $sizetype?"
20065         . ./myread
20066         ssizetype="$ans"
20067 fi
20068 $rm -f try try.*
20069
20070 : see what type of char stdio uses.
20071 echo " "
20072 echo '#include <stdio.h>' > stdio.c
20073 $cppstdin $cppminus < stdio.c > stdioh
20074 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20075         echo "Your stdio uses unsigned chars." >&4
20076         stdchar="unsigned char"
20077 else
20078         echo "Your stdio uses signed chars." >&4
20079         stdchar="char"
20080 fi
20081 $rm -f stdio.* stdioh
20082
20083 : see what type uids are declared as in the kernel
20084 echo " "
20085 echo "Looking for the type for user ids returned by getuid()."
20086 set uid_t uidtype xxx stdio.h sys/types.h
20087 eval $typedef
20088 case "$uidtype" in
20089 xxx)
20090         xxx=`./findhdr sys/user.h`
20091         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20092         case $1 in
20093         unsigned) dflt="$1 $2" ;;
20094         *) dflt="$1" ;;
20095         esac
20096         ;;
20097 *) dflt="$uidtype";;
20098 esac
20099 case "$uidtype" in
20100 uid_t)  echo "uid_t found." ;;
20101 *)      rp="What is the type for user ids returned by getuid()?"
20102         . ./myread
20103         uidtype="$ans"
20104         ;;
20105 esac
20106
20107 echo " "
20108 case "$uidtype" in
20109 *_t) zzz="$uidtype"     ;;
20110 *)   zzz="uid"          ;;
20111 esac
20112 echo "Checking the size of $zzz..." >&4 
20113 cat > try.c <<EOCP
20114 #include <sys/types.h>
20115 #include <stdio.h>
20116 #$i_stdlib I_STDLIB
20117 #ifdef I_STDLIB
20118 #include <stdlib.h>
20119 #endif
20120 int main() {
20121     printf("%d\n", (int)sizeof($uidtype));
20122     exit(0);
20123 }
20124 EOCP
20125 set try
20126 if eval $compile_ok; then
20127         yyy=`$run ./try`
20128         case "$yyy" in
20129         '')     uidsize=4
20130                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20131                 ;;
20132         *)      uidsize=$yyy
20133                 echo "Your $zzz is $uidsize bytes long."
20134                 ;;
20135         esac
20136 else
20137         uidsize=4
20138         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20139 fi
20140
20141 echo " "
20142 case "$uidtype" in
20143 *_t) zzz="$uidtype"     ;;
20144 *)   zzz="uid"          ;;
20145 esac
20146 echo "Checking the sign of $zzz..." >&4
20147 cat > try.c <<EOCP
20148 #include <sys/types.h>
20149 #include <stdio.h>
20150 int main() {
20151         $uidtype foo = -1;
20152         if (foo < 0)
20153                 printf("-1\n");
20154         else
20155                 printf("1\n");
20156 }
20157 EOCP
20158 set try
20159 if eval $compile; then
20160         yyy=`$run ./try`
20161         case "$yyy" in
20162         '')     uidsign=1
20163                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20164                 ;;
20165         *)      uidsign=$yyy
20166                 case "$uidsign" in
20167                  1) echo "Your $zzz is unsigned." ;;
20168                 -1) echo "Your $zzz is signed."   ;;
20169                 esac
20170                 ;;
20171         esac
20172 else
20173         uidsign=1
20174         echo "(I can't compile the test program--guessing unsigned.)" >&4
20175 fi
20176
20177
20178
20179 echo " "
20180 $echo "Checking the format string to be used for uids..." >&4
20181
20182 case "$uidsign" in
20183 -1)     if $test X"$uidsize" = X"$ivsize"; then
20184                 uidformat="$ivdformat"
20185         else
20186                 if $test X"$uidsize" = X"$longsize"; then
20187                         uidformat='"ld"'
20188                 else
20189                         if $test X"$uidsize" = X"$intsize"; then
20190                                 uidformat='"d"'
20191                         else
20192                                 if $test X"$uidsize" = X"$shortsize"; then
20193                                         uidformat='"hd"'
20194                                 fi
20195                         fi
20196                 fi
20197         fi
20198         ;;
20199 *)      if $test X"$uidsize" = X"$uvsize"; then
20200                 uidformat="$uvuformat"
20201         else
20202                 if $test X"$uidsize" = X"$longsize"; then
20203                         uidformat='"lu"'
20204                 else
20205                         if $test X"$uidsize" = X"$intsize"; then
20206                                 uidformat='"u"'
20207                         else
20208                                 if $test X"$uidsize" = X"$shortsize"; then
20209                                         uidformat='"hu"'
20210                                 fi
20211                         fi
20212                 fi
20213         fi
20214         ;;
20215 esac
20216
20217
20218 case "$usesitecustomize" in
20219     $define|true|[Yy]*)
20220         usesitecustomize="$define"
20221         ;;
20222     *)
20223         usesitecustomize="$undef"
20224         ;;
20225     esac
20226
20227 : determine compiler compiler
20228 case "$yacc" in
20229 '')
20230         dflt=yacc;;
20231 *)
20232         dflt="$yacc";;
20233 esac
20234 echo " "
20235 comp='yacc'
20236 if $test -f "$byacc$_exe"; then
20237         dflt="$byacc"
20238         comp="byacc or $comp"
20239 fi
20240 if $test -f "$bison$_exe"; then
20241         comp="$comp or bison -y"
20242 fi
20243 rp="Which compiler compiler ($comp) shall I use?"
20244 . ./myread
20245 yacc="$ans"
20246 case "$yacc" in
20247 *bis*)
20248         case "$yacc" in
20249         *-y*) ;;
20250         *)
20251                 yacc="$yacc -y"
20252                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20253                 ;;
20254         esac
20255         ;;
20256 esac
20257
20258 : see if this is a fp.h system
20259 set fp.h i_fp
20260 eval $inhdr
20261
20262 : see if this is a fp_class.h system
20263 set fp_class.h i_fp_class
20264 eval $inhdr
20265
20266 : see if this is a ieeefp.h system
20267 case "$i_ieeefp" in
20268 '' ) set ieeefp.h i_ieeefp
20269      eval $inhdr
20270      ;;
20271 esac
20272
20273 : see if this is a libutil.h system
20274 set libutil.h i_libutil
20275 eval $inhdr
20276
20277 : see if mach cthreads are available
20278 if test "X$usethreads" = "X$define"; then
20279         set mach/cthreads.h i_machcthr
20280         eval $inhdr
20281 else
20282         i_machcthr="$undef"
20283 fi
20284
20285
20286
20287 : see if this is a mntent.h system
20288 set mntent.h i_mntent
20289 eval $inhdr
20290
20291 : see if ndbm.h is available
20292 set ndbm.h t_ndbm
20293 eval $inhdr
20294
20295 case "$t_ndbm" in
20296 $undef)
20297     # Some Linux distributions such as RedHat 7.1 put the
20298     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20299     if $test -f /usr/include/gdbm/ndbm.h; then
20300         echo '<gdbm/ndbm.h> found.'
20301         ccflags="$ccflags -I/usr/include/gdbm"
20302         cppflags="$cppflags -I/usr/include/gdbm"
20303         t_ndbm=$define
20304     fi
20305     ;;
20306 esac
20307
20308 case "$t_ndbm" in
20309 $define)
20310         : see if dbm_open exists
20311         set dbm_open d_dbm_open
20312         eval $inlibc
20313         case "$d_dbm_open" in
20314         $undef)
20315                 t_ndbm="$undef"
20316                 echo "We won't be including <ndbm.h>"
20317                 ;;
20318         esac
20319         ;;
20320 esac
20321 val="$t_ndbm"
20322 set i_ndbm
20323 eval $setvar
20324
20325 : see if net/errno.h is available
20326 val=''
20327 set net/errno.h val
20328 eval $inhdr
20329
20330 : Unfortunately, it causes problems on some systems.  Arrgh.
20331 case "$val" in
20332 $define)
20333         cat > try.c <<'EOM'
20334 #include <stdio.h>
20335 #include <errno.h>
20336 #include <net/errno.h>
20337 int func()
20338 {
20339         return ENOTSOCK;
20340 }
20341 EOM
20342         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20343                 echo "We'll be including <net/errno.h>." >&4
20344         else
20345                 echo "We won't be including <net/errno.h>." >&4
20346                 val="$undef"
20347         fi
20348         $rm -f try.* try
20349         ;;
20350 esac
20351 set i_neterrno
20352 eval $setvar
20353
20354 : see if netinet/tcp.h is available
20355 set netinet/tcp.h i_netinettcp
20356 eval $inhdr
20357
20358 : see if this is a poll.h system
20359 set poll.h i_poll
20360 eval $inhdr
20361
20362 : see if this is a prot.h system
20363 set prot.h i_prot
20364 eval $inhdr
20365
20366 echo " "
20367 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20368 $cat <<'EOSH' > Cppsym.know
20369 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20370 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20371 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20372 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20373 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20374 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20375 bull c cadmus clipper CMU COFF COMPILER_VERSION
20376 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20377 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20378 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20379 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20380 GLIBC GLIBC_MINOR
20381 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20382 H3050R H3050RX hbullx20 hcx host_mips
20383 hp200 hp300 hp700 HP700 hp800 hp9000
20384 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20385 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20386 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20387 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20388 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20389 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20390 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20391 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20392 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20393 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20394 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20395 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20396 MATH_HAS_NO_SIDE_EFFECTS
20397 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20398 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20399 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20400 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20401 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20402 NetBSD news1500 news1700 news1800 news1900 news3700
20403 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20404 ns32016 ns32332 ns32k nsc32000
20405 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20406 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20407 pc532 pdp11 PGC PIC plexus PORTAR posix
20408 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20409 POSIX_C_SOURCE POSIX_SOURCE POWER
20410 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20411 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20412 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20413 sony sony_news sonyrisc sparc sparclite spectrum
20414 stardent stdc STDC_EXT stratos sun sun3 sun386
20415 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20416 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20417 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20418 sysV68 sysV88 Tek4132 Tek4300 titan
20419 TM3200 TM5400 TM5600
20420 tower tower32 tower32_200 tower32_600 tower32_700
20421 tower32_800 tower32_850 tss
20422 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20423 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20424 unix UNIX95 UNIX99 unixpc unos
20425 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20426 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20427 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20428 USGr4 USGr4_2
20429 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20430 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20431 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20432 z8000
20433 EOSH
20434 # Maybe put other stuff here too.
20435 cat <<EOSH >>Cppsym.know
20436 $osname
20437 EOSH
20438 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20439 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20440 $cat Cppsym.know > Cppsym.c
20441 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20442 $rm -f Cppsym.a Cppsym.b Cppsym.c
20443 cat <<EOSH > Cppsym
20444 $startsh
20445 if $test \$# -gt 0; then
20446     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20447     if $test -s Cppsym.got; then
20448         $rm -f Cppsym.got
20449         exit 0
20450     fi
20451     $rm -f Cppsym.got
20452     exit 1
20453 else
20454     $tr " " "$trnl" | ./Cppsym.try
20455     exit 0
20456 fi
20457 EOSH
20458 chmod +x Cppsym
20459 $eunicefix Cppsym
20460 cat <<EOSH > Cppsym.try
20461 $startsh
20462 cat <<'EOCP' > try.c
20463 #include <stdio.h>
20464 #if cpp_stuff == 1
20465 #define STRINGIFY(a)    "a"
20466 #endif
20467 #if cpp_stuff == 42
20468 #define StGiFy(a)  #a
20469 #define STRINGIFY(a)    StGiFy(a)
20470 #endif
20471 #if $cpp_stuff != 1 && $cpp_stuff != 42
20472 #   include "Bletch: How does this C preprocessor stringify macros?"
20473 #endif
20474 int main() {
20475 EOCP
20476 $awk \\
20477 EOSH
20478 cat <<'EOSH' >> Cppsym.try
20479 'length($1) > 0 {
20480     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20481     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20482     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20483     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20484 }'       >> try.c
20485 echo 'return 0;}' >> try.c
20486 EOSH
20487 cat <<EOSH >> Cppsym.try
20488 ccflags="$ccflags"
20489 case "$osname-$gccversion" in
20490 irix-) ccflags="\$ccflags -woff 1178" ;;
20491 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20492 esac
20493 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20494 EOSH
20495 chmod +x Cppsym.try
20496 $eunicefix Cppsym.try
20497 ./Cppsym < Cppsym.know > Cppsym.true
20498 : Add in any linux cpp "predefined macros":
20499 case "$osname::$gccversion" in
20500   *linux*::*.*)
20501     tHdrH=_tmpHdr
20502     rm -f $tHdrH'.h' $tHdrH
20503     touch $tHdrH'.h'
20504     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20505        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20506        if [ -s $tHdrH'_cppsym.real' ]; then
20507           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20508        fi
20509     fi
20510     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20511   ;;
20512 esac
20513 : now check the C compiler for additional symbols
20514 postprocess_cc_v=''
20515 case "$osname" in
20516 aix) postprocess_cc_v="|$tr , ' '" ;;
20517 esac
20518 $cat >ccsym <<EOS
20519 $startsh
20520 $cat >tmp.c <<EOF
20521 extern int foo;
20522 EOF
20523 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20524 do
20525         case "\$i" in
20526         -D*) echo "\$i" | $sed 's/^-D//';;
20527         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20528         esac
20529 done
20530 $rm -f try.c
20531 EOS
20532 postprocess_cc_v=''
20533 chmod +x ccsym
20534 $eunicefix ccsym
20535 ./ccsym > ccsym1.raw
20536 if $test -s ccsym1.raw; then
20537        $sort ccsym1.raw | $uniq >ccsym.raw
20538 else
20539        mv ccsym1.raw ccsym.raw
20540 fi
20541
20542 $awk '/\=/ { print $0; next }
20543         { print $0"=1" }' ccsym.raw >ccsym.list
20544 $comm -13 Cppsym.true ccsym.list >ccsym.own
20545 $comm -12 Cppsym.true ccsym.list >ccsym.com
20546 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20547 also=''
20548 if $test -z ccsym.raw; then
20549         echo "Your C compiler doesn't seem to define any symbols!" >&4
20550         echo " "
20551         echo "However, your C preprocessor defines the following symbols:"
20552         $cat Cppsym.true
20553         ccsymbols=''
20554         cppsymbols=`$cat Cppsym.true`
20555         cppsymbols=`echo $cppsymbols`
20556         cppccsymbols="$cppsymbols"
20557 else
20558         if $test -s ccsym.com; then
20559                 echo "Your C compiler and pre-processor define these symbols:"
20560                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20561                 also='also '
20562                 symbols='ones'
20563                 cppccsymbols=`$cat ccsym.com`
20564                 cppccsymbols=`echo $cppccsymbols`
20565                 $test "$silent" || sleep 1
20566         fi
20567         if $test -s ccsym.cpp; then
20568                 $test "$also" && echo " "
20569                 echo "Your C pre-processor ${also}defines the following symbols:"
20570                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20571                 also='further '
20572                 cppsymbols=`$cat ccsym.cpp`
20573                 cppsymbols=`echo $cppsymbols`
20574                 $test "$silent" || sleep 1
20575         fi
20576         if $test -s ccsym.own; then
20577                 $test "$also" && echo " "
20578                 echo "Your C compiler ${also}defines the following cpp symbols:"
20579                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20580                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20581                 ccsymbols=`$cat ccsym.own`
20582                 ccsymbols=`echo $ccsymbols`
20583                 $test "$silent" || sleep 1
20584         fi
20585 fi
20586
20587 : see if this is a termio system
20588 val="$undef"
20589 val2="$undef"
20590 val3="$undef"
20591 if $test `./findhdr termios.h`; then
20592         set tcsetattr i_termios
20593         eval $inlibc
20594         val3="$i_termios"
20595 fi
20596 echo " "
20597 case "$val3" in
20598 "$define") echo "You have POSIX termios.h... good!" >&4;;
20599 *) if ./Cppsym pyr; then
20600                 case "`/bin/universe`" in
20601                 ucb) if $test `./findhdr sgtty.h`; then
20602                                 val2="$define"
20603                                 echo "<sgtty.h> found." >&4
20604                         else
20605                                 echo "System is pyramid with BSD universe."
20606                                 echo "<sgtty.h> not found--you could have problems." >&4
20607                         fi;;
20608                 *) if $test `./findhdr termio.h`; then
20609                                 val="$define"
20610                                 echo "<termio.h> found." >&4
20611                         else
20612                                 echo "System is pyramid with USG universe."
20613                                 echo "<termio.h> not found--you could have problems." >&4
20614                         fi;;
20615                 esac
20616         elif ./usg; then
20617                 if $test `./findhdr termio.h`; then
20618                         echo "<termio.h> found." >&4
20619                         val="$define"
20620                 elif $test `./findhdr sgtty.h`; then
20621                         echo "<sgtty.h> found." >&4
20622                         val2="$define"
20623                 else
20624 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20625                 fi
20626         else
20627                 if $test `./findhdr sgtty.h`; then
20628                         echo "<sgtty.h> found." >&4
20629                         val2="$define"
20630                 elif $test `./findhdr termio.h`; then
20631                         echo "<termio.h> found." >&4
20632                         val="$define"
20633                 else
20634 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20635                 fi
20636         fi;;
20637 esac
20638 set i_termio; eval $setvar
20639 val=$val2; set i_sgtty; eval $setvar
20640 val=$val3; set i_termios; eval $setvar
20641
20642 : see if stddef is available
20643 set stddef.h i_stddef
20644 eval $inhdr
20645
20646 : see if this is a sunmath.h system
20647 set sunmath.h i_sunmath
20648 eval $inhdr
20649
20650 : see if sys/access.h is available
20651 set sys/access.h i_sysaccess
20652 eval $inhdr
20653
20654 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20655 set sys/filio.h i_sysfilio
20656 eval $inhdr
20657 echo " "
20658 if $test `./findhdr sys/ioctl.h`; then
20659         val="$define"
20660         echo '<sys/ioctl.h> found.' >&4
20661 else
20662         val="$undef"
20663         if $test $i_sysfilio = "$define"; then
20664             echo '<sys/ioctl.h> NOT found.' >&4
20665         else
20666                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20667                 $test $i_termio = "$define" && xxx="termio.h"
20668                 $test $i_termios = "$define" && xxx="termios.h"
20669 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20670         fi
20671 fi
20672 set i_sysioctl
20673 eval $setvar
20674
20675 : see if socket ioctl defs are in sys/sockio.h
20676 echo " "
20677 xxx=`./findhdr sys/sockio.h`
20678 if $test "$xxx"; then
20679         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20680                 val="$define"
20681                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20682         else
20683                 val="$undef"
20684                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20685         fi
20686 else
20687         val="$undef"
20688         $cat <<EOM
20689 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20690 EOM
20691 fi
20692 set i_syssockio
20693 eval $setvar
20694
20695
20696 : see if this is a syslog.h system
20697 set syslog.h i_syslog
20698 eval $inhdr
20699
20700
20701 : see if this is a sys/mode.h system
20702 set sys/mode.h i_sysmode
20703 eval $inhdr
20704
20705 : see if sys/resource.h has to be included
20706 set sys/resource.h i_sysresrc
20707 eval $inhdr
20708
20709 : see if sys/security.h is available
20710 set sys/security.h i_syssecrt
20711 eval $inhdr
20712
20713 : see if this is a sys/statvfs.h system
20714 set sys/statvfs.h i_sysstatvfs
20715 eval $inhdr
20716
20717 : see if this is a sys/un.h system
20718 set sys/un.h i_sysun
20719 eval $inhdr
20720
20721
20722 : see if this is a sys/utsname.h system
20723 set sys/utsname.h i_sysutsname
20724 eval $inhdr
20725
20726 : see if this is a syswait system
20727 set sys/wait.h i_syswait
20728 eval $inhdr
20729
20730 : see if this is a ustat.h system
20731 set ustat.h i_ustat
20732 eval $inhdr
20733
20734 : see if this is an utime system
20735 set utime.h i_utime
20736 eval $inhdr
20737
20738 : see if this is a values.h system
20739 set values.h i_values
20740 eval $inhdr
20741
20742 : see if this is a vfork system
20743 case "$d_vfork" in
20744 "$define")
20745         set vfork.h i_vfork
20746         eval $inhdr
20747         ;;
20748 *)
20749         i_vfork="$undef"
20750         ;;
20751 esac
20752
20753 : see if gdbm.h is available
20754 set gdbm.h t_gdbm
20755 eval $inhdr
20756 case "$t_gdbm" in
20757 $define)
20758         : see if gdbm_open exists
20759         set gdbm_open d_gdbm_open
20760         eval $inlibc
20761         case "$d_gdbm_open" in
20762         $undef)
20763                 t_gdbm="$undef"
20764                 echo "We won't be including <gdbm.h>"
20765                 ;;
20766         esac
20767         ;;
20768 esac
20769 val="$t_gdbm"
20770 set i_gdbm
20771 eval $setvar
20772
20773 echo " "
20774 echo "Looking for extensions..." >&4
20775 : If we are using the old config.sh, known_extensions may contain
20776 : old or inaccurate or duplicate values.
20777 known_extensions=''
20778 nonxs_extensions=''
20779 : We do not use find because it might not be available.
20780 : We do not just use MANIFEST because the user may have dropped
20781 : some additional extensions into the source tree and expect them
20782 : to be built.
20783
20784 : Function to recursively find available extensions, ignoring DynaLoader
20785 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20786 find_extensions='
20787     for xxx in *; do
20788        case "$xxx" in
20789            DynaLoader|dynaload) ;;
20790            *)
20791            if $test -f $xxx/$xxx.xs; then
20792                known_extensions="$known_extensions $1$xxx";
20793            elif $test -f $xxx/Makefile.PL; then
20794                nonxs_extensions="$nonxs_extensions $1$xxx";
20795            else
20796                if $test -d $xxx -a $# -lt 10; then
20797                    set $1$xxx/ $*;
20798                    cd "$xxx";
20799                    eval $find_extensions;
20800                    cd ..;
20801                    shift;
20802                fi;
20803            fi
20804            ;;
20805        esac;
20806     done'
20807 tdir=`pwd`
20808 cd "$rsrc/ext"
20809 set X
20810 shift
20811 eval $find_extensions
20812 # Special case:  Add in threads/shared since it is not picked up by the
20813 # recursive find above (and adding in general recursive finding breaks
20814 # SDBM_File/sdbm).  A.D.  10/25/2001.
20815 known_extensions="$known_extensions threads/shared"
20816 set X $nonxs_extensions
20817 shift
20818 nonxs_extensions="$*"
20819 set X $known_extensions
20820 shift
20821 known_extensions="$*"
20822 cd "$tdir"
20823
20824 : Now see which are supported on this system.
20825 avail_ext=''
20826 for xxx in $known_extensions ; do
20827         case "$xxx" in
20828         DB_File|db_file)
20829                 case "$i_db" in
20830                 $define) avail_ext="$avail_ext $xxx" ;;
20831                 esac
20832                 ;;
20833         GDBM_File|gdbm_fil)
20834                 case "$i_gdbm" in 
20835                 $define) avail_ext="$avail_ext $xxx" ;;
20836                 esac
20837                 ;;
20838         I18N/Langinfo|i18n_lan)
20839                 case "$i_langinfo$d_nl_langinfo" in 
20840                 $define$define) avail_ext="$avail_ext $xxx" ;;
20841                 esac
20842                 ;;
20843         NDBM_File|ndbm_fil)
20844                 case "$i_ndbm" in
20845                 $define)
20846                     case "$osname-$use64bitint" in
20847                     hpux-define)
20848                         case "$libs" in
20849                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20850                         esac
20851                         ;;
20852                     *) avail_ext="$avail_ext $xxx" ;;
20853                     esac
20854                     ;;
20855                 esac
20856                 ;;
20857         ODBM_File|odbm_fil) 
20858                 case "${i_dbm}${i_rpcsvcdbm}" in
20859                 *"${define}"*)
20860                     case "$osname-$use64bitint" in
20861                     hpux-define)
20862                         case "$libs" in
20863                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20864                         esac
20865                         ;;
20866                     *) avail_ext="$avail_ext $xxx" ;;
20867                     esac
20868                     ;;
20869                 esac
20870                 ;;
20871         POSIX|posix)
20872                 case "$useposix" in
20873                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20874                 esac
20875                 ;;
20876         Opcode|opcode)
20877                 case "$useopcode" in
20878                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20879                 esac
20880                 ;;
20881         Socket|socket)
20882                 case "$d_socket" in 
20883                 true|$define|y)
20884                     case "$osname" in
20885                     beos) ;; # not unless BONE
20886                     *) avail_ext="$avail_ext $xxx" ;;
20887                     esac
20888                     ;;
20889                 esac
20890                 ;;
20891         Sys/Syslog|sys/syslog)
20892                 : XXX syslog requires socket
20893                 case "$d_socket" in 
20894                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20895                 esac
20896                 ;;
20897         Thread|thread)
20898                 case "$usethreads" in
20899                 true|$define|y)
20900                         case "$useithreads" in
20901                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20902                         esac
20903                 esac
20904                 ;;
20905         XS/APItest|xs/apitest)
20906                 # This is just for testing.  Skip it unless we have dynamic loading.
20907
20908                 case "$usedl" in
20909                 $define) avail_ext="$avail_ext $xxx" ;;
20910                 esac
20911                 ;;
20912         XS/Typemap|xs/typemap)
20913                 # This is just for testing.  Skip it unless we have dynamic loading.
20914                 case "$usedl" in
20915                 $define) avail_ext="$avail_ext $xxx" ;;
20916                 esac
20917                 ;;
20918         threads|threads/shared)
20919                 # threads and threads::shared are special cases.
20920                 # To stop people from asking "Perl 5.8.0 was supposed
20921                 # to have this new fancy threads implementation but my
20922                 # perl doesn't have it" and from people trying to
20923                 # (re)install the threads module using CPAN.pm and
20924                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20925                 # the threads.pm and threads/shared.pm will always be
20926                 # there, croaking informatively ("you need to rebuild
20927                 # all of Perl with threads, sorry") when threads haven't
20928                 # been compiled in.
20929                 # --jhi
20930                 avail_ext="$avail_ext $xxx"
20931                 ;;
20932         IPC/SysV|ipc/sysv)
20933                 : XXX Do we need a useipcsysv variable here
20934                 case "${d_msg}${d_sem}${d_shm}" in 
20935                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20936                 esac
20937                 ;;
20938         *)      avail_ext="$avail_ext $xxx"
20939                 ;;
20940         esac
20941 done
20942
20943 set X $avail_ext
20944 shift
20945 avail_ext="$*"
20946
20947 case "$onlyextensions" in
20948 '') ;;
20949 *)  keepextensions=''
20950     echo "You have requested that only certains extensions be included..." >&4
20951     for i in $onlyextensions; do
20952         case " $avail_ext " in
20953         *" $i "*)
20954             echo "Keeping extension $i."
20955             keepextensions="$keepextensions $i"
20956             ;;
20957         *) echo "Ignoring extension $i." ;;
20958         esac
20959     done
20960     avail_ext="$keepextensions"
20961     ;;
20962 esac
20963
20964 case "$noextensions" in
20965 '') ;;
20966 *)  keepextensions=''
20967     echo "You have requested that certain extensions be ignored..." >&4
20968     for i in $avail_ext; do
20969         case " $noextensions " in
20970         *" $i "*) echo "Ignoring extension $i." ;;
20971         *) echo "Keeping extension $i.";
20972            keepextensions="$keepextensions $i"
20973            ;;
20974         esac
20975     done
20976     avail_ext="$keepextensions"
20977     ;;
20978 esac
20979
20980 : Now see which nonxs extensions are supported on this system.
20981 : For now assume all are.
20982 nonxs_ext=''
20983 for xxx in $nonxs_extensions ; do
20984         case "$xxx" in
20985         *)      nonxs_ext="$nonxs_ext $xxx"
20986                 ;;
20987         esac
20988 done
20989
20990 set X $nonxs_ext
20991 shift
20992 nonxs_ext="$*"
20993
20994 case $usedl in
20995 $define)
20996         $cat <<EOM
20997 A number of extensions are supplied with $package.  You may choose to
20998 compile these extensions for dynamic loading (the default), compile
20999 them into the $package executable (static loading), or not include
21000 them at all.  Answer "none" to include no extensions.
21001 Note that DynaLoader is always built and need not be mentioned here.
21002
21003 EOM
21004         case "$dynamic_ext" in
21005         '')
21006                 : Exclude those listed in static_ext
21007                 dflt=''
21008                 for xxx in $avail_ext; do
21009                         case " $static_ext " in
21010                         *" $xxx "*) ;;
21011                         *) dflt="$dflt $xxx" ;;
21012                         esac
21013                 done
21014                 set X $dflt
21015                 shift
21016                 dflt="$*"
21017                 ;;
21018         *)      dflt="$dynamic_ext"
21019                 # Perhaps we are reusing an old out-of-date config.sh.
21020                 case "$hint" in
21021                 previous)
21022                         if test X"$dynamic_ext" != X"$avail_ext"; then
21023                                 $cat <<EOM
21024 NOTICE:  Your previous config.sh list may be incorrect. 
21025 The extensions now available to you are 
21026         ${avail_ext}
21027 but the default list from your previous config.sh is
21028         ${dynamic_ext} 
21029
21030 EOM
21031                         fi
21032                         ;;
21033                 esac
21034                 ;;
21035         esac
21036         case "$dflt" in
21037         '')     dflt=none;;
21038         esac
21039         rp="What extensions do you wish to load dynamically?"
21040         . ./myread
21041         case "$ans" in
21042         none) dynamic_ext=' ' ;;
21043         *) dynamic_ext="$ans" ;;
21044         esac
21045
21046         case "$static_ext" in
21047         '')
21048                 : Exclude those already listed in dynamic linking
21049                 dflt=''
21050                 for xxx in $avail_ext; do
21051                         case " $dynamic_ext " in
21052                         *" $xxx "*) ;;
21053                         *) dflt="$dflt $xxx" ;;
21054                         esac
21055                 done
21056                 set X $dflt
21057                 shift
21058                 dflt="$*"
21059                 ;;
21060         *)  dflt="$static_ext" 
21061                 ;;
21062         esac
21063
21064         case "$dflt" in
21065         '')     dflt=none;;
21066         esac
21067         rp="What extensions do you wish to load statically?"
21068         . ./myread
21069         case "$ans" in
21070         none) static_ext=' ' ;;
21071         *) static_ext="$ans" ;;
21072         esac
21073         ;;
21074 *)
21075         $cat <<EOM
21076 A number of extensions are supplied with $package.  Answer "none" 
21077 to include no extensions. 
21078 Note that DynaLoader is always built and need not be mentioned here.
21079
21080 EOM
21081         case "$static_ext" in
21082         '') dflt="$avail_ext" ;;
21083         *)      dflt="$static_ext"
21084                 # Perhaps we are reusing an old out-of-date config.sh.
21085                 case "$hint" in
21086                 previous)
21087                         if test X"$static_ext" != X"$avail_ext"; then
21088                                 $cat <<EOM
21089 NOTICE:  Your previous config.sh list may be incorrect. 
21090 The extensions now available to you are 
21091         ${avail_ext}
21092 but the default list from your previous config.sh is
21093         ${static_ext} 
21094
21095 EOM
21096                         fi
21097                         ;;
21098                 esac
21099                 ;;
21100         esac
21101         : Exclude those that are not xs extensions
21102         case "$dflt" in
21103         '')     dflt=none;;
21104         esac
21105         rp="What extensions do you wish to include?"
21106         . ./myread
21107         case "$ans" in
21108         none) static_ext=' ' ;;
21109         *) static_ext="$ans" ;;
21110         esac
21111         ;;
21112 esac
21113 #        
21114 # Encode is a special case.  If we are building Encode as a static
21115 # extension, we need to explicitly list its subextensions as well.
21116 # For other nested extensions, this is handled automatically by
21117 # the appropriate Makefile.PL.
21118 case " $static_ext " in
21119         *" Encode "*) # Add the subextensions of Encode
21120         cd "$rsrc/ext"
21121         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21122                 static_ext="$static_ext Encode/$xxx"
21123         done
21124         cd "$tdir"
21125         ;;
21126 esac
21127
21128 set X $dynamic_ext $static_ext $nonxs_ext
21129 shift
21130 extensions="$*"
21131
21132 # Sanity check:  We require an extension suitable for use with
21133 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21134 # should show up as failures in the test suite, but it's helpful to
21135 # catch them now.) The 'extensions' list is normally sorted
21136 # alphabetically, so we need to accept either
21137 #    DB_File ... Fcntl ... IO  ....
21138 # or something like
21139 #    Fcntl ... NDBM_File ... IO  ....
21140 case " $extensions"  in
21141 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21142 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21143 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21144 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21145    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21146    ;;
21147 esac
21148
21149 : Remove libraries needed only for extensions
21150 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21151 : The exception is SunOS 4.x, which needs them.
21152 case "${osname}X${osvers}" in
21153 sunos*X4*)
21154     perllibs="$libs"
21155     ;;
21156 *) case "$usedl" in
21157     $define|true|[yY]*)
21158             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21159             shift
21160             perllibs="$*"
21161             ;;
21162     *)  perllibs="$libs"
21163             ;;
21164     esac
21165     ;;
21166 esac
21167
21168 : Remove build directory name from cppstdin so it can be used from
21169 : either the present location or the final installed location.
21170 echo " "
21171 : Get out of the UU directory to get correct path name.
21172 cd ..
21173 case "$cppstdin" in
21174 `pwd`/cppstdin)
21175         echo "Stripping down cppstdin path name"
21176         cppstdin=cppstdin
21177         ;;
21178 esac
21179 cd UU
21180
21181 : end of configuration questions
21182 echo " "
21183 echo "End of configuration questions."
21184 echo " "
21185
21186 : back to where it started
21187 if test -d ../UU; then
21188         cd ..
21189 fi
21190
21191 : configuration may be patched via a 'config.arch' file
21192 if $test -f config.arch; then
21193         echo "I see a config.arch file, loading it."
21194         . ./config.arch
21195 fi
21196
21197 : configuration may be patched via a 'config.over' file
21198 if $test -f config.over; then
21199         echo " "
21200         dflt=y
21201         rp='I see a config.over file.  Do you wish to load it?'
21202         . UU/myread
21203         case "$ans" in
21204         n*) echo "OK, I'll ignore it.";;
21205         *)      . ./config.over
21206                 echo "Configuration override changes have been loaded."
21207                 ;;
21208         esac
21209 fi
21210
21211 : in case they want portability, strip down executable paths
21212 case "$d_portable" in
21213 "$define")
21214         echo " "
21215         echo "Stripping down executable paths..." >&4
21216         for file in $loclist $trylist; do
21217                 eval temp=\$$file
21218                 eval $file=`basename $temp`
21219         done
21220         ;;
21221 esac
21222
21223 : create config.sh file
21224 echo " "
21225 echo "Creating config.sh..." >&4
21226 $spitshell <<EOT >config.sh
21227 $startsh
21228 #
21229 # This file was produced by running the Configure script. It holds all the
21230 # definitions figured out by Configure. Should you modify one of these values,
21231 # do not forget to propagate your changes by running "Configure -der". You may
21232 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21233 #
21234
21235 # Package name      : $package
21236 # Source directory  : $src
21237 # Configuration time: $cf_time
21238 # Configured by     : $cf_by
21239 # Target system     : $myuname
21240
21241 Author='$Author'
21242 Date='$Date'
21243 Header='$Header'
21244 Id='$Id'
21245 Locker='$Locker'
21246 Log='$Log'
21247 Mcc='$Mcc'
21248 RCSfile='$RCSfile'
21249 Revision='$Revision'
21250 Source='$Source'
21251 State='$State'
21252 _a='$_a'
21253 _exe='$_exe'
21254 _o='$_o'
21255 afs='$afs'
21256 afsroot='$afsroot'
21257 alignbytes='$alignbytes'
21258 ansi2knr='$ansi2knr'
21259 aphostname='$aphostname'
21260 api_revision='$api_revision'
21261 api_subversion='$api_subversion'
21262 api_version='$api_version'
21263 api_versionstring='$api_versionstring'
21264 ar='$ar'
21265 archlib='$archlib'
21266 archlibexp='$archlibexp'
21267 archname64='$archname64'
21268 archname='$archname'
21269 archobjs='$archobjs'
21270 asctime_r_proto='$asctime_r_proto'
21271 awk='$awk'
21272 baserev='$baserev'
21273 bash='$bash'
21274 bin='$bin'
21275 binexp='$binexp'
21276 bison='$bison'
21277 byacc='$byacc'
21278 byteorder='$byteorder'
21279 c='$c'
21280 castflags='$castflags'
21281 cat='$cat'
21282 cc='$cc'
21283 cccdlflags='$cccdlflags'
21284 ccdlflags='$ccdlflags'
21285 ccflags='$ccflags'
21286 ccflags_uselargefiles='$ccflags_uselargefiles'
21287 ccname='$ccname'
21288 ccsymbols='$ccsymbols'
21289 ccversion='$ccversion'
21290 cf_by='$cf_by'
21291 cf_email='$cf_email'
21292 cf_time='$cf_time'
21293 charsize='$charsize'
21294 chgrp='$chgrp'
21295 chmod='$chmod'
21296 chown='$chown'
21297 clocktype='$clocktype'
21298 comm='$comm'
21299 compress='$compress'
21300 contains='$contains'
21301 cp='$cp'
21302 cpio='$cpio'
21303 cpp='$cpp'
21304 cpp_stuff='$cpp_stuff'
21305 cppccsymbols='$cppccsymbols'
21306 cppflags='$cppflags'
21307 cpplast='$cpplast'
21308 cppminus='$cppminus'
21309 cpprun='$cpprun'
21310 cppstdin='$cppstdin'
21311 cppsymbols='$cppsymbols'
21312 crypt_r_proto='$crypt_r_proto'
21313 cryptlib='$cryptlib'
21314 csh='$csh'
21315 ctermid_r_proto='$ctermid_r_proto'
21316 ctime_r_proto='$ctime_r_proto'
21317 d_Gconvert='$d_Gconvert'
21318 d_PRIEUldbl='$d_PRIEUldbl'
21319 d_PRIFUldbl='$d_PRIFUldbl'
21320 d_PRIGUldbl='$d_PRIGUldbl'
21321 d_PRIXU64='$d_PRIXU64'
21322 d_PRId64='$d_PRId64'
21323 d_PRIeldbl='$d_PRIeldbl'
21324 d_PRIfldbl='$d_PRIfldbl'
21325 d_PRIgldbl='$d_PRIgldbl'
21326 d_PRIi64='$d_PRIi64'
21327 d_PRIo64='$d_PRIo64'
21328 d_PRIu64='$d_PRIu64'
21329 d_PRIx64='$d_PRIx64'
21330 d_SCNfldbl='$d_SCNfldbl'
21331 d__fwalk='$d__fwalk'
21332 d_access='$d_access'
21333 d_accessx='$d_accessx'
21334 d_aintl='$d_aintl'
21335 d_alarm='$d_alarm'
21336 d_archlib='$d_archlib'
21337 d_asctime_r='$d_asctime_r'
21338 d_atolf='$d_atolf'
21339 d_atoll='$d_atoll'
21340 d_attribute_format='$d_attribute_format'
21341 d_attribute_malloc='$d_attribute_malloc'
21342 d_attribute_nonnull='$d_attribute_nonnull'
21343 d_attribute_noreturn='$d_attribute_noreturn'
21344 d_attribute_pure='$d_attribute_pure'
21345 d_attribute_unused='$d_attribute_unused'
21346 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21347 d_bcmp='$d_bcmp'
21348 d_bcopy='$d_bcopy'
21349 d_bsd='$d_bsd'
21350 d_bsdgetpgrp='$d_bsdgetpgrp'
21351 d_bsdsetpgrp='$d_bsdsetpgrp'
21352 d_builtin_choose_expr='$d_builtin_choose_expr'
21353 d_builtin_expect='$d_builtin_expect'
21354 d_bzero='$d_bzero'
21355 d_c99_variadic_macros='$d_c99_variadic_macros'
21356 d_casti32='$d_casti32'
21357 d_castneg='$d_castneg'
21358 d_charvspr='$d_charvspr'
21359 d_chown='$d_chown'
21360 d_chroot='$d_chroot'
21361 d_chsize='$d_chsize'
21362 d_class='$d_class'
21363 d_clearenv='$d_clearenv'
21364 d_closedir='$d_closedir'
21365 d_cmsghdr_s='$d_cmsghdr_s'
21366 d_const='$d_const'
21367 d_copysignl='$d_copysignl'
21368 d_cplusplus='$d_cplusplus'
21369 d_crypt='$d_crypt'
21370 d_crypt_r='$d_crypt_r'
21371 d_csh='$d_csh'
21372 d_ctermid_r='$d_ctermid_r'
21373 d_ctime_r='$d_ctime_r'
21374 d_cuserid='$d_cuserid'
21375 d_dbl_dig='$d_dbl_dig'
21376 d_dbminitproto='$d_dbminitproto'
21377 d_difftime='$d_difftime'
21378 d_dirfd='$d_dirfd'
21379 d_dirnamlen='$d_dirnamlen'
21380 d_dlerror='$d_dlerror'
21381 d_dlopen='$d_dlopen'
21382 d_dlsymun='$d_dlsymun'
21383 d_dosuid='$d_dosuid'
21384 d_drand48_r='$d_drand48_r'
21385 d_drand48proto='$d_drand48proto'
21386 d_dup2='$d_dup2'
21387 d_eaccess='$d_eaccess'
21388 d_endgrent='$d_endgrent'
21389 d_endgrent_r='$d_endgrent_r'
21390 d_endhent='$d_endhent'
21391 d_endhostent_r='$d_endhostent_r'
21392 d_endnent='$d_endnent'
21393 d_endnetent_r='$d_endnetent_r'
21394 d_endpent='$d_endpent'
21395 d_endprotoent_r='$d_endprotoent_r'
21396 d_endpwent='$d_endpwent'
21397 d_endpwent_r='$d_endpwent_r'
21398 d_endsent='$d_endsent'
21399 d_endservent_r='$d_endservent_r'
21400 d_eofnblk='$d_eofnblk'
21401 d_eunice='$d_eunice'
21402 d_faststdio='$d_faststdio'
21403 d_fchdir='$d_fchdir'
21404 d_fchmod='$d_fchmod'
21405 d_fchown='$d_fchown'
21406 d_fcntl='$d_fcntl'
21407 d_fcntl_can_lock='$d_fcntl_can_lock'
21408 d_fd_macros='$d_fd_macros'
21409 d_fd_set='$d_fd_set'
21410 d_fds_bits='$d_fds_bits'
21411 d_fgetpos='$d_fgetpos'
21412 d_finite='$d_finite'
21413 d_finitel='$d_finitel'
21414 d_flexfnam='$d_flexfnam'
21415 d_flock='$d_flock'
21416 d_flockproto='$d_flockproto'
21417 d_fork='$d_fork'
21418 d_fp_class='$d_fp_class'
21419 d_fpathconf='$d_fpathconf'
21420 d_fpclass='$d_fpclass'
21421 d_fpclassify='$d_fpclassify'
21422 d_fpclassl='$d_fpclassl'
21423 d_fpos64_t='$d_fpos64_t'
21424 d_frexpl='$d_frexpl'
21425 d_fs_data_s='$d_fs_data_s'
21426 d_fseeko='$d_fseeko'
21427 d_fsetpos='$d_fsetpos'
21428 d_fstatfs='$d_fstatfs'
21429 d_fstatvfs='$d_fstatvfs'
21430 d_fsync='$d_fsync'
21431 d_ftello='$d_ftello'
21432 d_ftime='$d_ftime'
21433 d_futimes='$d_futimes'
21434 d_getcwd='$d_getcwd'
21435 d_getespwnam='$d_getespwnam'
21436 d_getfsstat='$d_getfsstat'
21437 d_getgrent='$d_getgrent'
21438 d_getgrent_r='$d_getgrent_r'
21439 d_getgrgid_r='$d_getgrgid_r'
21440 d_getgrnam_r='$d_getgrnam_r'
21441 d_getgrps='$d_getgrps'
21442 d_gethbyaddr='$d_gethbyaddr'
21443 d_gethbyname='$d_gethbyname'
21444 d_gethent='$d_gethent'
21445 d_gethname='$d_gethname'
21446 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21447 d_gethostbyname_r='$d_gethostbyname_r'
21448 d_gethostent_r='$d_gethostent_r'
21449 d_gethostprotos='$d_gethostprotos'
21450 d_getitimer='$d_getitimer'
21451 d_getlogin='$d_getlogin'
21452 d_getlogin_r='$d_getlogin_r'
21453 d_getmnt='$d_getmnt'
21454 d_getmntent='$d_getmntent'
21455 d_getnbyaddr='$d_getnbyaddr'
21456 d_getnbyname='$d_getnbyname'
21457 d_getnent='$d_getnent'
21458 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21459 d_getnetbyname_r='$d_getnetbyname_r'
21460 d_getnetent_r='$d_getnetent_r'
21461 d_getnetprotos='$d_getnetprotos'
21462 d_getpagsz='$d_getpagsz'
21463 d_getpbyname='$d_getpbyname'
21464 d_getpbynumber='$d_getpbynumber'
21465 d_getpent='$d_getpent'
21466 d_getpgid='$d_getpgid'
21467 d_getpgrp2='$d_getpgrp2'
21468 d_getpgrp='$d_getpgrp'
21469 d_getppid='$d_getppid'
21470 d_getprior='$d_getprior'
21471 d_getprotobyname_r='$d_getprotobyname_r'
21472 d_getprotobynumber_r='$d_getprotobynumber_r'
21473 d_getprotoent_r='$d_getprotoent_r'
21474 d_getprotoprotos='$d_getprotoprotos'
21475 d_getprpwnam='$d_getprpwnam'
21476 d_getpwent='$d_getpwent'
21477 d_getpwent_r='$d_getpwent_r'
21478 d_getpwnam_r='$d_getpwnam_r'
21479 d_getpwuid_r='$d_getpwuid_r'
21480 d_getsbyname='$d_getsbyname'
21481 d_getsbyport='$d_getsbyport'
21482 d_getsent='$d_getsent'
21483 d_getservbyname_r='$d_getservbyname_r'
21484 d_getservbyport_r='$d_getservbyport_r'
21485 d_getservent_r='$d_getservent_r'
21486 d_getservprotos='$d_getservprotos'
21487 d_getspnam='$d_getspnam'
21488 d_getspnam_r='$d_getspnam_r'
21489 d_gettimeod='$d_gettimeod'
21490 d_gmtime_r='$d_gmtime_r'
21491 d_gnulibc='$d_gnulibc'
21492 d_grpasswd='$d_grpasswd'
21493 d_hasmntopt='$d_hasmntopt'
21494 d_htonl='$d_htonl'
21495 d_ilogbl='$d_ilogbl'
21496 d_inc_version_list='$d_inc_version_list'
21497 d_index='$d_index'
21498 d_inetaton='$d_inetaton'
21499 d_int64_t='$d_int64_t'
21500 d_isascii='$d_isascii'
21501 d_isfinite='$d_isfinite'
21502 d_isinf='$d_isinf'
21503 d_isnan='$d_isnan'
21504 d_isnanl='$d_isnanl'
21505 d_killpg='$d_killpg'
21506 d_lchown='$d_lchown'
21507 d_ldbl_dig='$d_ldbl_dig'
21508 d_libm_lib_version='$d_libm_lib_version'
21509 d_link='$d_link'
21510 d_localtime_r='$d_localtime_r'
21511 d_locconv='$d_locconv'
21512 d_lockf='$d_lockf'
21513 d_longdbl='$d_longdbl'
21514 d_longlong='$d_longlong'
21515 d_lseekproto='$d_lseekproto'
21516 d_lstat='$d_lstat'
21517 d_madvise='$d_madvise'
21518 d_malloc_good_size='$d_malloc_good_size'
21519 d_malloc_size='$d_malloc_size'
21520 d_mblen='$d_mblen'
21521 d_mbstowcs='$d_mbstowcs'
21522 d_mbtowc='$d_mbtowc'
21523 d_memchr='$d_memchr'
21524 d_memcmp='$d_memcmp'
21525 d_memcpy='$d_memcpy'
21526 d_memmove='$d_memmove'
21527 d_memset='$d_memset'
21528 d_mkdir='$d_mkdir'
21529 d_mkdtemp='$d_mkdtemp'
21530 d_mkfifo='$d_mkfifo'
21531 d_mkstemp='$d_mkstemp'
21532 d_mkstemps='$d_mkstemps'
21533 d_mktime='$d_mktime'
21534 d_mmap='$d_mmap'
21535 d_modfl='$d_modfl'
21536 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21537 d_modflproto='$d_modflproto'
21538 d_mprotect='$d_mprotect'
21539 d_msg='$d_msg'
21540 d_msg_ctrunc='$d_msg_ctrunc'
21541 d_msg_dontroute='$d_msg_dontroute'
21542 d_msg_oob='$d_msg_oob'
21543 d_msg_peek='$d_msg_peek'
21544 d_msg_proxy='$d_msg_proxy'
21545 d_msgctl='$d_msgctl'
21546 d_msgget='$d_msgget'
21547 d_msghdr_s='$d_msghdr_s'
21548 d_msgrcv='$d_msgrcv'
21549 d_msgsnd='$d_msgsnd'
21550 d_msync='$d_msync'
21551 d_munmap='$d_munmap'
21552 d_mymalloc='$d_mymalloc'
21553 d_nice='$d_nice'
21554 d_nl_langinfo='$d_nl_langinfo'
21555 d_nv_preserves_uv='$d_nv_preserves_uv'
21556 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21557 d_off64_t='$d_off64_t'
21558 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21559 d_oldpthreads='$d_oldpthreads'
21560 d_oldsock='$d_oldsock'
21561 d_open3='$d_open3'
21562 d_pathconf='$d_pathconf'
21563 d_pause='$d_pause'
21564 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21565 d_phostname='$d_phostname'
21566 d_pipe='$d_pipe'
21567 d_poll='$d_poll'
21568 d_portable='$d_portable'
21569 d_procselfexe='$d_procselfexe'
21570 d_pthread_atfork='$d_pthread_atfork'
21571 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21572 d_pthread_yield='$d_pthread_yield'
21573 d_pwage='$d_pwage'
21574 d_pwchange='$d_pwchange'
21575 d_pwclass='$d_pwclass'
21576 d_pwcomment='$d_pwcomment'
21577 d_pwexpire='$d_pwexpire'
21578 d_pwgecos='$d_pwgecos'
21579 d_pwpasswd='$d_pwpasswd'
21580 d_pwquota='$d_pwquota'
21581 d_qgcvt='$d_qgcvt'
21582 d_quad='$d_quad'
21583 d_random_r='$d_random_r'
21584 d_readdir64_r='$d_readdir64_r'
21585 d_readdir='$d_readdir'
21586 d_readdir_r='$d_readdir_r'
21587 d_readlink='$d_readlink'
21588 d_readv='$d_readv'
21589 d_recvmsg='$d_recvmsg'
21590 d_rename='$d_rename'
21591 d_rewinddir='$d_rewinddir'
21592 d_rmdir='$d_rmdir'
21593 d_safebcpy='$d_safebcpy'
21594 d_safemcpy='$d_safemcpy'
21595 d_sanemcmp='$d_sanemcmp'
21596 d_sbrkproto='$d_sbrkproto'
21597 d_scalbnl='$d_scalbnl'
21598 d_sched_yield='$d_sched_yield'
21599 d_scm_rights='$d_scm_rights'
21600 d_seekdir='$d_seekdir'
21601 d_select='$d_select'
21602 d_sem='$d_sem'
21603 d_semctl='$d_semctl'
21604 d_semctl_semid_ds='$d_semctl_semid_ds'
21605 d_semctl_semun='$d_semctl_semun'
21606 d_semget='$d_semget'
21607 d_semop='$d_semop'
21608 d_sendmsg='$d_sendmsg'
21609 d_setegid='$d_setegid'
21610 d_seteuid='$d_seteuid'
21611 d_setgrent='$d_setgrent'
21612 d_setgrent_r='$d_setgrent_r'
21613 d_setgrps='$d_setgrps'
21614 d_sethent='$d_sethent'
21615 d_sethostent_r='$d_sethostent_r'
21616 d_setitimer='$d_setitimer'
21617 d_setlinebuf='$d_setlinebuf'
21618 d_setlocale='$d_setlocale'
21619 d_setlocale_r='$d_setlocale_r'
21620 d_setnent='$d_setnent'
21621 d_setnetent_r='$d_setnetent_r'
21622 d_setpent='$d_setpent'
21623 d_setpgid='$d_setpgid'
21624 d_setpgrp2='$d_setpgrp2'
21625 d_setpgrp='$d_setpgrp'
21626 d_setprior='$d_setprior'
21627 d_setproctitle='$d_setproctitle'
21628 d_setprotoent_r='$d_setprotoent_r'
21629 d_setpwent='$d_setpwent'
21630 d_setpwent_r='$d_setpwent_r'
21631 d_setregid='$d_setregid'
21632 d_setresgid='$d_setresgid'
21633 d_setresuid='$d_setresuid'
21634 d_setreuid='$d_setreuid'
21635 d_setrgid='$d_setrgid'
21636 d_setruid='$d_setruid'
21637 d_setsent='$d_setsent'
21638 d_setservent_r='$d_setservent_r'
21639 d_setsid='$d_setsid'
21640 d_setvbuf='$d_setvbuf'
21641 d_sfio='$d_sfio'
21642 d_shm='$d_shm'
21643 d_shmat='$d_shmat'
21644 d_shmatprototype='$d_shmatprototype'
21645 d_shmctl='$d_shmctl'
21646 d_shmdt='$d_shmdt'
21647 d_shmget='$d_shmget'
21648 d_sigaction='$d_sigaction'
21649 d_sigprocmask='$d_sigprocmask'
21650 d_sigsetjmp='$d_sigsetjmp'
21651 d_snprintf='$d_snprintf'
21652 d_sitearch='$d_sitearch'
21653 d_sockatmark='$d_sockatmark'
21654 d_sockatmarkproto='$d_sockatmarkproto'
21655 d_socket='$d_socket'
21656 d_socklen_t='$d_socklen_t'
21657 d_sockpair='$d_sockpair'
21658 d_socks5_init='$d_socks5_init'
21659 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21660 d_sqrtl='$d_sqrtl'
21661 d_srand48_r='$d_srand48_r'
21662 d_srandom_r='$d_srandom_r'
21663 d_sresgproto='$d_sresgproto'
21664 d_sresuproto='$d_sresuproto'
21665 d_statblks='$d_statblks'
21666 d_statfs_f_flags='$d_statfs_f_flags'
21667 d_statfs_s='$d_statfs_s'
21668 d_statvfs='$d_statvfs'
21669 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21670 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21671 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21672 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21673 d_stdio_stream_array='$d_stdio_stream_array'
21674 d_stdiobase='$d_stdiobase'
21675 d_stdstdio='$d_stdstdio'
21676 d_strchr='$d_strchr'
21677 d_strcoll='$d_strcoll'
21678 d_strctcpy='$d_strctcpy'
21679 d_strerrm='$d_strerrm'
21680 d_strerror='$d_strerror'
21681 d_strerror_r='$d_strerror_r'
21682 d_strftime='$d_strftime'
21683 d_strlcat='$d_strlcat'
21684 d_strlcpy='$d_strlcpy'
21685 d_strtod='$d_strtod'
21686 d_strtol='$d_strtol'
21687 d_strtold='$d_strtold'
21688 d_strtoll='$d_strtoll'
21689 d_strtoq='$d_strtoq'
21690 d_strtoul='$d_strtoul'
21691 d_strtoull='$d_strtoull'
21692 d_strtouq='$d_strtouq'
21693 d_strxfrm='$d_strxfrm'
21694 d_suidsafe='$d_suidsafe'
21695 d_symlink='$d_symlink'
21696 d_syscall='$d_syscall'
21697 d_syscallproto='$d_syscallproto'
21698 d_sysconf='$d_sysconf'
21699 d_sysernlst='$d_sysernlst'
21700 d_syserrlst='$d_syserrlst'
21701 d_system='$d_system'
21702 d_tcgetpgrp='$d_tcgetpgrp'
21703 d_tcsetpgrp='$d_tcsetpgrp'
21704 d_telldir='$d_telldir'
21705 d_telldirproto='$d_telldirproto'
21706 d_time='$d_time'
21707 d_times='$d_times'
21708 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21709 d_tm_tm_zone='$d_tm_tm_zone'
21710 d_tmpnam_r='$d_tmpnam_r'
21711 d_truncate='$d_truncate'
21712 d_ttyname_r='$d_ttyname_r'
21713 d_tzname='$d_tzname'
21714 d_u32align='$d_u32align'
21715 d_ualarm='$d_ualarm'
21716 d_umask='$d_umask'
21717 d_uname='$d_uname'
21718 d_union_semun='$d_union_semun'
21719 d_unordered='$d_unordered'
21720 d_unsetenv='$d_unsetenv'
21721 d_usleep='$d_usleep'
21722 d_usleepproto='$d_usleepproto'
21723 d_ustat='$d_ustat'
21724 d_vendorarch='$d_vendorarch'
21725 d_vendorbin='$d_vendorbin'
21726 d_vendorlib='$d_vendorlib'
21727 d_vendorscript='$d_vendorscript'
21728 d_vfork='$d_vfork'
21729 d_void_closedir='$d_void_closedir'
21730 d_voidsig='$d_voidsig'
21731 d_voidtty='$d_voidtty'
21732 d_volatile='$d_volatile'
21733 d_vprintf='$d_vprintf'
21734 d_vsnprintf='$d_vsnprintf'
21735 d_wait4='$d_wait4'
21736 d_waitpid='$d_waitpid'
21737 d_wcstombs='$d_wcstombs'
21738 d_wctomb='$d_wctomb'
21739 d_writev='$d_writev'
21740 d_xenix='$d_xenix'
21741 date='$date'
21742 db_hashtype='$db_hashtype'
21743 db_prefixtype='$db_prefixtype'
21744 db_version_major='$db_version_major'
21745 db_version_minor='$db_version_minor'
21746 db_version_patch='$db_version_patch'
21747 defvoidused='$defvoidused'
21748 direntrytype='$direntrytype'
21749 dlext='$dlext'
21750 dlsrc='$dlsrc'
21751 doublesize='$doublesize'
21752 drand01='$drand01'
21753 drand48_r_proto='$drand48_r_proto'
21754 dynamic_ext='$dynamic_ext'
21755 eagain='$eagain'
21756 ebcdic='$ebcdic'
21757 echo='$echo'
21758 egrep='$egrep'
21759 emacs='$emacs'
21760 endgrent_r_proto='$endgrent_r_proto'
21761 endhostent_r_proto='$endhostent_r_proto'
21762 endnetent_r_proto='$endnetent_r_proto'
21763 endprotoent_r_proto='$endprotoent_r_proto'
21764 endpwent_r_proto='$endpwent_r_proto'
21765 endservent_r_proto='$endservent_r_proto'
21766 eunicefix='$eunicefix'
21767 exe_ext='$exe_ext'
21768 expr='$expr'
21769 extensions='$extensions'
21770 extras='$extras'
21771 fflushNULL='$fflushNULL'
21772 fflushall='$fflushall'
21773 find='$find'
21774 firstmakefile='$firstmakefile'
21775 flex='$flex'
21776 fpossize='$fpossize'
21777 fpostype='$fpostype'
21778 freetype='$freetype'
21779 from='$from'
21780 full_ar='$full_ar'
21781 full_csh='$full_csh'
21782 full_sed='$full_sed'
21783 gccansipedantic='$gccansipedantic'
21784 gccosandvers='$gccosandvers'
21785 gccversion='$gccversion'
21786 getgrent_r_proto='$getgrent_r_proto'
21787 getgrgid_r_proto='$getgrgid_r_proto'
21788 getgrnam_r_proto='$getgrnam_r_proto'
21789 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21790 gethostbyname_r_proto='$gethostbyname_r_proto'
21791 gethostent_r_proto='$gethostent_r_proto'
21792 getlogin_r_proto='$getlogin_r_proto'
21793 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21794 getnetbyname_r_proto='$getnetbyname_r_proto'
21795 getnetent_r_proto='$getnetent_r_proto'
21796 getprotobyname_r_proto='$getprotobyname_r_proto'
21797 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21798 getprotoent_r_proto='$getprotoent_r_proto'
21799 getpwent_r_proto='$getpwent_r_proto'
21800 getpwnam_r_proto='$getpwnam_r_proto'
21801 getpwuid_r_proto='$getpwuid_r_proto'
21802 getservbyname_r_proto='$getservbyname_r_proto'
21803 getservbyport_r_proto='$getservbyport_r_proto'
21804 getservent_r_proto='$getservent_r_proto'
21805 getspnam_r_proto='$getspnam_r_proto'
21806 gidformat='$gidformat'
21807 gidsign='$gidsign'
21808 gidsize='$gidsize'
21809 gidtype='$gidtype'
21810 glibpth='$glibpth'
21811 gmake='$gmake'
21812 gmtime_r_proto='$gmtime_r_proto'
21813 gnulibc_version='$gnulibc_version'
21814 grep='$grep'
21815 groupcat='$groupcat'
21816 groupstype='$groupstype'
21817 gzip='$gzip'
21818 h_fcntl='$h_fcntl'
21819 h_sysfile='$h_sysfile'
21820 hint='$hint'
21821 hostcat='$hostcat'
21822 html1dir='$html1dir'
21823 html1direxp='$html1direxp'
21824 html3dir='$html3dir'
21825 html3direxp='$html3direxp'
21826 i16size='$i16size'
21827 i16type='$i16type'
21828 i32size='$i32size'
21829 i32type='$i32type'
21830 i64size='$i64size'
21831 i64type='$i64type'
21832 i8size='$i8size'
21833 i8type='$i8type'
21834 i_arpainet='$i_arpainet'
21835 i_bsdioctl='$i_bsdioctl'
21836 i_crypt='$i_crypt'
21837 i_db='$i_db'
21838 i_dbm='$i_dbm'
21839 i_dirent='$i_dirent'
21840 i_dld='$i_dld'
21841 i_dlfcn='$i_dlfcn'
21842 i_fcntl='$i_fcntl'
21843 i_float='$i_float'
21844 i_fp='$i_fp'
21845 i_fp_class='$i_fp_class'
21846 i_gdbm='$i_gdbm'
21847 i_grp='$i_grp'
21848 i_ieeefp='$i_ieeefp'
21849 i_inttypes='$i_inttypes'
21850 i_langinfo='$i_langinfo'
21851 i_libutil='$i_libutil'
21852 i_limits='$i_limits'
21853 i_locale='$i_locale'
21854 i_machcthr='$i_machcthr'
21855 i_malloc='$i_malloc'
21856 i_math='$i_math'
21857 i_memory='$i_memory'
21858 i_mntent='$i_mntent'
21859 i_ndbm='$i_ndbm'
21860 i_netdb='$i_netdb'
21861 i_neterrno='$i_neterrno'
21862 i_netinettcp='$i_netinettcp'
21863 i_niin='$i_niin'
21864 i_poll='$i_poll'
21865 i_prot='$i_prot'
21866 i_pthread='$i_pthread'
21867 i_pwd='$i_pwd'
21868 i_rpcsvcdbm='$i_rpcsvcdbm'
21869 i_sfio='$i_sfio'
21870 i_sgtty='$i_sgtty'
21871 i_shadow='$i_shadow'
21872 i_socks='$i_socks'
21873 i_stdarg='$i_stdarg'
21874 i_stddef='$i_stddef'
21875 i_stdlib='$i_stdlib'
21876 i_string='$i_string'
21877 i_sunmath='$i_sunmath'
21878 i_sysaccess='$i_sysaccess'
21879 i_sysdir='$i_sysdir'
21880 i_sysfile='$i_sysfile'
21881 i_sysfilio='$i_sysfilio'
21882 i_sysin='$i_sysin'
21883 i_sysioctl='$i_sysioctl'
21884 i_syslog='$i_syslog'
21885 i_sysmman='$i_sysmman'
21886 i_sysmode='$i_sysmode'
21887 i_sysmount='$i_sysmount'
21888 i_sysndir='$i_sysndir'
21889 i_sysparam='$i_sysparam'
21890 i_sysresrc='$i_sysresrc'
21891 i_syssecrt='$i_syssecrt'
21892 i_sysselct='$i_sysselct'
21893 i_syssockio='$i_syssockio'
21894 i_sysstat='$i_sysstat'
21895 i_sysstatfs='$i_sysstatfs'
21896 i_sysstatvfs='$i_sysstatvfs'
21897 i_systime='$i_systime'
21898 i_systimek='$i_systimek'
21899 i_systimes='$i_systimes'
21900 i_systypes='$i_systypes'
21901 i_sysuio='$i_sysuio'
21902 i_sysun='$i_sysun'
21903 i_sysutsname='$i_sysutsname'
21904 i_sysvfs='$i_sysvfs'
21905 i_syswait='$i_syswait'
21906 i_termio='$i_termio'
21907 i_termios='$i_termios'
21908 i_time='$i_time'
21909 i_unistd='$i_unistd'
21910 i_ustat='$i_ustat'
21911 i_utime='$i_utime'
21912 i_values='$i_values'
21913 i_varargs='$i_varargs'
21914 i_varhdr='$i_varhdr'
21915 i_vfork='$i_vfork'
21916 ignore_versioned_solibs='$ignore_versioned_solibs'
21917 inc_version_list='$inc_version_list'
21918 inc_version_list_init='$inc_version_list_init'
21919 incpath='$incpath'
21920 inews='$inews'
21921 initialinstalllocation='$initialinstalllocation'
21922 installarchlib='$installarchlib'
21923 installbin='$installbin'
21924 installhtml1dir='$installhtml1dir'
21925 installhtml3dir='$installhtml3dir'
21926 installman1dir='$installman1dir'
21927 installman3dir='$installman3dir'
21928 installprefix='$installprefix'
21929 installprefixexp='$installprefixexp'
21930 installprivlib='$installprivlib'
21931 installscript='$installscript'
21932 installsitearch='$installsitearch'
21933 installsitebin='$installsitebin'
21934 installsitehtml1dir='$installsitehtml1dir'
21935 installsitehtml3dir='$installsitehtml3dir'
21936 installsitelib='$installsitelib'
21937 installsiteman1dir='$installsiteman1dir'
21938 installsiteman3dir='$installsiteman3dir'
21939 installsitescript='$installsitescript'
21940 installstyle='$installstyle'
21941 installusrbinperl='$installusrbinperl'
21942 installvendorarch='$installvendorarch'
21943 installvendorbin='$installvendorbin'
21944 installvendorhtml1dir='$installvendorhtml1dir'
21945 installvendorhtml3dir='$installvendorhtml3dir'
21946 installvendorlib='$installvendorlib'
21947 installvendorman1dir='$installvendorman1dir'
21948 installvendorman3dir='$installvendorman3dir'
21949 installvendorscript='$installvendorscript'
21950 intsize='$intsize'
21951 issymlink='$issymlink'
21952 ivdformat='$ivdformat'
21953 ivsize='$ivsize'
21954 ivtype='$ivtype'
21955 known_extensions='$known_extensions'
21956 ksh='$ksh'
21957 ld='$ld'
21958 lddlflags='$lddlflags'
21959 ldflags='$ldflags'
21960 ldflags_uselargefiles='$ldflags_uselargefiles'
21961 ldlibpthname='$ldlibpthname'
21962 less='$less'
21963 lib_ext='$lib_ext'
21964 libc='$libc'
21965 libperl='$libperl'
21966 libpth='$libpth'
21967 libs='$libs'
21968 libsdirs='$libsdirs'
21969 libsfiles='$libsfiles'
21970 libsfound='$libsfound'
21971 libspath='$libspath'
21972 libswanted='$libswanted'
21973 libswanted_uselargefiles='$libswanted_uselargefiles'
21974 line='$line'
21975 lint='$lint'
21976 lkflags='$lkflags'
21977 ln='$ln'
21978 lns='$lns'
21979 localtime_r_proto='$localtime_r_proto'
21980 locincpth='$locincpth'
21981 loclibpth='$loclibpth'
21982 longdblsize='$longdblsize'
21983 longlongsize='$longlongsize'
21984 longsize='$longsize'
21985 lp='$lp'
21986 lpr='$lpr'
21987 ls='$ls'
21988 lseeksize='$lseeksize'
21989 lseektype='$lseektype'
21990 mad='$mad'
21991 madlyh='$madlyh'
21992 madlyobj='$madlyobj'
21993 madlysrc='$madlysrc'
21994 mail='$mail'
21995 mailx='$mailx'
21996 make='$make'
21997 make_set_make='$make_set_make'
21998 mallocobj='$mallocobj'
21999 mallocsrc='$mallocsrc'
22000 malloctype='$malloctype'
22001 man1dir='$man1dir'
22002 man1direxp='$man1direxp'
22003 man1ext='$man1ext'
22004 man3dir='$man3dir'
22005 man3direxp='$man3direxp'
22006 man3ext='$man3ext'
22007 mips_type='$mips_type'
22008 mistrustnm='$mistrustnm'
22009 mkdir='$mkdir'
22010 mmaptype='$mmaptype'
22011 modetype='$modetype'
22012 more='$more'
22013 multiarch='$multiarch'
22014 mv='$mv'
22015 myarchname='$myarchname'
22016 mydomain='$mydomain'
22017 myhostname='$myhostname'
22018 myuname='$myuname'
22019 n='$n'
22020 need_va_copy='$need_va_copy'
22021 netdb_hlen_type='$netdb_hlen_type'
22022 netdb_host_type='$netdb_host_type'
22023 netdb_name_type='$netdb_name_type'
22024 netdb_net_type='$netdb_net_type'
22025 nm='$nm'
22026 nm_opt='$nm_opt'
22027 nm_so_opt='$nm_so_opt'
22028 nonxs_ext='$nonxs_ext'
22029 nroff='$nroff'
22030 nvEUformat='$nvEUformat'
22031 nvFUformat='$nvFUformat'
22032 nvGUformat='$nvGUformat'
22033 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22034 nveformat='$nveformat'
22035 nvfformat='$nvfformat'
22036 nvgformat='$nvgformat'
22037 nvsize='$nvsize'
22038 nvtype='$nvtype'
22039 o_nonblock='$o_nonblock'
22040 obj_ext='$obj_ext'
22041 old_pthread_create_joinable='$old_pthread_create_joinable'
22042 optimize='$optimize'
22043 orderlib='$orderlib'
22044 osname='$osname'
22045 osvers='$osvers'
22046 otherlibdirs='$otherlibdirs'
22047 package='$package'
22048 pager='$pager'
22049 passcat='$passcat'
22050 patchlevel='$patchlevel'
22051 path_sep='$path_sep'
22052 perl5='$perl5'
22053 perl='$perl'
22054 perl_patchlevel='$perl_patchlevel'
22055 perladmin='$perladmin'
22056 perllibs='$perllibs'
22057 perlpath='$perlpath'
22058 pg='$pg'
22059 phostname='$phostname'
22060 pidtype='$pidtype'
22061 plibpth='$plibpth'
22062 pmake='$pmake'
22063 pr='$pr'
22064 prefix='$prefix'
22065 prefixexp='$prefixexp'
22066 privlib='$privlib'
22067 privlibexp='$privlibexp'
22068 procselfexe='$procselfexe'
22069 prototype='$prototype'
22070 ptrsize='$ptrsize'
22071 quadkind='$quadkind'
22072 quadtype='$quadtype'
22073 randbits='$randbits'
22074 randfunc='$randfunc'
22075 random_r_proto='$random_r_proto'
22076 randseedtype='$randseedtype'
22077 ranlib='$ranlib'
22078 rd_nodata='$rd_nodata'
22079 readdir64_r_proto='$readdir64_r_proto'
22080 readdir_r_proto='$readdir_r_proto'
22081 revision='$revision'
22082 rm='$rm'
22083 rmail='$rmail'
22084 run='$run'
22085 runnm='$runnm'
22086 sPRIEUldbl='$sPRIEUldbl'
22087 sPRIFUldbl='$sPRIFUldbl'
22088 sPRIGUldbl='$sPRIGUldbl'
22089 sPRIXU64='$sPRIXU64'
22090 sPRId64='$sPRId64'
22091 sPRIeldbl='$sPRIeldbl'
22092 sPRIfldbl='$sPRIfldbl'
22093 sPRIgldbl='$sPRIgldbl'
22094 sPRIi64='$sPRIi64'
22095 sPRIo64='$sPRIo64'
22096 sPRIu64='$sPRIu64'
22097 sPRIx64='$sPRIx64'
22098 sSCNfldbl='$sSCNfldbl'
22099 sched_yield='$sched_yield'
22100 scriptdir='$scriptdir'
22101 scriptdirexp='$scriptdirexp'
22102 sed='$sed'
22103 seedfunc='$seedfunc'
22104 selectminbits='$selectminbits'
22105 selecttype='$selecttype'
22106 sendmail='$sendmail'
22107 setgrent_r_proto='$setgrent_r_proto'
22108 sethostent_r_proto='$sethostent_r_proto'
22109 setlocale_r_proto='$setlocale_r_proto'
22110 setnetent_r_proto='$setnetent_r_proto'
22111 setprotoent_r_proto='$setprotoent_r_proto'
22112 setpwent_r_proto='$setpwent_r_proto'
22113 setservent_r_proto='$setservent_r_proto'
22114 sh='$sh'
22115 shar='$shar'
22116 sharpbang='$sharpbang'
22117 shmattype='$shmattype'
22118 shortsize='$shortsize'
22119 shrpenv='$shrpenv'
22120 shsharp='$shsharp'
22121 sig_count='$sig_count'
22122 sig_name='$sig_name'
22123 sig_name_init='$sig_name_init'
22124 sig_num='$sig_num'
22125 sig_num_init='$sig_num_init'
22126 sig_size='$sig_size'
22127 signal_t='$signal_t'
22128 sitearch='$sitearch'
22129 sitearchexp='$sitearchexp'
22130 sitebin='$sitebin'
22131 sitebinexp='$sitebinexp'
22132 sitehtml1dir='$sitehtml1dir'
22133 sitehtml1direxp='$sitehtml1direxp'
22134 sitehtml3dir='$sitehtml3dir'
22135 sitehtml3direxp='$sitehtml3direxp'
22136 sitelib='$sitelib'
22137 sitelib_stem='$sitelib_stem'
22138 sitelibexp='$sitelibexp'
22139 siteman1dir='$siteman1dir'
22140 siteman1direxp='$siteman1direxp'
22141 siteman3dir='$siteman3dir'
22142 siteman3direxp='$siteman3direxp'
22143 siteprefix='$siteprefix'
22144 siteprefixexp='$siteprefixexp'
22145 sitescript='$sitescript'
22146 sitescriptexp='$sitescriptexp'
22147 sizesize='$sizesize'
22148 sizetype='$sizetype'
22149 sleep='$sleep'
22150 smail='$smail'
22151 so='$so'
22152 sockethdr='$sockethdr'
22153 socketlib='$socketlib'
22154 socksizetype='$socksizetype'
22155 sort='$sort'
22156 spackage='$spackage'
22157 spitshell='$spitshell'
22158 srand48_r_proto='$srand48_r_proto'
22159 srandom_r_proto='$srandom_r_proto'
22160 src='$src'
22161 ssizetype='$ssizetype'
22162 startperl='$startperl'
22163 startsh='$startsh'
22164 static_ext='$static_ext'
22165 stdchar='$stdchar'
22166 stdio_base='$stdio_base'
22167 stdio_bufsiz='$stdio_bufsiz'
22168 stdio_cnt='$stdio_cnt'
22169 stdio_filbuf='$stdio_filbuf'
22170 stdio_ptr='$stdio_ptr'
22171 stdio_stream_array='$stdio_stream_array'
22172 strerror_r_proto='$strerror_r_proto'
22173 strings='$strings'
22174 submit='$submit'
22175 subversion='$subversion'
22176 sysman='$sysman'
22177 tail='$tail'
22178 tar='$tar'
22179 targetarch='$targetarch'
22180 tbl='$tbl'
22181 tee='$tee'
22182 test='$test'
22183 timeincl='$timeincl'
22184 timetype='$timetype'
22185 tmpnam_r_proto='$tmpnam_r_proto'
22186 to='$to'
22187 touch='$touch'
22188 tr='$tr'
22189 trnl='$trnl'
22190 troff='$troff'
22191 ttyname_r_proto='$ttyname_r_proto'
22192 u16size='$u16size'
22193 u16type='$u16type'
22194 u32size='$u32size'
22195 u32type='$u32type'
22196 u64size='$u64size'
22197 u64type='$u64type'
22198 u8size='$u8size'
22199 u8type='$u8type'
22200 uidformat='$uidformat'
22201 uidsign='$uidsign'
22202 uidsize='$uidsize'
22203 uidtype='$uidtype'
22204 uname='$uname'
22205 uniq='$uniq'
22206 uquadtype='$uquadtype'
22207 use5005threads='$use5005threads'
22208 use64bitall='$use64bitall'
22209 use64bitint='$use64bitint'
22210 usecrosscompile='$usecrosscompile'
22211 usedl='$usedl'
22212 usefaststdio='$usefaststdio'
22213 useithreads='$useithreads'
22214 uselargefiles='$uselargefiles'
22215 uselongdouble='$uselongdouble'
22216 usemallocwrap='$usemallocwrap'
22217 usemorebits='$usemorebits'
22218 usemultiplicity='$usemultiplicity'
22219 usemymalloc='$usemymalloc'
22220 usenm='$usenm'
22221 useopcode='$useopcode'
22222 useperlio='$useperlio'
22223 useposix='$useposix'
22224 usereentrant='$usereentrant'
22225 userelocatableinc='$userelocatableinc'
22226 usesfio='$usesfio'
22227 useshrplib='$useshrplib'
22228 usesitecustomize='$usesitecustomize'
22229 usesocks='$usesocks'
22230 usethreads='$usethreads'
22231 usevendorprefix='$usevendorprefix'
22232 usevfork='$usevfork'
22233 usrinc='$usrinc'
22234 uuname='$uuname'
22235 uvXUformat='$uvXUformat'
22236 uvoformat='$uvoformat'
22237 uvsize='$uvsize'
22238 uvtype='$uvtype'
22239 uvuformat='$uvuformat'
22240 uvxformat='$uvxformat'
22241 vendorarch='$vendorarch'
22242 vendorarchexp='$vendorarchexp'
22243 vendorbin='$vendorbin'
22244 vendorbinexp='$vendorbinexp'
22245 vendorhtml1dir='$vendorhtml1dir'
22246 vendorhtml1direxp='$vendorhtml1direxp'
22247 vendorhtml3dir='$vendorhtml3dir'
22248 vendorhtml3direxp='$vendorhtml3direxp'
22249 vendorlib='$vendorlib'
22250 vendorlib_stem='$vendorlib_stem'
22251 vendorlibexp='$vendorlibexp'
22252 vendorman1dir='$vendorman1dir'
22253 vendorman1direxp='$vendorman1direxp'
22254 vendorman3dir='$vendorman3dir'
22255 vendorman3direxp='$vendorman3direxp'
22256 vendorprefix='$vendorprefix'
22257 vendorprefixexp='$vendorprefixexp'
22258 vendorscript='$vendorscript'
22259 vendorscriptexp='$vendorscriptexp'
22260 version='$version'
22261 version_patchlevel_string='$version_patchlevel_string'
22262 versiononly='$versiononly'
22263 vi='$vi'
22264 voidflags='$voidflags'
22265 xlibpth='$xlibpth'
22266 yacc='$yacc'
22267 yaccflags='$yaccflags'
22268 zcat='$zcat'
22269 zip='$zip'
22270 EOT
22271
22272 : Add in command line options if available
22273 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22274
22275 : add special variables
22276 $test -f $src/patchlevel.h && \
22277 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22278 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22279 echo "PERL_CONFIG_SH=true" >>config.sh
22280
22281 : propagate old symbols
22282 if $test -f UU/config.sh; then
22283         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22284         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22285         $sort | $uniq -u >UU/oldsyms
22286         set X `cat UU/oldsyms`
22287         shift
22288         case $# in
22289         0) ;;
22290         *)
22291                 cat <<EOM
22292 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22293 EOM
22294                 echo "# Variables propagated from previous config.sh file." >>config.sh
22295                 for sym in `cat UU/oldsyms`; do
22296                         echo "    Propagating $hint variable "'$'"$sym..."
22297                         eval 'tmp="$'"${sym}"'"'
22298                         echo "$tmp" | \
22299                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22300                 done
22301                 ;;
22302         esac
22303 fi
22304
22305 : Finish up by extracting the .SH files
22306 case "$alldone" in
22307 exit)
22308         $rm -rf UU
22309         echo "Extraction done."
22310         exit 0
22311         ;;
22312 cont)
22313         ;;
22314 '')
22315         dflt=''
22316         nostick=true
22317         $cat <<EOM
22318
22319 If you'd like to make any changes to the config.sh file before I begin
22320 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22321
22322 EOM
22323         rp="Press return or use a shell escape to edit config.sh:"
22324         . UU/myread
22325         nostick=''
22326         case "$ans" in
22327         '') ;;
22328         *) : in case they cannot read
22329                 sh 1>&4 -c "$ans";;
22330         esac
22331         ;;
22332 esac
22333
22334 : if this fails, just run all the .SH files by hand
22335 . ./config.sh
22336
22337 echo " "
22338 exec 1>&4
22339 pwd=`pwd`
22340 . ./UU/extract
22341 cd "$pwd"
22342
22343 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22344         dflt=y
22345         case "$silent" in
22346         true) ;;
22347         *)
22348                 $cat <<EOM
22349
22350 Now you need to generate make dependencies by running "$make depend".
22351 You might prefer to run it in background: "$make depend > makedepend.out &"
22352 It can take a while, so you might not want to run it right now.
22353
22354 EOM
22355                 ;;
22356         esac
22357         rp="Run $make depend now?"
22358         . UU/myread
22359         case "$ans" in
22360         y*)
22361                 $make depend && echo "Now you must run '$make'."
22362                 ;;
22363         *)
22364                 echo "You must run '$make depend' then '$make'."
22365                 ;;
22366         esac
22367 elif test -f [Mm]akefile; then
22368         echo " "
22369         echo "Now you must run a $make."
22370 else
22371         echo "Configure done."
22372 fi
22373
22374 if $test -f Policy.sh; then
22375     $cat <<EOM
22376
22377 If you compile $package on a different machine or from a different object
22378 directory, copy the Policy.sh file from this object directory to the
22379 new one before you run Configure -- this will help you with most of
22380 the policy defaults.
22381
22382 EOM
22383 fi
22384 if $test -f config.msg; then
22385     echo "Hmm.  I also noted the following information while running:"
22386     echo " "
22387     $cat config.msg >&4
22388     $rm -f config.msg
22389 fi
22390 $rm -f kit*isdone ark*isdone
22391 $rm -rf UU
22392
22393 : End of Configure
22394