Oops. Fix bad #! lines when not using userelocatableinc
[p5sagit/p5-mst-13.2.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 Mon Apr 17 14:14:39 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_casti32=''
363 castflags=''
364 d_castneg=''
365 d_chown=''
366 d_chroot=''
367 d_chsize=''
368 d_class=''
369 d_clearenv=''
370 d_closedir=''
371 d_void_closedir=''
372 d_cmsghdr_s=''
373 d_const=''
374 d_copysignl=''
375 cryptlib=''
376 d_crypt=''
377 crypt_r_proto=''
378 d_crypt_r=''
379 d_csh=''
380 full_csh=''
381 ctermid_r_proto=''
382 d_ctermid_r=''
383 ctime_r_proto=''
384 d_ctime_r=''
385 d_cuserid=''
386 d_c99_variadic_macros=''
387 d_dbl_dig=''
388 d_dbminitproto=''
389 d_difftime=''
390 d_dirfd=''
391 d_dlerror=''
392 d_dlopen=''
393 d_dlsymun=''
394 d_dosuid=''
395 d_suidsafe=''
396 d_drand48_r=''
397 drand48_r_proto=''
398 d_drand48proto=''
399 d_dup2=''
400 d_eaccess=''
401 d_endgrent=''
402 d_endgrent_r=''
403 endgrent_r_proto=''
404 d_endhent=''
405 d_endhostent_r=''
406 endhostent_r_proto=''
407 d_endnent=''
408 d_endnetent_r=''
409 endnetent_r_proto=''
410 d_endpent=''
411 d_endprotoent_r=''
412 endprotoent_r_proto=''
413 d_endpwent=''
414 d_endpwent_r=''
415 endpwent_r_proto=''
416 d_endsent=''
417 d_endservent_r=''
418 endservent_r_proto=''
419 d_faststdio=''
420 d_fchdir=''
421 d_fchmod=''
422 d_fchown=''
423 d_fcntl=''
424 d_fcntl_can_lock=''
425 d_fd_macros=''
426 d_fd_set=''
427 d_fds_bits=''
428 d_fgetpos=''
429 d_finite=''
430 d_finitel=''
431 d_flexfnam=''
432 d_flock=''
433 d_flockproto=''
434 d_fork=''
435 d_fp_class=''
436 d_fpclass=''
437 d_fpclassify=''
438 d_fpclassl=''
439 d_fpos64_t=''
440 d_frexpl=''
441 d_fs_data_s=''
442 d_fseeko=''
443 d_fsetpos=''
444 d_fstatfs=''
445 d_fsync=''
446 d_ftello=''
447 d_ftime=''
448 d_gettimeod=''
449 d_futimes=''
450 d_Gconvert=''
451 d_getcwd=''
452 d_getespwnam=''
453 d_getfsstat=''
454 d_getgrent=''
455 d_getgrent_r=''
456 getgrent_r_proto=''
457 d_getgrgid_r=''
458 getgrgid_r_proto=''
459 d_getgrnam_r=''
460 getgrnam_r_proto=''
461 d_getgrps=''
462 d_gethbyaddr=''
463 d_gethbyname=''
464 d_gethent=''
465 aphostname=''
466 d_gethname=''
467 d_phostname=''
468 d_uname=''
469 d_gethostbyaddr_r=''
470 gethostbyaddr_r_proto=''
471 d_gethostbyname_r=''
472 gethostbyname_r_proto=''
473 d_gethostent_r=''
474 gethostent_r_proto=''
475 d_gethostprotos=''
476 d_getitimer=''
477 d_getlogin=''
478 d_getlogin_r=''
479 getlogin_r_proto=''
480 d_getmnt=''
481 d_getmntent=''
482 d_getnbyaddr=''
483 d_getnbyname=''
484 d_getnent=''
485 d_getnetbyaddr_r=''
486 getnetbyaddr_r_proto=''
487 d_getnetbyname_r=''
488 getnetbyname_r_proto=''
489 d_getnetent_r=''
490 getnetent_r_proto=''
491 d_getnetprotos=''
492 d_getpagsz=''
493 d_getpent=''
494 d_getpgid=''
495 d_getpgrp2=''
496 d_bsdgetpgrp=''
497 d_getpgrp=''
498 d_getppid=''
499 d_getprior=''
500 d_getpbyname=''
501 d_getpbynumber=''
502 d_getprotobyname_r=''
503 getprotobyname_r_proto=''
504 d_getprotobynumber_r=''
505 getprotobynumber_r_proto=''
506 d_getprotoent_r=''
507 getprotoent_r_proto=''
508 d_getprotoprotos=''
509 d_getprpwnam=''
510 d_getpwent=''
511 d_getpwent_r=''
512 getpwent_r_proto=''
513 d_getpwnam_r=''
514 getpwnam_r_proto=''
515 d_getpwuid_r=''
516 getpwuid_r_proto=''
517 d_getsent=''
518 d_getservbyname_r=''
519 getservbyname_r_proto=''
520 d_getservbyport_r=''
521 getservbyport_r_proto=''
522 d_getservent_r=''
523 getservent_r_proto=''
524 d_getservprotos=''
525 d_getspnam=''
526 d_getspnam_r=''
527 getspnam_r_proto=''
528 d_getsbyname=''
529 d_getsbyport=''
530 d_gmtime_r=''
531 gmtime_r_proto=''
532 d_gnulibc=''
533 gnulibc_version=''
534 d_hasmntopt=''
535 d_htonl=''
536 d_ilogbl=''
537 d_inetaton=''
538 d_int64_t=''
539 d_isascii=''
540 d_isfinite=''
541 d_isinf=''
542 d_isnan=''
543 d_isnanl=''
544 d_killpg=''
545 d_lchown=''
546 d_ldbl_dig=''
547 d_libm_lib_version=''
548 d_link=''
549 d_localtime_r=''
550 localtime_r_proto=''
551 d_locconv=''
552 d_lockf=''
553 d_longdbl=''
554 longdblsize=''
555 d_longlong=''
556 longlongsize=''
557 d_lseekproto=''
558 d_lstat=''
559 d_madvise=''
560 d_malloc_good_size=''
561 d_malloc_size=''
562 d_mblen=''
563 d_mbstowcs=''
564 d_mbtowc=''
565 d_memchr=''
566 d_memcmp=''
567 d_memcpy=''
568 d_memmove=''
569 d_memset=''
570 d_mkdir=''
571 d_mkdtemp=''
572 d_mkfifo=''
573 d_mkstemp=''
574 d_mkstemps=''
575 d_mktime=''
576 d_mmap=''
577 mmaptype=''
578 d_modfl=''
579 d_modfl_pow32_bug=''
580 d_modflproto=''
581 d_mprotect=''
582 d_msg=''
583 d_msgctl=''
584 d_msgget=''
585 d_msghdr_s=''
586 d_msgrcv=''
587 d_msgsnd=''
588 d_msync=''
589 d_munmap=''
590 d_nice=''
591 d_nl_langinfo=''
592 d_off64_t=''
593 d_open3=''
594 d_fpathconf=''
595 d_pathconf=''
596 d_pause=''
597 d_pipe=''
598 d_poll=''
599 d_portable=''
600 d_procselfexe=''
601 procselfexe=''
602 d_old_pthread_create_joinable=''
603 old_pthread_create_joinable=''
604 d_pthread_atfork=''
605 d_pthread_attr_setscope=''
606 d_pthread_yield=''
607 d_sched_yield=''
608 sched_yield=''
609 d_qgcvt=''
610 d_random_r=''
611 random_r_proto=''
612 d_readdir64_r=''
613 readdir64_r_proto=''
614 d_readdir=''
615 d_rewinddir=''
616 d_seekdir=''
617 d_telldir=''
618 d_readdir_r=''
619 readdir_r_proto=''
620 d_readlink=''
621 d_readv=''
622 d_recvmsg=''
623 d_rename=''
624 d_rmdir=''
625 d_safebcpy=''
626 d_safemcpy=''
627 d_sanemcmp=''
628 d_sbrkproto=''
629 d_scalbnl=''
630 d_select=''
631 d_sem=''
632 d_semctl=''
633 d_semget=''
634 d_semop=''
635 d_sendmsg=''
636 d_setegid=''
637 d_seteuid=''
638 d_setgrent=''
639 d_setgrent_r=''
640 setgrent_r_proto=''
641 d_setgrps=''
642 d_sethent=''
643 d_sethostent_r=''
644 sethostent_r_proto=''
645 d_setitimer=''
646 d_setlinebuf=''
647 d_setlocale=''
648 d_setlocale_r=''
649 setlocale_r_proto=''
650 d_setnent=''
651 d_setnetent_r=''
652 setnetent_r_proto=''
653 d_setpent=''
654 d_setpgid=''
655 d_setpgrp2=''
656 d_bsdsetpgrp=''
657 d_setpgrp=''
658 d_setprior=''
659 d_setproctitle=''
660 d_setprotoent_r=''
661 setprotoent_r_proto=''
662 d_setpwent=''
663 d_setpwent_r=''
664 setpwent_r_proto=''
665 d_setregid=''
666 d_setresgid=''
667 d_setresuid=''
668 d_setreuid=''
669 d_setrgid=''
670 d_setruid=''
671 d_setsent=''
672 d_setservent_r=''
673 setservent_r_proto=''
674 d_setsid=''
675 d_setvbuf=''
676 d_sfio=''
677 usesfio=''
678 d_shm=''
679 d_shmat=''
680 d_shmatprototype=''
681 shmattype=''
682 d_shmctl=''
683 d_shmdt=''
684 d_shmget=''
685 d_sigaction=''
686 d_sigprocmask=''
687 d_sigsetjmp=''
688 usesitecustomize=''
689 d_snprintf=''
690 d_vsnprintf=''
691 d_sockatmark=''
692 d_sockatmarkproto=''
693 d_msg_ctrunc=''
694 d_msg_dontroute=''
695 d_msg_oob=''
696 d_msg_peek=''
697 d_msg_proxy=''
698 d_oldsock=''
699 d_scm_rights=''
700 d_socket=''
701 d_sockpair=''
702 sockethdr=''
703 socketlib=''
704 d_socklen_t=''
705 d_socks5_init=''
706 d_sprintf_returns_strlen=''
707 d_sqrtl=''
708 d_srand48_r=''
709 srand48_r_proto=''
710 d_srandom_r=''
711 srandom_r_proto=''
712 d_sresgproto=''
713 d_sresuproto=''
714 d_statblks=''
715 d_statfs_f_flags=''
716 d_statfs_s=''
717 d_fstatvfs=''
718 d_statvfs=''
719 d_stdio_cnt_lval=''
720 d_stdio_ptr_lval=''
721 d_stdio_ptr_lval_nochange_cnt=''
722 d_stdio_ptr_lval_sets_cnt=''
723 d_stdiobase=''
724 d_stdstdio=''
725 stdio_base=''
726 stdio_bufsiz=''
727 stdio_cnt=''
728 stdio_filbuf=''
729 stdio_ptr=''
730 d_index=''
731 d_strchr=''
732 d_strcoll=''
733 d_strctcpy=''
734 d_strerrm=''
735 d_strerror=''
736 d_sysernlst=''
737 d_syserrlst=''
738 d_strerror_r=''
739 strerror_r_proto=''
740 d_strftime=''
741 d_strlcat=''
742 d_strlcpy=''
743 d_strtod=''
744 d_strtol=''
745 d_strtold=''
746 d_strtoll=''
747 d_strtoq=''
748 d_strtoul=''
749 d_strtoull=''
750 d_strtouq=''
751 d_strxfrm=''
752 d_symlink=''
753 d_syscall=''
754 d_syscallproto=''
755 d_sysconf=''
756 d_system=''
757 d_tcgetpgrp=''
758 d_tcsetpgrp=''
759 d_telldirproto=''
760 d_time=''
761 timetype=''
762 clocktype=''
763 d_times=''
764 d_tmpnam_r=''
765 tmpnam_r_proto=''
766 d_truncate=''
767 d_ttyname_r=''
768 ttyname_r_proto=''
769 d_tzname=''
770 d_u32align=''
771 d_ualarm=''
772 d_umask=''
773 d_semctl_semid_ds=''
774 d_semctl_semun=''
775 d_union_semun=''
776 d_unordered=''
777 d_unsetenv=''
778 d_usleep=''
779 d_usleepproto=''
780 d_ustat=''
781 d_vfork=''
782 usevfork=''
783 d_voidsig=''
784 signal_t=''
785 d_volatile=''
786 d_charvspr=''
787 d_vprintf=''
788 d_wait4=''
789 d_waitpid=''
790 d_wcstombs=''
791 d_wctomb=''
792 d_writev=''
793 dlext=''
794 cccdlflags=''
795 ccdlflags=''
796 dlsrc=''
797 ld=''
798 lddlflags=''
799 usedl=''
800 doublesize=''
801 ebcdic=''
802 fflushNULL=''
803 fflushall=''
804 fpossize=''
805 fpostype=''
806 gccansipedantic=''
807 gccosandvers=''
808 gccversion=''
809 gidformat=''
810 gidsign=''
811 gidsize=''
812 gidtype=''
813 groupstype=''
814 h_fcntl=''
815 h_sysfile=''
816 html1dir=''
817 html1direxp=''
818 installhtml1dir=''
819 html3dir=''
820 html3direxp=''
821 installhtml3dir=''
822 i_arpainet=''
823 i_crypt=''
824 db_hashtype=''
825 db_prefixtype=''
826 db_version_major=''
827 db_version_minor=''
828 db_version_patch=''
829 i_db=''
830 i_dbm=''
831 i_rpcsvcdbm=''
832 d_dirnamlen=''
833 direntrytype=''
834 i_dirent=''
835 i_dld=''
836 i_dlfcn=''
837 i_fcntl=''
838 i_float=''
839 i_fp=''
840 i_fp_class=''
841 i_gdbm=''
842 d_grpasswd=''
843 i_grp=''
844 i_ieeefp=''
845 i_inttypes=''
846 i_langinfo=''
847 i_libutil=''
848 i_limits=''
849 i_locale=''
850 i_machcthr=''
851 i_malloc=''
852 i_math=''
853 i_memory=''
854 i_mntent=''
855 i_ndbm=''
856 i_netdb=''
857 i_neterrno=''
858 i_netinettcp=''
859 i_niin=''
860 i_sysin=''
861 i_poll=''
862 i_prot=''
863 i_pthread=''
864 d_pwage=''
865 d_pwchange=''
866 d_pwclass=''
867 d_pwcomment=''
868 d_pwexpire=''
869 d_pwgecos=''
870 d_pwpasswd=''
871 d_pwquota=''
872 i_pwd=''
873 i_sfio=''
874 i_shadow=''
875 i_socks=''
876 i_stddef=''
877 i_stdlib=''
878 i_string=''
879 strings=''
880 i_sunmath=''
881 i_sysaccess=''
882 i_sysdir=''
883 i_sysfile=''
884 d_voidtty=''
885 i_bsdioctl=''
886 i_sysfilio=''
887 i_sysioctl=''
888 i_syssockio=''
889 i_syslog=''
890 i_sysmman=''
891 i_sysmode=''
892 i_sysmount=''
893 i_sysndir=''
894 i_sysparam=''
895 i_sysresrc=''
896 i_syssecrt=''
897 i_sysselct=''
898 i_sysstat=''
899 i_sysstatfs=''
900 i_sysstatvfs=''
901 i_systimes=''
902 i_systypes=''
903 i_sysuio=''
904 i_sysun=''
905 i_sysutsname=''
906 i_sysvfs=''
907 i_syswait=''
908 i_sgtty=''
909 i_termio=''
910 i_termios=''
911 d_tm_tm_gmtoff=''
912 d_tm_tm_zone=''
913 i_systime=''
914 i_systimek=''
915 i_time=''
916 timeincl=''
917 i_unistd=''
918 i_ustat=''
919 i_utime=''
920 i_values=''
921 i_stdarg=''
922 i_varargs=''
923 i_varhdr=''
924 i_vfork=''
925 d_inc_version_list=''
926 inc_version_list=''
927 inc_version_list_init=''
928 installprefix=''
929 installprefixexp=''
930 installstyle=''
931 installusrbinperl=''
932 intsize=''
933 longsize=''
934 shortsize=''
935 issymlink=''
936 libc=''
937 ldlibpthname=''
938 libperl=''
939 shrpenv=''
940 useshrplib=''
941 glibpth=''
942 libpth=''
943 loclibpth=''
944 plibpth=''
945 xlibpth=''
946 ignore_versioned_solibs=''
947 libs=''
948 libsdirs=''
949 libsfiles=''
950 libsfound=''
951 libspath=''
952 lns=''
953 d_PRIEUldbl=''
954 d_PRIFUldbl=''
955 d_PRIGUldbl=''
956 d_PRIeldbl=''
957 d_PRIfldbl=''
958 d_PRIgldbl=''
959 d_SCNfldbl=''
960 sPRIEUldbl=''
961 sPRIFUldbl=''
962 sPRIGUldbl=''
963 sPRIeldbl=''
964 sPRIfldbl=''
965 sPRIgldbl=''
966 sSCNfldbl=''
967 lseeksize=''
968 lseektype=''
969 mad=''
970 madlyh=''
971 madlyobj=''
972 madlysrc=''
973 make_set_make=''
974 d_mymalloc=''
975 freetype=''
976 mallocobj=''
977 mallocsrc=''
978 malloctype=''
979 usemallocwrap=''
980 usemymalloc=''
981 installman1dir=''
982 man1dir=''
983 man1direxp=''
984 man1ext=''
985 installman3dir=''
986 man3dir=''
987 man3direxp=''
988 man3ext=''
989 modetype=''
990 multiarch=''
991 mydomain=''
992 myhostname=''
993 phostname=''
994 c=''
995 n=''
996 d_eofnblk=''
997 eagain=''
998 o_nonblock=''
999 rd_nodata=''
1000 need_va_copy=''
1001 netdb_hlen_type=''
1002 netdb_host_type=''
1003 netdb_name_type=''
1004 netdb_net_type=''
1005 groupcat=''
1006 hostcat=''
1007 passcat=''
1008 orderlib=''
1009 ranlib=''
1010 d_perl_otherlibdirs=''
1011 otherlibdirs=''
1012 package=''
1013 spackage=''
1014 pager=''
1015 api_revision=''
1016 api_subversion=''
1017 api_version=''
1018 api_versionstring=''
1019 patchlevel=''
1020 perl_patchlevel=''
1021 revision=''
1022 subversion=''
1023 version=''
1024 version_patchlevel_string=''
1025 perl5=''
1026 perladmin=''
1027 perlpath=''
1028 d_nv_preserves_uv=''
1029 d_nv_zero_is_allbits_zero=''
1030 i16size=''
1031 i16type=''
1032 i32size=''
1033 i32type=''
1034 i64size=''
1035 i64type=''
1036 i8size=''
1037 i8type=''
1038 ivsize=''
1039 ivtype=''
1040 nv_preserves_uv_bits=''
1041 nvsize=''
1042 nvtype=''
1043 u16size=''
1044 u16type=''
1045 u32size=''
1046 u32type=''
1047 u64size=''
1048 u64type=''
1049 u8size=''
1050 u8type=''
1051 uvsize=''
1052 uvtype=''
1053 ivdformat=''
1054 nvEUformat=''
1055 nvFUformat=''
1056 nvGUformat=''
1057 nveformat=''
1058 nvfformat=''
1059 nvgformat=''
1060 uvXUformat=''
1061 uvoformat=''
1062 uvuformat=''
1063 uvxformat=''
1064 pidtype=''
1065 prefix=''
1066 prefixexp=''
1067 installprivlib=''
1068 privlib=''
1069 privlibexp=''
1070 prototype=''
1071 ptrsize=''
1072 d_PRIXU64=''
1073 d_PRId64=''
1074 d_PRIi64=''
1075 d_PRIo64=''
1076 d_PRIu64=''
1077 d_PRIx64=''
1078 sPRIXU64=''
1079 sPRId64=''
1080 sPRIi64=''
1081 sPRIo64=''
1082 sPRIu64=''
1083 sPRIx64=''
1084 d_quad=''
1085 quadkind=''
1086 quadtype=''
1087 uquadtype=''
1088 drand01=''
1089 randbits=''
1090 randfunc=''
1091 randseedtype=''
1092 seedfunc=''
1093 installscript=''
1094 scriptdir=''
1095 scriptdirexp=''
1096 selectminbits=''
1097 selecttype=''
1098 sh=''
1099 sig_count=''
1100 sig_name=''
1101 sig_name_init=''
1102 sig_num=''
1103 sig_num_init=''
1104 sig_size=''
1105 d_sitearch=''
1106 installsitearch=''
1107 sitearch=''
1108 sitearchexp=''
1109 installsitebin=''
1110 sitebin=''
1111 sitebinexp=''
1112 installsitehtml1dir=''
1113 sitehtml1dir=''
1114 sitehtml1direxp=''
1115 installsitehtml3dir=''
1116 sitehtml3dir=''
1117 sitehtml3direxp=''
1118 installsitelib=''
1119 sitelib=''
1120 sitelib_stem=''
1121 sitelibexp=''
1122 installsiteman1dir=''
1123 siteman1dir=''
1124 siteman1direxp=''
1125 installsiteman3dir=''
1126 siteman3dir=''
1127 siteman3direxp=''
1128 siteprefix=''
1129 siteprefixexp=''
1130 installsitescript=''
1131 sitescript=''
1132 sitescriptexp=''
1133 sizesize=''
1134 sizetype=''
1135 so=''
1136 socksizetype=''
1137 sharpbang=''
1138 shsharp=''
1139 spitshell=''
1140 src=''
1141 ssizetype=''
1142 startperl=''
1143 startsh=''
1144 stdchar=''
1145 d_stdio_stream_array=''
1146 stdio_stream_array=''
1147 sysman=''
1148 trnl=''
1149 uidformat=''
1150 uidsign=''
1151 uidsize=''
1152 uidtype=''
1153 archname64=''
1154 use64bitall=''
1155 use64bitint=''
1156 usefaststdio=''
1157 ccflags_uselargefiles=''
1158 ldflags_uselargefiles=''
1159 libswanted_uselargefiles=''
1160 uselargefiles=''
1161 uselongdouble=''
1162 usemorebits=''
1163 usemultiplicity=''
1164 nm_opt=''
1165 nm_so_opt=''
1166 runnm=''
1167 usenm=''
1168 useperlio=''
1169 usesocks=''
1170 d_oldpthreads=''
1171 use5005threads=''
1172 useithreads=''
1173 usereentrant=''
1174 usethreads=''
1175 incpath=''
1176 mips_type=''
1177 usrinc=''
1178 d_vendorarch=''
1179 installvendorarch=''
1180 vendorarch=''
1181 vendorarchexp=''
1182 d_vendorbin=''
1183 installvendorbin=''
1184 vendorbin=''
1185 vendorbinexp=''
1186 installvendorhtml1dir=''
1187 vendorhtml1dir=''
1188 vendorhtml1direxp=''
1189 installvendorhtml3dir=''
1190 vendorhtml3dir=''
1191 vendorhtml3direxp=''
1192 d_vendorlib=''
1193 installvendorlib=''
1194 vendorlib=''
1195 vendorlib_stem=''
1196 vendorlibexp=''
1197 installvendorman1dir=''
1198 vendorman1dir=''
1199 vendorman1direxp=''
1200 installvendorman3dir=''
1201 vendorman3dir=''
1202 vendorman3direxp=''
1203 usevendorprefix=''
1204 vendorprefix=''
1205 vendorprefixexp=''
1206 d_vendorscript=''
1207 installvendorscript=''
1208 vendorscript=''
1209 vendorscriptexp=''
1210 versiononly=''
1211 defvoidused=''
1212 voidflags=''
1213 yacc=''
1214 yaccflags=''
1215 CONFIG=''
1216
1217 define='define'
1218 undef='undef'
1219 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1220 rmlist=''
1221
1222 : We must find out about Eunice early
1223 eunicefix=':'
1224 if test -f /etc/unixtovms; then
1225         eunicefix=/etc/unixtovms
1226 fi
1227 if test -f /etc/unixtovms.exe; then
1228         eunicefix=/etc/unixtovms.exe
1229 fi
1230
1231 : Set executable suffix now -- needed before hints available
1232 if test -f "/libs/version.library"; then
1233 : Amiga OS
1234     _exe=""
1235 elif test -f "/system/gnu_library/bin/ar.pm"; then
1236 : Stratus VOS
1237     _exe=".pm"
1238 elif test -n "$DJGPP"; then
1239 : DOS DJGPP
1240     _exe=".exe"
1241 elif test -d c:/. -o -n "$is_os2" ; then
1242 : OS/2 or cygwin
1243     _exe=".exe"
1244 fi
1245
1246 i_whoami=''
1247 ccname=''
1248 ccversion=''
1249 perllibs=''
1250 : set useposix=false in your hint file to disable the POSIX extension.
1251 useposix=true
1252 : set useopcode=false in your hint file to disable the Opcode extension.
1253 useopcode=true
1254 : Trailing extension.  Override this in a hint file, if needed.
1255 : Extra object files, if any, needed on this platform.
1256 archobjs=''
1257 archname=''
1258 : Possible local include directories to search.
1259 : Set locincpth to "" in a hint file to defeat local include searches.
1260 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1261 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1262 :
1263 : no include file wanted by default
1264 inclwanted=''
1265
1266 : Enable -DEBUGGING and -DDEBUGGING from the command line
1267 EBUGGING=''
1268 DEBUGGING=old
1269
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283
1284 : Private path used by Configure to find libraries.  Its value
1285 : is prepended to libpth. This variable takes care of special
1286 : machines, like the mips.  Usually, it should be empty.
1287 plibpth=''
1288
1289 : default library list
1290 libswanted=''
1291 : some systems want to use only the non-versioned libso:s
1292 ignore_versioned_solibs=''
1293 siteman1dir=''
1294 siteman3dir=''
1295 sitescript=''
1296 archname64=''
1297 ccflags_uselargefiles=''
1298 ldflags_uselargefiles=''
1299 libswanted_uselargefiles=''
1300 : set usemultiplicity on the Configure command line to enable multiplicity.
1301 : set usesocks on the Configure command line to enable socks.
1302 : set usethreads on the Configure command line to enable threads.
1303 usereentrant='undef'
1304 : full support for void wanted by default
1305 defvoidused=15
1306
1307 : List of libraries we want.
1308 : If anyone needs extra -lxxx, put those in a hint file.
1309 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1310 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1311 : We probably want to search /usr/shlib before most other libraries.
1312 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1313 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1314 glibpth="/usr/shlib $glibpth"
1315 : Do not use vfork unless overridden by a hint file.
1316 usevfork=false
1317
1318 : Find the basic shell for Bourne shell scripts
1319 case "$sh" in
1320 '')
1321         case "$SYSTYPE" in
1322         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1323         *) xxx='/bin/sh';;
1324         esac
1325         if test -f "$xxx"; then
1326                 sh="$xxx"
1327         else
1328                 : Build up a list and do a single loop so we can 'break' out.
1329                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1330                 for xxx in sh bash ksh pdksh ash; do
1331                         for p in $pth; do
1332                                 try="$try ${p}/${xxx}"
1333                         done
1334                 done
1335                 for xxx in $try; do
1336                         if test -f "$xxx"; then
1337                                 sh="$xxx";
1338                                 break
1339                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1340                                 sh="$xxx";
1341                                 break
1342                         elif test -f "$xxx.exe"; then
1343                                 sh="$xxx";
1344                                 break
1345                         fi
1346                 done
1347         fi
1348         ;;
1349 esac
1350
1351 case "$sh" in
1352 '')     cat >&2 <<EOM
1353 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1354
1355 Usually it's in /bin/sh.  How did you even get this far?
1356 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1357 we'll try to straighten this all out.
1358 EOM
1359         exit 1
1360         ;;
1361 esac
1362
1363 : see if sh knows # comments
1364 if `$sh -c '#' >/dev/null 2>&1`; then
1365         shsharp=true
1366         spitshell=cat
1367         xcat=/bin/cat
1368         test -f $xcat$_exe || xcat=/usr/bin/cat
1369         if test ! -f $xcat$_exe; then
1370                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1371                         if test -f $p/cat$_exe; then
1372                                 xcat=$p/cat
1373                                 break
1374                         fi
1375                 done
1376                 if test ! -f $xcat$_exe; then
1377                         echo "Can't find cat anywhere!"
1378                         exit 1
1379                 fi
1380         fi
1381         echo "#!$xcat" >sharp
1382         $eunicefix sharp
1383         chmod +x sharp
1384         ./sharp > today
1385         if test -s today; then
1386                 sharpbang='#!'
1387         else
1388                 echo "#! $xcat" > sharp
1389                 $eunicefix sharp
1390                 chmod +x sharp
1391                 ./sharp > today
1392                 if test -s today; then
1393                         sharpbang='#! '
1394                 else
1395                         sharpbang=': use '
1396                 fi
1397         fi
1398 else
1399         echo " "
1400         echo "Your $sh doesn't grok # comments--I will strip them later on."
1401         shsharp=false
1402         cd ..
1403         echo "exec grep -v '^[  ]*#'" >spitshell
1404         chmod +x spitshell
1405         $eunicefix spitshell
1406         spitshell=`pwd`/spitshell
1407         cd UU
1408         echo "I presume that if # doesn't work, #! won't work either!"
1409         sharpbang=': use '
1410 fi
1411 rm -f sharp today
1412
1413 : figure out how to guarantee sh startup
1414 case "$startsh" in
1415 '') startsh=${sharpbang}${sh} ;;
1416 *)
1417 esac
1418 cat >sharp <<EOSS
1419 $startsh
1420 set abc
1421 test "$?abc" != 1
1422 EOSS
1423
1424 chmod +x sharp
1425 $eunicefix sharp
1426 if ./sharp; then
1427         : echo "Yup, it does."
1428 else
1429         echo "Hmm... '$startsh' does not guarantee sh startup..."
1430         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1431 fi
1432 rm -f sharp
1433
1434
1435 : Save command line options in file UU/cmdline.opt for later use in
1436 : generating config.sh.
1437 cat > cmdline.opt <<EOSH
1438 # Configure command line arguments.
1439 config_arg0='$0'
1440 config_args='$*'
1441 config_argc=$#
1442 EOSH
1443 argn=1
1444 args_exp=''
1445 args_sep=''
1446 for arg in "$@"; do
1447         cat >>cmdline.opt <<EOSH
1448 config_arg$argn='$arg'
1449 EOSH
1450         # Extreme backslashitis: replace each ' by '"'"'
1451         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1452 $arg
1453 EOC
1454         arg_exp=`cat cmdl.opt`
1455         args_exp="$args_exp$args_sep'$arg_exp'"
1456         argn=`expr $argn + 1`
1457         args_sep=' '
1458 done
1459 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1460 # used by ./hints/os2.sh
1461 rm -f cmdl.opt
1462
1463 : produce awk script to parse command line options
1464 cat >options.awk <<'EOF'
1465 BEGIN {
1466         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1467
1468         len = length(optstr);
1469         for (i = 1; i <= len; i++) {
1470                 c = substr(optstr, i, 1);
1471                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1472                 if (a == ":") {
1473                         arg[c] = 1;
1474                         i++;
1475                 }
1476                 opt[c] = 1;
1477         }
1478 }
1479 {
1480         expect = 0;
1481         str = $0;
1482         if (substr(str, 1, 1) != "-") {
1483                 printf("'%s'\n", str);
1484                 next;
1485         }
1486         len = length($0);
1487         for (i = 2; i <= len; i++) {
1488                 c = substr(str, i, 1);
1489                 if (!opt[c]) {
1490                         printf("-%s\n", substr(str, i));
1491                         next;
1492                 }
1493                 printf("-%s\n", c);
1494                 if (arg[c]) {
1495                         if (i < len)
1496                                 printf("'%s'\n", substr(str, i + 1));
1497                         else
1498                                 expect = 1;
1499                         next;
1500                 }
1501         }
1502 }
1503 END {
1504         if (expect)
1505                 print "?";
1506 }
1507 EOF
1508
1509 : process the command line options
1510 set X `for arg in "$@"; do echo "X$arg"; done |
1511         sed -e s/X// | awk -f options.awk`
1512 eval "set $*"
1513 shift
1514 rm -f options.awk
1515
1516 : set up default values
1517 fastread=''
1518 reuseval=false
1519 config_sh=''
1520 alldone=''
1521 error=''
1522 silent=''
1523 extractsh=''
1524 override=''
1525 knowitall=''
1526 rm -f optdef.sh posthint.sh
1527 cat >optdef.sh <<EOS
1528 $startsh
1529 EOS
1530
1531
1532 : option parsing
1533 while test $# -gt 0; do
1534         case "$1" in
1535         -d) shift; fastread=yes;;
1536         -e) shift; alldone=cont;;
1537         -f)
1538                 shift
1539                 cd ..
1540                 if test -r "$1"; then
1541                         config_sh="$1"
1542                 else
1543                         echo "$me: cannot read config file $1." >&2
1544                         error=true
1545                 fi
1546                 cd UU
1547                 shift;;
1548         -h) shift; error=true;;
1549         -r) shift; reuseval=true;;
1550         -s) shift; silent=true; realsilent=true;;
1551         -E) shift; alldone=exit;;
1552         -K) shift; knowitall=true;;
1553         -O) shift; override=true;;
1554         -S) shift; silent=true; extractsh=true;;
1555         -D)
1556                 shift
1557                 case "$1" in
1558                 *=)
1559                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1560                         echo "$me: ignoring -D $1" >&2
1561                         ;;
1562                 *=*) echo "$1" | \
1563                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1564                 *) echo "$1='define'" >> optdef.sh;;
1565                 esac
1566                 shift
1567                 ;;
1568         -U)
1569                 shift
1570                 case "$1" in
1571                 *=) echo "$1" >> optdef.sh;;
1572                 *=*)
1573                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1574                         echo "$me: ignoring -U $1" >&2
1575                         ;;
1576                 *) echo "$1='undef'" >> optdef.sh;;
1577                 esac
1578                 shift
1579                 ;;
1580         -A)
1581             shift
1582             xxx=''
1583             yyy="$1"
1584             zzz=''
1585             uuu=undef
1586             case "$yyy" in
1587             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1588                  case "$zzz" in
1589                  *:*) zzz='' ;;
1590                  *)   xxx=append
1591                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1592                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1593                  esac
1594                  ;;
1595             esac
1596             case "$xxx" in
1597             '')  case "$yyy" in
1598                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1599                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1600                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1601                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1602                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1603                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1604                  esac
1605                  ;;       
1606             esac
1607             case "$xxx" in
1608             append)
1609                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1610             clear)
1611                 echo "$yyy=''"                  >> posthint.sh ;;
1612             define)
1613                 case "$zzz" in
1614                 '') zzz=define ;;
1615                 esac
1616                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1617             eval)
1618                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1619             prepend)
1620                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1621             undef)
1622                 case "$zzz" in
1623                 '') zzz="$uuu" ;;
1624                 esac
1625                 echo "$yyy=$zzz"                >> posthint.sh ;;
1626             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1627             esac
1628             shift
1629             ;;
1630         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1631             exit 0;;
1632         --) break;;
1633         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1634         *) break;;
1635         esac
1636 done
1637
1638 case "$error" in
1639 true)
1640         cat >&2 <<EOM
1641 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1642                  [-U symbol] [-U symbol=] [-A command:symbol...]
1643   -d : use defaults for all answers.
1644   -e : go on without questioning past the production of config.sh.
1645   -f : specify an alternate default configuration file.
1646   -h : print this help message and exit (with an error status).
1647   -r : reuse C symbols value if possible (skips costly nm extraction).
1648   -s : silent mode, only echoes questions and essential information.
1649   -D : define symbol to have some value:
1650          -D symbol         symbol gets the value 'define'
1651          -D symbol=value   symbol gets the value 'value'
1652   -E : stop at the end of questions, after having produced config.sh.
1653   -K : do not use unless you know what you are doing.
1654   -O : let -D and -U override definitions from loaded configuration file.
1655   -S : perform variable substitutions on all .SH files (can mix with -f)
1656   -U : undefine symbol:
1657          -U symbol    symbol gets the value 'undef'
1658          -U symbol=   symbol gets completely empty
1659   -A : manipulate symbol after the platform specific hints have been applied:
1660          -A symbol=value                append " "value to symbol
1661          -A append:symbol=value         append value to symbol
1662          -A define:symbol=value         define symbol to have value
1663          -A clear:symbol                define symbol to be ''
1664          -A define:symbol               define symbol to be 'define'
1665          -A eval:symbol=value           define symbol to be eval of value
1666          -A prepend:symbol=value        prepend value to symbol
1667          -A undef:symbol                define symbol to be 'undef'
1668          -A undef:symbol=               define symbol to be ''
1669   -V : print version number and exit (with a zero status).
1670 EOM
1671         exit 1
1672         ;;
1673 esac
1674
1675 : Sanity checks
1676 case "$fastread$alldone" in
1677 yescont|yesexit) ;;
1678 *)
1679         case "$extractsh" in
1680         true) ;;
1681         *)
1682                 if test ! -t 0; then
1683                         echo "Say 'sh Configure', not 'sh <Configure'"
1684                         exit 1
1685                 fi
1686                 ;;
1687         esac
1688         ;;
1689 esac
1690
1691 exec 4>&1
1692 case "$silent" in
1693 true) exec 1>/dev/null;;
1694 esac
1695
1696 : run the defines and the undefines, if any, but leave the file out there...
1697 touch optdef.sh
1698 . ./optdef.sh
1699 : create the posthint manipulation script and leave the file out there...
1700 touch posthint.sh
1701
1702 : set package name
1703 package=perl5
1704 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1705 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1706 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1707 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1708 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1709 esac
1710
1711 : Some greps do not return status, grrr.
1712 echo "grimblepritz" >grimble
1713 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1714         contains=contains
1715 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1716         contains=grep
1717 else
1718         contains=contains
1719 fi
1720 rm -f grimble
1721 : the following should work in any shell
1722 case "$contains" in
1723 contains*)
1724         echo " "
1725         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1726         cat >contains <<'EOSS'
1727 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1728 EOSS
1729 chmod +x contains
1730 esac
1731
1732 : Find the path to the source tree
1733 case "$src" in
1734 '') case "$0" in
1735     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1736          case "$src" in
1737          /*)    ;;
1738          .)     ;;
1739          *)     src=`cd ../$src && pwd` ;;
1740          esac
1741          ;;
1742     *)   src='.';;
1743     esac;;
1744 esac
1745 case "$src" in
1746 '')     src=/
1747         rsrc=/
1748         ;;
1749 /*) rsrc="$src";;
1750 *) rsrc="../$src";;
1751 esac
1752 if test -f $rsrc/Configure && \
1753         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1754 then
1755    : found it, so we are ok.
1756 else
1757         rsrc=''
1758         for src in . .. ../.. ../../.. ../../../..; do
1759                 if test -f ../$src/Configure && \
1760                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1761                 then
1762                         rsrc=../$src
1763                         break
1764                 fi
1765         done
1766 fi
1767 case "$rsrc" in
1768 '')
1769         cat <<EOM >&4
1770
1771 Sorry, I can't seem to locate the source dir for $package.  Please start
1772 Configure with an explicit path -- i.e. /some/path/Configure.
1773
1774 EOM
1775         exit 1
1776         ;;
1777 ../.)   rsrc='..';;
1778 *)
1779         echo " "
1780         echo "Sources for $package found in \"$src\"." >&4
1781         ;;
1782 esac
1783
1784 : script used to extract .SH files with variable substitutions
1785 cat >extract <<'EOS'
1786 PERL_CONFIG_SH=true
1787 echo "Doing variable substitutions on .SH files..."
1788 if test -f MANIFEST; then
1789         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1790 else
1791         echo "(Looking for .SH files under the source directory.)"
1792         set x `(cd "$src"; find . -name "*.SH" -print)`
1793 fi
1794 shift
1795 case $# in
1796 0) set x `(cd "$src"; echo *.SH)`; shift;;
1797 esac
1798 if test ! -f "$src/$1"; then
1799         shift
1800 fi
1801 mkdir_p='
1802 name=$1;
1803 create="";
1804 while test $name; do
1805         if test ! -d "$name"; then
1806                 create="$name $create";
1807                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1808                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1809         else
1810                 name="";
1811         fi;
1812 done;
1813 for file in $create; do
1814         mkdir $file;
1815 done
1816 '
1817 for file in $*; do
1818         case "$src" in
1819         ".")
1820                 case "$file" in
1821                 */*)
1822                         dir=`expr X$file : 'X\(.*\)/'`
1823                         file=`expr X$file : 'X.*/\(.*\)'`
1824                         (cd "$dir" && . ./$file)
1825                         ;;
1826                 *)
1827                         . ./$file
1828                         ;;
1829                 esac
1830                 ;;
1831         *)
1832                 case "$file" in
1833                 */*)
1834                         dir=`expr X$file : 'X\(.*\)/'`
1835                         file=`expr X$file : 'X.*/\(.*\)'`
1836                         (set x $dir; shift; eval $mkdir_p)
1837                         sh <"$src/$dir/$file"
1838                         ;;
1839                 *)
1840                         sh <"$src/$file"
1841                         ;;
1842                 esac
1843                 ;;
1844         esac
1845 done
1846 if test -f "$src/config_h.SH"; then
1847         if test ! -f config.h; then
1848         : oops, they left it out of MANIFEST, probably, so do it anyway.
1849         . "$src/config_h.SH"
1850         fi
1851 fi
1852 EOS
1853
1854 : extract files and exit if asked to do so
1855 case "$extractsh" in
1856 true)
1857         case "$realsilent" in
1858         true) ;;
1859         *) exec 1>&4;;
1860         esac
1861         case "$config_sh" in
1862         '') config_sh='config.sh';;
1863         esac
1864         echo " "
1865         echo "Fetching answers from $config_sh..."
1866         cd ..
1867         . $config_sh
1868         test "$override" && . ./optdef.sh
1869         echo " "
1870         . UU/extract
1871         rm -rf UU
1872         echo "Extraction done."
1873         exit 0
1874         ;;
1875 esac
1876
1877 : Eunice requires " " instead of "", can you believe it
1878 echo " "
1879 : Here we go...
1880 echo "Beginning of configuration questions for $package."
1881
1882 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1883
1884 : first determine how to suppress newline on echo command
1885 echo " "
1886 echo "Checking echo to see how to suppress newlines..."
1887 (echo "hi there\c" ; echo " ") >.echotmp
1888 if $contains c .echotmp >/dev/null 2>&1 ; then
1889         echo "...using -n."
1890         n='-n'
1891         c=''
1892 else
1893         cat <<'EOM'
1894 ...using \c
1895 EOM
1896         n=''
1897         c='\c'
1898 fi
1899 echo $n "The star should be here-->$c"
1900 echo '*'
1901 rm -f .echotmp
1902
1903 : Now test for existence of everything in MANIFEST
1904 echo " "
1905 if test -f "$rsrc/MANIFEST"; then
1906         echo "First let's make sure your kit is complete.  Checking..." >&4
1907         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1908         rm -f missing
1909         tmppwd=`pwd`
1910         for filelist in x??; do
1911                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1912         done
1913         if test -s missing; then
1914                 cat missing >&4
1915                 cat >&4 <<'EOM'
1916
1917 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1918
1919 You have the option of continuing the configuration process, despite the
1920 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1921 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1922 and contact the author (perlbug@perl.org).
1923
1924 EOM
1925                 echo $n "Continue? [n] $c" >&4
1926                 read ans
1927                 case "$ans" in
1928                 y*)
1929                         echo "Continuing..." >&4
1930                         rm -f missing
1931                         ;;
1932                 *)
1933                         echo "ABORTING..." >&4
1934                         kill $$
1935                         ;;
1936                 esac
1937         else
1938                 echo "Looks good..."
1939         fi
1940 else
1941         echo "There is no MANIFEST file.  I hope your kit is complete !"
1942 fi
1943 rm -f missing x??
1944
1945 echo " "
1946 : Find the appropriate value for a newline for tr
1947 if test -n "$DJGPP"; then
1948        trnl='\012'
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\n' x 2>/dev/null`" in
1952         foox) trnl='\n' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956         case "`echo foo|tr '\012' x 2>/dev/null`" in
1957         foox) trnl='\012' ;;
1958         esac
1959 fi
1960 if test X"$trnl" = X; then
1961        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1962        fooxy) trnl='\n\r' ;;
1963        esac
1964 fi
1965 if test X"$trnl" = X; then
1966         cat <<EOM >&2
1967
1968 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1969
1970 EOM
1971         exit 1
1972 fi
1973
1974 : compute the number of columns on the terminal for proper question formatting
1975 case "$COLUMNS" in
1976 '') COLUMNS='80';;
1977 esac
1978
1979 : set up the echo used in my read
1980 myecho="case \"\$xxxm\" in
1981 '') echo $n \"\$rp $c\" >&4;;
1982 *) case \"\$rp\" in
1983         '') echo $n \"[\$xxxm] $c\";;
1984         *)
1985                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1986                         echo \"\$rp\" >&4
1987                         echo $n \"[\$xxxm] $c\" >&4
1988                 else
1989                         echo $n \"\$rp [\$xxxm] $c\" >&4
1990                 fi
1991                 ;;
1992         esac;;
1993 esac"
1994
1995 : now set up to do reads with possible shell escape and default assignment
1996 cat <<EOSC >myread
1997 $startsh
1998 xxxm=\$dflt
1999 $myecho
2000 ans='!'
2001 case "\$fastread" in
2002 yes) case "\$dflt" in
2003         '') ;;
2004         *) ans='';
2005                 case "\$silent-\$rp" in
2006                 true-) ;;
2007                 *) echo " " >&4;;
2008                 esac;;
2009         esac;;
2010 *) case "\$silent" in
2011         true) case "\$rp" in
2012                 '') ans='';;
2013                 esac;;
2014         esac;;
2015 esac
2016 while expr "X\$ans" : "X!" >/dev/null; do
2017         read answ
2018         set x \$xxxm
2019         shift
2020         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2021         case  "\$answ" in
2022         "!")
2023                 sh 1>&4
2024                 echo " "
2025                 $myecho
2026                 ;;
2027         !*)
2028                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2029                 shift
2030                 sh 1>&4 -c "\$*"
2031                 echo " "
2032                 $myecho
2033                 ;;
2034         "\$ans")
2035                 case "\$ans" in
2036                 \\&*)
2037                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2038                         shift
2039                         case "\$1" in
2040                         -d)
2041                                 fastread=yes
2042                                 echo "(OK, I'll run with -d after this question.)" >&4
2043                                 ;;
2044                         -*)
2045                                 echo "*** Sorry, \$1 not supported yet." >&4
2046                                 ;;
2047                         esac
2048                         $myecho
2049                         ans=!
2050                         ;;
2051                 esac;;
2052         *)
2053                 case "\$aok" in
2054                 y)
2055                         echo "*** Substitution done -- please confirm."
2056                         xxxm="\$ans"
2057                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2058                         xxxm="\$ans"
2059                         ans=!
2060                         ;;
2061                 *)
2062                         echo "*** Error -- try again."
2063                         ans=!
2064                         ;;
2065                 esac
2066                 $myecho
2067                 ;;
2068         esac
2069         case "\$ans\$xxxm\$nostick" in
2070         '')
2071                 ans=!
2072                 $myecho
2073                 ;;
2074         esac
2075 done
2076 case "\$ans" in
2077 '') ans="\$xxxm";;
2078 esac
2079 EOSC
2080
2081 : create .config dir to save info across Configure sessions
2082 test -d ../.config || mkdir ../.config
2083 cat >../.config/README <<EOF
2084 This directory created by Configure to save information that should
2085 persist across sessions for $package.
2086
2087 You may safely delete it if you wish.
2088 EOF
2089
2090 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2091 case "$usedevel" in
2092 $define|true|[yY]*) ;;
2093 *) case "$xversion" in
2094    *[13579])
2095         cat >&4 <<EOH
2096 *** WHOA THERE!!! ***
2097
2098     This is an UNSTABLE DEVELOPMENT release.
2099     The version of this $package distribution is $xversion, that is, odd,
2100     (as opposed to even) and that signifies a development release.
2101     If you want a maintenance release, you want an even-numbered version.
2102
2103     Do ***NOT*** install this into production use.
2104     Data corruption and crashes are possible.
2105
2106     It is most seriously suggested that you do not continue any further
2107     unless you want to help in developing and debugging Perl.
2108
2109     If you *still* want to build perl, you can answer 'y' now,
2110     or pass -Dusedevel to Configure.
2111
2112 EOH
2113         rp='Do you really want to continue?'
2114         dflt='n'
2115         . ./myread
2116         case "$ans" in
2117         [yY]) echo >&4 "Okay, continuing."
2118               usedevel="$define" ;;
2119         *) echo >&4 "Okay, bye."
2120            exit 1
2121            ;;
2122         esac
2123         ;;
2124     esac
2125     ;;
2126 esac
2127 case "$usedevel" in
2128 $define|true|[yY]*)
2129         case "$versiononly" in
2130         '') versiononly="$define" ;;
2131         esac
2132         case "$installusrbinperl" in
2133         '') installusrbinperl="$undef" ;;
2134         esac
2135         ;;
2136 esac
2137
2138 : general instructions
2139 needman=true
2140 firsttime=true
2141 user=`(logname) 2>/dev/null`
2142 case "$user" in
2143 '') user=`whoami 2>&1`;;
2144 esac
2145 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2146         firsttime=false
2147         echo " "
2148         rp='Would you like to see the instructions?'
2149         dflt=n
2150         . ./myread
2151         case "$ans" in
2152         [yY]*) ;;
2153         *) needman=false;;
2154         esac
2155 fi
2156 if $needman; then
2157         cat <<EOH
2158
2159 This installation shell script will examine your system and ask you questions
2160 to determine how the perl5 package should be installed. If you get
2161 stuck on a question, you may use a ! shell escape to start a subshell or
2162 execute a command.  Many of the questions will have default answers in square
2163 brackets; typing carriage return will give you the default.
2164
2165 On some of the questions which ask for file or directory names you are allowed
2166 to use the ~name construct to specify the login directory belonging to "name",
2167 even if you don't have a shell which knows about that.  Questions where this is
2168 allowed will be marked "(~name ok)".
2169
2170 EOH
2171         rp=''
2172         dflt='Type carriage return to continue'
2173         . ./myread
2174         cat <<'EOH'
2175
2176 The prompter used in this script allows you to use shell variables and
2177 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2178 in the default answer, as if the default line was a set of arguments given to a
2179 script shell.  This means you may also use $* to repeat the whole default line,
2180 so you do not have to re-type everything to add something to the default.
2181
2182 Everytime there is a substitution, you will have to confirm.  If there is an
2183 error (e.g. an unmatched backtick), the default answer will remain unchanged
2184 and you will be prompted again.
2185
2186 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2187 the questions and use the computed defaults (or the previous answers if there
2188 was already a config.sh file). Type 'Configure -h' for a list of options.
2189 You may also start interactively and then answer '& -d' at any prompt to turn
2190 on the non-interactive behaviour for the remainder of the execution.
2191
2192 EOH
2193         . ./myread
2194         cat <<EOH
2195
2196 Much effort has been expended to ensure that this shell script will run on any
2197 Unix system.  If despite that it blows up on yours, your best bet is to edit
2198 Configure and run it again.  If you can't run Configure for some reason,
2199 you'll have to generate a config.sh file by hand.  Whatever problems you
2200 have, let me (perlbug@perl.org) know how I blew it.
2201
2202 This installation script affects things in two ways:
2203
2204 1) it may do direct variable substitutions on some of the files included
2205    in this kit.
2206 2) it builds a config.h file for inclusion in C programs.  You may edit
2207    any of these files as the need arises after running this script.
2208
2209 If you make a mistake on a question, there is no easy way to back up to it
2210 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2211 files.  Configure will offer to let you do this before it runs the SH files.
2212
2213 EOH
2214         dflt='Type carriage return to continue'
2215         . ./myread
2216         case "$firsttime" in
2217         true) echo $user >>../.config/instruct;;
2218         esac
2219 fi
2220
2221 : find out where common programs are
2222 echo " "
2223 echo "Locating common programs..." >&4
2224 cat <<EOSC >loc
2225 $startsh
2226 case \$# in
2227 0) exit 1;;
2228 esac
2229 thing=\$1
2230 shift
2231 dflt=\$1
2232 shift
2233 for dir in \$*; do
2234         case "\$thing" in
2235         .)
2236         if test -d \$dir/\$thing; then
2237                 echo \$dir
2238                 exit 0
2239         fi
2240         ;;
2241         *)
2242         for thisthing in \$dir/\$thing; do
2243                 : just loop through to pick last item
2244         done
2245         if test -f \$thisthing; then
2246                 echo \$thisthing
2247                 exit 0
2248         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2249                 echo \$thisthing
2250                 exit 0
2251         elif test -f \$dir/\$thing.exe; then
2252                 if test -n "$DJGPP"; then
2253                         echo \$dir/\$thing.exe
2254                 elif test "$eunicefix" != ":"; then
2255                         : on Eunice apparently
2256                         echo \$dir/\$thing
2257                         exit 0
2258                 fi
2259                 exit 0
2260         fi
2261         ;;
2262         esac
2263 done
2264 echo \$dflt
2265 exit 1
2266 EOSC
2267 chmod +x loc
2268 $eunicefix loc
2269 loclist="
2270 awk
2271 cat
2272 chmod
2273 comm
2274 cp
2275 echo
2276 expr
2277 grep
2278 ls
2279 mkdir
2280 rm
2281 sed
2282 sort
2283 touch
2284 tr
2285 uniq
2286 "
2287 trylist="
2288 Mcc
2289 ar
2290 bison
2291 byacc
2292 cpp
2293 csh
2294 date
2295 egrep
2296 gmake
2297 gzip
2298 less
2299 ln
2300 make
2301 more
2302 nm
2303 nroff
2304 pg
2305 test
2306 uname
2307 zip
2308 "
2309 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2310 pth="$pth /lib /usr/lib"
2311 for file in $loclist; do
2312         eval xxx=\$$file
2313         case "$xxx" in
2314         /*|?:[\\/]*)
2315                 if test -f "$xxx"; then
2316                         : ok
2317                 else
2318                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2319                         xxx=`./loc $file $file $pth`
2320                 fi
2321                 ;;
2322         '') xxx=`./loc $file $file $pth`;;
2323         *) xxx=`./loc $xxx $xxx $pth`;;
2324         esac
2325         eval $file=$xxx$_exe
2326         eval _$file=$xxx
2327         case "$xxx" in
2328         /*)
2329                 echo $file is in $xxx.
2330                 ;;
2331         ?:[\\/]*)
2332                 echo $file is in $xxx.
2333                 ;;
2334         *)
2335                 echo "I don't know where '$file' is, and my life depends on it." >&4
2336                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337                 exit 1
2338                 ;;
2339         esac
2340 done
2341 echo " "
2342 echo "Don't worry if any of the following aren't found..."
2343 say=offhand
2344 for file in $trylist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't see $file out there, $say."
2369                 say=either
2370                 ;;
2371         esac
2372 done
2373 case "$egrep" in
2374 egrep)
2375         echo "Substituting grep for egrep."
2376         egrep=$grep
2377         _egrep=$grep
2378         ;;
2379 esac
2380 case "$ln" in
2381 ln)
2382         echo "Substituting cp for ln."
2383         ln=$cp
2384         _ln=$cp
2385         ;;
2386 esac
2387 case "$make" in
2388 make)   
2389         case "$gmake" in
2390         gmake)
2391         echo "I can't find make or gmake, and my life depends on it." >&4
2392         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2393         exit 1
2394         ;;
2395         esac
2396         ;;
2397 esac    
2398 case "$gmake" in
2399 gmake)  ;;
2400 *)      # We can't have osname yet.
2401         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2402                 # Assume that gmake, if found, is definitely GNU make
2403                 # and prefer it over the system make.
2404                 echo "Substituting gmake for make."
2405                 make=$gmake
2406                 _make=$gmake
2407         fi
2408         ;;
2409 esac
2410 case "$test" in
2411 test)
2412         echo "Hopefully test is built into your sh."
2413         ;;
2414 *)
2415         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2416                 echo "Using the test built into your sh."
2417                 test=test
2418                 _test=test
2419         fi
2420         ;;
2421 esac
2422 case "$echo" in
2423 echo)
2424         echo "Hopefully echo is built into your sh."
2425         ;;
2426 '') ;;
2427 *)
2428         echo " "
2429 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2430         $echo $n "hi there$c" >foo1
2431         echo $n "hi there$c" >foo2
2432         if cmp foo1 foo2 >/dev/null 2>&1; then
2433                 echo "They are compatible.  In fact, they may be identical."
2434         else
2435                 case "$n" in
2436                 '-n') n='' c='\c';;
2437                 *) n='-n' c='';;
2438                 esac
2439                 cat <<FOO
2440 They are not compatible!  You are probably running ksh on a non-USG system.
2441 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2442 have echo built in and we may have to run some Bourne shell scripts.  That
2443 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2444
2445 FOO
2446                 $echo $n "The star should be here-->$c"
2447                 $echo "*"
2448         fi
2449         $rm -f foo1 foo2
2450         ;;
2451 esac
2452
2453 cat <<EOS >trygcc
2454 $startsh
2455 EOS
2456 cat <<'EOSC' >>trygcc
2457 case "$cc" in
2458 '') ;;
2459 *)  $rm -f try try.*
2460     $cat >try.c <<EOM
2461 int main(int argc, char *argv[]) {
2462   return 0;
2463 }
2464 EOM
2465     if $cc -o try $ccflags $ldflags try.c; then
2466        :
2467     else
2468         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2469         despair=yes
2470         trygcc=yes
2471         case "$cc" in
2472         *gcc*) trygcc=no ;;
2473         esac
2474         case "`$cc -v -c try.c 2>&1`" in
2475         *gcc*) trygcc=no ;;
2476         esac
2477         if $test X"$trygcc" = Xyes; then
2478             if gcc -o try -c try.c; then
2479                 echo " "
2480                 echo "You seem to have a working gcc, though." >&4
2481                 rp="Would you like to use it?"
2482                 dflt=y
2483                 if $test -f myread; then
2484                     . ./myread
2485                 else
2486                     if $test -f UU/myread; then
2487                         . ./UU/myread
2488                     else
2489                         echo "Cannot find myread, sorry.  Aborting." >&2
2490                         exit 1
2491                     fi
2492                 fi  
2493                 case "$ans" in
2494                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2495                        if $test -f usethreads.cbu; then
2496                            $cat >&4 <<EOM 
2497
2498 *** However, any setting of the C compiler flags (e.g. for thread support)
2499 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2500 *** (together with e.g. -Dusethreads).
2501
2502 EOM
2503                        fi;;
2504                 esac
2505             fi
2506         fi
2507     fi
2508     $rm -f try try.*
2509     ;;
2510 esac
2511 EOSC
2512
2513 cat <<EOS >checkcc
2514 $startsh
2515 EOS
2516 cat <<'EOSC' >>checkcc
2517 case "$cc" in        
2518 '') ;;
2519 *)  $rm -f try try.*              
2520     $cat >try.c <<EOM
2521 int main(int argc, char *argv[]) {
2522   return 0;
2523 }
2524 EOM
2525     if $cc -o try $ccflags $ldflags try.c; then
2526        :
2527     else
2528         if $test X"$despair" = Xyes; then
2529            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530         fi
2531         $cat >&4 <<EOM         
2532 You need to find a working C compiler.
2533 Either (purchase and) install the C compiler supplied by your OS vendor,
2534 or for a free C compiler try http://gcc.gnu.org/
2535 I cannot continue any further, aborting.
2536 EOM
2537         exit 1
2538     fi
2539     $rm -f try try.*
2540     ;;
2541 esac
2542 EOSC
2543
2544 : determine whether symbolic links are supported
2545 echo " "
2546 $touch blurfl
2547 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2548         echo "Symbolic links are supported." >&4
2549         lns="$ln -s"
2550 else
2551         echo "Symbolic links are NOT supported." >&4
2552         lns="$ln"
2553 fi
2554 $rm -f blurfl sym
2555
2556 : determine whether symbolic links are supported
2557 echo " "
2558 case "$lns" in
2559 *"ln"*" -s")
2560         echo "Checking how to test for symbolic links..." >&4
2561         $lns blurfl sym
2562         if $test "X$issymlink" = X; then
2563                 case "$newsh" in
2564                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 esac
2567                 if test $? = 0; then
2568                         issymlink="test -h"
2569                 else
2570                         echo "Your builtin 'test -h' may be broken." >&4
2571                         case "$test" in
2572                         /*)     ;;
2573                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2574                                 for p in $pth
2575                                 do
2576                                         if test -f "$p/$test"; then
2577                                                 test="$p/$test"
2578                                                 break
2579                                         fi
2580                                 done
2581                                 ;;
2582                         esac
2583                         case "$test" in
2584                         /*)
2585                                 echo "Trying external '$test -h'." >&4
2586                                 issymlink="$test -h"
2587                                 if $test ! -h sym >/dev/null 2>&1; then
2588                                         echo "External '$test -h' is broken, too." >&4
2589                                         issymlink=''
2590                                 fi
2591                                 ;;
2592                         *)      issymlink='' ;;
2593                         esac
2594                 fi              
2595         fi
2596         if $test "X$issymlink" = X; then
2597                 if $test -L sym 2>/dev/null; then
2598                         issymlink="$test -L"
2599                         echo "The builtin '$test -L' worked." >&4
2600                 fi
2601         fi
2602         if $test "X$issymlink" != X; then
2603                 echo "You can test for symbolic links with '$issymlink'." >&4
2604         else
2605                 echo "I do not know how you can test for symbolic links." >&4
2606         fi
2607         $rm -f blurfl sym
2608         ;;
2609 *)      echo "No symbolic links, so not testing for their testing..." >&4
2610         ;;
2611 esac
2612 echo " "
2613
2614
2615 case "$mksymlinks" in
2616 $define|true|[yY]*)
2617         case "$src" in
2618         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2619                 exit 1
2620                 ;;
2621         *)      case "$lns:$issymlink" in
2622                 *"ln"*" -s:"*"test -"?)
2623                         echo "Creating the symbolic links..." >&4
2624                         echo "(First creating the subdirectories...)" >&4
2625                         cd ..
2626                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2627                                 read directory
2628                                 test -z "$directory" && break
2629                                 mkdir -p $directory
2630                         done
2631                         # Sanity check 1.
2632                         if test ! -d t/base; then
2633                                 echo "Failed to create the subdirectories.  Aborting." >&4
2634                                 exit 1
2635                         fi
2636                         echo "(Then creating the symlinks...)" >&4
2637                         awk '{print $1}' $src/MANIFEST | while true; do
2638                                 read filename
2639                                 test -z "$filename" && break
2640                                 if test -f $filename; then
2641                                         if $issymlink $filename; then
2642                                                 rm -f $filename
2643                                         fi
2644                                 fi
2645                                 if test -f $filename; then
2646                                         echo "$filename already exists, not symlinking."
2647                                 else
2648                                         ln -s $src/$filename $filename
2649                                 fi
2650                         done
2651                         # Sanity check 2.
2652                         if test ! -f t/base/lex.t; then
2653                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         cd UU
2657                         ;;
2658                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2659                         ;;
2660                 esac
2661                 ;;
2662         esac
2663         ;;
2664 esac
2665
2666
2667 case "$usecrosscompile" in
2668 $define|true|[yY]*)
2669         $echo "Cross-compiling..."
2670         croak=''
2671         case "$cc" in
2672         *-*-gcc) # A cross-compiling gcc, probably.
2673             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2674             ar=$targetarch-ar
2675             # leave out ld, choosing it is more complex
2676             nm=$targetarch-nm
2677             ranlib=$targetarch-ranlib
2678             $echo 'extern int foo;' > try.c
2679             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2680             shift
2681             if $test $# -gt 0; then
2682                 incpth="$incpth $*"
2683                 incpth="`$echo $incpth|$sed 's/^ //'`"
2684                 echo "Guessing incpth '$incpth'." >&4
2685                 for i in $*; do
2686                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2687                     if $test -d $j; then
2688                         libpth="$libpth $j"
2689                     fi
2690                 done   
2691                 libpth="`$echo $libpth|$sed 's/^ //'`"
2692                 echo "Guessing libpth '$libpth'." >&4
2693             fi
2694             $rm -f try.c
2695             ;;
2696         esac
2697         case "$targetarch" in
2698         '') echo "Targetarch not defined." >&4; croak=y ;;
2699         *)  echo "Using targetarch $targetarch." >&4 ;;
2700         esac
2701         case "$incpth" in
2702         '') echo "Incpth not defined." >&4; croak=y ;;
2703         *)  echo "Using incpth '$incpth'." >&4 ;;
2704         esac
2705         case "$libpth" in
2706         '') echo "Libpth not defined." >&4; croak=y ;;
2707         *)  echo "Using libpth '$libpth'." >&4 ;;
2708         esac
2709         case "$usrinc" in
2710         '') for i in $incpth; do
2711                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2712                     usrinc=$i
2713                     echo "Guessing usrinc $usrinc." >&4
2714                     break
2715                 fi
2716             done
2717             case "$usrinc" in
2718             '') echo "Usrinc not defined." >&4; croak=y ;;
2719             esac
2720             ;;
2721         *)  echo "Using usrinc $usrinc." >&4 ;;
2722         esac
2723         case "$targethost" in
2724         '') echo "Targethost not defined." >&4; croak=y ;;
2725         *)  echo "Using targethost $targethost." >&4
2726         esac
2727         locincpth=' '
2728         loclibpth=' '
2729         case "$croak" in
2730         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2731         esac
2732         case "$src" in
2733         /*) run=$src/Cross/run
2734             targetmkdir=$src/Cross/mkdir
2735             to=$src/Cross/to
2736             from=$src/Cross/from
2737             ;;
2738         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2739             run=$pwd/Cross/run
2740             targetmkdir=$pwd/Cross/mkdir
2741             to=$pwd/Cross/to
2742             from=$pwd/Cross/from
2743             ;;
2744         esac
2745         case "$targetrun" in
2746         '') targetrun=ssh ;;
2747         esac
2748         case "$targetto" in
2749         '') targetto=scp ;;
2750         esac
2751         case "$targetfrom" in
2752         '') targetfrom=scp ;;
2753         esac
2754         run=$run-$targetrun
2755         to=$to-$targetto
2756         from=$from-$targetfrom
2757         case "$targetdir" in
2758         '')  targetdir=/tmp
2759              echo "Guessing targetdir $targetdir." >&4
2760              ;;
2761         esac
2762         case "$targetuser" in
2763         '')  targetuser=root
2764              echo "Guessing targetuser $targetuser." >&4
2765              ;;
2766         esac
2767         case "$targetfrom" in
2768         scp)    q=-q ;;
2769         *)      q='' ;;
2770         esac
2771         case "$targetrun" in
2772         ssh|rsh)
2773             cat >$run <<EOF
2774 #!/bin/sh
2775 case "\$1" in
2776 -cwd)
2777   shift
2778   cwd=\$1
2779   shift
2780   ;;
2781 esac
2782 case "\$cwd" in
2783 '') cwd=$targetdir ;;
2784 esac
2785 exe=\$1
2786 shift
2787 if $test ! -f \$exe.xok; then
2788   $to \$exe
2789   $touch \$exe.xok
2790 fi
2791 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2792 EOF
2793             ;;
2794         *)  echo "Unknown targetrun '$targetrun'" >&4
2795             exit 1
2796             ;;
2797         esac
2798         case "$targetmkdir" in
2799         */Cross/mkdir)
2800             cat >$targetmkdir <<EOF
2801 #!/bin/sh
2802 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2803 EOF
2804             $chmod a+rx $targetmkdir
2805             ;;
2806         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2807             exit 1
2808             ;;
2809         esac
2810         case "$targetto" in
2811         scp|rcp)
2812             cat >$to <<EOF
2813 #!/bin/sh
2814 for f in \$@
2815 do
2816   case "\$f" in
2817   /*)
2818     $targetmkdir \`dirname \$f\`
2819     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2820     ;;
2821   *)
2822     $targetmkdir $targetdir/\`dirname \$f\`
2823     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2824     ;;
2825   esac
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         cp) cat >$to <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   case "\$f" in
2835   /*)
2836     $mkdir -p $targetdir/\`dirname \$f\`
2837     $cp \$f $targetdir/\$f || exit 1
2838     ;;
2839   *)
2840     $targetmkdir $targetdir/\`dirname \$f\`
2841     $cp \$f $targetdir/\$f || exit 1
2842     ;;
2843   esac
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         *)  echo "Unknown targetto '$targetto'" >&4
2849             exit 1
2850             ;;
2851         esac
2852         case "$targetfrom" in
2853         scp|rcp)
2854           cat >$from <<EOF
2855 #!/bin/sh
2856 for f in \$@
2857 do
2858   $rm -f \$f
2859   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2860 done
2861 exit 0
2862 EOF
2863             ;;
2864         cp) cat >$from <<EOF
2865 #!/bin/sh
2866 for f in \$@
2867 do
2868   $rm -f \$f
2869   cp $targetdir/\$f . || exit 1
2870 done
2871 exit 0
2872 EOF
2873             ;;
2874         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2875             exit 1
2876             ;;
2877         esac
2878         if $test ! -f $run; then
2879             echo "Target 'run' script '$run' not found." >&4
2880         else
2881             $chmod a+rx $run
2882         fi
2883         if $test ! -f $to; then
2884             echo "Target 'to' script '$to' not found." >&4
2885         else
2886             $chmod a+rx $to
2887         fi
2888         if $test ! -f $from; then
2889             echo "Target 'from' script '$from' not found." >&4
2890         else
2891             $chmod a+rx $from
2892         fi
2893         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2894             exit 1
2895         fi
2896         cat >&4 <<EOF
2897 Using '$run' for remote execution,
2898 and '$from' and '$to'
2899 for remote file transfer.
2900 EOF
2901         ;;
2902 *)      run=''
2903         to=:
2904         from=:
2905         usecrosscompile='undef'
2906         targetarch=''
2907         ;;
2908 esac
2909
2910 : see whether [:lower:] and [:upper:] are supported character classes
2911 echo " "
2912 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2913 ABYZ)
2914         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2915         up='[:upper:]'
2916         low='[:lower:]'
2917         ;;
2918 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2919         # (0xd9 and 0xe2), therefore that is a nice testing point.
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2922             rs) up='[A-Z]'
2923                 low='[a-z]'
2924                 ;;
2925             esac
2926         fi
2927         if test "X$up" = X -o "X$low" = X; then
2928             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2929             rs) up='A-Z'
2930                 low='a-z'
2931                 ;;
2932             esac
2933         fi
2934         if test "X$up" = X -o "X$low" = X; then
2935             case "`echo RS | od -x 2>/dev/null`" in
2936             *D9E2*|*d9e2*)
2937                 echo "Hey, this might be EBCDIC." >&4
2938                 if test "X$up" = X -o "X$low" = X; then
2939                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2940                     rs) up='[A-IJ-RS-Z]'
2941                         low='[a-ij-rs-z]'
2942                         ;;
2943                     esac
2944                 fi
2945                 if test "X$up" = X -o "X$low" = X; then
2946                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2947                     rs) up='A-IJ-RS-Z'
2948                         low='a-ij-rs-z'
2949                         ;;
2950                     esac
2951                 fi
2952                 ;;
2953             esac
2954         fi
2955 esac
2956 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2957 rs)
2958     echo "Using $up and $low to convert case." >&4
2959     ;;
2960 *)
2961     echo "I don't know how to translate letters from upper to lower case." >&4
2962     echo "Your tr is not acting any way I know of." >&4
2963     exit 1
2964     ;;
2965 esac
2966 : set up the translation script tr, must be called with ./tr of course
2967 cat >tr <<EOSC
2968 $startsh
2969 case "\$1\$2" in
2970 '[A-Z][a-z]') exec $tr '$up' '$low';;
2971 '[a-z][A-Z]') exec $tr '$low' '$up';;
2972 esac
2973 exec $tr "\$@"
2974 EOSC
2975 chmod +x tr
2976 $eunicefix tr
2977
2978 : Try to determine whether config.sh was made on this system
2979 case "$config_sh" in
2980 '')
2981 myuname=`$uname -a 2>/dev/null`
2982 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2983 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2984 # because the A-Z/a-z are not consecutive.
2985 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2986         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2987 newmyuname="$myuname"
2988 dflt=n
2989 case "$knowitall" in
2990 '')
2991         if test -f ../config.sh; then
2992                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2993                         eval "`grep myuname= ../config.sh`"
2994                 fi
2995                 if test "X$myuname" = "X$newmyuname"; then
2996                         dflt=y
2997                 fi
2998         fi
2999         ;;
3000 *) dflt=y;;
3001 esac
3002
3003 : Get old answers from old config file if Configure was run on the
3004 : same system, otherwise use the hints.
3005 hint=default
3006 cd ..
3007 if test -f config.sh; then
3008         echo " "
3009         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3010         . UU/myread
3011         case "$ans" in
3012         n*|N*) echo "OK, I'll ignore it."
3013                 mv config.sh config.sh.old
3014                 myuname="$newmyuname"
3015                 ;;
3016         *)  echo "Fetching default answers from your old config.sh file..." >&4
3017                 tmp_n="$n"
3018                 tmp_c="$c"
3019                 tmp_sh="$sh"
3020                 . ./config.sh
3021                 cp config.sh UU
3022                 n="$tmp_n"
3023                 c="$tmp_c"
3024                 : Older versions did not always set $sh.  Catch re-use of such
3025                 : an old config.sh.
3026                 case "$sh" in
3027                 '') sh="$tmp_sh" ;;
3028                 esac
3029                 hint=previous
3030                 ;;
3031         esac
3032 fi
3033 . ./UU/checkcc
3034 if test ! -f config.sh; then
3035         $cat <<EOM
3036
3037 First time through, eh?  I have some defaults handy for some systems
3038 that need some extra help getting the Configure answers right:
3039
3040 EOM
3041         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3042         dflt=''
3043         : Half the following guesses are probably wrong... If you have better
3044         : tests or hints, please send them to perlbug@perl.org
3045         : The metaconfig authors would also appreciate a copy...
3046         $test -f /irix && osname=irix
3047         $test -f /xenix && osname=sco_xenix
3048         $test -f /dynix && osname=dynix
3049         $test -f /dnix && osname=dnix
3050         $test -f /lynx.os && osname=lynxos
3051         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3052         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3053         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /bin/mips && /bin/mips && osname=mips
3055         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3056                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3057         $test -d /usr/apollo/bin && osname=apollo
3058         $test -f /etc/saf/_sactab && osname=svr4
3059         $test -d /usr/include/minix && osname=minix
3060         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3061         if $test -d /MachTen -o -d /MachTen_Folder; then
3062                 osname=machten
3063                 if $test -x /sbin/version; then
3064                         osvers=`/sbin/version | $awk '{print $2}' |
3065                         $sed -e 's/[A-Za-z]$//'`
3066                 elif $test -x /usr/etc/version; then
3067                         osvers=`/usr/etc/version | $awk '{print $2}' |
3068                         $sed -e 's/[A-Za-z]$//'`
3069                 else
3070                         osvers="$2.$3"
3071                 fi
3072         fi
3073
3074         $test -f /sys/posix.dll &&
3075                 $test -f /usr/bin/what &&
3076                 set X `/usr/bin/what /sys/posix.dll` &&
3077                 $test "$3" = UWIN &&
3078                 osname=uwin &&
3079                 osvers="$5"
3080
3081         if $test -f $uname; then
3082                 set X $myuname
3083                 shift
3084
3085                 case "$5" in
3086                 fps*) osname=fps ;;
3087                 mips*)
3088                         case "$4" in
3089                         umips) osname=umips ;;
3090                         *) osname=mips ;;
3091                         esac;;
3092                 [23]100) osname=mips ;;
3093                 next*) osname=next ;;
3094                 i386*)
3095                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3096                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3097                                 osname='sco'
3098                                 osvers=$tmp
3099                         elif $test -f /etc/kconfig; then
3100                                 osname=isc
3101                                 if test "$lns" = "$ln -s"; then
3102                                         osvers=4
3103                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3104                                         osvers=3
3105                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3106                                         osvers=2
3107                                 fi
3108                         fi
3109                         tmp=''
3110                         ;;
3111                 pc*)
3112                         if test -n "$DJGPP"; then
3113                                 osname=dos
3114                                 osvers=djgpp
3115                         fi
3116                         ;;
3117                 esac
3118
3119                 case "$1" in
3120                 aix) osname=aix
3121                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3122                         case "$tmp" in
3123                         # oslevel can fail with:
3124                         # oslevel: Unable to acquire lock.
3125                         *not\ found) osvers="$4"."$3" ;;
3126                         '<3240'|'<>3240') osvers=3.2.0 ;;
3127                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3128                         '=3250'|'>3250') osvers=3.2.5 ;;
3129                         *) osvers=$tmp;;
3130                         esac
3131                         ;;
3132                 bsd386) osname=bsd386
3133                         osvers=`$uname -r`
3134                         ;;
3135                 cygwin*) osname=cygwin
3136                         osvers="$3"
3137                         ;;
3138                 *dc.osx) osname=dcosx
3139                         osvers="$3"
3140                         ;;
3141                 dnix) osname=dnix
3142                         osvers="$3"
3143                         ;;
3144                 domainos) osname=apollo
3145                         osvers="$3"
3146                         ;;
3147                 dgux)   osname=dgux
3148                         osvers="$3"
3149                         ;;
3150                 dragonfly) osname=dragonfly
3151                         osvers="$3"
3152                         ;;
3153                 dynixptx*) osname=dynixptx
3154                         osvers=`echo "$4"|sed 's/^v//'`
3155                         ;;
3156                 freebsd) osname=freebsd
3157                         osvers="$3" ;;
3158                 genix)  osname=genix ;;
3159                 gnu)    osname=gnu
3160                         osvers="$3" ;;
3161                 hp*)    osname=hpux
3162                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3163                         ;;
3164                 irix*)  osname=irix
3165                         case "$3" in
3166                         4*) osvers=4 ;;
3167                         5*) osvers=5 ;;
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 linux)  osname=linux
3172                         case "$3" in
3173                         *)      osvers="$3" ;;
3174                         esac
3175                         ;;
3176                 MiNT)   osname=mint
3177                         ;;
3178                 netbsd*) osname=netbsd
3179                         osvers="$3"
3180                         ;;
3181                 news-os) osvers="$3"
3182                         case "$3" in
3183                         4*) osname=newsos4 ;;
3184                         *) osname=newsos ;;
3185                         esac
3186                         ;;
3187                 next*) osname=next ;;
3188                 nonstop-ux) osname=nonstopux ;;
3189                 openbsd) osname=openbsd
3190                         osvers="$3"
3191                         ;;
3192                 os2)    osname=os2
3193                         osvers="$4"
3194                         ;;
3195                 POSIX-BC | posix-bc ) osname=posix-bc
3196                         osvers="$3"
3197                         ;;
3198                 powerux | power_ux | powermax_os | powermaxos | \
3199                 powerunix | power_unix) osname=powerux
3200                         osvers="$3"
3201                         ;;
3202                 qnx) osname=qnx
3203                         osvers="$4"
3204                         ;;
3205                 solaris) osname=solaris
3206                         case "$3" in
3207                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3208                         *)      osvers="$3" ;;
3209                         esac
3210                         ;;
3211                 sunos) osname=sunos
3212                         case "$3" in
3213                         5*) osname=solaris
3214                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3215                         *)      osvers="$3" ;;
3216                         esac
3217                         ;;
3218                 titanos) osname=titanos
3219                         case "$3" in
3220                         1*) osvers=1 ;;
3221                         2*) osvers=2 ;;
3222                         3*) osvers=3 ;;
3223                         4*) osvers=4 ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 ultrix) osname=ultrix
3228                         osvers="$3"
3229                         ;;
3230                 osf1|mls+)      case "$5" in
3231                                 alpha)
3232                                         osname=dec_osf
3233                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3234                                         case "$osvers" in
3235                                         [1-9].[0-9]*) ;;
3236                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3237                                         esac
3238                                         ;;
3239                         hp*)    osname=hp_osf1  ;;
3240                         mips)   osname=mips_osf1 ;;
3241                         esac
3242                         ;;
3243                 # UnixWare 7.1.2 is known as Open UNIX 8
3244                 openunix|unixware) osname=svr5
3245                         osvers="$4"
3246                         ;;
3247                 uts)    osname=uts
3248                         osvers="$3"
3249                         ;;
3250                 vos) osvers="$3"
3251                         ;;
3252                 $2) case "$osname" in
3253                         *isc*) ;;
3254                         *freebsd*) ;;
3255                         svr*)
3256                                 : svr4.x or possibly later
3257                                 case "svr$3" in
3258                                 ${osname}*)
3259                                         osname=svr$3
3260                                         osvers=$4
3261                                         ;;
3262                                 esac
3263                                 case "$osname" in
3264                                 svr4.0)
3265                                         : Check for ESIX
3266                                         if test -f /stand/boot ; then
3267                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3268                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3269                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3270                                                         if test -n "$isesix"; then
3271                                                                 osname=esix4
3272                                                         fi
3273                                                 fi
3274                                         fi
3275                                         ;;
3276                                 esac
3277                                 ;;
3278                         *)      if test -f /etc/systemid; then
3279                                         osname=sco
3280                                         set `echo $3 | $sed 's/\./ /g'` $4
3281                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3282                                                 osvers=$1.$2.$3
3283                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3284                                                 osvers=$1.$2
3285                                         elif $test -f $src/hints/sco_$1.sh; then
3286                                                 osvers=$1
3287                                         fi
3288                                 else
3289                                         case "$osname" in
3290                                         '') : Still unknown.  Probably a generic Sys V.
3291                                                 osname="sysv"
3292                                                 osvers="$3"
3293                                                 ;;
3294                                         esac
3295                                 fi
3296                                 ;;
3297                         esac
3298                         ;;
3299                 *)      case "$osname" in
3300                         '') : Still unknown.  Probably a generic BSD.
3301                                 osname="$1"
3302                                 osvers="$3"
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307         else
3308                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3309                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3310                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3311                                 osname=news_os
3312                         fi
3313                         $rm -f UU/kernel.what
3314                 elif test -d c:/. -o -n "$is_os2" ; then
3315                         set X $myuname
3316                         osname=os2
3317                         osvers="$5"
3318                 fi
3319         fi
3320
3321         case "$targetarch" in
3322         '') ;;
3323         *)  hostarch=$osname
3324             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3325             osvers=''
3326             ;;
3327         esac
3328
3329         : Now look for a hint file osname_osvers, unless one has been
3330         : specified already.
3331         case "$hintfile" in
3332         ''|' ')
3333                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3334                 : Also try without trailing minor version numbers.
3335                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3336                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3337                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3339                 case "$file" in
3340                 '') dflt=none ;;
3341                 *)  case "$osvers" in
3342                         '') dflt=$file
3343                                 ;;
3344                         *)  if $test -f $src/hints/$file.sh ; then
3345                                         dflt=$file
3346                                 elif $test -f $src/hints/$xfile.sh ; then
3347                                         dflt=$xfile
3348                                 elif $test -f $src/hints/$xxfile.sh ; then
3349                                         dflt=$xxfile
3350                                 elif $test -f $src/hints/$xxxfile.sh ; then
3351                                         dflt=$xxxfile
3352                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3353                                         dflt=$xxxxfile
3354                                 elif $test -f "$src/hints/${osname}.sh" ; then
3355                                         dflt="${osname}"
3356                                 else
3357                                         dflt=none
3358                                 fi
3359                                 ;;
3360                         esac
3361                         ;;
3362                 esac
3363                 if $test -f Policy.sh ; then
3364                         case "$dflt" in
3365                         *Policy*) ;;
3366                         none) dflt="Policy" ;;
3367                         *) dflt="Policy $dflt" ;;
3368                         esac
3369                 fi
3370                 ;;
3371         *)
3372                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3373                 ;;
3374         esac
3375
3376         if $test -f Policy.sh ; then
3377                 $cat <<EOM
3378
3379 There's also a Policy hint file available, which should make the
3380 site-specific (policy) questions easier to answer.
3381 EOM
3382
3383         fi
3384
3385         $cat <<EOM
3386
3387 You may give one or more space-separated answers, or "none" if appropriate.
3388 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3389 is a good thing.  DO NOT give a wrong version or a wrong OS.
3390
3391 EOM
3392
3393         rp="Which of these apply, if any?"
3394         . UU/myread
3395         tans=$ans
3396         for file in $tans; do
3397                 if $test X$file = XPolicy -a -f Policy.sh; then
3398                         . Policy.sh
3399                         $cat Policy.sh >> UU/config.sh
3400                 elif $test -f $src/hints/$file.sh; then
3401                         . $src/hints/$file.sh
3402                         $cat $src/hints/$file.sh >> UU/config.sh
3403                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3404                         : nothing
3405                 else
3406                         : Give one chance to correct a possible typo.
3407                         echo "$file.sh does not exist"
3408                         dflt=$file
3409                         rp="hint to use instead?"
3410                         . UU/myread
3411                         for file in $ans; do
3412                                 if $test -f "$src/hints/$file.sh"; then
3413                                         . $src/hints/$file.sh
3414                                         $cat $src/hints/$file.sh >> UU/config.sh
3415                                 elif $test X$ans = X -o X$ans = Xnone ; then
3416                                         : nothing
3417                                 else
3418                                         echo "$file.sh does not exist -- ignored."
3419                                 fi
3420                         done
3421                 fi
3422         done
3423
3424         hint=recommended
3425         : Remember our hint file for later.
3426         if $test -f "$src/hints/$file.sh" ; then
3427                 hintfile="$file"
3428         else
3429                 hintfile=''
3430         fi
3431 fi
3432 cd UU
3433 ;;
3434 *)
3435         echo " "
3436         echo "Fetching default answers from $config_sh..." >&4
3437         tmp_n="$n"
3438         tmp_c="$c"
3439         cd ..
3440         cp $config_sh config.sh 2>/dev/null
3441         chmod +w config.sh
3442         . ./config.sh
3443         cd UU
3444         cp ../config.sh .
3445         n="$tmp_n"
3446         c="$tmp_c"
3447         hint=previous
3448         ;;
3449 esac
3450 test "$override" && . ./optdef.sh
3451
3452 : Restore computed paths
3453 for file in $loclist $trylist; do
3454         eval $file="\$_$file"
3455 done
3456
3457 cat << EOM
3458
3459 Configure uses the operating system name and version to set some defaults.
3460 The default value is probably right if the name rings a bell. Otherwise,
3461 since spelling matters for me, either accept the default or answer "none"
3462 to leave it blank.
3463
3464 EOM
3465 case "$osname" in
3466         ''|' ')
3467                 case "$hintfile" in
3468                 ''|' '|none) dflt=none ;;
3469                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3470                 esac
3471                 ;;
3472         *) dflt="$osname" ;;
3473 esac
3474 rp="Operating system name?"
3475 . ./myread
3476 case "$ans" in
3477 none)  osname='' ;;
3478 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3479 esac
3480 echo " "
3481 case "$osvers" in
3482         ''|' ')
3483                 case "$hintfile" in
3484                 ''|' '|none) dflt=none ;;
3485                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3486                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3487                         case "$dflt" in
3488                         ''|' ') dflt=none ;;
3489                         esac
3490                         ;;
3491                 esac
3492                 ;;
3493         *) dflt="$osvers" ;;
3494 esac
3495 rp="Operating system version?"
3496 . ./myread
3497 case "$ans" in
3498 none)  osvers='' ;;
3499 *) osvers="$ans" ;;
3500 esac
3501
3502
3503 . ./posthint.sh
3504
3505 : who configured the system
3506 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3507 case "$cf_by" in
3508 "")
3509         cf_by=`(logname) 2>/dev/null`
3510         case "$cf_by" in
3511         "")
3512                 cf_by=`(whoami) 2>/dev/null`
3513                 case "$cf_by" in
3514                 "") cf_by=unknown ;;
3515                 esac ;;
3516         esac ;;
3517 esac
3518
3519 : decide how portable to be.  Allow command line overrides.
3520 case "$d_portable" in
3521 "$undef") ;;
3522 *)      d_portable="$define" ;;
3523 esac
3524
3525 : set up shell script to do ~ expansion
3526 cat >filexp <<EOSS
3527 $startsh
3528 : expand filename
3529 case "\$1" in
3530  ~/*|~)
3531         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3532         ;;
3533  ~*)
3534         if $test -f /bin/csh; then
3535                 /bin/csh -f -c "glob \$1"
3536                 failed=\$?
3537                 echo ""
3538                 exit \$failed
3539         else
3540                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3541                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3542                 if $test ! -d "\$dir"; then
3543                         me=\`basename \$0\`
3544                         echo "\$me: can't locate home directory for: \$name" >&2
3545                         exit 1
3546                 fi
3547                 case "\$1" in
3548                 */*)
3549                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3550                         ;;
3551                 *)
3552                         echo \$dir
3553                         ;;
3554                 esac
3555         fi
3556         ;;
3557 *)
3558         echo \$1
3559         ;;
3560 esac
3561 EOSS
3562 chmod +x filexp
3563 $eunicefix filexp
3564
3565 : now set up to get a file name
3566 cat <<EOS >getfile
3567 $startsh
3568 EOS
3569 cat <<'EOSC' >>getfile
3570 tilde=''
3571 fullpath=''
3572 already=''
3573 skip=''
3574 none_ok=''
3575 exp_file=''
3576 nopath_ok=''
3577 orig_rp="$rp"
3578 orig_dflt="$dflt"
3579 case "$gfpth" in
3580 '') gfpth='.' ;;
3581 esac
3582
3583 case "$fn" in
3584 *\(*)
3585         : getfile will accept an answer from the comma-separated list
3586         : enclosed in parentheses even if it does not meet other criteria.
3587         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3588         fn=`echo $fn | sed 's/(.*)//'`
3589         ;;
3590 esac
3591
3592 case "$fn" in
3593 *:*)
3594         loc_file=`expr $fn : '.*:\(.*\)'`
3595         fn=`expr $fn : '\(.*\):.*'`
3596         ;;
3597 esac
3598
3599 case "$fn" in
3600 *~*) tilde=true;;
3601 esac
3602 case "$fn" in
3603 */*) fullpath=true;;
3604 esac
3605 case "$fn" in
3606 *+*) skip=true;;
3607 esac
3608 case "$fn" in
3609 *n*) none_ok=true;;
3610 esac
3611 case "$fn" in
3612 *e*) exp_file=true;;
3613 esac
3614 case "$fn" in
3615 *p*) nopath_ok=true;;
3616 esac
3617
3618 case "$fn" in
3619 *f*) type='File';;
3620 *d*) type='Directory';;
3621 *l*) type='Locate';;
3622 esac
3623
3624 what="$type"
3625 case "$what" in
3626 Locate) what='File';;
3627 esac
3628
3629 case "$exp_file" in
3630 '')
3631         case "$d_portable" in
3632         "$define") ;;
3633         *) exp_file=true;;
3634         esac
3635         ;;
3636 esac
3637
3638 cd ..
3639 while test "$type"; do
3640         redo=''
3641         rp="$orig_rp"
3642         dflt="$orig_dflt"
3643         case "$tilde" in
3644         true) rp="$rp (~name ok)";;
3645         esac
3646         . UU/myread
3647         if test -f UU/getfile.ok && \
3648                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3649         then
3650                 value="$ans"
3651                 ansexp="$ans"
3652                 break
3653         fi
3654         case "$ans" in
3655         none)
3656                 value=''
3657                 ansexp=''
3658                 case "$none_ok" in
3659                 true) type='';;
3660                 esac
3661                 ;;
3662         *)
3663                 case "$tilde" in
3664                 '') value="$ans"
3665                         ansexp="$ans";;
3666                 *)
3667                         value=`UU/filexp $ans`
3668                         case $? in
3669                         0)
3670                                 if test "$ans" != "$value"; then
3671                                         echo "(That expands to $value on this system.)"
3672                                 fi
3673                                 ;;
3674                         *) value="$ans";;
3675                         esac
3676                         ansexp="$value"
3677                         case "$exp_file" in
3678                         '') value="$ans";;
3679                         esac
3680                         ;;
3681                 esac
3682                 case "$fullpath" in
3683                 true)
3684                         case "$ansexp" in
3685                         /*) value="$ansexp" ;;
3686                         [a-zA-Z]:/*) value="$ansexp" ;;
3687                         *)
3688                                 redo=true
3689                                 case "$already" in
3690                                 true)
3691                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3692                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3693                                         ;;
3694                                 *)
3695                                 echo "Please give a full path name, starting with slash." >&4
3696                                         case "$tilde" in
3697                                         true)
3698                                 echo "Note that using ~name is ok provided it expands well." >&4
3699                                                 already=true
3700                                                 ;;
3701                                         esac
3702                                 esac
3703                                 ;;
3704                         esac
3705                         ;;
3706                 esac
3707                 case "$redo" in
3708                 '')
3709                         case "$type" in
3710                         File)
3711                                 for fp in $gfpth; do
3712                                         if test "X$fp" = X.; then
3713                                             pf="$ansexp"
3714                                         else    
3715                                             pf="$fp/$ansexp"
3716                                         fi
3717                                         if test -f "$pf"; then
3718                                                 type=''
3719                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3720                                         then
3721                                                 echo "($value is not a plain file, but that's ok.)"
3722                                                 type=''
3723                                         fi
3724                                         if test X"$type" = X; then
3725                                             value="$pf"
3726                                             break
3727                                         fi
3728                                 done
3729                                 ;;
3730                         Directory)
3731                                 for fp in $gfpth; do
3732                                         if test "X$fp" = X.; then
3733                                             dir="$ans"
3734                                             direxp="$ansexp"
3735                                         else    
3736                                             dir="$fp/$ansexp"
3737                                             direxp="$fp/$ansexp"
3738                                         fi
3739                                         if test -d "$direxp"; then
3740                                                 type=''
3741                                                 value="$dir"
3742                                                 break
3743                                         fi
3744                                 done
3745                                 ;;
3746                         Locate)
3747                                 if test -d "$ansexp"; then
3748                                         echo "(Looking for $loc_file in directory $value.)"
3749                                         value="$value/$loc_file"
3750                                         ansexp="$ansexp/$loc_file"
3751                                 fi
3752                                 if test -f "$ansexp"; then
3753                                         type=''
3754                                 fi
3755                                 case "$nopath_ok" in
3756                                 true)   case "$value" in
3757                                         */*) ;;
3758                                         *)      echo "Assuming $value will be in people's path."
3759                                                 type=''
3760                                                 ;;
3761                                         esac
3762                                         ;;
3763                                 esac
3764                                 ;;
3765                         esac
3766
3767                         case "$skip" in
3768                         true) type='';
3769                         esac
3770
3771                         case "$type" in
3772                         '') ;;
3773                         *)
3774                                 if test "$fastread" = yes; then
3775                                         dflt=y
3776                                 else
3777                                         dflt=n
3778                                 fi
3779                                 rp="$what $value doesn't exist.  Use that name anyway?"
3780                                 . UU/myread
3781                                 dflt=''
3782                                 case "$ans" in
3783                                 y*) type='';;
3784                                 *) echo " ";;
3785                                 esac
3786                                 ;;
3787                         esac
3788                         ;;
3789                 esac
3790                 ;;
3791         esac
3792 done
3793 cd UU
3794 ans="$value"
3795 rp="$orig_rp"
3796 dflt="$orig_dflt"
3797 rm -f getfile.ok
3798 test "X$gfpthkeep" != Xy && gfpth=""
3799 EOSC
3800
3801 : determine root of directory hierarchy where package will be installed.
3802 case "$prefix" in
3803 '')
3804         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3805         ;;
3806 *?/)
3807         dflt=`echo "$prefix" | sed 's/.$//'`
3808         ;;
3809 *)
3810         dflt="$prefix"
3811         ;;
3812 esac
3813 $cat <<EOM
3814
3815 By default, $package will be installed in $dflt/bin, manual pages
3816 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3817 installation directories. Typically this is something like /usr/local.
3818 If you wish to have binaries under /usr/bin but other parts of the
3819 installation under /usr/local, that's ok: you will be prompted
3820 separately for each of the installation directories, the prefix being
3821 only used to set the defaults.
3822
3823 EOM
3824 fn=d~
3825 rp='Installation prefix to use?'
3826 . ./getfile
3827 oldprefix=''
3828 case "$prefix" in
3829 '') ;;
3830 *)
3831         case "$ans" in
3832         "$prefix") ;;
3833         *) oldprefix="$prefix";;
3834         esac
3835         ;;
3836 esac
3837 prefix="$ans"
3838 prefixexp="$ansexp"
3839
3840 case "$afsroot" in
3841 '')     afsroot=/afs ;;
3842 *)      afsroot=$afsroot ;;
3843 esac
3844
3845 : is AFS running?
3846 echo " "
3847 case "$afs" in
3848 $define|true)   afs=true ;;
3849 $undef|false)   afs=false ;;
3850 *)      if test -d $afsroot; then
3851                 afs=true
3852         else
3853                 afs=false
3854         fi
3855         ;;
3856 esac
3857 if $afs; then
3858         echo "AFS may be running... I'll be extra cautious then..." >&4
3859 else
3860         echo "AFS does not seem to be running..." >&4
3861 fi
3862
3863 : determine installation prefix for where package is to be installed.
3864 if $afs; then 
3865 $cat <<EOM
3866
3867 Since you are running AFS, I need to distinguish the directory in which
3868 files will reside from the directory in which they are installed (and from
3869 which they are presumably copied to the former directory by occult means).
3870
3871 EOM
3872         case "$installprefix" in
3873         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3874         *) dflt="$installprefix";;
3875         esac
3876 else
3877 $cat <<EOM
3878
3879 In some special cases, particularly when building $package for distribution,
3880 it is convenient to distinguish the directory in which files should be
3881 installed from the directory ($prefix) in which they will
3882 eventually reside.  For most users, these two directories are the same.
3883
3884 EOM
3885         case "$installprefix" in
3886         '') dflt=$prefix ;;
3887         *) dflt=$installprefix;;
3888         esac
3889 fi
3890 fn=d~
3891 rp='What installation prefix should I use for installing files?'
3892 . ./getfile
3893 installprefix="$ans"
3894 installprefixexp="$ansexp"
3895
3896 : Perform the prefixexp/installprefixexp correction if necessary
3897 cat <<EOS >installprefix
3898 $startsh
3899 EOS
3900 cat <<'EOSC' >>installprefix
3901 : Change installation prefix, if necessary.
3902 if $test X"$prefix" != X"$installprefix"; then
3903     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3904 else
3905     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3906 fi
3907 EOSC
3908 chmod +x installprefix
3909 $eunicefix installprefix
3910
3911 : Set variables such as privlib and privlibexp from the output of ./getfile
3912 : performing the prefixexp/installprefixexp correction if necessary.
3913 cat <<EOS >setprefixvar
3914 $startsh
3915 EOS
3916 cat <<'EOSC' >>setprefixvar
3917 eval "${prefixvar}=\"\$ans\""
3918 eval "${prefixvar}exp=\"\$ansexp\""
3919 . ./installprefix
3920 EOSC
3921 chmod +x setprefixvar
3922 $eunicefix setprefixvar
3923
3924 : set up the script used to warn in case of inconsistency
3925 cat <<EOS >whoa
3926 $startsh
3927 EOS
3928 cat <<'EOSC' >>whoa
3929 dflt=y
3930 echo " "
3931 echo "*** WHOA THERE!!! ***" >&4
3932 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3933 rp="    Keep the $hint value?"
3934 . ./myread
3935 case "$ans" in
3936 y) td=$was; tu=$was;;
3937 esac
3938 EOSC
3939
3940 : function used to set $1 to $val
3941 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3942 case "$val$was" in
3943 $define$undef) . ./whoa; eval "$var=\$td";;
3944 $undef$define) . ./whoa; eval "$var=\$tu";;
3945 *) eval "$var=$val";;
3946 esac'
3947
3948 case "$usesocks" in
3949 $define|true|[yY]*)     dflt='y';;
3950 *) dflt='n';;
3951 esac
3952 cat <<EOM
3953
3954 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3955 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3956 to use the PerlIO abstraction layer, this will be implicitly selected.
3957
3958 If this doesn't make any sense to you, just accept the default '$dflt'.
3959 EOM
3960 rp='Build Perl for SOCKS?'
3961 . ./myread
3962 case "$ans" in
3963 y|Y)    val="$define" ;;     
3964 *)      val="$undef" ;;
3965 esac
3966 set usesocks
3967 eval $setvar
3968
3969 case "$usesocks" in
3970 $define|true|[yY]*) useperlio="$define";;
3971 esac
3972
3973 case "$useperlio" in
3974 $define|true|[yY]*|'')  dflt='y';;
3975 *) dflt='n';;
3976 esac
3977 cat <<EOM
3978
3979 Previous version of $package used the standard IO mechanisms as
3980 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3981 alternate IO mechanisms via the PerlIO abstraction layer, but the
3982 stdio mechanism is still available if needed.  The abstraction layer
3983 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3984 Using PerlIO with sfio may cause problems with some extension modules.
3985
3986 If this doesn't make any sense to you, just accept the default '$dflt'.
3987 EOM
3988 rp='Use the PerlIO abstraction layer?'
3989 . ./myread
3990 case "$ans" in
3991 y|Y) 
3992         val="$define"
3993         ;;
3994 *)      
3995         echo "Ok, doing things the stdio way."
3996         val="$undef"
3997         ;;
3998 esac
3999 set useperlio
4000 eval $setvar 
4001
4002 case "$usesocks" in
4003 $define|true|[yY]*)
4004         case "$useperlio" in
4005         $define|true|[yY]*) ;;
4006         *)      cat >&4 <<EOM
4007
4008 You are using the SOCKS proxy protocol library which means that you
4009 should also use the PerlIO layer.  You may be headed for trouble.
4010
4011 EOM
4012                 ;;
4013         esac
4014         ;;
4015 esac
4016
4017         
4018 case "$usethreads" in
4019 $define|true|[yY]*)     dflt='y';;
4020 *)     # Catch case where user specified ithreads or 5005threads but
4021        # forgot -Dusethreads (A.D. 4/2002)
4022        case "$useithreads$use5005threads" in
4023        *$define*)      
4024                 case "$useperlio" in
4025                 "$define")      dflt='y' ;;
4026                 *)              dflt='n' ;;
4027                 esac
4028                 ;;
4029        *)       dflt='n';;
4030        esac
4031        ;;
4032 esac
4033 cat <<EOM
4034
4035 Perl can be built to take advantage of threads on some systems.
4036 To do so, Configure can be run with -Dusethreads.
4037
4038 Note that Perl built with threading support runs slightly slower
4039 and uses more memory than plain Perl. The current implementation
4040 is believed to be stable, but it is fairly new, and so should be
4041 treated with caution.
4042
4043 If this doesn't make any sense to you, just accept the default '$dflt'.
4044 EOM
4045 rp='Build a threading Perl?'
4046 . ./myread
4047 case "$ans" in
4048 y|Y)    val="$define" ;;
4049 *)      val="$undef" ;;
4050 esac
4051 set usethreads
4052 eval $setvar
4053
4054 case "$usethreads" in
4055 $define)
4056         $cat <<EOM
4057
4058 Since release 5.6, Perl has had two different threading implementations,
4059 the newer interpreter-based version (ithreads) with one interpreter per
4060 thread, and the older 5.005 version (5005threads).
4061 The 5005threads version is effectively unmaintained and will probably be
4062 removed in Perl 5.10, so there should be no need to build a Perl using it
4063 unless needed for backwards compatibility with some existing 5.005threads
4064 code.
4065
4066 EOM
4067         : Default to ithreads unless overridden on command line or with
4068         : old config.sh
4069         dflt='y'
4070         case "$use5005threads" in
4071                 $define|true|[yY]*) dflt='n';;
4072         esac
4073         case "$useithreads" in
4074                 $undef|false|[nN]*) dflt='n';;
4075         esac
4076         rp='Use the newer interpreter-based ithreads?'
4077         . ./myread
4078         case "$ans" in
4079         y|Y)    val="$define" ;;
4080         *)      val="$undef" ;;
4081         esac
4082         set useithreads
4083         eval $setvar
4084         : Now set use5005threads to the opposite value.
4085         case "$useithreads" in
4086         $define) val="$undef" ;;
4087         *) val="$define" ;;
4088         esac
4089         set use5005threads
4090         eval $setvar
4091         ;;
4092 *)
4093         useithreads="$undef"
4094         use5005threads="$undef"
4095         ;;
4096 esac
4097
4098 case "$useithreads$use5005threads" in
4099 "$define$define")
4100         $cat >&4 <<EOM
4101
4102 You cannot have both the ithreads and the 5.005 threads enabled
4103 at the same time.  Disabling the 5.005 threads since they are
4104 much less stable than the ithreads.
4105
4106 EOM
4107         use5005threads="$undef"
4108         ;;
4109 esac
4110
4111 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4112         cat >&4 <<EOF
4113 ***
4114 *** To build with ithreads you must also use the PerlIO layer.
4115 *** Cannot continue, aborting.
4116 ***
4117 EOF
4118         exit 1
4119 fi
4120
4121 case "$d_oldpthreads" in
4122 '')     : Configure tests would be welcome here.  For now, assume undef.
4123         val="$undef" ;;
4124 *)      val="$d_oldpthreads" ;;
4125 esac
4126 set d_oldpthreads
4127 eval $setvar
4128
4129
4130 : Look for a hint-file generated 'call-back-unit'.  If the
4131 : user has specified that a threading perl is to be built,
4132 : we may need to set or change some other defaults.
4133 if $test -f usethreads.cbu; then
4134     echo "Your platform has some specific hints regarding threaded builds, using them..."
4135     . ./usethreads.cbu
4136 else
4137     case "$usethreads" in
4138         "$define"|true|[yY]*)
4139                 $cat <<EOM
4140 (Your platform does not have any specific hints for threaded builds.
4141  Assuming POSIX threads, then.)
4142 EOM
4143         ;;
4144     esac
4145 fi
4146
4147 cat <<EOM
4148
4149 Perl can be built so that multiple Perl interpreters can coexist
4150 within the same Perl executable.
4151 EOM
4152
4153 case "$useithreads" in
4154 $define)
4155         cat <<EOM
4156 This multiple interpreter support is required for interpreter-based threads.
4157 EOM
4158         val="$define"
4159         ;;
4160 *)      case "$usemultiplicity" in
4161         $define|true|[yY]*)     dflt='y';;
4162         *) dflt='n';;
4163         esac
4164         echo " "
4165         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4166         rp='Build Perl for multiplicity?'
4167         . ./myread
4168         case "$ans" in
4169         y|Y)    val="$define" ;;
4170         *)      val="$undef" ;;
4171         esac
4172         ;;
4173 esac
4174 set usemultiplicity
4175 eval $setvar
4176
4177
4178 case "$usemorebits" in
4179 "$define"|true|[yY]*)
4180         use64bitint="$define"
4181         uselongdouble="$define"
4182         usemorebits="$define"
4183         ;;
4184 *)      usemorebits="$undef"
4185         ;;
4186 esac
4187
4188 : make some quick guesses about what we are up against
4189 echo " "
4190 $echo $n "Hmm...  $c"
4191 echo exit 1 >bsd
4192 echo exit 1 >usg
4193 echo exit 1 >v7
4194 echo exit 1 >osf1
4195 echo exit 1 >eunice
4196 echo exit 1 >xenix
4197 echo exit 1 >venix
4198 echo exit 1 >os2
4199 d_bsd="$undef"
4200 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4201 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4202 then
4203         echo "Looks kind of like an OSF/1 system, but we'll see..."
4204         echo exit 0 >osf1
4205 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4206         xxx=`./loc addbib blurfl $pth`
4207         if $test -f $xxx; then
4208         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4209                 echo exit 0 >bsd
4210                 echo exit 0 >usg
4211         else
4212                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4213                         echo "Looks kind of like an extended USG system, but we'll see..."
4214                 else
4215                         echo "Looks kind of like a USG system, but we'll see..."
4216                 fi
4217                 echo exit 0 >usg
4218         fi
4219 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4220         echo "Looks kind of like a BSD system, but we'll see..."
4221         d_bsd="$define"
4222         echo exit 0 >bsd
4223 else
4224         echo "Looks kind of like a Version 7 system, but we'll see..."
4225         echo exit 0 >v7
4226 fi
4227 case "$eunicefix" in
4228 *unixtovms*)
4229         $cat <<'EOI'
4230 There is, however, a strange, musty smell in the air that reminds me of
4231 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4232 EOI
4233         echo exit 0 >eunice
4234         d_eunice="$define"
4235 : it so happens the Eunice I know will not run shell scripts in Unix format
4236         ;;
4237 *)
4238         echo " "
4239         echo "Congratulations.  You aren't running Eunice."
4240         d_eunice="$undef"
4241         ;;
4242 esac
4243 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4244 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4245 : semicolon as a patch separator
4246 case "$p_" in
4247 :) ;;
4248 *)
4249         $cat <<'EOI'
4250 I have the feeling something is not exactly right, however...don't tell me...
4251 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4252 (Or you may be running DOS with DJGPP.)
4253 EOI
4254         echo exit 0 >os2
4255         ;;
4256 esac
4257 if test -f /xenix; then
4258         echo "Actually, this looks more like a XENIX system..."
4259         echo exit 0 >xenix
4260         d_xenix="$define"
4261 else
4262         echo " "
4263         echo "It's not Xenix..."
4264         d_xenix="$undef"
4265 fi
4266 chmod +x xenix
4267 $eunicefix xenix
4268 if test -f /venix; then
4269         echo "Actually, this looks more like a VENIX system..."
4270         echo exit 0 >venix
4271 else
4272         echo " "
4273         if ./xenix; then
4274                 : null
4275         else
4276                 echo "Nor is it Venix..."
4277         fi
4278 fi
4279 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4280 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4281 $rm -f foo
4282
4283 case "$cc" in
4284 '') dflt=cc;;
4285 *) dflt="$cc";;
4286 esac
4287 rp="Use which C compiler?"
4288 . ./myread
4289 cc="$ans"
4290
4291 : See if they have not cc but they do have gcc
4292 . ./trygcc
4293 : Look for a hint-file generated 'call-back-unit'.  Now that the
4294 : user has specified the compiler, we may need to set or change some
4295 : other defaults.
4296 if $test -f cc.cbu; then
4297     . ./cc.cbu
4298 fi
4299 . ./checkcc
4300
4301 echo " "
4302 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4303 $cat >try.c <<EOM
4304 #include <stdio.h>
4305 int main() {
4306 #ifdef __GNUC__
4307 #ifdef __VERSION__
4308         printf("%s\n", __VERSION__);
4309 #else
4310         printf("%s\n", "1");
4311 #endif
4312 #endif
4313         return(0);
4314 }
4315 EOM
4316 if $cc -o try $ccflags $ldflags try.c; then
4317         gccversion=`$run ./try`
4318         case "$gccversion" in
4319         '') echo "You are not using GNU cc." ;;
4320         *)  echo "You are using GNU cc $gccversion."
4321             ccname=gcc
4322             ;;
4323         esac
4324 else
4325         echo " "
4326         echo "*** WHOA THERE!!! ***" >&4
4327         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4328         case "$knowitall" in
4329         '')
4330         echo "    You'd better start hunting for one and let me know about it." >&4
4331                 exit 1
4332                 ;;
4333         esac
4334 fi
4335 $rm -f try try.*
4336 case "$gccversion" in
4337 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4338 esac
4339 case "$gccversion" in
4340 '') gccosandvers='' ;;
4341 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4342    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4343    gccshortvers=''
4344    case "$gccosandvers" in
4345    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4346    $osname$osvers) ;; # looking good
4347    $osname*) cat <<EOM >&4
4348
4349 *** WHOA THERE!!! ***
4350
4351     Your gcc has not been compiled for the exact release of
4352     your operating system ($gccosandvers versus $osname$osvers).
4353
4354     In general it is a good idea to keep gcc synchronized with
4355     the operating system because otherwise serious problems
4356     may ensue when trying to compile software, like Perl.
4357
4358     I'm trying to be optimistic here, though, and will continue.
4359     If later during the configuration and build icky compilation
4360     problems appear (headerfile conflicts being the most common
4361     manifestation), I suggest reinstalling the gcc to match
4362     your operating system release.
4363
4364 EOM
4365       ;;
4366    *) gccosandvers='' ;; # failed to parse, better be silent
4367    esac
4368    ;;
4369 esac
4370 case "$ccname" in
4371 '') ccname="$cc" ;;
4372 esac
4373
4374 # gcc 3.* complain about adding -Idirectories that they already know about,
4375 # so we will take those off from locincpth.
4376 case "$gccversion" in
4377 3*)
4378     echo "main(){}">try.c
4379     for incdir in $locincpth; do
4380        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4381              grep '^c[cp]p*[01]: warning: changing search order '`
4382        if test "X$warn" != X; then
4383            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4384        fi
4385     done
4386     $rm -f try try.*
4387 esac
4388
4389 : What should the include directory be ?
4390 echo " "
4391 $echo $n "Hmm...  $c"
4392 dflt='/usr/include'
4393 incpath=''
4394 mips_type=''
4395 if $test -f /bin/mips && /bin/mips; then
4396         echo "Looks like a MIPS system..."
4397         $cat >usr.c <<'EOCP'
4398 #ifdef SYSTYPE_BSD43
4399 /bsd43
4400 #endif
4401 EOCP
4402         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4403                 dflt='/bsd43/usr/include'
4404                 incpath='/bsd43'
4405                 mips_type='BSD 4.3'
4406         else
4407                 mips_type='System V'
4408         fi
4409         $rm -f usr.c usr.out
4410         echo "and you're compiling with the $mips_type compiler and libraries."
4411         xxx_prompt=y
4412         echo "exit 0" >mips
4413 else
4414         echo "Doesn't look like a MIPS system."
4415         xxx_prompt=n
4416         echo "exit 1" >mips
4417 fi
4418 chmod +x mips
4419 $eunicefix mips
4420 case "$usrinc" in
4421 '') ;;
4422 *) dflt="$usrinc";;
4423 esac
4424 case "$xxx_prompt" in
4425 y)      fn=d/
4426         echo " "
4427         rp='Where are the include files you want to use?'
4428         . ./getfile
4429         usrinc="$ans"
4430         ;;
4431 *)      usrinc="$dflt"
4432         ;;
4433 esac
4434
4435 : see how we invoke the C preprocessor
4436 echo " "
4437 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4438 cat <<'EOT' >testcpp.c
4439 #define ABC abc
4440 #define XYZ xyz
4441 ABC.XYZ
4442 EOT
4443 cd ..
4444 if test ! -f cppstdin; then
4445         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4446                 # AIX cc -E doesn't show the absolute headerfile
4447                 # locations but we'll cheat by using the -M flag.
4448                 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
4449         else
4450                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4451         fi
4452 else
4453         echo "Keeping your $hint cppstdin wrapper."
4454 fi
4455 chmod 755 cppstdin
4456 wrapper=`pwd`/cppstdin
4457 ok='false'
4458 cd UU
4459
4460 if $test "X$cppstdin" != "X" && \
4461         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4462         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4463 then
4464         echo "You used to use $cppstdin $cppminus so we'll use that again."
4465         case "$cpprun" in
4466         '') echo "But let's see if we can live without a wrapper..." ;;
4467         *)
4468                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4469                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4470                 then
4471                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4472                         ok='true'
4473                 else
4474                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4475                 fi
4476                 ;;
4477         esac
4478 else
4479         case "$cppstdin" in
4480         '') ;;
4481         *)
4482                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4483                 ;;
4484         esac
4485 fi
4486
4487 if $ok; then
4488         : nothing
4489 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4490         $cc -E <testcpp.c >testcpp.out 2>&1; \
4491         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4492         echo "Yup, it does."
4493         x_cpp="$cc -E"
4494         x_minus='';
4495 elif echo 'Nope...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"' -P" will work...'; \
4502         $cc -P <testcpp.c >testcpp.out 2>&1; \
4503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4504         echo "Yipee, that works!"
4505         x_cpp="$cc -P"
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 "At long last!"
4511         x_cpp="$cc -P"
4512         x_minus='-';
4513 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4514         $cpp <testcpp.c >testcpp.out 2>&1; \
4515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4516         echo "It works!"
4517         x_cpp="$cpp"
4518         x_minus='';
4519 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4523         x_cpp="$cpp"
4524         x_minus='-';
4525 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4526         $wrapper <testcpp.c >testcpp.out 2>&1; \
4527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4528         x_cpp="$wrapper"
4529         x_minus=''
4530         echo "Eureka!"
4531 else
4532         dflt=''
4533         rp="No dice.  I can't find a C preprocessor.  Name one:"
4534         . ./myread
4535         x_cpp="$ans"
4536         x_minus=''
4537         $x_cpp <testcpp.c >testcpp.out 2>&1
4538         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4539                 echo "OK, that will do." >&4
4540         else
4541 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4542                 exit 1
4543         fi
4544 fi
4545
4546 case "$ok" in
4547 false)
4548         cppstdin="$x_cpp"
4549         cppminus="$x_minus"
4550         cpprun="$x_cpp"
4551         cpplast="$x_minus"
4552         set X $x_cpp
4553         shift
4554         case "$1" in
4555         "$cpp")
4556                 echo "Perhaps can we force $cc -E using a wrapper..."
4557                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4558                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4559                 then
4560                         echo "Yup, we can."
4561                         cppstdin="$wrapper"
4562                         cppminus='';
4563                 else
4564                         echo "Nope, we'll have to live without it..."
4565                 fi
4566                 ;;
4567         esac
4568         case "$cpprun" in
4569         "$wrapper")
4570                 cpprun=''
4571                 cpplast=''
4572                 ;;
4573         esac
4574         ;;
4575 esac
4576
4577 case "$cppstdin" in
4578 "$wrapper"|'cppstdin') ;;
4579 *) $rm -f $wrapper;;
4580 esac
4581 $rm -f testcpp.c testcpp.out
4582
4583 : Set private lib path
4584 case "$plibpth" in
4585 '') if ./mips; then
4586                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4587         fi;;
4588 esac
4589 case "$libpth" in
4590 ' ') dlist='';;
4591 '') dlist="$loclibpth $plibpth $glibpth";;
4592 *) dlist="$libpth";;
4593 esac
4594
4595 : Now check and see which directories actually exist, avoiding duplicates
4596 libpth=''
4597 for xxx in $dlist
4598 do
4599     if $test -d $xxx; then
4600                 case " $libpth " in
4601                 *" $xxx "*) ;;
4602                 *) libpth="$libpth $xxx";;
4603                 esac
4604     fi
4605 done
4606 $cat <<'EOM'
4607
4608 Some systems have incompatible or broken versions of libraries.  Among
4609 the directories listed in the question below, please remove any you
4610 know not to be holding relevant libraries, and add any that are needed.
4611 Say "none" for none.
4612
4613 EOM
4614 case "$libpth" in
4615 '') dflt='none';;
4616 *)
4617         set X $libpth
4618         shift
4619         dflt=${1+"$@"}
4620         ;;
4621 esac
4622 rp="Directories to use for library searches?"
4623 . ./myread
4624 case "$ans" in
4625 none) libpth=' ';;
4626 *) libpth="$ans";;
4627 esac
4628
4629 : compute shared library extension
4630 case "$so" in
4631 '')
4632         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4633                 dflt='sl'
4634         else
4635                 dflt='so'
4636         fi
4637         ;;
4638 *) dflt="$so";;
4639 esac
4640 $cat <<EOM
4641
4642 On some systems, shared libraries may be available.  Answer 'none' if
4643 you want to suppress searching of shared libraries for the remainder
4644 of this configuration.
4645
4646 EOM
4647 rp='What is the file extension used for shared libraries?'
4648 . ./myread
4649 so="$ans"
4650
4651 : Define several unixisms.
4652 : Hints files or command line option can be used to override them.
4653 : The convoluted testing is in case hints files set either the old
4654 : or the new name.
4655 case "$_exe" in
4656 '')     case "$exe_ext" in
4657         '')     ;;
4658         *)      _exe="$exe_ext" ;;
4659         esac
4660         ;;
4661 esac
4662 case "$_a" in
4663 '')     case "$lib_ext" in
4664     '') _a='.a';;
4665         *)      _a="$lib_ext" ;;
4666         esac
4667         ;;
4668 esac
4669 case "$_o" in
4670 '') case "$obj_ext" in
4671         '')     _o='.o';;
4672         *)      _o="$obj_ext";;
4673         esac
4674         ;;
4675 esac
4676 case "$p_" in
4677 '') case "$path_sep" in
4678         '')     p_=':';;
4679         *)      p_="$path_sep";;
4680         esac
4681         ;;
4682 esac
4683 exe_ext=$_exe
4684 lib_ext=$_a
4685 obj_ext=$_o
4686 path_sep=$p_
4687
4688 : Which makefile gets called first.  This is used by make depend.
4689 case "$firstmakefile" in
4690 '') firstmakefile='makefile';;
4691 esac
4692
4693 case "$ccflags" in
4694 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4695 esac
4696
4697 case "$uselongdouble" in
4698 $define|true|[yY]*)     dflt='y';;
4699 *) dflt='n';;
4700 esac
4701 cat <<EOM
4702
4703 Perl can be built to take advantage of long doubles which
4704 (if available) may give more accuracy and range for floating point numbers.
4705
4706 If this doesn't make any sense to you, just accept the default '$dflt'.
4707 EOM
4708 rp='Try to use long doubles if available?'
4709 . ./myread
4710 case "$ans" in
4711 y|Y)    val="$define"   ;;
4712 *)      val="$undef"    ;;
4713 esac
4714 set uselongdouble
4715 eval $setvar
4716
4717 case "$uselongdouble" in
4718 true|[yY]*) uselongdouble="$define" ;;
4719 esac
4720
4721 : Look for a hint-file generated 'call-back-unit'.  If the
4722 : user has specified that long doubles should be used,
4723 : we may need to set or change some other defaults.
4724 if $test -f uselongdouble.cbu; then
4725     echo "Your platform has some specific hints regarding long doubles, using them..."
4726     . ./uselongdouble.cbu
4727 else
4728     case "$uselongdouble" in
4729         $define)
4730                 $cat <<EOM
4731 (Your platform does not have any specific hints for long doubles.)
4732 EOM
4733         ;;
4734     esac
4735 fi
4736
4737 : Looking for optional libraries
4738 echo " "
4739 echo "Checking for optional libraries..." >&4
4740 case "$libs" in
4741 ' '|'') dflt='';;
4742 *) dflt="$libs";;
4743 esac
4744 case "$libswanted" in
4745 '') libswanted='c_s';;
4746 esac
4747 case "$usesocks" in
4748 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4749 esac
4750 libsfound=''
4751 libsfiles=''
4752 libsdirs=''
4753 libspath=''
4754 for thisdir in $libpth $xlibpth; do
4755   test -d $thisdir && libspath="$libspath $thisdir"
4756 done
4757 for thislib in $libswanted; do
4758         for thisdir in $libspath; do
4759             xxx=''
4760             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4761                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4762                 $test -f "$xxx" && eval $libscheck
4763                 $test -f "$xxx" && libstyle=shared
4764             fi
4765             if test ! -f "$xxx"; then
4766                 xxx=$thisdir/lib$thislib.$so
4767                 $test -f "$xxx" && eval $libscheck
4768                 $test -f "$xxx" && libstyle=shared
4769             fi  
4770             if test ! -f "$xxx"; then
4771                 xxx=$thisdir/lib$thislib$_a
4772                 $test -f "$xxx" && eval $libscheck
4773                 $test -f "$xxx" && libstyle=static
4774             fi
4775             if test ! -f "$xxx"; then
4776                 xxx=$thisdir/$thislib$_a
4777                 $test -f "$xxx" && eval $libscheck
4778                 $test -f "$xxx" && libstyle=static
4779             fi
4780             if test ! -f "$xxx"; then
4781                 xxx=$thisdir/lib${thislib}_s$_a
4782                 $test -f "$xxx" && eval $libscheck
4783                 $test -f "$xxx" && libstyle=static
4784                 $test -f "$xxx" && thislib=${thislib}_s
4785             fi
4786             if test ! -f "$xxx"; then
4787                 xxx=$thisdir/Slib$thislib$_a
4788                 $test -f "$xxx" && eval $libscheck
4789                 $test -f "$xxx" && libstyle=static
4790             fi
4791             if $test -f "$xxx"; then
4792                 case "$libstyle" in
4793                 shared) echo "Found -l$thislib (shared)." ;;
4794                 static) echo "Found -l$thislib." ;;
4795                 *)      echo "Found -l$thislib ($libstyle)." ;;
4796                 esac
4797                 case " $dflt " in
4798                 *"-l$thislib "*);;
4799                 *) dflt="$dflt -l$thislib"
4800                    libsfound="$libsfound $xxx"
4801                    yyy=`basename $xxx`
4802                    libsfiles="$libsfiles $yyy"
4803                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4804                    case " $libsdirs " in
4805                    *" $yyy "*) ;;
4806                    *) libsdirs="$libsdirs $yyy" ;;
4807                    esac
4808                    ;;
4809                 esac
4810                 break
4811             fi  
4812         done
4813         if $test ! -f "$xxx"; then
4814             echo "No -l$thislib."
4815         fi
4816 done
4817 set X $dflt
4818 shift
4819 dflt="$*"
4820 case "$libs" in
4821 '') dflt="$dflt";;
4822 *) dflt="$libs";;
4823 esac
4824 case "$dflt" in
4825 ' '|'') dflt='none';;
4826 esac
4827
4828 $cat <<EOM
4829
4830 In order to compile $package on your machine, a number of libraries
4831 are usually needed.  Include any other special libraries here as well.
4832 Say "none" for none.  The default list is almost always right.
4833 EOM
4834
4835 echo " "
4836 rp="What libraries to use?"
4837 . ./myread
4838 case "$ans" in
4839 none) libs=' ';;
4840 *) libs="$ans";;
4841 esac
4842
4843 : determine optimization, if desired, or use for debug flag also
4844 case "$optimize" in
4845 ' '|$undef) dflt='none';;
4846 '') dflt='-O';;
4847 *) dflt="$optimize";;
4848 esac
4849 $cat <<EOH
4850
4851 By default, $package compiles with the -O flag to use the optimizer.
4852 Alternately, you might want to use the symbolic debugger, which uses
4853 the -g flag (on traditional Unix systems).  Either flag can be
4854 specified here.  To use neither flag, specify the word "none".
4855
4856 EOH
4857 rp="What optimizer/debugger flag should be used?"
4858 . ./myread
4859 optimize="$ans"
4860 case "$optimize" in
4861 'none') optimize=" ";;
4862 esac
4863
4864 : Check what DEBUGGING is required from the command line
4865 : -DEBUGGING      or -DDEBUGGING or
4866 : -DEBUGGING=both                       = -g + -DDEBUGGING
4867 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4868 : -DEBUGGING=none or -UDEBUGGING        =
4869 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4870 case "$EBUGGING" in
4871 '')     ;;
4872 *)      DEBUGGING=$EBUGGING ;;
4873 esac
4874
4875 case "$DEBUGGING" in
4876 -g|$define)
4877     case "$optimize" in
4878         *-g*) ;;
4879         *)    optimize="$optimize -g" ;;
4880     esac ;;
4881 none|$undef)
4882     case "$optimize" in
4883         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4884                 shift
4885                 optimize="$*"
4886                 ;;
4887     esac ;;
4888 esac
4889
4890 dflt=''
4891 case "$DEBUGGING" in
4892 both|$define) dflt='-DDEBUGGING'
4893 esac
4894
4895 : We will not override a previous value, but we might want to
4896 : augment a hint file
4897 case "$hint" in
4898 default|recommended)
4899         case "$gccversion" in
4900         1*) dflt="$dflt -fpcc-struct-return" ;;
4901         esac
4902         case "$optimize:$DEBUGGING" in
4903         *-g*:old) dflt="$dflt -DDEBUGGING";;
4904         esac
4905         case "$gccversion" in
4906         2*) if test -d /etc/conf/kconfig.d &&
4907                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4908                 then
4909                         # Interactive Systems (ISC) POSIX mode.
4910                         dflt="$dflt -posix"
4911                 fi
4912                 ;;
4913         esac
4914         case "$gccversion" in
4915         1*) ;;
4916         2.[0-8]*) ;;
4917         ?*)     echo " "
4918                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4919                 echo 'int main(void) { return 0; }' > gcctest.c
4920                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4921                         echo "Yes, it does." 2>&1
4922                         case "$ccflags" in
4923                         *strict-aliasing*)
4924                                 echo "Leaving current flags $ccflags alone." 2>&1
4925                                 ;;
4926                         *) dflt="$dflt -fno-strict-aliasing" ;;
4927                         esac
4928                 else
4929                         echo "Nope, it doesn't, but that's ok." 2>&1
4930                 fi
4931                 ;;
4932         esac
4933         # For gcc, adding -pipe speeds up compilations for some, but apparently
4934         # some assemblers can't read from stdin.  (It also slows down compilations
4935         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4936         case "$gccversion" in
4937         ?*)     echo " "
4938                 echo "Checking if your compiler accepts -pipe" 2>&1
4939                 echo 'int main(void) { return 0; }' > gcctest.c
4940                 if $cc -pipe -o gcctest gcctest.c; then
4941                         echo "Yes, it does." 2>&1
4942                         case "$ccflags" in
4943                         *-pipe*)
4944                                 echo "Leaving current flags $ccflags alone." 2>&1
4945                                 ;;
4946                         *) dflt="$dflt -pipe" ;;
4947                         esac
4948                 else
4949                         echo "Nope, it doesn't, but that's ok." 2>&1
4950                 fi
4951
4952                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4953                 echo 'int main(void) { return 0; }' > gcctest.c
4954                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4955                         echo "Yes, it does." 2>&1
4956                         case "$ccflags" in
4957                         *-Wdeclaration-after-statement*)
4958                                 echo "Leaving current flags $ccflags alone." 2>&1
4959                                 ;;
4960                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4961                         esac
4962                 else
4963                         echo "Nope, it doesn't, but that's ok." 2>&1
4964                 fi
4965                 ;;
4966         esac
4967         ;;
4968 esac
4969
4970 case "$mips_type" in
4971 *BSD*|'') inclwanted="$locincpth $usrinc";;
4972 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4973 esac
4974 for thisincl in $inclwanted; do
4975         if $test -d $thisincl; then
4976                 if $test x$thisincl != x$usrinc; then
4977                         case "$dflt" in
4978                         *" -I$thisincl "*);;
4979                         *) dflt="$dflt -I$thisincl ";;
4980                         esac
4981                 fi
4982         fi
4983 done
4984
4985 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4986         xxx=true;
4987 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4988         xxx=true;
4989 else
4990         xxx=false;
4991 fi;
4992 if $xxx; then
4993         case "$dflt" in
4994         *$2*);;
4995         *) dflt="$dflt -D$2";;
4996         esac;
4997 fi'
4998
4999 set signal.h LANGUAGE_C; eval $inctest
5000
5001 case "$usesocks" in
5002 $define)
5003         ccflags="$ccflags -DSOCKS"
5004         ;;
5005 esac
5006
5007 case "$hint" in
5008 default|recommended) dflt="$ccflags $dflt" ;;
5009 *) dflt="$ccflags";;
5010 esac
5011
5012 case "$dflt" in
5013 ''|' ') dflt=none;;
5014 esac
5015
5016 $cat <<EOH
5017
5018 Your C compiler may want other flags.  For this question you should include
5019 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5020 but you should NOT include libraries or ld flags like -lwhatever.  If you
5021 want $package to honor its debug switch, you should include -DDEBUGGING here.
5022 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5023
5024 To use no flags, specify the word "none".
5025
5026 EOH
5027 set X $dflt
5028 shift
5029 dflt=${1+"$@"}
5030 rp="Any additional cc flags?"
5031 . ./myread
5032 case "$ans" in
5033 none) ccflags='';;
5034 *) ccflags="$ans";;
5035 esac
5036
5037 : the following weeds options from ccflags that are of no interest to cpp
5038 case "$cppflags" in
5039 '') cppflags="$ccflags" ;;
5040 *)  cppflags="$cppflags $ccflags" ;;
5041 esac
5042 case "$gccversion" in
5043 1*) cppflags="$cppflags -D__GNUC__"
5044 esac
5045 case "$mips_type" in
5046 '');;
5047 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5048 esac
5049 case "$cppflags" in
5050 '');;
5051 *)
5052         echo " "
5053         echo "Let me guess what the preprocessor flags are..." >&4
5054         set X $cppflags
5055         shift
5056         cppflags=''
5057         $cat >cpp.c <<'EOM'
5058 #define BLURFL foo
5059
5060 BLURFL xx LFRULB
5061 EOM
5062         previous=''
5063         for flag in $*
5064         do
5065                 case "$flag" in
5066                 -*) ftry="$flag";;
5067                 *) ftry="$previous $flag";;
5068                 esac
5069                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5070                         >cpp1.out 2>/dev/null && \
5071                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5072                         >cpp2.out 2>/dev/null && \
5073                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5074                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5075                 then
5076                         cppflags="$cppflags $ftry"
5077                         previous=''
5078                 else
5079                         previous="$flag"
5080                 fi
5081         done
5082         set X $cppflags
5083         shift
5084         cppflags=${1+"$@"}
5085         case "$cppflags" in
5086         *-*)  echo "They appear to be: $cppflags";;
5087         esac
5088         $rm -f cpp.c cpp?.out
5089         ;;
5090 esac
5091
5092 : flags used in final linking phase
5093 case "$ldflags" in
5094 '') if ./venix; then
5095                 dflt='-i -z'
5096         else
5097                 dflt=''
5098         fi
5099         case "$ccflags" in
5100         *-posix*) dflt="$dflt -posix" ;;
5101         esac
5102         ;;
5103 *) dflt="$ldflags";;
5104 esac
5105
5106 : Try to guess additional flags to pick up local libraries.
5107 for thislibdir in $libpth; do
5108         case " $loclibpth " in
5109         *" $thislibdir "*)
5110                 case "$dflt " in
5111                 *"-L$thislibdir "*) ;;
5112                 *)  dflt="$dflt -L$thislibdir" ;;
5113                 esac
5114                 ;;
5115         esac
5116 done
5117
5118 case "$dflt" in
5119 '') dflt='none' ;;
5120 esac
5121
5122 $cat <<EOH
5123
5124 Your C linker may need flags.  For this question you should
5125 include -L/whatever and any other flags used by the C linker, but you
5126 should NOT include libraries like -lwhatever.
5127
5128 Make sure you include the appropriate -L/path flags if your C linker
5129 does not normally search all of the directories you specified above,
5130 namely
5131         $libpth
5132 To use no flags, specify the word "none".
5133
5134 EOH
5135
5136 rp="Any additional ld flags (NOT including libraries)?"
5137 . ./myread
5138 case "$ans" in
5139 none) ldflags='';;
5140 *) ldflags="$ans";;
5141 esac
5142 rmlist="$rmlist pdp11"
5143
5144 : coherency check
5145 echo " "
5146 echo "Checking your choice of C compiler and flags for coherency..." >&4
5147 $cat > try.c <<'EOF'
5148 #include <stdio.h>
5149 int main() { printf("Ok\n"); return(0); }
5150 EOF
5151 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5152 shift
5153 $cat >try.msg <<'EOM'
5154 I've tried to compile and run the following simple program:
5155
5156 EOM
5157 $cat try.c >> try.msg
5158
5159 $cat >> try.msg <<EOM
5160
5161 I used the command:
5162
5163         $*
5164         $run ./try
5165
5166 and I got the following output:
5167
5168 EOM
5169 dflt=y
5170 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5171         if $sh -c "$run ./try" >>try.msg 2>&1; then
5172                 xxx=`$run ./try`
5173                 case "$xxx" in
5174                 "Ok") dflt=n ;;
5175                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5176                         case " $libs " in
5177                         *" -lsfio "*)
5178                                 cat >> try.msg <<'EOQS'
5179 If $libs contains -lsfio, and sfio is mis-configured, then it
5180 sometimes (apparently) runs and exits with a 0 status, but with no
5181 output!  It may have to do with sfio's use of _exit vs. exit.
5182
5183 EOQS
5184                                 rp="You have a big problem.  Shall I abort Configure"
5185                                 dflt=y
5186                                 ;;
5187                         esac
5188                         ;;
5189                 esac
5190         else
5191                 echo "The program compiled OK, but exited with status $?." >>try.msg
5192                 rp="You have a problem.  Shall I abort Configure"
5193                 dflt=y
5194         fi
5195 else
5196         echo "I can't compile the test program." >>try.msg
5197         rp="You have a BIG problem.  Shall I abort Configure"
5198         dflt=y
5199 fi
5200 case "$dflt" in
5201 y)
5202         $cat try.msg >&4
5203         case "$knowitall" in
5204         '')
5205                 echo "(The supplied flags or libraries might be incorrect.)"
5206                 ;;
5207         *) dflt=n;;
5208         esac
5209         echo " "
5210         . ./myread
5211         case "$ans" in
5212         n*|N*) ;;
5213         *)      echo "Ok.  Stopping Configure." >&4
5214                 exit 1
5215                 ;;
5216         esac
5217         ;;
5218 n) echo "OK, that should do.";;
5219 esac
5220 $rm -f try try.* core
5221
5222 : define a shorthand compile call
5223 compile='
5224 mc_file=$1;
5225 shift;
5226 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5227 : define a shorthand compile call for compilations that should be ok.
5228 compile_ok='
5229 mc_file=$1;
5230 shift;
5231 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5232
5233 : determine filename position in cpp output
5234 echo " "
5235 echo "Computing filename position in cpp output for #include directives..." >&4
5236 case "$osname" in
5237 vos) testaccess=-e ;;
5238 *)   testaccess=-r ;;
5239 esac
5240 echo '#include <stdio.h>' > foo.c
5241 $cat >fieldn <<EOF
5242 $startsh
5243 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5244 $grep '^[       ]*#.*stdio\.h' | \
5245 while read cline; do
5246         pos=1
5247         set \$cline
5248         while $test \$# -gt 0; do
5249                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5250                         echo "\$pos"
5251                         exit 0
5252                 fi
5253                 shift
5254                 pos=\`expr \$pos + 1\`
5255         done
5256 done
5257 EOF
5258 chmod +x fieldn
5259 fieldn=`./fieldn`
5260 $rm -f foo.c fieldn
5261 case $fieldn in
5262 '') pos='???';;
5263 1) pos=first;;
5264 2) pos=second;;
5265 3) pos=third;;
5266 *) pos="${fieldn}th";;
5267 esac
5268 echo "Your cpp writes the filename in the $pos field of the line."
5269
5270 case "$osname" in
5271 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5272 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5273 *)   cppfilter='' ;;
5274 esac
5275 : locate header file
5276 $cat >findhdr <<EOF
5277 $startsh
5278 wanted=\$1
5279 name=''
5280 for usrincdir in $usrinc
5281 do
5282         if test -f \$usrincdir/\$wanted; then
5283                 echo "\$usrincdir/\$wanted"
5284                 exit 0
5285         fi
5286 done
5287 awkprg='{ print \$$fieldn }'
5288 echo "#include <\$wanted>" > foo\$\$.c
5289 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5290 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5291 while read cline; do
5292         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5293         case "\$name" in
5294         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5295         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5296         *) exit 2;;
5297         esac;
5298 done;
5299 #
5300 # status = 0: grep returned 0 lines, case statement not executed
5301 # status = 1: headerfile found
5302 # status = 2: while loop executed, no headerfile found
5303 #
5304 status=\$?
5305 $rm -f foo\$\$.c;
5306 if test \$status -eq 1; then
5307         exit 0;
5308 fi
5309 exit 1
5310 EOF
5311 chmod +x findhdr
5312
5313 : define an alternate in-header-list? function
5314 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5315 cont=true; xxf="echo \"<\$1> found.\" >&4";
5316 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5317 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5318 esac;
5319 case $# in 4) instead=instead;; *) instead="at last";; esac;
5320 while $test "$cont"; do
5321         xxx=`./findhdr $1`
5322         var=$2; eval "was=\$$2";
5323         if $test "$xxx" && $test -r "$xxx";
5324         then eval $xxf;
5325         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5326                 cont="";
5327         else eval $xxnf;
5328         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5329         set $yyy; shift; shift; yyy=$@;
5330         case $# in 0) cont="";;
5331         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5332                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5333         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5334                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5335         esac;
5336 done;
5337 while $test "$yyy";
5338 do set $yyy; var=$2; eval "was=\$$2";
5339         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5340         set $yyy; shift; shift; yyy=$@;
5341 done'
5342
5343 : see if stdlib is available
5344 set stdlib.h i_stdlib
5345 eval $inhdr
5346
5347 : check for lengths of integral types
5348 echo " "
5349 case "$intsize" in
5350 '')
5351         echo "Checking to see how big your integers are..." >&4
5352         $cat >try.c <<EOCP
5353 #include <stdio.h>
5354 #$i_stdlib I_STDLIB
5355 #ifdef I_STDLIB
5356 #include <stdlib.h>
5357 #endif
5358 int main()
5359 {
5360         printf("intsize=%d;\n", (int)sizeof(int));
5361         printf("longsize=%d;\n", (int)sizeof(long));
5362         printf("shortsize=%d;\n", (int)sizeof(short));
5363         exit(0);
5364 }
5365 EOCP
5366         set try
5367         if eval $compile_ok && $run ./try > /dev/null; then
5368                 eval `$run ./try`
5369                 echo "Your integers are $intsize bytes long."
5370                 echo "Your long integers are $longsize bytes long."
5371                 echo "Your short integers are $shortsize bytes long."
5372         else
5373                 $cat >&4 <<EOM
5374 !
5375 Help! I can't compile and run the intsize test program: please enlighten me!
5376 (This is probably a misconfiguration in your system or libraries, and
5377 you really ought to fix it.  Still, I'll try anyway.)
5378 !
5379 EOM
5380                 dflt=4
5381                 rp="What is the size of an integer (in bytes)?"
5382                 . ./myread
5383                 intsize="$ans"
5384                 dflt=$intsize
5385                 rp="What is the size of a long integer (in bytes)?"
5386                 . ./myread
5387                 longsize="$ans"
5388                 dflt=2
5389                 rp="What is the size of a short integer (in bytes)?"
5390                 . ./myread
5391                 shortsize="$ans"
5392         fi
5393         ;;
5394 esac
5395 $rm -f try try.*
5396
5397 : check for long long
5398 echo " "
5399 echo "Checking to see if you have long long..." >&4
5400 echo 'int main() { long long x = 7; return 0; }' > try.c
5401 set try
5402 if eval $compile; then
5403         val="$define"
5404         echo "You have long long."
5405 else
5406         val="$undef"
5407         echo "You do not have long long."
5408 fi
5409 $rm try.*
5410 set d_longlong
5411 eval $setvar
5412
5413 : check for length of long long
5414 case "${d_longlong}${longlongsize}" in
5415 $define)
5416         echo " "
5417         echo "Checking to see how big your long longs are..." >&4
5418         $cat >try.c <<'EOCP'
5419 #include <stdio.h>
5420 int main()
5421 {
5422     printf("%d\n", (int)sizeof(long long));
5423     return(0);
5424 }
5425 EOCP
5426         set try
5427         if eval $compile_ok; then
5428                 longlongsize=`$run ./try`
5429                 echo "Your long longs are $longlongsize bytes long."
5430         else
5431                 dflt='8'
5432                 echo " "
5433                 echo "(I can't seem to compile the test program.  Guessing...)"
5434                 rp="What is the size of a long long (in bytes)?"
5435                 . ./myread
5436                 longlongsize="$ans"
5437         fi
5438         if $test "X$longsize" = "X$longlongsize"; then
5439                 echo "(That isn't any different from an ordinary long.)"
5440         fi      
5441         ;;
5442 esac
5443 $rm -f try.* try
5444
5445 : see if inttypes.h is available
5446 : we want a real compile instead of Inhdr because some systems
5447 : have an inttypes.h which includes non-existent headers
5448 echo " "
5449 $cat >try.c <<EOCP
5450 #include <inttypes.h>
5451 int main() {
5452         static int32_t foo32 = 0x12345678;
5453 }
5454 EOCP
5455 set try
5456 if eval $compile; then
5457         echo "<inttypes.h> found." >&4
5458         val="$define"
5459 else
5460         echo "<inttypes.h> NOT found." >&4
5461         val="$undef"
5462 fi
5463 $rm -f try.c try
5464 set i_inttypes
5465 eval $setvar
5466
5467 : check for int64_t
5468 echo " "
5469 echo "Checking to see if you have int64_t..." >&4
5470 $cat >try.c <<EOCP
5471 #include <sys/types.h>
5472 #$i_inttypes I_INTTYPES
5473 #ifdef I_INTTYPES
5474 #include <inttypes.h>
5475 #endif
5476 int main() { int64_t x = 7; }
5477 EOCP
5478 set try
5479 if eval $compile; then
5480         val="$define"
5481         echo "You have int64_t."
5482 else
5483         val="$undef"
5484         echo "You do not have int64_t."
5485 fi
5486 $rm -f try try.*
5487 set d_int64_t
5488 eval $setvar
5489
5490
5491 echo " "
5492 echo "Checking which 64-bit integer type we could use..." >&4
5493
5494 case "$intsize" in
5495 8) val=int
5496    set quadtype
5497    eval $setvar
5498    val='"unsigned int"'
5499    set uquadtype
5500    eval $setvar
5501    quadkind=1
5502    ;;
5503 *) case "$longsize" in
5504    8) val=long
5505       set quadtype
5506       eval $setvar
5507       val='"unsigned long"'
5508       set uquadtype
5509       eval $setvar
5510       quadkind=2
5511       ;;
5512    *) case "$d_longlong:$longlongsize" in
5513       define:8)
5514         val='"long long"'
5515         set quadtype
5516         eval $setvar
5517         val='"unsigned long long"'
5518         set uquadtype
5519         eval $setvar
5520         quadkind=3
5521         ;;
5522       *) case "$d_int64_t" in
5523          define)
5524            val=int64_t
5525            set quadtype
5526            eval $setvar
5527            val=uint64_t
5528            set uquadtype
5529            eval $setvar
5530            quadkind=4
5531            ;;
5532          esac
5533          ;;
5534       esac
5535       ;;
5536    esac
5537    ;;
5538 esac
5539
5540 case "$quadtype" in
5541 '')     echo "Alas, no 64-bit integer types in sight." >&4
5542         d_quad="$undef"
5543         ;;
5544 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5545         d_quad="$define"
5546         ;;
5547 esac
5548
5549
5550 case "$uselonglong" in
5551 "$define"|true|[yY]*)
5552         cat <<EOM >&4
5553
5554 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5555 EOM
5556         use64bitint="$define"
5557         ;;
5558 esac                          
5559 case "$use64bits" in
5560 "$define"|true|[yY]*)
5561         cat <<EOM >&4
5562
5563 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5564 EOM
5565         use64bitint="$define"
5566         ;;
5567 esac                          
5568 case "$use64bitints" in
5569 "$define"|true|[yY]*)
5570         cat <<EOM >&4
5571
5572 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5573 EOM
5574         use64bitint="$define"
5575         ;;
5576 esac                          
5577 case "$use64bitsint" in
5578 "$define"|true|[yY]*)
5579         cat <<EOM >&4
5580
5581 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5582 EOM
5583         use64bitint="$define"
5584         ;;
5585 esac                          
5586 case "$uselonglongs" in
5587 "$define"|true|[yY]*)
5588         cat <<EOM >&4
5589
5590 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5591 EOM
5592         use64bitint="$define"
5593         ;;
5594 esac                          
5595 case "$use64bitsall" in
5596 "$define"|true|[yY]*)
5597         cat <<EOM >&4
5598
5599 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5600 EOM
5601         use64bitall="$define"
5602         ;;
5603 esac                          
5604
5605 case "$ccflags" in
5606 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5607 esac
5608 case "$use64bitall" in
5609 "$define"|true|[yY]*) use64bitint="$define" ;;
5610 esac
5611
5612 case "$longsize" in
5613 8) cat <<EOM
5614
5615 You have natively 64-bit long integers.
5616 EOM
5617    val="$define"
5618    ;;
5619 *) case "$use64bitint" in
5620    "$define"|true|[yY]*) dflt='y';;
5621    *) dflt='n';;
5622    esac
5623    case "$d_quad" in
5624    "$define") ;;
5625    *) dflt='n' ;;
5626    esac
5627    cat <<EOM
5628
5629 Perl can be built to take advantage of 64-bit integer types
5630 on some systems.  To do so, Configure can be run with -Duse64bitint.
5631 Choosing this option will most probably introduce binary incompatibilities.
5632
5633 If this doesn't make any sense to you, just accept the default '$dflt'.
5634 (The default has been chosen based on your configuration.)
5635 EOM
5636    rp='Try to use 64-bit integers, if available?'
5637    . ./myread
5638    case "$ans" in
5639    [yY]*) val="$define" ;;
5640    *)     val="$undef"  ;;
5641    esac
5642    ;;
5643 esac
5644 set use64bitint
5645 eval $setvar
5646
5647 case "$use64bitall" in
5648 "$define"|true|[yY]*) dflt='y' ;;
5649 *) case "$longsize" in
5650    8) dflt='y' ;;
5651    *) dflt='n' ;;
5652    esac
5653    ;;
5654 esac    
5655 cat <<EOM
5656
5657 You may also choose to try maximal 64-bitness.  It means using as much
5658 64-bitness as possible on the platform.  This in turn means even more
5659 binary incompatibilities.  On the other hand, your platform may not
5660 have any more 64-bitness available than what you already have chosen.
5661
5662 If this doesn't make any sense to you, just accept the default '$dflt'.
5663 (The default has been chosen based on your configuration.)
5664 EOM
5665 rp='Try to use maximal 64-bit support, if available?'
5666 . ./myread
5667 case "$ans" in
5668 [yY]*) val="$define" ;;
5669 *)     val="$undef"  ;;
5670 esac
5671 set use64bitall
5672 eval $setvar
5673 case "$use64bitall" in
5674 "$define")
5675         case "$use64bitint" in
5676         "$undef")
5677                 cat <<EOM
5678
5679 Since you have chosen a maximally 64-bit build, I'm also turning on
5680 the use of 64-bit integers.
5681 EOM
5682                 use64bitint="$define" ;;
5683         esac
5684         ;;
5685 esac
5686
5687 : Look for a hint-file generated 'call-back-unit'.  If the
5688 : user has specified that a 64-bit perl is to be built,
5689 : we may need to set or change some other defaults.
5690 if $test -f use64bitint.cbu; then
5691         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5692         . ./use64bitint.cbu
5693 fi
5694 case "$use64bitint" in
5695 "$define"|true|[yY]*)
5696         case "$longsize" in
5697         4) case "$archname64" in
5698            '') archname64=64int ;;
5699            esac
5700            ;;
5701         esac
5702         ;;
5703 esac
5704
5705 : Look for a hint-file generated 'call-back-unit'.  If the
5706 : user has specified that a maximally 64-bit perl is to be built,
5707 : we may need to set or change some other defaults.
5708 if $test -f use64bitall.cbu; then
5709         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5710         . ./use64bitall.cbu
5711 fi
5712 case "$use64bitall" in
5713 "$define"|true|[yY]*)
5714         case "$longsize" in
5715         4) case "$archname64" in
5716            ''|64int) archname64=64all ;;
5717            esac
5718            ;;
5719         esac
5720         ;;
5721 esac
5722
5723 case "$d_quad:$use64bitint" in
5724 $undef:$define)
5725         cat >&4 <<EOF
5726
5727 *** You have chosen to use 64-bit integers,
5728 *** but none can be found.
5729 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5730 *** Cannot continue, aborting.
5731
5732 EOF
5733         exit 1
5734         ;;
5735 esac
5736
5737 : check for length of double
5738 echo " "
5739 case "$doublesize" in
5740 '')
5741         echo "Checking to see how big your double precision numbers are..." >&4
5742         $cat >try.c <<EOCP
5743 #include <stdio.h>
5744 #$i_stdlib I_STDLIB
5745 #ifdef I_STDLIB
5746 #include <stdlib.h>
5747 #endif
5748 int main()
5749 {
5750     printf("%d\n", (int)sizeof(double));
5751     exit(0);
5752 }
5753 EOCP
5754         set try
5755         if eval $compile_ok; then
5756                 doublesize=`$run ./try`
5757                 echo "Your double is $doublesize bytes long."
5758         else
5759                 dflt='8'
5760                 echo "(I can't seem to compile the test program.  Guessing...)"
5761                 rp="What is the size of a double precision number (in bytes)?"
5762                 . ./myread
5763                 doublesize="$ans"
5764         fi
5765         ;;
5766 esac
5767 $rm -f try.c try
5768
5769 : check for long doubles
5770 echo " "
5771 echo "Checking to see if you have long double..." >&4
5772 echo 'int main() { long double x = 7.0; }' > try.c
5773 set try
5774 if eval $compile; then
5775         val="$define"
5776         echo "You have long double."
5777 else
5778         val="$undef"
5779         echo "You do not have long double."
5780 fi
5781 $rm try.*
5782 set d_longdbl
5783 eval $setvar
5784
5785 : check for length of long double
5786 case "${d_longdbl}${longdblsize}" in
5787 $define)
5788         echo " "
5789         echo "Checking to see how big your long doubles are..." >&4
5790         $cat >try.c <<'EOCP'
5791 #include <stdio.h>
5792 int main()
5793 {
5794         printf("%d\n", sizeof(long double));
5795 }
5796 EOCP
5797         set try
5798         set try
5799         if eval $compile; then
5800                 longdblsize=`$run ./try`
5801                 echo "Your long doubles are $longdblsize bytes long."
5802         else
5803                 dflt='8'
5804                 echo " "
5805                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5806                 rp="What is the size of a long double (in bytes)?"
5807                 . ./myread
5808                 longdblsize="$ans"
5809         fi
5810         if $test "X$doublesize" = "X$longdblsize"; then
5811                 echo "That isn't any different from an ordinary double."
5812                 echo "I'll keep your setting anyway, but you may see some"
5813                 echo "harmless compilation warnings."
5814         fi      
5815         ;;
5816 esac
5817 $rm -f try.* try
5818
5819 : determine the architecture name
5820 echo " "
5821 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5822         tarch=`arch`"-$osname"
5823 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5824         if uname -m > tmparch 2>&1 ; then
5825                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5826                         -e 's/$/'"-$osname/" tmparch`
5827         else
5828                 tarch="$osname"
5829         fi
5830         $rm -f tmparch
5831 else
5832         tarch="$osname"
5833 fi
5834 case "$myarchname" in
5835 ''|"$tarch") ;;
5836 *)
5837         echo "(Your architecture name used to be $myarchname.)"
5838         archname=''
5839         ;;
5840 esac
5841 case "$targetarch" in
5842 '') ;;
5843 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5844 esac
5845 myarchname="$tarch"
5846 case "$archname" in
5847 '') dflt="$tarch";;
5848 *) dflt="$archname";;
5849 esac
5850 rp='What is your architecture name'
5851 . ./myread
5852 archname="$ans"
5853 case "$usethreads" in
5854 $define)
5855         echo "Threads selected." >&4
5856         case "$archname" in
5857         *-thread*) echo "...and architecture name already has -thread." >&4
5858                 ;;
5859         *)      archname="$archname-thread"
5860                 echo "...setting architecture name to $archname." >&4
5861                 ;;
5862         esac
5863         ;;
5864 esac
5865 case "$usemultiplicity" in
5866 $define)
5867         echo "Multiplicity selected." >&4
5868         case "$archname" in
5869         *-multi*) echo "...and architecture name already has -multi." >&4
5870                 ;;
5871         *)      archname="$archname-multi"
5872                 echo "...setting architecture name to $archname." >&4
5873                 ;;
5874         esac
5875         ;;
5876 esac
5877 case "$use64bitint$use64bitall" in
5878 *"$define"*)
5879         case "$archname64" in
5880         '')
5881                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5882                 ;;
5883         *)
5884                 case "$use64bitint" in
5885                 "$define") echo "64 bit integers selected." >&4 ;;
5886                 esac
5887                 case "$use64bitall" in
5888                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5889                 esac
5890                 case "$archname" in
5891                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5892                         ;;
5893                 *)      archname="$archname-$archname64"
5894                         echo "...setting architecture name to $archname." >&4
5895                         ;;
5896                 esac
5897                 ;;
5898         esac
5899 esac
5900 case "$uselongdouble" in
5901 $define)
5902         echo "Long doubles selected." >&4
5903         case "$longdblsize" in
5904         $doublesize)
5905                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5906                 ;;
5907         *)
5908                 case "$archname" in
5909                 *-ld*) echo "...and architecture name already has -ld." >&4
5910                         ;;
5911                 *)      archname="$archname-ld"
5912                         echo "...setting architecture name to $archname." >&4
5913                         ;;
5914                 esac
5915                 ;;
5916         esac
5917         ;;
5918 esac
5919 case "$useperlio" in
5920 $define)
5921         echo "Perlio selected." >&4
5922         ;;
5923 *)
5924         echo "Perlio not selected, using stdio." >&4
5925         case "$archname" in
5926         *-stdio*) echo "...and architecture name already has -stdio." >&4
5927                 ;;
5928         *)      archname="$archname-stdio"
5929                 echo "...setting architecture name to $archname." >&4
5930                 ;;
5931         esac
5932         ;;
5933 esac
5934 if $test -f archname.cbu; then
5935         echo "Your platform has some specific hints for architecture name, using them..."
5936         . ./archname.cbu
5937 fi
5938
5939 : set the prefixit variable, to compute a suitable default value
5940 prefixit='case "$3" in
5941 ""|none)
5942         case "$oldprefix" in
5943         "") eval "$1=\"\$$2\"";;
5944         *)
5945                 case "$3" in
5946                 "") eval "$1=";;
5947                 none)
5948                         eval "tp=\"\$$2\"";
5949                         case "$tp" in
5950                         ""|" ") eval "$1=\"\$$2\"";;
5951                         *) eval "$1=";;
5952                         esac;;
5953                 esac;;
5954         esac;;
5955 *)
5956         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5957         case "$tp" in
5958         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5959         /*-$oldprefix/*|\~*-$oldprefix/*)
5960                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5961         *) eval "$1=\"\$$2\"";;
5962         esac;;
5963 esac'
5964
5965 : get the patchlevel
5966 echo " "
5967 echo "Getting the current patchlevel..." >&4
5968 if $test -r $rsrc/patchlevel.h;then
5969         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5970         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5971         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5972         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5973         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5974         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5975         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5976 else
5977         revision=0
5978         patchlevel=0
5979         subversion=0
5980         api_revision=0
5981         api_version=0
5982         api_subversion=0
5983         perl_patchlevel=0
5984         $echo "(You do not have patchlevel.h.  Eek.)"
5985 fi
5986 if $test -r $rsrc/.patch ; then
5987         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5988                 perl_patchlevel=`cat $rsrc/.patch`
5989         fi
5990 fi
5991 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5992 version_patchlevel_string="version $patchlevel subversion $subversion"
5993 case "$perl_patchlevel" in
5994 0|'') ;;
5995 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5996 esac
5997
5998 $echo "(You have $package $version_patchlevel_string.)"
5999
6000 case "$osname" in
6001 dos|vms)
6002         : XXX Should be a Configure test for double-dots in filenames.
6003         version=`echo $revision $patchlevel $subversion | \
6004                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6005         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6006                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6007         ;;
6008 *)
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 esac
6015 : Special case the 5.005_xx maintenance series, which used 5.005
6016 : without any subversion label as a subdirectory in $sitelib
6017 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6018         api_versionstring='5.005'
6019 fi
6020
6021 : determine installation style
6022 : For now, try to deduce it from prefix unless it is already set.
6023 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6024 case "$installstyle" in
6025 '')     case "$prefix" in
6026                 *perl*) dflt='lib';;
6027                 *) dflt='lib/perl5' ;;
6028         esac
6029         ;;
6030 *)      dflt="$installstyle" ;;
6031 esac
6032 : Probably not worth prompting for this since we prompt for all
6033 : the directories individually, and the prompt would be too long and
6034 : confusing anyway.
6035 installstyle=$dflt
6036
6037 : determine where public executables go
6038 echo " "
6039 set dflt bin bin
6040 eval $prefixit
6041 fn=d~
6042 rp='Pathname where the public executables will reside?'
6043 . ./getfile
6044 if $test "X$ansexp" != "X$binexp"; then
6045         installbin=''
6046 fi
6047 prefixvar=bin
6048 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6049 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6050 : this via initialinstalllocation
6051 . ./setprefixvar
6052
6053 case "$userelocatableinc" in
6054 $define|true|[yY]*)     dflt='y' ;;
6055 *)                      dflt='n' ;;
6056 esac
6057 cat <<EOM
6058
6059 Would you like to build Perl so that the installation is relocatable, so that
6060 library paths in @INC are determined relative to the path of the perl binary?
6061 This is not advised for system Perl installs, or if you need to run setid
6062 scripts or scripts under taint mode.
6063
6064 If this doesn't make any sense to you, just accept the default '$dflt'.
6065 EOM
6066 rp='Use relocatable @INC?'
6067 . ./myread
6068 case "$ans" in
6069 y|Y)    val="$define" ;;
6070 *)      val="$undef"  ;;
6071 esac
6072 set userelocatableinc
6073 eval $setvar
6074
6075 initialinstalllocation="$binexp"
6076 : Default prefix is now "up one level from where the binaries are"
6077 case "$userelocatableinc" in
6078 $define|true|[yY]*)
6079     bin=".../"
6080     binexp=".../"
6081     prefix=".../.."
6082     prefixexp=".../.."
6083     installprefixexp=".../.."
6084     ;;
6085 esac
6086
6087 : determine where private library files go
6088 : Usual default is /usr/local/lib/perl5/$version.
6089 : Also allow things like /opt/perl/lib/$version, since
6090 : /opt/perl/lib/perl5... would be redundant.
6091 : The default "style" setting is made in installstyle.U
6092 case "$installstyle" in
6093 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6094 *)       set dflt privlib lib/$version ;;
6095 esac
6096 eval $prefixit
6097 $cat <<EOM
6098
6099 There are some auxiliary files for $package that need to be put into a
6100 private library directory that is accessible by everyone.
6101
6102 EOM
6103 fn=$binexp
6104 fn=d~+
6105 rp='Pathname where the private library files will reside?'
6106 . ./getfile
6107 prefixvar=privlib
6108 . ./setprefixvar
6109
6110 : set the prefixup variable, to restore leading tilda escape
6111 prefixup='case "$prefixexp" in
6112 "$prefix") ;;
6113 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6114 esac'
6115
6116 : determine where public architecture dependent libraries go
6117 set archlib archlib
6118 eval $prefixit
6119 : privlib default is /usr/local/lib/$package/$version
6120 : archlib default is /usr/local/lib/$package/$version/$archname
6121 : privlib may have an optional trailing /share.
6122 tdflt=`echo $privlib | $sed 's,/share$,,'`
6123 tdflt=$tdflt/$archname
6124 case "$archlib" in
6125 '')     dflt=$tdflt
6126         ;;
6127 *)      dflt="$archlib"
6128     ;;
6129 esac
6130 $cat <<EOM
6131
6132 $spackage contains architecture-dependent library files.  If you are
6133 sharing libraries in a heterogeneous environment, you might store
6134 these files in a separate location.  Otherwise, you can just include
6135 them with the rest of the public library files.
6136
6137 EOM
6138 fn=$binexp
6139 fn=d+~
6140 rp='Where do you want to put the public architecture-dependent libraries?'
6141 . ./getfile
6142 prefixvar=archlib
6143 . ./setprefixvar
6144 if $test X"$archlib" = X"$privlib"; then
6145         d_archlib="$undef"
6146 else
6147         d_archlib="$define"
6148 fi
6149
6150 : see if setuid scripts can be secure
6151 $cat <<EOM
6152
6153 Some kernels have a bug that prevents setuid #! scripts from being
6154 secure.  Some sites have disabled setuid #! scripts because of this.
6155
6156 First let's decide if your kernel supports secure setuid #! scripts.
6157 (If setuid #! scripts would be secure but have been disabled anyway,
6158 don't say that they are secure if asked.)
6159
6160 EOM
6161
6162 val="$undef"
6163 if $test -d /dev/fd; then
6164         echo "#!$ls" >reflect
6165         chmod +x,u+s reflect
6166         ./reflect >flect 2>&1
6167         if $contains "/dev/fd" flect >/dev/null; then
6168                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6169                 val="$define"
6170         else
6171                 $cat <<EOM
6172 If you are not sure if they are secure, I can check but I'll need a
6173 username and password different from the one you are using right now.
6174 If you don't have such a username or don't want me to test, simply
6175 enter 'none'.
6176
6177 EOM
6178                 rp='Other username to test security of setuid scripts with?'
6179                 dflt='none'
6180                 . ./myread
6181                 case "$ans" in
6182                 n|none)
6183                         case "$d_suidsafe" in
6184                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6185                                 dflt=n;;
6186                         "$undef")
6187                                 echo "Well, the $hint value is *not* secure." >&4
6188                                 dflt=n;;
6189                         *)      echo "Well, the $hint value *is* secure." >&4
6190                                 dflt=y;;
6191                         esac
6192                         ;;
6193                 *)
6194                         $rm -f reflect flect
6195                         echo "#!$ls" >reflect
6196                         chmod +x,u+s reflect
6197                         echo >flect
6198                         chmod a+w flect
6199                         echo '"su" will (probably) prompt you for '"$ans's password."
6200                         su $ans -c './reflect >flect'
6201                         if $contains "/dev/fd" flect >/dev/null; then
6202                                 echo "Okay, it looks like setuid scripts are secure." >&4
6203                                 dflt=y
6204                         else
6205                                 echo "I don't think setuid scripts are secure." >&4
6206                                 dflt=n
6207                         fi
6208                         ;;
6209                 esac
6210                 rp='Does your kernel have *secure* setuid scripts?'
6211                 . ./myread
6212                 case "$ans" in
6213                 [yY]*)  val="$define";;
6214                 *)      val="$undef";;
6215                 esac
6216         fi
6217 else
6218         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6219         echo "(That's for file descriptors, not floppy disks.)"
6220         val="$undef"
6221 fi
6222 set d_suidsafe
6223 eval $setvar
6224
6225 $rm -f reflect flect
6226
6227 : now see if they want to do setuid emulation
6228 echo " "
6229 val="$undef"
6230 case "$d_suidsafe" in
6231 "$define")
6232         val="$undef"
6233         echo "No need to emulate SUID scripts since they are secure here." >&4
6234         ;;
6235 *)
6236         $cat <<EOM
6237 Some systems have disabled setuid scripts, especially systems where
6238 setuid scripts cannot be secure.  On systems where setuid scripts have
6239 been disabled, the setuid/setgid bits on scripts are currently
6240 useless.  It is possible for $package to detect those bits and emulate
6241 setuid/setgid in a secure fashion.  This emulation will only work if
6242 setuid scripts have been disabled in your kernel.
6243
6244 EOM
6245         case "$d_dosuid" in
6246         "$define") dflt=y ;;
6247         *) dflt=n ;;
6248         esac
6249         rp="Do you want to do setuid/setgid emulation?"
6250         . ./myread
6251         case "$ans" in
6252         [yY]*)  val="$define";;
6253         *)      val="$undef";;
6254         esac
6255         ;;
6256 esac
6257 set d_dosuid
6258 eval $setvar
6259
6260 : Find perl5.005 or later.
6261 echo "Looking for a previously installed perl5.005 or later... "
6262 case "$perl5" in
6263 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6264                 : Check if this perl is recent and can load a simple module
6265                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6266                         perl5=$tdir/perl
6267                         break;
6268                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6269                         perl5=$tdir/perl5
6270                         break;
6271                 fi
6272         done
6273         ;;
6274 *)      perl5="$perl5"
6275         ;;
6276 esac
6277 case "$perl5" in
6278 '')     echo "None found.  That's ok.";;
6279 *)      echo "Using $perl5." ;;
6280 esac
6281
6282 $cat <<EOM
6283
6284 After $package is installed, you may wish to install various
6285 add-on modules and utilities.  Typically, these add-ons will
6286 be installed under $prefix with the rest
6287 of this package.  However, you may wish to install such add-ons
6288 elsewhere under a different prefix.
6289
6290 If you do not wish to put everything under a single prefix, that's
6291 ok.  You will be prompted for the individual locations; this siteprefix
6292 is only used to suggest the defaults.
6293
6294 The default should be fine for most people.
6295
6296 EOM
6297 fn=d~+
6298 rp='Installation prefix to use for add-on modules and utilities?'
6299 : XXX Here might be another good place for an installstyle setting.
6300 case "$siteprefix" in
6301 '') dflt=$prefix ;;
6302 *)  dflt=$siteprefix ;;
6303 esac
6304 . ./getfile
6305 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6306 oldsiteprefix=''
6307 case "$siteprefix" in
6308 '') ;;
6309 *)      case "$ans" in
6310         "$prefix") ;;
6311         *) oldsiteprefix="$prefix";;
6312         esac
6313         ;;
6314 esac
6315 siteprefix="$ans"
6316 siteprefixexp="$ansexp"
6317
6318 : determine where site specific libraries go.
6319 : Usual default is /usr/local/lib/perl5/site_perl/$version
6320 : The default "style" setting is made in installstyle.U
6321 : XXX No longer works with Prefixit stuff.
6322 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6323 case "$sitelib" in
6324 '') case "$installstyle" in
6325         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6326         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6327         esac
6328         ;;
6329 *)      dflt="$sitelib"
6330         ;;
6331 esac
6332 $cat <<EOM
6333
6334 The installation process will create a directory for
6335 site-specific extensions and modules.  Most users find it convenient
6336 to place all site-specific files in this directory rather than in the
6337 main distribution directory.
6338
6339 EOM
6340 fn=d~+
6341 rp='Pathname for the site-specific library files?'
6342 . ./getfile
6343 prefixvar=sitelib
6344 . ./setprefixvar
6345 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6346
6347 : Determine list of previous versions to include in @INC
6348 $cat > getverlist <<EOPL
6349 #!$perl5 -w
6350 use File::Basename;
6351 \$api_versionstring = "$api_versionstring";
6352 \$version = "$version";
6353 \$stem = "$sitelib_stem";
6354 \$archname = "$archname";
6355 EOPL
6356         $cat >> getverlist <<'EOPL'
6357 # Can't have leading @ because metaconfig interprets it as a command!
6358 ;@inc_version_list=();
6359 # XXX Redo to do opendir/readdir?
6360 if (-d $stem) {
6361     chdir($stem);
6362     ;@candidates = glob("5.*");
6363 }
6364 else {
6365     ;@candidates = ();
6366 }
6367
6368 # XXX ToDo:  These comparisons must be reworked when two-digit
6369 # subversions come along, so that 5.7.10 compares as greater than
6370 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6371 # widespread that we can use the built-in version vectors rather
6372 # than reinventing them here.  For 5.6.0, however, we must
6373 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6374 foreach $d (@candidates) {
6375     if ($d lt $version) {
6376         if ($d ge $api_versionstring) {
6377             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6378         }
6379         elsif ($d ge "5.005") {
6380             unshift(@inc_version_list, grep { -d } $d);
6381         }
6382     }
6383     else {
6384         # Skip newer version.  I.e. don't look in
6385         # 5.7.0 if we're installing 5.6.1.
6386     }
6387 }
6388
6389 if (@inc_version_list) {
6390     print join(' ', @inc_version_list);
6391 }
6392 else {
6393     # Blank space to preserve value for next Configure run.
6394     print " ";
6395 }
6396 EOPL
6397 chmod +x getverlist
6398 case "$inc_version_list" in
6399 '')     if test -x "$perl5$exe_ext"; then
6400                 dflt=`$perl5 getverlist`
6401         else
6402                 dflt='none'
6403         fi
6404         ;;
6405 $undef) dflt='none' ;;
6406 *)  eval dflt=\"$inc_version_list\" ;;
6407 esac
6408 case "$dflt" in
6409 ''|' ') dflt=none ;;
6410 esac
6411 case "$dflt" in
6412 5.005) dflt=none ;;
6413 esac
6414 $cat <<EOM
6415
6416 In order to ease the process of upgrading, this version of perl
6417 can be configured to use modules built and installed with earlier
6418 versions of perl that were installed under $prefix.  Specify here
6419 the list of earlier versions that this version of perl should check.
6420 If Configure detected no earlier versions of perl installed under
6421 $prefix, then the list will be empty.  Answer 'none' to tell perl
6422 to not search earlier versions.
6423
6424 The default should almost always be sensible, so if you're not sure,
6425 just accept the default.
6426 EOM
6427
6428 rp='List of earlier versions to include in @INC?'
6429 . ./myread
6430 case "$ans" in
6431 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6432 *) inc_version_list="$ans" ;;
6433 esac
6434 case "$inc_version_list" in
6435 ''|' ')
6436         inc_version_list_init='0'
6437         d_inc_version_list="$undef"
6438         ;;
6439 *)      inc_version_list_init=`echo $inc_version_list |
6440                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6441         d_inc_version_list="$define"
6442         ;;
6443 esac
6444 $rm -f getverlist
6445
6446 : see if this is a malloc.h system
6447 : we want a real compile instead of Inhdr because some systems have a
6448 : malloc.h that just gives a compile error saying to use stdlib.h instead
6449 echo " "
6450 $cat >try.c <<EOCP
6451 #include <stdlib.h>
6452 #include <malloc.h>
6453 int main () { return 0; }
6454 EOCP
6455 set try
6456 if eval $compile; then
6457     echo "<malloc.h> found." >&4
6458     val="$define"
6459 else
6460     echo "<malloc.h> NOT found." >&4
6461     val="$undef"
6462 fi
6463 $rm -f try.c try
6464 set i_malloc
6465 eval $setvar
6466
6467 : check for void type
6468 echo " "
6469 echo "Checking to see how well your C compiler groks the void type..." >&4
6470 case "$voidflags" in
6471 '')
6472         $cat >try.c <<EOCP
6473 #$i_stdlib I_STDLIB
6474 #ifdef I_STDLIB
6475 #include <stdlib.h>
6476 #endif
6477 #if TRY & 1
6478 void sub() {
6479 #else
6480 sub() {
6481 #endif
6482         extern void moo();      /* function returning void */
6483         void (*goo)();          /* ptr to func returning void */
6484 #if TRY & 8
6485         void *hue;              /* generic ptr */
6486 #endif
6487 #if TRY & 2
6488         void (*foo[10])();
6489 #endif
6490
6491 #if TRY & 4
6492         if(goo == moo) {
6493                 exit(0);
6494         }
6495 #endif
6496         exit(0);
6497 }
6498 int main() { sub(); }
6499 EOCP
6500         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6501                 voidflags=$defvoidused
6502         echo "Good.  It appears to support void to the level $package wants.">&4
6503                 if $contains warning .out >/dev/null 2>&1; then
6504                         echo "However, you might get some warnings that look like this:"
6505                         $cat .out
6506                 fi
6507         else
6508 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6509                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6510                         echo "It supports 1..."
6511                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6512                                 echo "It also supports 2..."
6513                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6514                                         voidflags=7
6515                                         echo "And it supports 4 but not 8 definitely."
6516                                 else
6517                                         echo "It doesn't support 4..."
6518                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6519                                                 voidflags=11
6520                                                 echo "But it supports 8."
6521                                         else
6522                                                 voidflags=3
6523                                                 echo "Neither does it support 8."
6524                                         fi
6525                                 fi
6526                         else
6527                                 echo "It does not support 2..."
6528                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6529                                         voidflags=13
6530                                         echo "But it supports 4 and 8."
6531                                 else
6532                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6533                                                 voidflags=5
6534                                                 echo "And it supports 4 but has not heard about 8."
6535                                         else
6536                                                 echo "However it supports 8 but not 4."
6537                                         fi
6538                                 fi
6539                         fi
6540                 else
6541                         echo "There is no support at all for void."
6542                         voidflags=0
6543                 fi
6544         fi
6545 esac
6546 case "$voidflags" in
6547 "$defvoidused") ;;
6548 *)      $cat >&4 <<'EOM'
6549   Support flag bits are:
6550     1: basic void declarations.
6551     2: arrays of pointers to functions returning void.
6552     4: operations between pointers to and addresses of void functions.
6553     8: generic void pointers.
6554 EOM
6555         dflt="$voidflags";
6556         rp="Your void support flags add up to what?"
6557         . ./myread
6558         voidflags="$ans"
6559         ;;
6560 esac
6561 $rm -f try.* .out
6562
6563 : check for length of pointer
6564 echo " "
6565 case "$ptrsize" in
6566 '')
6567         echo "Checking to see how big your pointers are..." >&4
6568         if test "$voidflags" -gt 7; then
6569                 echo '#define VOID_PTR char *' > try.c
6570         else
6571                 echo '#define VOID_PTR void *' > try.c
6572         fi
6573         $cat >>try.c <<EOCP
6574 #include <stdio.h>
6575 #$i_stdlib I_STDLIB
6576 #ifdef I_STDLIB
6577 #include <stdlib.h>
6578 #endif
6579 int main()
6580 {
6581     printf("%d\n", (int)sizeof(VOID_PTR));
6582     exit(0);
6583 }
6584 EOCP
6585         set try
6586         if eval $compile_ok; then
6587                 ptrsize=`$run ./try`
6588                 echo "Your pointers are $ptrsize bytes long."
6589         else
6590                 dflt='4'
6591                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6592                 rp="What is the size of a pointer (in bytes)?"
6593                 . ./myread
6594                 ptrsize="$ans"
6595         fi
6596         ;;
6597 esac
6598 $rm -f try.c try
6599 case "$use64bitall" in
6600 "$define"|true|[yY]*)
6601         case "$ptrsize" in
6602         4)      cat <<EOM >&4
6603
6604 *** You have chosen a maximally 64-bit build,
6605 *** but your pointers are only 4 bytes wide.
6606 *** Please rerun Configure without -Duse64bitall.
6607 EOM
6608                 case "$d_quad" in
6609                 define)
6610                         cat <<EOM >&4
6611 *** Since you have quads, you could possibly try with -Duse64bitint.
6612 EOM
6613                         ;;
6614                 esac
6615                 cat <<EOM >&4
6616 *** Cannot continue, aborting.
6617
6618 EOM
6619
6620                 exit 1
6621                 ;;
6622         esac
6623         ;;
6624 esac
6625
6626
6627 : determine whether to use malloc wrapping
6628 echo " "
6629 case "$usemallocwrap" in
6630 [yY]*|true|$define)     dflt='y' ;;
6631 [nN]*|false|$undef)     dflt='n' ;;
6632 *)      case "$usedevel" in
6633         [yY]*|true|$define)     dflt='y' ;;
6634         *) dflt='n' ;;
6635         esac
6636         ;;
6637 esac
6638 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6639 . ./myread
6640 usemallocwrap="$ans"
6641 case "$ans" in
6642 y*|true)
6643         usemallocwrap="$define" ;;
6644 *)
6645         usemallocwrap="$undef" ;;
6646 esac
6647
6648 : determine which malloc to compile in
6649 echo " "
6650 case "$usemymalloc" in
6651 [yY]*|true|$define)     dflt='y' ;;
6652 [nN]*|false|$undef)     dflt='n' ;;
6653 *)      case "$ptrsize" in
6654         4) dflt='y' ;;
6655         *) dflt='n' ;;
6656         esac
6657         ;;
6658 esac
6659 rp="Do you wish to attempt to use the malloc that comes with $package?"
6660 . ./myread
6661 usemymalloc="$ans"
6662 case "$ans" in
6663 y*|true)
6664         usemymalloc='y'
6665         mallocsrc='malloc.c'
6666         mallocobj="malloc$_o"
6667         d_mymalloc="$define"
6668         case "$libs" in
6669         *-lmalloc*)
6670                 : Remove malloc from list of libraries to use
6671                 echo "Removing unneeded -lmalloc from library list" >&4
6672                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6673                 shift
6674                 libs="$*"
6675                 echo "libs = $libs" >&4
6676                 ;;
6677         esac
6678         ;;
6679 *)
6680         usemymalloc='n'
6681         mallocsrc=''
6682         mallocobj=''
6683         d_mymalloc="$undef"
6684         ;;
6685 esac
6686
6687 : compute the return types of malloc and free
6688 echo " "
6689 $cat >malloc.c <<END
6690 #$i_malloc I_MALLOC
6691 #$i_stdlib I_STDLIB
6692 #include <stdio.h>
6693 #include <sys/types.h>
6694 #ifdef I_MALLOC
6695 #include <malloc.h>
6696 #endif
6697 #ifdef I_STDLIB
6698 #include <stdlib.h>
6699 #endif
6700 #ifdef TRY_MALLOC
6701 void *malloc();
6702 #endif
6703 #ifdef TRY_FREE
6704 void free();
6705 #endif
6706 END
6707 case "$malloctype" in
6708 '')
6709         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6710                 malloctype='void *'
6711         else
6712                 malloctype='char *'
6713         fi
6714         ;;
6715 esac
6716 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6717
6718 case "$freetype" in
6719 '')
6720         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6721                 freetype='void'
6722         else
6723                 freetype='int'
6724         fi
6725         ;;
6726 esac
6727 echo "Your system uses $freetype free(), it would seem." >&4
6728 $rm -f malloc.[co]
6729 : determine where site specific architecture-dependent libraries go.
6730 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6731 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6732 : sitelib may have an optional trailing /share.
6733 case "$sitearch" in
6734 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6735         dflt="$dflt/$archname"
6736         ;;
6737 *)      dflt="$sitearch"
6738         ;;
6739 esac
6740 set sitearch sitearch none
6741 eval $prefixit
6742 $cat <<EOM
6743
6744 The installation process will also create a directory for
6745 architecture-dependent site-specific extensions and modules.
6746
6747 EOM
6748 fn=d~+
6749 rp='Pathname for the site-specific architecture-dependent library files?'
6750 . ./getfile
6751 prefixvar=sitearch
6752 . ./setprefixvar
6753 if $test X"$sitearch" = X"$sitelib"; then
6754         d_sitearch="$undef"
6755 else
6756         d_sitearch="$define"
6757 fi
6758
6759 $cat <<EOM
6760
6761 The installation process will also create a directory for
6762 vendor-supplied add-ons.  Vendors who supply perl with their system
6763 may find it convenient to place all vendor-supplied files in this
6764 directory rather than in the main distribution directory.  This will
6765 ease upgrades between binary-compatible maintenance versions of perl.
6766
6767 Of course you may also use these directories in whatever way you see
6768 fit.  For example, you might use them to access modules shared over a
6769 company-wide network.
6770
6771 The default answer should be fine for most people.
6772 This causes further questions about vendor add-ons to be skipped
6773 and no vendor-specific directories will be configured for perl.
6774
6775 EOM
6776 rp='Do you want to configure vendor-specific add-on directories?'
6777 case "$usevendorprefix" in
6778 define|true|[yY]*) dflt=y ;;
6779 *)      : User may have set vendorprefix directly on Configure command line.
6780         case "$vendorprefix" in
6781         ''|' ') dflt=n ;;
6782         *)      dflt=y ;;
6783         esac
6784         ;;
6785 esac
6786 . ./myread
6787 case "$ans" in
6788 [yY]*)  fn=d~+
6789         rp='Installation prefix to use for vendor-supplied add-ons?'
6790         case "$vendorprefix" in
6791         '') dflt='' ;;
6792         *)  dflt=$vendorprefix ;;
6793         esac
6794         . ./getfile
6795         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6796         oldvendorprefix=''
6797         case "$vendorprefix" in
6798         '') ;;
6799         *)      case "$ans" in
6800                 "$prefix") ;;
6801                 *) oldvendorprefix="$prefix";;
6802                 esac
6803                 ;;
6804         esac
6805         usevendorprefix="$define"
6806         vendorprefix="$ans"
6807         vendorprefixexp="$ansexp"
6808         ;;
6809 *)      usevendorprefix="$undef"
6810         vendorprefix=''
6811         vendorprefixexp=''
6812         ;;
6813 esac
6814
6815 case "$vendorprefix" in
6816 '')     d_vendorlib="$undef"
6817         vendorlib=''
6818         vendorlibexp=''
6819         ;;
6820 *)      d_vendorlib="$define"
6821         : determine where vendor-supplied modules go.
6822         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6823         case "$vendorlib" in
6824         '')
6825                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6826                 case "$installstyle" in
6827                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6828                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6829                 esac
6830                 ;;
6831         *)      dflt="$vendorlib"
6832                 ;;
6833         esac
6834         fn=d~+
6835         rp='Pathname for the vendor-supplied library files?'
6836         . ./getfile
6837         vendorlib="$ans"
6838         vendorlibexp="$ansexp"
6839         ;;
6840 esac
6841 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6842 prefixvar=vendorlib
6843 . ./installprefix
6844
6845 case "$vendorprefix" in
6846 '')     d_vendorarch="$undef"
6847         vendorarch=''
6848         vendorarchexp=''
6849         ;;
6850 *)      d_vendorarch="$define"
6851         : determine where vendor-supplied architecture-dependent libraries go.
6852         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6853         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6854         : vendorlib may have an optional trailing /share.
6855         case "$vendorarch" in
6856         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6857                 dflt="$dflt/$archname"
6858                 ;;
6859         *)      dflt="$vendorarch" ;;
6860         esac
6861         fn=d~+
6862         rp='Pathname for vendor-supplied architecture-dependent files?'
6863         . ./getfile
6864         vendorarch="$ans"
6865         vendorarchexp="$ansexp"
6866         ;;
6867 esac
6868 prefixvar=vendorarch
6869 . ./installprefix
6870
6871 : Final catch-all directories to search
6872 $cat <<EOM
6873
6874 Lastly, you can have perl look in other directories for extensions and
6875 modules in addition to those already specified.
6876 These directories will be searched after 
6877         $sitearch 
6878         $sitelib 
6879 EOM
6880 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6881 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6882 echo ' '
6883 case "$otherlibdirs" in
6884 ''|' ') dflt='none' ;;
6885 *)      dflt="$otherlibdirs" ;;
6886 esac
6887 $cat <<EOM
6888 Enter a colon-separated set of extra paths to include in perl's @INC
6889 search path, or enter 'none' for no extra paths.
6890
6891 EOM
6892
6893 rp='Colon-separated list of additional directories for perl to search?'
6894 . ./myread
6895 case "$ans" in
6896 ' '|''|none)    otherlibdirs=' ' ;;     
6897 *)      otherlibdirs="$ans" ;;
6898 esac
6899 case "$otherlibdirs" in
6900 ' ') val=$undef ;;
6901 *)      val=$define ;;
6902 esac
6903 set d_perl_otherlibdirs
6904 eval $setvar
6905
6906 : Cruising for prototypes
6907 echo " "
6908 echo "Checking out function prototypes..." >&4
6909 $cat >prototype.c <<EOCP
6910 #$i_stdlib I_STDLIB
6911 #ifdef I_STDLIB
6912 #include <stdlib.h>
6913 #endif
6914 int main(int argc, char *argv[]) {
6915         exit(0);}
6916 EOCP
6917 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6918         echo "Your C compiler appears to support function prototypes."
6919         val="$define"
6920 else
6921         echo "Your C compiler doesn't seem to understand function prototypes."
6922         val="$undef"
6923 fi
6924 set prototype
6925 eval $setvar
6926 $rm -f prototype*
6927
6928 case "$prototype" in
6929 "$define") ;;
6930 *)      ansi2knr='ansi2knr'
6931         echo " "
6932         cat <<EOM >&4
6933
6934 $me:  FATAL ERROR:
6935 This version of $package can only be compiled by a compiler that 
6936 understands function prototypes.  Unfortunately, your C compiler 
6937         $cc $ccflags
6938 doesn't seem to understand them.  Sorry about that.
6939
6940 If GNU cc is available for your system, perhaps you could try that instead.  
6941
6942 Eventually, we hope to support building Perl with pre-ANSI compilers.
6943 If you would like to help in that effort, please contact <perlbug@perl.org>.
6944
6945 Aborting Configure now.
6946 EOM
6947         exit 2
6948         ;;
6949 esac
6950
6951 echo " "
6952 case "$extras" in
6953 '') dflt='n';;
6954 *) dflt='y';;
6955 esac
6956 cat <<EOM
6957 Perl can be built with extra modules or bundles of modules which
6958 will be fetched from the CPAN and installed alongside Perl.
6959
6960 Notice that you will need access to the CPAN; either via the Internet,
6961 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6962 be asked later to configure the CPAN.pm module which will in turn do
6963 the installation of the rest of the extra modules or bundles.)
6964
6965 Notice also that if the modules require any external software such as
6966 libraries and headers (the libz library and the zlib.h header for the
6967 Compress::Zlib module, for example) you MUST have any such software
6968 already installed, this configuration process will NOT install such
6969 things for you.
6970
6971 If this doesn't make any sense to you, just accept the default '$dflt'.
6972 EOM
6973 rp='Install any extra modules (y or n)?'
6974 . ./myread
6975 case "$ans" in
6976 y|Y)
6977         cat <<EOM
6978
6979 Please list any extra modules or bundles to be installed from CPAN,
6980 with spaces between the names.  The names can be in any format the
6981 'install' command of CPAN.pm will understand.  (Answer 'none',
6982 without the quotes, to install no extra modules or bundles.)
6983 EOM
6984         rp='Extras?'
6985         dflt="$extras"
6986         . ./myread
6987         extras="$ans"
6988 esac
6989 case "$extras" in
6990 ''|'none')
6991         val=''
6992         $rm -f ../extras.lst
6993         ;;
6994 *)      echo "(Saving the list of extras for later...)"
6995         echo "$extras" > ../extras.lst
6996         val="'$extras'"
6997         ;;
6998 esac
6999 set extras
7000 eval $setvar
7001 echo " "
7002
7003 : determine where html pages for programs go
7004 set html1dir html1dir none
7005 eval $prefixit
7006 $cat <<EOM
7007
7008 If you wish to install html files for programs in $spackage, indicate
7009 the appropriate directory here.  To skip installing html files,
7010 answer "none".
7011 EOM
7012 case "$html1dir" in
7013 ''|none|$undef|' ') dflt=none ;;
7014 *) dflt=$html1dir ;;
7015 esac
7016 fn=dn+~
7017 rp="Directory for the main $spackage html pages?"
7018 . ./getfile
7019 prefixvar=html1dir
7020 . ./setprefixvar
7021 : Use ' ' for none so value is preserved next time through Configure
7022 $test X"$html1dir" = "X" && html1dir=' '
7023
7024 : determine where html pages for libraries and modules go
7025 set html3dir html3dir none
7026 eval $prefixit
7027 $cat <<EOM
7028
7029 If you wish to install html files for modules associated with $spackage,
7030 indicate the appropriate directory here.  To skip installing html files,
7031 answer "none".
7032 EOM
7033 : There is no obvious default.  If they have specified html1dir, then
7034 : try to key off that, possibly changing .../html1 into .../html3.
7035 case "$html3dir" in
7036 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7037 *) dflt=$html3dir ;;
7038 esac
7039 fn=dn+~
7040 rp="Directory for the $spackage module html pages?"
7041 . ./getfile
7042 prefixvar=html3dir
7043 . ./setprefixvar
7044 : Use ' ' for none so value is preserved next time through Configure
7045 $test X"$html3dir" = "X" && html3dir=' '
7046
7047 : determine whether to install perl also as /usr/bin/perl
7048
7049 echo " "
7050 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7051         $cat <<EOM
7052 Many scripts expect perl to be installed as /usr/bin/perl.
7053
7054 If you want to, I can install the perl you are about to compile
7055 as /usr/bin/perl (in addition to $bin/perl).
7056 EOM
7057         if test -f /usr/bin/perl; then
7058             $cat <<EOM
7059
7060 However, please note that because you already have a /usr/bin/perl,
7061 overwriting that with a new Perl would very probably cause problems.
7062 Therefore I'm assuming you don't want to do that (unless you insist).
7063
7064 EOM
7065             case "$installusrbinperl" in
7066             "$define"|[yY]*)    dflt='y';;
7067             *)                  dflt='n';;
7068             esac
7069         else
7070             $cat <<EOM
7071
7072 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7073
7074 EOM
7075             case "$installusrbinperl" in
7076             "$undef"|[nN]*)     dflt='n';;
7077             *)                  dflt='y';;
7078             esac
7079         fi
7080         rp="Do you want to install perl as /usr/bin/perl?"
7081         . ./myread
7082         case "$ans" in
7083         [yY]*)  val="$define";;
7084         *)      val="$undef" ;;
7085         esac
7086 else
7087         val="$undef"
7088 fi
7089 set installusrbinperl
7090 eval $setvar
7091
7092 echo " "
7093 echo "Checking for GNU C Library..." >&4
7094 cat >try.c <<'EOCP'
7095 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7096    alone are insufficient to distinguish different versions, such as
7097    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7098    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7099 */
7100 #include <stdio.h>
7101 int main(void)
7102 {
7103 #ifdef __GLIBC__
7104 #   ifdef __GLIBC_MINOR__
7105 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7106 #           include <gnu/libc-version.h>
7107             printf("%s\n",  gnu_get_libc_version());
7108 #       else
7109             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7110 #       endif
7111 #   else
7112         printf("%d\n",  __GLIBC__);
7113 #   endif
7114     return 0;
7115 #else
7116     return 1;
7117 #endif
7118 }
7119 EOCP
7120 set try
7121 if eval $compile_ok && $run ./try > glibc.ver; then
7122         val="$define"
7123         gnulibc_version=`$cat glibc.ver`
7124         echo "You are using the GNU C Library version $gnulibc_version"
7125 else
7126         val="$undef"
7127         gnulibc_version=''
7128         echo "You are not using the GNU C Library"
7129 fi
7130 $rm -f try try.* glibc.ver
7131 set d_gnulibc
7132 eval $setvar
7133
7134 : see if nm is to be used to determine whether a symbol is defined or not
7135 case "$usenm" in
7136 '')
7137         dflt=''
7138         case "$d_gnulibc" in
7139         "$define")
7140                 echo " "
7141                 echo "nm probably won't work on the GNU C Library." >&4
7142                 dflt=n
7143                 ;;
7144         esac
7145         case "$dflt" in
7146         '') 
7147                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7148                         echo " "
7149                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7150                         echo "'nm' won't be sufficient on this sytem." >&4
7151                         dflt=n
7152                 fi
7153                 ;;
7154         esac
7155         case "$dflt" in
7156         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7157                 if $test $dflt -gt 20; then
7158                         dflt=y
7159                 else
7160                         dflt=n
7161                 fi
7162                 ;;
7163         esac
7164         ;;
7165 *)
7166         case "$usenm" in
7167         true|$define) dflt=y;;
7168         *) dflt=n;;
7169         esac
7170         ;;
7171 esac
7172 $cat <<EOM
7173
7174 I can use $nm to extract the symbols from your C libraries. This
7175 is a time consuming task which may generate huge output on the disk (up
7176 to 3 megabytes) but that should make the symbols extraction faster. The
7177 alternative is to skip the 'nm' extraction part and to compile a small
7178 test program instead to determine whether each symbol is present. If
7179 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7180 this may be the best solution.
7181
7182 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7183
7184 EOM
7185 rp="Shall I use $nm to extract C symbols from the libraries?"
7186 . ./myread
7187 case "$ans" in
7188 [Nn]*) usenm=false;;
7189 *) usenm=true;;
7190 esac
7191
7192 runnm=$usenm
7193 case "$reuseval" in
7194 true) runnm=false;;
7195 esac
7196
7197 : nm options which may be necessary
7198 case "$nm_opt" in
7199 '') if $test -f /mach_boot; then
7200                 nm_opt=''       # Mach
7201         elif $test -d /usr/ccs/lib; then
7202                 nm_opt='-p'     # Solaris (and SunOS?)
7203         elif $test -f /dgux; then
7204                 nm_opt='-p'     # DG-UX
7205         elif $test -f /lib64/rld; then
7206                 nm_opt='-p'     # 64-bit Irix
7207         else
7208                 nm_opt=''
7209         fi;;
7210 esac
7211
7212 : nm options which may be necessary for shared libraries but illegal
7213 : for archive libraries.  Thank you, Linux.
7214 case "$nm_so_opt" in
7215 '')     case "$myuname" in
7216         *linux*|gnu*)
7217                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7218                         nm_so_opt='--dynamic'
7219                 fi
7220                 ;;
7221         esac
7222         ;;
7223 esac
7224
7225 case "$runnm" in
7226 true)
7227 : get list of predefined functions in a handy place
7228 echo " "
7229 case "$libc" in
7230 '') libc=unknown
7231         case "$libs" in
7232         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7233         esac
7234         ;;
7235 esac
7236 case "$libs" in
7237 '') ;;
7238 *)  for thislib in $libs; do
7239         case "$thislib" in
7240         -lc|-lc_s)
7241                 : Handle C library specially below.
7242                 ;;
7243         -l*)
7244                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7245                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7246                         :
7247                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7248                         :
7249                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7250                         :
7251                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7252                         :
7253                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7254                         :
7255                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7256                         :
7257                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7258                         :
7259                 else
7260                         try=''
7261                 fi
7262                 libnames="$libnames $try"
7263                 ;;
7264         *) libnames="$libnames $thislib" ;;
7265         esac
7266         done
7267         ;;
7268 esac
7269 xxx=normal
7270 case "$libc" in
7271 unknown)
7272         set /lib/libc.$so
7273         for xxx in $libpth; do
7274                 $test -r $1 || set $xxx/libc.$so
7275                 : The messy sed command sorts on library version numbers.
7276                 $test -r $1 || \
7277                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7278                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7279                                 h
7280                                 s/[0-9][0-9]*/0000&/g
7281                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7282                                 G
7283                                 s/\n/ /' | \
7284                          $sort | $sed -e 's/^.* //'`
7285                 eval set \$$#
7286         done
7287         $test -r $1 || set /usr/ccs/lib/libc.$so
7288         $test -r $1 || set /lib/libsys_s$_a
7289         ;;
7290 *)
7291         set blurfl
7292         ;;
7293 esac
7294 if $test -r "$1"; then
7295         echo "Your (shared) C library seems to be in $1."
7296         libc="$1"
7297 elif $test -r /lib/libc && $test -r /lib/clib; then
7298         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7299         xxx=apollo
7300         libc='/lib/clib /lib/libc'
7301         if $test -r /lib/syslib; then
7302                 echo "(Your math library is in /lib/syslib.)"
7303                 libc="$libc /lib/syslib"
7304         fi
7305 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7306         echo "Your C library seems to be in $libc, as you said before."
7307 elif $test -r $incpath/usr/lib/libc$_a; then
7308         libc=$incpath/usr/lib/libc$_a;
7309         echo "Your C library seems to be in $libc.  That's fine."
7310 elif $test -r /lib/libc$_a; then
7311         libc=/lib/libc$_a;
7312         echo "Your C library seems to be in $libc.  You're normal."
7313 else
7314         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7315                 :
7316         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7317                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7318         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7319                 :
7320         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7321                 :
7322         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7323                 :
7324         else
7325                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7326         fi
7327         if $test -r "$tans"; then
7328                 echo "Your C library seems to be in $tans, of all places."
7329                 libc=$tans
7330         else
7331                 libc='blurfl'
7332         fi
7333 fi
7334 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7335         dflt="$libc"
7336         cat <<EOM
7337
7338 If the guess above is wrong (which it might be if you're using a strange
7339 compiler, or your machine supports multiple models), you can override it here.
7340
7341 EOM
7342 else
7343         dflt=''
7344         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7345         cat >&4 <<EOM
7346 I can't seem to find your C library.  I've looked in the following places:
7347
7348 EOM
7349         $sed 's/^/      /' libpath
7350         cat <<EOM
7351
7352 None of these seems to contain your C library. I need to get its name...
7353
7354 EOM
7355 fi
7356 fn=f
7357 rp='Where is your C library?'
7358 . ./getfile
7359 libc="$ans"
7360
7361 echo " "
7362 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7363 set X `cat libnames`
7364 shift
7365 xxx=files
7366 case $# in 1) xxx=file; esac
7367 echo "Extracting names from the following $xxx for later perusal:" >&4
7368 echo " "
7369 $sed 's/^/      /' libnames >&4
7370 echo " "
7371 $echo $n "This may take a while...$c" >&4
7372
7373 for file in $*; do
7374         case $file in
7375         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7376         *) $nm $nm_opt $file 2>/dev/null;;
7377         esac
7378 done >libc.tmp
7379
7380 $echo $n ".$c"
7381 $grep fprintf libc.tmp > libc.ptf
7382 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7383 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7384 xxx='[ADTSIW]'
7385 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7386         eval $xscan;\
7387         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7388                 eval $xrun
7389 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7390         eval $xscan;\
7391         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7392                 eval $xrun
7393 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7394         eval $xscan;\
7395         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7396                 eval $xrun
7397 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7398         eval $xscan;\
7399         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7400                 eval $xrun
7401 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7402         eval $xscan;\
7403         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7404                 eval $xrun
7405 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7406         eval $xscan;\
7407         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7408                 eval $xrun
7409 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7410                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7411         eval $xscan;\
7412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7413                 eval $xrun
7414 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7415         eval $xscan;\
7416         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7417                 eval $xrun
7418 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7419         eval $xscan;\
7420         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7421                 eval $xrun
7422 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7423         eval $xscan;\
7424         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7425                 eval $xrun
7426 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7427         eval $xscan;\
7428         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7429                 eval $xrun
7430 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7431         eval $xscan;\
7432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7433                 eval $xrun
7434 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7435         eval $xscan;\
7436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7437                 eval $xrun
7438 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7439         eval $xscan;\
7440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7441                 eval $xrun
7442 else
7443         $nm -p $* 2>/dev/null >libc.tmp
7444         $grep fprintf libc.tmp > libc.ptf
7445         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7446                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7447         then
7448                 nm_opt='-p'
7449                 eval $xrun
7450         else
7451                 echo " "
7452                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7453                 com=''
7454                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7455                         for thisname in $libnames $libc; do
7456                                 $ar t $thisname >>libc.tmp
7457                         done
7458                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7459                         echo "Ok." >&4
7460                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7461                         # Repeat libc to extract forwarders to DLL entries too
7462                         for thisname in $libnames $libc; do
7463                                 $ar tv $thisname >>libc.tmp
7464                                 # Revision 50 of EMX has bug in $ar.
7465                                 # it will not extract forwarders to DLL entries
7466                                 # Use emximp which will extract exactly them.
7467                                 emximp -o tmp.imp $thisname \
7468                                     2>/dev/null && \
7469                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7470                                     < tmp.imp >>libc.tmp
7471                                 $rm tmp.imp
7472                         done
7473                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7474                         echo "Ok." >&4
7475                 else
7476                         echo "$ar didn't seem to work right." >&4
7477                         echo "Maybe this is a Cray...trying bld instead..." >&4
7478                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7479                         then
7480                                 for thisname in $libnames; do
7481                                         bld t $libnames | \
7482                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7483                                         $ar t $thisname >>libc.tmp
7484                                 done
7485                                 echo "Ok." >&4
7486                         else
7487                                 echo "That didn't work either.  Giving up." >&4
7488                                 exit 1
7489                         fi
7490                 fi
7491         fi
7492 fi
7493 nm_extract="$com"
7494 case "$PASE" in
7495 define)
7496     echo " "
7497     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7498     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7499     ;;
7500 *)  if $test -f /lib/syscalls.exp; then
7501         echo " "
7502         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7503         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7504     fi
7505     ;;
7506 esac
7507 ;;
7508 esac
7509 $rm -f libnames libpath
7510
7511 : see if dld is available
7512 set dld.h i_dld
7513 eval $inhdr
7514
7515 : is a C symbol defined?
7516 csym='tlook=$1;
7517 case "$3" in
7518 -v) tf=libc.tmp; tdc="";;
7519 -a) tf=libc.tmp; tdc="[]";;
7520 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7521 esac;
7522 tx=yes;
7523 case "$reuseval-$4" in
7524 true-) ;;
7525 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7526 esac;
7527 case "$tx" in
7528 yes)
7529         tval=false;
7530         if $test "$runnm" = true; then
7531                 if $contains $tlook $tf >/dev/null 2>&1; then
7532                         tval=true;
7533                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7534                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7535                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7536                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7537                         $rm -f try$_exe try.c core core.* try.core;
7538                 fi;
7539         else
7540                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7541                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7542                 $rm -f try$_exe try.c;
7543         fi;
7544         ;;
7545 *)
7546         case "$tval" in
7547         $define) tval=true;;
7548         *) tval=false;;
7549         esac;
7550         ;;
7551 esac;
7552 eval "$2=$tval"'
7553
7554 : define an is-in-libc? function
7555 inlibc='echo " "; td=$define; tu=$undef;
7556 sym=$1; var=$2; eval "was=\$$2";
7557 tx=yes;
7558 case "$reuseval$was" in
7559 true) ;;
7560 true*) tx=no;;
7561 esac;
7562 case "$tx" in
7563 yes)
7564         set $sym tres -f;
7565         eval $csym;
7566         case "$tres" in
7567         true)
7568                 echo "$sym() found." >&4;
7569                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7570         *)
7571                 echo "$sym() NOT found." >&4;
7572                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7573         esac;;
7574 *)
7575         case "$was" in
7576         $define) echo "$sym() found." >&4;;
7577         *) echo "$sym() NOT found." >&4;;
7578         esac;;
7579 esac'
7580
7581 : see if dlopen exists
7582 xxx_runnm="$runnm"
7583 runnm=false
7584 set dlopen d_dlopen
7585 eval $inlibc
7586 runnm="$xxx_runnm"
7587
7588 : determine which dynamic loading, if any, to compile in
7589 echo " "
7590 dldir="ext/DynaLoader"
7591 case "$usedl" in
7592 $define|y|true)
7593         dflt='y'
7594         usedl="$define"
7595         ;;
7596 $undef|n|false)
7597         dflt='n'
7598         usedl="$undef"
7599         ;;
7600 *) 
7601         dflt='n'
7602         case "$d_dlopen" in
7603             $define) dflt='y' ;;
7604         esac
7605         case "$i_dld" in
7606             $define) dflt='y' ;;
7607         esac
7608         : Does a dl_xxx.xs file exist for this operating system
7609         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7610         ;;
7611 esac
7612 rp="Do you wish to use dynamic loading?"
7613 . ./myread
7614 usedl="$ans"
7615 case "$ans" in
7616 y*) usedl="$define"
7617         case "$dlsrc" in
7618         '')
7619                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7620                         dflt="$dldir/dl_${osname}.xs"
7621                 elif $test "$d_dlopen" = "$define" ; then
7622                         dflt="$dldir/dl_dlopen.xs"
7623                 elif $test "$i_dld" = "$define" ; then
7624                         dflt="$dldir/dl_dld.xs"
7625                 else
7626                         dflt=''
7627                 fi
7628                 ;;
7629         *)      dflt="$dldir/$dlsrc"
7630                 ;;
7631         esac
7632     echo "The following dynamic loading files are available:"
7633         : Can not go over to $dldir because getfile has path hard-coded in.
7634         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7635         rp="Source file to use for dynamic loading"
7636         fn="fne"
7637         gfpth="$src"
7638         . ./getfile
7639         usedl="$define"
7640         : emulate basename
7641         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7642
7643         $cat << EOM
7644
7645 Some systems may require passing special flags to $cc -c to
7646 compile modules that will be used to create a shared library.
7647 To use no flags, say "none".
7648
7649 EOM
7650     case "$cccdlflags" in
7651     '') case "$gccversion" in
7652                 '') case "$osname" in
7653                         hpux)   dflt='+z' ;;
7654                         next)   dflt='none' ;;
7655                         irix*)  dflt='-KPIC' ;;
7656                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7657                         sunos)  dflt='-pic' ;;
7658                         *)      dflt='none' ;;
7659                     esac
7660                         ;;
7661                 *)  case "$osname" in
7662                         darwin) dflt='none' ;;
7663                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7664                         *)      dflt='-fpic' ;;
7665                     esac ;;
7666             esac ;;
7667         ' ') dflt='none' ;;
7668     *)  dflt="$cccdlflags" ;;
7669     esac
7670     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7671     . ./myread
7672     case "$ans" in
7673     none) cccdlflags=' ' ;;
7674     *) cccdlflags="$ans" ;;
7675     esac
7676
7677     cat << EOM
7678
7679 Some systems use ld to create libraries that can be dynamically loaded,
7680 while other systems (such as those using ELF) use $cc.
7681
7682 EOM
7683         case "$ld" in
7684         '')     $cat >try.c <<EOM
7685 /* Test for whether ELF binaries are produced */
7686 #include <fcntl.h>
7687 #$i_stdlib I_STDLIB
7688 #ifdef I_STDLIB
7689 #include <stdlib.h>
7690 #endif
7691 int main() {
7692         char b[4];
7693         int i = open("a.out",O_RDONLY);
7694         if(i == -1) 
7695                 exit(1); /* fail */
7696         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7697                 exit(0); /* succeed (yes, it's ELF) */
7698         else
7699                 exit(1); /* fail */
7700 }
7701 EOM
7702                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7703                         cat <<EOM
7704 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7705 EOM
7706                         dflt="$cc"
7707                 else
7708                         echo "I'll use ld to build dynamic libraries."
7709                         dflt='ld'
7710                 fi
7711                 rm -f try.c a.out
7712                 ;;
7713         *)      dflt="$ld"
7714                 ;;
7715         esac
7716
7717     rp="What command should be used to create dynamic libraries?"
7718     . ./myread
7719         ld="$ans"
7720
7721     cat << EOM
7722
7723 Some systems may require passing special flags to $ld to create a
7724 library that can be dynamically loaded.  If your ld flags include
7725 -L/other/path options to locate libraries outside your loader's normal
7726 search path, you may need to specify those -L options here as well.  To
7727 use no flags, say "none".
7728
7729 EOM
7730     case "$lddlflags" in
7731     '') case "$osname" in
7732                         beos) dflt='-nostart' ;;
7733                         hpux) dflt='-b';
7734                               case "$gccversion" in
7735                               '') dflt="$dflt +vnocompatwarnings" ;;
7736                               esac
7737                               ;;        
7738                         linux|irix*|gnu*)       dflt='-shared' ;;
7739                         next)  dflt='none' ;;
7740                         solaris) dflt='-G' ;;
7741                         sunos) dflt='-assert nodefinitions' ;;
7742                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7743                 *)     dflt='none' ;;
7744                         esac
7745                         ;;
7746     *) dflt="$lddlflags" ;;
7747     esac
7748
7749         : Try to guess additional flags to pick up local libraries.
7750         : Be careful not to append to a plain 'none'
7751         case "$dflt" in
7752         none) dflt='' ;;
7753         esac
7754         for thisflag in $ldflags; do
7755                 case "$thisflag" in
7756                 -L*|-R*|-Wl,-R*)
7757                         case " $dflt " in
7758                         *" $thisflag "*) ;;
7759                         *) dflt="$dflt $thisflag" ;;
7760                         esac
7761                         ;;
7762                 esac
7763         done
7764
7765         case "$dflt" in
7766         ''|' ') dflt='none' ;;
7767         esac
7768
7769     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7770     . ./myread
7771     case "$ans" in
7772     none) lddlflags=' ' ;;
7773     *) lddlflags="$ans" ;;
7774     esac
7775
7776         cat <<EOM
7777
7778 Some systems may require passing special flags to $cc to indicate that
7779 the resulting executable will use dynamic linking.  To use no flags,
7780 say "none".
7781
7782 EOM
7783     case "$ccdlflags" in
7784     '') case "$osname" in
7785             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7786             next|sunos) dflt='none' ;;
7787             *)          dflt='none' ;;
7788             esac ;;
7789     ' ')  dflt='none' ;;
7790     *)  dflt="$ccdlflags" ;;
7791     esac
7792     rp="Any special flags to pass to $cc to use dynamic linking?"
7793     . ./myread
7794     case "$ans" in
7795     none) ccdlflags=' ' ;;
7796     *) ccdlflags="$ans" ;;
7797     esac
7798     ;;
7799 *)  usedl="$undef"
7800         ld='ld'
7801     dlsrc='dl_none.xs'
7802     lddlflags=''
7803     ccdlflags=''
7804     ;;
7805 esac
7806
7807 also=''
7808 case "$usedl" in
7809 $undef)
7810         # No dynamic loading being used, so don't bother even to prompt.
7811         useshrplib='false'
7812         ;;
7813 *)      case "$useshrplib" in
7814         '')     case "$osname" in
7815                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7816                         dflt=y
7817                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7818                         ;;
7819                 next*)
7820                         case "$osvers" in
7821                         4*)     dflt=y
7822                                 also='Building a shared libperl is needed for MAB support.'
7823                                 ;;
7824                         *)      dflt=n
7825                                 ;;
7826                         esac
7827                         ;;
7828                 *)      dflt=n
7829                         ;;
7830                 esac
7831                 ;;
7832         $define|true|[Yy]*)
7833                 dflt=y
7834                 ;;
7835         *)      dflt=n
7836                 ;;
7837         esac
7838         $cat << EOM
7839
7840 The perl executable is normally obtained by linking perlmain.c with
7841 libperl${_a}, any static extensions (usually just DynaLoader), and
7842 any other libraries needed on this system (such as -lm, etc.).  Since
7843 your system supports dynamic loading, it is probably possible to build
7844 a shared libperl.$so.  If you will have more than one executable linked
7845 to libperl.$so, this will significantly reduce the size of each
7846 executable, but it may have a noticeable effect on performance.  The
7847 default is probably sensible for your system.
7848 $also
7849
7850 EOM
7851         rp="Build a shared libperl.$so (y/n)"
7852         . ./myread
7853         case "$ans" in
7854         true|$define|[Yy]*)
7855                 useshrplib='true'  ;;
7856         *)      useshrplib='false' ;;
7857         esac
7858         ;;
7859 esac
7860
7861 case "$useshrplib" in
7862 true)
7863         case "$libperl" in
7864         '')
7865                 # Figure out a good name for libperl.so.  Since it gets stored in
7866                 # a version-specific architecture-dependent library, the version
7867                 # number isn't really that important, except for making cc/ld happy.
7868                 #
7869                 # A name such as libperl.so.3.1
7870                 majmin="libperl.$so.$patchlevel.$subversion"
7871                 # A name such as libperl.so.301
7872                 majonly=`echo $patchlevel $subversion |
7873                         $awk '{printf "%d%02d", $1, $2}'`
7874                 majonly=libperl.$so.$majonly
7875                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7876                 # rely on figuring it out from the naming of libc.
7877                 case "${osname}${osvers}" in
7878                 next4*)
7879                         dflt=libperl.5.$so
7880                         # XXX How handle the --version stuff for MAB?
7881                         ;;
7882                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7883                         dflt=libperl.$so
7884                         ;;
7885                 cygwin*) # ld links against an importlib
7886                         dflt=libperl$lib_ext
7887                         ;;
7888                 *)      # Try to guess based on whether libc has major.minor.
7889                         case "$libc" in
7890                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7891                         *libc.$so.[0-9]*) dflt=$majonly ;;
7892                         *)      dflt=libperl.$so ;;
7893                         esac
7894                         ;;
7895                 esac
7896                 ;;
7897         *)      dflt=$libperl
7898                 ;;
7899         esac
7900         cat << EOM
7901
7902 I need to select a good name for the shared libperl.  If your system uses
7903 library names with major and minor numbers, then you might want something
7904 like $majmin.  Alternatively, if your system uses a single version
7905 number for shared libraries, then you might want to use $majonly.
7906 Or, your system might be quite happy with a simple libperl.$so.
7907
7908 Since the shared libperl will get installed into a version-specific
7909 architecture-dependent directory, the version number of the shared perl
7910 library probably isn't important, so the default should be o.k.
7911
7912 EOM
7913         rp='What name do you want to give to the shared libperl?'
7914         . ./myread
7915         libperl=$ans
7916         echo "Ok, I'll use $libperl"
7917         ;;
7918 *)
7919         libperl="libperl${_a}"
7920         ;;
7921 esac
7922
7923 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7924 case "$shrpdir" in
7925 '') ;;
7926 *)      $cat >&4 <<EOM
7927 WARNING:  Use of the shrpdir variable for the installation location of
7928 the shared $libperl is not supported.  It was never documented and
7929 will not work in this version.  Let me (perlbug@perl.org)
7930 know of any problems this may cause.
7931
7932 EOM
7933         case "$shrpdir" in
7934         "$archlibexp/CORE")
7935                 $cat >&4 <<EOM
7936 But your current setting of $shrpdir is
7937 the default anyway, so it's harmless.
7938 EOM
7939                 ;;
7940         *)
7941                 $cat >&4 <<EOM
7942 Further, your current attempted setting of $shrpdir
7943 conflicts with the value of $archlibexp/CORE
7944 that installperl will use.
7945 EOM
7946                 ;;
7947         esac
7948         ;;
7949 esac
7950
7951 # How will the perl executable find the installed shared $libperl?
7952 # Add $xxx to ccdlflags.
7953 # If we can't figure out a command-line option, use $shrpenv to
7954 # set env LD_RUN_PATH.  The main perl makefile uses this.
7955 shrpdir=$archlibexp/CORE
7956 xxx=''
7957 tmp_shrpenv=''
7958 if "$useshrplib"; then
7959     case "$osname" in 
7960         aix)
7961                 # We'll set it in Makefile.SH...
7962                 ;;
7963         solaris)
7964                 xxx="-R $shrpdir"
7965                 ;;
7966         freebsd|netbsd|openbsd|interix|dragonfly)
7967                 xxx="-Wl,-R$shrpdir"
7968                 ;;
7969         bsdos|linux|irix*|dec_osf|gnu*)
7970                 xxx="-Wl,-rpath,$shrpdir"
7971                 ;;
7972         next)
7973                 # next doesn't like the default...
7974                 ;;
7975         beos)
7976                 # beos doesn't like the default, either.
7977                 ;;
7978         hpux*)
7979                 # hpux doesn't like the default, either.
7980                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7981                 ;;
7982         *)
7983                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7984                 ;;
7985         esac
7986         case "$xxx" in
7987         '') ;;
7988         *)      
7989                 # Only add $xxx if it isn't already in ccdlflags.
7990                 case " $ccdlflags " in
7991                 *" $xxx "*)     ;;
7992                 *)      ccdlflags="$ccdlflags $xxx"
7993                         cat <<EOM >&4
7994
7995 Adding $xxx to the flags
7996 passed to $ld so that the perl executable will find the 
7997 installed shared $libperl.
7998
7999 EOM
8000                         ;;
8001                 esac
8002                 ;;
8003         esac
8004 fi
8005 # Fix ccdlflags in AIX for building external extensions.
8006 # (For building Perl itself bare -bE:perl.exp is needed,
8007 #  Makefile.SH takes care of this.)
8008 case "$osname" in
8009 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8010 esac
8011 # Respect a hint or command-line value.
8012 case "$shrpenv" in
8013 '') shrpenv="$tmp_shrpenv" ;;
8014 esac
8015 case "$ldlibpthname" in
8016 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8017 none)   ldlibpthname='' ;;
8018 esac
8019
8020 : determine where manual pages are on this system
8021 echo " "
8022 case "$sysman" in
8023 '') 
8024         syspath='/usr/share/man/man1 /usr/man/man1'
8025         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8026         syspath="$syspath /usr/man/u_man/man1"
8027         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8028         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8029         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8030         sysman=`./loc . /usr/man/man1 $syspath`
8031         ;;
8032 esac
8033 if $test -d "$sysman"; then
8034         echo "System manual is in $sysman." >&4
8035 else
8036         echo "Could not find manual pages in source form." >&4
8037 fi
8038
8039 : determine where manual pages go
8040 set man1dir man1dir none
8041 eval $prefixit
8042 $cat <<EOM
8043
8044 $spackage has manual pages available in source form.
8045 EOM
8046 case "$nroff" in
8047 nroff)
8048         echo "However, you don't have nroff, so they're probably useless to you."
8049         case "$man1dir" in
8050         '') man1dir="none";;
8051         esac;;
8052 esac
8053 echo "If you don't want the manual sources installed, answer 'none'."
8054 case "$man1dir" in
8055 ' ') dflt=none
8056         ;;
8057 '')
8058         lookpath="$prefixexp/share/man/man1"
8059         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8060         lookpath="$lookpath $prefixexp/man/p_man/man1"
8061         lookpath="$lookpath $prefixexp/man/u_man/man1"
8062         lookpath="$lookpath $prefixexp/man/man.1"
8063         case "$sysman" in
8064         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8065         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8066         esac
8067         set dflt
8068         eval $prefixup
8069         ;;
8070 *)  dflt="$man1dir"
8071         ;;
8072 esac
8073 echo " "
8074 fn=dn+~
8075 rp="Where do the main $spackage manual pages (source) go?"
8076 . ./getfile
8077 if $test "X$man1direxp" != "X$ansexp"; then
8078         installman1dir=''
8079 fi
8080 prefixvar=man1dir
8081 . ./setprefixvar
8082
8083 case "$man1dir" in
8084 '')     man1dir=' '
8085         installman1dir='';;
8086 esac
8087
8088 : What suffix to use on installed man pages
8089
8090 case "$man1dir" in
8091 ' ')
8092         man1ext='0'
8093         ;;
8094 *)
8095         rp="What suffix should be used for the main $spackage man pages?"
8096         case "$man1ext" in
8097         '')     case "$man1dir" in
8098                 *1)  dflt=1 ;;
8099                 *1p) dflt=1p ;;
8100                 *1pm) dflt=1pm ;;
8101                 *l) dflt=l;;
8102                 *n) dflt=n;;
8103                 *o) dflt=o;;
8104                 *p) dflt=p;;
8105                 *C) dflt=C;;
8106                 *L) dflt=L;;
8107                 *L1) dflt=L1;;
8108                 *) dflt=1;;
8109                 esac
8110                 ;;
8111         *)      dflt="$man1ext";;
8112         esac
8113         . ./myread
8114         man1ext="$ans"
8115         ;;
8116 esac
8117
8118 : see if we can have long filenames
8119 echo " "
8120 first=123456789abcdef
8121 $rm -f $first
8122 if (echo hi >$first) 2>/dev/null; then
8123         if $test -f 123456789abcde; then
8124                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8125                 val="$undef"
8126         else
8127                 echo 'You can have filenames longer than 14 characters.'>&4
8128                 val="$define"
8129         fi
8130 else
8131         $cat <<'EOM'
8132 You can't have filenames longer than 14 chars.
8133 You can't even think about them!
8134 EOM
8135         val="$undef"
8136 fi 
8137 set d_flexfnam
8138 eval $setvar
8139 $rm -rf 123456789abcde*
8140
8141 : determine where library module manual pages go
8142 set man3dir man3dir none
8143 eval $prefixit
8144 $cat <<EOM
8145
8146 $spackage has manual pages for many of the library modules.
8147 EOM
8148
8149 case "$nroff" in
8150 nroff)
8151         $cat <<'EOM'
8152 However, you don't have nroff, so they're probably useless to you.
8153 EOM
8154         case "$man3dir" in
8155         '') man3dir="none";;
8156         esac;;
8157 esac
8158
8159 case "$d_flexfnam" in
8160 undef)
8161         $cat <<'EOM'
8162 However, your system can't handle the long file names like File::Basename.3.
8163 EOM
8164         case "$man3dir" in
8165         '') man3dir="none";;
8166         esac;;
8167 esac
8168
8169 echo "If you don't want the manual sources installed, answer 'none'."
8170 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8171 case "$man3dir" in
8172 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8173         if $test -d "$privlib/man/man3"; then
8174                 cat <<EOM >&4
8175
8176 WARNING:  Previous versions of perl installed man3 pages into
8177 $privlib/man/man3.  This version will suggest a
8178 new default of $dflt.
8179 EOM
8180                 tdflt=$dflt
8181                 dflt='n'
8182                 rp='Do you wish to preserve the old behavior?(y/n)'
8183                 . ./myread
8184                 case "$ans" in
8185                 y*) dflt="$privlib/man/man3" ;;
8186                 *)  dflt=$tdflt ;;
8187                 esac
8188     fi
8189         ;;
8190 *)      dflt="$man3dir" ;;
8191 esac
8192 case "$dflt" in
8193 ' ') dflt=none ;;
8194 esac
8195 echo " "
8196 fn=dn+~
8197 rp="Where do the $package library man pages (source) go?"
8198 . ./getfile
8199 prefixvar=man3dir
8200 . ./setprefixvar
8201
8202 case "$man3dir" in
8203 '')     man3dir=' '
8204         installman3dir='';;
8205 esac
8206
8207 : What suffix to use on installed man pages
8208 case "$man3dir" in
8209 ' ')
8210         man3ext='0'
8211         ;;
8212 *)
8213         rp="What suffix should be used for the $package library man pages?"
8214         case "$man3ext" in
8215         '')     case "$man3dir" in
8216                 *3)  dflt=3 ;;
8217                 *3p) dflt=3p ;;
8218                 *3pm) dflt=3pm ;;
8219                 *l) dflt=l;;
8220                 *n) dflt=n;;
8221                 *o) dflt=o;;
8222                 *p) dflt=p;;
8223                 *C) dflt=C;;
8224                 *L) dflt=L;;
8225                 *L3) dflt=L3;;
8226                 *) dflt=3;;
8227                 esac
8228                 ;;
8229         *)      dflt="$man3ext";;
8230         esac
8231         . ./myread
8232         man3ext="$ans"
8233         ;;
8234 esac
8235
8236 : see if we have to deal with yellow pages, now NIS.
8237 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8238         if $test -f /usr/etc/nibindd; then
8239                 echo " "
8240                 echo "I'm fairly confident you're on a NeXT."
8241                 echo " "
8242                 rp='Do you get the hosts file via NetInfo?'
8243                 dflt=y
8244                 case "$hostcat" in
8245                 nidump*) ;;
8246                 '') ;;
8247                 *) dflt=n;;
8248                 esac
8249                 . ./myread
8250                 case "$ans" in
8251                 y*) hostcat='nidump hosts .';;
8252                 *)      case "$hostcat" in
8253                         nidump*) hostcat='';;
8254                         esac
8255                         ;;
8256                 esac
8257         fi
8258         case "$hostcat" in
8259         nidump*) ;;
8260         *)
8261                 case "$hostcat" in
8262                 *ypcat*) dflt=y;;
8263                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8264                                 dflt=y
8265                         else
8266                                 dflt=n
8267                         fi;;
8268                 *) dflt=n;;
8269                 esac
8270                 echo " "
8271                 rp='Are you getting the hosts file via yellow pages?'
8272                 . ./myread
8273                 case "$ans" in
8274                 y*) hostcat='ypcat hosts';;
8275                 *) hostcat='cat /etc/hosts';;
8276                 esac
8277                 ;;
8278         esac
8279 fi
8280 case "$hostcat" in
8281 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8282 esac
8283 case "$groupcat" in
8284 '') test -f /etc/group && groupcat='cat /etc/group';;
8285 esac
8286 case "$passcat" in
8287 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8288 esac
8289
8290 : now get the host name
8291 echo " "
8292 echo "Figuring out host name..." >&4
8293 case "$myhostname" in
8294 '') cont=true
8295         echo 'Maybe "hostname" will work...'
8296         if tans=`sh -c hostname 2>&1` ; then
8297                 myhostname=$tans
8298                 phostname=hostname
8299                 cont=''
8300         fi
8301         ;;
8302 *) cont='';;
8303 esac
8304 if $test "$cont"; then
8305         if ./xenix; then
8306                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8307                 if tans=`cat /etc/systemid 2>&1` ; then
8308                         myhostname=$tans
8309                         phostname='cat /etc/systemid'
8310                         echo "Whadyaknow.  Xenix always was a bit strange..."
8311                         cont=''
8312                 fi
8313         elif $test -r /etc/systemid; then
8314                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8315         fi
8316 fi
8317 if $test "$cont"; then
8318         echo 'No, maybe "uuname -l" will work...'
8319         if tans=`sh -c 'uuname -l' 2>&1` ; then
8320                 myhostname=$tans
8321                 phostname='uuname -l'
8322         else
8323                 echo 'Strange.  Maybe "uname -n" will work...'
8324                 if tans=`sh -c 'uname -n' 2>&1` ; then
8325                         myhostname=$tans
8326                         phostname='uname -n'
8327                 else
8328                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8329                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8330                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8331                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8332                         else
8333                                 case "$myhostname" in
8334                                 '') echo "Does this machine have an identity crisis or something?"
8335                                         phostname='';;
8336                                 *)
8337                                         echo "Well, you said $myhostname before..."
8338                                         phostname='echo $myhostname';;
8339                                 esac
8340                         fi
8341                 fi
8342         fi
8343 fi
8344 case "$myhostname" in
8345 '') myhostname=noname ;;
8346 esac
8347 : you do not want to know about this
8348 set $myhostname
8349 myhostname=$1
8350
8351 : verify guess
8352 if $test "$myhostname" ; then
8353         dflt=y
8354         rp='Your host name appears to be "'$myhostname'".'" Right?"
8355         . ./myread
8356         case "$ans" in
8357         y*) ;;
8358         *) myhostname='';;
8359         esac
8360 fi
8361
8362 : bad guess or no guess
8363 while $test "X$myhostname" = X ; do
8364         dflt=''
8365         rp="Please type the (one word) name of your host:"
8366         . ./myread
8367         myhostname="$ans"
8368 done
8369
8370 : translate upper to lower if necessary
8371 case "$myhostname" in
8372 *[A-Z]*)
8373         echo "(Normalizing case in your host name)"
8374         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8375         ;;
8376 esac
8377
8378 case "$myhostname" in
8379 *.*)
8380         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8381         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8382         echo "(Trimming domain name from host name--host name is now $myhostname)"
8383         ;;
8384 *) case "$mydomain" in
8385         '')
8386                 {
8387                         test "X$hostcat" = "Xypcat hosts" &&
8388                         ypmatch "$myhostname" hosts 2>/dev/null |\
8389                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8390                         $test -s hosts
8391                 } || {
8392                         test "X$hostcat" != "X" &&
8393                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8394                                         /[       ]$myhostname[  . ]/p" > hosts
8395                 }
8396                 tmp_re="[       . ]"
8397                 if $test -f hosts; then
8398                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8399                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8400                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8401                                 hosts | $sort | $uniq | \
8402                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8403                         case `$echo X$dflt` in
8404                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8405                                 dflt=.
8406                                 ;;
8407                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8408                                 ;;
8409                         esac
8410                 else
8411                         echo "(I cannot locate a hosts database anywhere)"
8412                         dflt=.
8413                 fi
8414                 case "$dflt" in
8415                 .)
8416                         tans=`./loc resolv.conf X /etc /usr/etc`
8417                         if $test -f "$tans"; then
8418                                 echo "(Attempting domain name extraction from $tans)"
8419                                 dflt=.`$sed -n -e 's/   / /g' \
8420                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8421                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8422                                 case "$dflt" in
8423                                 .) dflt=.`$sed -n -e 's/        / /g' \
8424                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8425                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8426                                         ;;
8427                                 esac
8428                         fi
8429                         ;;
8430                 esac
8431                 case "$dflt" in
8432                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8433                         dflt=.`sh -c domainname 2>/dev/null`
8434                         case "$dflt" in
8435                         '') dflt='.';;
8436                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8437                         esac
8438                         ;;
8439                 esac
8440                 case "$dflt$osname" in
8441                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8442                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8443                         ;;
8444                 esac
8445                 case "$dflt" in
8446                 .) echo "(Lost all hope -- silly guess then)"
8447                         dflt='.nonet'
8448                         ;;
8449                 esac
8450                 $rm -f hosts
8451                 ;;
8452         *) dflt="$mydomain";;
8453         esac;;
8454 esac
8455 echo " "
8456 rp="What is your domain name?"
8457 . ./myread
8458 tans="$ans"
8459 case "$ans" in
8460 '') ;;
8461 .*) ;;
8462 *) tans=".$tans";;
8463 esac
8464 mydomain="$tans"
8465
8466 : translate upper to lower if necessary
8467 case "$mydomain" in
8468 *[A-Z]*)
8469         echo "(Normalizing case in your domain name)"
8470         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8471         ;;
8472 esac
8473
8474 : a little sanity check here
8475 case "$phostname" in
8476 '') ;;
8477 *)
8478         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8479         $myhostname$mydomain|$myhostname) ;;
8480         *)
8481                 case "$phostname" in
8482                 sed*)
8483                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8484                         ;;
8485                 *)
8486                         echo "(That doesn't agree with your $phostname command, by the way.)"
8487                         ;;
8488                 esac
8489         ;;
8490         esac
8491         ;;
8492 esac
8493
8494 $cat <<EOM
8495
8496 I need to get your e-mail address in Internet format if possible, i.e.
8497 something like user@host.domain. Please answer accurately since I have
8498 no easy means to double check it. The default value provided below
8499 is most probably close to reality but may not be valid from outside
8500 your organization...
8501
8502 EOM
8503 cont=x
8504 while test "$cont"; do
8505         case "$cf_email" in
8506         '') dflt="$cf_by@$myhostname$mydomain";;
8507         *) dflt="$cf_email";;
8508         esac
8509         rp='What is your e-mail address?'
8510         . ./myread
8511         cf_email="$ans"
8512         case "$cf_email" in
8513         *@*.*) cont='' ;;
8514         *)
8515                 rp='Address does not look like an Internet one.  Use it anyway?'
8516                 case "$fastread" in
8517                 yes) dflt=y ;;
8518                 *) dflt=n ;;
8519                 esac
8520                 . ./myread
8521                 case "$ans" in
8522                 y*) cont='' ;;
8523                 *) echo " " ;;
8524                 esac
8525                 ;;
8526         esac
8527 done
8528
8529 $cat <<EOM
8530
8531 If you or somebody else will be maintaining perl at your site, please
8532 fill in the correct e-mail address here so that they may be contacted
8533 if necessary. Currently, the "perlbug" program included with perl
8534 will send mail to this address in addition to perlbug@perl.org. You may
8535 enter "none" for no administrator.
8536
8537 EOM
8538 case "$perladmin" in
8539 '') dflt="$cf_email";;
8540 *) dflt="$perladmin";;
8541 esac
8542 rp='Perl administrator e-mail address'
8543 . ./myread
8544 perladmin="$ans"
8545
8546 : determine whether to only install version-specific parts.
8547 echo " "
8548 $cat <<EOM
8549 Do you want to install only the version-specific parts of the perl
8550 distribution?  Usually you do *not* want to do this.
8551 EOM
8552 case "$versiononly" in
8553 "$define"|[Yy]*|true) dflt='y' ;;
8554 *) dflt='n';
8555 esac
8556 rp="Do you want to install only the version-specific parts of perl?"
8557 . ./myread
8558 case "$ans" in
8559 [yY]*)  val="$define";;
8560 *)      val="$undef" ;;
8561 esac
8562 set versiononly
8563 eval $setvar
8564
8565 case "$versiononly" in
8566 "$define") inc_version_list=''
8567            inc_version_list_init=0
8568            ;;
8569 esac
8570
8571 : figure out how to guarantee perl startup
8572 : XXX Note that this currently takes advantage of the bug that binexp ignores
8573 : the Configure -Dinstallprefix setting, which in turn means that under
8574 : relocatable @INC, initialinstalllocation is what binexp started as.
8575 case "$startperl" in
8576 '')
8577         case "$sharpbang" in
8578         *!)
8579                 $cat <<EOH
8580
8581 I can use the #! construct to start perl on your system. This will
8582 make startup of perl scripts faster, but may cause problems if you
8583 want to share those scripts and perl is not in a standard place
8584 ($initialinstalllocation/perl) on all your platforms. The alternative is to force
8585 a shell by starting the script with a single ':' character.
8586
8587 EOH
8588                 case "$versiononly" in
8589                 "$define")      dflt="$initialinstalllocation/perl$version";;  
8590                 *)              dflt="$initialinstalllocation/perl";;
8591                 esac
8592                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8593                 . ./myread
8594                 case "$ans" in
8595                 none)   startperl=": # use perl";;
8596                 *)      startperl="#!$ans"
8597                         if $test 30 -lt `echo "$ans" | wc -c`; then
8598                                 $cat >&4 <<EOM
8599
8600 WARNING:  Some systems limit the #! command to 32 characters.
8601 If you experience difficulty running Perl scripts with #!, try
8602 installing Perl in a directory with a shorter pathname.
8603
8604 EOM
8605                         fi ;;
8606                 esac
8607                 ;;
8608         *) startperl=": # use perl"
8609                 ;;
8610         esac
8611         ;;
8612 esac
8613 echo "I'll use $startperl to start perl scripts."
8614
8615 : figure best path for perl in scripts
8616 case "$perlpath" in
8617 '')
8618         case "$versiononly" in
8619         "$define")      perlpath="$initialinstalllocation/perl$version";;
8620         *)              perlpath="$initialinstalllocation/perl";;
8621         esac
8622         case "$startperl" in
8623         *!*) ;;
8624         *)
8625                 $cat <<EOH
8626
8627 I will use the "eval 'exec'" idiom to start Perl on your system.
8628 I can use the full path of your Perl binary for this purpose, but
8629 doing so may cause problems if you want to share those scripts and
8630 Perl is not always in a standard place ($initialinstalllocation/perl).
8631
8632 EOH
8633                 dflt="$initialinstalllocation/perl"
8634                 rp="What path shall I use in \"eval 'exec'\"?"
8635                 . ./myread
8636                 perlpath="$ans"
8637                 ;;
8638         esac
8639         ;;
8640 esac
8641 case "$startperl" in
8642 *!*)    ;;
8643 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8644 esac
8645
8646 : determine where public executable scripts go
8647 set scriptdir scriptdir
8648 eval $prefixit
8649 case "$scriptdir" in
8650 '')
8651         dflt="$bin"
8652         : guess some guesses
8653         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8654         $test -d /usr/share/bin     && dflt=/usr/share/bin
8655         $test -d /usr/local/script  && dflt=/usr/local/script
8656         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8657         $test -d $prefixexp/script  && dflt=$prefixexp/script
8658         set dflt
8659         eval $prefixup
8660         ;;
8661 *)  dflt="$scriptdir"
8662         ;;
8663 esac
8664 $cat <<EOM
8665
8666 Some installations have a separate directory just for executable scripts so
8667 that they can mount it across multiple architectures but keep the scripts in
8668 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8669 Or you might just lump your scripts in with all your other executables.
8670
8671 EOM
8672 fn=d~
8673 rp='Where do you keep publicly executable scripts?'
8674 . ./getfile
8675 if $test "X$ansexp" != "X$scriptdirexp"; then
8676         installscript=''
8677 fi
8678 installscriptdir=''
8679 prefixvar=scriptdir
8680 . ./setprefixvar
8681 : A little fix up for an irregularly named variable.
8682 installscript="$installscriptdir"
8683
8684 : determine where add-on public executables go
8685 case "$sitebin" in
8686 '')     dflt=$siteprefix/bin ;;
8687 *)      dflt=$sitebin ;;
8688 esac
8689 fn=d~
8690 rp='Pathname where the add-on public executables should be installed?'
8691 . ./getfile
8692 prefixvar=sitebin
8693 . ./setprefixvar
8694
8695 : determine where add-on html pages go
8696 : There is no standard location, so try to copy the previously-selected
8697 : directory structure for the core html pages.
8698 case "$sitehtml1dir" in
8699 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8700 *)     dflt=$sitehtml1dir ;;
8701 esac
8702 case "$dflt" in
8703 ''|' ') dflt=none ;;
8704 esac
8705 fn=dn+~
8706 rp='Pathname where the site-specific html pages should be installed?'
8707 . ./getfile
8708 prefixvar=sitehtml1dir
8709 . ./setprefixvar
8710
8711 : determine where add-on library html pages go
8712 : There is no standard location, so try to copy the previously-selected
8713 : directory structure for the core html pages.
8714 case "$sitehtml3dir" in
8715 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8716 *)     dflt=$sitehtml3dir ;;
8717 esac
8718 case "$dflt" in
8719 ''|' ') dflt=none ;;
8720 esac
8721 fn=dn+~
8722 rp='Pathname where the site-specific library html pages should be installed?'
8723 . ./getfile
8724 prefixvar=sitehtml3dir
8725 . ./setprefixvar
8726
8727 : determine where add-on manual pages go
8728 case "$siteman1dir" in
8729 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8730 *)      dflt=$siteman1dir ;;
8731 esac
8732 case "$dflt" in
8733 ''|' ') dflt=none ;;
8734 esac
8735 fn=dn+~
8736 rp='Pathname where the site-specific manual pages should be installed?'
8737 . ./getfile
8738 prefixvar=siteman1dir
8739 . ./setprefixvar
8740
8741 : determine where add-on library man pages go
8742 case "$siteman3dir" in
8743 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8744 *)      dflt=$siteman3dir ;;
8745 esac
8746 case "$dflt" in
8747 ''|' ') dflt=none ;;
8748 esac
8749 fn=dn+~
8750 rp='Pathname where the site-specific library manual pages should be installed?'
8751 . ./getfile
8752 prefixvar=siteman3dir
8753 . ./setprefixvar
8754
8755 : determine where add-on public executable scripts go
8756 case "$sitescript" in
8757 '')     dflt=$siteprefix/script
8758         $test -d $dflt || dflt=$sitebin ;;
8759 *)  dflt="$sitescript" ;;
8760 esac
8761 fn=d~+
8762 rp='Pathname where add-on public executable scripts should be installed?'
8763 . ./getfile
8764 prefixvar=sitescript
8765 . ./setprefixvar
8766
8767 case "$usefaststdio" in
8768 $define|true|[yY]*|'')
8769         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8770         case "$xversion" in
8771         [68])   dflt='y' ;;
8772         *)      dflt='n' ;;
8773         esac
8774         ;;
8775 *) dflt='n';;
8776 esac
8777 cat <<EOM
8778
8779 Perl can be built to use 'fast stdio', which means using the stdio
8780 library but also directly manipulating the stdio buffers to enable
8781 faster I/O.  Using stdio is better for backward compatibility (especially
8782 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8783 interface has been preferred instead of stdio.
8784
8785 If this doesn't make any sense to you, just accept the default '$dflt'.
8786 EOM
8787 rp='Use the "fast stdio" if available?'
8788 . ./myread
8789 case "$ans" in
8790 y|Y)    val="$define" ;;     
8791 *)      val="$undef" ;;
8792 esac
8793 set usefaststdio
8794 eval $setvar
8795
8796
8797 : define an is-a-typedef? function
8798 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8799 case "$inclist" in
8800 "") inclist="sys/types.h";;
8801 esac;
8802 eval "varval=\$$var";
8803 case "$varval" in
8804 "")
8805         $rm -f temp.c;
8806         for inc in $inclist; do
8807                 echo "#include <$inc>" >>temp.c;
8808         done;
8809         echo "#ifdef $type" >> temp.c;
8810         echo "printf(\"We have $type\");" >> temp.c;
8811         echo "#endif" >> temp.c;
8812         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8813         if $contains $type temp.E >/dev/null 2>&1; then
8814                 eval "$var=\$type";
8815         else
8816                 eval "$var=\$def";
8817         fi;
8818         $rm -f temp.?;;
8819 *) eval "$var=\$varval";;
8820 esac'
8821
8822 : define an is-a-typedef? function that prompts if the type is not available.
8823 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8824 case "$inclist" in
8825 "") inclist="sys/types.h";;
8826 esac;
8827 eval "varval=\$$var";
8828 case "$varval" in
8829 "")
8830         $rm -f temp.c;
8831         for inc in $inclist; do
8832                 echo "#include <$inc>" >>temp.c;
8833         done;
8834         echo "#ifdef $type" >> temp.c;
8835         echo "printf(\"We have $type\");" >> temp.c;
8836         echo "#endif" >> temp.c;
8837         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8838         echo " " ;
8839         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8840         if $contains $type temp.E >/dev/null 2>&1; then
8841                 echo "$type found." >&4;
8842                 eval "$var=\$type";
8843         else
8844                 echo "$type NOT found." >&4;
8845                 dflt="$def";
8846                 . ./myread ;
8847                 eval "$var=\$ans";
8848         fi;
8849         $rm -f temp.?;;
8850 *) eval "$var=\$varval";;
8851 esac'
8852
8853 : see what type lseek is declared as in the kernel
8854 rp="What is the type used for lseek's offset on this system?"
8855 set off_t lseektype long stdio.h sys/types.h
8856 eval $typedef_ask
8857
8858 echo " "
8859 echo "Checking to see how big your file offsets are..." >&4
8860 $cat >try.c <<EOCP
8861 #include <sys/types.h>
8862 #include <stdio.h>
8863 int main()
8864 {
8865     printf("%d\n", (int)sizeof($lseektype));
8866     return(0); 
8867 }
8868 EOCP
8869 set try
8870 if eval $compile_ok; then
8871         lseeksize=`$run ./try`
8872         echo "Your file offsets are $lseeksize bytes long."
8873 else
8874         dflt=$longsize
8875         echo " "
8876         echo "(I can't seem to compile the test program.  Guessing...)"
8877         rp="What is the size of your file offsets (in bytes)?"
8878         . ./myread
8879         lseeksize="$ans"
8880 fi
8881 $rm -f try.c try
8882
8883 : see what type file positions are declared as in the library
8884 rp="What is the type for file position used by fsetpos()?"
8885 set fpos_t fpostype long stdio.h sys/types.h
8886 eval $typedef_ask
8887
8888 echo " "
8889 case "$fpostype" in
8890 *_t) zzz="$fpostype"    ;;
8891 *)   zzz="fpos_t"       ;;
8892 esac
8893 echo "Checking the size of $zzz..." >&4 
8894 cat > try.c <<EOCP
8895 #include <sys/types.h>
8896 #include <stdio.h>
8897 #$i_stdlib I_STDLIB
8898 #ifdef I_STDLIB
8899 #include <stdlib.h>
8900 #endif
8901 int main() {
8902     printf("%d\n", (int)sizeof($fpostype));
8903     exit(0);
8904 }
8905 EOCP
8906 set try
8907 if eval $compile_ok; then
8908         yyy=`$run ./try`
8909         case "$yyy" in
8910         '')     fpossize=4
8911                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8912                 ;;
8913         *)      fpossize=$yyy
8914                 echo "Your $zzz is $fpossize bytes long."
8915                 ;;
8916         esac
8917 else
8918         dflt="$longsize"
8919         echo " " >&4
8920         echo "(I can't compile the test program.  Guessing...)" >&4
8921         rp="What is the size of your file positions (in bytes)?"
8922         . ./myread
8923         fpossize="$ans"
8924 fi
8925
8926 # Backward compatibility (uselfs is deprecated).
8927 case "$uselfs" in
8928 "$define"|true|[yY]*)
8929         cat <<EOM >&4
8930
8931 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8932 EOM
8933         uselargefiles="$define"
8934         ;;
8935 esac                          
8936
8937 case "$lseeksize:$fpossize" in
8938 8:8) cat <<EOM
8939
8940 You can have files larger than 2 gigabytes.
8941 EOM
8942    val="$define" ;;
8943 *)    case "$uselargefiles" in
8944    "$undef"|false|[nN]*) dflt='n' ;;
8945    *)   dflt='y' ;;
8946    esac
8947    cat <<EOM
8948
8949 Perl can be built to understand large files (files larger than 2 gigabytes)
8950 on some systems.  To do so, Configure can be run with -Duselargefiles.
8951
8952 If this doesn't make any sense to you, just accept the default '$dflt'.
8953 EOM
8954    rp='Try to understand large files, if available?'
8955    . ./myread
8956    case "$ans" in
8957    y|Y)         val="$define" ;;
8958    *)           val="$undef"  ;;
8959    esac
8960    ;;
8961 esac
8962 set uselargefiles
8963 eval $setvar
8964 : Look for a hint-file generated 'call-back-unit'.  If the
8965 : user has specified that a large files perl is to be built,
8966 : we may need to set or change some other defaults.
8967 if $test -f uselargefiles.cbu; then
8968         echo "Your platform has some specific hints regarding large file builds, using them..."
8969         . ./uselargefiles.cbu
8970 fi
8971 case "$uselargefiles" in
8972 "$define")
8973         if $test -f uselargefiles.cbu; then
8974                 echo " "
8975                 echo "Rechecking to see how big your file offsets are..." >&4
8976                 $cat >try.c <<EOCP
8977 #include <sys/types.h>
8978 #include <stdio.h>
8979 int main()
8980 {
8981     printf("%d\n", (int)sizeof($lseektype));
8982     return(0); 
8983 }
8984 EOCP
8985                 set try
8986                 if eval $compile_ok; then
8987                         lseeksize=`$run ./try`
8988                         $echo "Your file offsets are now $lseeksize bytes long."
8989                 else
8990                         dflt="$lseeksize"
8991                         echo " "
8992                         echo "(I can't seem to compile the test program.  Guessing...)"
8993                         rp="What is the size of your file offsets (in bytes)?"
8994                         . ./myread
8995                         lseeksize="$ans"
8996                 fi
8997                 case "$fpostype" in
8998                 *_t) zzz="$fpostype"    ;;
8999                 *)   zzz="fpos_t"       ;;
9000                 esac
9001                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9002                 $cat > try.c <<EOCP
9003 #include <sys/types.h>
9004 #include <stdio.h>
9005 #$i_stdlib I_STDLIB
9006 #ifdef I_STDLIB
9007 #include <stdlib.h>
9008 #endif
9009 int main() {
9010     printf("%d\n", (int)sizeof($fpostype));
9011     return(0);
9012 }
9013 EOCP
9014                 set try
9015                 if eval $compile_ok; then
9016                         yyy=`$run ./try`
9017                         dflt="$lseeksize"
9018                         case "$yyy" in
9019                         '')     echo " "
9020                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9021                                 ;;
9022                         *)      fpossize=$yyy
9023                                 echo " $fpossize bytes." >&4
9024                                 ;;
9025                         esac
9026                 else
9027                         dflt="$fpossize"
9028                         echo " "
9029                         echo "(I can't compile the test program.  Guessing...)" >&4
9030                         rp="What is the size of your file positions (in bytes)?"
9031                         . ./myread
9032                         fpossize="$ans"
9033                 fi
9034                 $rm -f try.c try
9035         fi
9036         ;;
9037 esac
9038
9039 case "$vendorprefix" in
9040 '')     d_vendorbin="$undef"
9041         vendorbin=''
9042         vendorbinexp=''
9043         ;;
9044 *)      d_vendorbin="$define"
9045         : determine where vendor-supplied executables go.
9046         case "$vendorbin" in
9047         '') dflt=$vendorprefix/bin ;;
9048         *)      dflt="$vendorbin" ;;
9049         esac
9050         fn=d~+
9051         rp='Pathname for the vendor-supplied executables directory?'
9052         . ./getfile
9053         vendorbin="$ans"
9054         vendorbinexp="$ansexp"
9055         ;;
9056 esac
9057 prefixvar=vendorbin
9058 . ./installprefix
9059
9060 case "$vendorprefix" in
9061 '')     vendorhtml1dir=''
9062         vendorhtml1direxp=''
9063         ;;
9064 *)      : determine where vendor-supplied html pages go.
9065         : There is no standard location, so try to copy the previously-selected
9066         : directory structure for the core html pages.
9067         : XXX Better default suggestions would be welcome.
9068         case "$vendorhtml1dir" in
9069         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9070         *)      dflt=$vendorhtml1dir ;;
9071         esac
9072         case "$dflt" in
9073         ''|' ') dflt=none ;;
9074         esac
9075         fn=dn+~
9076         rp='Pathname for the vendor-supplied html pages?'
9077         . ./getfile
9078         vendorhtml1dir="$ans"
9079         vendorhtml1direxp="$ansexp"
9080         ;;
9081 esac
9082 : Use ' ' for none so value is preserved next time through Configure
9083 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9084 prefixvar=vendorhtml1dir
9085 . ./installprefix
9086
9087 case "$vendorprefix" in
9088 '')     vendorhtml3dir=''
9089         vendorhtml3direxp=''
9090         ;;
9091 *)      : determine where vendor-supplied module html pages go.
9092         : There is no standard location, so try to copy the previously-selected
9093         : directory structure for the core html pages.
9094         : XXX Better default suggestions would be welcome.
9095         case "$vendorhtml3dir" in
9096         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9097         *)      dflt=$vendorhtml3dir ;;
9098         esac
9099         case "$dflt" in
9100         ''|' ') dflt=none ;;
9101         esac
9102         fn=dn+~
9103         rp='Pathname for the vendor-supplied html pages?'
9104         . ./getfile
9105         vendorhtml3dir="$ans"
9106         vendorhtml3direxp="$ansexp"
9107         ;;
9108 esac
9109 : Use ' ' for none so value is preserved next time through Configure
9110 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9111 prefixvar=vendorhtml3dir
9112 . ./installprefix
9113
9114 case "$vendorprefix" in
9115 '')     vendorman1dir=''
9116         vendorman1direxp=''
9117         ;;
9118 *)      : determine where vendor-supplied manual pages go.
9119         case "$vendorman1dir" in
9120         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9121         *)      dflt=$vendorman1dir ;;
9122         esac
9123         case "$dflt" in
9124         ''|' ') dflt=none ;;
9125         esac
9126         fn=nd~+
9127         rp='Pathname for the vendor-supplied manual section 1 pages?'
9128         . ./getfile
9129         vendorman1dir="$ans"
9130         vendorman1direxp="$ansexp"
9131         ;;
9132 esac
9133 : Use ' ' for none so value is preserved next time through Configure
9134 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9135 prefixvar=vendorman1dir
9136 . ./installprefix
9137
9138 case "$vendorprefix" in
9139 '')     vendorman3dir=''
9140         vendorman3direxp=''
9141         ;;
9142 *)      : determine where vendor-supplied module manual pages go.
9143         case "$vendorman3dir" in
9144         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9145         *)      dflt=$vendorman3dir ;;
9146         esac
9147         case "$dflt" in
9148         ''|' ') dflt=none ;;
9149         esac
9150         fn=nd~+
9151         rp='Pathname for the vendor-supplied manual section 3 pages?'
9152         . ./getfile
9153         vendorman3dir="$ans"
9154         vendorman3direxp="$ansexp"
9155         ;;
9156 esac
9157 : Use ' ' for none so value is preserved next time through Configure
9158 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9159 prefixvar=vendorman3dir
9160 . ./installprefix
9161
9162 case "$vendorprefix" in
9163 '')     d_vendorscript="$undef"
9164         vendorscript=''
9165         vendorscriptexp=''
9166         ;;
9167 *)      d_vendorscript="$define"
9168         : determine where vendor-supplied scripts go.
9169         case "$vendorscript" in
9170         '')     dflt=$vendorprefix/script
9171                 $test -d $dflt || dflt=$vendorbin ;;
9172         *)  dflt="$vendorscript" ;;
9173         esac
9174         $cat <<EOM
9175
9176 The installation process will create a directory for
9177 vendor-supplied scripts.
9178
9179 EOM
9180         fn=d~+
9181         rp='Pathname for the vendor-supplied scripts directory?'
9182         . ./getfile
9183         vendorscript="$ans"
9184         vendorscriptexp="$ansexp"
9185         ;;
9186 esac
9187 prefixvar=vendorscript
9188 . ./installprefix
9189
9190 : see if qgcvt exists
9191 set qgcvt d_qgcvt
9192 eval $inlibc
9193
9194 echo " "
9195
9196 if $test X"$d_longdbl" = X"$define"; then
9197
9198 echo "Checking how to print long doubles..." >&4
9199
9200 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9201         $cat >try.c <<'EOCP'
9202 #include <sys/types.h>
9203 #include <stdio.h>
9204 int main() {
9205   double d = 123.456;
9206   printf("%.3f\n", d);
9207 }
9208 EOCP
9209         set try
9210         if eval $compile; then
9211                 yyy=`$run ./try`
9212                 case "$yyy" in
9213                 123.456)
9214                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9215                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9216                         echo "We will use %f."
9217                         ;;
9218                 esac
9219         fi
9220 fi
9221
9222 if $test X"$sPRIfldbl" = X; then
9223         $cat >try.c <<'EOCP'
9224 #include <sys/types.h>
9225 #include <stdio.h>
9226 int main() {
9227   long double d = 123.456;
9228   printf("%.3Lf\n", d);
9229 }
9230 EOCP
9231         set try
9232         if eval $compile; then
9233                 yyy=`$run ./try`
9234                 case "$yyy" in
9235                 123.456)
9236                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9237                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9238                         echo "We will use %Lf."
9239                         ;;
9240                 esac
9241         fi
9242 fi
9243
9244 if $test X"$sPRIfldbl" = X; then
9245         $cat >try.c <<'EOCP'
9246 #include <sys/types.h>
9247 #include <stdio.h>
9248 int main() {
9249   long double d = 123.456;
9250   printf("%.3llf\n", d);
9251 }
9252 EOCP
9253         set try
9254         if eval $compile; then
9255                 yyy=`$run ./try`
9256                 case "$yyy" in
9257                 123.456)
9258                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9259                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9260                         echo "We will use %llf."
9261                         ;;
9262                 esac
9263         fi
9264 fi
9265
9266 if $test X"$sPRIfldbl" = X; then
9267         $cat >try.c <<'EOCP'
9268 #include <sys/types.h>
9269 #include <stdio.h>
9270 int main() {
9271   long double d = 123.456;
9272   printf("%.3lf\n", d);
9273 }
9274 EOCP
9275         set try
9276         if eval $compile; then
9277                 yyy=`$run ./try`
9278                 case "$yyy" in
9279                 123.456)
9280                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9281                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9282                         echo "We will use %lf."
9283                         ;;
9284                 esac
9285         fi
9286 fi
9287
9288 if $test X"$sPRIfldbl" = X; then
9289         echo "Cannot figure out how to print long doubles." >&4
9290 else
9291         sSCNfldbl=$sPRIfldbl    # expect consistency
9292 fi
9293
9294 $rm -f try try.*
9295
9296 fi # d_longdbl
9297
9298 case "$sPRIfldbl" in
9299 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9300         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9301         d_SCNfldbl="$undef";
9302         ;;
9303 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9304         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9305         d_SCNfldbl="$define";
9306         ;;
9307 esac
9308
9309 : Check how to convert floats to strings.
9310
9311 if test "X$d_Gconvert" = X; then
9312
9313 echo " "
9314 echo "Checking for an efficient way to convert floats to strings."
9315 echo " " > try.c
9316 case "$uselongdouble" in
9317 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9318 esac
9319 case "$d_longdbl" in
9320 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9321 esac
9322 case "$d_PRIgldbl" in
9323 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9324 esac
9325 $cat >>try.c <<EOP
9326 #ifdef TRY_gconvert
9327 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9328 char *myname = "gconvert";
9329 #endif
9330 #ifdef TRY_gcvt
9331 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9332 char *myname = "gcvt";
9333 #endif
9334 #ifdef TRY_qgcvt
9335 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9336 char *myname = "qgcvt";
9337 #define DOUBLETYPE long double
9338 #endif
9339 #ifdef TRY_sprintf
9340 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9341 #ifdef HAS_PRIgldbl
9342 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9343 #else
9344 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9345 #endif
9346 #else
9347 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9348 #endif
9349 char *myname = "sprintf";
9350 #endif
9351
9352 #ifndef DOUBLETYPE
9353 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9354 #define DOUBLETYPE long double
9355 #else
9356 #define DOUBLETYPE double
9357 #endif
9358 #endif
9359
9360 #include <stdio.h>
9361
9362 #define I_STDLIB $i_stdlib
9363 #ifdef I_STDLIB
9364 #include <stdlib.h>
9365 #endif
9366
9367 int
9368 checkit(expect, got)
9369 char *expect;
9370 char *got;
9371 {
9372     if (strcmp(expect, got)) {
9373                 printf("%s oddity:  Expected %s, got %s\n",
9374                         myname, expect, got);
9375                 exit(1);
9376         }
9377 }
9378
9379 int main()
9380
9381         char buf[64]; 
9382         buf[63] = '\0';
9383
9384         /* This must be 1st test on (which?) platform */
9385         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9386         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9387         checkit("0.1", buf);
9388
9389         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9390         checkit("0.01", buf);
9391
9392         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9393         checkit("0.001", buf);
9394
9395         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9396         checkit("0.0001", buf);
9397
9398         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9399         if (strlen(buf) > 5)
9400             checkit("9e-005", buf); /* for Microsoft ?? */
9401         else
9402             checkit("9e-05", buf);
9403
9404         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9405         checkit("1", buf);
9406
9407         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9408         checkit("1.1", buf);
9409
9410         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9411         checkit("1.01", buf);
9412
9413         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9414         checkit("1.001", buf);
9415
9416         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9417         checkit("1.0001", buf);
9418
9419         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9420         checkit("1.00001", buf);
9421
9422         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9423         checkit("1.000001", buf);
9424
9425         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9426         checkit("0", buf);
9427
9428         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9429         checkit("-1", buf);
9430
9431         /* Some Linux gcvt's give 1.e+5 here. */
9432         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9433         checkit("100000", buf);
9434         
9435         /* Some Linux gcvt's give -1.e+5 here. */
9436         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9437         checkit("-100000", buf);
9438
9439         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9440         checkit("123.456", buf);
9441
9442         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9443         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9444         /* 34 should be enough to scare even long double
9445          * places into using the e notation. */
9446         if (strlen(buf) > 5)
9447             checkit("1e+034", buf); /* for Microsoft */
9448         else
9449             checkit("1e+34", buf);
9450
9451         /* For Perl, if you add additional tests here, also add them to
9452          * t/base/num.t for benefit of platforms not using Configure or
9453          * overriding d_Gconvert */
9454
9455         exit(0);
9456 }
9457 EOP
9458 : first add preferred functions to our list
9459 xxx_list=""
9460 for xxx_convert in $gconvert_preference; do
9461     case $xxx_convert in
9462     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9463     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9464     esac 
9465 done
9466 : then add any others
9467 for xxx_convert in gconvert gcvt sprintf; do
9468     case "$xxx_list" in
9469     *$xxx_convert*) ;;
9470     *) xxx_list="$xxx_list $xxx_convert" ;;
9471     esac 
9472 done
9473
9474 case "$d_longdbl$uselongdouble" in
9475 "$define$define")
9476     : again, add prefered functions to our list first
9477     xxx_ld_list=""
9478     for xxx_convert in $gconvert_ld_preference; do
9479         case $xxx_convert in
9480         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9481         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9482         esac
9483     done
9484     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9485     for xxx_convert in qgcvt sprintf $xxx_list; do
9486         case "$xxx_ld_list" in
9487         $xxx_convert*|*" $xxx_convert"*) ;;
9488         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9489         esac
9490     done
9491     : if sprintf cannot do long doubles, move it to the end
9492     if test "$d_PRIgldbl" != "$define"; then
9493         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9494     fi
9495     : if no qgcvt, remove it
9496     if test "$d_qgcvt" != "$define"; then
9497         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9498     fi
9499     : use the ld_list
9500     xxx_list="$xxx_ld_list"
9501     ;;
9502 esac
9503
9504 for xxx_convert in $xxx_list; do
9505         echo "Trying $xxx_convert..."
9506         $rm -f try try$_o
9507         set try -DTRY_$xxx_convert
9508         if eval $compile; then
9509                 echo "$xxx_convert() found." >&4
9510                 if $run ./try; then
9511                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9512                         break;
9513                 else
9514                         echo "...But $xxx_convert didn't work as I expected."
9515                         xxx_convert=''
9516                 fi
9517         else
9518                 echo "$xxx_convert NOT found." >&4
9519         fi
9520 done
9521
9522 if test X$xxx_convert = X; then
9523     echo "*** WHOA THERE!!! ***" >&4
9524     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9525     xxx_convert=sprintf
9526 fi
9527
9528 case "$xxx_convert" in
9529 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9530 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9531 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9532 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9533    "$define$define$define")
9534       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9535    "$define$define$undef")
9536       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9537    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9538    esac
9539    ;;  
9540 esac
9541
9542 fi
9543
9544 : see if _fwalk exists
9545 set fwalk d__fwalk
9546 eval $inlibc
9547
9548 : Initialize h_fcntl
9549 h_fcntl=false
9550
9551 : Initialize h_sysfile
9552 h_sysfile=false
9553
9554 : access call always available on UNIX
9555 set access d_access
9556 eval $inlibc
9557
9558 : locate the flags for 'access()'
9559 case "$d_access" in
9560 "$define")
9561         echo " "
9562         $cat >access.c <<EOCP
9563 #include <sys/types.h>
9564 #ifdef I_FCNTL
9565 #include <fcntl.h>
9566 #endif
9567 #ifdef I_SYS_FILE
9568 #include <sys/file.h>
9569 #endif
9570 #ifdef I_UNISTD
9571 #include <unistd.h>
9572 #endif
9573 #$i_stdlib I_STDLIB
9574 #ifdef I_STDLIB
9575 #include <stdlib.h>
9576 #endif
9577 int main() {
9578         exit(R_OK);
9579 }
9580 EOCP
9581         : check sys/file.h first, no particular reason here
9582         if $test `./findhdr sys/file.h` && \
9583                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9584                 h_sysfile=true;
9585                 echo "<sys/file.h> defines the *_OK access constants." >&4
9586         elif $test `./findhdr fcntl.h` && \
9587                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9588                 h_fcntl=true;
9589                 echo "<fcntl.h> defines the *_OK access constants." >&4
9590         elif $test `./findhdr unistd.h` && \
9591                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9592                 echo "<unistd.h> defines the *_OK access constants." >&4
9593         else
9594                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9595         fi
9596         ;;
9597 esac
9598 $rm -f access*
9599
9600 : see if accessx exists
9601 set accessx d_accessx
9602 eval $inlibc
9603
9604 : see if aintl exists
9605 set aintl d_aintl
9606 eval $inlibc
9607
9608 : see if alarm exists
9609 set alarm d_alarm
9610 eval $inlibc
9611
9612 : see if POSIX threads are available
9613 set pthread.h i_pthread
9614 eval $inhdr
9615
9616 : define a fucntion to check prototypes
9617 $cat > protochk <<EOSH
9618 $startsh
9619 cc="$cc"
9620 optimize="$optimize"
9621 ccflags="$ccflags"
9622 prototype="$prototype"
9623 define="$define"
9624 rm=$rm
9625 usethreads=$usethreads
9626 i_pthread=$i_pthread
9627 pthread_h_first=$pthread_h_first
9628 EOSH
9629
9630 $cat >> protochk <<'EOSH'
9631
9632 $rm -f try.c
9633 foo="$1"
9634 shift
9635 while test $# -ge 2; do
9636         case "$1" in
9637                 $define) echo "#include <$2>" >> try.c ;;
9638                 literal) echo "$2" >> try.c ;;
9639         esac
9640     # Extra magic for the benefit of systems that need pthread.h
9641     # to be included early to correctly detect threadsafe functions.
9642     # Such functions must guarantee themselves, though, that the usethreads
9643     # and i_pthread have been defined, before calling protochk.
9644     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9645         echo "#include <pthread.h>" >> try.c
9646         pthread_h_done=yes
9647     fi
9648     shift 2
9649 done
9650 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9651 cat >> try.c <<'EOCP'
9652 #ifdef CAN_PROTOTYPE
9653 #define _(args) args
9654 #else
9655 #define _(args) ()
9656 #endif
9657 EOCP
9658 echo "$foo" >> try.c
9659 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9660 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9661 status=$?
9662 $rm -f try.[co]
9663 exit $status
9664 EOSH
9665 chmod +x protochk
9666 $eunicefix protochk
9667
9668 hasproto='varname=$1; func=$2; shift; shift;
9669 while $test $# -ge 2; do
9670         case "$1" in
9671         $define) echo "#include <$2>";;
9672         esac ;
9673     shift 2;
9674 done > try.c;
9675 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9676 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9677         echo "$func() prototype found.";
9678         val="$define";
9679 else
9680         echo "$func() prototype NOT found.";
9681         val="$undef";
9682 fi;
9683 set $varname;
9684 eval $setvar;
9685 $rm -f try.c tryout.c'
9686
9687 : see if sys/types.h has to be included
9688 set sys/types.h i_systypes
9689 eval $inhdr
9690
9691 : see if sys/select.h has to be included
9692 set sys/select.h i_sysselct
9693 eval $inhdr
9694
9695 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9696 while $test $# -ge 2; do
9697         case "$1" in
9698         $define) echo "#include <$2>";;
9699         esac ;
9700     shift 2;
9701 done > try.c;
9702 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9703 set try;
9704 if eval $compile; then
9705         val="$define";
9706 else
9707         val="$undef";
9708 fi;
9709 set $varname;
9710 eval $setvar;
9711 $rm -f try.c try.o'
9712
9713 : see if we should include time.h, sys/time.h, or both
9714 echo " "
9715 if test "X$timeincl" = X; then
9716         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9717         $echo $n "I'm now running the test program...$c"
9718         $cat >try.c <<EOCP
9719 #include <sys/types.h>
9720 #ifdef I_TIME
9721 #include <time.h>
9722 #endif
9723 #ifdef I_SYSTIME
9724 #ifdef SYSTIMEKERNEL
9725 #define KERNEL
9726 #endif
9727 #include <sys/time.h>
9728 #endif
9729 #ifdef I_SYSSELECT
9730 #include <sys/select.h>
9731 #endif
9732 #$i_stdlib I_STDLIB
9733 #ifdef I_STDLIB
9734 #include <stdlib.h>
9735 #endif
9736 int main()
9737 {
9738         struct tm foo;
9739 #ifdef S_TIMEVAL
9740         struct timeval bar;
9741 #endif
9742 #ifdef S_TIMEZONE
9743         struct timezone tzp;
9744 #endif
9745         if (foo.tm_sec == foo.tm_sec)
9746                 exit(0);
9747 #ifdef S_TIMEVAL
9748         if (bar.tv_sec == bar.tv_sec)
9749                 exit(0);
9750 #endif
9751         exit(1);
9752 }
9753 EOCP
9754         flags=''
9755         for s_timezone in '-DS_TIMEZONE' ''; do
9756         sysselect=''
9757         for s_timeval in '-DS_TIMEVAL' ''; do
9758         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9759         for i_time in '' '-DI_TIME'; do
9760         for i_systime in '-DI_SYSTIME' ''; do
9761                 case "$flags" in
9762                 '') $echo $n ".$c"
9763                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9764                         if eval $compile; then
9765                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9766                                 shift
9767                                 flags="$*"
9768                                 echo " "
9769                                 $echo $n "Succeeded with $flags$c"
9770                         fi
9771                         ;;
9772                 esac
9773         done
9774         done
9775         done
9776         done
9777         done
9778         timeincl=''
9779         echo " "
9780         case "$flags" in
9781         *SYSTIMEKERNEL*) i_systimek="$define"
9782                 timeincl=`./findhdr sys/time.h`
9783                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9784         *) i_systimek="$undef";;
9785         esac
9786         case "$flags" in
9787         *I_TIME*) i_time="$define"
9788                 timeincl=`./findhdr time.h`" $timeincl"
9789                 echo "We'll include <time.h>." >&4;;
9790         *) i_time="$undef";;
9791         esac
9792         case "$flags" in
9793         *I_SYSTIME*) i_systime="$define"
9794                 timeincl=`./findhdr sys/time.h`" $timeincl"
9795                 echo "We'll include <sys/time.h>." >&4;;
9796         *) i_systime="$undef";;
9797         esac
9798         $rm -f try.c try
9799 fi
9800 : see if struct tm knows about tm_zone
9801 case "$i_systime$i_time" in
9802 *$define*) 
9803         echo " "
9804         echo "Checking to see if your struct tm has tm_zone field..." >&4
9805         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9806         eval $hasfield
9807         ;;
9808 *)      val="$undef"
9809         set d_tm_tm_zone
9810         eval $setvar
9811         ;;
9812 esac
9813 case "$d_tm_tm_zone" in
9814 "$define")      echo "Yes, it does."   ;;
9815 *)              echo "No, it doesn't." ;;
9816 esac
9817 : see if struct tm knows about tm_gmtoff
9818 case "$i_systime$i_time" in
9819 *$define*) 
9820         echo " "
9821         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9822         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9823         eval $hasfield
9824         ;;
9825 *)      val="$undef"
9826         set d_tm_tm_gmtoff
9827         eval $setvar
9828         ;;
9829 esac
9830 case "$d_tm_tm_gmtoff" in
9831 "$define")      echo "Yes, it does."   ;;
9832 *)              echo "No, it doesn't." ;;
9833 esac
9834
9835 : see if asctime_r exists
9836 set asctime_r d_asctime_r
9837 eval $inlibc
9838 case "$d_asctime_r" in
9839 "$define")
9840         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9841         case "$d_asctime_r_proto:$usethreads" in
9842         ":define")      d_asctime_r_proto=define
9843                 set d_asctime_r_proto asctime_r $hdrs
9844                 eval $hasproto ;;
9845         *)      ;;
9846         esac
9847         case "$d_asctime_r_proto" in
9848         define)
9849         case "$asctime_r_proto" in
9850         ''|0) try='char* asctime_r(const struct tm*, char*);'
9851         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9852         esac
9853         case "$asctime_r_proto" in
9854         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9855         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9856         esac
9857         case "$asctime_r_proto" in
9858         ''|0) try='int asctime_r(const struct tm*, char*);'
9859         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9860         esac
9861         case "$asctime_r_proto" in
9862         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9863         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9864         esac
9865         case "$asctime_r_proto" in
9866         ''|0)   d_asctime_r=undef
9867                 asctime_r_proto=0
9868                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9869         * )     case "$asctime_r_proto" in
9870                 REENTRANT_PROTO*) ;;
9871                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9872                 esac
9873                 echo "Prototype: $try" ;;
9874         esac
9875         ;;
9876         *)      case "$usethreads" in
9877                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9878                 esac
9879                 d_asctime_r=undef
9880                 asctime_r_proto=0
9881                 ;;
9882         esac
9883         ;;
9884 *)      asctime_r_proto=0
9885         ;;
9886 esac
9887
9888 : see if atolf exists
9889 set atolf d_atolf
9890 eval $inlibc
9891
9892 : see if atoll exists
9893 set atoll d_atoll
9894 eval $inlibc
9895
9896 : Look for GCC-style attribute format
9897 case "$d_attribute_format" in
9898 '')
9899 echo " "
9900 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9901 $cat >attrib.c <<'EOCP'
9902 #include <stdio.h>
9903 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9904 EOCP
9905 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9906         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9907                 echo "Your C compiler doesn't support __attribute__((format))."
9908                 val="$undef"
9909         else
9910                 echo "Your C compiler supports __attribute__((format))."
9911                 val="$define"
9912         fi
9913 else
9914         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9915         val="$undef"
9916 fi
9917 ;;
9918 *) val="$d_attribute_format" ;;
9919 esac
9920 set d_attribute_format
9921 eval $setvar
9922 $rm -f attrib*
9923
9924 : Look for GCC-style attribute malloc
9925 case "$d_attribute_malloc" in
9926 '')
9927 echo " "
9928 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9929 $cat >attrib.c <<'EOCP'
9930 #include <stdio.h>
9931 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9932 EOCP
9933 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9934         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9935                 echo "Your C compiler doesn't support __attribute__((malloc))."
9936                 val="$undef"
9937         else
9938                 echo "Your C compiler supports __attribute__((malloc))."
9939                 val="$define"
9940         fi
9941 else
9942         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9943         val="$undef"
9944 fi
9945 ;;
9946 *) val="$d_attribute_malloc" ;;
9947 esac
9948 set d_attribute_malloc
9949 eval $setvar
9950 $rm -f attrib*
9951
9952 : Look for GCC-style attribute nonnull
9953 case "$d_attribute_nonnull" in
9954 '')
9955 echo " "
9956 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9957 $cat >attrib.c <<'EOCP'
9958 #include <stdio.h>
9959 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9960 EOCP
9961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9963                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9964                 val="$undef"
9965         else
9966                 echo "Your C compiler supports __attribute__((nonnull))."
9967                 val="$define"
9968         fi
9969 else
9970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9971         val="$undef"
9972 fi
9973 ;;
9974 *) val="$d_attribute_nonnull" ;;
9975 esac
9976 set d_attribute_nonnull
9977 eval $setvar
9978 $rm -f attrib*
9979
9980 : Look for GCC-style attribute noreturn
9981 case "$d_attribute_noreturn" in
9982 '')
9983 echo " "
9984 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9985 $cat >attrib.c <<'EOCP'
9986 #include <stdio.h>
9987 void fall_over_dead( void ) __attribute__((noreturn));
9988 EOCP
9989 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9990         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9991                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9992                 val="$undef"
9993         else
9994                 echo "Your C compiler supports __attribute__((noreturn))."
9995                 val="$define"
9996         fi
9997 else
9998         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9999         val="$undef"
10000 fi
10001 ;;
10002 *) val="$d_attribute_noreturn" ;;
10003 esac
10004 set d_attribute_noreturn
10005 eval $setvar
10006 $rm -f attrib*
10007
10008 : Look for GCC-style attribute pure
10009 case "$d_attribute_pure" in
10010 '')
10011 echo " "
10012 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10013 $cat >attrib.c <<'EOCP'
10014 #include <stdio.h>
10015 int square( int n ) __attribute__((pure));
10016 EOCP
10017 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10018         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10019                 echo "Your C compiler doesn't support __attribute__((pure))."
10020                 val="$undef"
10021         else
10022                 echo "Your C compiler supports __attribute__((pure))."
10023                 val="$define"
10024         fi
10025 else
10026         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10027         val="$undef"
10028 fi
10029 ;;
10030 *) val="$d_attribute_pure" ;;
10031 esac
10032 set d_attribute_pure
10033 eval $setvar
10034 $rm -f attrib*
10035
10036 : Look for GCC-style attribute unused
10037 case "$d_attribute_unused" in
10038 '')
10039 echo " "
10040 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10041 $cat >attrib.c <<'EOCP'
10042 #include <stdio.h>
10043 int do_something( int dummy __attribute__((unused)), int n );
10044 EOCP
10045 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10046         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10047                 echo "Your C compiler doesn't support __attribute__((unused))."
10048                 val="$undef"
10049         else
10050                 echo "Your C compiler supports __attribute__((unused))."
10051                 val="$define"
10052         fi
10053 else
10054         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10055         val="$undef"
10056 fi
10057 ;;
10058 *) val="$d_attribute_unused" ;;
10059 esac
10060 set d_attribute_unused
10061 eval $setvar
10062 $rm -f attrib*
10063
10064 : Look for GCC-style attribute warn_unused_result
10065 case "$d_attribute_warn_unused_result" in
10066 '')
10067 echo " "
10068 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10069 $cat >attrib.c <<'EOCP'
10070 #include <stdio.h>
10071 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10072 EOCP
10073 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10074         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10075                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10076                 val="$undef"
10077         else
10078                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10079                 val="$define"
10080         fi
10081 else
10082         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10083         val="$undef"
10084 fi
10085 ;;
10086 *) val="$d_attribute_warn_unused_result" ;;
10087 esac
10088 set d_attribute_warn_unused_result
10089 eval $setvar
10090 $rm -f attrib*
10091
10092 : see if bcmp exists
10093 set bcmp d_bcmp
10094 eval $inlibc
10095
10096 : see if bcopy exists
10097 set bcopy d_bcopy
10098 eval $inlibc
10099
10100 : see if this is a unistd.h system
10101 set unistd.h i_unistd
10102 eval $inhdr
10103
10104 : see if getpgrp exists
10105 set getpgrp d_getpgrp
10106 eval $inlibc
10107
10108 case "$d_getpgrp" in
10109 "$define")
10110         echo " "
10111         echo "Checking to see which flavor of getpgrp is in use..."
10112         $cat >try.c <<EOP
10113 #$i_unistd I_UNISTD
10114 #include <sys/types.h>
10115 #ifdef I_UNISTD
10116 #  include <unistd.h>
10117 #endif
10118 #$i_stdlib I_STDLIB
10119 #ifdef I_STDLIB
10120 #include <stdlib.h>
10121 #endif
10122 int main()
10123 {
10124         if (getuid() == 0) {
10125                 printf("(I see you are running Configure as super-user...)\n");
10126                 setuid(1);
10127         }
10128 #ifdef TRY_BSD_PGRP
10129         if (getpgrp(1) == 0)
10130                 exit(0);
10131 #else
10132         if (getpgrp() > 0)
10133                 exit(0);
10134 #endif
10135         exit(1);
10136 }
10137 EOP
10138         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10139                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10140                 val="$define"
10141         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10142                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10143                 val="$undef"
10144         else
10145                 echo "I can't seem to compile and run the test program."
10146                 if ./usg; then
10147                         xxx="a USG one, i.e. you use getpgrp()."
10148                 else
10149                         # SVR4 systems can appear rather BSD-ish.
10150                         case "$i_unistd" in
10151                         $undef)
10152                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10153                                 val="$define"
10154                                 ;;
10155                         $define)
10156                                 xxx="probably a USG one, i.e. you use getpgrp()."
10157                                 val="$undef"
10158                                 ;;
10159                         esac
10160                 fi
10161                 echo "Assuming your getpgrp is $xxx" >&4
10162         fi
10163         ;;
10164 *) val="$undef";;
10165 esac
10166 set d_bsdgetpgrp
10167 eval $setvar
10168 $rm -f try try.*
10169
10170 : see if setpgrp exists
10171 set setpgrp d_setpgrp
10172 eval $inlibc
10173
10174 case "$d_setpgrp" in
10175 "$define")
10176         echo " "
10177         echo "Checking to see which flavor of setpgrp is in use..."
10178         $cat >try.c <<EOP
10179 #$i_unistd I_UNISTD
10180 #include <sys/types.h>
10181 #ifdef I_UNISTD
10182 #  include <unistd.h>
10183 #endif
10184 #$i_stdlib I_STDLIB
10185 #ifdef I_STDLIB
10186 #include <stdlib.h>
10187 #endif
10188 int main()
10189 {
10190         if (getuid() == 0) {
10191                 printf("(I see you are running Configure as super-user...)\n");
10192                 setuid(1);
10193         }
10194 #ifdef TRY_BSD_PGRP
10195         if (-1 == setpgrp(1, 1))
10196                 exit(0);
10197 #else
10198         if (setpgrp() != -1)
10199                 exit(0);
10200 #endif
10201         exit(1);
10202 }
10203 EOP
10204         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10205                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10206                 val="$define"
10207         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10208                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10209                 val="$undef"
10210         else
10211                 echo "(I can't seem to compile and run the test program.)"
10212                 if ./usg; then
10213                         xxx="a USG one, i.e. you use setpgrp()."
10214                 else
10215                         # SVR4 systems can appear rather BSD-ish.
10216                         case "$i_unistd" in
10217                         $undef)
10218                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10219                                 val="$define"
10220                                 ;;
10221                         $define)
10222                                 xxx="probably a USG one, i.e. you use setpgrp()."
10223                                 val="$undef"
10224                                 ;;
10225                         esac
10226                 fi
10227                 echo "Assuming your setpgrp is $xxx" >&4
10228         fi
10229         ;;
10230 *) val="$undef";;
10231 esac
10232 set d_bsdsetpgrp
10233 eval $setvar
10234 $rm -f try try.*
10235 : Look for GCC-style __builtin_choose_expr
10236 case "$d_builtin_choose_expr" in
10237 '')
10238     echo " "
10239     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10240     $cat >try.c <<'EOCP'
10241 #include <assert.h>
10242 #include <stdlib.h>
10243 #include <stdio.h>
10244
10245 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10246
10247 int main(void) {
10248     assert( SYRINX(1) == 2112 );
10249     assert( SYRINX(1) != 5150 );
10250     assert( SYRINX(0) == 5150 );
10251     assert( SYRINX(0) != 2112 );
10252     puts( "All good!" );
10253     exit(0);
10254 }
10255
10256 EOCP
10257     set try
10258     if eval $compile; then
10259         echo "Your C compiler supports __builtin_choose_expr."
10260         val="$define"
10261     else
10262         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10263         val="$undef"
10264     fi
10265 ;;
10266 *) val="$d_builtin_choose_expr" ;;
10267 esac
10268
10269 set d_builtin_choose_expr
10270 eval $setvar
10271 $rm -f try.* try core core.try.*
10272
10273 : Look for GCC-style __builtin_expect
10274 case "$d_builtin_expect" in
10275 '')
10276     echo " "
10277     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10278     $cat >builtin.c <<'EOCP'
10279 int main(void) {
10280     int n = 50;
10281     if ( __builtin_expect(n, 0) ) n = 1;
10282 }
10283 EOCP
10284     set try
10285     if eval $compile; then
10286         echo "Your C compiler supports __builtin_choose_expr."
10287         val="$define"
10288     else
10289         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10290         val="$undef"
10291     fi
10292     ;;
10293 *) val="$d_builtin_expect" ;;
10294 esac
10295
10296 set d_builtin_expect
10297 eval $setvar
10298 $rm -f try.* try core core.try.*
10299
10300 : see if bzero exists
10301 set bzero d_bzero
10302 eval $inlibc
10303
10304 : see if signal is declared as pointer to function returning int or void
10305 echo " "
10306 xxx=`./findhdr signal.h`
10307 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10308 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10309         echo "You have int (*signal())() instead of void." >&4
10310         val="$undef"
10311 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10312         echo "You have void (*signal())()." >&4
10313         val="$define"
10314 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10315         echo "You have int (*signal())() instead of void." >&4
10316         val="$undef"
10317 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10318         echo "You have void (*signal())()." >&4
10319         val="$define"
10320 else
10321         case "$d_voidsig" in
10322         '')
10323         echo "I can't determine whether signal handler returns void or int..." >&4
10324                 dflt=void
10325                 rp="What type does your signal handler return?"
10326                 . ./myread
10327                 case "$ans" in
10328                 v*) val="$define";;
10329                 *) val="$undef";;
10330                 esac;;
10331         "$define")
10332                 echo "As you already told me, signal handler returns void." >&4
10333                 val="$define"
10334                 ;;
10335         *)      echo "As you already told me, signal handler returns int." >&4
10336                 val="$undef"
10337                 ;;
10338         esac
10339 fi
10340 set d_voidsig
10341 eval $setvar
10342 case "$d_voidsig" in
10343 "$define") signal_t="void";;
10344 *) signal_t="int";;
10345 esac
10346 $rm -f $$.tmp
10347
10348 : check for ability to cast large floats to 32-bit ints.
10349 echo " "
10350 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10351 if $test "$intsize" -ge 4; then
10352         xxx=int
10353 else
10354         xxx=long
10355 fi
10356 $cat >try.c <<EOCP
10357 #include <stdio.h>
10358 #$i_stdlib I_STDLIB
10359 #ifdef I_STDLIB
10360 #include <stdlib.h>
10361 #endif
10362 #include <sys/types.h>
10363 #include <signal.h>
10364 $signal_t blech(s) int s; { exit(3); }
10365 int main()
10366 {
10367         $xxx i32;
10368         double f, g;
10369         int result = 0;
10370         char str[16];
10371         signal(SIGFPE, blech);
10372
10373         /* Don't let compiler optimize the test away.  Store the number 
10374            in a writable string for gcc to pass to sscanf under HP/UX.
10375         */
10376         sprintf(str, "2147483647");
10377         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10378         g = 10 * f;
10379         i32  = ($xxx) g;
10380
10381         /* x86 processors will probably give 0x8000 0000, which is a
10382            sign change.  We don't want that.  We want to mimic SPARC
10383            behavior here, which is to preserve the sign and give
10384            back 0x7fff ffff.
10385         */
10386         if (i32 != ($xxx) f)
10387                 result |= 1;
10388         exit(result);
10389 }
10390 EOCP
10391 set try
10392 if eval $compile_ok; then
10393         $run ./try
10394         yyy=$?
10395 else
10396         echo "(I can't seem to compile the test program--assuming it can't)"
10397         yyy=1
10398 fi
10399 case "$yyy" in
10400 0)      val="$define"
10401         echo "Yup, it can."
10402         ;;
10403 *)      val="$undef"
10404         echo "Nope, it can't."
10405         ;;
10406 esac
10407 set d_casti32
10408 eval $setvar
10409 $rm -f try try.*
10410
10411 : check for ability to cast negative floats to unsigned
10412 echo " "
10413 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10414 $cat >try.c <<EOCP
10415 #include <stdio.h>
10416 #$i_stdlib I_STDLIB
10417 #ifdef I_STDLIB
10418 #include <stdlib.h>
10419 #endif
10420 #include <sys/types.h>
10421 #include <signal.h>
10422 $signal_t blech(s) int s; { exit(7); }
10423 $signal_t blech_in_list(s) int s; { exit(4); }
10424 unsigned long dummy_long(p) unsigned long p; { return p; }
10425 unsigned int dummy_int(p) unsigned int p; { return p; }
10426 unsigned short dummy_short(p) unsigned short p; { return p; }
10427 int main()
10428 {
10429         double f;
10430         unsigned long along;
10431         unsigned int aint;
10432         unsigned short ashort;
10433         int result = 0;
10434         char str[16];
10435         
10436         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10437            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10438            optimized the whole file away
10439         */
10440         /* Store the number in a writable string for gcc to pass to 
10441            sscanf under HP/UX.
10442         */
10443         sprintf(str, "-123");
10444         sscanf(str, "%lf", &f);  /* f = -123.; */
10445
10446         signal(SIGFPE, blech);
10447         along = (unsigned long)f;
10448         aint = (unsigned int)f;
10449         ashort = (unsigned short)f;
10450         if (along != (unsigned long)-123)
10451                 result |= 1;
10452         if (aint != (unsigned int)-123)
10453                 result |= 1;
10454         if (ashort != (unsigned short)-123)
10455                 result |= 1;
10456         sprintf(str, "1073741824.");
10457         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10458         f = f + f;
10459         along = 0;
10460         along = (unsigned long)f;
10461         if (along != 0x80000000)
10462                 result |= 2;
10463         f -= 1.;
10464         along = 0;
10465         along = (unsigned long)f;
10466         if (along != 0x7fffffff)
10467                 result |= 1;
10468         f += 2.;
10469         along = 0;
10470         along = (unsigned long)f;
10471         if (along != 0x80000001)
10472                 result |= 2;
10473         if (result)
10474                 exit(result);
10475         signal(SIGFPE, blech_in_list);
10476         sprintf(str, "123.");
10477         sscanf(str, "%lf", &f);  /* f = 123.; */
10478         along = dummy_long((unsigned long)f);
10479         aint = dummy_int((unsigned int)f);
10480         ashort = dummy_short((unsigned short)f);
10481         if (along != (unsigned long)123)
10482                 result |= 4;
10483         if (aint != (unsigned int)123)
10484                 result |= 4;
10485         if (ashort != (unsigned short)123)
10486                 result |= 4;
10487         exit(result);
10488
10489 }
10490 EOCP
10491 set try
10492 if eval $compile_ok; then
10493         $run ./try
10494         castflags=$?
10495 else
10496         echo "(I can't seem to compile the test program--assuming it can't)"
10497         castflags=7
10498 fi
10499 case "$castflags" in
10500 0)      val="$define"
10501         echo "Yup, it can."
10502         ;;
10503 *)      val="$undef"
10504         echo "Nope, it can't."
10505         ;;
10506 esac
10507 set d_castneg
10508 eval $setvar
10509 $rm -f try.*
10510
10511 : see if vprintf exists
10512 echo " "
10513 if set vprintf val -f d_vprintf; eval $csym; $val; then
10514         echo 'vprintf() found.' >&4
10515         val="$define"
10516         $cat >try.c <<EOF
10517 #include <varargs.h>
10518 #$i_stdlib I_STDLIB
10519 #ifdef I_STDLIB
10520 #include <stdlib.h>
10521 #endif
10522
10523 int main() { xxx("foo"); }
10524
10525 xxx(va_alist)
10526 va_dcl
10527 {
10528         va_list args;
10529         char buf[10];
10530
10531         va_start(args);
10532         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10533 }
10534 EOF
10535         set try
10536         if eval $compile && $run ./try; then
10537                 echo "Your vsprintf() returns (int)." >&4
10538                 val2="$undef"
10539         else
10540                 echo "Your vsprintf() returns (char*)." >&4
10541                 val2="$define"
10542         fi
10543 else
10544         echo 'vprintf() NOT found.' >&4
10545                 val="$undef"
10546                 val2="$undef"
10547 fi
10548 $rm -f try try.*
10549 set d_vprintf
10550 eval $setvar
10551 val=$val2
10552 set d_charvspr
10553 eval $setvar
10554
10555 : see if chown exists
10556 set chown d_chown
10557 eval $inlibc
10558
10559 : see if chroot exists
10560 set chroot d_chroot
10561 eval $inlibc
10562
10563 : see if chsize exists
10564 set chsize d_chsize
10565 eval $inlibc
10566
10567 : see if class exists
10568 set class d_class
10569 eval $inlibc
10570
10571 : see if clearenv exists
10572 set clearenv d_clearenv
10573 eval $inlibc
10574
10575 hasstruct='varname=$1; struct=$2; shift; shift;
10576 while $test $# -ge 2; do
10577         case "$1" in
10578         $define) echo "#include <$2>";;
10579         esac ;
10580     shift 2;
10581 done > try.c;
10582 echo "int main () { struct $struct foo; }" >> try.c;
10583 set try;
10584 if eval $compile; then
10585         val="$define";
10586 else
10587         val="$undef";
10588 fi;
10589 set $varname;
10590 eval $setvar;
10591 $rm -f try.c try.o'
10592
10593 socketlib=''
10594 sockethdr=''
10595 : see whether socket exists
10596 echo " "
10597 $echo $n "Hmm... $c" >&4
10598 if set socket val -f d_socket; eval $csym; $val; then
10599         echo "Looks like you have Berkeley networking support." >&4
10600         d_socket="$define"
10601         if set setsockopt val -f; eval $csym; $val; then
10602                 d_oldsock="$undef"
10603         else
10604                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10605                 d_oldsock="$define"
10606         fi
10607 else
10608         if $contains socklib libc.list >/dev/null 2>&1; then
10609                 echo "Looks like you have Berkeley networking support." >&4
10610                 d_socket="$define"
10611                 : we will have to assume that it supports the 4.2 BSD interface
10612                 d_oldsock="$undef"
10613         else
10614                 echo "You don't have Berkeley networking in libc$_a..." >&4
10615                 if test "X$d_socket" = "X$define"; then
10616                    echo "...but you seem to believe that you have sockets." >&4
10617                 else
10618                         for net in net socket
10619                         do
10620                                 if test -f /usr/lib/lib$net$_a; then
10621                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10622                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10623                                         if $contains socket libc.list >/dev/null 2>&1; then
10624                                                 d_socket="$define"
10625                                                 socketlib="-l$net"
10626                                                 case "$net" in
10627                                                 net)
10628                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10629                                                         sockethdr="-I/usr/netinclude"
10630                                                         ;;
10631                                                 esac
10632                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10633                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10634                                                         d_oldsock="$undef"
10635                                                 else
10636                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10637                                                         d_oldsock="$define"
10638                                                 fi
10639                                                 break
10640                                         fi
10641                                 fi
10642                         done
10643                         if test "X$d_socket" != "X$define"; then
10644                            echo "or anywhere else I see." >&4
10645                            d_socket="$undef"
10646                            d_oldsock="$undef"
10647                         fi
10648                 fi
10649         fi
10650 fi
10651
10652 : see if socketpair exists
10653 set socketpair d_sockpair
10654 eval $inlibc
10655
10656
10657 echo " "
10658 echo "Checking the availability of certain socket constants..." >&4
10659 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10660         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10661         $cat >try.c <<EOF
10662 #include <sys/types.h>
10663 #include <sys/socket.h>
10664 int main() {
10665     int i = $ENUM;
10666 }
10667 EOF
10668         val="$undef"
10669         set try; if eval $compile; then
10670                 val="$define"
10671         fi
10672         set d_${enum}; eval $setvar
10673         $rm -f try.c try
10674 done
10675
10676 : see if this is a sys/uio.h system
10677 set sys/uio.h i_sysuio
10678 eval $inhdr
10679
10680
10681 echo " "
10682 echo "Checking to see if your system supports struct cmsghdr..." >&4
10683 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10684 eval $hasstruct
10685 case "$d_cmsghdr_s" in
10686 "$define")      echo "Yes, it does."   ;;
10687 *)              echo "No, it doesn't." ;;
10688 esac
10689
10690
10691 : check for const keyword
10692 echo " "
10693 echo 'Checking to see if your C compiler knows about "const"...' >&4
10694 $cat >const.c <<'EOCP'
10695 typedef struct spug { int drokk; } spug;
10696 int main()
10697 {
10698         const char *foo;
10699         const spug y;
10700 }
10701 EOCP
10702 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10703         val="$define"
10704         echo "Yup, it does."
10705 else
10706         val="$undef"
10707         echo "Nope, it doesn't."
10708 fi
10709 set d_const
10710 eval $setvar
10711
10712 : see if copysignl exists
10713 set copysignl d_copysignl
10714 eval $inlibc
10715
10716 : see if crypt exists
10717 echo " "
10718 set crypt d_crypt
10719 eval $inlibc
10720 case "$d_crypt" in
10721 $define) cryptlib='' ;;
10722 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10723                 echo 'crypt() found.' >&4
10724                 val="$define"
10725                 cryptlib=''
10726         else
10727                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10728                 if $test -z "$cryptlib"; then
10729                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10730                 else
10731                         cryptlib=-lcrypt
10732                 fi
10733                 if $test -z "$cryptlib"; then
10734                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10735                 else
10736                         cryptlib=-lcrypt
10737                 fi
10738                 if $test -z "$cryptlib"; then
10739                         cryptlib=`./loc libcrypt$_a "" $libpth`
10740                 else
10741                         cryptlib=-lcrypt
10742                 fi
10743                 if $test -z "$cryptlib"; then
10744                         echo 'crypt() NOT found.' >&4
10745                         val="$undef"
10746                 else
10747                         val="$define"
10748                 fi
10749         fi
10750         set d_crypt
10751         eval $setvar
10752         ;;
10753 esac
10754
10755 : see if this is a crypt.h system
10756 set crypt.h i_crypt
10757 eval $inhdr
10758
10759 : see if crypt_r exists
10760 set crypt_r d_crypt_r
10761 eval $inlibc
10762 case "$d_crypt_r" in
10763 "$define")
10764         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10765         case "$d_crypt_r_proto:$usethreads" in
10766         ":define")      d_crypt_r_proto=define
10767                 set d_crypt_r_proto crypt_r $hdrs
10768                 eval $hasproto ;;
10769         *)      ;;
10770         esac
10771         case "$d_crypt_r_proto" in
10772         define)
10773         case "$crypt_r_proto" in
10774         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10775         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10776         esac
10777         case "$crypt_r_proto" in
10778         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10779         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10780         esac
10781         case "$crypt_r_proto" in
10782         ''|0)   d_crypt_r=undef
10783                 crypt_r_proto=0
10784                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10785         * )     case "$crypt_r_proto" in
10786                 REENTRANT_PROTO*) ;;
10787                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10788                 esac
10789                 echo "Prototype: $try" ;;
10790         esac
10791         ;;
10792         *)      case "$usethreads" in
10793                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10794                 esac
10795                 d_crypt_r=undef
10796                 crypt_r_proto=0
10797                 ;;
10798         esac
10799         ;;
10800 *)      crypt_r_proto=0
10801         ;;
10802 esac
10803
10804 : get csh whereabouts
10805 case "$csh" in
10806 'csh') val="$undef" ;;
10807 *) val="$define" ;;
10808 esac
10809 set d_csh
10810 eval $setvar
10811 : Respect a hint or command line value for full_csh.
10812 case "$full_csh" in
10813 '') full_csh=$csh ;;
10814 esac
10815
10816 : see if ctermid_r exists
10817 set ctermid_r d_ctermid_r
10818 eval $inlibc
10819 case "$d_ctermid_r" in
10820 "$define")
10821         hdrs="$i_systypes sys/types.h define stdio.h "
10822         case "$d_ctermid_r_proto:$usethreads" in
10823         ":define")      d_ctermid_r_proto=define
10824                 set d_ctermid_r_proto ctermid_r $hdrs
10825                 eval $hasproto ;;
10826         *)      ;;
10827         esac
10828         case "$d_ctermid_r_proto" in
10829         define)
10830         case "$ctermid_r_proto" in
10831         ''|0) try='char* ctermid_r(char*);'
10832         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10833         esac
10834         case "$ctermid_r_proto" in
10835         ''|0)   d_ctermid_r=undef
10836                 ctermid_r_proto=0
10837                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10838         * )     case "$ctermid_r_proto" in
10839                 REENTRANT_PROTO*) ;;
10840                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10841                 esac
10842                 echo "Prototype: $try" ;;
10843         esac
10844         ;;
10845         *)      case "$usethreads" in
10846                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10847                 esac
10848                 d_ctermid_r=undef
10849                 ctermid_r_proto=0
10850                 ;;
10851         esac
10852         ;;
10853 *)      ctermid_r_proto=0
10854         ;;
10855 esac
10856
10857 : see if ctime_r exists
10858 set ctime_r d_ctime_r
10859 eval $inlibc
10860 case "$d_ctime_r" in
10861 "$define")
10862         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10863         case "$d_ctime_r_proto:$usethreads" in
10864         ":define")      d_ctime_r_proto=define
10865                 set d_ctime_r_proto ctime_r $hdrs
10866                 eval $hasproto ;;
10867         *)      ;;
10868         esac
10869         case "$d_ctime_r_proto" in
10870         define)
10871         case "$ctime_r_proto" in
10872         ''|0) try='char* ctime_r(const time_t*, char*);'
10873         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10874         esac
10875         case "$ctime_r_proto" in
10876         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10877         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10878         esac
10879         case "$ctime_r_proto" in
10880         ''|0) try='int ctime_r(const time_t*, char*);'
10881         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10882         esac
10883         case "$ctime_r_proto" in
10884         ''|0) try='int ctime_r(const time_t*, char*, int);'
10885         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10886         esac
10887         case "$ctime_r_proto" in
10888         ''|0)   d_ctime_r=undef
10889                 ctime_r_proto=0
10890                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10891         * )     case "$ctime_r_proto" in
10892                 REENTRANT_PROTO*) ;;
10893                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10894                 esac
10895                 echo "Prototype: $try" ;;
10896         esac
10897         ;;
10898         *)      case "$usethreads" in
10899                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10900                 esac
10901                 d_ctime_r=undef
10902                 ctime_r_proto=0
10903                 ;;
10904         esac
10905         ;;
10906 *)      ctime_r_proto=0
10907         ;;
10908 esac
10909
10910 : see if cuserid exists
10911 set cuserid d_cuserid
10912 eval $inlibc
10913
10914 : see if this is a limits.h system
10915 set limits.h i_limits
10916 eval $inhdr
10917
10918 : see if this is a float.h system
10919 set float.h i_float
10920 eval $inhdr
10921
10922 : See if number of significant digits in a double precision number is known
10923 echo " "
10924 $cat >dbl_dig.c <<EOM
10925 #$i_limits I_LIMITS
10926 #$i_float I_FLOAT
10927 #ifdef I_LIMITS
10928 #include <limits.h>
10929 #endif
10930 #ifdef I_FLOAT
10931 #include <float.h>
10932 #endif
10933 #ifdef DBL_DIG
10934 printf("Contains DBL_DIG");
10935 #endif
10936 EOM
10937 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10938 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10939         echo "DBL_DIG found." >&4
10940         val="$define"
10941 else
10942         echo "DBL_DIG NOT found." >&4
10943         val="$undef"
10944 fi
10945 $rm -f dbl_dig.?
10946 set d_dbl_dig
10947 eval $setvar
10948
10949 : see if dbm.h is available
10950 : see if dbmclose exists
10951 set dbmclose d_dbmclose
10952 eval $inlibc
10953
10954 case "$d_dbmclose" in
10955 $define)
10956         set dbm.h i_dbm
10957         eval $inhdr
10958         case "$i_dbm" in
10959         $define)
10960                 val="$undef"
10961                 set i_rpcsvcdbm
10962                 eval $setvar
10963                 ;;
10964         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10965                 eval $inhdr
10966                 ;;
10967         esac
10968         ;;
10969 *)      echo "We won't be including <dbm.h>"
10970         val="$undef"
10971         set i_dbm
10972         eval $setvar
10973         val="$undef"
10974         set i_rpcsvcdbm
10975         eval $setvar
10976         ;;
10977 esac
10978
10979 : see if prototype for dbminit is available
10980 echo " "
10981 set d_dbminitproto dbminit $i_dbm dbm.h
10982 eval $hasproto
10983
10984 : see if difftime exists
10985 set difftime d_difftime
10986 eval $inlibc
10987
10988 : see if this is a dirent system
10989 echo " "
10990 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10991         val="$define"
10992         echo "<dirent.h> found." >&4
10993 else
10994         val="$undef"
10995         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10996                 echo "<sys/dir.h> found." >&4
10997                 echo " "
10998         else
10999                 xinc=`./findhdr sys/ndir.h`
11000         fi
11001         echo "<dirent.h> NOT found." >&4
11002 fi
11003 set i_dirent
11004 eval $setvar
11005
11006 : Look for type of directory structure.
11007 echo " "
11008 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11009
11010 case "$direntrytype" in
11011 ''|' ')
11012         case "$i_dirent" in
11013         $define) guess1='struct dirent' ;;
11014         *) guess1='struct direct'  ;;
11015         esac
11016         ;;
11017 *)      guess1="$direntrytype"
11018         ;;
11019 esac
11020
11021 case "$guess1" in
11022 'struct dirent') guess2='struct direct' ;;
11023 *) guess2='struct dirent' ;;
11024 esac
11025                 
11026 if $contains "$guess1" try.c >/dev/null 2>&1; then
11027         direntrytype="$guess1"
11028         echo "Your directory entries are $direntrytype." >&4
11029 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11030         direntrytype="$guess2"
11031         echo "Your directory entries seem to be $direntrytype." >&4
11032 else
11033         echo "I don't recognize your system's directory entries." >&4
11034         rp="What type is used for directory entries on this system?"
11035         dflt="$guess1"
11036         . ./myread
11037         direntrytype="$ans"
11038 fi
11039 $rm -f try.c
11040
11041
11042 : see if the directory entry stores field length
11043 echo " "
11044 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11045 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11046         echo "Good, your directory entry keeps length information in d_namlen." >&4
11047         val="$define"
11048 else
11049         echo "Your directory entry does not know about the d_namlen field." >&4
11050         val="$undef"
11051 fi
11052 set d_dirnamlen
11053 eval $setvar
11054 $rm -f try.c
11055
11056 : see if this is an sysdir system
11057 set sys/dir.h i_sysdir
11058 eval $inhdr
11059
11060 : see if this is an sysndir system
11061 set sys/ndir.h i_sysndir
11062 eval $inhdr
11063
11064 : Look for dirfd
11065 echo " "
11066 $cat >dirfd.c <<EOM
11067 #include <stdio.h>
11068 #$i_stdlib I_STDLIB
11069 #ifdef I_STDLIB
11070 #include <stdlib.h>
11071 #endif
11072 #$i_dirent I_DIRENT             /**/
11073 #$i_sysdir I_SYS_DIR            /**/
11074 #$i_sysndir I_SYS_NDIR          /**/
11075 #$i_systypes I_SYS_TYPES        /**/
11076 #if defined(I_SYS_TYPES)
11077 #include <sys/types.h>
11078 #endif
11079 #if defined(I_DIRENT)
11080 #include <dirent.h>
11081 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11082 #include <sys/dir.h>
11083 #endif
11084 #else
11085 #ifdef I_SYS_NDIR
11086 #include <sys/ndir.h>
11087 #else
11088 #ifdef I_SYS_DIR
11089 #ifdef hp9000s500
11090 #include <ndir.h>       /* may be wrong in the future */
11091 #else
11092 #include <sys/dir.h>
11093 #endif
11094 #endif
11095 #endif
11096 #endif 
11097 int main() {
11098         DIR *dirp = opendir(".");
11099         if (dirfd(dirp) >= 0)
11100                 exit(0);
11101         else
11102                 exit(1);
11103 }
11104 EOM
11105 val=$undef
11106 set dirfd
11107 if eval $compile; then
11108         val="$define"
11109 fi
11110 case "$val" in
11111 $define)        echo "dirfd() found." >&4       ;;
11112 *)              echo "dirfd() NOT found." >&4   ;;
11113 esac
11114 set d_dirfd
11115 eval $setvar
11116 $rm -f dirfd*
11117
11118 : see if dlerror exists
11119 xxx_runnm="$runnm"
11120 runnm=false
11121 set dlerror d_dlerror
11122 eval $inlibc
11123 runnm="$xxx_runnm"
11124
11125 : see if dlfcn is available
11126 set dlfcn.h i_dlfcn
11127 eval $inhdr
11128
11129 case "$usedl" in
11130 $define|y|true)
11131         $cat << EOM
11132
11133 On a few systems, the dynamically loaded modules that perl generates and uses
11134 will need a different extension than shared libs. The default will probably
11135 be appropriate.
11136
11137 EOM
11138         case "$dlext" in
11139         '')     dflt="$so" ;;
11140         *)      dflt="$dlext" ;;
11141         esac
11142         rp='What is the extension of dynamically loaded modules'
11143         . ./myread
11144         dlext="$ans"
11145         ;;
11146 *)
11147         dlext="none"
11148         ;;
11149 esac
11150
11151 : Check if dlsym need a leading underscore
11152 echo " "
11153 val="$undef"
11154
11155 case "$dlsrc" in
11156 dl_dlopen.xs)
11157         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11158         $cat >dyna.c <<'EOM'
11159 fred () { }
11160 EOM
11161
11162 $cat >fred.c<<EOM
11163
11164 #include <stdio.h>
11165 #$i_stdlib I_STDLIB
11166 #ifdef I_STDLIB
11167 #include <stdlib.h>
11168 #endif
11169 #$i_dlfcn I_DLFCN
11170 #ifdef I_DLFCN
11171 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11172 #else
11173 #include <sys/types.h>
11174 #include <nlist.h>
11175 #include <link.h>
11176 #endif
11177
11178 extern int fred() ;
11179
11180 int main()
11181 {
11182     void * handle ;
11183     void * symbol ;
11184 #ifndef RTLD_LAZY
11185     int mode = 1 ;
11186 #else
11187     int mode = RTLD_LAZY ;
11188 #endif
11189     handle = dlopen("./dyna.$dlext", mode) ;
11190     if (handle == NULL) {
11191         printf ("1\n") ;
11192         fflush (stdout) ;
11193         exit(0);
11194     }
11195     symbol = dlsym(handle, "fred") ;
11196     if (symbol == NULL) {
11197         /* try putting a leading underscore */
11198         symbol = dlsym(handle, "_fred") ;
11199         if (symbol == NULL) {
11200             printf ("2\n") ;
11201             fflush (stdout) ;
11202             exit(0);
11203         }
11204         printf ("3\n") ;
11205     }
11206     else
11207         printf ("4\n") ;
11208     fflush (stdout) ;
11209     exit(0);
11210 }
11211 EOM
11212         : Call the object file tmp-dyna.o in case dlext=o.
11213         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11214                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11215                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11216                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11217                 xxx=`$run ./fred`
11218                 case $xxx in
11219                 1)      echo "Test program failed using dlopen." >&4
11220                         echo "Perhaps you should not use dynamic loading." >&4;;
11221                 2)      echo "Test program failed using dlsym." >&4
11222                         echo "Perhaps you should not use dynamic loading." >&4;;
11223                 3)      echo "dlsym needs a leading underscore" >&4
11224                         val="$define" ;;
11225                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11226                 esac
11227         else
11228                 echo "I can't compile and run the test program." >&4
11229                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11230         fi
11231         ;;
11232 esac
11233                 
11234 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11235
11236 set d_dlsymun
11237 eval $setvar
11238
11239 : see if drand48_r exists
11240 set drand48_r d_drand48_r
11241 eval $inlibc
11242 case "$d_drand48_r" in
11243 "$define")
11244         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11245         case "$d_drand48_r_proto:$usethreads" in
11246         ":define")      d_drand48_r_proto=define
11247                 set d_drand48_r_proto drand48_r $hdrs
11248                 eval $hasproto ;;
11249         *)      ;;
11250         esac
11251         case "$d_drand48_r_proto" in
11252         define)
11253         case "$drand48_r_proto" in
11254         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11255         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11256         esac
11257         case "$drand48_r_proto" in
11258         ''|0)   d_drand48_r=undef
11259                 drand48_r_proto=0
11260                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11261         * )     case "$drand48_r_proto" in
11262                 REENTRANT_PROTO*) ;;
11263                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11264                 esac
11265                 echo "Prototype: $try" ;;
11266         esac
11267         ;;
11268         *)      case "$usethreads" in
11269                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11270                 esac
11271                 d_drand48_r=undef
11272                 drand48_r_proto=0
11273                 ;;
11274         esac
11275         ;;
11276 *)      drand48_r_proto=0
11277         ;;
11278 esac
11279
11280 : see if prototype for drand48 is available
11281 echo " "
11282 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11283 eval $hasproto
11284
11285 : see if dup2 exists
11286 set dup2 d_dup2
11287 eval $inlibc
11288
11289 : see if eaccess exists
11290 set eaccess d_eaccess
11291 eval $inlibc
11292
11293 : see if endgrent exists
11294 set endgrent d_endgrent
11295 eval $inlibc
11296
11297 : see if this is an grp system
11298 set grp.h i_grp
11299 eval $inhdr
11300
11301 case "$i_grp" in
11302 $define)
11303         xxx=`./findhdr grp.h`
11304         $cppstdin $cppflags $cppminus < $xxx >$$.h
11305
11306         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11307                 val="$define"
11308         else
11309                 val="$undef"
11310         fi
11311         set d_grpasswd
11312         eval $setvar
11313
11314         $rm -f $$.h
11315         ;;
11316 *)
11317         val="$undef";
11318         set d_grpasswd; eval $setvar
11319         ;;
11320 esac
11321
11322 : see if endgrent_r exists
11323 set endgrent_r d_endgrent_r
11324 eval $inlibc
11325 case "$d_endgrent_r" in
11326 "$define")
11327         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11328         case "$d_endgrent_r_proto:$usethreads" in
11329         ":define")      d_endgrent_r_proto=define
11330                 set d_endgrent_r_proto endgrent_r $hdrs
11331                 eval $hasproto ;;
11332         *)      ;;
11333         esac
11334         case "$d_endgrent_r_proto" in
11335         define)
11336         case "$endgrent_r_proto" in
11337         ''|0) try='int endgrent_r(FILE**);'
11338         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11339         esac
11340         case "$endgrent_r_proto" in
11341         ''|0) try='void endgrent_r(FILE**);'
11342         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11343         esac
11344         case "$endgrent_r_proto" in
11345         ''|0)   d_endgrent_r=undef
11346                 endgrent_r_proto=0
11347                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11348         * )     case "$endgrent_r_proto" in
11349                 REENTRANT_PROTO*) ;;
11350                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11351                 esac
11352                 echo "Prototype: $try" ;;
11353         esac
11354         ;;
11355         *)      case "$usethreads" in
11356                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11357                 esac
11358                 d_endgrent_r=undef
11359                 endgrent_r_proto=0
11360                 ;;
11361         esac
11362         ;;
11363 *)      endgrent_r_proto=0
11364         ;;
11365 esac
11366
11367 : see if endhostent exists
11368 set endhostent d_endhent
11369 eval $inlibc
11370
11371 : see if this is a netdb.h system
11372 set netdb.h i_netdb
11373 eval $inhdr
11374
11375 : see if endhostent_r exists
11376 set endhostent_r d_endhostent_r
11377 eval $inlibc
11378 case "$d_endhostent_r" in
11379 "$define")
11380         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11381         case "$d_endhostent_r_proto:$usethreads" in
11382         ":define")      d_endhostent_r_proto=define
11383                 set d_endhostent_r_proto endhostent_r $hdrs
11384                 eval $hasproto ;;
11385         *)      ;;
11386         esac
11387         case "$d_endhostent_r_proto" in
11388         define)
11389         case "$endhostent_r_proto" in
11390         ''|0) try='int endhostent_r(struct hostent_data*);'
11391         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11392         esac
11393         case "$endhostent_r_proto" in
11394         ''|0) try='void endhostent_r(struct hostent_data*);'
11395         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11396         esac
11397         case "$endhostent_r_proto" in
11398         ''|0)   d_endhostent_r=undef
11399                 endhostent_r_proto=0
11400                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11401         * )     case "$endhostent_r_proto" in
11402                 REENTRANT_PROTO*) ;;
11403                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11404                 esac
11405                 echo "Prototype: $try" ;;
11406         esac
11407         ;;
11408         *)      case "$usethreads" in
11409                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11410                 esac
11411                 d_endhostent_r=undef
11412                 endhostent_r_proto=0
11413                 ;;
11414         esac
11415         ;;
11416 *)      endhostent_r_proto=0
11417         ;;
11418 esac
11419
11420 : see if endnetent exists
11421 set endnetent d_endnent
11422 eval $inlibc
11423
11424 : see if endnetent_r exists
11425 set endnetent_r d_endnetent_r
11426 eval $inlibc
11427 case "$d_endnetent_r" in
11428 "$define")
11429         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11430         case "$d_endnetent_r_proto:$usethreads" in
11431         ":define")      d_endnetent_r_proto=define
11432                 set d_endnetent_r_proto endnetent_r $hdrs
11433                 eval $hasproto ;;
11434         *)      ;;
11435         esac
11436         case "$d_endnetent_r_proto" in
11437         define)
11438         case "$endnetent_r_proto" in
11439         ''|0) try='int endnetent_r(struct netent_data*);'
11440         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11441         esac
11442         case "$endnetent_r_proto" in
11443         ''|0) try='void endnetent_r(struct netent_data*);'
11444         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11445         esac
11446         case "$endnetent_r_proto" in
11447         ''|0)   d_endnetent_r=undef
11448                 endnetent_r_proto=0
11449                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11450         * )     case "$endnetent_r_proto" in
11451                 REENTRANT_PROTO*) ;;
11452                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11453                 esac
11454                 echo "Prototype: $try" ;;
11455         esac
11456         ;;
11457         *)      case "$usethreads" in
11458                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11459                 esac
11460                 d_endnetent_r=undef
11461                 endnetent_r_proto=0
11462                 ;;
11463         esac
11464         ;;
11465 *)      endnetent_r_proto=0
11466         ;;
11467 esac
11468
11469 : see if endprotoent exists
11470 set endprotoent d_endpent
11471 eval $inlibc
11472
11473 : see if endprotoent_r exists
11474 set endprotoent_r d_endprotoent_r
11475 eval $inlibc
11476 case "$d_endprotoent_r" in
11477 "$define")
11478         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11479         case "$d_endprotoent_r_proto:$usethreads" in
11480         ":define")      d_endprotoent_r_proto=define
11481                 set d_endprotoent_r_proto endprotoent_r $hdrs
11482                 eval $hasproto ;;
11483         *)      ;;
11484         esac
11485         case "$d_endprotoent_r_proto" in
11486         define)
11487         case "$endprotoent_r_proto" in
11488         ''|0) try='int endprotoent_r(struct protoent_data*);'
11489         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11490         esac
11491         case "$endprotoent_r_proto" in
11492         ''|0) try='void endprotoent_r(struct protoent_data*);'
11493         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11494         esac
11495         case "$endprotoent_r_proto" in
11496         ''|0)   d_endprotoent_r=undef
11497                 endprotoent_r_proto=0
11498                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11499         * )     case "$endprotoent_r_proto" in
11500                 REENTRANT_PROTO*) ;;
11501                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11502                 esac
11503                 echo "Prototype: $try" ;;
11504         esac
11505         ;;
11506         *)      case "$usethreads" in
11507                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11508                 esac
11509                 d_endprotoent_r=undef
11510                 endprotoent_r_proto=0
11511                 ;;
11512         esac
11513         ;;
11514 *)      endprotoent_r_proto=0
11515         ;;
11516 esac
11517
11518 : see if endpwent exists
11519 set endpwent d_endpwent
11520 eval $inlibc
11521
11522 : see if this is a pwd.h system
11523 set pwd.h i_pwd
11524 eval $inhdr
11525
11526 case "$i_pwd" in
11527 $define)
11528         xxx=`./findhdr pwd.h`
11529         $cppstdin $cppflags $cppminus < $xxx >$$.h
11530
11531         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11532                 val="$define"
11533         else
11534                 val="$undef"
11535         fi
11536         set d_pwquota
11537         eval $setvar
11538
11539         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11540                 val="$define"
11541         else
11542                 val="$undef"
11543         fi
11544         set d_pwage
11545         eval $setvar
11546
11547         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11548                 val="$define"
11549         else
11550                 val="$undef"
11551         fi
11552         set d_pwchange
11553         eval $setvar
11554
11555         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11556                 val="$define"
11557         else
11558                 val="$undef"
11559         fi
11560         set d_pwclass
11561         eval $setvar
11562
11563         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11564                 val="$define"
11565         else
11566                 val="$undef"
11567         fi
11568         set d_pwexpire
11569         eval $setvar
11570
11571         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11572                 val="$define"
11573         else
11574                 val="$undef"
11575         fi
11576         set d_pwcomment
11577         eval $setvar
11578
11579         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11580                 val="$define"
11581         else
11582                 val="$undef"
11583         fi
11584         set d_pwgecos
11585         eval $setvar
11586
11587         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11588                 val="$define"
11589         else
11590                 val="$undef"
11591         fi
11592         set d_pwpasswd
11593         eval $setvar
11594
11595         $rm -f $$.h
11596         ;;
11597 *)
11598         val="$undef"; 
11599         set d_pwquota; eval $setvar
11600         set d_pwage; eval $setvar
11601         set d_pwchange; eval $setvar
11602         set d_pwclass; eval $setvar
11603         set d_pwexpire; eval $setvar
11604         set d_pwcomment; eval $setvar
11605         set d_pwgecos; eval $setvar
11606         set d_pwpasswd; eval $setvar
11607         ;;
11608 esac
11609
11610 : see if endpwent_r exists
11611 set endpwent_r d_endpwent_r
11612 eval $inlibc
11613 case "$d_endpwent_r" in
11614 "$define")
11615         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11616         case "$d_endpwent_r_proto:$usethreads" in
11617         ":define")      d_endpwent_r_proto=define
11618                 set d_endpwent_r_proto endpwent_r $hdrs
11619                 eval $hasproto ;;
11620         *)      ;;
11621         esac
11622         case "$d_endpwent_r_proto" in
11623         define)
11624         case "$endpwent_r_proto" in
11625         ''|0) try='int endpwent_r(FILE**);'
11626         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11627         esac
11628         case "$endpwent_r_proto" in
11629         ''|0) try='void endpwent_r(FILE**);'
11630         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11631         esac
11632         case "$endpwent_r_proto" in
11633         ''|0)   d_endpwent_r=undef
11634                 endpwent_r_proto=0
11635                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11636         * )     case "$endpwent_r_proto" in
11637                 REENTRANT_PROTO*) ;;
11638                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11639                 esac
11640                 echo "Prototype: $try" ;;
11641         esac
11642         ;;
11643         *)      case "$usethreads" in
11644                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11645                 esac
11646                 d_endpwent_r=undef
11647                 endpwent_r_proto=0
11648                 ;;
11649         esac
11650         ;;
11651 *)      endpwent_r_proto=0
11652         ;;
11653 esac
11654
11655 : see if endservent exists
11656 set endservent d_endsent
11657 eval $inlibc
11658
11659 : see if endservent_r exists
11660 set endservent_r d_endservent_r
11661 eval $inlibc
11662 case "$d_endservent_r" in
11663 "$define")
11664         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11665         case "$d_endservent_r_proto:$usethreads" in
11666         ":define")      d_endservent_r_proto=define
11667                 set d_endservent_r_proto endservent_r $hdrs
11668                 eval $hasproto ;;
11669         *)      ;;
11670         esac
11671         case "$d_endservent_r_proto" in
11672         define)
11673         case "$endservent_r_proto" in
11674         ''|0) try='int endservent_r(struct servent_data*);'
11675         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11676         esac
11677         case "$endservent_r_proto" in
11678         ''|0) try='void endservent_r(struct servent_data*);'
11679         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11680         esac
11681         case "$endservent_r_proto" in
11682         ''|0)   d_endservent_r=undef
11683                 endservent_r_proto=0
11684                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11685         * )     case "$endservent_r_proto" in
11686                 REENTRANT_PROTO*) ;;
11687                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11688                 esac
11689                 echo "Prototype: $try" ;;
11690         esac
11691         ;;
11692         *)      case "$usethreads" in
11693                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11694                 esac
11695                 d_endservent_r=undef
11696                 endservent_r_proto=0
11697                 ;;
11698         esac
11699         ;;
11700 *)      endservent_r_proto=0
11701         ;;
11702 esac
11703
11704 : Locate the flags for 'open()'
11705 echo " "
11706 $cat >try.c <<EOCP
11707 #include <sys/types.h>
11708 #ifdef I_FCNTL
11709 #include <fcntl.h>
11710 #endif
11711 #ifdef I_SYS_FILE
11712 #include <sys/file.h>
11713 #endif
11714 #$i_stdlib I_STDLIB
11715 #ifdef I_STDLIB
11716 #include <stdlib.h>
11717 #endif
11718 int main() {
11719         if(O_RDONLY);
11720 #ifdef O_TRUNC
11721         exit(0);
11722 #else
11723         exit(1);
11724 #endif
11725 }
11726 EOCP
11727 : check sys/file.h first to get FREAD on Sun
11728 if $test `./findhdr sys/file.h` && \
11729                 set try -DI_SYS_FILE && eval $compile; then
11730         h_sysfile=true;
11731         echo "<sys/file.h> defines the O_* constants..." >&4
11732         if $run ./try; then
11733                 echo "and you have the 3 argument form of open()." >&4
11734                 val="$define"
11735         else
11736                 echo "but not the 3 argument form of open().  Oh, well." >&4
11737                 val="$undef"
11738         fi
11739 elif $test `./findhdr fcntl.h` && \
11740                 set try -DI_FCNTL && eval $compile; then
11741         h_fcntl=true;
11742         echo "<fcntl.h> defines the O_* constants..." >&4
11743         if $run ./try; then
11744                 echo "and you have the 3 argument form of open()." >&4
11745                 val="$define"
11746         else
11747                 echo "but not the 3 argument form of open().  Oh, well." >&4
11748                 val="$undef"
11749         fi
11750 else
11751         val="$undef"
11752         echo "I can't find the O_* constant definitions!  You got problems." >&4
11753 fi
11754 set d_open3
11755 eval $setvar
11756 $rm -f try try.*
11757
11758 : see which of string.h or strings.h is needed
11759 echo " "
11760 strings=`./findhdr string.h`
11761 if $test "$strings" && $test -r "$strings"; then
11762         echo "Using <string.h> instead of <strings.h>." >&4
11763         val="$define"
11764 else
11765         val="$undef"
11766         strings=`./findhdr strings.h`
11767         if $test "$strings" && $test -r "$strings"; then
11768                 echo "Using <strings.h> instead of <string.h>." >&4
11769         else
11770                 echo "No string header found -- You'll surely have problems." >&4
11771         fi
11772 fi
11773 set i_string
11774 eval $setvar
11775 case "$i_string" in
11776 "$undef") strings=`./findhdr strings.h`;;
11777 *)        strings=`./findhdr string.h`;;
11778 esac
11779
11780 : see if this is a sys/file.h system
11781 val=''
11782 set sys/file.h val
11783 eval $inhdr
11784
11785 : do we need to include sys/file.h ?
11786 case "$val" in
11787 "$define")
11788         echo " "
11789         if $h_sysfile; then
11790                 val="$define"
11791                 echo "We'll be including <sys/file.h>." >&4
11792         else
11793                 val="$undef"
11794                 echo "We won't be including <sys/file.h>." >&4
11795         fi
11796         ;;
11797 *)
11798         h_sysfile=false
11799         ;;
11800 esac
11801 set i_sysfile
11802 eval $setvar
11803
11804 : see if fcntl.h is there
11805 val=''
11806 set fcntl.h val
11807 eval $inhdr
11808
11809 : see if we can include fcntl.h
11810 case "$val" in
11811 "$define")
11812         echo " "
11813         if $h_fcntl; then
11814                 val="$define"
11815                 echo "We'll be including <fcntl.h>." >&4
11816         else
11817                 val="$undef"
11818                 if $h_sysfile; then
11819         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11820                 else
11821                         echo "We won't be including <fcntl.h>." >&4
11822                 fi
11823         fi
11824         ;;
11825 *)
11826         h_fcntl=false
11827         val="$undef"
11828         ;;
11829 esac
11830 set i_fcntl
11831 eval $setvar
11832
11833 : check for non-blocking I/O stuff
11834 case "$h_sysfile" in
11835 true) echo "#include <sys/file.h>" > head.c;;
11836 *)
11837        case "$h_fcntl" in
11838        true) echo "#include <fcntl.h>" > head.c;;
11839        *) echo "#include <sys/fcntl.h>" > head.c;;
11840        esac
11841        ;;
11842 esac
11843 echo " "
11844 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11845 case "$o_nonblock" in
11846 '')
11847         $cat head.c > try.c
11848         $cat >>try.c <<EOCP
11849 #include <stdio.h>
11850 #$i_stdlib I_STDLIB
11851 #ifdef I_STDLIB
11852 #include <stdlib.h>
11853 #endif
11854 #$i_fcntl I_FCNTL
11855 #ifdef I_FCNTL
11856 #include <fcntl.h>
11857 #endif
11858 int main() {
11859 #ifdef O_NONBLOCK
11860         printf("O_NONBLOCK\n");
11861         exit(0);
11862 #endif
11863 #ifdef O_NDELAY
11864         printf("O_NDELAY\n");
11865         exit(0);
11866 #endif
11867 #ifdef FNDELAY
11868         printf("FNDELAY\n");
11869         exit(0);
11870 #endif
11871         exit(0);
11872 }
11873 EOCP
11874         set try
11875         if eval $compile_ok; then
11876                 o_nonblock=`$run ./try`
11877                 case "$o_nonblock" in
11878                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11879                 *) echo "Seems like we can use $o_nonblock.";;
11880                 esac
11881         else
11882                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11883         fi
11884         ;;
11885 *) echo "Using $hint value $o_nonblock.";;
11886 esac
11887 $rm -f try try.* .out core
11888
11889 echo " "
11890 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11891 case "$eagain" in
11892 '')
11893         $cat head.c > try.c
11894         $cat >>try.c <<EOCP
11895 #include <errno.h>
11896 #include <sys/types.h>
11897 #include <signal.h>
11898 #include <stdio.h> 
11899 #$i_stdlib I_STDLIB
11900 #ifdef I_STDLIB
11901 #include <stdlib.h>
11902 #endif
11903 #$i_fcntl I_FCNTL
11904 #ifdef I_FCNTL
11905 #include <fcntl.h>
11906 #endif
11907 #define MY_O_NONBLOCK $o_nonblock
11908 #ifndef errno  /* XXX need better Configure test */
11909 extern int errno;
11910 #endif
11911 #$i_unistd I_UNISTD
11912 #ifdef I_UNISTD
11913 #include <unistd.h>
11914 #endif
11915 #$i_string I_STRING
11916 #ifdef I_STRING
11917 #include <string.h>
11918 #else
11919 #include <strings.h>
11920 #endif
11921 $signal_t blech(x) int x; { exit(3); }
11922 EOCP
11923         $cat >> try.c <<'EOCP'
11924 int main()
11925 {
11926         int pd[2];
11927         int pu[2];
11928         char buf[1];
11929         char string[100];
11930
11931         pipe(pd);       /* Down: child -> parent */
11932         pipe(pu);       /* Up: parent -> child */
11933         if (0 != fork()) {
11934                 int ret;
11935                 close(pd[1]);   /* Parent reads from pd[0] */
11936                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11937 #ifdef F_SETFL
11938                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11939                         exit(1);
11940 #else
11941                 exit(4);
11942 #endif
11943                 signal(SIGALRM, blech);
11944                 alarm(5);
11945                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11946                         exit(2);
11947                 sprintf(string, "%d\n", ret);
11948                 write(2, string, strlen(string));
11949                 alarm(0);
11950 #ifdef EAGAIN
11951                 if (errno == EAGAIN) {
11952                         printf("EAGAIN\n");
11953                         goto ok;
11954                 }
11955 #endif
11956 #ifdef EWOULDBLOCK
11957                 if (errno == EWOULDBLOCK)
11958                         printf("EWOULDBLOCK\n");
11959 #endif
11960         ok:
11961                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11962                 sleep(2);                               /* Give it time to close our pipe */
11963                 alarm(5);
11964                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11965                 alarm(0);
11966                 sprintf(string, "%d\n", ret);
11967                 write(4, string, strlen(string));
11968                 exit(0);
11969         }
11970
11971         close(pd[0]);                   /* We write to pd[1] */
11972         close(pu[1]);                   /* We read from pu[0] */
11973         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11974         close(pd[1]);                   /* Pipe pd is now fully closed! */
11975         exit(0);                                /* Bye bye, thank you for playing! */
11976 }
11977 EOCP
11978         set try
11979         if eval $compile_ok; then
11980                 echo "$startsh" >mtry
11981                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11982                 chmod +x mtry
11983                 ./mtry >/dev/null 2>&1
11984                 case $? in
11985                 0) eagain=`$cat try.out`;;
11986                 1) echo "Could not perform non-blocking setting!";;
11987                 2) echo "I did a successful read() for something that was not there!";;
11988                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11989                 4) echo "Could not find F_SETFL!";;
11990                 *) echo "Something terribly wrong happened during testing.";;
11991                 esac
11992                 rd_nodata=`$cat try.ret`
11993                 echo "A read() system call with no data present returns $rd_nodata."
11994                 case "$rd_nodata" in
11995                 0|-1) ;;
11996                 *)
11997                         echo "(That's peculiar, fixing that to be -1.)"
11998                         rd_nodata=-1
11999                         ;;
12000                 esac
12001                 case "$eagain" in
12002                 '')
12003                         echo "Forcing errno EAGAIN on read() with no data available."
12004                         eagain=EAGAIN
12005                         ;;
12006                 *)
12007                         echo "Your read() sets errno to $eagain when no data is available."
12008                         ;;
12009                 esac
12010                 status=`$cat try.err`
12011                 case "$status" in
12012                 0) echo "And it correctly returns 0 to signal EOF.";;
12013                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12014                 *) echo "However, your read() returns '$status' on EOF??";;
12015                 esac
12016                 val="$define"
12017                 if test "$status" = "$rd_nodata"; then
12018                         echo "WARNING: you can't distinguish between EOF and no data!"
12019                         val="$undef"
12020                 fi
12021         else
12022                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12023                 eagain=EAGAIN
12024         fi
12025         set d_eofnblk
12026         eval $setvar
12027         ;;
12028 *)
12029         echo "Using $hint value $eagain."
12030         echo "Your read() returns $rd_nodata when no data is present."
12031         case "$d_eofnblk" in
12032         "$define") echo "And you can see EOF because read() returns 0.";;
12033         "$undef") echo "But you can't see EOF status from read() returned value.";;
12034         *)
12035                 echo "(Assuming you can't see EOF status from read anyway.)"
12036                 d_eofnblk=$undef
12037                 ;;
12038         esac
12039         ;;
12040 esac
12041 $rm -f try try.* .out core head.c mtry
12042
12043 : see if _ptr and _cnt from stdio act std
12044 echo " "
12045
12046 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12047         echo "(Looks like you have stdio.h from BSD.)"
12048         case "$stdio_ptr" in
12049         '') stdio_ptr='((fp)->_p)'
12050                 ptr_lval=$define
12051                 ;;
12052         *)      ptr_lval=$d_stdio_ptr_lval;;
12053         esac
12054         case "$stdio_cnt" in
12055         '') stdio_cnt='((fp)->_r)'
12056                 cnt_lval=$define
12057                 ;;
12058         *)      cnt_lval=$d_stdio_cnt_lval;;
12059         esac
12060         case "$stdio_base" in
12061         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12062         esac
12063         case "$stdio_bufsiz" in
12064         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12065         esac
12066 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12067         echo "(Looks like you have stdio.h from Linux.)"
12068         case "$stdio_ptr" in
12069         '') stdio_ptr='((fp)->_IO_read_ptr)'
12070                 ptr_lval=$define
12071                 ;;
12072         *)      ptr_lval=$d_stdio_ptr_lval;;
12073         esac
12074         case "$stdio_cnt" in
12075         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12076                 cnt_lval=$undef
12077                 ;;
12078         *)      cnt_lval=$d_stdio_cnt_lval;;
12079         esac
12080         case "$stdio_base" in
12081         '') stdio_base='((fp)->_IO_read_base)';;
12082         esac
12083         case "$stdio_bufsiz" in
12084         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12085         esac
12086 else
12087         case "$stdio_ptr" in
12088         '') stdio_ptr='((fp)->_ptr)'
12089                 ptr_lval=$define
12090                 ;;
12091         *)      ptr_lval=$d_stdio_ptr_lval;;
12092         esac
12093         case "$stdio_cnt" in
12094         '') stdio_cnt='((fp)->_cnt)'
12095                 cnt_lval=$define
12096                 ;;
12097         *)      cnt_lval=$d_stdio_cnt_lval;;
12098         esac
12099         case "$stdio_base" in
12100         '') stdio_base='((fp)->_base)';;
12101         esac
12102         case "$stdio_bufsiz" in
12103         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12104         esac
12105 fi
12106
12107 : test whether _ptr and _cnt really work
12108 echo "Checking how std your stdio is..." >&4
12109 $cat >try.c <<EOP
12110 #include <stdio.h>
12111 #$i_stdlib I_STDLIB
12112 #ifdef I_STDLIB
12113 #include <stdlib.h>
12114 #endif
12115 #define FILE_ptr(fp)    $stdio_ptr
12116 #define FILE_cnt(fp)    $stdio_cnt
12117 int main() {
12118         FILE *fp = fopen("try.c", "r");
12119         char c = getc(fp);
12120         if (
12121                 18 <= FILE_cnt(fp) &&
12122                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12123         )
12124                 exit(0);
12125         exit(1);
12126 }
12127 EOP
12128 val="$undef"
12129 set try
12130 if eval $compile && $to try.c; then
12131         if $run ./try; then
12132                 echo "Your stdio acts pretty std."
12133                 val="$define"
12134         else
12135                 echo "Your stdio isn't very std."
12136         fi
12137 else
12138         echo "Your stdio doesn't appear very std."
12139 fi
12140 $rm -f try.c try
12141
12142 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12143 # direct buffer manipulation no longer works.  The Configure tests
12144 # should be changed to correctly detect this, but until then,
12145 # the following check should at least let perl compile and run.
12146 # (This quick fix should be updated before 5.8.1.)
12147 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12148 # A. Dougherty, June 3, 2002.
12149 case "$d_gnulibc" in
12150 $define)
12151         case "$gnulibc_version" in
12152         2.[01]*)  ;;
12153         2.2) ;;
12154         2.2.[0-9]) ;;
12155         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12156                 val="$undef"
12157                 ;;
12158         esac
12159         ;;
12160 esac
12161 set d_stdstdio
12162 eval $setvar
12163
12164 : Can _ptr be used as an lvalue?
12165 case "$d_stdstdio$ptr_lval" in
12166 $define$define) val=$define ;;
12167 *) val=$undef ;;
12168 esac
12169 set d_stdio_ptr_lval
12170 eval $setvar
12171
12172 : Can _cnt be used as an lvalue?
12173 case "$d_stdstdio$cnt_lval" in
12174 $define$define) val=$define ;;
12175 *) val=$undef ;;
12176 esac
12177 set d_stdio_cnt_lval
12178 eval $setvar
12179
12180
12181 : test whether setting _ptr sets _cnt as a side effect
12182 d_stdio_ptr_lval_sets_cnt="$undef"
12183 d_stdio_ptr_lval_nochange_cnt="$undef"
12184 case "$d_stdio_ptr_lval$d_stdstdio" in
12185 $define$define)
12186         echo "Checking to see what happens if we set the stdio ptr..." >&4
12187 $cat >try.c <<EOP
12188 #include <stdio.h>
12189 /* Can we scream? */
12190 /* Eat dust sed :-) */
12191 /* In the buffer space, no one can hear you scream. */
12192 #$i_stdlib I_STDLIB
12193 #ifdef I_STDLIB
12194 #include <stdlib.h>
12195 #endif
12196 #define FILE_ptr(fp)    $stdio_ptr
12197 #define FILE_cnt(fp)    $stdio_cnt
12198 #include <sys/types.h>
12199 int main() {
12200         FILE *fp = fopen("try.c", "r");
12201         int c;
12202         char *ptr;
12203         size_t cnt;
12204         if (!fp) {
12205             puts("Fail even to read");
12206             exit(1);
12207         }
12208         c = getc(fp); /* Read away the first # */
12209         if (c == EOF) {
12210             puts("Fail even to read");
12211             exit(1);
12212         }
12213         if (!(
12214                 18 <= FILE_cnt(fp) &&
12215                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12216         )) {
12217                 puts("Fail even to read");
12218                 exit (1);
12219         }
12220         ptr = (char*) FILE_ptr(fp);
12221         cnt = (size_t)FILE_cnt(fp);
12222
12223         FILE_ptr(fp) += 42;
12224
12225         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12226                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12227                 exit (1);
12228         }
12229         if (FILE_cnt(fp) <= 20) {
12230                 printf ("Fail (<20 chars to test)");
12231                 exit (1);
12232         }
12233         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12234                 puts("Fail compare");
12235                 exit (1);
12236         }
12237         if (cnt == FILE_cnt(fp)) {
12238                 puts("Pass_unchanged");
12239                 exit (0);
12240         }       
12241         if (FILE_cnt(fp) == (cnt - 42)) {
12242                 puts("Pass_changed");
12243                 exit (0);
12244         }
12245         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12246         return 1;
12247
12248 }
12249 EOP
12250         set try
12251         if eval $compile && $to try.c; then
12252                 case `$run ./try` in
12253                 Pass_changed)
12254                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12255                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12256                 Pass_unchanged)
12257                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12258                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12259                 Fail*)
12260                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12261                 *)
12262                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12263         esac
12264         else
12265                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12266         fi
12267         $rm -f try.c try
12268         ;;
12269 esac
12270
12271 : see if _base is also standard
12272 val="$undef"
12273 case "$d_stdstdio" in
12274 $define)
12275         $cat >try.c <<EOP
12276 #include <stdio.h>
12277 #$i_stdlib I_STDLIB
12278 #ifdef I_STDLIB
12279 #include <stdlib.h>
12280 #endif
12281 #define FILE_base(fp)   $stdio_base
12282 #define FILE_bufsiz(fp) $stdio_bufsiz
12283 int main() {
12284         FILE *fp = fopen("try.c", "r");
12285         char c = getc(fp);
12286         if (
12287                 19 <= FILE_bufsiz(fp) &&
12288                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12289         )
12290                 exit(0);
12291         exit(1);
12292 }
12293 EOP
12294         set try
12295         if eval $compile && $to try.c; then
12296                 if $run ./try; then
12297                         echo "And its _base field acts std."
12298                         val="$define"
12299                 else
12300                         echo "But its _base field isn't std."
12301                 fi
12302         else
12303                 echo "However, it seems to be lacking the _base field."
12304         fi
12305         $rm -f try.c try
12306         ;;
12307 esac
12308 set d_stdiobase
12309 eval $setvar
12310
12311 : see if fast_stdio exists
12312 val="$undef"
12313 case "$d_stdstdio:$d_stdio_ptr_lval" in
12314 "$define:$define")
12315         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12316         *$define*)
12317                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12318                 val="$define"
12319                 ;;
12320         esac
12321         ;;
12322 esac
12323 set d_faststdio
12324 eval $setvar
12325
12326
12327
12328 : see if fchdir exists
12329 set fchdir d_fchdir
12330 eval $inlibc
12331
12332 : see if fchmod exists
12333 set fchmod d_fchmod
12334 eval $inlibc
12335
12336 : see if fchown exists
12337 set fchown d_fchown
12338 eval $inlibc
12339
12340 : see if this is an fcntl system
12341 set fcntl d_fcntl
12342 eval $inlibc
12343
12344 echo " "
12345 : See if fcntl-based locking works.
12346 $cat >try.c <<EOCP
12347 #$i_stdlib I_STDLIB
12348 #ifdef I_STDLIB
12349 #include <stdlib.h>
12350 #endif
12351 #include <unistd.h>
12352 #include <fcntl.h>
12353 #include <signal.h>
12354 $signal_t blech(x) int x; { exit(3); }
12355 int main() {
12356 #if defined(F_SETLK) && defined(F_SETLKW)
12357      struct flock flock;
12358      int retval, fd;
12359      fd = open("try.c", O_RDONLY);
12360      flock.l_type = F_RDLCK;
12361      flock.l_whence = SEEK_SET;
12362      flock.l_start = flock.l_len = 0;
12363      signal(SIGALRM, blech);
12364      alarm(10);
12365      retval = fcntl(fd, F_SETLK, &flock);
12366      close(fd);
12367      (retval < 0 ? exit(2) : exit(0));
12368 #else
12369      exit(2);
12370 #endif
12371 }
12372 EOCP
12373 echo "Checking if fcntl-based file locking works... "
12374 case "$d_fcntl" in
12375 "$define")
12376         set try
12377         if eval $compile_ok; then
12378                 if $run ./try; then
12379                         echo "Yes, it seems to work."
12380                         val="$define"
12381                 else
12382                         echo "Nope, it didn't work."
12383                         val="$undef"
12384                         case "$?" in
12385                         3) $cat >&4 <<EOM
12386 ***
12387 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12388 *** This is (almost) impossible.
12389 *** If your NFS lock daemons are not feeling well, something like
12390 *** this may happen, please investigate.  Cannot continue, aborting.
12391 ***
12392 EOM
12393                                 exit 1
12394                                 ;;
12395                         esac
12396                 fi
12397         else
12398                 echo "I'm unable to compile the test program, so I'll assume not."
12399                 val="$undef"
12400         fi
12401         ;;
12402 *) val="$undef";
12403         echo "Nope, since you don't even have fcntl()."
12404         ;;
12405 esac
12406 set d_fcntl_can_lock
12407 eval $setvar
12408 $rm -f try*
12409
12410
12411 : check for fd_set items
12412 $cat <<EOM
12413
12414 Checking to see how well your C compiler handles fd_set and friends ...
12415 EOM
12416 $cat >try.c <<EOCP
12417 #$i_stdlib I_STDLIB
12418 #ifdef I_STDLIB
12419 #include <stdlib.h>
12420 #endif
12421 #$i_systime I_SYS_TIME
12422 #$i_sysselct I_SYS_SELECT
12423 #$d_socket HAS_SOCKET
12424 #include <sys/types.h>
12425 #ifdef HAS_SOCKET
12426 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12427 #endif
12428 #ifdef I_SYS_TIME
12429 #include <sys/time.h>
12430 #endif
12431 #ifdef I_SYS_SELECT
12432 #include <sys/select.h>
12433 #endif
12434 int main() {
12435         fd_set fds;
12436
12437 #ifdef TRYBITS
12438         if(fds.fds_bits);
12439 #endif
12440
12441 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12442         exit(0);
12443 #else
12444         exit(1);
12445 #endif
12446 }
12447 EOCP
12448 set try -DTRYBITS
12449 if eval $compile; then
12450         d_fds_bits="$define"
12451         d_fd_set="$define"
12452         echo "Well, your system knows about the normal fd_set typedef..." >&4
12453         if $run ./try; then
12454                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12455                 d_fd_macros="$define"
12456         else
12457                 $cat >&4 <<'EOM'
12458 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12459 EOM
12460                 d_fd_macros="$undef"
12461         fi
12462 else
12463         $cat <<'EOM'
12464 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12465 EOM
12466         set try
12467         if eval $compile; then
12468                 d_fds_bits="$undef"
12469                 d_fd_set="$define"
12470                 echo "Well, your system has some sort of fd_set available..." >&4
12471                 if $run ./try; then
12472                         echo "and you have the normal fd_set macros." >&4
12473                         d_fd_macros="$define"
12474                 else
12475                         $cat <<'EOM'
12476 but not the normal fd_set macros!  Gross!  More work for me...
12477 EOM
12478                         d_fd_macros="$undef"
12479                 fi
12480         else
12481         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12482                 d_fd_set="$undef"
12483                 d_fds_bits="$undef"
12484                 d_fd_macros="$undef"
12485         fi
12486 fi
12487 $rm -f try try.*
12488
12489 : see if fgetpos exists
12490 set fgetpos d_fgetpos
12491 eval $inlibc
12492
12493 : see if finite exists
12494 set finite d_finite
12495 eval $inlibc
12496
12497 : see if finitel exists
12498 set finitel d_finitel
12499 eval $inlibc
12500
12501 : see if flock exists
12502 set flock d_flock
12503 eval $inlibc
12504
12505 : see if prototype for flock is available
12506 echo " "
12507 set d_flockproto flock $i_sysfile sys/file.h
12508 eval $hasproto
12509
12510 : see if fork exists
12511 set fork d_fork
12512 eval $inlibc
12513
12514 : see if fp_class exists
12515 set fp_class d_fp_class
12516 eval $inlibc
12517
12518 : see if pathconf exists
12519 set pathconf d_pathconf
12520 eval $inlibc
12521
12522 : see if fpathconf exists
12523 set fpathconf d_fpathconf
12524 eval $inlibc
12525
12526 : see if fpclass exists
12527 set fpclass d_fpclass
12528 eval $inlibc
12529
12530 : see if fpclassify exists
12531 set fpclassify d_fpclassify
12532 eval $inlibc
12533
12534 : see if fpclassl exists
12535 set fpclassl d_fpclassl
12536 eval $inlibc
12537
12538
12539 : check for fpos64_t
12540 echo " "
12541 echo "Checking to see if you have fpos64_t..." >&4
12542 $cat >try.c <<EOCP
12543 #include <stdio.h>
12544 int main() { fpos64_t x = 7; }
12545 EOCP
12546 set try
12547 if eval $compile; then
12548         val="$define"
12549         echo "You have fpos64_t."
12550 else
12551         val="$undef"
12552         echo "You do not have fpos64_t."
12553         case "$fpossize" in
12554         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12555         esac
12556 fi
12557 $rm -f try.* try
12558 set d_fpos64_t
12559 eval $setvar
12560
12561 : see if frexpl exists
12562 set frexpl d_frexpl
12563 eval $inlibc
12564
12565 : see if this is a sys/param system
12566 set sys/param.h i_sysparam
12567 eval $inhdr
12568
12569 : see if this is a sys/mount.h system
12570 set sys/mount.h i_sysmount
12571 eval $inhdr
12572
12573
12574 echo " "
12575 echo "Checking to see if your system supports struct fs_data..." >&4
12576 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12577 eval $hasstruct
12578 case "$d_fs_data_s" in
12579 "$define")      echo "Yes, it does."   ;;
12580 *)              echo "No, it doesn't." ;;
12581 esac
12582
12583 : see if fseeko exists
12584 set fseeko d_fseeko
12585 eval $inlibc
12586 case "$longsize" in
12587 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12588 esac
12589
12590 : see if fsetpos exists
12591 set fsetpos d_fsetpos
12592 eval $inlibc
12593
12594
12595 : see if fstatfs exists
12596 set fstatfs d_fstatfs
12597 eval $inlibc
12598
12599
12600 : see if statvfs exists
12601 set statvfs d_statvfs
12602 eval $inlibc
12603
12604 : see if fstatvfs exists
12605 set fstatvfs d_fstatvfs
12606 eval $inlibc
12607
12608
12609 : see if fsync exists
12610 set fsync d_fsync
12611 eval $inlibc
12612
12613 : see if ftello exists
12614 set ftello d_ftello
12615 eval $inlibc
12616 case "$longsize" in
12617 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12618 esac
12619
12620 d_futimes="$undef"
12621 : check for a working futimes
12622 echo " "
12623 echo "Checking for a working futimes()" >&4
12624 $cat >try.c <<EOCP
12625 #include <stdio.h>
12626 #include <sys/time.h>
12627 #include <errno.h>
12628 #include <fcntl.h>
12629
12630 int main ()
12631 {
12632     int fd, rv;
12633     fd = open ("try.c", O_RDWR);
12634     if (-1 == fd) exit (1);
12635     rv = futimes (fd, NULL);
12636     exit (rv == -1 ? errno : 0);
12637 }
12638 EOCP
12639 set try
12640 if eval $compile; then
12641     `$run ./try`
12642     rc=$?
12643     case "$rc" in
12644         0)  echo "Yes, it does" >&4
12645             d_futimes="$define"
12646             ;;
12647         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12648             ;;
12649     esac
12650 else
12651     echo "No, it does not (probably harmless)\n" >&4
12652 fi
12653 $rm -f try.* try core core.try.*
12654
12655 : see if getcwd exists
12656 set getcwd d_getcwd
12657 eval $inlibc
12658
12659 : see if getespwnam exists
12660 set getespwnam d_getespwnam
12661 eval $inlibc
12662
12663
12664 : see if getfsstat exists
12665 set getfsstat d_getfsstat
12666 eval $inlibc
12667
12668 : see if getgrent exists
12669 set getgrent d_getgrent
12670 eval $inlibc
12671
12672 : see if getgrent_r exists
12673 set getgrent_r d_getgrent_r
12674 eval $inlibc
12675 case "$d_getgrent_r" in
12676 "$define")
12677         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12678         case "$d_getgrent_r_proto:$usethreads" in
12679         ":define")      d_getgrent_r_proto=define
12680                 set d_getgrent_r_proto getgrent_r $hdrs
12681                 eval $hasproto ;;
12682         *)      ;;
12683         esac
12684         case "$d_getgrent_r_proto" in
12685         define)
12686         case "$getgrent_r_proto" in
12687         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12688         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12689         esac
12690         case "$getgrent_r_proto" in
12691         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12692         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12693         esac
12694         case "$getgrent_r_proto" in
12695         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12696         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12697         esac
12698         case "$getgrent_r_proto" in
12699         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12700         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12701         esac
12702         case "$getgrent_r_proto" in
12703         ''|0) try='int getgrent_r(struct group*, char*, int);'
12704         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12705         esac
12706         case "$getgrent_r_proto" in
12707         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12708         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12709         esac
12710         case "$getgrent_r_proto" in
12711         ''|0)   d_getgrent_r=undef
12712                 getgrent_r_proto=0
12713                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12714         * )     case "$getgrent_r_proto" in
12715                 REENTRANT_PROTO*) ;;
12716                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12717                 esac
12718                 echo "Prototype: $try" ;;
12719         esac
12720         ;;
12721         *)      case "$usethreads" in
12722                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12723                 esac
12724                 d_getgrent_r=undef
12725                 getgrent_r_proto=0
12726                 ;;
12727         esac
12728         ;;
12729 *)      getgrent_r_proto=0
12730         ;;
12731 esac
12732
12733 : see if getgrgid_r exists
12734 set getgrgid_r d_getgrgid_r
12735 eval $inlibc
12736 case "$d_getgrgid_r" in
12737 "$define")
12738         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12739         case "$d_getgrgid_r_proto:$usethreads" in
12740         ":define")      d_getgrgid_r_proto=define
12741                 set d_getgrgid_r_proto getgrgid_r $hdrs
12742                 eval $hasproto ;;
12743         *)      ;;
12744         esac
12745         case "$d_getgrgid_r_proto" in
12746         define)
12747         case "$getgrgid_r_proto" in
12748         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12749         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12750         esac
12751         case "$getgrgid_r_proto" in
12752         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12753         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12754         esac
12755         case "$getgrgid_r_proto" in
12756         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12757         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12758         esac
12759         case "$getgrgid_r_proto" in
12760         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12761         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12762         esac
12763         case "$getgrgid_r_proto" in
12764         ''|0)   d_getgrgid_r=undef
12765                 getgrgid_r_proto=0
12766                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12767         * )     case "$getgrgid_r_proto" in
12768                 REENTRANT_PROTO*) ;;
12769                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12770                 esac
12771                 echo "Prototype: $try" ;;
12772         esac
12773         ;;
12774         *)      case "$usethreads" in
12775                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12776                 esac
12777                 d_getgrgid_r=undef
12778                 getgrgid_r_proto=0
12779                 ;;
12780         esac
12781         ;;
12782 *)      getgrgid_r_proto=0
12783         ;;
12784 esac
12785
12786 : see if getgrnam_r exists
12787 set getgrnam_r d_getgrnam_r
12788 eval $inlibc
12789 case "$d_getgrnam_r" in
12790 "$define")
12791         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12792         case "$d_getgrnam_r_proto:$usethreads" in
12793         ":define")      d_getgrnam_r_proto=define
12794                 set d_getgrnam_r_proto getgrnam_r $hdrs
12795                 eval $hasproto ;;
12796         *)      ;;
12797         esac
12798         case "$d_getgrnam_r_proto" in
12799         define)
12800         case "$getgrnam_r_proto" in
12801         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12802         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12803         esac
12804         case "$getgrnam_r_proto" in
12805         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12806         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12807         esac
12808         case "$getgrnam_r_proto" in
12809         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12810         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12811         esac
12812         case "$getgrnam_r_proto" in
12813         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12814         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12815         esac
12816         case "$getgrnam_r_proto" in
12817         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12818         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12819         esac
12820         case "$getgrnam_r_proto" in
12821         ''|0)   d_getgrnam_r=undef
12822                 getgrnam_r_proto=0
12823                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12824         * )     case "$getgrnam_r_proto" in
12825                 REENTRANT_PROTO*) ;;
12826                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12827                 esac
12828                 echo "Prototype: $try" ;;
12829         esac
12830         ;;
12831         *)      case "$usethreads" in
12832                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12833                 esac
12834                 d_getgrnam_r=undef
12835                 getgrnam_r_proto=0
12836                 ;;
12837         esac
12838         ;;
12839 *)      getgrnam_r_proto=0
12840         ;;
12841 esac
12842
12843 : see if gethostbyaddr exists
12844 set gethostbyaddr d_gethbyaddr
12845 eval $inlibc
12846
12847 : see if gethostbyname exists
12848 set gethostbyname d_gethbyname
12849 eval $inlibc
12850
12851 : see if gethostent exists
12852 set gethostent d_gethent
12853 eval $inlibc
12854
12855 : see how we will look up host name
12856 echo " "
12857 call=''
12858 if set gethostname val -f d_gethname; eval $csym; $val; then
12859         echo 'gethostname() found.' >&4
12860         d_gethname="$define"
12861         call=gethostname
12862 fi
12863 if set uname val -f d_uname; eval $csym; $val; then
12864         if ./xenix; then
12865                 $cat <<'EOM'
12866 uname() was found, but you're running xenix, and older versions of xenix
12867 have a broken uname(). If you don't really know whether your xenix is old
12868 enough to have a broken system call, use the default answer.
12869
12870 EOM
12871                 dflt=y
12872                 case "$d_uname" in
12873                 "$define") dflt=n;;
12874                 esac
12875                 rp='Is your uname() broken?'
12876                 . ./myread
12877                 case "$ans" in
12878                 n*) d_uname="$define"; call=uname;;
12879                 esac
12880         else
12881                 echo 'uname() found.' >&4
12882                 d_uname="$define"
12883                 case "$call" in
12884                 '') call=uname ;;
12885                 esac
12886         fi
12887 fi
12888 case "$d_gethname" in
12889 '') d_gethname="$undef";;
12890 esac
12891 case "$d_uname" in
12892 '') d_uname="$undef";;
12893 esac
12894 case "$d_uname$d_gethname" in
12895 *define*)
12896         dflt=n
12897         cat <<EOM
12898  
12899 Every now and then someone has a $call() that lies about the hostname
12900 but can't be fixed for political or economic reasons.  If you wish, I can
12901 pretend $call() isn't there and maybe compute hostname at run-time
12902 thanks to the '$phostname' command.
12903
12904 EOM
12905         rp="Shall I ignore $call() from now on?"
12906         . ./myread
12907         case "$ans" in
12908         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12909         esac;;
12910 esac
12911 case "$phostname" in
12912 '') aphostname='';;
12913 *) case "$aphostname" in
12914         /*) ;;
12915         *) set X $phostname
12916                 shift
12917                 file=$1
12918                 shift
12919                 file=`./loc $file $file $pth`
12920                 aphostname=`echo $file $*`
12921                 ;;
12922         esac
12923         ;;
12924 esac
12925 case "$d_uname$d_gethname" in
12926 *define*) ;;
12927 *)
12928         case "$phostname" in
12929         '')
12930                 echo "There will be no way for $package to get your hostname." >&4;;
12931         *)
12932         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12933                 ;;
12934         esac;;
12935 esac
12936 case "$d_phostname" in
12937 '') d_phostname="$undef";;
12938 esac
12939
12940 : see if gethostbyaddr_r exists
12941 set gethostbyaddr_r d_gethostbyaddr_r
12942 eval $inlibc
12943 case "$d_gethostbyaddr_r" in
12944 "$define")
12945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12946         case "$d_gethostbyaddr_r_proto:$usethreads" in
12947         ":define")      d_gethostbyaddr_r_proto=define
12948                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12949                 eval $hasproto ;;
12950         *)      ;;
12951         esac
12952         case "$d_gethostbyaddr_r_proto" in
12953         define)
12954         case "$gethostbyaddr_r_proto" in
12955         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12956         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12957         esac
12958         case "$gethostbyaddr_r_proto" in
12959         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12960         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12961         esac
12962         case "$gethostbyaddr_r_proto" in
12963         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12964         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12965         esac
12966         case "$gethostbyaddr_r_proto" in
12967         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12968         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12969         esac
12970         case "$gethostbyaddr_r_proto" in
12971         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12972         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12973         esac
12974         case "$gethostbyaddr_r_proto" in
12975         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12976         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12977         esac
12978         case "$gethostbyaddr_r_proto" in
12979         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12980         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12981         esac
12982         case "$gethostbyaddr_r_proto" in
12983         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12984         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12985         esac
12986         case "$gethostbyaddr_r_proto" in
12987         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12988         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12989         esac
12990         case "$gethostbyaddr_r_proto" in
12991         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12992         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12993         esac
12994         case "$gethostbyaddr_r_proto" in
12995         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12996         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12997         esac
12998         case "$gethostbyaddr_r_proto" in
12999         ''|0)   d_gethostbyaddr_r=undef
13000                 gethostbyaddr_r_proto=0
13001                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13002         * )     case "$gethostbyaddr_r_proto" in
13003                 REENTRANT_PROTO*) ;;
13004                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13005                 esac
13006                 echo "Prototype: $try" ;;
13007         esac
13008         ;;
13009         *)      case "$usethreads" in
13010                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13011                 esac
13012                 d_gethostbyaddr_r=undef
13013                 gethostbyaddr_r_proto=0
13014                 ;;
13015         esac
13016         ;;
13017 *)      gethostbyaddr_r_proto=0
13018         ;;
13019 esac
13020
13021 : see if gethostbyname_r exists
13022 set gethostbyname_r d_gethostbyname_r
13023 eval $inlibc
13024 case "$d_gethostbyname_r" in
13025 "$define")
13026         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13027         case "$d_gethostbyname_r_proto:$usethreads" in
13028         ":define")      d_gethostbyname_r_proto=define
13029                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13030                 eval $hasproto ;;
13031         *)      ;;
13032         esac
13033         case "$d_gethostbyname_r_proto" in
13034         define)
13035         case "$gethostbyname_r_proto" in
13036         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13037         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13038         esac
13039         case "$gethostbyname_r_proto" in
13040         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13041         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13042         esac
13043         case "$gethostbyname_r_proto" in
13044         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13045         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13046         esac
13047         case "$gethostbyname_r_proto" in
13048         ''|0)   d_gethostbyname_r=undef
13049                 gethostbyname_r_proto=0
13050                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13051         * )     case "$gethostbyname_r_proto" in
13052                 REENTRANT_PROTO*) ;;
13053                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13054                 esac
13055                 echo "Prototype: $try" ;;
13056         esac
13057         ;;
13058         *)      case "$usethreads" in
13059                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13060                 esac
13061                 d_gethostbyname_r=undef
13062                 gethostbyname_r_proto=0
13063                 ;;
13064         esac
13065         ;;
13066 *)      gethostbyname_r_proto=0
13067         ;;
13068 esac
13069
13070 : see if gethostent_r exists
13071 set gethostent_r d_gethostent_r
13072 eval $inlibc
13073 case "$d_gethostent_r" in
13074 "$define")
13075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13076         case "$d_gethostent_r_proto:$usethreads" in
13077         ":define")      d_gethostent_r_proto=define
13078                 set d_gethostent_r_proto gethostent_r $hdrs
13079                 eval $hasproto ;;
13080         *)      ;;
13081         esac
13082         case "$d_gethostent_r_proto" in
13083         define)
13084         case "$gethostent_r_proto" in
13085         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13086         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13087         esac
13088         case "$gethostent_r_proto" in
13089         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13090         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13091         esac
13092         case "$gethostent_r_proto" in
13093         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13094         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13095         esac
13096         case "$gethostent_r_proto" in
13097         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13098         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13099         esac
13100         case "$gethostent_r_proto" in
13101         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13102         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13103         esac
13104         case "$gethostent_r_proto" in
13105         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13106         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13107         esac
13108         case "$gethostent_r_proto" in
13109         ''|0)   d_gethostent_r=undef
13110                 gethostent_r_proto=0
13111                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13112         * )     case "$gethostent_r_proto" in
13113                 REENTRANT_PROTO*) ;;
13114                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13115                 esac
13116                 echo "Prototype: $try" ;;
13117         esac
13118         ;;
13119         *)      case "$usethreads" in
13120                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13121                 esac
13122                 d_gethostent_r=undef
13123                 gethostent_r_proto=0
13124                 ;;
13125         esac
13126         ;;
13127 *)      gethostent_r_proto=0
13128         ;;
13129 esac
13130
13131 : see if prototypes for various gethostxxx netdb.h functions are available
13132 echo " "
13133 set d_gethostprotos gethostent $i_netdb netdb.h
13134 eval $hasproto
13135
13136 : see if getitimer exists
13137 set getitimer d_getitimer
13138 eval $inlibc
13139
13140 : see if getlogin exists
13141 set getlogin d_getlogin
13142 eval $inlibc
13143
13144 : see if getlogin_r exists
13145 set getlogin_r d_getlogin_r
13146 eval $inlibc
13147 case "$d_getlogin_r" in
13148 "$define")
13149         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13150         case "$d_getlogin_r_proto:$usethreads" in
13151         ":define")      d_getlogin_r_proto=define
13152                 set d_getlogin_r_proto getlogin_r $hdrs
13153                 eval $hasproto ;;
13154         *)      ;;
13155         esac
13156         case "$d_getlogin_r_proto" in
13157         define)
13158         case "$getlogin_r_proto" in
13159         ''|0) try='int getlogin_r(char*, size_t);'
13160         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13161         esac
13162         case "$getlogin_r_proto" in
13163         ''|0) try='int getlogin_r(char*, int);'
13164         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13165         esac
13166         case "$getlogin_r_proto" in
13167         ''|0) try='char* getlogin_r(char*, size_t);'
13168         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13169         esac
13170         case "$getlogin_r_proto" in
13171         ''|0) try='char* getlogin_r(char*, int);'
13172         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13173         esac
13174         case "$getlogin_r_proto" in
13175         ''|0)   d_getlogin_r=undef
13176                 getlogin_r_proto=0
13177                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13178         * )     case "$getlogin_r_proto" in
13179                 REENTRANT_PROTO*) ;;
13180                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13181                 esac
13182                 echo "Prototype: $try" ;;
13183         esac
13184         ;;
13185         *)      case "$usethreads" in
13186                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13187                 esac
13188                 d_getlogin_r=undef
13189                 getlogin_r_proto=0
13190                 ;;
13191         esac
13192         ;;
13193 *)      getlogin_r_proto=0
13194         ;;
13195 esac
13196
13197 : see if getmnt exists
13198 set getmnt d_getmnt
13199 eval $inlibc
13200
13201 : see if getmntent exists
13202 set getmntent d_getmntent
13203 eval $inlibc
13204
13205 : see if getnetbyaddr exists
13206 set getnetbyaddr d_getnbyaddr
13207 eval $inlibc
13208
13209 : see if getnetbyname exists
13210 set getnetbyname d_getnbyname
13211 eval $inlibc
13212
13213 : see if getnetent exists
13214 set getnetent d_getnent
13215 eval $inlibc
13216
13217 : see if getnetbyaddr_r exists
13218 set getnetbyaddr_r d_getnetbyaddr_r
13219 eval $inlibc
13220 case "$d_getnetbyaddr_r" in
13221 "$define")
13222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13223         case "$d_getnetbyaddr_r_proto:$usethreads" in
13224         ":define")      d_getnetbyaddr_r_proto=define
13225                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13226                 eval $hasproto ;;
13227         *)      ;;
13228         esac
13229         case "$d_getnetbyaddr_r_proto" in
13230         define)
13231         case "$getnetbyaddr_r_proto" in
13232         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13233         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13234         esac
13235         case "$getnetbyaddr_r_proto" in
13236         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13237         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13238         esac
13239         case "$getnetbyaddr_r_proto" in
13240         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13241         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13242         esac
13243         case "$getnetbyaddr_r_proto" in
13244         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13245         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13246         esac
13247         case "$getnetbyaddr_r_proto" in
13248         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13249         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13250         esac
13251         case "$getnetbyaddr_r_proto" in
13252         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13253         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13254         esac
13255         case "$getnetbyaddr_r_proto" in
13256         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13257         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13258         esac
13259         case "$getnetbyaddr_r_proto" in
13260         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13261         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13262         esac
13263         case "$getnetbyaddr_r_proto" in
13264         ''|0)   d_getnetbyaddr_r=undef
13265                 getnetbyaddr_r_proto=0
13266                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13267         * )     case "$getnetbyaddr_r_proto" in
13268                 REENTRANT_PROTO*) ;;
13269                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13270                 esac
13271                 echo "Prototype: $try" ;;
13272         esac
13273         ;;
13274         *)      case "$usethreads" in
13275                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13276                 esac
13277                 d_getnetbyaddr_r=undef
13278                 getnetbyaddr_r_proto=0
13279                 ;;
13280         esac
13281         ;;
13282 *)      getnetbyaddr_r_proto=0
13283         ;;
13284 esac
13285
13286 : see if getnetbyname_r exists
13287 set getnetbyname_r d_getnetbyname_r
13288 eval $inlibc
13289 case "$d_getnetbyname_r" in
13290 "$define")
13291         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13292         case "$d_getnetbyname_r_proto:$usethreads" in
13293         ":define")      d_getnetbyname_r_proto=define
13294                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13295                 eval $hasproto ;;
13296         *)      ;;
13297         esac
13298         case "$d_getnetbyname_r_proto" in
13299         define)
13300         case "$getnetbyname_r_proto" in
13301         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13302         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13303         esac
13304         case "$getnetbyname_r_proto" in
13305         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13306         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13307         esac
13308         case "$getnetbyname_r_proto" in
13309         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13310         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13311         esac
13312         case "$getnetbyname_r_proto" in
13313         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13314         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13315         esac
13316         case "$getnetbyname_r_proto" in
13317         ''|0)   d_getnetbyname_r=undef
13318                 getnetbyname_r_proto=0
13319                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13320         * )     case "$getnetbyname_r_proto" in
13321                 REENTRANT_PROTO*) ;;
13322                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13323                 esac
13324                 echo "Prototype: $try" ;;
13325         esac
13326         ;;
13327         *)      case "$usethreads" in
13328                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13329                 esac
13330                 d_getnetbyname_r=undef
13331                 getnetbyname_r_proto=0
13332                 ;;
13333         esac
13334         ;;
13335 *)      getnetbyname_r_proto=0
13336         ;;
13337 esac
13338
13339 : see if getnetent_r exists
13340 set getnetent_r d_getnetent_r
13341 eval $inlibc
13342 case "$d_getnetent_r" in
13343 "$define")
13344         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13345         case "$d_getnetent_r_proto:$usethreads" in
13346         ":define")      d_getnetent_r_proto=define
13347                 set d_getnetent_r_proto getnetent_r $hdrs
13348                 eval $hasproto ;;
13349         *)      ;;
13350         esac
13351         case "$d_getnetent_r_proto" in
13352         define)
13353         case "$getnetent_r_proto" in
13354         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13355         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13356         esac
13357         case "$getnetent_r_proto" in
13358         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13359         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13360         esac
13361         case "$getnetent_r_proto" in
13362         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13363         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13364         esac
13365         case "$getnetent_r_proto" in
13366         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13367         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13368         esac
13369         case "$getnetent_r_proto" in
13370         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13371         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13372         esac
13373         case "$getnetent_r_proto" in
13374         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13375         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13376         esac
13377         case "$getnetent_r_proto" in
13378         ''|0)   d_getnetent_r=undef
13379                 getnetent_r_proto=0
13380                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13381         * )     case "$getnetent_r_proto" in
13382                 REENTRANT_PROTO*) ;;
13383                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13384                 esac
13385                 echo "Prototype: $try" ;;
13386         esac
13387         ;;
13388         *)      case "$usethreads" in
13389                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13390                 esac
13391                 d_getnetent_r=undef
13392                 getnetent_r_proto=0
13393                 ;;
13394         esac
13395         ;;
13396 *)      getnetent_r_proto=0
13397         ;;
13398 esac
13399
13400 : see if prototypes for various getnetxxx netdb.h functions are available
13401 echo " "
13402 set d_getnetprotos getnetent $i_netdb netdb.h
13403 eval $hasproto
13404
13405 : see if getpagesize exists
13406 set getpagesize d_getpagsz
13407 eval $inlibc
13408
13409
13410 : see if getprotobyname exists
13411 set getprotobyname d_getpbyname
13412 eval $inlibc
13413
13414 : see if getprotobynumber exists
13415 set getprotobynumber d_getpbynumber
13416 eval $inlibc
13417
13418 : see if getprotoent exists
13419 set getprotoent d_getpent
13420 eval $inlibc
13421
13422 : see if getpgid exists
13423 set getpgid d_getpgid
13424 eval $inlibc
13425
13426 : see if getpgrp2 exists
13427 set getpgrp2 d_getpgrp2
13428 eval $inlibc
13429
13430 : see if getppid exists
13431 set getppid d_getppid
13432 eval $inlibc
13433
13434 : see if getpriority exists
13435 set getpriority d_getprior
13436 eval $inlibc
13437
13438 : see if getprotobyname_r exists
13439 set getprotobyname_r d_getprotobyname_r
13440 eval $inlibc
13441 case "$d_getprotobyname_r" in
13442 "$define")
13443         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13444         case "$d_getprotobyname_r_proto:$usethreads" in
13445         ":define")      d_getprotobyname_r_proto=define
13446                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13447                 eval $hasproto ;;
13448         *)      ;;
13449         esac
13450         case "$d_getprotobyname_r_proto" in
13451         define)
13452         case "$getprotobyname_r_proto" in
13453         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13454         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13455         esac
13456         case "$getprotobyname_r_proto" in
13457         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13458         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13459         esac
13460         case "$getprotobyname_r_proto" in
13461         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13462         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13463         esac
13464         case "$getprotobyname_r_proto" in
13465         ''|0)   d_getprotobyname_r=undef
13466                 getprotobyname_r_proto=0
13467                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13468         * )     case "$getprotobyname_r_proto" in
13469                 REENTRANT_PROTO*) ;;
13470                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13471                 esac
13472                 echo "Prototype: $try" ;;
13473         esac
13474         ;;
13475         *)      case "$usethreads" in
13476                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13477                 esac
13478                 d_getprotobyname_r=undef
13479                 getprotobyname_r_proto=0
13480                 ;;
13481         esac
13482         ;;
13483 *)      getprotobyname_r_proto=0
13484         ;;
13485 esac
13486
13487 : see if getprotobynumber_r exists
13488 set getprotobynumber_r d_getprotobynumber_r
13489 eval $inlibc
13490 case "$d_getprotobynumber_r" in
13491 "$define")
13492         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13493         case "$d_getprotobynumber_r_proto:$usethreads" in
13494         ":define")      d_getprotobynumber_r_proto=define
13495                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13496                 eval $hasproto ;;
13497         *)      ;;
13498         esac
13499         case "$d_getprotobynumber_r_proto" in
13500         define)
13501         case "$getprotobynumber_r_proto" in
13502         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13503         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13504         esac
13505         case "$getprotobynumber_r_proto" in
13506         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13507         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13508         esac
13509         case "$getprotobynumber_r_proto" in
13510         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13511         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13512         esac
13513         case "$getprotobynumber_r_proto" in
13514         ''|0)   d_getprotobynumber_r=undef
13515                 getprotobynumber_r_proto=0
13516                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13517         * )     case "$getprotobynumber_r_proto" in
13518                 REENTRANT_PROTO*) ;;
13519                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13520                 esac
13521                 echo "Prototype: $try" ;;
13522         esac
13523         ;;
13524         *)      case "$usethreads" in
13525                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13526                 esac
13527                 d_getprotobynumber_r=undef
13528                 getprotobynumber_r_proto=0
13529                 ;;
13530         esac
13531         ;;
13532 *)      getprotobynumber_r_proto=0
13533         ;;
13534 esac
13535
13536 : see if getprotoent_r exists
13537 set getprotoent_r d_getprotoent_r
13538 eval $inlibc
13539 case "$d_getprotoent_r" in
13540 "$define")
13541         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13542         case "$d_getprotoent_r_proto:$usethreads" in
13543         ":define")      d_getprotoent_r_proto=define
13544                 set d_getprotoent_r_proto getprotoent_r $hdrs
13545                 eval $hasproto ;;
13546         *)      ;;
13547         esac
13548         case "$d_getprotoent_r_proto" in
13549         define)
13550         case "$getprotoent_r_proto" in
13551         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13552         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13553         esac
13554         case "$getprotoent_r_proto" in
13555         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13556         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13557         esac
13558         case "$getprotoent_r_proto" in
13559         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13560         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13561         esac
13562         case "$getprotoent_r_proto" in
13563         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13564         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13565         esac
13566         case "$getprotoent_r_proto" in
13567         ''|0)   d_getprotoent_r=undef
13568                 getprotoent_r_proto=0
13569                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13570         * )     case "$getprotoent_r_proto" in
13571                 REENTRANT_PROTO*) ;;
13572                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13573                 esac
13574                 echo "Prototype: $try" ;;
13575         esac
13576         ;;
13577         *)      case "$usethreads" in
13578                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13579                 esac
13580                 d_getprotoent_r=undef
13581                 getprotoent_r_proto=0
13582                 ;;
13583         esac
13584         ;;
13585 *)      getprotoent_r_proto=0
13586         ;;
13587 esac
13588
13589 : see if prototypes for various getprotoxxx netdb.h functions are available
13590 echo " "
13591 set d_getprotoprotos getprotoent $i_netdb netdb.h
13592 eval $hasproto
13593
13594 : see if getprpwnam exists
13595 set getprpwnam d_getprpwnam
13596 eval $inlibc
13597
13598 : see if getpwent exists
13599 set getpwent d_getpwent
13600 eval $inlibc
13601
13602 : see if getpwent_r exists
13603 set getpwent_r d_getpwent_r
13604 eval $inlibc
13605 case "$d_getpwent_r" in
13606 "$define")
13607         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13608         case "$d_getpwent_r_proto:$usethreads" in
13609         ":define")      d_getpwent_r_proto=define
13610                 set d_getpwent_r_proto getpwent_r $hdrs
13611                 eval $hasproto ;;
13612         *)      ;;
13613         esac
13614         case "$d_getpwent_r_proto" in
13615         define)
13616         case "$getpwent_r_proto" in
13617         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13618         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13619         esac
13620         case "$getpwent_r_proto" in
13621         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13622         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13623         esac
13624         case "$getpwent_r_proto" in
13625         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13626         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13627         esac
13628         case "$getpwent_r_proto" in
13629         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13630         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13631         esac
13632         case "$getpwent_r_proto" in
13633         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13634         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13635         esac
13636         case "$getpwent_r_proto" in
13637         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13638         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13639         esac
13640         case "$getpwent_r_proto" in
13641         ''|0)   d_getpwent_r=undef
13642                 getpwent_r_proto=0
13643                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13644         * )     case "$getpwent_r_proto" in
13645                 REENTRANT_PROTO*) ;;
13646                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13647                 esac
13648                 echo "Prototype: $try" ;;
13649         esac
13650         ;;
13651         *)      case "$usethreads" in
13652                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13653                 esac
13654                 d_getpwent_r=undef
13655                 getpwent_r_proto=0
13656                 ;;
13657         esac
13658         ;;
13659 *)      getpwent_r_proto=0
13660         ;;
13661 esac
13662
13663 : see if getpwnam_r exists
13664 set getpwnam_r d_getpwnam_r
13665 eval $inlibc
13666 case "$d_getpwnam_r" in
13667 "$define")
13668         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13669         case "$d_getpwnam_r_proto:$usethreads" in
13670         ":define")      d_getpwnam_r_proto=define
13671                 set d_getpwnam_r_proto getpwnam_r $hdrs
13672                 eval $hasproto ;;
13673         *)      ;;
13674         esac
13675         case "$d_getpwnam_r_proto" in
13676         define)
13677         case "$getpwnam_r_proto" in
13678         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13679         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13680         esac
13681         case "$getpwnam_r_proto" in
13682         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13683         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13684         esac
13685         case "$getpwnam_r_proto" in
13686         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13687         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13688         esac
13689         case "$getpwnam_r_proto" in
13690         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13691         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13692         esac
13693         case "$getpwnam_r_proto" in
13694         ''|0)   d_getpwnam_r=undef
13695                 getpwnam_r_proto=0
13696                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13697         * )     case "$getpwnam_r_proto" in
13698                 REENTRANT_PROTO*) ;;
13699                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13700                 esac
13701                 echo "Prototype: $try" ;;
13702         esac
13703         ;;
13704         *)      case "$usethreads" in
13705                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13706                 esac
13707                 d_getpwnam_r=undef
13708                 getpwnam_r_proto=0
13709                 ;;
13710         esac
13711         ;;
13712 *)      getpwnam_r_proto=0
13713         ;;
13714 esac
13715
13716 : see if getpwuid_r exists
13717 set getpwuid_r d_getpwuid_r
13718 eval $inlibc
13719 case "$d_getpwuid_r" in
13720 "$define")
13721         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13722         case "$d_getpwuid_r_proto:$usethreads" in
13723         ":define")      d_getpwuid_r_proto=define
13724                 set d_getpwuid_r_proto getpwuid_r $hdrs
13725                 eval $hasproto ;;
13726         *)      ;;
13727         esac
13728         case "$d_getpwuid_r_proto" in
13729         define)
13730         case "$getpwuid_r_proto" in
13731         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13732         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13733         esac
13734         case "$getpwuid_r_proto" in
13735         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13736         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13737         esac
13738         case "$getpwuid_r_proto" in
13739         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13740         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13741         esac
13742         case "$getpwuid_r_proto" in
13743         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13744         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13745         esac
13746         case "$getpwuid_r_proto" in
13747         ''|0)   d_getpwuid_r=undef
13748                 getpwuid_r_proto=0
13749                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13750         * )     case "$getpwuid_r_proto" in
13751                 REENTRANT_PROTO*) ;;
13752                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13753                 esac
13754                 echo "Prototype: $try" ;;
13755         esac
13756         ;;
13757         *)      case "$usethreads" in
13758                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13759                 esac
13760                 d_getpwuid_r=undef
13761                 getpwuid_r_proto=0
13762                 ;;
13763         esac
13764         ;;
13765 *)      getpwuid_r_proto=0
13766         ;;
13767 esac
13768
13769
13770 : see if getservbyname exists
13771 set getservbyname d_getsbyname
13772 eval $inlibc
13773
13774 : see if getservbyport exists
13775 set getservbyport d_getsbyport
13776 eval $inlibc
13777
13778 : see if getservent exists
13779 set getservent d_getsent
13780 eval $inlibc
13781
13782 : see if getservbyname_r exists
13783 set getservbyname_r d_getservbyname_r
13784 eval $inlibc
13785 case "$d_getservbyname_r" in
13786 "$define")
13787         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13788         case "$d_getservbyname_r_proto:$usethreads" in
13789         ":define")      d_getservbyname_r_proto=define
13790                 set d_getservbyname_r_proto getservbyname_r $hdrs
13791                 eval $hasproto ;;
13792         *)      ;;
13793         esac
13794         case "$d_getservbyname_r_proto" in
13795         define)
13796         case "$getservbyname_r_proto" in
13797         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13798         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13799         esac
13800         case "$getservbyname_r_proto" in
13801         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13802         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13803         esac
13804         case "$getservbyname_r_proto" in
13805         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13806         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13807         esac
13808         case "$getservbyname_r_proto" in
13809         ''|0)   d_getservbyname_r=undef
13810                 getservbyname_r_proto=0
13811                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13812         * )     case "$getservbyname_r_proto" in
13813                 REENTRANT_PROTO*) ;;
13814                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13815                 esac
13816                 echo "Prototype: $try" ;;
13817         esac
13818         ;;
13819         *)      case "$usethreads" in
13820                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13821                 esac
13822                 d_getservbyname_r=undef
13823                 getservbyname_r_proto=0
13824                 ;;
13825         esac
13826         ;;
13827 *)      getservbyname_r_proto=0
13828         ;;
13829 esac
13830
13831 : see if getservbyport_r exists
13832 set getservbyport_r d_getservbyport_r
13833 eval $inlibc
13834 case "$d_getservbyport_r" in
13835 "$define")
13836         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13837         case "$d_getservbyport_r_proto:$usethreads" in
13838         ":define")      d_getservbyport_r_proto=define
13839                 set d_getservbyport_r_proto getservbyport_r $hdrs
13840                 eval $hasproto ;;
13841         *)      ;;
13842         esac
13843         case "$d_getservbyport_r_proto" in
13844         define)
13845         case "$getservbyport_r_proto" in
13846         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13847         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13848         esac
13849         case "$getservbyport_r_proto" in
13850         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13851         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13852         esac
13853         case "$getservbyport_r_proto" in
13854         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13855         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13856         esac
13857         case "$getservbyport_r_proto" in
13858         ''|0)   d_getservbyport_r=undef
13859                 getservbyport_r_proto=0
13860                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13861         * )     case "$getservbyport_r_proto" in
13862                 REENTRANT_PROTO*) ;;
13863                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13864                 esac
13865                 echo "Prototype: $try" ;;
13866         esac
13867         ;;
13868         *)      case "$usethreads" in
13869                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13870                 esac
13871                 d_getservbyport_r=undef
13872                 getservbyport_r_proto=0
13873                 ;;
13874         esac
13875         ;;
13876 *)      getservbyport_r_proto=0
13877         ;;
13878 esac
13879
13880 : see if getservent_r exists
13881 set getservent_r d_getservent_r
13882 eval $inlibc
13883 case "$d_getservent_r" in
13884 "$define")
13885         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13886         case "$d_getservent_r_proto:$usethreads" in
13887         ":define")      d_getservent_r_proto=define
13888                 set d_getservent_r_proto getservent_r $hdrs
13889                 eval $hasproto ;;
13890         *)      ;;
13891         esac
13892         case "$d_getservent_r_proto" in
13893         define)
13894         case "$getservent_r_proto" in
13895         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13896         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13897         esac
13898         case "$getservent_r_proto" in
13899         ''|0) try='int getservent_r(struct servent*, char*, int);'
13900         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13901         esac
13902         case "$getservent_r_proto" in
13903         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13904         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13905         esac
13906         case "$getservent_r_proto" in
13907         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13908         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13909         esac
13910         case "$getservent_r_proto" in
13911         ''|0)   d_getservent_r=undef
13912                 getservent_r_proto=0
13913                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13914         * )     case "$getservent_r_proto" in
13915                 REENTRANT_PROTO*) ;;
13916                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13917                 esac
13918                 echo "Prototype: $try" ;;
13919         esac
13920         ;;
13921         *)      case "$usethreads" in
13922                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13923                 esac
13924                 d_getservent_r=undef
13925                 getservent_r_proto=0
13926                 ;;
13927         esac
13928         ;;
13929 *)      getservent_r_proto=0
13930         ;;
13931 esac
13932
13933 : see if prototypes for various getservxxx netdb.h functions are available
13934 echo " "
13935 set d_getservprotos getservent $i_netdb netdb.h
13936 eval $hasproto
13937
13938 : see if getspnam exists
13939 set getspnam d_getspnam
13940 eval $inlibc
13941
13942 : see if this is a shadow.h system
13943 set shadow.h i_shadow
13944 eval $inhdr
13945
13946 : see if getspnam_r exists
13947 set getspnam_r d_getspnam_r
13948 eval $inlibc
13949 case "$d_getspnam_r" in
13950 "$define")
13951         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13952         case "$d_getspnam_r_proto:$usethreads" in
13953         ":define")      d_getspnam_r_proto=define
13954                 set d_getspnam_r_proto getspnam_r $hdrs
13955                 eval $hasproto ;;
13956         *)      ;;
13957         esac
13958         case "$d_getspnam_r_proto" in
13959         define)
13960         case "$getspnam_r_proto" in
13961         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13962         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13963         esac
13964         case "$getspnam_r_proto" in
13965         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13966         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13967         esac
13968         case "$getspnam_r_proto" in
13969         ''|0)   d_getspnam_r=undef
13970                 getspnam_r_proto=0
13971                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13972         * )     case "$getspnam_r_proto" in
13973                 REENTRANT_PROTO*) ;;
13974                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13975                 esac
13976                 echo "Prototype: $try" ;;
13977         esac
13978         ;;
13979         *)      case "$usethreads" in
13980                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13981                 esac
13982                 d_getspnam_r=undef
13983                 getspnam_r_proto=0
13984                 ;;
13985         esac
13986         ;;
13987 *)      getspnam_r_proto=0
13988         ;;
13989 esac
13990
13991 : see if gettimeofday or ftime exists
13992 set gettimeofday d_gettimeod
13993 eval $inlibc
13994 case "$d_gettimeod" in
13995 "$undef")
13996         set ftime d_ftime 
13997         eval $inlibc
13998         ;;
13999 *)
14000         val="$undef"; set d_ftime; eval $setvar
14001         ;;
14002 esac
14003 case "$d_gettimeod$d_ftime" in
14004 "$undef$undef")
14005         echo " "
14006         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14007         ;;
14008 esac
14009
14010 : see if gmtime_r exists
14011 set gmtime_r d_gmtime_r
14012 eval $inlibc
14013 case "$d_gmtime_r" in
14014 "$define")
14015         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14016         case "$d_gmtime_r_proto:$usethreads" in
14017         ":define")      d_gmtime_r_proto=define
14018                 set d_gmtime_r_proto gmtime_r $hdrs
14019                 eval $hasproto ;;
14020         *)      ;;
14021         esac
14022         case "$d_gmtime_r_proto" in
14023         define)
14024         case "$gmtime_r_proto" in
14025         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14026         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14027         esac
14028         case "$gmtime_r_proto" in
14029         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14030         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14031         esac
14032         case "$gmtime_r_proto" in
14033         ''|0)   d_gmtime_r=undef
14034                 gmtime_r_proto=0
14035                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14036         * )     case "$gmtime_r_proto" in
14037                 REENTRANT_PROTO*) ;;
14038                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14039                 esac
14040                 echo "Prototype: $try" ;;
14041         esac
14042         ;;
14043         *)      case "$usethreads" in
14044                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14045                 esac
14046                 d_gmtime_r=undef
14047                 gmtime_r_proto=0
14048                 ;;
14049         esac
14050         ;;
14051 *)      gmtime_r_proto=0
14052         ;;
14053 esac
14054
14055 : see if hasmntopt exists
14056 set hasmntopt d_hasmntopt
14057 eval $inlibc
14058
14059 : see if this is a netinet/in.h or sys/in.h system
14060 set netinet/in.h i_niin sys/in.h i_sysin
14061 eval $inhdr
14062
14063 : see if arpa/inet.h has to be included
14064 set arpa/inet.h i_arpainet
14065 eval $inhdr
14066
14067 : see if htonl --and friends-- exists
14068 val=''
14069 set htonl val
14070 eval $inlibc
14071
14072 : Maybe they are macros.
14073 case "$val" in
14074 $undef)
14075         $cat >htonl.c <<EOM
14076 #include <stdio.h>
14077 #include <sys/types.h>
14078 #$i_niin I_NETINET_IN
14079 #$i_sysin I_SYS_IN
14080 #$i_arpainet I_ARPA_INET
14081 #ifdef I_NETINET_IN
14082 #include <netinet/in.h>
14083 #endif
14084 #ifdef I_SYS_IN
14085 #include <sys/in.h>
14086 #endif
14087 #ifdef I_ARPA_INET
14088 #include <arpa/inet.h>
14089 #endif
14090 #ifdef htonl
14091 printf("Defined as a macro.");
14092 #endif
14093 EOM
14094         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14095         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14096                 val="$define"
14097                 echo "But it seems to be defined as a macro." >&4
14098         fi
14099         $rm -f htonl.?
14100         ;;
14101 esac
14102 set d_htonl
14103 eval $setvar
14104
14105 : see if ilogbl exists
14106 set ilogbl d_ilogbl
14107 eval $inlibc
14108
14109 : index or strchr
14110 echo " "
14111 if set index val -f; eval $csym; $val; then
14112         if set strchr val -f d_strchr; eval $csym; $val; then
14113                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14114                         val="$define"
14115                         vali="$undef"
14116                         echo "strchr() found." >&4
14117                 else
14118                         val="$undef"
14119                         vali="$define"
14120                         echo "index() found." >&4
14121                 fi
14122         else
14123                 val="$undef"
14124                 vali="$define"
14125                 echo "index() found." >&4
14126         fi
14127 else
14128         if set strchr val -f d_strchr; eval $csym; $val; then
14129                 val="$define"
14130                 vali="$undef"
14131                 echo "strchr() found." >&4
14132         else
14133                 echo "No index() or strchr() found!" >&4
14134                 val="$undef"
14135                 vali="$undef"
14136         fi
14137 fi
14138 set d_strchr; eval $setvar
14139 val="$vali"
14140 set d_index; eval $setvar
14141
14142 : check whether inet_aton exists
14143 set inet_aton d_inetaton
14144 eval $inlibc
14145
14146 : Look for isascii
14147 echo " "
14148 $cat >isascii.c <<EOCP
14149 #include <stdio.h>
14150 #include <ctype.h>
14151 #$i_stdlib I_STDLIB
14152 #ifdef I_STDLIB
14153 #include <stdlib.h>
14154 #endif
14155 int main() {
14156         int c = 'A';
14157         if (isascii(c))
14158                 exit(0);
14159         else
14160                 exit(1);
14161 }
14162 EOCP
14163 set isascii
14164 if eval $compile; then
14165         echo "isascii() found." >&4
14166         val="$define"
14167 else
14168         echo "isascii() NOT found." >&4
14169         val="$undef"
14170 fi
14171 set d_isascii
14172 eval $setvar
14173 $rm -f isascii*
14174
14175 : see if isfinite exists
14176 set isfinite d_isfinite
14177 eval $inlibc
14178
14179 : see if isinf exists
14180 set isinf d_isinf
14181 eval $inlibc
14182
14183 : see if isnan exists
14184 set isnan d_isnan
14185 eval $inlibc
14186
14187 : see if isnanl exists
14188 set isnanl d_isnanl
14189 eval $inlibc
14190
14191 : see if killpg exists
14192 set killpg d_killpg
14193 eval $inlibc
14194
14195 : see if lchown exists
14196 echo " "
14197 $cat > try.c <<'EOCP'
14198 /* System header to define __stub macros and hopefully few prototypes,
14199     which can conflict with char lchown(); below.  */
14200 #include <assert.h>
14201 /* Override any gcc2 internal prototype to avoid an error.  */
14202 /* We use char because int might match the return type of a gcc2
14203    builtin and then its argument prototype would still apply.  */
14204 char lchown();
14205 int main() {
14206     /*  The GNU C library defines this for functions which it implements
14207         to always fail with ENOSYS.  Some functions are actually named
14208         something starting with __ and the normal name is an alias.  */
14209 #if defined (__stub_lchown) || defined (__stub___lchown)
14210 choke me
14211 #else
14212 lchown();
14213 #endif
14214 ; return 0; }
14215 EOCP
14216 set try
14217 if eval $compile; then
14218     $echo "lchown() found." >&4
14219     val="$define"
14220 else
14221     $echo "lchown() NOT found." >&4
14222     val="$undef"
14223 fi
14224 set d_lchown
14225 eval $setvar
14226
14227 : See if number of significant digits in a double precision number is known
14228 echo " "
14229 $cat >ldbl_dig.c <<EOM
14230 #$i_limits I_LIMITS
14231 #$i_float I_FLOAT
14232 #ifdef I_LIMITS
14233 #include <limits.h>
14234 #endif
14235 #ifdef I_FLOAT
14236 #include <float.h>
14237 #endif
14238 #ifdef LDBL_DIG
14239 printf("Contains LDBL_DIG");
14240 #endif
14241 EOM
14242 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14243 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14244         echo "LDBL_DIG found." >&4
14245         val="$define"
14246 else
14247         echo "LDBL_DIG NOT found." >&4
14248         val="$undef"
14249 fi
14250 $rm -f ldbl_dig.?
14251 set d_ldbl_dig
14252 eval $setvar
14253
14254 : see if this is a math.h system
14255 set math.h i_math
14256 eval $inhdr
14257
14258 d_libm_lib_version="$undef"
14259 case $i_math in
14260     $define)
14261         : check to see if math.h defines _LIB_VERSION
14262         echo " "
14263         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14264         $cat >try.c <<EOCP
14265 #include <unistd.h>
14266 #include <math.h>
14267 int main (int argc, char *argv[])
14268 {
14269     printf ("%d\n", _LIB_VERSION);
14270     return (0);
14271     } /* main */
14272 EOCP
14273         set try
14274         if eval $compile; then
14275             foo=`$run ./try`
14276             echo "Yes, it does ($foo)" >&4
14277             d_libm_lib_version="$define"
14278         else
14279             echo "No, it does not (probably harmless)\n" >&4
14280             fi
14281         $rm -f try.* try core core.try.*
14282         ;;
14283
14284     esac
14285
14286 : see if link exists
14287 set link d_link
14288 eval $inlibc
14289
14290 : see if localtime_r exists
14291 set localtime_r d_localtime_r
14292 eval $inlibc
14293 case "$d_localtime_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14296         case "$d_localtime_r_proto:$usethreads" in
14297         ":define")      d_localtime_r_proto=define
14298                 set d_localtime_r_proto localtime_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_localtime_r_proto" in
14303         define)
14304         case "$localtime_r_proto" in
14305         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14306         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14307         esac
14308         case "$localtime_r_proto" in
14309         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14310         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14311         esac
14312         case "$localtime_r_proto" in
14313         ''|0)   d_localtime_r=undef
14314                 localtime_r_proto=0
14315                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14316         * )     case "$localtime_r_proto" in
14317                 REENTRANT_PROTO*) ;;
14318                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14319                 esac
14320                 echo "Prototype: $try" ;;
14321         esac
14322         ;;
14323         *)      case "$usethreads" in
14324                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14325                 esac
14326                 d_localtime_r=undef
14327                 localtime_r_proto=0
14328                 ;;
14329         esac
14330         ;;
14331 *)      localtime_r_proto=0
14332         ;;
14333 esac
14334
14335 : see if localeconv exists
14336 set localeconv d_locconv
14337 eval $inlibc
14338
14339 : see if lockf exists
14340 set lockf d_lockf
14341 eval $inlibc
14342
14343 : see if prototype for lseek is available
14344 echo " "
14345 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14346 eval $hasproto
14347
14348 : see if lstat exists
14349 set lstat d_lstat
14350 eval $inlibc
14351
14352 : see if madvise exists
14353 set madvise d_madvise
14354 eval $inlibc
14355
14356 : see if malloc_size exists
14357 set malloc_size d_malloc_size
14358 eval $inlibc
14359
14360 : see if malloc_size_good exists
14361 set malloc_good_size d_malloc_good_size
14362 eval $inlibc
14363
14364 : see if mblen exists
14365 set mblen d_mblen
14366 eval $inlibc
14367
14368 : see if mbstowcs exists
14369 set mbstowcs d_mbstowcs
14370 eval $inlibc
14371
14372 : see if mbtowc exists
14373 set mbtowc d_mbtowc
14374 eval $inlibc
14375
14376 : see if memchr exists
14377 set memchr d_memchr
14378 eval $inlibc
14379
14380 : see if memcmp exists
14381 set memcmp d_memcmp
14382 eval $inlibc
14383
14384 : see if memcpy exists
14385 set memcpy d_memcpy
14386 eval $inlibc
14387
14388 : see if memmove exists
14389 set memmove d_memmove
14390 eval $inlibc
14391
14392 : see if memset exists
14393 set memset d_memset
14394 eval $inlibc
14395
14396 : see if mkdir exists
14397 set mkdir d_mkdir
14398 eval $inlibc
14399
14400 : see if mkdtemp exists
14401 set mkdtemp d_mkdtemp
14402 eval $inlibc
14403
14404 : see if mkfifo exists
14405 set mkfifo d_mkfifo
14406 eval $inlibc
14407
14408 : see if mkstemp exists
14409 set mkstemp d_mkstemp
14410 eval $inlibc
14411
14412 : see if mkstemps exists
14413 set mkstemps d_mkstemps
14414 eval $inlibc
14415
14416 : see if mktime exists
14417 set mktime d_mktime
14418 eval $inlibc
14419
14420 : see if this is a sys/mman.h system
14421 set sys/mman.h i_sysmman
14422 eval $inhdr
14423
14424 : see if mmap exists
14425 set mmap d_mmap
14426 eval $inlibc
14427 : see what shmat returns
14428 : default to something harmless
14429 mmaptype='void *'
14430 case "$i_sysmman$d_mmap" in
14431 "$define$define")
14432         $cat >mmap.c <<'END'
14433 #include <sys/mman.h>
14434 void *mmap();
14435 END
14436         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14437                 mmaptype='void *'
14438         else
14439                 mmaptype='caddr_t'
14440         fi
14441         echo "and it returns ($mmaptype)." >&4
14442         ;;
14443 esac
14444
14445
14446
14447 : see if sqrtl exists
14448 set sqrtl d_sqrtl
14449 eval $inlibc
14450
14451 : see if scalbnl exists
14452 set scalbnl d_scalbnl
14453 eval $inlibc
14454
14455 : see if modfl exists
14456 set modfl d_modfl
14457 eval $inlibc
14458
14459 : see if prototype for modfl is available
14460 echo " "
14461 set d_modflproto modfl $i_math math.h
14462 eval $hasproto
14463
14464 d_modfl_pow32_bug="$undef"
14465
14466 case "$d_longdbl$d_modfl" in
14467 $define$define)
14468         $cat <<EOM
14469 Checking to see whether your modfl() is okay for large values...
14470 EOM
14471 $cat >try.c <<EOCP
14472 #include <math.h> 
14473 #include <stdio.h>
14474 EOCP
14475 if $test "X$d_modflproto" != "X$define"; then
14476         $cat >>try.c <<EOCP
14477 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14478 long double modfl (long double, long double *);
14479 EOCP
14480 fi
14481 $cat >>try.c <<EOCP
14482 int main() {
14483     long double nv = 4294967303.15;
14484     long double v, w;
14485     v = modfl(nv, &w);         
14486 #ifdef __GLIBC__
14487     printf("glibc");
14488 #endif
14489     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14490     return 0;
14491 }
14492 EOCP
14493         case "$osname:$gccversion" in
14494         aix:)   saveccflags="$ccflags"
14495                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14496         esac
14497         set try
14498         if eval $compile; then
14499                 foo=`$run ./try`
14500                 case "$foo" in
14501                 *" 4294967303.150000 1.150000 4294967302.000000")
14502                         echo >&4 "Your modfl() is broken for large values."
14503                         d_modfl_pow32_bug="$define"
14504                         case "$foo" in
14505                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14506                         ;;
14507                         esac
14508                         ;;
14509                 *" 4294967303.150000 0.150000 4294967303.000000")
14510                         echo >&4 "Your modfl() seems okay for large values."
14511                         ;;
14512                 *)      echo >&4 "I don't understand your modfl() at all."
14513                         d_modfl="$undef"
14514                         ;;
14515                 esac
14516                 $rm -f try.* try core core.try.*
14517         else
14518                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14519                 d_modfl="$undef"
14520         fi
14521         case "$osname:$gccversion" in
14522         aix:)   ccflags="$saveccflags" ;; # restore
14523         esac
14524         ;;
14525 esac
14526
14527 if $test "$uselongdouble" = "$define"; then
14528     message=""
14529     if $test "$d_sqrtl" != "$define"; then
14530         message="$message sqrtl"
14531     fi
14532     if $test "$d_modfl" != "$define"; then
14533         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14534             echo "You have both aintl and copysignl, so I can emulate modfl."
14535         else
14536             message="$message modfl"
14537         fi
14538     fi
14539     if $test "$d_frexpl" != "$define"; then
14540         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14541             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14542         else
14543             message="$message frexpl"
14544         fi
14545     fi
14546
14547     if $test "$message" != ""; then
14548         $cat <<EOM >&4
14549
14550 *** You requested the use of long doubles but you do not seem to have
14551 *** the following mathematical functions needed for long double support:
14552 ***    $message
14553 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14554 *** Cannot continue, aborting.
14555
14556 EOM
14557
14558         exit 1
14559     fi
14560 fi
14561
14562 : see if mprotect exists
14563 set mprotect d_mprotect
14564 eval $inlibc
14565
14566 : see if msgctl exists
14567 set msgctl d_msgctl
14568 eval $inlibc
14569
14570 : see if msgget exists
14571 set msgget d_msgget
14572 eval $inlibc
14573
14574 : see if msgsnd exists
14575 set msgsnd d_msgsnd
14576 eval $inlibc
14577
14578 : see if msgrcv exists
14579 set msgrcv d_msgrcv
14580 eval $inlibc
14581
14582 : see how much of the 'msg*(2)' library is present.
14583 h_msg=true
14584 echo " "
14585 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14586 *"$undef"*) h_msg=false;;
14587 esac
14588 case "$osname" in
14589 freebsd)
14590     case "`ipcs 2>&1`" in
14591     "SVID messages"*"not configured"*)
14592         echo "Your $osname does not have the msg*(2) configured." >&4
14593         h_msg=false
14594         val="$undef"
14595         set msgctl d_msgctl
14596         eval $setvar
14597         set msgget d_msgget
14598         eval $setvar
14599         set msgsnd d_msgsnd
14600         eval $setvar
14601         set msgrcv d_msgrcv
14602         eval $setvar
14603         ;;
14604     esac
14605     ;;
14606 esac
14607 : we could also check for sys/ipc.h ...
14608 if $h_msg && $test `./findhdr sys/msg.h`; then
14609         echo "You have the full msg*(2) library." >&4
14610         val="$define"
14611 else
14612         echo "You don't have the full msg*(2) library." >&4
14613         val="$undef"
14614 fi
14615 set d_msg
14616 eval $setvar
14617
14618
14619 echo " "
14620 echo "Checking to see if your system supports struct msghdr..." >&4
14621 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14622 eval $hasstruct
14623 case "$d_msghdr_s" in
14624 "$define")      echo "Yes, it does."   ;;
14625 *)              echo "No, it doesn't." ;;
14626 esac
14627
14628
14629 : see if msync exists
14630 set msync d_msync
14631 eval $inlibc
14632
14633 : see if munmap exists
14634 set munmap d_munmap
14635 eval $inlibc
14636
14637 : see if nice exists
14638 set nice d_nice
14639 eval $inlibc
14640
14641 : see if this is a langinfo.h system
14642 set langinfo.h i_langinfo
14643 eval $inhdr
14644
14645 : see if nl_langinfo exists
14646 set nl_langinfo d_nl_langinfo
14647 eval $inlibc
14648
14649 : check for length of character
14650 echo " "
14651 case "$charsize" in
14652 '')
14653         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14654         $cat >try.c <<EOCP
14655 #include <stdio.h>
14656 #$i_stdlib I_STDLIB
14657 #ifdef I_STDLIB
14658 #include <stdlib.h>
14659 #endif
14660 int main()
14661 {
14662     printf("%d\n", (int)sizeof(char));
14663     exit(0);
14664 }
14665 EOCP
14666         set try
14667         if eval $compile_ok; then
14668                 dflt=`$run ./try`
14669         else
14670                 dflt='1'
14671                 echo "(I can't seem to compile the test program.  Guessing...)"
14672         fi
14673         ;;
14674 *)
14675         dflt="$charsize"
14676         ;;
14677 esac
14678 rp="What is the size of a character (in bytes)?"
14679 . ./myread
14680 charsize="$ans"
14681 $rm -f try.c try
14682
14683 : check for volatile keyword
14684 echo " "
14685 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14686 $cat >try.c <<'EOCP'
14687 int main()
14688 {
14689         typedef struct _goo_struct goo_struct;
14690         goo_struct * volatile goo = ((goo_struct *)0);
14691         struct _goo_struct {
14692                 long long_int;
14693                 int reg_int;
14694                 char char_var;
14695         };
14696         typedef unsigned short foo_t;
14697         char *volatile foo;
14698         volatile int bar;
14699         volatile foo_t blech;
14700         foo = foo;
14701 }
14702 EOCP
14703 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14704         val="$define"
14705         echo "Yup, it does."
14706 else
14707         val="$undef"
14708         echo "Nope, it doesn't."
14709 fi
14710 set d_volatile
14711 eval $setvar
14712 $rm -f try.*
14713
14714
14715 echo " "
14716 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14717
14718 case "$use64bitint:$d_quad:$quadtype" in
14719 define:define:?*)
14720         ivtype="$quadtype"
14721         uvtype="$uquadtype"
14722         ivsize=8
14723         uvsize=8
14724         ;;
14725 *)      ivtype="long"
14726         uvtype="unsigned long"
14727         ivsize=$longsize
14728         uvsize=$longsize
14729         ;;
14730 esac
14731
14732 case "$uselongdouble:$d_longdbl" in
14733 define:define)
14734         nvtype="long double"
14735         nvsize=$longdblsize
14736         ;;
14737 *)      nvtype=double
14738         nvsize=$doublesize
14739         ;;
14740 esac
14741
14742 $echo "(IV will be "$ivtype", $ivsize bytes)"
14743 $echo "(UV will be "$uvtype", $uvsize bytes)"
14744 $echo "(NV will be "$nvtype", $nvsize bytes)"
14745
14746 $cat >try.c <<EOCP
14747 #$i_inttypes I_INTTYPES
14748 #ifdef I_INTTYPES
14749 #include <inttypes.h>
14750 #endif
14751 #include <stdio.h>
14752 int main() {
14753 #ifdef INT8
14754    int8_t i =  INT8_MAX;
14755   uint8_t u = UINT8_MAX;
14756   printf("int8_t\n");
14757 #endif
14758 #ifdef INT16
14759    int16_t i =  INT16_MAX;
14760   uint16_t i = UINT16_MAX;
14761   printf("int16_t\n");
14762 #endif
14763 #ifdef INT32
14764    int32_t i =  INT32_MAX;
14765   uint32_t u = UINT32_MAX;
14766   printf("int32_t\n");
14767 #endif
14768 }
14769 EOCP
14770
14771 case "$i8type" in
14772 '')     case "$charsize" in
14773         1)      i8type=char
14774                 u8type="unsigned char"
14775                 i8size=$charsize
14776                 u8size=$charsize
14777                 ;;
14778         esac
14779         ;;
14780 esac
14781 case "$i8type" in
14782 '')     set try -DINT8
14783         if eval $compile; then
14784                 case "`$run ./try`" in
14785                 int8_t) i8type=int8_t
14786                         u8type=uint8_t
14787                         i8size=1
14788                         u8size=1
14789                         ;;
14790                 esac
14791         fi
14792         ;;
14793 esac
14794 case "$i8type" in
14795 '')     if $test $charsize -ge 1; then
14796                 i8type=char
14797                 u8type="unsigned char"
14798                 i8size=$charsize
14799                 u8size=$charsize
14800         fi
14801         ;;
14802 esac
14803
14804 case "$i16type" in
14805 '')     case "$shortsize" in
14806         2)      i16type=short
14807                 u16type="unsigned short"
14808                 i16size=$shortsize
14809                 u16size=$shortsize
14810                 ;;
14811         esac
14812         ;;
14813 esac
14814 case "$i16type" in
14815 '')     set try -DINT16
14816         if eval $compile; then
14817                 case "`$run ./try`" in
14818                 int16_t)
14819                         i16type=int16_t
14820                         u16type=uint16_t
14821                         i16size=2
14822                         u16size=2
14823                         ;;
14824                 esac
14825         fi
14826         ;;
14827 esac
14828 case "$i16type" in
14829 '')     if $test $shortsize -ge 2; then
14830                 i16type=short
14831                 u16type="unsigned short"
14832                 i16size=$shortsize
14833                 u16size=$shortsize
14834         fi
14835         ;;
14836 esac
14837
14838 case "$i32type" in
14839 '')     case "$longsize" in
14840         4)      i32type=long
14841                 u32type="unsigned long"
14842                 i32size=$longsize
14843                 u32size=$longsize
14844                 ;;
14845         *)      case "$intsize" in
14846                 4)      i32type=int
14847                         u32type="unsigned int"
14848                         i32size=$intsize
14849                         u32size=$intsize
14850                         ;;
14851                 esac
14852                 ;;
14853         esac
14854         ;;
14855 esac
14856 case "$i32type" in
14857 '')     set try -DINT32
14858         if eval $compile; then
14859                 case "`$run ./try`" in
14860                 int32_t)
14861                         i32type=int32_t
14862                         u32type=uint32_t
14863                         i32size=4
14864                         u32size=4
14865                         ;;
14866                 esac
14867         fi
14868         ;;
14869 esac
14870 case "$i32type" in
14871 '')     if $test $intsize -ge 4; then
14872                 i32type=int
14873                 u32type="unsigned int"
14874                 i32size=$intsize
14875                 u32size=$intsize
14876         fi
14877         ;;
14878 esac
14879
14880 case "$i64type" in
14881 '')     case "$d_quad:$quadtype" in
14882         define:?*)
14883                 i64type="$quadtype"
14884                 u64type="$uquadtype"
14885                 i64size=8
14886                 u64size=8
14887                 ;;
14888         esac
14889         ;;
14890 esac
14891
14892 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14893 : volatile so that the compiler has to store it out to memory.
14894 if test X"$d_volatile" = X"$define"; then
14895         volatile=volatile
14896 fi
14897 $cat <<EOP >try.c
14898 #include <stdio.h>
14899 #$i_stdlib I_STDLIB
14900 #ifdef I_STDLIB
14901 #include <stdlib.h>
14902 #endif
14903 #include <sys/types.h>
14904 #include <signal.h>
14905 #ifdef SIGFPE
14906 $volatile int bletched = 0;
14907 $signal_t blech(s) int s; { bletched = 1; }
14908 #endif
14909 int main() {
14910     $uvtype u = 0;
14911     $nvtype d;
14912     int     n = 8 * $uvsize;
14913     int     i;
14914 #ifdef SIGFPE
14915     signal(SIGFPE, blech);
14916 #endif
14917
14918     for (i = 0; i < n; i++) {
14919       u = u << 1 | ($uvtype)1;
14920       d = ($nvtype)u;
14921       if (($uvtype)d != u)
14922         break;
14923       if (d <= 0)
14924         break;
14925       d = ($nvtype)(u - 1);
14926       if (($uvtype)d != (u - 1))
14927         break;
14928 #ifdef SIGFPE
14929       if (bletched) {
14930         break;
14931 #endif
14932       } 
14933     }
14934     printf("%d\n", ((i == n) ? -n : i));
14935     exit(0);
14936 }
14937 EOP
14938 set try
14939
14940 d_nv_preserves_uv="$undef"
14941 if eval $compile; then
14942         nv_preserves_uv_bits="`$run ./try`"
14943 fi
14944 case "$nv_preserves_uv_bits" in
14945 \-[1-9]*)       
14946         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14947         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14948         d_nv_preserves_uv="$define"
14949         ;;
14950 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14951         d_nv_preserves_uv="$undef" ;;
14952 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14953         nv_preserves_uv_bits="$undef" ;;
14954 esac
14955
14956 $rm -f try.* try
14957
14958 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14959 : volatile so that the compiler has to store it out to memory.
14960 if test X"$d_volatile" = X"$define"; then
14961         volatile=volatile
14962 fi
14963 $cat <<EOP >try.c
14964 #include <stdio.h>
14965 #$i_stdlib I_STDLIB
14966 #ifdef I_STDLIB
14967 #include <stdlib.h>
14968 #endif
14969 #$i_string I_STRING
14970 #ifdef I_STRING
14971 #  include <string.h>
14972 #else
14973 #  include <strings.h>
14974 #endif
14975 #include <sys/types.h>
14976 #include <signal.h>
14977 #ifdef SIGFPE
14978 $volatile int bletched = 0;
14979 $signal_t blech(s) int s; { bletched = 1; }
14980 #endif
14981
14982 int checkit($nvtype d, char *where) {
14983     unsigned char *p = (char *)&d;
14984     unsigned char *end = p + sizeof(d);
14985     int fail = 0;
14986
14987     while (p < end)
14988         fail += *p++;
14989
14990     if (!fail)
14991         return 0;
14992
14993     p = (char *)&d;
14994     printf("No - %s: 0x", where);
14995     while (p < end)
14996         printf ("%02X", *p++);
14997     printf("\n");
14998     return 1;
14999 }
15000
15001 int main(int argc, char **argv) {
15002     $nvtype d = 0.0;
15003     int fail = 0;
15004     fail += checkit(d, "0.0");
15005
15006     /* The compiler shouldn't be assuming that bletched is 0  */
15007     d = bletched;
15008
15009     fail += checkit(d, "bleched");
15010
15011 #ifdef SIGFPE
15012     signal(SIGFPE, blech);
15013 #endif
15014
15015     /* Paranoia - the compiler should have no way of knowing that ANSI says
15016        that argv[argc] will always be NULL.  Actually, if it did assume this it
15017        would be buggy, as this is C and main() can be called from elsewhere in
15018        the program.  */
15019     d = argv[argc] ? 1 : 0;
15020
15021     if (d) {
15022         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15023     }
15024
15025     fail += checkit(d, "ternary");
15026
15027     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15028
15029     if (d != 0.0) {
15030         printf("No - memset doesn't give 0.0\n");
15031         /* This might just blow up:  */
15032         printf("(gives %g)\n", d);
15033         return 1;
15034     }
15035     
15036 #ifdef SIGFPE
15037     if (bletched) {
15038         printf("No - something bleched\n");
15039         return 1;
15040     }
15041 #endif
15042     if (fail) {
15043       printf("No - %d fail(s)\n", fail);
15044       return 1;
15045     }
15046     printf("Yes\n");
15047     return 0;
15048 }
15049 EOP
15050 set try
15051
15052 d_nv_zero_is_allbits_zero="$undef"
15053 if eval $compile; then
15054     xxx="`$run ./try`"
15055     case "$?" in
15056         0)
15057             case "$xxx" in
15058                 Yes)  cat >&4 <<EOM
15059 0.0 is represented as all bits zero in memory
15060 EOM
15061                     d_nv_zero_is_allbits_zero="$define"
15062                     ;;
15063                 *)  cat >&4 <<EOM
15064 0.0 is not represented as all bits zero in memory
15065 EOM
15066                     d_nv_zero_is_allbits_zero="$undef"
15067                     ;;
15068             esac
15069             ;;
15070         *)  cat >&4 <<EOM
15071 0.0 is not represented as all bits zero in memory
15072 EOM
15073             d_nv_zero_is_allbits_zero="$undef"
15074             ;;
15075     esac
15076 fi
15077
15078 $rm -f try.* try
15079
15080
15081 : check for off64_t
15082 echo " "
15083 echo "Checking to see if you have off64_t..." >&4
15084 $cat >try.c <<EOCP
15085 #include <sys/types.h>
15086 #include <unistd.h>
15087 int main() { off64_t x = 7; }
15088 EOCP
15089 set try
15090 if eval $compile; then
15091         val="$define"
15092         echo "You have off64_t."
15093 else
15094         val="$undef"
15095         echo "You do not have off64_t."
15096         case "$lseeksize" in
15097         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15098         esac
15099 fi
15100 $rm -f try.* try
15101 set d_off64_t
15102 eval $setvar
15103
15104 : how to create joinable pthreads
15105 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15106         echo " "
15107         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15108         $cat >try.c <<'EOCP'
15109 #include <pthread.h>
15110 int main() {
15111     int detachstate = JOINABLE;
15112 }
15113 EOCP
15114         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15115         if eval $compile; then
15116                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15117                 val="$undef" # Yes, undef.
15118                 set d_old_pthread_create_joinable
15119                 eval $setvar
15120                 val=""
15121                 set old_pthread_create_joinable
15122                 eval $setvar
15123         else
15124                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15125                 if eval $compile; then
15126                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15127                         val="$define"
15128                         set d_old_pthread_create_joinable
15129                         eval $setvar
15130                         val=PTHREAD_CREATE_UNDETACHED
15131                         set old_pthread_create_joinable
15132                         eval $setvar
15133                 else            
15134                         set try -DJOINABLE=__UNDETACHED
15135                         if eval $compile; then
15136                                 echo "You seem to use __UNDETACHED." >&4
15137                                 val="$define"
15138                                 set d_old_pthread_create_joinable
15139                                 eval $setvar
15140                                 val=__UNDETACHED
15141                                 set old_pthread_create_joinable
15142                                 eval $setvar
15143                         else
15144                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15145                                 val="$define"
15146                                 set d_old_pthread_create_joinable
15147                                 eval $setvar
15148                                 val=0
15149                                 set old_pthread_create_joinable
15150                                 eval $setvar
15151                         fi
15152                 fi
15153         fi
15154         $rm -f try try.*
15155 else
15156     d_old_pthread_create_joinable="$undef"
15157     old_pthread_create_joinable=""
15158 fi
15159
15160 : see if pause exists
15161 set pause d_pause
15162 eval $inlibc
15163
15164 : see if pipe exists
15165 set pipe d_pipe
15166 eval $inlibc
15167
15168 : see if poll exists
15169 set poll d_poll
15170 eval $inlibc
15171
15172 : see if readlink exists
15173 set readlink d_readlink
15174 eval $inlibc
15175
15176 echo " "
15177 procselfexe=''
15178 val="$undef"
15179 case "$d_readlink" in
15180 "$define")
15181         if $issymlink /proc/self/exe ; then
15182                 $ls -l /proc/self/exe > reflect
15183                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15184                         echo "You have Linux-like /proc/self/exe."
15185                         procselfexe='"/proc/self/exe"'
15186                         val="$define"
15187                 fi
15188         fi
15189         if $issymlink /proc/curproc/file ; then
15190                 $ls -l /proc/curproc/file > reflect
15191                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15192                         echo "You have BSD-like /proc/curproc/file."
15193                         procselfexe='"/proc/curproc/file"'
15194                         val="$define"
15195                 fi
15196         fi
15197         ;;
15198 esac
15199 $rm -f reflect
15200 set d_procselfexe
15201 eval $setvar
15202
15203 : see whether the pthread_atfork exists
15204 $cat >try.c <<EOP
15205 #include <pthread.h>
15206 #include <stdio.h>
15207 int main() {
15208 #ifdef  PTHREAD_ATFORK
15209         pthread_atfork(NULL,NULL,NULL);
15210 #endif
15211 }
15212 EOP
15213
15214 : see if pthread_atfork exists
15215 set try -DPTHREAD_ATFORK
15216 if eval $compile; then
15217     val="$define"
15218 else
15219     val="$undef"
15220 fi
15221 case "$usethreads" in
15222 $define)
15223         case "$val" in
15224         $define) echo 'pthread_atfork found.' >&4        ;;
15225         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15226         esac
15227 esac
15228 set d_pthread_atfork
15229 eval $setvar
15230
15231 : see if pthread_attr_setscope exists
15232 set pthread_attr_setscope d_pthread_attr_setscope
15233 eval $inlibc
15234
15235
15236 : see whether the various POSIXish _yields exist
15237 $cat >try.c <<EOP
15238 #include <pthread.h>
15239 #include <stdio.h>
15240 int main() {
15241 #ifdef SCHED_YIELD
15242         sched_yield();
15243 #else
15244 #ifdef PTHREAD_YIELD
15245         pthread_yield();
15246 #else
15247 #ifdef PTHREAD_YIELD_NULL
15248         pthread_yield(NULL);
15249 #endif
15250 #endif
15251 #endif
15252 }
15253 EOP
15254 : see if sched_yield exists
15255 set try -DSCHED_YIELD
15256 if eval $compile; then
15257     val="$define"
15258     sched_yield='sched_yield()'
15259 else
15260     val="$undef"
15261 fi
15262 case "$usethreads" in
15263 $define)
15264         case "$val" in
15265         $define) echo 'sched_yield() found.' >&4        ;;
15266         *)       echo 'sched_yield() NOT found.' >&4    ;;
15267         esac
15268 esac
15269 set d_sched_yield
15270 eval $setvar
15271
15272 : see if pthread_yield exists
15273 set try -DPTHREAD_YIELD
15274 if eval $compile; then
15275     val="$define"
15276     case "$sched_yield" in
15277     '') sched_yield='pthread_yield()' ;;
15278     esac
15279 else
15280     set try -DPTHREAD_YIELD_NULL
15281     if eval $compile; then
15282         val="$define"
15283         case "$sched_yield" in
15284         '') sched_yield='pthread_yield(NULL)' ;;
15285         esac
15286     else
15287         val="$undef"
15288     fi
15289 fi
15290 case "$usethreads" in
15291 $define)
15292         case "$val" in
15293         $define) echo 'pthread_yield() found.' >&4      ;;
15294         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15295         esac
15296         ;;
15297 esac
15298 set d_pthread_yield
15299 eval $setvar
15300
15301 case "$sched_yield" in
15302 '') sched_yield=undef ;;
15303 esac
15304
15305 $rm -f try try.*
15306
15307 : see if random_r exists
15308 set random_r d_random_r
15309 eval $inlibc
15310 case "$d_random_r" in
15311 "$define")
15312         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15313         case "$d_random_r_proto:$usethreads" in
15314         ":define")      d_random_r_proto=define
15315                 set d_random_r_proto random_r $hdrs
15316                 eval $hasproto ;;
15317         *)      ;;
15318         esac
15319         case "$d_random_r_proto" in
15320         define)
15321         case "$random_r_proto" in
15322         ''|0) try='int random_r(int*, struct random_data*);'
15323         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15324         esac
15325         case "$random_r_proto" in
15326         ''|0) try='int random_r(long*, struct random_data*);'
15327         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15328         esac
15329         case "$random_r_proto" in
15330         ''|0) try='int random_r(struct random_data*, int32_t*);'
15331         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15332         esac
15333         case "$random_r_proto" in
15334         ''|0)   d_random_r=undef
15335                 random_r_proto=0
15336                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15337         * )     case "$random_r_proto" in
15338                 REENTRANT_PROTO*) ;;
15339                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15340                 esac
15341                 echo "Prototype: $try" ;;
15342         esac
15343         ;;
15344         *)      case "$usethreads" in
15345                 define) echo "random_r has no prototype, not using it." >&4 ;;
15346                 esac
15347                 d_random_r=undef
15348                 random_r_proto=0
15349                 ;;
15350         esac
15351         ;;
15352 *)      random_r_proto=0
15353         ;;
15354 esac
15355
15356 : see if readdir and friends exist
15357 set readdir d_readdir
15358 eval $inlibc
15359 set seekdir d_seekdir
15360 eval $inlibc
15361 set telldir d_telldir
15362 eval $inlibc
15363 set rewinddir d_rewinddir
15364 eval $inlibc
15365
15366 : see if readdir64_r exists
15367 set readdir64_r d_readdir64_r
15368 eval $inlibc
15369 case "$d_readdir64_r" in
15370 "$define")
15371         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15372         case "$d_readdir64_r_proto:$usethreads" in
15373         ":define")      d_readdir64_r_proto=define
15374                 set d_readdir64_r_proto readdir64_r $hdrs
15375                 eval $hasproto ;;
15376         *)      ;;
15377         esac
15378         case "$d_readdir64_r_proto" in
15379         define)
15380         case "$readdir64_r_proto" in
15381         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15382         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15383         esac
15384         case "$readdir64_r_proto" in
15385         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15386         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15387         esac
15388         case "$readdir64_r_proto" in
15389         ''|0)   d_readdir64_r=undef
15390                 readdir64_r_proto=0
15391                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15392         * )     case "$readdir64_r_proto" in
15393                 REENTRANT_PROTO*) ;;
15394                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15395                 esac
15396                 echo "Prototype: $try" ;;
15397         esac
15398         ;;
15399         *)      case "$usethreads" in
15400                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15401                 esac
15402                 d_readdir64_r=undef
15403                 readdir64_r_proto=0
15404                 ;;
15405         esac
15406         ;;
15407 *)      readdir64_r_proto=0
15408         ;;
15409 esac
15410
15411 : see if readdir_r exists
15412 set readdir_r d_readdir_r
15413 eval $inlibc
15414 case "$d_readdir_r" in
15415 "$define")
15416         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15417         case "$d_readdir_r_proto:$usethreads" in
15418         ":define")      d_readdir_r_proto=define
15419                 set d_readdir_r_proto readdir_r $hdrs
15420                 eval $hasproto ;;
15421         *)      ;;
15422         esac
15423         case "$d_readdir_r_proto" in
15424         define)
15425         case "$readdir_r_proto" in
15426         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15427         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15428         esac
15429         case "$readdir_r_proto" in
15430         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15431         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15432         esac
15433         case "$readdir_r_proto" in
15434         ''|0)   d_readdir_r=undef
15435                 readdir_r_proto=0
15436                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15437         * )     case "$readdir_r_proto" in
15438                 REENTRANT_PROTO*) ;;
15439                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15440                 esac
15441                 echo "Prototype: $try" ;;
15442         esac
15443         ;;
15444         *)      case "$usethreads" in
15445                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15446                 esac
15447                 d_readdir_r=undef
15448                 readdir_r_proto=0
15449                 ;;
15450         esac
15451         ;;
15452 *)      readdir_r_proto=0
15453         ;;
15454 esac
15455
15456 : see if readv exists
15457 set readv d_readv
15458 eval $inlibc
15459
15460 : see if recvmsg exists
15461 set recvmsg d_recvmsg
15462 eval $inlibc
15463
15464 : see if rename exists
15465 set rename d_rename
15466 eval $inlibc
15467
15468 : see if rmdir exists
15469 set rmdir d_rmdir
15470 eval $inlibc
15471
15472 : see if memory.h is available.
15473 val=''
15474 set memory.h val
15475 eval $inhdr
15476
15477 : See if it conflicts with string.h
15478 case "$val" in
15479 $define)
15480         case "$strings" in
15481         '') ;;
15482         *)
15483                 $cppstdin $cppflags $cppminus < $strings > mem.h
15484                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15485                         echo " "
15486                         echo "We won't be including <memory.h>."
15487                         val="$undef"
15488                 fi
15489                 $rm -f mem.h
15490                 ;;
15491         esac
15492 esac
15493 set i_memory
15494 eval $setvar
15495
15496 : can bcopy handle overlapping blocks?
15497 echo " "
15498 val="$undef"
15499 case "$d_memmove" in
15500 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15501 *)      case "$d_bcopy" in
15502         "$define")
15503                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15504                 $cat >try.c <<EOCP
15505 #$i_memory I_MEMORY
15506 #$i_stdlib I_STDLIB
15507 #$i_string I_STRING
15508 #$i_unistd I_UNISTD
15509 EOCP
15510         $cat >>try.c <<'EOCP'
15511 #include <stdio.h>
15512 #ifdef I_MEMORY
15513 #  include <memory.h>
15514 #endif
15515 #ifdef I_STDLIB
15516 #  include <stdlib.h>
15517 #endif
15518 #ifdef I_STRING
15519 #  include <string.h>
15520 #else
15521 #  include <strings.h>
15522 #endif
15523 #ifdef I_UNISTD
15524 #  include <unistd.h>  /* Needed for NetBSD */
15525 #endif
15526 int main()
15527 {
15528 char buf[128], abc[128];
15529 char *b;
15530 int len;
15531 int off;
15532 int align;
15533
15534 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15535    try to store the string in read-only memory. */
15536 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15537
15538 for (align = 7; align >= 0; align--) {
15539         for (len = 36; len; len--) {
15540                 b = buf+align;
15541                 bcopy(abc, b, len);
15542                 for (off = 1; off <= len; off++) {
15543                         bcopy(b, b+off, len);
15544                         bcopy(b+off, b, len);
15545                         if (bcmp(b, abc, len))
15546                                 exit(1);
15547                 }
15548         }
15549 }
15550 exit(0);
15551 }
15552 EOCP
15553                 set try
15554                 if eval $compile_ok; then
15555                         if ./try 2>/dev/null; then
15556                                 echo "Yes, it can."
15557                                 val="$define"
15558                         else
15559                                 echo "It can't, sorry."
15560                         fi
15561                 else
15562                         echo "(I can't compile the test program, so we'll assume not...)"
15563                 fi
15564                 ;;
15565         esac
15566         $rm -f try.* try core
15567         ;;
15568 esac
15569 set d_safebcpy
15570 eval $setvar
15571
15572 : can memcpy handle overlapping blocks?
15573 echo " "
15574 val="$undef"
15575 case "$d_memmove" in
15576 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15577 *)      case "$d_memcpy" in
15578         "$define")
15579                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15580                 $cat >try.c <<EOCP
15581 #$i_memory I_MEMORY
15582 #$i_stdlib I_STDLIB
15583 #$i_string I_STRING
15584 #$i_unistd I_UNISTD
15585 EOCP
15586         $cat >>try.c <<'EOCP'
15587 #include <stdio.h>
15588 #ifdef I_MEMORY
15589 #  include <memory.h>
15590 #endif
15591 #ifdef I_STDLIB
15592 #  include <stdlib.h>
15593 #endif
15594 #ifdef I_STRING
15595 #  include <string.h>
15596 #else
15597 #  include <strings.h>
15598 #endif
15599 #ifdef I_UNISTD
15600 #  include <unistd.h>  /* Needed for NetBSD */
15601 #endif
15602 int main()
15603 {
15604 char buf[128], abc[128];
15605 char *b;
15606 int len;
15607 int off;
15608 int align;
15609
15610 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15611    try to store the string in read-only memory. */
15612 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15613
15614 for (align = 7; align >= 0; align--) {
15615         for (len = 36; len; len--) {
15616                 b = buf+align;
15617                 memcpy(b, abc, len);
15618                 for (off = 1; off <= len; off++) {
15619                         memcpy(b+off, b, len);
15620                         memcpy(b, b+off, len);
15621                         if (memcmp(b, abc, len))
15622                                 exit(1);
15623                 }
15624         }
15625 }
15626 exit(0);
15627 }
15628 EOCP
15629                 set try
15630                 if eval $compile_ok; then
15631                         if ./try 2>/dev/null; then
15632                                 echo "Yes, it can."
15633                                 val="$define"
15634                         else
15635                                 echo "It can't, sorry."
15636                         fi
15637                 else
15638                         echo "(I can't compile the test program, so we'll assume not...)"
15639                 fi
15640                 ;;
15641         esac
15642         $rm -f try.* try core
15643         ;;
15644 esac
15645 set d_safemcpy
15646 eval $setvar
15647
15648 : can memcmp be trusted to compare relative magnitude?
15649 val="$undef"
15650 case "$d_memcmp" in
15651 "$define")
15652         echo " "
15653         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15654         $cat >try.c <<EOCP
15655 #$i_memory I_MEMORY
15656 #$i_stdlib I_STDLIB
15657 #$i_string I_STRING
15658 #$i_unistd I_UNISTD
15659 EOCP
15660         $cat >>try.c <<'EOCP'
15661 #include <stdio.h>
15662 #ifdef I_MEMORY
15663 #  include <memory.h>
15664 #endif
15665 #ifdef I_STDLIB
15666 #  include <stdlib.h>
15667 #endif
15668 #ifdef I_STRING
15669 #  include <string.h>
15670 #else
15671 #  include <strings.h>
15672 #endif
15673 #ifdef I_UNISTD
15674 #  include <unistd.h>  /* Needed for NetBSD */
15675 #endif
15676 int main()
15677 {
15678 char a = -1;
15679 char b = 0;
15680 if ((a < b) && memcmp(&a, &b, 1) < 0)
15681         exit(1);
15682 exit(0);
15683 }
15684 EOCP
15685         set try
15686         if eval $compile_ok; then
15687                 if $run ./try 2>/dev/null; then
15688                         echo "Yes, it can."
15689                         val="$define"
15690                 else
15691                         echo "No, it can't (it uses signed chars)."
15692                 fi
15693         else
15694                 echo "(I can't compile the test program, so we'll assume not...)"
15695         fi
15696         ;;
15697 esac
15698 $rm -f try.* try core
15699 set d_sanemcmp
15700 eval $setvar
15701
15702 : see if prototype for sbrk is available
15703 echo " "
15704 set d_sbrkproto sbrk $i_unistd unistd.h
15705 eval $hasproto
15706
15707 : see if select exists
15708 set select d_select
15709 eval $inlibc
15710
15711 : see if semctl exists
15712 set semctl d_semctl
15713 eval $inlibc
15714
15715 : see if semget exists
15716 set semget d_semget
15717 eval $inlibc
15718
15719 : see if semop exists
15720 set semop d_semop
15721 eval $inlibc
15722
15723 : see how much of the 'sem*(2)' library is present.
15724 h_sem=true
15725 echo " "
15726 case "$d_semctl$d_semget$d_semop" in
15727 *"$undef"*) h_sem=false;;
15728 esac
15729 case "$osname" in
15730 freebsd)
15731     case "`ipcs 2>&1`" in
15732     "SVID messages"*"not configured"*)
15733         echo "Your $osname does not have the sem*(2) configured." >&4
15734         h_sem=false
15735         val="$undef"
15736         set semctl d_semctl
15737         eval $setvar
15738         set semget d_semget
15739         eval $setvar
15740         set semop d_semop
15741         eval $setvar
15742         ;;
15743     esac
15744     ;;
15745 esac
15746 : we could also check for sys/ipc.h ...
15747 if $h_sem && $test `./findhdr sys/sem.h`; then
15748         echo "You have the full sem*(2) library." >&4
15749         val="$define"
15750 else
15751         echo "You don't have the full sem*(2) library." >&4
15752         val="$undef"
15753 fi
15754 set d_sem
15755 eval $setvar
15756
15757 : see whether sys/sem.h defines union semun
15758 echo " "
15759 $cat > try.c <<'END'
15760 #include <sys/types.h>
15761 #include <sys/ipc.h>
15762 #include <sys/sem.h>
15763 int main () { union semun semun; semun.buf = 0; }
15764 END
15765 set try
15766 if eval $compile; then
15767     echo "You have union semun in <sys/sem.h>." >&4
15768     val="$define"
15769 else
15770     echo "You do not have union semun in <sys/sem.h>." >&4
15771     val="$undef"
15772 fi
15773 $rm -f try try.c
15774 set d_union_semun
15775 eval $setvar
15776
15777 : see how to do semctl IPC_STAT
15778 case "$d_sem" in
15779 $define)
15780     echo " "
15781     $cat > try.h <<END
15782 #ifndef S_IRUSR
15783 #   ifdef S_IREAD
15784 #       define S_IRUSR S_IREAD
15785 #       define S_IWUSR S_IWRITE
15786 #       define S_IXUSR S_IEXEC
15787 #   else
15788 #       define S_IRUSR 0400
15789 #       define S_IWUSR 0200
15790 #       define S_IXUSR 0100
15791 #   endif
15792 #   define S_IRGRP (S_IRUSR>>3)
15793 #   define S_IWGRP (S_IWUSR>>3)
15794 #   define S_IXGRP (S_IXUSR>>3)
15795 #   define S_IROTH (S_IRUSR>>6)
15796 #   define S_IWOTH (S_IWUSR>>6)
15797 #   define S_IXOTH (S_IXUSR>>6)
15798 #endif
15799 #ifndef S_IRWXU
15800 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15801 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15802 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15803 #endif
15804 END
15805     : see whether semctl IPC_STAT can use union semun
15806     case "$d_semctl_semun" in
15807     '')
15808       val="$undef"
15809       $cat > try.c <<END
15810 #include <sys/types.h>
15811 #include <sys/ipc.h>
15812 #include <sys/sem.h>
15813 #include <sys/stat.h>
15814 #include <stdio.h>
15815 #include <errno.h>
15816 #include "try.h"
15817 #ifndef errno
15818 extern int errno;
15819 #endif
15820 #$d_union_semun HAS_UNION_SEMUN
15821 int main() {
15822     union semun
15823 #ifndef HAS_UNION_SEMUN
15824     {
15825         int val;
15826         struct semid_ds *buf;
15827         unsigned short *array;
15828     }
15829 #endif
15830     arg;
15831     int sem, st;
15832
15833 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15834     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15835     if (sem > -1) {
15836         struct semid_ds argbuf;
15837         arg.buf = &argbuf;
15838 #       ifdef IPC_STAT
15839         st = semctl(sem, 0, IPC_STAT, arg);
15840         if (st == 0)
15841             printf("semun\n");
15842         else
15843 #       endif /* IPC_STAT */
15844             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15845 #       ifdef IPC_RMID
15846         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15847 #       endif /* IPC_RMID */
15848             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15849     } else
15850 #endif /* IPC_PRIVATE && ... */
15851         printf("semget failed: errno = %d\n", errno);
15852   return 0;
15853 }
15854 END
15855       set try
15856       if eval $compile; then
15857           xxx=`$run ./try`
15858           case "$xxx" in
15859           semun) val="$define" ;;
15860           esac
15861       fi
15862       $rm -f try try.c
15863       set d_semctl_semun
15864       eval $setvar
15865       ;;
15866     esac
15867     case "$d_semctl_semun" in
15868     $define)
15869         echo "You can use union semun for semctl IPC_STAT." >&4
15870         also='also'
15871         ;;
15872     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15873         also=''
15874         ;;
15875     esac
15876
15877     : see whether semctl IPC_STAT can use struct semid_ds pointer
15878     case "$d_semctl_semid_ds" in
15879     '')
15880       val="$undef"
15881       $cat > try.c <<'END'
15882 #include <sys/types.h>
15883 #include <sys/ipc.h>
15884 #include <sys/sem.h>
15885 #include <sys/stat.h>
15886 #include "try.h"
15887 #include <stdio.h>
15888 #include <errno.h>
15889 #ifndef errno
15890 extern int errno;
15891 #endif
15892 int main() {
15893     struct semid_ds arg;
15894     int sem, st;
15895
15896 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15897     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15898     if (sem > -1) {
15899 #       ifdef IPC_STAT
15900         st = semctl(sem, 0, IPC_STAT, &arg);
15901         if (st == 0)
15902             printf("semid_ds\n");
15903         else
15904 #       endif /* IPC_STAT */
15905             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15906 #       ifdef IPC_RMID
15907         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15908 #       endif /* IPC_RMID */
15909             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15910     } else
15911 #endif /* IPC_PRIVATE && ... */
15912         printf("semget failed: errno = %d\n", errno);
15913
15914     return 0;
15915 }
15916 END
15917       set try
15918       if eval $compile; then
15919           xxx=`$run ./try`
15920           case "$xxx" in
15921           semid_ds) val="$define" ;;
15922           esac
15923       fi
15924       $rm -f try try.c
15925       set d_semctl_semid_ds
15926       eval $setvar
15927       ;;
15928     esac
15929     case "$d_semctl_semid_ds" in
15930     $define)
15931         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15932         ;;
15933     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15934         ;;
15935     esac
15936     $rm -f try.h
15937     ;;
15938 *)  val="$undef"
15939
15940     # We do not have the full sem*(2) library, so assume we can not
15941     # use either.
15942
15943     set d_semctl_semun
15944     eval $setvar
15945
15946     set d_semctl_semid_ds
15947     eval $setvar
15948     ;;
15949 esac
15950
15951 : see if sendmsg exists
15952 set sendmsg d_sendmsg
15953 eval $inlibc
15954
15955 : see if setegid exists
15956 set setegid d_setegid
15957 eval $inlibc
15958
15959 : see if seteuid exists
15960 set seteuid d_seteuid
15961 eval $inlibc
15962
15963 : see if setgrent exists
15964 set setgrent d_setgrent
15965 eval $inlibc
15966
15967 : see if setgrent_r exists
15968 set setgrent_r d_setgrent_r
15969 eval $inlibc
15970 case "$d_setgrent_r" in
15971 "$define")
15972         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15973         case "$d_setgrent_r_proto:$usethreads" in
15974         ":define")      d_setgrent_r_proto=define
15975                 set d_setgrent_r_proto setgrent_r $hdrs
15976                 eval $hasproto ;;
15977         *)      ;;
15978         esac
15979         case "$d_setgrent_r_proto" in
15980         define)
15981         case "$setgrent_r_proto" in
15982         ''|0) try='int setgrent_r(FILE**);'
15983         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15984         esac
15985         case "$setgrent_r_proto" in
15986         ''|0) try='void setgrent_r(FILE**);'
15987         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15988         esac
15989         case "$setgrent_r_proto" in
15990         ''|0)   d_setgrent_r=undef
15991                 setgrent_r_proto=0
15992                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15993         * )     case "$setgrent_r_proto" in
15994                 REENTRANT_PROTO*) ;;
15995                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15996                 esac
15997                 echo "Prototype: $try" ;;
15998         esac
15999         ;;
16000         *)      case "$usethreads" in
16001                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16002                 esac
16003                 d_setgrent_r=undef
16004                 setgrent_r_proto=0
16005                 ;;
16006         esac
16007         ;;
16008 *)      setgrent_r_proto=0
16009         ;;
16010 esac
16011
16012 : see if sethostent exists
16013 set sethostent d_sethent
16014 eval $inlibc
16015
16016 : see if sethostent_r exists
16017 set sethostent_r d_sethostent_r
16018 eval $inlibc
16019 case "$d_sethostent_r" in
16020 "$define")
16021         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16022         case "$d_sethostent_r_proto:$usethreads" in
16023         ":define")      d_sethostent_r_proto=define
16024                 set d_sethostent_r_proto sethostent_r $hdrs
16025                 eval $hasproto ;;
16026         *)      ;;
16027         esac
16028         case "$d_sethostent_r_proto" in
16029         define)
16030         case "$sethostent_r_proto" in
16031         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16032         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16033         esac
16034         case "$sethostent_r_proto" in
16035         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16036         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16037         esac
16038         case "$sethostent_r_proto" in
16039         ''|0)   d_sethostent_r=undef
16040                 sethostent_r_proto=0
16041                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16042         * )     case "$sethostent_r_proto" in
16043                 REENTRANT_PROTO*) ;;
16044                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16045                 esac
16046                 echo "Prototype: $try" ;;
16047         esac
16048         ;;
16049         *)      case "$usethreads" in
16050                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16051                 esac
16052                 d_sethostent_r=undef
16053                 sethostent_r_proto=0
16054                 ;;
16055         esac
16056         ;;
16057 *)      sethostent_r_proto=0
16058         ;;
16059 esac
16060
16061 : see if setitimer exists
16062 set setitimer d_setitimer
16063 eval $inlibc
16064
16065 : see if setlinebuf exists
16066 set setlinebuf d_setlinebuf
16067 eval $inlibc
16068
16069 : see if setlocale exists
16070 set setlocale d_setlocale
16071 eval $inlibc
16072
16073 : see if locale.h is available
16074 set locale.h i_locale
16075 eval $inhdr
16076
16077 : see if setlocale_r exists
16078 set setlocale_r d_setlocale_r
16079 eval $inlibc
16080 case "$d_setlocale_r" in
16081 "$define")
16082         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16083         case "$d_setlocale_r_proto:$usethreads" in
16084         ":define")      d_setlocale_r_proto=define
16085                 set d_setlocale_r_proto setlocale_r $hdrs
16086                 eval $hasproto ;;
16087         *)      ;;
16088         esac
16089         case "$d_setlocale_r_proto" in
16090         define)
16091         case "$setlocale_r_proto" in
16092         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16093         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16094         esac
16095         case "$setlocale_r_proto" in
16096         ''|0)   d_setlocale_r=undef
16097                 setlocale_r_proto=0
16098                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16099         * )     case "$setlocale_r_proto" in
16100                 REENTRANT_PROTO*) ;;
16101                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16102                 esac
16103                 echo "Prototype: $try" ;;
16104         esac
16105         ;;
16106         *)      case "$usethreads" in
16107                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16108                 esac
16109                 d_setlocale_r=undef
16110                 setlocale_r_proto=0
16111                 ;;
16112         esac
16113         ;;
16114 *)      setlocale_r_proto=0
16115         ;;
16116 esac
16117
16118 : see if setnetent exists
16119 set setnetent d_setnent
16120 eval $inlibc
16121
16122 : see if setnetent_r exists
16123 set setnetent_r d_setnetent_r
16124 eval $inlibc
16125 case "$d_setnetent_r" in
16126 "$define")
16127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16128         case "$d_setnetent_r_proto:$usethreads" in
16129         ":define")      d_setnetent_r_proto=define
16130                 set d_setnetent_r_proto setnetent_r $hdrs
16131                 eval $hasproto ;;
16132         *)      ;;
16133         esac
16134         case "$d_setnetent_r_proto" in
16135         define)
16136         case "$setnetent_r_proto" in
16137         ''|0) try='int setnetent_r(int, struct netent_data*);'
16138         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16139         esac
16140         case "$setnetent_r_proto" in
16141         ''|0) try='void setnetent_r(int, struct netent_data*);'
16142         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16143         esac
16144         case "$setnetent_r_proto" in
16145         ''|0)   d_setnetent_r=undef
16146                 setnetent_r_proto=0
16147                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16148         * )     case "$setnetent_r_proto" in
16149                 REENTRANT_PROTO*) ;;
16150                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16151                 esac
16152                 echo "Prototype: $try" ;;
16153         esac
16154         ;;
16155         *)      case "$usethreads" in
16156                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16157                 esac
16158                 d_setnetent_r=undef
16159                 setnetent_r_proto=0
16160                 ;;
16161         esac
16162         ;;
16163 *)      setnetent_r_proto=0
16164         ;;
16165 esac
16166
16167 : see if setprotoent exists
16168 set setprotoent d_setpent
16169 eval $inlibc
16170
16171 : see if setpgid exists
16172 set setpgid d_setpgid
16173 eval $inlibc
16174
16175 : see if setpgrp2 exists
16176 set setpgrp2 d_setpgrp2
16177 eval $inlibc
16178
16179 : see if setpriority exists
16180 set setpriority d_setprior
16181 eval $inlibc
16182
16183 : see if setproctitle exists
16184 set setproctitle d_setproctitle
16185 eval $inlibc
16186
16187 : see if setprotoent_r exists
16188 set setprotoent_r d_setprotoent_r
16189 eval $inlibc
16190 case "$d_setprotoent_r" in
16191 "$define")
16192         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16193         case "$d_setprotoent_r_proto:$usethreads" in
16194         ":define")      d_setprotoent_r_proto=define
16195                 set d_setprotoent_r_proto setprotoent_r $hdrs
16196                 eval $hasproto ;;
16197         *)      ;;
16198         esac
16199         case "$d_setprotoent_r_proto" in
16200         define)
16201         case "$setprotoent_r_proto" in
16202         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16203         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16204         esac
16205         case "$setprotoent_r_proto" in
16206         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16207         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16208         esac
16209         case "$setprotoent_r_proto" in
16210         ''|0)   d_setprotoent_r=undef
16211                 setprotoent_r_proto=0
16212                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16213         * )     case "$setprotoent_r_proto" in
16214                 REENTRANT_PROTO*) ;;
16215                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16216                 esac
16217                 echo "Prototype: $try" ;;
16218         esac
16219         ;;
16220         *)      case "$usethreads" in
16221                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16222                 esac
16223                 d_setprotoent_r=undef
16224                 setprotoent_r_proto=0
16225                 ;;
16226         esac
16227         ;;
16228 *)      setprotoent_r_proto=0
16229         ;;
16230 esac
16231
16232 : see if setpwent exists
16233 set setpwent d_setpwent
16234 eval $inlibc
16235
16236 : see if setpwent_r exists
16237 set setpwent_r d_setpwent_r
16238 eval $inlibc
16239 case "$d_setpwent_r" in
16240 "$define")
16241         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16242         case "$d_setpwent_r_proto:$usethreads" in
16243         ":define")      d_setpwent_r_proto=define
16244                 set d_setpwent_r_proto setpwent_r $hdrs
16245                 eval $hasproto ;;
16246         *)      ;;
16247         esac
16248         case "$d_setpwent_r_proto" in
16249         define)
16250         case "$setpwent_r_proto" in
16251         ''|0) try='int setpwent_r(FILE**);'
16252         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16253         esac
16254         case "$setpwent_r_proto" in
16255         ''|0) try='void setpwent_r(FILE**);'
16256         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16257         esac
16258         case "$setpwent_r_proto" in
16259         ''|0)   d_setpwent_r=undef
16260                 setpwent_r_proto=0
16261                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16262         * )     case "$setpwent_r_proto" in
16263                 REENTRANT_PROTO*) ;;
16264                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16265                 esac
16266                 echo "Prototype: $try" ;;
16267         esac
16268         ;;
16269         *)      case "$usethreads" in
16270                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16271                 esac
16272                 d_setpwent_r=undef
16273                 setpwent_r_proto=0
16274                 ;;
16275         esac
16276         ;;
16277 *)      setpwent_r_proto=0
16278         ;;
16279 esac
16280
16281 : see if setregid exists
16282 set setregid d_setregid
16283 eval $inlibc
16284 set setresgid d_setresgid
16285 eval $inlibc
16286
16287 : see if setreuid exists
16288 set setreuid d_setreuid
16289 eval $inlibc
16290 set setresuid d_setresuid
16291 eval $inlibc
16292
16293 : see if setrgid exists
16294 set setrgid d_setrgid
16295 eval $inlibc
16296
16297 : see if setruid exists
16298 set setruid d_setruid
16299 eval $inlibc
16300
16301 : see if setservent exists
16302 set setservent d_setsent
16303 eval $inlibc
16304
16305 : see if setservent_r exists
16306 set setservent_r d_setservent_r
16307 eval $inlibc
16308 case "$d_setservent_r" in
16309 "$define")
16310         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16311         case "$d_setservent_r_proto:$usethreads" in
16312         ":define")      d_setservent_r_proto=define
16313                 set d_setservent_r_proto setservent_r $hdrs
16314                 eval $hasproto ;;
16315         *)      ;;
16316         esac
16317         case "$d_setservent_r_proto" in
16318         define)
16319         case "$setservent_r_proto" in
16320         ''|0) try='int setservent_r(int, struct servent_data*);'
16321         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16322         esac
16323         case "$setservent_r_proto" in
16324         ''|0) try='void setservent_r(int, struct servent_data*);'
16325         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16326         esac
16327         case "$setservent_r_proto" in
16328         ''|0)   d_setservent_r=undef
16329                 setservent_r_proto=0
16330                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16331         * )     case "$setservent_r_proto" in
16332                 REENTRANT_PROTO*) ;;
16333                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16334                 esac
16335                 echo "Prototype: $try" ;;
16336         esac
16337         ;;
16338         *)      case "$usethreads" in
16339                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16340                 esac
16341                 d_setservent_r=undef
16342                 setservent_r_proto=0
16343                 ;;
16344         esac
16345         ;;
16346 *)      setservent_r_proto=0
16347         ;;
16348 esac
16349
16350 : see if setsid exists
16351 set setsid d_setsid
16352 eval $inlibc
16353
16354 : see if setvbuf exists
16355 set setvbuf d_setvbuf
16356 eval $inlibc
16357
16358 : see if sfio.h is available
16359 set sfio.h i_sfio
16360 eval $inhdr
16361
16362
16363 : see if sfio library is available
16364 case "$i_sfio" in
16365 $define)
16366         val=''
16367         set sfreserve val
16368         eval $inlibc
16369         ;;
16370 *)
16371         val="$undef"
16372         ;;
16373 esac
16374 : Ok, but do we want to use it.
16375 case "$val" in
16376 $define)
16377         case "$usesfio" in
16378         true|$define|[yY]*) dflt='y';;
16379         *) dflt='n';;
16380         esac
16381         echo "$package can use the sfio library, but it is experimental."
16382         case "$useperlio" in
16383         "$undef")
16384             echo "For sfio also the PerlIO abstraction layer is needed."
16385             echo "Earlier you said you wouldn't want that."
16386             ;;
16387         esac
16388         rp="You seem to have sfio available, do you want to try using it?"
16389         . ./myread
16390         case "$ans" in
16391         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16392                 useperlio="$define"
16393                 val="$define"
16394                 ;;
16395         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16396                 val="$undef"
16397                 ;;
16398         esac
16399         ;;
16400 *)      case "$usesfio" in
16401         true|$define|[yY]*)
16402                 echo "Sorry, cannot find sfio on this machine." >&4
16403                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16404                 val="$undef"
16405                 ;;
16406         esac
16407         ;;
16408 esac
16409 set d_sfio
16410 eval $setvar
16411 case "$d_sfio" in
16412 $define) usesfio='true';;
16413 *) usesfio='false';;
16414 esac
16415 case "$d_sfio" in
16416 $define) ;;
16417 *)      : Remove sfio from list of libraries to use
16418         case "$libs" in
16419         *-lsfio*)
16420                 echo "Removing unneeded -lsfio from library list" >&4
16421                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16422                 shift
16423                 libs="$*"
16424                 echo "libs = $libs" >&4
16425                 ;;
16426         esac
16427 ;;
16428 esac
16429
16430
16431 : see if shmctl exists
16432 set shmctl d_shmctl
16433 eval $inlibc
16434
16435 : see if shmget exists
16436 set shmget d_shmget
16437 eval $inlibc
16438
16439 : see if shmat exists
16440 set shmat d_shmat
16441 eval $inlibc
16442 : see what shmat returns
16443 case "$d_shmat" in
16444 "$define")
16445         $cat >shmat.c <<'END'
16446 #include <sys/shm.h>
16447 void *shmat();
16448 END
16449         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16450                 shmattype='void *'
16451         else
16452                 shmattype='char *'
16453         fi
16454         echo "and it returns ($shmattype)." >&4
16455         : see if a prototype for shmat is available
16456         xxx=`./findhdr sys/shm.h`
16457         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16458         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16459                 val="$define"
16460         else
16461                 val="$undef"
16462         fi
16463         $rm -f shmat.[co]
16464         ;;
16465 *)
16466         val="$undef"
16467         ;;
16468 esac
16469 set d_shmatprototype
16470 eval $setvar
16471
16472 : see if shmdt exists
16473 set shmdt d_shmdt
16474 eval $inlibc
16475
16476 : see how much of the 'shm*(2)' library is present.
16477 h_shm=true
16478 echo " "
16479 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16480 *"$undef"*) h_shm=false;;
16481 esac
16482 case "$osname" in
16483 freebsd)
16484     case "`ipcs 2>&1`" in
16485     "SVID shared memory"*"not configured"*)
16486         echo "Your $osname does not have the shm*(2) configured." >&4
16487         h_shm=false
16488         val="$undef"
16489         set shmctl d_shmctl
16490         evat $setvar
16491         set shmget d_shmget
16492         evat $setvar
16493         set shmat d_shmat
16494         evat $setvar
16495         set shmdt d_shmdt
16496         evat $setvar
16497         ;;
16498     esac
16499     ;;
16500 esac
16501 : we could also check for sys/ipc.h ...
16502 if $h_shm && $test `./findhdr sys/shm.h`; then
16503         echo "You have the full shm*(2) library." >&4
16504         val="$define"
16505 else
16506         echo "You don't have the full shm*(2) library." >&4
16507         val="$undef"
16508 fi
16509 set d_shm
16510 eval $setvar
16511
16512 echo " "
16513 : see if we have sigaction
16514 if set sigaction val -f d_sigaction; eval $csym; $val; then
16515         echo 'sigaction() found.' >&4
16516         $cat > try.c <<EOP
16517 #include <stdio.h>
16518 #include <sys/types.h>
16519 #include <signal.h>
16520 #$i_stdlib I_STDLIB
16521 #ifdef I_STDLIB
16522 #include <stdlib.h>
16523 #endif
16524 int main()
16525 {
16526     struct sigaction act, oact;
16527     act.sa_flags = 0;
16528     oact.sa_handler = 0;
16529     /* so that act and oact are used */
16530     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16531 }
16532 EOP
16533         set try
16534         if eval $compile_ok; then
16535                 val="$define"
16536         else
16537                 echo "But you don't seem to have a useable struct sigaction." >&4
16538                 val="$undef"
16539         fi
16540 else
16541         echo 'sigaction NOT found.' >&4
16542         val="$undef"
16543 fi
16544 set d_sigaction; eval $setvar
16545 $rm -f try try$_o try.c
16546
16547 : see if sigprocmask exists
16548 set sigprocmask d_sigprocmask
16549 eval $inlibc
16550
16551 : see if sigsetjmp exists
16552 echo " "
16553 case "$d_sigsetjmp" in
16554 '')
16555         $cat >try.c <<EOP
16556 #include <setjmp.h>
16557 #$i_stdlib I_STDLIB
16558 #ifdef I_STDLIB
16559 #include <stdlib.h>
16560 #endif
16561 sigjmp_buf env;
16562 int set = 1;
16563 int main()
16564 {
16565         if (sigsetjmp(env,1))
16566                 exit(set);
16567         set = 0;
16568         siglongjmp(env, 1);
16569         exit(1);
16570 }
16571 EOP
16572         set try
16573         if eval $compile; then
16574                 if $run ./try >/dev/null 2>&1; then
16575                         echo "POSIX sigsetjmp found." >&4
16576                         val="$define"
16577                 else
16578                         $cat >&4 <<EOM
16579 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16580 I'll ignore them.
16581 EOM
16582                         val="$undef"
16583                 fi
16584         else
16585                 echo "sigsetjmp not found." >&4
16586                 val="$undef"
16587         fi
16588         ;;
16589 *) val="$d_sigsetjmp"
16590         case "$d_sigsetjmp" in
16591         $define) echo "POSIX sigsetjmp found." >&4;;
16592         $undef) echo "sigsetjmp not found." >&4;;
16593         esac
16594         ;;
16595 esac
16596 set d_sigsetjmp
16597 eval $setvar
16598 $rm -f try.c try
16599
16600 : see if snprintf exists
16601 set snprintf d_snprintf
16602 eval $inlibc
16603
16604 : see if vsnprintf exists
16605 set vsnprintf d_vsnprintf
16606 eval $inlibc
16607
16608 case "$d_snprintf-$d_vsnprintf" in
16609 "$define-$define")
16610     $cat <<EOM
16611 Checking whether your snprintf() and vsnprintf() work okay...
16612 EOM
16613     $cat >try.c <<'EOCP'
16614 /* v?snprintf testing logic courtesy of Russ Allbery.
16615  * According to C99:
16616  * - if the buffer is too short it still must be \0-terminated
16617  * - if the buffer is too short the potentially required length
16618  *   must be returned and not -1
16619  * - if the buffer is NULL the potentially required length
16620  *   must be returned and not -1 or core dump
16621  */
16622 #include <stdio.h>
16623 #include <stdarg.h>
16624
16625 char buf[2];
16626
16627 int test (char *format, ...)
16628 {
16629     va_list args;
16630     int count;
16631
16632     va_start (args, format);
16633     count = vsnprintf (buf, sizeof buf, format, args);
16634     va_end (args);
16635     return count;
16636 }
16637
16638 int main ()
16639 {
16640     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16641              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16642 }
16643 EOCP
16644     set try
16645     if eval $compile; then
16646         `$run ./try`
16647         case "$?" in
16648         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16649         *) cat <<EOM >&4
16650 Your snprintf() and snprintf() don't seem to be working okay.
16651 EOM
16652            d_snprintf="$undef"
16653            d_vsnprintf="$undef"
16654            ;;
16655         esac
16656     else
16657         echo "(I can't seem to compile the test program--assuming they don't)"
16658         d_snprintf="$undef"
16659         d_vsnprintf="$undef"
16660     fi
16661     $rm -f try.* try core core.try.*
16662     ;;
16663 esac
16664
16665 : see if sockatmark exists
16666 set sockatmark d_sockatmark
16667 eval $inlibc
16668
16669 : see if prototype for sockatmark is available
16670 echo " "
16671 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16672 eval $hasproto
16673
16674 : see if socks5_init exists
16675 set socks5_init d_socks5_init
16676 eval $inlibc
16677
16678 : see if sprintf returns the length of the string in the buffer as per ANSI
16679 $echo "Checking whether sprintf returns the length of the string..." >&4
16680 $cat <<EOP >try.c
16681 #include <stdio.h>
16682 #$i_stdlib I_STDLIB
16683 #ifdef I_STDLIB
16684 #include <stdlib.h>
16685 #endif
16686 #$i_string I_STRING
16687 #ifdef I_STRING
16688 #  include <string.h>
16689 #else
16690 #  include <strings.h>
16691 #endif
16692 #$i_math I_MATH
16693 #ifdef I_MATH
16694 #include <math.h>
16695 #endif
16696
16697 char buffer[256];
16698
16699 int check (size_t expect, int test) {
16700   size_t got = strlen(buffer);
16701   if (expect == got)
16702     return 0;
16703
16704   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16705        test, buffer);
16706   exit (test);
16707 }
16708
16709 int main(int argc, char **argv) {
16710   int test = 0;
16711
16712   check(sprintf(buffer, ""), ++test);
16713   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16714   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16715
16716   return 0;
16717 }
16718 EOP
16719 set try
16720
16721 d_sprintf_returns_strlen="$undef"
16722 if eval $compile; then
16723     xxx="`$run ./try`"
16724     case "$?" in
16725         0) cat >&4 <<EOM
16726 sprintf returns the length of the string (as ANSI says it should)
16727 EOM
16728         d_sprintf_returns_strlen="$define"
16729         ;;
16730         *) cat >&4 <<EOM
16731 sprintf does not return the length of the string (how old is this system?)
16732 EOM
16733         d_sprintf_returns_strlen="$undef"
16734         ;;
16735     esac
16736 fi
16737
16738 $rm -f try.* try
16739
16740 : see if srand48_r exists
16741 set srand48_r d_srand48_r
16742 eval $inlibc
16743 case "$d_srand48_r" in
16744 "$define")
16745         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16746         case "$d_srand48_r_proto:$usethreads" in
16747         ":define")      d_srand48_r_proto=define
16748                 set d_srand48_r_proto srand48_r $hdrs
16749                 eval $hasproto ;;
16750         *)      ;;
16751         esac
16752         case "$d_srand48_r_proto" in
16753         define)
16754         case "$srand48_r_proto" in
16755         ''|0) try='int srand48_r(long, struct drand48_data*);'
16756         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16757         esac
16758         case "$srand48_r_proto" in
16759         ''|0)   d_srand48_r=undef
16760                 srand48_r_proto=0
16761                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16762         * )     case "$srand48_r_proto" in
16763                 REENTRANT_PROTO*) ;;
16764                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16765                 esac
16766                 echo "Prototype: $try" ;;
16767         esac
16768         ;;
16769         *)      case "$usethreads" in
16770                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16771                 esac
16772                 d_srand48_r=undef
16773                 srand48_r_proto=0
16774                 ;;
16775         esac
16776         ;;
16777 *)      srand48_r_proto=0
16778         ;;
16779 esac
16780
16781 : see if srandom_r exists
16782 set srandom_r d_srandom_r
16783 eval $inlibc
16784 case "$d_srandom_r" in
16785 "$define")
16786         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16787         case "$d_srandom_r_proto:$usethreads" in
16788         ":define")      d_srandom_r_proto=define
16789                 set d_srandom_r_proto srandom_r $hdrs
16790                 eval $hasproto ;;
16791         *)      ;;
16792         esac
16793         case "$d_srandom_r_proto" in
16794         define)
16795         case "$srandom_r_proto" in
16796         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16797         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16798         esac
16799         case "$srandom_r_proto" in
16800         ''|0)   d_srandom_r=undef
16801                 srandom_r_proto=0
16802                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16803         * )     case "$srandom_r_proto" in
16804                 REENTRANT_PROTO*) ;;
16805                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16806                 esac
16807                 echo "Prototype: $try" ;;
16808         esac
16809         ;;
16810         *)      case "$usethreads" in
16811                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16812                 esac
16813                 d_srandom_r=undef
16814                 srandom_r_proto=0
16815                 ;;
16816         esac
16817         ;;
16818 *)      srandom_r_proto=0
16819         ;;
16820 esac
16821
16822 : see if prototype for setresgid is available
16823 echo " "
16824 set d_sresgproto setresgid $i_unistd unistd.h
16825 eval $hasproto
16826
16827 : see if prototype for setresuid is available
16828 echo " "
16829 set d_sresuproto setresuid $i_unistd unistd.h
16830 eval $hasproto
16831
16832 : see if sys/stat.h is available
16833 set sys/stat.h i_sysstat
16834 eval $inhdr
16835
16836
16837 : see if stat knows about block sizes
16838 echo " "
16839 echo "Checking to see if your struct stat has st_blocks field..." >&4
16840 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16841 eval $hasfield
16842
16843
16844 : see if this is a sys/vfs.h system
16845 set sys/vfs.h i_sysvfs
16846 eval $inhdr
16847
16848
16849 : see if this is a sys/statfs.h system
16850 set sys/statfs.h i_sysstatfs
16851 eval $inhdr
16852
16853
16854 echo " "
16855 echo "Checking to see if your system supports struct statfs..." >&4
16856 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
16857 eval $hasstruct
16858 case "$d_statfs_s" in
16859 "$define")      echo "Yes, it does."   ;;
16860 *)              echo "No, it doesn't." ;;
16861 esac
16862
16863
16864
16865 : see if struct statfs knows about f_flags
16866 case "$d_statfs_s" in
16867 define) 
16868         echo " "
16869         echo "Checking to see if your struct statfs has f_flags field..." >&4
16870         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
16871         eval $hasfield
16872         ;;
16873 *)      val="$undef"
16874         set d_statfs_f_flags
16875         eval $setvar
16876         ;;
16877 esac
16878 case "$d_statfs_f_flags" in
16879 "$define")      echo "Yes, it does."   ;;
16880 *)              echo "No, it doesn't." ;;
16881 esac
16882
16883 $cat >&4 <<EOM
16884 Checking how to access stdio streams by file descriptor number...
16885 EOM
16886 case "$stdio_stream_array" in
16887 '')     $cat >try.c <<EOCP
16888 #include <stdio.h>
16889 int main() {
16890   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16891     printf("yes\n");
16892 }
16893 EOCP
16894         for s in _iob __iob __sF
16895         do
16896                 set try -DSTDIO_STREAM_ARRAY=$s
16897                 if eval $compile; then
16898                         case "`$run ./try`" in
16899                         yes)    stdio_stream_array=$s; break ;;
16900                         esac
16901                 fi
16902         done
16903         $rm -f try.* try$exe_ext
16904 esac
16905 case "$stdio_stream_array" in
16906 '')     $cat >&4 <<EOM
16907 I can't figure out how to access stdio streams by file descriptor number.
16908 EOM
16909         d_stdio_stream_array="$undef"
16910         ;;
16911 *)      $cat >&4 <<EOM
16912 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16913 EOM
16914         d_stdio_stream_array="$define"
16915         ;;
16916 esac
16917
16918 : see if strcoll exists
16919 set strcoll d_strcoll
16920 eval $inlibc
16921
16922 : check for structure copying
16923 echo " "
16924 echo "Checking to see if your C compiler can copy structs..." >&4
16925 $cat >try.c <<'EOCP'
16926 int main()
16927 {
16928         struct blurfl {
16929                 int dyick;
16930         } foo, bar;
16931
16932         foo = bar;
16933 }
16934 EOCP
16935 if $cc -c try.c >/dev/null 2>&1 ; then
16936         val="$define"
16937         echo "Yup, it can."
16938 else
16939         val="$undef"
16940         echo "Nope, it can't."
16941 fi
16942 set d_strctcpy
16943 eval $setvar
16944 $rm -f try.*
16945
16946 : see if strerror and/or sys_errlist[] exist
16947 echo " "
16948 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16949     if set strerror val -f d_strerror; eval $csym; $val; then
16950                 echo 'strerror() found.' >&4
16951                 d_strerror="$define"
16952                 d_strerrm='strerror(e)'
16953                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16954                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16955                         d_syserrlst="$define"
16956                 else
16957                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16958                         d_syserrlst="$undef"
16959                 fi
16960     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16961                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16962                 echo 'strerror() found in string header.' >&4
16963                 d_strerror="$define"
16964                 d_strerrm='strerror(e)'
16965                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16966                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16967                                 d_syserrlst="$define"
16968                 else
16969                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16970                         d_syserrlst="$undef"
16971                 fi
16972     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16973                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16974                 d_strerror="$undef"
16975                 d_syserrlst="$define"
16976                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16977     else
16978                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16979                 d_strerror="$undef"
16980                 d_syserrlst="$undef"
16981                 d_strerrm='"unknown"'
16982     fi
16983 fi
16984
16985 : see if strerror_r exists
16986 set strerror_r d_strerror_r
16987 eval $inlibc
16988 case "$d_strerror_r" in
16989 "$define")
16990         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16991         case "$d_strerror_r_proto:$usethreads" in
16992         ":define")      d_strerror_r_proto=define
16993                 set d_strerror_r_proto strerror_r $hdrs
16994                 eval $hasproto ;;
16995         *)      ;;
16996         esac
16997         case "$d_strerror_r_proto" in
16998         define)
16999         case "$strerror_r_proto" in
17000         ''|0) try='int strerror_r(int, char*, size_t);'
17001         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17002         esac
17003         case "$strerror_r_proto" in
17004         ''|0) try='int strerror_r(int, char*, int);'
17005         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17006         esac
17007         case "$strerror_r_proto" in
17008         ''|0) try='char* strerror_r(int, char*, size_t);'
17009         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17010         esac
17011         case "$strerror_r_proto" in
17012         ''|0)   d_strerror_r=undef
17013                 strerror_r_proto=0
17014                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17015         * )     case "$strerror_r_proto" in
17016                 REENTRANT_PROTO*) ;;
17017                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17018                 esac
17019                 echo "Prototype: $try" ;;
17020         esac
17021         ;;
17022         *)      case "$usethreads" in
17023                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17024                 esac
17025                 d_strerror_r=undef
17026                 strerror_r_proto=0
17027                 ;;
17028         esac
17029         ;;
17030 *)      strerror_r_proto=0
17031         ;;
17032 esac
17033
17034 : see if strftime exists
17035 set strftime d_strftime
17036 eval $inlibc
17037
17038 : see if strlcat exists
17039 set strlcat d_strlcat
17040 eval $inlibc
17041
17042 : see if strlcpy exists
17043 set strlcpy d_strlcpy
17044 eval $inlibc
17045
17046 : see if strtod exists
17047 set strtod d_strtod
17048 eval $inlibc
17049
17050 : see if strtol exists
17051 set strtol d_strtol
17052 eval $inlibc
17053
17054 : see if strtold exists
17055 set strtold d_strtold
17056 eval $inlibc
17057
17058 : see if strtoll exists
17059 set strtoll d_strtoll
17060 eval $inlibc
17061
17062 case "$d_longlong-$d_strtoll" in
17063 "$define-$define")
17064         $cat <<EOM
17065 Checking whether your strtoll() works okay...
17066 EOM
17067         $cat >try.c <<'EOCP'
17068 #include <errno.h>
17069 #ifdef __hpux
17070 #define strtoll __strtoll
17071 #endif
17072 #ifdef __EMX__
17073 #define strtoll _strtoll
17074 #endif
17075 #include <stdio.h>
17076 extern long long int strtoll(char *s, char **, int); 
17077 static int bad = 0;
17078 int check(char *s, long long ell, int een) {
17079         long long gll;
17080         errno = 0;
17081         gll = strtoll(s, 0, 10);
17082         if (!((gll == ell) && (errno == een)))
17083                 bad++;
17084 }
17085 int main() {
17086         check(" 1",                                      1LL, 0);
17087         check(" 0",                                      0LL, 0);
17088         check("-1",                                     -1LL, 0);
17089         check("-9223372036854775808", -9223372036854775808LL, 0);
17090         check("-9223372036854775808", -9223372036854775808LL, 0);
17091         check(" 9223372036854775807",  9223372036854775807LL, 0);
17092         check("-9223372036854775808", -9223372036854775808LL, 0);
17093         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17094         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17095         if (!bad)
17096                 printf("ok\n");
17097 }
17098 EOCP
17099         set try
17100         if eval $compile; then
17101                 yyy=`$run ./try`
17102                 case "$yyy" in
17103                 ok) echo "Your strtoll() seems to be working okay." ;;
17104                 *) cat <<EOM >&4
17105 Your strtoll() doesn't seem to be working okay.
17106 EOM
17107                    d_strtoll="$undef"
17108                    ;;
17109                 esac
17110         else
17111                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17112                 d_strtoll="$undef"
17113         fi
17114         ;;
17115 esac
17116
17117 : see if strtoq exists
17118 set strtoq d_strtoq
17119 eval $inlibc
17120
17121 : see if strtoul exists
17122 set strtoul d_strtoul
17123 eval $inlibc
17124
17125 case "$d_strtoul" in
17126 "$define")
17127         $cat <<EOM
17128 Checking whether your strtoul() works okay...
17129 EOM
17130         $cat >try.c <<'EOCP'
17131 #include <errno.h>
17132 #include <stdio.h>
17133 extern unsigned long int strtoul(char *s, char **, int); 
17134 static int bad = 0;
17135 void check(char *s, unsigned long eul, int een) {
17136         unsigned long gul;
17137         errno = 0;
17138         gul = strtoul(s, 0, 10);
17139         if (!((gul == eul) && (errno == een)))
17140                 bad++;
17141 }
17142 int main() {
17143         check(" 1", 1L, 0);
17144         check(" 0", 0L, 0);
17145 EOCP
17146         case "$longsize" in
17147         8)
17148             $cat >>try.c <<'EOCP'
17149         check("18446744073709551615", 18446744073709551615UL, 0);
17150         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17151 #if 0 /* strtoul() for /^-/ strings is undefined. */
17152         check("-1", 18446744073709551615UL, 0);
17153         check("-18446744073709551614", 2, 0);
17154         check("-18446744073709551615", 1, 0);
17155         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17156         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17157 #endif
17158 EOCP
17159                 ;;
17160         4)
17161                     $cat >>try.c <<'EOCP'
17162         check("4294967295", 4294967295UL, 0);
17163         check("4294967296", 4294967295UL, ERANGE);
17164 #if 0 /* strtoul() for /^-/ strings is undefined. */
17165         check("-1", 4294967295UL, 0);
17166         check("-4294967294", 2, 0);
17167         check("-4294967295", 1, 0);
17168         check("-4294967296", 4294967295UL, ERANGE);
17169         check("-4294967297", 4294967295UL, ERANGE);
17170 #endif
17171 EOCP
17172                 ;;
17173         *)
17174 : Should we write these tests to be more portable by sprintf-ing
17175 : ~0 and then manipulating that char string as input for strtol?
17176                 ;;
17177         esac
17178         $cat >>try.c <<'EOCP'
17179         if (!bad)
17180                 printf("ok\n");
17181         return 0;
17182 }
17183 EOCP
17184         set try
17185         if eval $compile; then
17186                 case "`$run ./try`" in
17187                 ok) echo "Your strtoul() seems to be working okay." ;;
17188                 *) cat <<EOM >&4
17189 Your strtoul() doesn't seem to be working okay.
17190 EOM
17191                    d_strtoul="$undef"
17192                    ;;
17193                 esac
17194         fi
17195         ;;
17196 esac
17197
17198 : see if strtoull exists
17199 set strtoull d_strtoull
17200 eval $inlibc
17201
17202 case "$d_longlong-$d_strtoull" in
17203 "$define-$define")
17204         $cat <<EOM
17205 Checking whether your strtoull() works okay...
17206 EOM
17207         $cat >try.c <<'EOCP'
17208 #include <errno.h>
17209 #ifdef __hpux
17210 #define strtoull __strtoull
17211 #endif
17212 #include <stdio.h>
17213 extern unsigned long long int strtoull(char *s, char **, int); 
17214 static int bad = 0;
17215 int check(char *s, long long eull, int een) {
17216         long long gull;
17217         errno = 0;
17218         gull = strtoull(s, 0, 10);
17219         if (!((gull == eull) && (errno == een)))
17220                 bad++;
17221 }
17222 int main() {
17223         check(" 1",                                        1LL, 0);
17224         check(" 0",                                        0LL, 0);
17225         check("18446744073709551615",  18446744073709551615ULL, 0);
17226         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17227 #if 0 /* strtoull() for /^-/ strings is undefined. */
17228         check("-1",                    18446744073709551615ULL, 0);
17229         check("-18446744073709551614",                     2LL, 0);
17230         check("-18446744073709551615",                     1LL, 0);
17231         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17232         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17233 #endif
17234         if (!bad)
17235                 printf("ok\n");
17236 }
17237 EOCP
17238         set try
17239         if eval $compile; then
17240                 case "`$run ./try`" in
17241                 ok) echo "Your strtoull() seems to be working okay." ;;
17242                 *) cat <<EOM >&4
17243 Your strtoull() doesn't seem to be working okay.
17244 EOM
17245                    d_strtoull="$undef"
17246                    ;;
17247                 esac
17248         fi
17249         ;;
17250 esac
17251
17252 : see if strtouq exists
17253 set strtouq d_strtouq
17254 eval $inlibc
17255
17256 case "$d_strtouq" in
17257 "$define")
17258         $cat <<EOM
17259 Checking whether your strtouq() works okay...
17260 EOM
17261         $cat >try.c <<'EOCP'
17262 #include <errno.h>
17263 #include <stdio.h>
17264 extern unsigned long long int strtouq(char *s, char **, int); 
17265 static int bad = 0;
17266 void check(char *s, unsigned long long eull, int een) {
17267         unsigned long long gull;
17268         errno = 0;
17269         gull = strtouq(s, 0, 10);
17270         if (!((gull == eull) && (errno == een)))
17271                 bad++;
17272 }
17273 int main() {
17274         check(" 1",                                        1LL, 0);
17275         check(" 0",                                        0LL, 0);
17276         check("18446744073709551615",  18446744073709551615ULL, 0);
17277         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17278 #if 0 /* strtouq() for /^-/ strings is undefined. */
17279         check("-1",                    18446744073709551615ULL, 0);
17280         check("-18446744073709551614",                     2LL, 0);
17281         check("-18446744073709551615",                     1LL, 0);
17282         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17283         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17284 #endif
17285         if (!bad)
17286                 printf("ok\n");
17287         return 0;
17288 }
17289 EOCP
17290         set try
17291         if eval $compile; then
17292                 case "`$run ./try`" in
17293                 ok) echo "Your strtouq() seems to be working okay." ;;
17294                 *) cat <<EOM >&4
17295 Your strtouq() doesn't seem to be working okay.
17296 EOM
17297                    d_strtouq="$undef"
17298                    ;;
17299                 esac
17300         fi
17301         ;;
17302 esac
17303
17304 : see if strxfrm exists
17305 set strxfrm d_strxfrm
17306 eval $inlibc
17307
17308 : see if symlink exists
17309 set symlink d_symlink
17310 eval $inlibc
17311
17312 : see if syscall exists
17313 set syscall d_syscall
17314 eval $inlibc
17315
17316 : see if prototype for syscall is available
17317 echo " "
17318 set d_syscallproto syscall $i_unistd unistd.h
17319 eval $hasproto
17320
17321 : see if sysconf exists
17322 set sysconf d_sysconf
17323 eval $inlibc
17324
17325 : see if system exists
17326 set system d_system
17327 eval $inlibc
17328
17329 : see if tcgetpgrp exists
17330 set tcgetpgrp d_tcgetpgrp
17331 eval $inlibc
17332
17333 : see if tcsetpgrp exists
17334 set tcsetpgrp d_tcsetpgrp
17335 eval $inlibc
17336
17337 : see if prototype for telldir is available
17338 echo " "
17339 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17340 eval $hasproto
17341
17342 : see if time exists
17343 echo " "
17344 if test "X$d_time" = X -o X"$timetype" = X; then
17345     if set time val -f d_time; eval $csym; $val; then
17346                 echo 'time() found.' >&4
17347                 val="$define"
17348                 rp="What is the type returned by time() on this system?"
17349                 set time_t timetype long stdio.h sys/types.h
17350                 eval $typedef_ask
17351     else
17352                 echo 'time() not found, hope that will do.' >&4
17353                 val="$undef"
17354                 timetype='int';
17355     fi
17356     set d_time
17357     eval $setvar
17358 fi
17359
17360 : see if this is a sys/times.h system
17361 set sys/times.h i_systimes
17362 eval $inhdr
17363
17364 : see if times exists
17365 echo " "
17366 if set times val -f d_times; eval $csym; $val; then
17367         echo 'times() found.' >&4
17368         d_times="$define"
17369         inc=''
17370         case "$i_systimes" in
17371         "$define") inc='sys/times.h';;
17372         esac
17373         rp="What is the type returned by times() on this system?"
17374         set clock_t clocktype long stdio.h sys/types.h $inc
17375         eval $typedef_ask
17376 else
17377         echo 'times() NOT found, hope that will do.' >&4
17378         d_times="$undef"
17379         clocktype='int'
17380 fi
17381
17382 : see if tmpnam_r exists
17383 set tmpnam_r d_tmpnam_r
17384 eval $inlibc
17385 case "$d_tmpnam_r" in
17386 "$define")
17387         hdrs="$i_systypes sys/types.h define stdio.h "
17388         case "$d_tmpnam_r_proto:$usethreads" in
17389         ":define")      d_tmpnam_r_proto=define
17390                 set d_tmpnam_r_proto tmpnam_r $hdrs
17391                 eval $hasproto ;;
17392         *)      ;;
17393         esac
17394         case "$d_tmpnam_r_proto" in
17395         define)
17396         case "$tmpnam_r_proto" in
17397         ''|0) try='char* tmpnam_r(char*);'
17398         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17399         esac
17400         case "$tmpnam_r_proto" in
17401         ''|0)   d_tmpnam_r=undef
17402                 tmpnam_r_proto=0
17403                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17404         * )     case "$tmpnam_r_proto" in
17405                 REENTRANT_PROTO*) ;;
17406                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17407                 esac
17408                 echo "Prototype: $try" ;;
17409         esac
17410         ;;
17411         *)      case "$usethreads" in
17412                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17413                 esac
17414                 d_tmpnam_r=undef
17415                 tmpnam_r_proto=0
17416                 ;;
17417         esac
17418         ;;
17419 *)      tmpnam_r_proto=0
17420         ;;
17421 esac
17422
17423 : see if truncate exists
17424 set truncate d_truncate
17425 eval $inlibc
17426
17427 : see if ttyname_r exists
17428 set ttyname_r d_ttyname_r
17429 eval $inlibc
17430 case "$d_ttyname_r" in
17431 "$define")
17432         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17433         case "$d_ttyname_r_proto:$usethreads" in
17434         ":define")      d_ttyname_r_proto=define
17435                 set d_ttyname_r_proto ttyname_r $hdrs
17436                 eval $hasproto ;;
17437         *)      ;;
17438         esac
17439         case "$d_ttyname_r_proto" in
17440         define)
17441         case "$ttyname_r_proto" in
17442         ''|0) try='int ttyname_r(int, char*, size_t);'
17443         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17444         esac
17445         case "$ttyname_r_proto" in
17446         ''|0) try='int ttyname_r(int, char*, int);'
17447         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17448         esac
17449         case "$ttyname_r_proto" in
17450         ''|0) try='char* ttyname_r(int, char*, int);'
17451         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17452         esac
17453         case "$ttyname_r_proto" in
17454         ''|0)   d_ttyname_r=undef
17455                 ttyname_r_proto=0
17456                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17457         * )     case "$ttyname_r_proto" in
17458                 REENTRANT_PROTO*) ;;
17459                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17460                 esac
17461                 echo "Prototype: $try" ;;
17462         esac
17463         ;;
17464         *)      case "$usethreads" in
17465                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17466                 esac
17467                 d_ttyname_r=undef
17468                 ttyname_r_proto=0
17469                 ;;
17470         esac
17471         ;;
17472 *)      ttyname_r_proto=0
17473         ;;
17474 esac
17475
17476 : see if tzname[] exists
17477 echo " "
17478 if set tzname val -a d_tzname; eval $csym; $val; then
17479         val="$define"
17480         echo 'tzname[] found.' >&4
17481 else
17482         val="$undef"
17483         echo 'tzname[] NOT found.' >&4
17484 fi
17485 set d_tzname
17486 eval $setvar
17487
17488 case "$osname" in
17489 next|rhapsody|darwin) multiarch="$define" ;;
17490 esac
17491 case "$multiarch" in
17492 ''|[nN]*) multiarch="$undef" ;;
17493 esac
17494
17495 : check for ordering of bytes in a UV
17496 echo " "
17497 case "$usecrosscompile$multiarch" in
17498 *$define*)
17499         $cat <<EOM
17500 You seem to be either cross-compiling or doing a multiarchitecture build,
17501 skipping the byteorder check.
17502
17503 EOM
17504         byteorder='ffff'
17505         ;;
17506 *)
17507         case "$byteorder" in
17508         '')
17509                 $cat <<'EOM'
17510 In the following, larger digits indicate more significance.  A big-endian
17511 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17512 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17513 machines may have weird orders like 3412.  A Cray will report 87654321,
17514 an Alpha will report 12345678. If the test program works the default is
17515 probably right.
17516 I'm now running the test program...
17517 EOM
17518                 $cat >try.c <<EOCP
17519 #include <stdio.h>
17520 #$i_stdlib I_STDLIB
17521 #ifdef I_STDLIB
17522 #include <stdlib.h>
17523 #endif
17524 #include <sys/types.h>
17525 typedef $uvtype UV;
17526 int main()
17527 {
17528         int i;
17529         union {
17530                 UV l;
17531                 char c[$uvsize];
17532         } u;
17533
17534         if ($uvsize > 4)
17535                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17536         else
17537                 u.l = (UV)0x04030201;
17538         for (i = 0; i < $uvsize; i++)
17539                 printf("%c", u.c[i]+'0');
17540         printf("\n");
17541         exit(0);
17542 }
17543 EOCP
17544                 xxx_prompt=y
17545                 set try
17546                 if eval $compile && ./try > /dev/null; then
17547                         dflt=`$run ./try`
17548                         case "$dflt" in
17549                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17550                                 echo "(The test program ran ok.)"
17551                                 echo "byteorder=$dflt"
17552                                 xxx_prompt=n
17553                         ;;
17554                         ????|????????) echo "(The test program ran ok.)" ;;
17555                         *) echo "(The test program didn't run right for some reason.)" ;;
17556                         esac
17557                 else
17558                         dflt='4321'
17559                         cat <<'EOM'
17560 (I can't seem to compile the test program.  Guessing big-endian...)
17561 EOM
17562                 fi
17563                 case "$xxx_prompt" in
17564                 y)
17565                         rp="What is the order of bytes in $uvtype?"
17566                         . ./myread
17567                         byteorder="$ans"
17568                         ;;
17569                 *)      byteorder=$dflt
17570                         ;;
17571                 esac
17572                 ;;
17573         esac
17574         $rm -f try.c try
17575         ;;
17576 esac
17577
17578
17579 $cat <<EOM
17580
17581 Checking to see whether you can access character data unalignedly...
17582 EOM
17583 case "$d_u32align" in
17584 '')   $cat >try.c <<EOCP
17585 #include <stdio.h>
17586 #$i_stdlib I_STDLIB
17587 #ifdef I_STDLIB
17588 #include <stdlib.h>
17589 #endif
17590 #define U32 $u32type
17591 #define BYTEORDER 0x$byteorder
17592 #define U8 $u8type
17593 #include <signal.h>
17594 #ifdef SIGBUS
17595 $signal_t bletch(s) int s; { exit(4); }
17596 #endif
17597 int main() {
17598 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17599     U8 buf[8];
17600     U32 *up;
17601     int i;
17602
17603     if (sizeof(U32) != 4) {
17604         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17605         exit(1);
17606     }
17607
17608     fflush(stdout);
17609
17610 #ifdef SIGBUS
17611     signal(SIGBUS, bletch);
17612 #endif
17613
17614     buf[0] = 0;
17615     buf[1] = 0;
17616     buf[2] = 0;
17617     buf[3] = 1;
17618     buf[4] = 0;
17619     buf[5] = 0;
17620     buf[6] = 0;
17621     buf[7] = 1;
17622
17623     for (i = 0; i < 4; i++) {
17624         up = (U32*)(buf + i);
17625         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17626                (*up == 1 << (8*(3-i)))  /* little-endian */
17627               )
17628            )
17629         {
17630             printf("read failed (%x)\n", *up);
17631             exit(2);
17632         }
17633     }
17634
17635     /* write test */
17636     for (i = 0; i < 4; i++) {
17637         up = (U32*)(buf + i);
17638         *up = 0xBeef;
17639         if (*up != 0xBeef) {
17640             printf("write failed (%x)\n", *up);
17641             exit(3);
17642         }
17643     }
17644
17645     exit(0);
17646 #else
17647     printf("1\n");
17648     exit(1);
17649 #endif
17650     return 0;
17651 }
17652 EOCP
17653 set try
17654 if eval $compile_ok; then
17655         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17656         $run ./try 2>&1 >/dev/null
17657         case "$?" in
17658         0)      cat >&4 <<EOM
17659 You can access character data pretty unalignedly.
17660 EOM
17661                 d_u32align="$undef"
17662                 ;;
17663         *)      cat >&4 <<EOM
17664 It seems that you must access character data in an aligned manner.
17665 EOM
17666                 d_u32align="$define"
17667                 ;;
17668         esac
17669 else
17670         rp='Can you access character data at unaligned addresses?'
17671         dflt='n'
17672         . ./myread
17673         case "$ans" in
17674         [yY]*)  d_u32align="$undef"  ;;
17675         *)      d_u32align="$define" ;;
17676         esac
17677 fi
17678 $rm -f core core.try.* try.core
17679 ;;
17680 esac
17681
17682 : see if ualarm exists
17683 set ualarm d_ualarm
17684 eval $inlibc
17685
17686 : see if umask exists
17687 set umask d_umask
17688 eval $inlibc
17689
17690 : see if unordered exists
17691 set unordered d_unordered
17692 eval $inlibc
17693
17694 : see if unsetenv exists
17695 set unsetenv d_unsetenv
17696 eval $inlibc
17697
17698 : see if usleep exists
17699 set usleep d_usleep
17700 eval $inlibc
17701
17702 : see if prototype for usleep is available
17703 echo " "
17704 set d_usleepproto usleep $i_unistd unistd.h
17705 eval $hasproto
17706
17707 : see if ustat exists
17708 set ustat d_ustat
17709 eval $inlibc
17710
17711 : backward compatibility for d_hvfork
17712 if test X$d_hvfork != X; then
17713         d_vfork="$d_hvfork"
17714         d_hvfork=''
17715 fi
17716 : see if there is a vfork
17717 val=''
17718 set vfork val
17719 eval $inlibc
17720
17721 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17722 : perl on Solaris 2.x, and probably elsewhere.
17723 case "$val" in
17724 $define)
17725         echo " "
17726         case "$usevfork" in
17727         false) dflt='n';;
17728         *) dflt='y';;
17729         esac
17730         cat <<'EOM'
17731  
17732 Perl can only use a vfork() that doesn't suffer from strict
17733 restrictions on calling functions or modifying global data in
17734 the child.  For example, glibc-2.1 contains such a vfork()
17735 that is unsuitable.  If your system provides a proper fork()
17736 call, chances are that you do NOT want perl to use vfork().
17737
17738 EOM
17739         rp="Do you still want to use vfork()?"
17740         . ./myread
17741         case "$ans" in
17742         y|Y) ;;
17743         *)
17744                 echo "Ok, we won't use vfork()."
17745                 val="$undef"
17746                 ;;
17747         esac
17748         ;;
17749 esac
17750 set d_vfork
17751 eval $setvar
17752 case "$d_vfork" in
17753 $define) usevfork='true';;
17754 *) usevfork='false';;
17755 esac
17756
17757 : see if closedir exists
17758 set closedir d_closedir
17759 eval $inlibc
17760
17761 case "$d_closedir" in
17762 "$define")
17763         echo " "
17764         echo "Checking whether closedir() returns a status..." >&4
17765         cat > try.c <<EOM
17766 #$i_dirent I_DIRENT             /**/
17767 #$i_sysdir I_SYS_DIR            /**/
17768 #$i_sysndir I_SYS_NDIR          /**/
17769 #$i_systypes I_SYS_TYPES        /**/
17770
17771 #if defined(I_SYS_TYPES)
17772 #include <sys/types.h>
17773 #endif
17774 #if defined(I_DIRENT)
17775 #include <dirent.h>
17776 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17777 #include <sys/dir.h>
17778 #endif
17779 #else
17780 #ifdef I_SYS_NDIR
17781 #include <sys/ndir.h>
17782 #else
17783 #ifdef I_SYS_DIR
17784 #ifdef hp9000s500
17785 #include <ndir.h>       /* may be wrong in the future */
17786 #else
17787 #include <sys/dir.h>
17788 #endif
17789 #endif
17790 #endif
17791 #endif 
17792 int main() { return closedir(opendir(".")); }
17793 EOM
17794         set try
17795         if eval $compile_ok; then
17796                 if $run ./try > /dev/null 2>&1 ; then
17797                         echo "Yes, it does."
17798                         val="$undef"
17799                 else
17800                         echo "No, it doesn't."
17801                         val="$define"
17802                 fi
17803         else
17804                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17805                 val="$define"
17806         fi
17807         ;;
17808 *)
17809         val="$undef";
17810         ;;
17811 esac
17812 set d_void_closedir
17813 eval $setvar
17814 $rm -f try try.*
17815 : see if there is a wait4
17816 set wait4 d_wait4
17817 eval $inlibc
17818
17819 : see if waitpid exists
17820 set waitpid d_waitpid
17821 eval $inlibc
17822
17823 : see if wcstombs exists
17824 set wcstombs d_wcstombs
17825 eval $inlibc
17826
17827 : see if wctomb exists
17828 set wctomb d_wctomb
17829 eval $inlibc
17830
17831 : see if writev exists
17832 set writev d_writev
17833 eval $inlibc
17834
17835 : preserve RCS keywords in files with variable substitution, grrr
17836 Date='$Date'
17837 Id='$Id'
17838 Log='$Log'
17839 RCSfile='$RCSfile'
17840 Revision='$Revision'
17841
17842 : check for alignment requirements
17843 echo " "
17844 case "$usecrosscompile$multiarch" in
17845 *$define*)
17846         $cat <<EOM
17847 You seem to be either cross-compiling or doing a multiarchitecture build,
17848 skipping the memory alignment check.
17849
17850 EOM
17851         case "$alignbytes" in
17852         '') alignbytes=8 ;;
17853         esac
17854         ;;
17855 *)
17856         case "$alignbytes" in
17857         '') echo "Checking alignment constraints..." >&4
17858                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17859                         $cat >try.c <<'EOCP'
17860 typedef long double NV;
17861 EOCP
17862                 else
17863                         $cat >try.c <<'EOCP'
17864 typedef double NV;
17865 EOCP
17866                 fi
17867                 $cat >>try.c <<'EOCP'
17868 #include <stdio.h>
17869 struct foobar {
17870         char foo;
17871         NV bar;
17872 } try_algn;
17873 int main()
17874 {
17875     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17876     return(0);
17877 }
17878 EOCP
17879                 set try
17880                 if eval $compile_ok; then
17881                         dflt=`$run ./try`
17882                 else
17883                         dflt='8'
17884                         echo "(I can't seem to compile the test program...)"
17885                 fi
17886                 ;;
17887         *) dflt="$alignbytes"
17888                 ;;
17889         esac
17890         rp="Doubles must be aligned on a how-many-byte boundary?"
17891         . ./myread
17892         alignbytes="$ans"
17893         $rm -f try.c try
17894         ;;
17895 esac
17896
17897
17898 : set the base revision
17899 baserev=5.0
17900
17901 : how do we concatenate cpp tokens here?
17902 echo " "
17903 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17904 $cat >cpp_stuff.c <<'EOCP'
17905 #define RCAT(a,b)a/**/b
17906 #define ACAT(a,b)a ## b
17907 RCAT(Rei,ser)
17908 ACAT(Cir,cus)
17909 EOCP
17910 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17911 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17912         echo "Oh!  Smells like ANSI's been here." >&4
17913         echo "We can catify or stringify, separately or together!"
17914         cpp_stuff=42
17915 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17916         echo "Ah, yes!  The good old days!" >&4
17917         echo "However, in the good old days we don't know how to stringify and"
17918         echo "catify at the same time."
17919         cpp_stuff=1
17920 else
17921         $cat >&4 <<EOM
17922 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17923 You're going to have to edit the values of CAT[2-5] in config.h...
17924 EOM
17925         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17926 fi
17927 $rm -f cpp_stuff.*
17928
17929 : see if this is a db.h system
17930 set db.h i_db
17931 eval $inhdr
17932
17933 case "$i_db" in
17934 $define)
17935         : Check db version.
17936         echo " "
17937         echo "Checking Berkeley DB version ..." >&4
17938         $cat >try.c <<EOCP
17939 #$d_const HASCONST
17940 #ifndef HASCONST
17941 #define const
17942 #endif
17943 #include <sys/types.h>
17944 #include <stdio.h>
17945 #$i_stdlib I_STDLIB
17946 #ifdef I_STDLIB
17947 #include <stdlib.h>
17948 #endif
17949 #include <db.h>
17950 int main(int argc, char *argv[])
17951 {
17952 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17953     int Major, Minor, Patch ;
17954     unsigned long Version ;
17955     (void)db_version(&Major, &Minor, &Patch) ;
17956     if (argc == 2) {
17957         printf("%d %d %d %d %d %d\n",
17958                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17959                Major, Minor, Patch);
17960         exit(0);
17961     }
17962     printf("You have Berkeley DB Version 2 or greater.\n");
17963
17964     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17965                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17966     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17967                 Major, Minor, Patch) ;
17968
17969     /* check that db.h & libdb are compatible */
17970     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17971         printf("db.h and libdb are incompatible.\n") ;
17972         exit(3);        
17973     }
17974
17975     printf("db.h and libdb are compatible.\n") ;
17976
17977     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17978                 + DB_VERSION_PATCH ;
17979
17980     /* needs to be >= 2.3.4 */
17981     if (Version < 2003004) {
17982     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17983         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17984         exit(2);        
17985     }
17986
17987     exit(0);
17988 #else
17989 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17990     if (argc == 2) {
17991         printf("1 0 0\n");
17992         exit(0);
17993     }
17994     printf("You have Berkeley DB Version 1.\n");
17995     exit(0);    /* DB version < 2: the coast is clear. */
17996 #else
17997     exit(1);    /* <db.h> not Berkeley DB? */
17998 #endif
17999 #endif
18000 }
18001 EOCP
18002         set try
18003         if eval $compile_ok && $run ./try; then
18004                 echo 'Looks OK.' >&4
18005                 set `$run ./try 1`
18006                 db_version_major=$1
18007                 db_version_minor=$2
18008                 db_version_patch=$3
18009         else
18010                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18011                 i_db=$undef
18012                 case " $libs " in
18013                 *"-ldb "*)
18014                         : Remove db from list of libraries to use
18015                         echo "Removing unusable -ldb from library list" >&4
18016                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18017                         shift
18018                         libs="$*"
18019                         echo "libs = $libs" >&4
18020                         ;;
18021                 esac
18022         fi
18023         $rm -f try.*
18024         ;;
18025 esac
18026
18027 case "$i_db" in
18028 define)
18029         : Check the return type needed for hash 
18030         echo " "
18031         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18032         $cat >try.c <<EOCP
18033 #$d_const HASCONST
18034 #ifndef HASCONST
18035 #define const
18036 #endif
18037 #include <sys/types.h>
18038 #include <db.h>
18039
18040 #ifndef DB_VERSION_MAJOR
18041 u_int32_t hash_cb (ptr, size)
18042 const void *ptr;
18043 size_t size;
18044 {
18045 }
18046 HASHINFO info;
18047 int main()
18048 {
18049         info.hash = hash_cb;
18050 }
18051 #endif
18052 EOCP
18053         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18054                 if $contains warning try.out >>/dev/null 2>&1 ; then
18055                         db_hashtype='int'
18056                 else
18057                         db_hashtype='u_int32_t'
18058                 fi
18059         else
18060                 : XXX Maybe we should just give up here.
18061                 db_hashtype=u_int32_t
18062                 $cat try.out >&4
18063                 echo "Help:  I can't seem to compile the db test program." >&4
18064                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18065         fi
18066         $rm -f try.*
18067         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18068         ;;
18069 *)      db_hashtype=u_int32_t
18070         ;;
18071 esac
18072 case "$i_db" in
18073 define)
18074         : Check the return type needed for prefix 
18075         echo " "
18076         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18077         cat >try.c <<EOCP
18078 #$d_const HASCONST
18079 #ifndef HASCONST
18080 #define const
18081 #endif
18082 #include <sys/types.h>
18083 #include <db.h>
18084
18085 #ifndef DB_VERSION_MAJOR
18086 size_t prefix_cb (key1, key2)
18087 const DBT *key1;
18088 const DBT *key2;
18089 {
18090 }
18091 BTREEINFO info;
18092 int main()
18093 {
18094         info.prefix = prefix_cb;
18095 }
18096 #endif
18097 EOCP
18098         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18099                 if $contains warning try.out >>/dev/null 2>&1 ; then
18100                         db_prefixtype='int'
18101                 else
18102                         db_prefixtype='size_t'
18103                 fi
18104         else
18105                 db_prefixtype='size_t'
18106                 : XXX Maybe we should just give up here.
18107                 $cat try.out >&4
18108                 echo "Help:  I can't seem to compile the db test program." >&4
18109                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18110         fi
18111         $rm -f try.*
18112         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18113         ;;
18114 *)      db_prefixtype='size_t'
18115         ;;
18116 esac
18117
18118
18119 : How can we generate normalized random numbers ?
18120 echo " "
18121 echo "Looking for a random number function..." >&4
18122 case "$randfunc" in
18123 '')
18124         if set drand48 val -f; eval $csym; $val; then
18125                 dflt="drand48"
18126                 echo "Good, found drand48()." >&4
18127         elif set random val -f; eval $csym; $val; then
18128                 dflt="random"
18129                 echo "OK, found random()." >&4
18130         else
18131                 dflt="rand"
18132                 echo "Yick, looks like I have to use rand()." >&4
18133         fi
18134         echo " "
18135         ;;
18136 *)
18137         dflt="$randfunc"
18138         ;;
18139 esac
18140 cont=true
18141
18142 case "$ccflags" in
18143 *-Dmy_rand=*|*-Dmy_srand=*)
18144         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18145         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18146         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18147         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18148         ;;
18149 esac
18150
18151 while $test "$cont"; do
18152         rp="Use which function to generate random numbers?"
18153         . ./myread
18154         if $test "$ans" = "$dflt"; then
18155                 : null
18156         else
18157                 randbits=''
18158         fi
18159         randfunc="$ans"
18160         if set $ans val -f; eval $csym; $val; then
18161                 cont=''
18162         else
18163                 dflt=y
18164                 rp="I cannot find function $ans. Use that name anyway?"
18165                 . ./myread
18166                 dflt=rand
18167                 case "$ans" in
18168                         [yY]*) cont='';;
18169                 esac
18170         fi
18171         case "$cont" in
18172         '')
18173                 case "$randfunc" in
18174                 drand48)
18175                         drand01="drand48()"
18176                         seedfunc="srand48"
18177                         randbits=48
18178                         randseedtype=long
18179                         ;;
18180                 rand|random)
18181                         case "$randbits" in
18182                         '')
18183 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18184                                 $cat >try.c <<EOCP
18185 #$i_unistd I_UNISTD
18186 #$i_stdlib I_STDLIB
18187 #include <stdio.h>
18188 #ifdef I_UNISTD
18189 #  include <unistd.h>
18190 #endif
18191 #ifdef I_STDLIB
18192 #  include <stdlib.h>
18193 #endif
18194 int main()
18195 {
18196         register int i;
18197         register unsigned long tmp;
18198         register unsigned long max = 0L;
18199
18200         for (i = 1000; i; i--) {
18201                 tmp = (unsigned long) $randfunc();
18202                 if (tmp > max) max = tmp;
18203         }
18204         for (i = 0; max; i++)
18205                 max /= 2;
18206         printf("%d\n",i);
18207 }
18208 EOCP
18209                                 set try
18210                                 if eval $compile_ok; then
18211                                         dflt=`try`
18212                                 else
18213                                         dflt='?'
18214                                         echo "(I can't seem to compile the test program...)"
18215                                 fi
18216                                 ;;
18217                         *)
18218                                 dflt="$randbits"
18219                                 ;;
18220                         esac
18221                         rp="How many bits does your $randfunc() function produce?"
18222                         . ./myread
18223                         randbits="$ans"
18224                         $rm -f try.c try
18225                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18226                         seedfunc="s$randfunc"
18227                         randseedtype=unsigned
18228                         ;;
18229                 *)
18230                         dflt="31"
18231                         rp="How many bits does your $randfunc() function produce?"
18232                         . ./myread
18233                         randbits="$ans"
18234                         seedfunc="s$randfunc"
18235                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18236                         if set $seedfunc val -f; eval $csym; $val; then
18237                                 echo "(Using $seedfunc() to seed random generator)"
18238                         else
18239                                 echo "(Warning: no $seedfunc() to seed random generator)"
18240                                 seedfunc=rand
18241                         fi
18242                         randseedtype=unsigned
18243                         ;;
18244                 esac
18245                 ;;
18246         esac
18247 done
18248
18249 echo " "
18250 echo "Determining whether or not we are on an EBCDIC system..." >&4
18251 $cat >try.c <<'EOM'
18252 int main()
18253 {
18254   if ('M'==0xd4) return 0;
18255   return 1;
18256 }
18257 EOM
18258
18259 val=$undef
18260 set try
18261 if eval $compile_ok; then
18262         if $run ./try; then
18263                 echo "You seem to speak EBCDIC." >&4
18264                 val="$define"
18265         else
18266                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18267         fi
18268 else
18269         echo "I'm unable to compile the test program." >&4
18270         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18271 fi
18272 $rm -f try try.*
18273 set ebcdic
18274 eval $setvar
18275
18276 echo " "
18277 $cat >&4 <<EOM
18278 Checking how to flush all pending stdio output...
18279 EOM
18280 # I only know how to find the first 32 possibly open files on SunOS.
18281 # See also hints/sunos_4_1.sh and util.c  --AD
18282 case "$osname" in
18283 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18284 esac
18285 $cat >>try.c <<EOCP
18286 #include <stdio.h>
18287 #$i_stdlib I_STDLIB
18288 #ifdef I_STDLIB
18289 #include <stdlib.h>
18290 #endif
18291 #$i_unistd I_UNISTD
18292 #ifdef I_UNISTD
18293 # include <unistd.h>
18294 #endif
18295 #$d_sysconf HAS_SYSCONF
18296 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18297 #ifdef HAS_STDIO_STREAM_ARRAY
18298 # define STDIO_STREAM_ARRAY $stdio_stream_array
18299 #endif
18300 int main() {
18301   FILE* p;
18302   unlink("try.out");
18303   p = fopen("try.out", "w");
18304 #ifdef TRY_FPUTC
18305   fputc('x', p);
18306 #else
18307 # ifdef TRY_FPRINTF
18308   fprintf(p, "x");
18309 # endif
18310 #endif
18311 #ifdef TRY_FFLUSH_NULL
18312   fflush(NULL);
18313 #endif
18314 #ifdef TRY_FFLUSH_ALL
18315   {
18316     long open_max = -1;
18317 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18318     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18319 # else
18320 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18321     open_max = sysconf(_SC_OPEN_MAX);
18322 #  else
18323 #   ifdef FOPEN_MAX
18324     open_max = FOPEN_MAX;
18325 #   else
18326 #    ifdef OPEN_MAX
18327     open_max = OPEN_MAX;
18328 #    else
18329 #     ifdef _NFILE
18330     open_max = _NFILE;
18331 #     endif
18332 #    endif
18333 #   endif
18334 #  endif
18335 # endif 
18336 # ifdef HAS_STDIO_STREAM_ARRAY
18337     if (open_max > 0) {
18338       long i;
18339       for (i = 0; i < open_max; i++)
18340             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18341                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18342                 STDIO_STREAM_ARRAY[i]._flag)
18343                 fflush(&STDIO_STREAM_ARRAY[i]);
18344     }   
18345   }
18346 # endif
18347 #endif
18348   _exit(42);
18349 }
18350 EOCP
18351 : first we have to find out how _not_ to flush
18352 $to try.c
18353 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18354     output=''
18355     set try -DTRY_FPUTC
18356     if eval $compile; then
18357             $run ./try 2>/dev/null
18358             code="$?"
18359             $from try.out
18360             if $test ! -s try.out -a "X$code" = X42; then
18361                 output=-DTRY_FPUTC
18362             fi
18363     fi
18364     case "$output" in
18365     '')
18366             set try -DTRY_FPRINTF
18367             if eval $compile; then
18368                     $run ./try 2>/dev/null
18369                     code="$?"
18370                     $from try.out
18371                     if $test ! -s try.out -a "X$code" = X42; then
18372                         output=-DTRY_FPRINTF
18373                     fi
18374             fi
18375         ;;
18376     esac
18377 fi
18378 : check for fflush NULL behaviour
18379 case "$fflushNULL" in
18380 '')     set try -DTRY_FFLUSH_NULL $output
18381         if eval $compile; then
18382                 $run ./try 2>/dev/null
18383                 code="$?"
18384                 $from try.out
18385                 if $test -s try.out -a "X$code" = X42; then
18386                         fflushNULL="`$cat try.out`"
18387                 else
18388                         if $test "X$code" != X42; then
18389                                 $cat >&4 <<EOM
18390 (If this test failed, don't worry, we'll try another method shortly.)
18391 EOM
18392                         fi
18393                 fi
18394         fi
18395         $rm -f core try.core core.try.*
18396         case "$fflushNULL" in
18397         x)      $cat >&4 <<EOM
18398 Your fflush(NULL) works okay for output streams.
18399 Let's see if it clobbers input pipes...
18400 EOM
18401 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18402 # bug that improperly flushes the input end of pipes.  So we avoid the
18403 # autoflush on fork/system/exec support for now. :-(
18404 $cat >tryp.c <<EOCP
18405 #include <stdio.h>
18406 int
18407 main(int argc, char **argv)
18408 {
18409     char buf[1024];
18410     int i;
18411     char *bp = buf;
18412     while (1) {
18413         while ((i = getc(stdin)) != -1
18414                && (*bp++ = i) != '\n'
18415                && bp < &buf[1024])
18416         /* DO NOTHING */ ;
18417         *bp = '\0';
18418         fprintf(stdout, "%s", buf);
18419         fflush(NULL);
18420         if (i == -1)
18421             return 0;
18422         bp = buf;
18423     }
18424 }
18425 EOCP
18426                 fflushNULL="$define"
18427                 set tryp
18428                 if eval $compile; then
18429                     $rm -f tryp.out
18430                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18431                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18432                        $cat >&4 <<EOM
18433 fflush(NULL) seems to behave okay with input streams.
18434 EOM
18435                         fflushNULL="$define"
18436                     else
18437                         $cat >&4 <<EOM
18438 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18439 EOM
18440                         fflushNULL="$undef"
18441                     fi
18442                 fi
18443                 $rm -f core tryp.c tryp.core core.tryp.*
18444                 ;;
18445         '')     $cat >&4 <<EOM
18446 Your fflush(NULL) isn't working (contrary to ANSI C).
18447 EOM
18448                 fflushNULL="$undef"
18449                 ;;
18450         *)      $cat >&4 <<EOM
18451 Cannot figure out whether your fflush(NULL) works or not.
18452 I'm assuming it doesn't (contrary to ANSI C).
18453 EOM
18454                 fflushNULL="$undef"
18455                 ;;
18456         esac
18457         ;;
18458 $define|true|[yY]*)
18459         fflushNULL="$define"
18460         ;;
18461 *)
18462         fflushNULL="$undef"
18463         ;;
18464 esac
18465 : check explicit looping only if NULL did not work, and if the pipe
18466 : bug does not show up on an explicit flush too
18467 case "$fflushNULL" in
18468 "$undef")
18469         $cat >tryp.c <<EOCP
18470 #include <stdio.h>
18471 int
18472 main(int argc, char **argv)
18473 {
18474     char buf[1024];
18475     int i;
18476     char *bp = buf;
18477     while (1) {
18478         while ((i = getc(stdin)) != -1
18479                && (*bp++ = i) != '\n'
18480                && bp < &buf[1024])
18481         /* DO NOTHING */ ;
18482         *bp = '\0';
18483         fprintf(stdout, "%s", buf);
18484         fflush(stdin);
18485         if (i == -1)
18486             return 0;
18487         bp = buf;
18488     }
18489 }
18490 EOCP
18491         set tryp
18492         if eval $compile; then
18493             $rm -f tryp.out
18494             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18495             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18496                $cat >&4 <<EOM
18497 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18498 EOM
18499                 : now check for fflushall behaviour
18500                 case "$fflushall" in
18501                 '')     set try -DTRY_FFLUSH_ALL $output
18502                         if eval $compile; then
18503                                 $cat >&4 <<EOM
18504 (Now testing the other method--but note that this also may fail.)
18505 EOM
18506                                 $run ./try 2>/dev/null
18507                                 code=$?
18508                                 $from try.out
18509                                 if $test -s try.out -a "X$code" = X42; then
18510                                         fflushall="`$cat try.out`"
18511                                 fi
18512                         fi
18513                         $rm -f core try.core core.try.*
18514                         case "$fflushall" in
18515                         x)      $cat >&4 <<EOM
18516 Whew. Flushing explicitly all the stdio streams works.
18517 EOM
18518                                 fflushall="$define"
18519                                 ;;
18520                         '')     $cat >&4 <<EOM
18521 Sigh. Flushing explicitly all the stdio streams doesn't work.
18522 EOM
18523                                 fflushall="$undef"
18524                                 ;;
18525                         *)      $cat >&4 <<EOM
18526 Cannot figure out whether flushing stdio streams explicitly works or not.
18527 I'm assuming it doesn't.
18528 EOM
18529                                 fflushall="$undef"
18530                                 ;;
18531                         esac
18532                         ;;
18533                 "$define"|true|[yY]*)
18534                         fflushall="$define"
18535                         ;;
18536                 *)
18537                         fflushall="$undef"
18538                         ;;
18539                 esac
18540             else
18541                 $cat >&4 <<EOM
18542 All is futile.  Even fflush(stdin) clobbers input pipes!
18543 EOM
18544                 fflushall="$undef"
18545             fi
18546         else
18547             fflushall="$undef"
18548         fi
18549         $rm -f core tryp.c tryp.core core.tryp.*
18550         ;;
18551 *)      fflushall="$undef"
18552         ;;
18553 esac
18554
18555 case "$fflushNULL$fflushall" in
18556 undefundef)
18557         $cat <<EOM
18558 OK, I give up.  I cannot figure out how to flush pending stdio output.
18559 We won't be flushing handles at all before fork/exec/popen.
18560 EOM
18561         ;;
18562 esac
18563 $rm -f try.* try$exe_ext
18564
18565 : Store the full pathname to the ar program for use in the C program
18566 : Respect a hint or command line value for full_ar.
18567 case "$full_ar" in
18568 '') full_ar=$ar ;;
18569 esac
18570
18571 : Store the full pathname to the sed program for use in the C program
18572 full_sed=$sed
18573
18574 : see what type gids are declared as in the kernel
18575 echo " "
18576 echo "Looking for the type for group ids returned by getgid()."
18577 set gid_t gidtype xxx stdio.h sys/types.h
18578 eval $typedef
18579 case "$gidtype" in
18580 xxx)
18581         xxx=`./findhdr sys/user.h`
18582         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18583         case $1 in
18584         unsigned) dflt="$1 $2" ;;
18585         *) dflt="$1" ;;
18586         esac
18587         ;;
18588 *) dflt="$gidtype";;
18589 esac
18590 case "$gidtype" in
18591 gid_t) echo "gid_t found." ;;
18592 *)      rp="What is the type for group ids returned by getgid()?"
18593         . ./myread
18594         gidtype="$ans"
18595         ;;
18596 esac
18597
18598 echo " "
18599 case "$gidtype" in
18600 *_t) zzz="$gidtype"     ;;
18601 *)   zzz="gid"          ;;
18602 esac
18603 echo "Checking the size of $zzz..." >&4 
18604 cat > try.c <<EOCP
18605 #include <sys/types.h>
18606 #include <stdio.h>
18607 #$i_stdlib I_STDLIB
18608 #ifdef I_STDLIB
18609 #include <stdlib.h>
18610 #endif
18611 int main() {
18612     printf("%d\n", (int)sizeof($gidtype));
18613     exit(0);
18614 }
18615 EOCP
18616 set try
18617 if eval $compile_ok; then
18618         yyy=`$run ./try`
18619         case "$yyy" in
18620         '')     gidsize=4
18621                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18622                 ;;
18623         *)      gidsize=$yyy
18624                 echo "Your $zzz is $gidsize bytes long."
18625                 ;;
18626         esac
18627 else
18628         gidsize=4
18629         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18630 fi
18631
18632
18633 echo " "
18634 case "$gidtype" in
18635 *_t) zzz="$gidtype"     ;;
18636 *)   zzz="gid"          ;;
18637 esac
18638 echo "Checking the sign of $zzz..." >&4 
18639 cat > try.c <<EOCP
18640 #include <sys/types.h>
18641 #include <stdio.h>
18642 int main() {
18643         $gidtype foo = -1;
18644         if (foo < 0)
18645                 printf("-1\n");
18646         else
18647                 printf("1\n");
18648 }
18649 EOCP
18650 set try
18651 if eval $compile; then
18652         yyy=`$run ./try`
18653         case "$yyy" in
18654         '')     gidsign=1
18655                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18656                 ;;
18657         *)      gidsign=$yyy
18658                 case "$gidsign" in
18659                  1) echo "Your $zzz is unsigned." ;;
18660                 -1) echo "Your $zzz is signed."   ;;
18661                 esac
18662                 ;;
18663         esac
18664 else
18665         gidsign=1
18666         echo "(I can't compile the test program--guessing unsigned.)" >&4
18667 fi
18668
18669
18670 echo " "
18671
18672 if $test X"$quadtype" != X; then
18673
18674 echo "Checking how to print 64-bit integers..." >&4
18675
18676 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18677         $cat >try.c <<'EOCP'
18678 #include <sys/types.h>
18679 #include <stdio.h>
18680 int main() {
18681   int q = 12345678901;
18682   printf("%ld\n", q);
18683 }
18684 EOCP
18685         set try
18686         if eval $compile; then
18687                 yyy=`$run ./try`
18688                 case "$yyy" in
18689                 12345678901)
18690                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18691                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18692                         echo "We will use %d."
18693                         ;;
18694                 esac
18695         fi
18696 fi
18697
18698 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18699         $cat >try.c <<'EOCP'
18700 #include <sys/types.h>
18701 #include <stdio.h>
18702 int main() {
18703   long q = 12345678901;
18704   printf("%ld\n", q);
18705 }
18706 EOCP
18707         set try
18708         if eval $compile; then
18709                 yyy=`$run ./try`
18710                 case "$yyy" in
18711                 12345678901)
18712                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18713                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18714                         echo "We will use %ld."
18715                         ;;
18716                 esac
18717         fi
18718 fi
18719
18720 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18721         $cat >try.c <<'EOCP'
18722 #include <sys/types.h>
18723 #include <inttypes.h>
18724 #include <stdio.h>
18725 int main() {
18726   int64_t q = 12345678901;
18727   printf("%" PRId64 "\n", q);
18728 }
18729 EOCP
18730         set try
18731         if eval $compile; then
18732                 yyy=`$run ./try`
18733                 case "$yyy" in
18734                 12345678901)
18735                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18736                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18737                         echo "We will use the C9X style."
18738                         ;;
18739                 esac
18740         fi
18741 fi
18742
18743 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18744         $cat >try.c <<EOCP
18745 #include <sys/types.h>
18746 #include <stdio.h>
18747 int main() {
18748   $quadtype q = 12345678901;
18749   printf("%Ld\n", q);
18750 }
18751 EOCP
18752         set try
18753         if eval $compile; then
18754                 yyy=`$run ./try`
18755                 case "$yyy" in
18756                 12345678901)
18757                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18758                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18759                         echo "We will use %Ld."
18760                         ;;
18761                 esac
18762         fi
18763 fi
18764
18765 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18766         $cat >try.c <<'EOCP'
18767 #include <sys/types.h>
18768 #include <stdio.h>
18769 int main() {
18770   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18771   printf("%lld\n", q);
18772 }
18773 EOCP
18774         set try
18775         if eval $compile; then
18776                 yyy=`$run ./try`
18777                 case "$yyy" in
18778                 12345678901)
18779                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18780                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18781                         echo "We will use the %lld style."
18782                         ;;
18783                 esac
18784         fi
18785 fi
18786
18787 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18788         $cat >try.c <<EOCP
18789 #include <sys/types.h>
18790 #include <stdio.h>
18791 int main() {
18792   $quadtype q = 12345678901;
18793   printf("%qd\n", q);
18794 }
18795 EOCP
18796         set try
18797         if eval $compile; then
18798                 yyy=`$run ./try`
18799                 case "$yyy" in
18800                 12345678901)
18801                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18802                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18803                         echo "We will use %qd."
18804                         ;;
18805                 esac
18806         fi
18807 fi
18808
18809 if $test X"$sPRId64" = X; then
18810         echo "Cannot figure out how to print 64-bit integers." >&4
18811 fi
18812
18813 $rm -f try try.*
18814
18815 fi
18816
18817 case "$sPRId64" in
18818 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18819         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18820         ;;
18821 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18822         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18823         ;;
18824 esac
18825
18826
18827 echo " "
18828 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18829
18830 if $test X"$ivsize" = X8; then
18831         ivdformat="$sPRId64"
18832         uvuformat="$sPRIu64"
18833         uvoformat="$sPRIo64"
18834         uvxformat="$sPRIx64"
18835         uvXUformat="$sPRIXU64"
18836 else
18837         if $test X"$ivsize" = X"$longsize"; then
18838                 ivdformat='"ld"'
18839                 uvuformat='"lu"'
18840                 uvoformat='"lo"'
18841                 uvxformat='"lx"'
18842                 uvXUformat='"lX"'
18843         else
18844                 if $test X"$ivsize" = X"$intsize"; then
18845                         ivdformat='"d"'
18846                         uvuformat='"u"'
18847                         uvoformat='"o"'
18848                         uvxformat='"x"'
18849                         uvXUformat='"X"'
18850                 else
18851                         : far out
18852                         if $test X"$ivsize" = X"$shortsize"; then
18853                                 ivdformat='"hd"'
18854                                 uvuformat='"hu"'
18855                                 uvoformat='"ho"'
18856                                 uvxformat='"hx"'
18857                                 uvXUformat='"hX"'
18858                         fi
18859                 fi
18860         fi
18861 fi
18862
18863 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18864         nveformat="$sPRIeldbl"
18865         nvfformat="$sPRIfldbl"
18866         nvgformat="$sPRIgldbl"
18867         nvEUformat="$sPRIEUldbl"
18868         nvFUformat="$sPRIFUldbl"
18869         nvGUformat="$sPRIGUldbl"
18870 else
18871         nveformat='"e"'
18872         nvfformat='"f"'
18873         nvgformat='"g"'
18874         nvEUformat='"E"'
18875         nvFUformat='"F"'
18876         nvGUformat='"G"'
18877 fi
18878
18879 case "$ivdformat" in
18880 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18881     exit 1
18882     ;;
18883 esac
18884
18885
18886 echo " "
18887 $echo "Checking the format string to be used for gids..." >&4
18888
18889 case "$gidsign" in
18890 -1)     if $test X"$gidsize" = X"$ivsize"; then
18891                 gidformat="$ivdformat"
18892         else
18893                 if $test X"$gidsize" = X"$longsize"; then
18894                         gidformat='"ld"'
18895                 else
18896                         if $test X"$gidsize" = X"$intsize"; then
18897                                 gidformat='"d"'
18898                         else
18899                                 if $test X"$gidsize" = X"$shortsize"; then
18900                                         gidformat='"hd"'
18901                                 fi
18902                         fi
18903                 fi
18904         fi
18905         ;;
18906 *)      if $test X"$gidsize" = X"$uvsize"; then
18907                 gidformat="$uvuformat"
18908         else
18909                 if $test X"$gidsize" = X"$longsize"; then
18910                         gidformat='"lu"'
18911                 else
18912                         if $test X"$gidsize" = X"$intsize"; then
18913                                 gidformat='"u"'
18914                         else
18915                                 if $test X"$gidsize" = X"$shortsize"; then
18916                                         gidformat='"hu"'
18917                                 fi
18918                         fi
18919                 fi
18920         fi
18921         ;;
18922 esac
18923
18924 : see if getgroups exists
18925 set getgroups d_getgrps
18926 eval $inlibc
18927
18928 : see if setgroups exists
18929 set setgroups d_setgrps
18930 eval $inlibc
18931
18932
18933 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18934 echo " "
18935 case "$d_getgrps$d_setgrps" in
18936 *define*)
18937         case "$groupstype" in
18938         '') dflt="$gidtype" ;;
18939         *)  dflt="$groupstype" ;;
18940         esac
18941         $cat <<EOM
18942 What type of pointer is the second argument to getgroups() and setgroups()?
18943 Usually this is the same as group ids, $gidtype, but not always.
18944
18945 EOM
18946         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18947         . ./myread
18948         groupstype="$ans"
18949         ;;
18950 *)  groupstype="$gidtype";;
18951 esac
18952
18953
18954 if $test $patchlevel -lt 9; then
18955 : MAD is not available in 5.8.x or earlier.
18956     ans=n;
18957 else
18958     case "$mad" in
18959     $define|true|[yY]*) dflt='y' ;;
18960     *)                  dflt='n' ;;
18961     esac
18962     cat <<EOM
18963
18964 Would you like to build with Misc Attribute Decoration? This is development
18965 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18966 overhead on the interpreter.
18967
18968 If this doesn't make any sense to you, just accept the default '$dflt'.
18969 EOM
18970     rp='Build Perl with MAD?'
18971     . ./myread
18972 fi
18973 case "$ans" in
18974 y|Y)    val="$define"
18975         madlyh='madly.h madly.act madly.tab'
18976         madlysrc='madly.c'
18977         madlyobj="madly$_o" ;;
18978 *)      val="$undef"
18979         madlyh=''
18980         madlysrc=''
18981         madlyobj='' ;;
18982 esac
18983 set mad
18984 eval $setvar
18985
18986 echo " "
18987 echo "Checking if your $make program sets \$(MAKE)..." >&4
18988 case "$make_set_make" in
18989 '')
18990         $sed 's/^X //' > testmake.mak << 'EOF'
18991 Xall:
18992 X       @echo 'maketemp="$(MAKE)"'
18993 EOF
18994         case "`$make -f testmake.mak 2>/dev/null`" in
18995         *maketemp=*) make_set_make='#' ;;
18996         *)      make_set_make="MAKE=$make" ;;
18997         esac
18998         $rm -f testmake.mak
18999         ;;
19000 esac
19001 case "$make_set_make" in
19002 '#') echo "Yup, it does.";;
19003 *) echo "Nope, it doesn't.";;
19004 esac
19005
19006 : see what type is used for mode_t
19007 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19008 set mode_t modetype int stdio.h sys/types.h
19009 eval $typedef_ask
19010
19011 : see if stdarg is available
19012 echo " "
19013 if $test `./findhdr stdarg.h`; then
19014         echo "<stdarg.h> found." >&4
19015         valstd="$define"
19016 else
19017         echo "<stdarg.h> NOT found." >&4
19018         valstd="$undef"
19019 fi
19020
19021 : see if varags is available
19022 echo " "
19023 if $test `./findhdr varargs.h`; then
19024         echo "<varargs.h> found." >&4
19025 else
19026         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19027 fi
19028
19029 : set up the varargs testing programs
19030 $cat > varargs.c <<EOP
19031 #ifdef I_STDARG
19032 #include <stdarg.h>
19033 #endif
19034 #ifdef I_VARARGS
19035 #include <varargs.h>
19036 #endif
19037
19038 #ifdef I_STDARG
19039 int f(char *p, ...)
19040 #else
19041 int f(va_alist)
19042 va_dcl
19043 #endif
19044 {
19045         va_list ap;
19046 #ifndef I_STDARG
19047         char *p;
19048 #endif
19049 #ifdef I_STDARG
19050         va_start(ap,p);
19051 #else
19052         va_start(ap);
19053         p = va_arg(ap, char *);
19054 #endif
19055         va_end(ap);
19056 }
19057 EOP
19058 $cat > varargs <<EOP
19059 $startsh
19060 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19061         echo "true"
19062 else
19063         echo "false"
19064 fi
19065 $rm -f varargs$_o
19066 EOP
19067 chmod +x varargs
19068
19069 : now check which varargs header should be included
19070 echo " "
19071 i_varhdr=''
19072 case "$valstd" in
19073 "$define")
19074         if `./varargs I_STDARG`; then
19075                 val='stdarg.h'
19076         elif `./varargs I_VARARGS`; then
19077                 val='varargs.h'
19078         fi
19079         ;;
19080 *)
19081         if `./varargs I_VARARGS`; then
19082                 val='varargs.h'
19083         fi
19084         ;;
19085 esac
19086 case "$val" in
19087 '')
19088 echo "I could not find the definition for va_dcl... You have problems..." >&4
19089         val="$undef"; set i_stdarg; eval $setvar
19090         val="$undef"; set i_varargs; eval $setvar
19091         ;;
19092 *) 
19093         set i_varhdr
19094         eval $setvar
19095         case "$i_varhdr" in
19096         stdarg.h)
19097                 val="$define"; set i_stdarg; eval $setvar
19098                 val="$undef"; set i_varargs; eval $setvar
19099                 ;;
19100         varargs.h)
19101                 val="$undef"; set i_stdarg; eval $setvar
19102                 val="$define"; set i_varargs; eval $setvar
19103                 ;;
19104         esac
19105         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19106 esac
19107 $rm -f varargs*
19108
19109 : see if we need va_copy
19110 echo " "
19111 case "$i_stdarg" in
19112 "$define")
19113         $cat >try.c <<EOCP
19114 #include <stdarg.h>
19115 #include <stdio.h>
19116 #$i_stdlib I_STDLIB
19117 #ifdef I_STDLIB
19118 #include <stdlib.h>
19119 #endif
19120 #include <signal.h>
19121
19122 int
19123 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19124 {
19125   return vfprintf(f, fmt, *valp);
19126 }
19127  
19128 int    
19129 myvfprintf(FILE *f, const  char *fmt, va_list val)
19130 {
19131   return ivfprintf(f, fmt, &val);
19132 }
19133       
19134 int
19135 myprintf(char *fmt, ...) 
19136 {
19137   va_list val;
19138   va_start(val, fmt);
19139   return myvfprintf(stdout, fmt, val); 
19140 }         
19141
19142 int
19143 main(int ac, char **av)
19144 {
19145   signal(SIGSEGV, exit);
19146
19147   myprintf("%s%cs all right, then\n", "that", '\'');                            
19148   exit(0);      
19149 }
19150 EOCP
19151         set try
19152         if eval $compile && $run ./try 2>&1 >/dev/null; then
19153                 case "`$run ./try`" in
19154                 "that's all right, then")
19155                         okay=yes
19156                         ;;
19157                 esac
19158         fi
19159         case "$okay" in
19160         yes)    echo "It seems that you don't need va_copy()." >&4
19161                 need_va_copy="$undef"
19162                 ;;
19163         *)      echo "It seems that va_copy() or similar will be needed." >&4
19164                 need_va_copy="$define"
19165                 ;;
19166         esac
19167         $rm -f try.* core core.* *.core *.core.*
19168         ;;
19169 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19170         ;;
19171 esac
19172
19173 : see if the Compiler supports C99 variadic macros 
19174 case "$i_stdarg$i_stdlib" in
19175     "$define$define")
19176     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
19177     $cat >try.c <<EOCP
19178 #include <stdio.h>
19179 #include <stdarg.h>
19180
19181 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
19182
19183 int main() {
19184   char buf[20];
19185   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
19186   puts(buf);
19187   return 0;
19188 }
19189 EOCP
19190     set try
19191     if eval $compile && $run ./try 2>&1 >/dev/null; then
19192         case "`$run ./try`" in
19193             "123 456 789")
19194             echo "You have C99 variadic macros." >&4
19195             d_c99_variadic_macros="$define"
19196             ;;
19197             *)
19198             echo "You don't have functional C99 variadic macros." >&4
19199             d_c99_variadic_macros="$undef"
19200             ;;
19201         esac
19202     else
19203         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
19204         d_c99_variadic_macros="$undef"
19205     fi
19206     ;;
19207     *)
19208     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
19209     d_c99_variadic_macros="$undef"
19210     ;;
19211 esac
19212
19213 : see what type is used for size_t
19214 rp="What is the type used for the length parameter for string functions?"
19215 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19216 eval $typedef_ask
19217
19218 : check for type of arguments to gethostbyaddr. 
19219 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19220         case "$d_gethbyaddr" in
19221         $define)
19222                 $cat <<EOM
19223
19224 Checking to see what type of arguments are accepted by gethostbyaddr().
19225 EOM
19226                 hdrs="$define sys/types.h
19227                         $d_socket sys/socket.h 
19228                         $i_niin netinet/in.h 
19229                         $i_netdb netdb.h
19230                         $i_unistd unistd.h"
19231                 : The first arg can 'char *' or 'void *'
19232                 : The second arg is some of integral type
19233                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19234                         for yyy in size_t long int; do
19235                                 case "$netdb_host_type" in
19236                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19237                                         if ./protochk "$try" $hdrs; then
19238                                                 echo "Your system accepts $xxx for the first arg."
19239                                                 echo "...and $yyy for the second arg."
19240                                                 netdb_host_type="$xxx"
19241                                                 netdb_hlen_type="$yyy"
19242                                         fi
19243                                         ;;
19244                                 esac
19245                         done
19246                 done
19247                 : In case none of those worked, prompt the user.
19248                 case "$netdb_host_type" in
19249                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19250                         dflt='char *'
19251                         . ./myread
19252                         netdb_host_type=$ans
19253                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19254                         dflt="$sizetype"
19255                         . ./myread
19256                         netdb_hlen_type=$ans
19257                         ;;
19258                 esac
19259                 ;;
19260         *)      : no gethostbyaddr, so pick harmless defaults
19261                 netdb_host_type='char *'
19262                 netdb_hlen_type="$sizetype"
19263                 ;;
19264         esac
19265         # Remove the "const" if needed. -- but then we'll have a 
19266         # prototype clash!
19267         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19268 fi
19269
19270 : check for type of argument to gethostbyname. 
19271 if test "X$netdb_name_type" = X ; then
19272         case "$d_gethbyname" in
19273         $define)
19274                 $cat <<EOM
19275
19276 Checking to see what type of argument is accepted by gethostbyname().
19277 EOM
19278                 hdrs="$define sys/types.h
19279                         $d_socket sys/socket.h 
19280                         $i_niin netinet/in.h 
19281                         $i_netdb netdb.h
19282                         $i_unistd unistd.h"
19283                 for xxx in "const char *" "char *"; do
19284                         case "$netdb_name_type" in
19285                         '')     try="extern struct hostent *gethostbyname($xxx);"
19286                                 if ./protochk "$try" $hdrs; then
19287                                         echo "Your system accepts $xxx."
19288                                         netdb_name_type="$xxx"
19289                                 fi
19290                                 ;;
19291                         esac
19292                 done
19293                 : In case none of those worked, prompt the user.
19294                 case "$netdb_name_type" in
19295                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19296                         dflt='char *'
19297                         . ./myread
19298                         netdb_name_type=$ans
19299                         ;;
19300                 esac
19301                 ;;
19302         *)      : no gethostbyname, so pick harmless default
19303                 netdb_name_type='char *'
19304                 ;;
19305         esac
19306 fi
19307
19308 : check for type of 1st argument to getnetbyaddr. 
19309 if test "X$netdb_net_type" = X ; then
19310         case "$d_getnbyaddr" in
19311         $define)
19312                 $cat <<EOM
19313
19314 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19315 EOM
19316                 hdrs="$define sys/types.h
19317                         $d_socket sys/socket.h 
19318                         $i_niin netinet/in.h 
19319                         $i_netdb netdb.h
19320                         $i_unistd unistd.h"
19321                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19322                         case "$netdb_net_type" in
19323                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19324                                 if ./protochk "$try" $hdrs; then
19325                                         echo "Your system accepts $xxx."
19326                                         netdb_net_type="$xxx"
19327                                 fi
19328                                 ;;
19329                         esac
19330                 done
19331                 : In case none of those worked, prompt the user.
19332                 case "$netdb_net_type" in
19333                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19334                         dflt='long'
19335                         . ./myread
19336                         netdb_net_type=$ans
19337                         ;;
19338                 esac
19339                 ;;
19340         *)      : no getnetbyaddr, so pick harmless default
19341                 netdb_net_type='long'
19342                 ;;
19343         esac
19344 fi
19345 : locate the preferred pager for this system
19346 fn=f/
19347 case "$pager" in
19348 '')
19349         dflt=''
19350         case "$pg" in
19351         /*) dflt=$pg;;
19352         [a-zA-Z]:/*) dflt=$pg;;
19353         esac
19354         case "$more" in
19355         /*) dflt=$more;;
19356         [a-zA-Z]:/*) dflt=$more;;
19357         esac
19358         case "$less" in
19359         /*) dflt=$less;;
19360         [a-zA-Z]:/*) dflt=$less;;
19361         esac
19362         case "$dflt" in
19363         '') dflt=/usr/ucb/more;;
19364         esac
19365         ;;
19366 *)      dflt="$pager"
19367         : Instruct ./getfile to trust the hinted or previous pager value,
19368         : even if it does not begin with a slash.  For example, on os2,
19369         : pager might be cmd /c more.  See comments in UU/getfile.
19370         fn="f/($pager)"
19371         ;;
19372 esac
19373 echo " "
19374 rp='What pager is used on your system?'
19375 . ./getfile
19376 pager="$ans"
19377
19378 : see what type pids are declared as in the kernel
19379 rp="What is the type of process ids on this system?"
19380 set pid_t pidtype int stdio.h sys/types.h
19381 eval $typedef_ask
19382
19383 : see if ar generates random libraries by itself
19384 echo " "
19385 echo "Checking how to generate random libraries on your machine..." >&4
19386 echo 'int bar1() { return bar2(); }' > bar1.c
19387 echo 'int bar2() { return 2; }' > bar2.c
19388 $cat > foo.c <<EOP
19389 #$i_stdlib I_STDLIB
19390 #ifdef I_STDLIB
19391 #include <stdlib.h>
19392 #endif
19393 int main() { printf("%d\n", bar1()); exit(0); }
19394 EOP
19395 $cc $ccflags -c bar1.c >/dev/null 2>&1
19396 $cc $ccflags -c bar2.c >/dev/null 2>&1
19397 $cc $ccflags -c foo.c >/dev/null 2>&1
19398 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19399 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19400         $run ./foobar >/dev/null 2>&1; then
19401         echo "$ar appears to generate random libraries itself."
19402         orderlib=false
19403         if [ "X$ranlib" = "X" ]; then
19404             ranlib=":"
19405         fi
19406 elif $ar s bar$_a >/dev/null 2>&1 &&
19407         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19408         $run ./foobar >/dev/null 2>&1; then
19409                 echo "a table of contents needs to be added with '$ar s'."
19410                 orderlib=false
19411                 ranlib="$ar s"
19412 elif $ar ts bar$_a >/dev/null 2>&1 &&
19413         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19414         $run ./foobar >/dev/null 2>&1; then
19415                 echo "a table of contents needs to be added with '$ar ts'."
19416                 orderlib=false
19417                 ranlib="$ar ts"
19418 else
19419         case "$ranlib" in
19420         :) ranlib='';;
19421         '')
19422                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19423                 $test -f $ranlib || ranlib=''
19424                 ;;
19425         esac
19426         if $test -n "$ranlib"; then
19427                 echo "your system has '$ranlib'; we'll use that."
19428                 orderlib=false
19429         else
19430                 echo "your system doesn't seem to support random libraries"
19431                 echo "so we'll use lorder and tsort to order the libraries."
19432                 orderlib=true
19433                 ranlib=":"
19434         fi
19435 fi
19436 $rm -f foo* bar*
19437
19438 : check for type of arguments to select. 
19439 case "$selecttype" in
19440 '') case "$d_select" in
19441         $define)
19442                 echo " "
19443                 $cat <<EOM
19444 Checking to see what type of arguments are accepted by select().
19445 EOM
19446                 hdrs="$define sys/types.h
19447                         $i_systime sys/time.h 
19448                         $i_sysselct sys/select.h
19449                         $d_socket sys/socket.h"
19450                 : The first arg can be int, unsigned, or size_t
19451                 : The last arg may or may not be 'const'
19452                 val=''
19453                 : void pointer has been seen but using that
19454                 : breaks the selectminbits test
19455                 for xxx in 'fd_set *' 'int *'; do
19456                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19457                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19458                                         case "$val" in
19459                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19460                                                 if ./protochk "$try" $hdrs; then
19461                                                         echo "Your system accepts $xxx."
19462                                                         val="$xxx"
19463                                                 fi
19464                                                 ;;
19465                                         esac
19466                                 done
19467                         done
19468                 done
19469                 case "$val" in
19470                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19471                         case "$d_fd_set" in
19472                                 $define) dflt="fd_set *" ;;
19473                                 *)              dflt="int *" ;;
19474                         esac
19475                         . ./myread
19476                         val=$ans
19477                         ;;
19478                 esac
19479                 selecttype="$val"
19480                 ;;
19481         *)      : no select, so pick a harmless default
19482                 selecttype='int *'
19483                 ;;
19484         esac
19485         ;;
19486 esac
19487
19488 : check for the select 'width'
19489 case "$selectminbits" in
19490 '') safebits=`expr $ptrsize \* 8`
19491     case "$d_select" in
19492         $define)
19493                 $cat <<EOM
19494
19495 Checking to see on how many bits at a time your select() operates...
19496 EOM
19497                 $cat >try.c <<EOCP
19498 #include <sys/types.h>
19499 #$i_time I_TIME
19500 #$i_systime I_SYS_TIME
19501 #$i_systimek I_SYS_TIME_KERNEL
19502 #ifdef I_TIME
19503 #   include <time.h>
19504 #endif
19505 #ifdef I_SYS_TIME
19506 #   ifdef I_SYS_TIME_KERNEL
19507 #       define KERNEL
19508 #   endif
19509 #   include <sys/time.h>
19510 #   ifdef I_SYS_TIME_KERNEL
19511 #       undef KERNEL
19512 #   endif
19513 #endif
19514 #$i_sysselct I_SYS_SELECT
19515 #ifdef I_SYS_SELECT
19516 #include <sys/select.h>
19517 #endif
19518 #$d_socket HAS_SOCKET
19519 #ifdef HAS_SOCKET
19520 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19521 #endif
19522 #include <stdio.h>
19523 #$i_stdlib I_STDLIB
19524 #ifdef I_STDLIB
19525 #include <stdlib.h>
19526 #endif
19527 $selecttype b;
19528 #define S sizeof(*(b))
19529 #define MINBITS 64
19530 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19531 #define NBITS  (NBYTES * 8)
19532 int main() {
19533     char *s = malloc(NBYTES);
19534     struct timeval t;
19535     int i;
19536     FILE* fp;
19537     int fd;
19538
19539     if (!s)
19540         exit(1);
19541     fclose(stdin);
19542     fp = fopen("try.c", "r");
19543     if (fp == 0)
19544       exit(2);
19545     fd = fileno(fp);
19546     if (fd < 0)
19547       exit(3);
19548     b = ($selecttype)s;
19549     for (i = 0; i < NBITS; i++)
19550         FD_SET(i, b);
19551     t.tv_sec  = 0;
19552     t.tv_usec = 0;
19553     select(fd + 1, b, 0, 0, &t);
19554     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19555     free(s);
19556     printf("%d\n", i + 1);
19557     return 0;
19558 }
19559 EOCP
19560                 set try
19561                 if eval $compile_ok; then
19562                         selectminbits=`$run ./try`
19563                         case "$selectminbits" in
19564                         '')     cat >&4 <<EOM
19565 Cannot figure out on how many bits at a time your select() operates.
19566 I'll play safe and guess it is $safebits bits.
19567 EOM
19568                                 selectminbits=$safebits
19569                                 bits="$safebits bits"
19570                                 ;;
19571                         1)      bits="1 bit" ;;
19572                         *)      bits="$selectminbits bits" ;;
19573                         esac
19574                         echo "Your select() operates on $bits at a time." >&4
19575                 else
19576                         rp='What is the minimum number of bits your select() operates on?'
19577                         case "$byteorder" in
19578                         12345678)       dflt=64 ;;
19579                         1234)           dflt=32 ;;
19580                         *)              dflt=1  ;;
19581                         esac
19582                         . ./myread
19583                         val=$ans
19584                         selectminbits="$val"
19585                 fi
19586                 $rm -f try.* try
19587                 ;;
19588         *)      : no select, so pick a harmless default
19589                 selectminbits=$safebits
19590                 ;;
19591         esac
19592         ;;
19593 esac
19594
19595 : Trace out the files included by signal.h, then look for SIGxxx names.
19596 : Remove SIGARRAYSIZE used by HPUX.
19597 : Remove SIGSTKSIZE used by Linux.
19598 : Remove SIGSTKSZ used by Posix.
19599 : Remove SIGTYP void lines used by OS2.
19600 : Some cpps, like os390, dont give the file name anywhere
19601 if [ "X$fieldn" = X ]; then
19602         : Just make some guesses.  We check them later.
19603         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19604 else
19605         xxx=`echo '#include <signal.h>' |
19606         $cppstdin $cppminus $cppflags 2>/dev/null |
19607         $grep '^[       ]*#.*include' | 
19608         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19609 fi
19610 : Check this list of files to be sure we have parsed the cpp output ok.
19611 : This will also avoid potentially non-existent files, such 
19612 : as ../foo/bar.h
19613 xxxfiles=''
19614 for xx in $xxx /dev/null ; do
19615         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19616 done
19617 : If we have found no files, at least try signal.h
19618 case "$xxxfiles" in
19619 '')     xxxfiles=`./findhdr signal.h` ;;
19620 esac
19621 xxx=`awk '
19622 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19623         print substr($2, 4, 20)
19624 }
19625 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19626         print substr($3, 4, 20)
19627 }' $xxxfiles`
19628 : Append some common names just in case the awk scan failed.
19629 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19630 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19631 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19632 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19633 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19634
19635 : generate a few handy files for later
19636 $cat > signal.c <<EOCP
19637 #include <sys/types.h>
19638 #include <signal.h>
19639 #$i_stdlib I_STDLIB
19640 #ifdef I_STDLIB
19641 #include <stdlib.h>
19642 #endif
19643 #include <stdio.h>
19644 int main() {
19645
19646 /* Strange style to avoid deeply-nested #if/#else/#endif */
19647 #ifndef NSIG
19648 #  ifdef _NSIG
19649 #    define NSIG (_NSIG)
19650 #  endif
19651 #endif
19652
19653 #ifndef NSIG
19654 #  ifdef SIGMAX
19655 #    define NSIG (SIGMAX+1)
19656 #  endif
19657 #endif
19658
19659 #ifndef NSIG
19660 #  ifdef SIG_MAX
19661 #    define NSIG (SIG_MAX+1)
19662 #  endif
19663 #endif
19664
19665 #ifndef NSIG
19666 #  ifdef _SIG_MAX
19667 #    define NSIG (_SIG_MAX+1)
19668 #  endif
19669 #endif
19670
19671 #ifndef NSIG
19672 #  ifdef MAXSIG
19673 #    define NSIG (MAXSIG+1)
19674 #  endif
19675 #endif
19676
19677 #ifndef NSIG
19678 #  ifdef MAX_SIG
19679 #    define NSIG (MAX_SIG+1)
19680 #  endif
19681 #endif
19682
19683 #ifndef NSIG
19684 #  ifdef SIGARRAYSIZE
19685 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19686 #  endif
19687 #endif
19688
19689 #ifndef NSIG
19690 #  ifdef _sys_nsig
19691 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19692 #  endif
19693 #endif
19694
19695 /* Default to some arbitrary number that's big enough to get most
19696    of the common signals.
19697 */
19698 #ifndef NSIG
19699 #    define NSIG 50
19700 #endif
19701
19702 printf("NSIG %d\n", NSIG);
19703
19704 #ifndef JUST_NSIG
19705
19706 EOCP
19707
19708 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19709 {
19710         printf "#ifdef SIG"; printf $1; printf "\n"
19711         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19712         printf $1; printf ");\n"
19713         printf "#endif\n"
19714 }
19715 END {
19716         printf "#endif /* JUST_NSIG */\n";
19717         printf "exit(0);\n}\n";
19718 }
19719 ' >>signal.c
19720 $cat >signal.awk <<'EOP'
19721 BEGIN { ndups = 0 }
19722 $1 ~ /^NSIG$/ { nsig = $2 }
19723 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19724     if ($2 > maxsig) { maxsig = $2 }
19725     if (sig_name[$2]) {
19726         dup_name[ndups] = $1
19727         dup_num[ndups] = $2
19728         ndups++ 
19729     }
19730     else {
19731         sig_name[$2] = $1
19732         sig_num[$2] = $2
19733     }
19734 }
19735 END { 
19736     if (nsig == 0) {
19737         nsig = maxsig + 1
19738     }
19739     printf("NSIG %d\n", nsig);
19740     for (n = 1; n < nsig; n++) {
19741         if (sig_name[n]) {
19742             printf("%s %d\n", sig_name[n], sig_num[n])
19743         }
19744         else {
19745             printf("NUM%d %d\n", n, n) 
19746         }
19747     }
19748     for (n = 0; n < ndups; n++) {
19749         printf("%s %d\n", dup_name[n], dup_num[n])
19750     }
19751 }
19752 EOP
19753 $cat >signal_cmd <<EOS
19754 $startsh
19755 if $test -s signal.lst; then
19756     echo "Using your existing signal.lst file"
19757         exit 0
19758 fi
19759 xxx="$xxx"
19760 EOS
19761 $cat >>signal_cmd <<'EOS'
19762
19763 set signal
19764 if eval $compile_ok; then
19765         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19766 else
19767         echo "(I can't seem be able to compile the whole test program)" >&4
19768         echo "(I'll try it in little pieces.)" >&4
19769         set signal -DJUST_NSIG
19770         if eval $compile_ok; then
19771                 $run ./signal$_exe > signal.nsg
19772                 $cat signal.nsg
19773         else
19774                 echo "I can't seem to figure out how many signals you have." >&4
19775                 echo "Guessing 50." >&4
19776                 echo 'NSIG 50' > signal.nsg
19777         fi
19778         : Now look at all the signal names, one at a time.
19779         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19780                 $cat > signal.c <<EOCP
19781 #include <sys/types.h>
19782 #include <signal.h>
19783 #include <stdio.h>
19784 int main() {
19785 printf("$xx %d\n", SIG${xx});
19786 return 0;
19787 }
19788 EOCP
19789                 set signal
19790                 if eval $compile; then
19791                         echo "SIG${xx} found."
19792                         $run ./signal$_exe  >> signal.ls1
19793                 else
19794                         echo "SIG${xx} NOT found."
19795                 fi
19796         done
19797         if $test -s signal.ls1; then
19798                 $cat signal.nsg signal.ls1 |
19799                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19800         fi
19801
19802 fi
19803 if $test -s signal.lst; then
19804         :
19805 else
19806         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19807         echo 'kill -l' >signal
19808         set X `csh -f <signal`
19809         $rm -f signal
19810         shift
19811         case $# in
19812         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19813         esac
19814         echo $@ | $tr ' ' $trnl | \
19815             $awk '{ printf "%s %d\n", $1, ++s; }
19816                   END { printf "NSIG %d\n", ++s }' >signal.lst
19817 fi
19818 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19819 EOS
19820 chmod a+x signal_cmd
19821 $eunicefix signal_cmd
19822
19823 : generate list of signal names
19824 echo " "
19825 case "$sig_name_init" in
19826 '') doinit=yes ;;
19827 *)  case "$sig_num_init" in
19828     ''|*,*) doinit=yes ;;
19829     esac ;;
19830 esac
19831 case "$doinit" in
19832 yes)
19833         echo "Generating a list of signal names and numbers..." >&4
19834         . ./signal_cmd
19835         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19836         sig_name=`$awk 'BEGIN { printf "ZERO " }
19837                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19838         sig_num=`$awk  'BEGIN { printf "0 " }
19839                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19840         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19841                              !/^NSIG/   { printf "\"%s\", ", $1 }
19842                              END        { printf "0\n" }' signal.lst`
19843         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19844                              !/^NSIG/   { printf "%d, ", $2}
19845                              END        { printf "0\n"}' signal.lst`
19846         ;;
19847 esac
19848 echo "The following $sig_count signals are available:"
19849 echo " "
19850 echo $sig_name | $awk \
19851 'BEGIN { linelen = 0 }
19852 {
19853         for (i = 1; i <= NF; i++) {
19854                 name = "SIG" $i " "
19855                 linelen = linelen + length(name)
19856                 if (linelen > 70) {
19857                         printf "\n"
19858                         linelen = length(name)
19859                 }
19860                 printf "%s", name
19861         }
19862         printf "\n"
19863 }'
19864 sig_size=`echo $sig_name | awk '{print NF}'`
19865 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19866
19867 echo " "
19868 case "$sizetype" in
19869 *_t) zzz="$sizetype"    ;;
19870 *)   zzz="filesize"     ;;
19871 esac
19872 echo "Checking the size of $zzz..." >&4 
19873 cat > try.c <<EOCP
19874 #include <sys/types.h>
19875 #include <stdio.h>
19876 #$i_stdlib I_STDLIB
19877 #ifdef I_STDLIB
19878 #include <stdlib.h>
19879 #endif
19880 int main() {
19881     printf("%d\n", (int)sizeof($sizetype));
19882     exit(0);
19883 }
19884 EOCP
19885 set try
19886 if eval $compile_ok; then
19887         yyy=`$run ./try`
19888         case "$yyy" in
19889         '')     sizesize=4
19890                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19891                 ;;
19892         *)      sizesize=$yyy
19893                 echo "Your $zzz size is $sizesize bytes."
19894                 ;;
19895         esac
19896 else
19897         sizesize=4
19898         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19899 fi
19900
19901
19902 : check for socklen_t
19903 echo " "
19904 echo "Checking to see if you have socklen_t..." >&4
19905 $cat >try.c <<EOCP
19906 #include <sys/types.h>
19907 #$d_socket HAS_SOCKET
19908 #ifdef HAS_SOCKET
19909 #include <sys/socket.h>
19910 #endif
19911 int main() { socklen_t x = 16; }
19912 EOCP
19913 set try
19914 if eval $compile; then
19915         val="$define"
19916         echo "You have socklen_t."
19917 else
19918         val="$undef"
19919         echo "You do not have socklen_t."
19920         case "$sizetype" in
19921         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19922         esac
19923 fi
19924 $rm -f try try.*
19925 set d_socklen_t
19926 eval $setvar
19927
19928 : see if this is a socks.h system
19929 set socks.h i_socks
19930 eval $inhdr
19931
19932 : check for type of the size argument to socket calls
19933 case "$d_socket" in
19934 "$define")
19935         $cat <<EOM
19936
19937 Checking to see what type is the last argument of accept().
19938 EOM
19939         yyy=''
19940         case "$d_socklen_t" in
19941         "$define") yyy="$yyy socklen_t"
19942         esac
19943         yyy="$yyy $sizetype int long unsigned"
19944         for xxx in $yyy; do
19945                 case "$socksizetype" in
19946                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19947                         case "$usesocks" in
19948                         "$define")
19949                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19950                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19951                                         socksizetype="$xxx"
19952                                 fi
19953                                 ;;
19954                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19955                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19956                                         socksizetype="$xxx"
19957                                 fi
19958                                 ;;
19959                         esac
19960                         ;;
19961                 esac
19962         done
19963 : In case none of those worked, prompt the user.
19964         case "$socksizetype" in
19965         '')     rp='What is the type for socket address structure sizes?'
19966                 dflt='int'
19967                 . ./myread
19968                 socksizetype=$ans
19969                 ;;
19970         esac
19971         ;;
19972 *)      : no sockets, so pick relatively harmless default
19973         socksizetype='int'
19974         ;;
19975 esac
19976
19977 : see what type is used for signed size_t
19978 set ssize_t ssizetype int stdio.h sys/types.h
19979 eval $typedef
19980 dflt="$ssizetype"
19981 $cat > try.c <<EOM
19982 #include <stdio.h>
19983 #$i_stdlib I_STDLIB
19984 #ifdef I_STDLIB
19985 #include <stdlib.h>
19986 #endif
19987 #include <sys/types.h>
19988 #define Size_t $sizetype
19989 #define SSize_t $dflt
19990 int main()
19991 {
19992         if (sizeof(Size_t) == sizeof(SSize_t))
19993                 printf("$dflt\n");
19994         else if (sizeof(Size_t) == sizeof(int))
19995                 printf("int\n");
19996         else 
19997                 printf("long\n");
19998         exit(0);
19999 }
20000 EOM
20001 echo " "
20002 set try
20003 if eval $compile_ok && $run ./try > /dev/null; then
20004         ssizetype=`$run ./try`
20005         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20006 else
20007         $cat >&4 <<EOM
20008 Help! I can't compile and run the ssize_t test program: please enlighten me!
20009 (This is probably a misconfiguration in your system or libraries, and
20010 you really ought to fix it.  Still, I'll try anyway.)
20011
20012 I need a type that is the same size as $sizetype, but is guaranteed to
20013 be signed.  Common values are ssize_t, int and long.
20014
20015 EOM
20016         rp="What signed type is the same size as $sizetype?"
20017         . ./myread
20018         ssizetype="$ans"
20019 fi
20020 $rm -f try try.*
20021
20022 : see what type of char stdio uses.
20023 echo " "
20024 echo '#include <stdio.h>' > stdio.c
20025 $cppstdin $cppminus < stdio.c > stdioh
20026 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20027         echo "Your stdio uses unsigned chars." >&4
20028         stdchar="unsigned char"
20029 else
20030         echo "Your stdio uses signed chars." >&4
20031         stdchar="char"
20032 fi
20033 $rm -f stdio.* stdioh
20034
20035 : see what type uids are declared as in the kernel
20036 echo " "
20037 echo "Looking for the type for user ids returned by getuid()."
20038 set uid_t uidtype xxx stdio.h sys/types.h
20039 eval $typedef
20040 case "$uidtype" in
20041 xxx)
20042         xxx=`./findhdr sys/user.h`
20043         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20044         case $1 in
20045         unsigned) dflt="$1 $2" ;;
20046         *) dflt="$1" ;;
20047         esac
20048         ;;
20049 *) dflt="$uidtype";;
20050 esac
20051 case "$uidtype" in
20052 uid_t)  echo "uid_t found." ;;
20053 *)      rp="What is the type for user ids returned by getuid()?"
20054         . ./myread
20055         uidtype="$ans"
20056         ;;
20057 esac
20058
20059 echo " "
20060 case "$uidtype" in
20061 *_t) zzz="$uidtype"     ;;
20062 *)   zzz="uid"          ;;
20063 esac
20064 echo "Checking the size of $zzz..." >&4 
20065 cat > try.c <<EOCP
20066 #include <sys/types.h>
20067 #include <stdio.h>
20068 #$i_stdlib I_STDLIB
20069 #ifdef I_STDLIB
20070 #include <stdlib.h>
20071 #endif
20072 int main() {
20073     printf("%d\n", (int)sizeof($uidtype));
20074     exit(0);
20075 }
20076 EOCP
20077 set try
20078 if eval $compile_ok; then
20079         yyy=`$run ./try`
20080         case "$yyy" in
20081         '')     uidsize=4
20082                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20083                 ;;
20084         *)      uidsize=$yyy
20085                 echo "Your $zzz is $uidsize bytes long."
20086                 ;;
20087         esac
20088 else
20089         uidsize=4
20090         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20091 fi
20092
20093 echo " "
20094 case "$uidtype" in
20095 *_t) zzz="$uidtype"     ;;
20096 *)   zzz="uid"          ;;
20097 esac
20098 echo "Checking the sign of $zzz..." >&4
20099 cat > try.c <<EOCP
20100 #include <sys/types.h>
20101 #include <stdio.h>
20102 int main() {
20103         $uidtype foo = -1;
20104         if (foo < 0)
20105                 printf("-1\n");
20106         else
20107                 printf("1\n");
20108 }
20109 EOCP
20110 set try
20111 if eval $compile; then
20112         yyy=`$run ./try`
20113         case "$yyy" in
20114         '')     uidsign=1
20115                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20116                 ;;
20117         *)      uidsign=$yyy
20118                 case "$uidsign" in
20119                  1) echo "Your $zzz is unsigned." ;;
20120                 -1) echo "Your $zzz is signed."   ;;
20121                 esac
20122                 ;;
20123         esac
20124 else
20125         uidsign=1
20126         echo "(I can't compile the test program--guessing unsigned.)" >&4
20127 fi
20128
20129
20130
20131 echo " "
20132 $echo "Checking the format string to be used for uids..." >&4
20133
20134 case "$uidsign" in
20135 -1)     if $test X"$uidsize" = X"$ivsize"; then
20136                 uidformat="$ivdformat"
20137         else
20138                 if $test X"$uidsize" = X"$longsize"; then
20139                         uidformat='"ld"'
20140                 else
20141                         if $test X"$uidsize" = X"$intsize"; then
20142                                 uidformat='"d"'
20143                         else
20144                                 if $test X"$uidsize" = X"$shortsize"; then
20145                                         uidformat='"hd"'
20146                                 fi
20147                         fi
20148                 fi
20149         fi
20150         ;;
20151 *)      if $test X"$uidsize" = X"$uvsize"; then
20152                 uidformat="$uvuformat"
20153         else
20154                 if $test X"$uidsize" = X"$longsize"; then
20155                         uidformat='"lu"'
20156                 else
20157                         if $test X"$uidsize" = X"$intsize"; then
20158                                 uidformat='"u"'
20159                         else
20160                                 if $test X"$uidsize" = X"$shortsize"; then
20161                                         uidformat='"hu"'
20162                                 fi
20163                         fi
20164                 fi
20165         fi
20166         ;;
20167 esac
20168
20169
20170 case "$usesitecustomize" in
20171     $define|true|[Yy]*)
20172         usesitecustomize="$define"
20173         ;;
20174     *)
20175         usesitecustomize="$undef"
20176         ;;
20177     esac
20178
20179 : determine compiler compiler
20180 case "$yacc" in
20181 '')
20182         dflt=yacc;;
20183 *)
20184         dflt="$yacc";;
20185 esac
20186 echo " "
20187 comp='yacc'
20188 if $test -f "$byacc$_exe"; then
20189         dflt="$byacc"
20190         comp="byacc or $comp"
20191 fi
20192 if $test -f "$bison$_exe"; then
20193         comp="$comp or bison -y"
20194 fi
20195 rp="Which compiler compiler ($comp) shall I use?"
20196 . ./myread
20197 yacc="$ans"
20198 case "$yacc" in
20199 *bis*)
20200         case "$yacc" in
20201         *-y*) ;;
20202         *)
20203                 yacc="$yacc -y"
20204                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20205                 ;;
20206         esac
20207         ;;
20208 esac
20209
20210 : see if this is a fp.h system
20211 set fp.h i_fp
20212 eval $inhdr
20213
20214 : see if this is a fp_class.h system
20215 set fp_class.h i_fp_class
20216 eval $inhdr
20217
20218 : see if this is a ieeefp.h system
20219 case "$i_ieeefp" in
20220 '' ) set ieeefp.h i_ieeefp
20221      eval $inhdr
20222      ;;
20223 esac
20224
20225 : see if this is a libutil.h system
20226 set libutil.h i_libutil
20227 eval $inhdr
20228
20229 : see if mach cthreads are available
20230 if test "X$usethreads" = "X$define"; then
20231         set mach/cthreads.h i_machcthr
20232         eval $inhdr
20233 else
20234         i_machcthr="$undef"
20235 fi
20236
20237
20238
20239 : see if this is a mntent.h system
20240 set mntent.h i_mntent
20241 eval $inhdr
20242
20243 : see if ndbm.h is available
20244 set ndbm.h t_ndbm
20245 eval $inhdr
20246
20247 case "$t_ndbm" in
20248 $undef)
20249     # Some Linux distributions such as RedHat 7.1 put the
20250     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20251     if $test -f /usr/include/gdbm/ndbm.h; then
20252         echo '<gdbm/ndbm.h> found.'
20253         ccflags="$ccflags -I/usr/include/gdbm"
20254         cppflags="$cppflags -I/usr/include/gdbm"
20255         t_ndbm=$define
20256     fi
20257     ;;
20258 esac
20259
20260 case "$t_ndbm" in
20261 $define)
20262         : see if dbm_open exists
20263         set dbm_open d_dbm_open
20264         eval $inlibc
20265         case "$d_dbm_open" in
20266         $undef)
20267                 t_ndbm="$undef"
20268                 echo "We won't be including <ndbm.h>"
20269                 ;;
20270         esac
20271         ;;
20272 esac
20273 val="$t_ndbm"
20274 set i_ndbm
20275 eval $setvar
20276
20277 : see if net/errno.h is available
20278 val=''
20279 set net/errno.h val
20280 eval $inhdr
20281
20282 : Unfortunately, it causes problems on some systems.  Arrgh.
20283 case "$val" in
20284 $define)
20285         cat > try.c <<'EOM'
20286 #include <stdio.h>
20287 #include <errno.h>
20288 #include <net/errno.h>
20289 int func()
20290 {
20291         return ENOTSOCK;
20292 }
20293 EOM
20294         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20295                 echo "We'll be including <net/errno.h>." >&4
20296         else
20297                 echo "We won't be including <net/errno.h>." >&4
20298                 val="$undef"
20299         fi
20300         $rm -f try.* try
20301         ;;
20302 esac
20303 set i_neterrno
20304 eval $setvar
20305
20306 : see if netinet/tcp.h is available
20307 set netinet/tcp.h i_netinettcp
20308 eval $inhdr
20309
20310 : see if this is a poll.h system
20311 set poll.h i_poll
20312 eval $inhdr
20313
20314 : see if this is a prot.h system
20315 set prot.h i_prot
20316 eval $inhdr
20317
20318 echo " "
20319 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20320 $cat <<'EOSH' > Cppsym.know
20321 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20322 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20323 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20324 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20325 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20326 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20327 bull c cadmus clipper CMU COFF COMPILER_VERSION
20328 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20329 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20330 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20331 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20332 GLIBC GLIBC_MINOR
20333 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20334 H3050R H3050RX hbullx20 hcx host_mips
20335 hp200 hp300 hp700 HP700 hp800 hp9000
20336 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20337 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20338 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20339 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20340 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20341 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20342 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20343 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20344 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20345 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20346 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20347 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20348 MATH_HAS_NO_SIDE_EFFECTS
20349 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20350 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20351 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20352 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20353 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20354 NetBSD news1500 news1700 news1800 news1900 news3700
20355 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20356 ns32016 ns32332 ns32k nsc32000
20357 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20358 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20359 pc532 pdp11 PGC PIC plexus PORTAR posix
20360 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20361 POSIX_C_SOURCE POSIX_SOURCE POWER
20362 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20363 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20364 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20365 sony sony_news sonyrisc sparc sparclite spectrum
20366 stardent stdc STDC_EXT stratos sun sun3 sun386
20367 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20368 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20369 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20370 sysV68 sysV88 Tek4132 Tek4300 titan
20371 TM3200 TM5400 TM5600
20372 tower tower32 tower32_200 tower32_600 tower32_700
20373 tower32_800 tower32_850 tss
20374 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20375 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20376 unix UNIX95 UNIX99 unixpc unos
20377 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20378 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20379 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20380 USGr4 USGr4_2
20381 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20382 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20383 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20384 z8000
20385 EOSH
20386 # Maybe put other stuff here too.
20387 cat <<EOSH >>Cppsym.know
20388 $osname
20389 EOSH
20390 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20391 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20392 $cat Cppsym.know > Cppsym.c
20393 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20394 $rm -f Cppsym.a Cppsym.b Cppsym.c
20395 cat <<EOSH > Cppsym
20396 $startsh
20397 if $test \$# -gt 0; then
20398     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20399     if $test -s Cppsym.got; then
20400         $rm -f Cppsym.got
20401         exit 0
20402     fi
20403     $rm -f Cppsym.got
20404     exit 1
20405 else
20406     $tr " " "$trnl" | ./Cppsym.try
20407     exit 0
20408 fi
20409 EOSH
20410 chmod +x Cppsym
20411 $eunicefix Cppsym
20412 cat <<EOSH > Cppsym.try
20413 $startsh
20414 cat <<'EOCP' > try.c
20415 #include <stdio.h>
20416 #if cpp_stuff == 1
20417 #define STRINGIFY(a)    "a"
20418 #endif
20419 #if cpp_stuff == 42
20420 #define StGiFy(a)  #a
20421 #define STRINGIFY(a)    StGiFy(a)
20422 #endif
20423 #if $cpp_stuff != 1 && $cpp_stuff != 42
20424 #   include "Bletch: How does this C preprocessor stringify macros?"
20425 #endif
20426 int main() {
20427 EOCP
20428 $awk \\
20429 EOSH
20430 cat <<'EOSH' >> Cppsym.try
20431 'length($1) > 0 {
20432     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20433     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20434     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20435     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20436 }'       >> try.c
20437 echo 'return 0;}' >> try.c
20438 EOSH
20439 cat <<EOSH >> Cppsym.try
20440 ccflags="$ccflags"
20441 case "$osname-$gccversion" in
20442 irix-) ccflags="\$ccflags -woff 1178" ;;
20443 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20444 esac
20445 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20446 EOSH
20447 chmod +x Cppsym.try
20448 $eunicefix Cppsym.try
20449 ./Cppsym < Cppsym.know > Cppsym.true
20450 : Add in any linux cpp "predefined macros":
20451 case "$osname::$gccversion" in
20452   *linux*::*.*)
20453     tHdrH=_tmpHdr
20454     rm -f $tHdrH'.h' $tHdrH
20455     touch $tHdrH'.h'
20456     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20457        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20458        if [ -s $tHdrH'_cppsym.real' ]; then
20459           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20460        fi
20461     fi
20462     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20463   ;;
20464 esac
20465 : now check the C compiler for additional symbols
20466 postprocess_cc_v=''
20467 case "$osname" in
20468 aix) postprocess_cc_v="|$tr , ' '" ;;
20469 esac
20470 $cat >ccsym <<EOS
20471 $startsh
20472 $cat >tmp.c <<EOF
20473 extern int foo;
20474 EOF
20475 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20476 do
20477         case "\$i" in
20478         -D*) echo "\$i" | $sed 's/^-D//';;
20479         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20480         esac
20481 done
20482 $rm -f try.c
20483 EOS
20484 postprocess_cc_v=''
20485 chmod +x ccsym
20486 $eunicefix ccsym
20487 ./ccsym > ccsym1.raw
20488 if $test -s ccsym1.raw; then
20489        $sort ccsym1.raw | $uniq >ccsym.raw
20490 else
20491        mv ccsym1.raw ccsym.raw
20492 fi
20493
20494 $awk '/\=/ { print $0; next }
20495         { print $0"=1" }' ccsym.raw >ccsym.list
20496 $comm -13 Cppsym.true ccsym.list >ccsym.own
20497 $comm -12 Cppsym.true ccsym.list >ccsym.com
20498 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20499 also=''
20500 if $test -z ccsym.raw; then
20501         echo "Your C compiler doesn't seem to define any symbols!" >&4
20502         echo " "
20503         echo "However, your C preprocessor defines the following symbols:"
20504         $cat Cppsym.true
20505         ccsymbols=''
20506         cppsymbols=`$cat Cppsym.true`
20507         cppsymbols=`echo $cppsymbols`
20508         cppccsymbols="$cppsymbols"
20509 else
20510         if $test -s ccsym.com; then
20511                 echo "Your C compiler and pre-processor define these symbols:"
20512                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20513                 also='also '
20514                 symbols='ones'
20515                 cppccsymbols=`$cat ccsym.com`
20516                 cppccsymbols=`echo $cppccsymbols`
20517                 $test "$silent" || sleep 1
20518         fi
20519         if $test -s ccsym.cpp; then
20520                 $test "$also" && echo " "
20521                 echo "Your C pre-processor ${also}defines the following symbols:"
20522                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20523                 also='further '
20524                 cppsymbols=`$cat ccsym.cpp`
20525                 cppsymbols=`echo $cppsymbols`
20526                 $test "$silent" || sleep 1
20527         fi
20528         if $test -s ccsym.own; then
20529                 $test "$also" && echo " "
20530                 echo "Your C compiler ${also}defines the following cpp symbols:"
20531                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20532                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20533                 ccsymbols=`$cat ccsym.own`
20534                 ccsymbols=`echo $ccsymbols`
20535                 $test "$silent" || sleep 1
20536         fi
20537 fi
20538
20539 : see if this is a termio system
20540 val="$undef"
20541 val2="$undef"
20542 val3="$undef"
20543 if $test `./findhdr termios.h`; then
20544         set tcsetattr i_termios
20545         eval $inlibc
20546         val3="$i_termios"
20547 fi
20548 echo " "
20549 case "$val3" in
20550 "$define") echo "You have POSIX termios.h... good!" >&4;;
20551 *) if ./Cppsym pyr; then
20552                 case "`/bin/universe`" in
20553                 ucb) if $test `./findhdr sgtty.h`; then
20554                                 val2="$define"
20555                                 echo "<sgtty.h> found." >&4
20556                         else
20557                                 echo "System is pyramid with BSD universe."
20558                                 echo "<sgtty.h> not found--you could have problems." >&4
20559                         fi;;
20560                 *) if $test `./findhdr termio.h`; then
20561                                 val="$define"
20562                                 echo "<termio.h> found." >&4
20563                         else
20564                                 echo "System is pyramid with USG universe."
20565                                 echo "<termio.h> not found--you could have problems." >&4
20566                         fi;;
20567                 esac
20568         elif ./usg; then
20569                 if $test `./findhdr termio.h`; then
20570                         echo "<termio.h> found." >&4
20571                         val="$define"
20572                 elif $test `./findhdr sgtty.h`; then
20573                         echo "<sgtty.h> found." >&4
20574                         val2="$define"
20575                 else
20576 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20577                 fi
20578         else
20579                 if $test `./findhdr sgtty.h`; then
20580                         echo "<sgtty.h> found." >&4
20581                         val2="$define"
20582                 elif $test `./findhdr termio.h`; then
20583                         echo "<termio.h> found." >&4
20584                         val="$define"
20585                 else
20586 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20587                 fi
20588         fi;;
20589 esac
20590 set i_termio; eval $setvar
20591 val=$val2; set i_sgtty; eval $setvar
20592 val=$val3; set i_termios; eval $setvar
20593
20594 : see if stddef is available
20595 set stddef.h i_stddef
20596 eval $inhdr
20597
20598 : see if this is a sunmath.h system
20599 set sunmath.h i_sunmath
20600 eval $inhdr
20601
20602 : see if sys/access.h is available
20603 set sys/access.h i_sysaccess
20604 eval $inhdr
20605
20606 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20607 set sys/filio.h i_sysfilio
20608 eval $inhdr
20609 echo " "
20610 if $test `./findhdr sys/ioctl.h`; then
20611         val="$define"
20612         echo '<sys/ioctl.h> found.' >&4
20613 else
20614         val="$undef"
20615         if $test $i_sysfilio = "$define"; then
20616             echo '<sys/ioctl.h> NOT found.' >&4
20617         else
20618                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20619                 $test $i_termio = "$define" && xxx="termio.h"
20620                 $test $i_termios = "$define" && xxx="termios.h"
20621 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20622         fi
20623 fi
20624 set i_sysioctl
20625 eval $setvar
20626
20627 : see if socket ioctl defs are in sys/sockio.h
20628 echo " "
20629 xxx=`./findhdr sys/sockio.h`
20630 if $test "$xxx"; then
20631         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20632                 val="$define"
20633                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20634         else
20635                 val="$undef"
20636                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20637         fi
20638 else
20639         val="$undef"
20640         $cat <<EOM
20641 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20642 EOM
20643 fi
20644 set i_syssockio
20645 eval $setvar
20646
20647
20648 : see if this is a syslog.h system
20649 set syslog.h i_syslog
20650 eval $inhdr
20651
20652
20653 : see if this is a sys/mode.h system
20654 set sys/mode.h i_sysmode
20655 eval $inhdr
20656
20657 : see if sys/resource.h has to be included
20658 set sys/resource.h i_sysresrc
20659 eval $inhdr
20660
20661 : see if sys/security.h is available
20662 set sys/security.h i_syssecrt
20663 eval $inhdr
20664
20665 : see if this is a sys/statvfs.h system
20666 set sys/statvfs.h i_sysstatvfs
20667 eval $inhdr
20668
20669 : see if this is a sys/un.h system
20670 set sys/un.h i_sysun
20671 eval $inhdr
20672
20673
20674 : see if this is a sys/utsname.h system
20675 set sys/utsname.h i_sysutsname
20676 eval $inhdr
20677
20678 : see if this is a syswait system
20679 set sys/wait.h i_syswait
20680 eval $inhdr
20681
20682 : see if this is a ustat.h system
20683 set ustat.h i_ustat
20684 eval $inhdr
20685
20686 : see if this is an utime system
20687 set utime.h i_utime
20688 eval $inhdr
20689
20690 : see if this is a values.h system
20691 set values.h i_values
20692 eval $inhdr
20693
20694 : see if this is a vfork system
20695 case "$d_vfork" in
20696 "$define")
20697         set vfork.h i_vfork
20698         eval $inhdr
20699         ;;
20700 *)
20701         i_vfork="$undef"
20702         ;;
20703 esac
20704
20705 : see if gdbm.h is available
20706 set gdbm.h t_gdbm
20707 eval $inhdr
20708 case "$t_gdbm" in
20709 $define)
20710         : see if gdbm_open exists
20711         set gdbm_open d_gdbm_open
20712         eval $inlibc
20713         case "$d_gdbm_open" in
20714         $undef)
20715                 t_gdbm="$undef"
20716                 echo "We won't be including <gdbm.h>"
20717                 ;;
20718         esac
20719         ;;
20720 esac
20721 val="$t_gdbm"
20722 set i_gdbm
20723 eval $setvar
20724
20725 echo " "
20726 echo "Looking for extensions..." >&4
20727 : If we are using the old config.sh, known_extensions may contain
20728 : old or inaccurate or duplicate values.
20729 known_extensions=''
20730 nonxs_extensions=''
20731 : We do not use find because it might not be available.
20732 : We do not just use MANIFEST because the user may have dropped
20733 : some additional extensions into the source tree and expect them
20734 : to be built.
20735
20736 : Function to recursively find available extensions, ignoring DynaLoader
20737 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20738 find_extensions='
20739     for xxx in *; do
20740        case "$xxx" in
20741            DynaLoader|dynaload) ;;
20742            *)
20743            if $test -f $xxx/$xxx.xs; then
20744                known_extensions="$known_extensions $1$xxx";
20745            elif $test -f $xxx/Makefile.PL; then
20746                nonxs_extensions="$nonxs_extensions $1$xxx";
20747            else
20748                if $test -d $xxx -a $# -lt 10; then
20749                    set $1$xxx/ $*;
20750                    cd "$xxx";
20751                    eval $find_extensions;
20752                    cd ..;
20753                    shift;
20754                fi;
20755            fi
20756            ;;
20757        esac;
20758     done'
20759 tdir=`pwd`
20760 cd "$rsrc/ext"
20761 set X
20762 shift
20763 eval $find_extensions
20764 # Special case:  Add in threads/shared since it is not picked up by the
20765 # recursive find above (and adding in general recursive finding breaks
20766 # SDBM_File/sdbm).  A.D.  10/25/2001.
20767 known_extensions="$known_extensions threads/shared"
20768 set X $nonxs_extensions
20769 shift
20770 nonxs_extensions="$*"
20771 set X $known_extensions
20772 shift
20773 known_extensions="$*"
20774 cd "$tdir"
20775
20776 : Now see which are supported on this system.
20777 avail_ext=''
20778 for xxx in $known_extensions ; do
20779         case "$xxx" in
20780         DB_File|db_file)
20781                 case "$i_db" in
20782                 $define) avail_ext="$avail_ext $xxx" ;;
20783                 esac
20784                 ;;
20785         GDBM_File|gdbm_fil)
20786                 case "$i_gdbm" in 
20787                 $define) avail_ext="$avail_ext $xxx" ;;
20788                 esac
20789                 ;;
20790         I18N/Langinfo|i18n_lan)
20791                 case "$i_langinfo$d_nl_langinfo" in 
20792                 $define$define) avail_ext="$avail_ext $xxx" ;;
20793                 esac
20794                 ;;
20795         NDBM_File|ndbm_fil)
20796                 case "$i_ndbm" in
20797                 $define)
20798                     case "$osname-$use64bitint" in
20799                     hpux-define)
20800                         case "$libs" in
20801                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20802                         esac
20803                         ;;
20804                     *) avail_ext="$avail_ext $xxx" ;;
20805                     esac
20806                     ;;
20807                 esac
20808                 ;;
20809         ODBM_File|odbm_fil) 
20810                 case "${i_dbm}${i_rpcsvcdbm}" in
20811                 *"${define}"*)
20812                     case "$osname-$use64bitint" in
20813                     hpux-define)
20814                         case "$libs" in
20815                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20816                         esac
20817                         ;;
20818                     *) avail_ext="$avail_ext $xxx" ;;
20819                     esac
20820                     ;;
20821                 esac
20822                 ;;
20823         POSIX|posix)
20824                 case "$useposix" in
20825                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20826                 esac
20827                 ;;
20828         Opcode|opcode)
20829                 case "$useopcode" in
20830                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20831                 esac
20832                 ;;
20833         Socket|socket)
20834                 case "$d_socket" in 
20835                 true|$define|y)
20836                     case "$osname" in
20837                     beos) ;; # not unless BONE
20838                     *) avail_ext="$avail_ext $xxx" ;;
20839                     esac
20840                     ;;
20841                 esac
20842                 ;;
20843         Sys/Syslog|sys/syslog)
20844                 : XXX syslog requires socket
20845                 case "$d_socket" in 
20846                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20847                 esac
20848                 ;;
20849         Thread|thread)
20850                 case "$usethreads" in
20851                 true|$define|y)
20852                         case "$useithreads" in
20853                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20854                         esac
20855                 esac
20856                 ;;
20857         XS/APItest|xs/apitest)
20858                 # This is just for testing.  Skip it unless we have dynamic loading.
20859
20860                 case "$usedl" in
20861                 $define) avail_ext="$avail_ext $xxx" ;;
20862                 esac
20863                 ;;
20864         XS/Typemap|xs/typemap)
20865                 # This is just for testing.  Skip it unless we have dynamic loading.
20866                 case "$usedl" in
20867                 $define) avail_ext="$avail_ext $xxx" ;;
20868                 esac
20869                 ;;
20870         threads|threads/shared)
20871                 # threads and threads::shared are special cases.
20872                 # To stop people from asking "Perl 5.8.0 was supposed
20873                 # to have this new fancy threads implementation but my
20874                 # perl doesn't have it" and from people trying to
20875                 # (re)install the threads module using CPAN.pm and
20876                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20877                 # the threads.pm and threads/shared.pm will always be
20878                 # there, croaking informatively ("you need to rebuild
20879                 # all of Perl with threads, sorry") when threads haven't
20880                 # been compiled in.
20881                 # --jhi
20882                 avail_ext="$avail_ext $xxx"
20883                 ;;
20884         IPC/SysV|ipc/sysv)
20885                 : XXX Do we need a useipcsysv variable here
20886                 case "${d_msg}${d_sem}${d_shm}" in 
20887                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20888                 esac
20889                 ;;
20890         *)      avail_ext="$avail_ext $xxx"
20891                 ;;
20892         esac
20893 done
20894
20895 set X $avail_ext
20896 shift
20897 avail_ext="$*"
20898
20899 case "$onlyextensions" in
20900 '') ;;
20901 *)  keepextensions=''
20902     echo "You have requested that only certains extensions be included..." >&4
20903     for i in $onlyextensions; do
20904         case " $avail_ext " in
20905         *" $i "*)
20906             echo "Keeping extension $i."
20907             keepextensions="$keepextensions $i"
20908             ;;
20909         *) echo "Ignoring extension $i." ;;
20910         esac
20911     done
20912     avail_ext="$keepextensions"
20913     ;;
20914 esac
20915
20916 case "$noextensions" in
20917 '') ;;
20918 *)  keepextensions=''
20919     echo "You have requested that certain extensions be ignored..." >&4
20920     for i in $avail_ext; do
20921         case " $noextensions " in
20922         *" $i "*) echo "Ignoring extension $i." ;;
20923         *) echo "Keeping extension $i.";
20924            keepextensions="$keepextensions $i"
20925            ;;
20926         esac
20927     done
20928     avail_ext="$keepextensions"
20929     ;;
20930 esac
20931
20932 : Now see which nonxs extensions are supported on this system.
20933 : For now assume all are.
20934 nonxs_ext=''
20935 for xxx in $nonxs_extensions ; do
20936         case "$xxx" in
20937         *)      nonxs_ext="$nonxs_ext $xxx"
20938                 ;;
20939         esac
20940 done
20941
20942 set X $nonxs_ext
20943 shift
20944 nonxs_ext="$*"
20945
20946 case $usedl in
20947 $define)
20948         $cat <<EOM
20949 A number of extensions are supplied with $package.  You may choose to
20950 compile these extensions for dynamic loading (the default), compile
20951 them into the $package executable (static loading), or not include
20952 them at all.  Answer "none" to include no extensions.
20953 Note that DynaLoader is always built and need not be mentioned here.
20954
20955 EOM
20956         case "$dynamic_ext" in
20957         '')
20958                 : Exclude those listed in static_ext
20959                 dflt=''
20960                 for xxx in $avail_ext; do
20961                         case " $static_ext " in
20962                         *" $xxx "*) ;;
20963                         *) dflt="$dflt $xxx" ;;
20964                         esac
20965                 done
20966                 set X $dflt
20967                 shift
20968                 dflt="$*"
20969                 ;;
20970         *)      dflt="$dynamic_ext"
20971                 # Perhaps we are reusing an old out-of-date config.sh.
20972                 case "$hint" in
20973                 previous)
20974                         if test X"$dynamic_ext" != X"$avail_ext"; then
20975                                 $cat <<EOM
20976 NOTICE:  Your previous config.sh list may be incorrect. 
20977 The extensions now available to you are 
20978         ${avail_ext}
20979 but the default list from your previous config.sh is
20980         ${dynamic_ext} 
20981
20982 EOM
20983                         fi
20984                         ;;
20985                 esac
20986                 ;;
20987         esac
20988         case "$dflt" in
20989         '')     dflt=none;;
20990         esac
20991         rp="What extensions do you wish to load dynamically?"
20992         . ./myread
20993         case "$ans" in
20994         none) dynamic_ext=' ' ;;
20995         *) dynamic_ext="$ans" ;;
20996         esac
20997
20998         case "$static_ext" in
20999         '')
21000                 : Exclude those already listed in dynamic linking
21001                 dflt=''
21002                 for xxx in $avail_ext; do
21003                         case " $dynamic_ext " in
21004                         *" $xxx "*) ;;
21005                         *) dflt="$dflt $xxx" ;;
21006                         esac
21007                 done
21008                 set X $dflt
21009                 shift
21010                 dflt="$*"
21011                 ;;
21012         *)  dflt="$static_ext" 
21013                 ;;
21014         esac
21015
21016         case "$dflt" in
21017         '')     dflt=none;;
21018         esac
21019         rp="What extensions do you wish to load statically?"
21020         . ./myread
21021         case "$ans" in
21022         none) static_ext=' ' ;;
21023         *) static_ext="$ans" ;;
21024         esac
21025         ;;
21026 *)
21027         $cat <<EOM
21028 A number of extensions are supplied with $package.  Answer "none" 
21029 to include no extensions. 
21030 Note that DynaLoader is always built and need not be mentioned here.
21031
21032 EOM
21033         case "$static_ext" in
21034         '') dflt="$avail_ext" ;;
21035         *)      dflt="$static_ext"
21036                 # Perhaps we are reusing an old out-of-date config.sh.
21037                 case "$hint" in
21038                 previous)
21039                         if test X"$static_ext" != X"$avail_ext"; then
21040                                 $cat <<EOM
21041 NOTICE:  Your previous config.sh list may be incorrect. 
21042 The extensions now available to you are 
21043         ${avail_ext}
21044 but the default list from your previous config.sh is
21045         ${static_ext} 
21046
21047 EOM
21048                         fi
21049                         ;;
21050                 esac
21051                 ;;
21052         esac
21053         : Exclude those that are not xs extensions
21054         case "$dflt" in
21055         '')     dflt=none;;
21056         esac
21057         rp="What extensions do you wish to include?"
21058         . ./myread
21059         case "$ans" in
21060         none) static_ext=' ' ;;
21061         *) static_ext="$ans" ;;
21062         esac
21063         ;;
21064 esac
21065 #        
21066 # Encode is a special case.  If we are building Encode as a static
21067 # extension, we need to explicitly list its subextensions as well.
21068 # For other nested extensions, this is handled automatically by
21069 # the appropriate Makefile.PL.
21070 case " $static_ext " in
21071         *" Encode "*) # Add the subextensions of Encode
21072         cd "$rsrc/ext"
21073         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21074                 static_ext="$static_ext Encode/$xxx"
21075         done
21076         cd "$tdir"
21077         ;;
21078 esac
21079
21080 set X $dynamic_ext $static_ext $nonxs_ext
21081 shift
21082 extensions="$*"
21083
21084 # Sanity check:  We require an extension suitable for use with
21085 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21086 # should show up as failures in the test suite, but it's helpful to
21087 # catch them now.) The 'extensions' list is normally sorted
21088 # alphabetically, so we need to accept either
21089 #    DB_File ... Fcntl ... IO  ....
21090 # or something like
21091 #    Fcntl ... NDBM_File ... IO  ....
21092 case " $extensions"  in
21093 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21094 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21095 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21096 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21097    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21098    ;;
21099 esac
21100
21101 : Remove libraries needed only for extensions
21102 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21103 : The exception is SunOS 4.x, which needs them.
21104 case "${osname}X${osvers}" in
21105 sunos*X4*)
21106     perllibs="$libs"
21107     ;;
21108 *) case "$usedl" in
21109     $define|true|[yY]*)
21110             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21111             shift
21112             perllibs="$*"
21113             ;;
21114     *)  perllibs="$libs"
21115             ;;
21116     esac
21117     ;;
21118 esac
21119
21120 : Remove build directory name from cppstdin so it can be used from
21121 : either the present location or the final installed location.
21122 echo " "
21123 : Get out of the UU directory to get correct path name.
21124 cd ..
21125 case "$cppstdin" in
21126 `pwd`/cppstdin)
21127         echo "Stripping down cppstdin path name"
21128         cppstdin=cppstdin
21129         ;;
21130 esac
21131 cd UU
21132
21133 : end of configuration questions
21134 echo " "
21135 echo "End of configuration questions."
21136 echo " "
21137
21138 : back to where it started
21139 if test -d ../UU; then
21140         cd ..
21141 fi
21142
21143 : configuration may be patched via a 'config.arch' file
21144 if $test -f config.arch; then
21145         echo "I see a config.arch file, loading it."
21146         . ./config.arch
21147 fi
21148
21149 : configuration may be patched via a 'config.over' file
21150 if $test -f config.over; then
21151         echo " "
21152         dflt=y
21153         rp='I see a config.over file.  Do you wish to load it?'
21154         . UU/myread
21155         case "$ans" in
21156         n*) echo "OK, I'll ignore it.";;
21157         *)      . ./config.over
21158                 echo "Configuration override changes have been loaded."
21159                 ;;
21160         esac
21161 fi
21162
21163 : in case they want portability, strip down executable paths
21164 case "$d_portable" in
21165 "$define")
21166         echo " "
21167         echo "Stripping down executable paths..." >&4
21168         for file in $loclist $trylist; do
21169                 eval temp=\$$file
21170                 eval $file=`basename $temp`
21171         done
21172         ;;
21173 esac
21174
21175 : create config.sh file
21176 echo " "
21177 echo "Creating config.sh..." >&4
21178 $spitshell <<EOT >config.sh
21179 $startsh
21180 #
21181 # This file was produced by running the Configure script. It holds all the
21182 # definitions figured out by Configure. Should you modify one of these values,
21183 # do not forget to propagate your changes by running "Configure -der". You may
21184 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21185 #
21186
21187 # Package name      : $package
21188 # Source directory  : $src
21189 # Configuration time: $cf_time
21190 # Configured by     : $cf_by
21191 # Target system     : $myuname
21192
21193 Author='$Author'
21194 Date='$Date'
21195 Header='$Header'
21196 Id='$Id'
21197 Locker='$Locker'
21198 Log='$Log'
21199 Mcc='$Mcc'
21200 RCSfile='$RCSfile'
21201 Revision='$Revision'
21202 Source='$Source'
21203 State='$State'
21204 _a='$_a'
21205 _exe='$_exe'
21206 _o='$_o'
21207 afs='$afs'
21208 afsroot='$afsroot'
21209 alignbytes='$alignbytes'
21210 ansi2knr='$ansi2knr'
21211 aphostname='$aphostname'
21212 api_revision='$api_revision'
21213 api_subversion='$api_subversion'
21214 api_version='$api_version'
21215 api_versionstring='$api_versionstring'
21216 ar='$ar'
21217 archlib='$archlib'
21218 archlibexp='$archlibexp'
21219 archname64='$archname64'
21220 archname='$archname'
21221 archobjs='$archobjs'
21222 asctime_r_proto='$asctime_r_proto'
21223 awk='$awk'
21224 baserev='$baserev'
21225 bash='$bash'
21226 bin='$bin'
21227 binexp='$binexp'
21228 bison='$bison'
21229 byacc='$byacc'
21230 byteorder='$byteorder'
21231 c='$c'
21232 castflags='$castflags'
21233 cat='$cat'
21234 cc='$cc'
21235 cccdlflags='$cccdlflags'
21236 ccdlflags='$ccdlflags'
21237 ccflags='$ccflags'
21238 ccflags_uselargefiles='$ccflags_uselargefiles'
21239 ccname='$ccname'
21240 ccsymbols='$ccsymbols'
21241 ccversion='$ccversion'
21242 cf_by='$cf_by'
21243 cf_email='$cf_email'
21244 cf_time='$cf_time'
21245 charsize='$charsize'
21246 chgrp='$chgrp'
21247 chmod='$chmod'
21248 chown='$chown'
21249 clocktype='$clocktype'
21250 comm='$comm'
21251 compress='$compress'
21252 contains='$contains'
21253 cp='$cp'
21254 cpio='$cpio'
21255 cpp='$cpp'
21256 cpp_stuff='$cpp_stuff'
21257 cppccsymbols='$cppccsymbols'
21258 cppflags='$cppflags'
21259 cpplast='$cpplast'
21260 cppminus='$cppminus'
21261 cpprun='$cpprun'
21262 cppstdin='$cppstdin'
21263 cppsymbols='$cppsymbols'
21264 crypt_r_proto='$crypt_r_proto'
21265 cryptlib='$cryptlib'
21266 csh='$csh'
21267 ctermid_r_proto='$ctermid_r_proto'
21268 ctime_r_proto='$ctime_r_proto'
21269 d_Gconvert='$d_Gconvert'
21270 d_PRIEUldbl='$d_PRIEUldbl'
21271 d_PRIFUldbl='$d_PRIFUldbl'
21272 d_PRIGUldbl='$d_PRIGUldbl'
21273 d_PRIXU64='$d_PRIXU64'
21274 d_PRId64='$d_PRId64'
21275 d_PRIeldbl='$d_PRIeldbl'
21276 d_PRIfldbl='$d_PRIfldbl'
21277 d_PRIgldbl='$d_PRIgldbl'
21278 d_PRIi64='$d_PRIi64'
21279 d_PRIo64='$d_PRIo64'
21280 d_PRIu64='$d_PRIu64'
21281 d_PRIx64='$d_PRIx64'
21282 d_SCNfldbl='$d_SCNfldbl'
21283 d__fwalk='$d__fwalk'
21284 d_access='$d_access'
21285 d_accessx='$d_accessx'
21286 d_aintl='$d_aintl'
21287 d_alarm='$d_alarm'
21288 d_archlib='$d_archlib'
21289 d_asctime_r='$d_asctime_r'
21290 d_atolf='$d_atolf'
21291 d_atoll='$d_atoll'
21292 d_attribute_format='$d_attribute_format'
21293 d_attribute_malloc='$d_attribute_malloc'
21294 d_attribute_nonnull='$d_attribute_nonnull'
21295 d_attribute_noreturn='$d_attribute_noreturn'
21296 d_attribute_pure='$d_attribute_pure'
21297 d_attribute_unused='$d_attribute_unused'
21298 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21299 d_bcmp='$d_bcmp'
21300 d_bcopy='$d_bcopy'
21301 d_bsd='$d_bsd'
21302 d_bsdgetpgrp='$d_bsdgetpgrp'
21303 d_bsdsetpgrp='$d_bsdsetpgrp'
21304 d_builtin_choose_expr='$d_builtin_choose_expr'
21305 d_builtin_expect='$d_builtin_expect'
21306 d_bzero='$d_bzero'
21307 d_casti32='$d_casti32'
21308 d_castneg='$d_castneg'
21309 d_charvspr='$d_charvspr'
21310 d_chown='$d_chown'
21311 d_chroot='$d_chroot'
21312 d_chsize='$d_chsize'
21313 d_class='$d_class'
21314 d_clearenv='$d_clearenv'
21315 d_closedir='$d_closedir'
21316 d_cmsghdr_s='$d_cmsghdr_s'
21317 d_const='$d_const'
21318 d_copysignl='$d_copysignl'
21319 d_crypt='$d_crypt'
21320 d_crypt_r='$d_crypt_r'
21321 d_csh='$d_csh'
21322 d_ctermid_r='$d_ctermid_r'
21323 d_ctime_r='$d_ctime_r'
21324 d_cuserid='$d_cuserid'
21325 d_c99_variadic_macros='$d_c99_variadic_macros'
21326 d_dbl_dig='$d_dbl_dig'
21327 d_dbminitproto='$d_dbminitproto'
21328 d_difftime='$d_difftime'
21329 d_dirfd='$d_dirfd'
21330 d_dirnamlen='$d_dirnamlen'
21331 d_dlerror='$d_dlerror'
21332 d_dlopen='$d_dlopen'
21333 d_dlsymun='$d_dlsymun'
21334 d_dosuid='$d_dosuid'
21335 d_drand48_r='$d_drand48_r'
21336 d_drand48proto='$d_drand48proto'
21337 d_dup2='$d_dup2'
21338 d_eaccess='$d_eaccess'
21339 d_endgrent='$d_endgrent'
21340 d_endgrent_r='$d_endgrent_r'
21341 d_endhent='$d_endhent'
21342 d_endhostent_r='$d_endhostent_r'
21343 d_endnent='$d_endnent'
21344 d_endnetent_r='$d_endnetent_r'
21345 d_endpent='$d_endpent'
21346 d_endprotoent_r='$d_endprotoent_r'
21347 d_endpwent='$d_endpwent'
21348 d_endpwent_r='$d_endpwent_r'
21349 d_endsent='$d_endsent'
21350 d_endservent_r='$d_endservent_r'
21351 d_eofnblk='$d_eofnblk'
21352 d_eunice='$d_eunice'
21353 d_faststdio='$d_faststdio'
21354 d_fchdir='$d_fchdir'
21355 d_fchmod='$d_fchmod'
21356 d_fchown='$d_fchown'
21357 d_fcntl='$d_fcntl'
21358 d_fcntl_can_lock='$d_fcntl_can_lock'
21359 d_fd_macros='$d_fd_macros'
21360 d_fd_set='$d_fd_set'
21361 d_fds_bits='$d_fds_bits'
21362 d_fgetpos='$d_fgetpos'
21363 d_finite='$d_finite'
21364 d_finitel='$d_finitel'
21365 d_flexfnam='$d_flexfnam'
21366 d_flock='$d_flock'
21367 d_flockproto='$d_flockproto'
21368 d_fork='$d_fork'
21369 d_fp_class='$d_fp_class'
21370 d_fpathconf='$d_fpathconf'
21371 d_fpclass='$d_fpclass'
21372 d_fpclassify='$d_fpclassify'
21373 d_fpclassl='$d_fpclassl'
21374 d_fpos64_t='$d_fpos64_t'
21375 d_frexpl='$d_frexpl'
21376 d_fs_data_s='$d_fs_data_s'
21377 d_fseeko='$d_fseeko'
21378 d_fsetpos='$d_fsetpos'
21379 d_fstatfs='$d_fstatfs'
21380 d_fstatvfs='$d_fstatvfs'
21381 d_fsync='$d_fsync'
21382 d_ftello='$d_ftello'
21383 d_ftime='$d_ftime'
21384 d_futimes='$d_futimes'
21385 d_getcwd='$d_getcwd'
21386 d_getespwnam='$d_getespwnam'
21387 d_getfsstat='$d_getfsstat'
21388 d_getgrent='$d_getgrent'
21389 d_getgrent_r='$d_getgrent_r'
21390 d_getgrgid_r='$d_getgrgid_r'
21391 d_getgrnam_r='$d_getgrnam_r'
21392 d_getgrps='$d_getgrps'
21393 d_gethbyaddr='$d_gethbyaddr'
21394 d_gethbyname='$d_gethbyname'
21395 d_gethent='$d_gethent'
21396 d_gethname='$d_gethname'
21397 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21398 d_gethostbyname_r='$d_gethostbyname_r'
21399 d_gethostent_r='$d_gethostent_r'
21400 d_gethostprotos='$d_gethostprotos'
21401 d_getitimer='$d_getitimer'
21402 d_getlogin='$d_getlogin'
21403 d_getlogin_r='$d_getlogin_r'
21404 d_getmnt='$d_getmnt'
21405 d_getmntent='$d_getmntent'
21406 d_getnbyaddr='$d_getnbyaddr'
21407 d_getnbyname='$d_getnbyname'
21408 d_getnent='$d_getnent'
21409 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21410 d_getnetbyname_r='$d_getnetbyname_r'
21411 d_getnetent_r='$d_getnetent_r'
21412 d_getnetprotos='$d_getnetprotos'
21413 d_getpagsz='$d_getpagsz'
21414 d_getpbyname='$d_getpbyname'
21415 d_getpbynumber='$d_getpbynumber'
21416 d_getpent='$d_getpent'
21417 d_getpgid='$d_getpgid'
21418 d_getpgrp2='$d_getpgrp2'
21419 d_getpgrp='$d_getpgrp'
21420 d_getppid='$d_getppid'
21421 d_getprior='$d_getprior'
21422 d_getprotobyname_r='$d_getprotobyname_r'
21423 d_getprotobynumber_r='$d_getprotobynumber_r'
21424 d_getprotoent_r='$d_getprotoent_r'
21425 d_getprotoprotos='$d_getprotoprotos'
21426 d_getprpwnam='$d_getprpwnam'
21427 d_getpwent='$d_getpwent'
21428 d_getpwent_r='$d_getpwent_r'
21429 d_getpwnam_r='$d_getpwnam_r'
21430 d_getpwuid_r='$d_getpwuid_r'
21431 d_getsbyname='$d_getsbyname'
21432 d_getsbyport='$d_getsbyport'
21433 d_getsent='$d_getsent'
21434 d_getservbyname_r='$d_getservbyname_r'
21435 d_getservbyport_r='$d_getservbyport_r'
21436 d_getservent_r='$d_getservent_r'
21437 d_getservprotos='$d_getservprotos'
21438 d_getspnam='$d_getspnam'
21439 d_getspnam_r='$d_getspnam_r'
21440 d_gettimeod='$d_gettimeod'
21441 d_gmtime_r='$d_gmtime_r'
21442 d_gnulibc='$d_gnulibc'
21443 d_grpasswd='$d_grpasswd'
21444 d_hasmntopt='$d_hasmntopt'
21445 d_htonl='$d_htonl'
21446 d_ilogbl='$d_ilogbl'
21447 d_inc_version_list='$d_inc_version_list'
21448 d_index='$d_index'
21449 d_inetaton='$d_inetaton'
21450 d_int64_t='$d_int64_t'
21451 d_isascii='$d_isascii'
21452 d_isfinite='$d_isfinite'
21453 d_isinf='$d_isinf'
21454 d_isnan='$d_isnan'
21455 d_isnanl='$d_isnanl'
21456 d_killpg='$d_killpg'
21457 d_lchown='$d_lchown'
21458 d_ldbl_dig='$d_ldbl_dig'
21459 d_libm_lib_version='$d_libm_lib_version'
21460 d_link='$d_link'
21461 d_localtime_r='$d_localtime_r'
21462 d_locconv='$d_locconv'
21463 d_lockf='$d_lockf'
21464 d_longdbl='$d_longdbl'
21465 d_longlong='$d_longlong'
21466 d_lseekproto='$d_lseekproto'
21467 d_lstat='$d_lstat'
21468 d_madvise='$d_madvise'
21469 d_malloc_good_size='$d_malloc_good_size'
21470 d_malloc_size='$d_malloc_size'
21471 d_mblen='$d_mblen'
21472 d_mbstowcs='$d_mbstowcs'
21473 d_mbtowc='$d_mbtowc'
21474 d_memchr='$d_memchr'
21475 d_memcmp='$d_memcmp'
21476 d_memcpy='$d_memcpy'
21477 d_memmove='$d_memmove'
21478 d_memset='$d_memset'
21479 d_mkdir='$d_mkdir'
21480 d_mkdtemp='$d_mkdtemp'
21481 d_mkfifo='$d_mkfifo'
21482 d_mkstemp='$d_mkstemp'
21483 d_mkstemps='$d_mkstemps'
21484 d_mktime='$d_mktime'
21485 d_mmap='$d_mmap'
21486 d_modfl='$d_modfl'
21487 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21488 d_modflproto='$d_modflproto'
21489 d_mprotect='$d_mprotect'
21490 d_msg='$d_msg'
21491 d_msg_ctrunc='$d_msg_ctrunc'
21492 d_msg_dontroute='$d_msg_dontroute'
21493 d_msg_oob='$d_msg_oob'
21494 d_msg_peek='$d_msg_peek'
21495 d_msg_proxy='$d_msg_proxy'
21496 d_msgctl='$d_msgctl'
21497 d_msgget='$d_msgget'
21498 d_msghdr_s='$d_msghdr_s'
21499 d_msgrcv='$d_msgrcv'
21500 d_msgsnd='$d_msgsnd'
21501 d_msync='$d_msync'
21502 d_munmap='$d_munmap'
21503 d_mymalloc='$d_mymalloc'
21504 d_nice='$d_nice'
21505 d_nl_langinfo='$d_nl_langinfo'
21506 d_nv_preserves_uv='$d_nv_preserves_uv'
21507 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21508 d_off64_t='$d_off64_t'
21509 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21510 d_oldpthreads='$d_oldpthreads'
21511 d_oldsock='$d_oldsock'
21512 d_open3='$d_open3'
21513 d_pathconf='$d_pathconf'
21514 d_pause='$d_pause'
21515 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21516 d_phostname='$d_phostname'
21517 d_pipe='$d_pipe'
21518 d_poll='$d_poll'
21519 d_portable='$d_portable'
21520 d_procselfexe='$d_procselfexe'
21521 d_pthread_atfork='$d_pthread_atfork'
21522 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21523 d_pthread_yield='$d_pthread_yield'
21524 d_pwage='$d_pwage'
21525 d_pwchange='$d_pwchange'
21526 d_pwclass='$d_pwclass'
21527 d_pwcomment='$d_pwcomment'
21528 d_pwexpire='$d_pwexpire'
21529 d_pwgecos='$d_pwgecos'
21530 d_pwpasswd='$d_pwpasswd'
21531 d_pwquota='$d_pwquota'
21532 d_qgcvt='$d_qgcvt'
21533 d_quad='$d_quad'
21534 d_random_r='$d_random_r'
21535 d_readdir64_r='$d_readdir64_r'
21536 d_readdir='$d_readdir'
21537 d_readdir_r='$d_readdir_r'
21538 d_readlink='$d_readlink'
21539 d_readv='$d_readv'
21540 d_recvmsg='$d_recvmsg'
21541 d_rename='$d_rename'
21542 d_rewinddir='$d_rewinddir'
21543 d_rmdir='$d_rmdir'
21544 d_safebcpy='$d_safebcpy'
21545 d_safemcpy='$d_safemcpy'
21546 d_sanemcmp='$d_sanemcmp'
21547 d_sbrkproto='$d_sbrkproto'
21548 d_scalbnl='$d_scalbnl'
21549 d_sched_yield='$d_sched_yield'
21550 d_scm_rights='$d_scm_rights'
21551 d_seekdir='$d_seekdir'
21552 d_select='$d_select'
21553 d_sem='$d_sem'
21554 d_semctl='$d_semctl'
21555 d_semctl_semid_ds='$d_semctl_semid_ds'
21556 d_semctl_semun='$d_semctl_semun'
21557 d_semget='$d_semget'
21558 d_semop='$d_semop'
21559 d_sendmsg='$d_sendmsg'
21560 d_setegid='$d_setegid'
21561 d_seteuid='$d_seteuid'
21562 d_setgrent='$d_setgrent'
21563 d_setgrent_r='$d_setgrent_r'
21564 d_setgrps='$d_setgrps'
21565 d_sethent='$d_sethent'
21566 d_sethostent_r='$d_sethostent_r'
21567 d_setitimer='$d_setitimer'
21568 d_setlinebuf='$d_setlinebuf'
21569 d_setlocale='$d_setlocale'
21570 d_setlocale_r='$d_setlocale_r'
21571 d_setnent='$d_setnent'
21572 d_setnetent_r='$d_setnetent_r'
21573 d_setpent='$d_setpent'
21574 d_setpgid='$d_setpgid'
21575 d_setpgrp2='$d_setpgrp2'
21576 d_setpgrp='$d_setpgrp'
21577 d_setprior='$d_setprior'
21578 d_setproctitle='$d_setproctitle'
21579 d_setprotoent_r='$d_setprotoent_r'
21580 d_setpwent='$d_setpwent'
21581 d_setpwent_r='$d_setpwent_r'
21582 d_setregid='$d_setregid'
21583 d_setresgid='$d_setresgid'
21584 d_setresuid='$d_setresuid'
21585 d_setreuid='$d_setreuid'
21586 d_setrgid='$d_setrgid'
21587 d_setruid='$d_setruid'
21588 d_setsent='$d_setsent'
21589 d_setservent_r='$d_setservent_r'
21590 d_setsid='$d_setsid'
21591 d_setvbuf='$d_setvbuf'
21592 d_sfio='$d_sfio'
21593 d_shm='$d_shm'
21594 d_shmat='$d_shmat'
21595 d_shmatprototype='$d_shmatprototype'
21596 d_shmctl='$d_shmctl'
21597 d_shmdt='$d_shmdt'
21598 d_shmget='$d_shmget'
21599 d_sigaction='$d_sigaction'
21600 d_sigprocmask='$d_sigprocmask'
21601 d_sigsetjmp='$d_sigsetjmp'
21602 d_sitearch='$d_sitearch'
21603 d_snprintf='$d_snprintf'
21604 d_sockatmark='$d_sockatmark'
21605 d_sockatmarkproto='$d_sockatmarkproto'
21606 d_socket='$d_socket'
21607 d_socklen_t='$d_socklen_t'
21608 d_sockpair='$d_sockpair'
21609 d_socks5_init='$d_socks5_init'
21610 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21611 d_sqrtl='$d_sqrtl'
21612 d_srand48_r='$d_srand48_r'
21613 d_srandom_r='$d_srandom_r'
21614 d_sresgproto='$d_sresgproto'
21615 d_sresuproto='$d_sresuproto'
21616 d_statblks='$d_statblks'
21617 d_statfs_f_flags='$d_statfs_f_flags'
21618 d_statfs_s='$d_statfs_s'
21619 d_statvfs='$d_statvfs'
21620 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21621 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21622 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21623 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21624 d_stdio_stream_array='$d_stdio_stream_array'
21625 d_stdiobase='$d_stdiobase'
21626 d_stdstdio='$d_stdstdio'
21627 d_strchr='$d_strchr'
21628 d_strcoll='$d_strcoll'
21629 d_strctcpy='$d_strctcpy'
21630 d_strerrm='$d_strerrm'
21631 d_strerror='$d_strerror'
21632 d_strerror_r='$d_strerror_r'
21633 d_strftime='$d_strftime'
21634 d_strlcat='$d_strlcat'
21635 d_strlcpy='$d_strlcpy'
21636 d_strtod='$d_strtod'
21637 d_strtol='$d_strtol'
21638 d_strtold='$d_strtold'
21639 d_strtoll='$d_strtoll'
21640 d_strtoq='$d_strtoq'
21641 d_strtoul='$d_strtoul'
21642 d_strtoull='$d_strtoull'
21643 d_strtouq='$d_strtouq'
21644 d_strxfrm='$d_strxfrm'
21645 d_suidsafe='$d_suidsafe'
21646 d_symlink='$d_symlink'
21647 d_syscall='$d_syscall'
21648 d_syscallproto='$d_syscallproto'
21649 d_sysconf='$d_sysconf'
21650 d_sysernlst='$d_sysernlst'
21651 d_syserrlst='$d_syserrlst'
21652 d_system='$d_system'
21653 d_tcgetpgrp='$d_tcgetpgrp'
21654 d_tcsetpgrp='$d_tcsetpgrp'
21655 d_telldir='$d_telldir'
21656 d_telldirproto='$d_telldirproto'
21657 d_time='$d_time'
21658 d_times='$d_times'
21659 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21660 d_tm_tm_zone='$d_tm_tm_zone'
21661 d_tmpnam_r='$d_tmpnam_r'
21662 d_truncate='$d_truncate'
21663 d_ttyname_r='$d_ttyname_r'
21664 d_tzname='$d_tzname'
21665 d_u32align='$d_u32align'
21666 d_ualarm='$d_ualarm'
21667 d_umask='$d_umask'
21668 d_uname='$d_uname'
21669 d_union_semun='$d_union_semun'
21670 d_unordered='$d_unordered'
21671 d_unsetenv='$d_unsetenv'
21672 d_usleep='$d_usleep'
21673 d_usleepproto='$d_usleepproto'
21674 d_ustat='$d_ustat'
21675 d_vendorarch='$d_vendorarch'
21676 d_vendorbin='$d_vendorbin'
21677 d_vendorlib='$d_vendorlib'
21678 d_vendorscript='$d_vendorscript'
21679 d_vfork='$d_vfork'
21680 d_void_closedir='$d_void_closedir'
21681 d_voidsig='$d_voidsig'
21682 d_voidtty='$d_voidtty'
21683 d_volatile='$d_volatile'
21684 d_vprintf='$d_vprintf'
21685 d_vsnprintf='$d_vsnprintf'
21686 d_wait4='$d_wait4'
21687 d_waitpid='$d_waitpid'
21688 d_wcstombs='$d_wcstombs'
21689 d_wctomb='$d_wctomb'
21690 d_writev='$d_writev'
21691 d_xenix='$d_xenix'
21692 date='$date'
21693 db_hashtype='$db_hashtype'
21694 db_prefixtype='$db_prefixtype'
21695 db_version_major='$db_version_major'
21696 db_version_minor='$db_version_minor'
21697 db_version_patch='$db_version_patch'
21698 defvoidused='$defvoidused'
21699 direntrytype='$direntrytype'
21700 dlext='$dlext'
21701 dlsrc='$dlsrc'
21702 doublesize='$doublesize'
21703 drand01='$drand01'
21704 drand48_r_proto='$drand48_r_proto'
21705 dynamic_ext='$dynamic_ext'
21706 eagain='$eagain'
21707 ebcdic='$ebcdic'
21708 echo='$echo'
21709 egrep='$egrep'
21710 emacs='$emacs'
21711 endgrent_r_proto='$endgrent_r_proto'
21712 endhostent_r_proto='$endhostent_r_proto'
21713 endnetent_r_proto='$endnetent_r_proto'
21714 endprotoent_r_proto='$endprotoent_r_proto'
21715 endpwent_r_proto='$endpwent_r_proto'
21716 endservent_r_proto='$endservent_r_proto'
21717 eunicefix='$eunicefix'
21718 exe_ext='$exe_ext'
21719 expr='$expr'
21720 extensions='$extensions'
21721 extras='$extras'
21722 fflushNULL='$fflushNULL'
21723 fflushall='$fflushall'
21724 find='$find'
21725 firstmakefile='$firstmakefile'
21726 flex='$flex'
21727 fpossize='$fpossize'
21728 fpostype='$fpostype'
21729 freetype='$freetype'
21730 from='$from'
21731 full_ar='$full_ar'
21732 full_csh='$full_csh'
21733 full_sed='$full_sed'
21734 gccansipedantic='$gccansipedantic'
21735 gccosandvers='$gccosandvers'
21736 gccversion='$gccversion'
21737 getgrent_r_proto='$getgrent_r_proto'
21738 getgrgid_r_proto='$getgrgid_r_proto'
21739 getgrnam_r_proto='$getgrnam_r_proto'
21740 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21741 gethostbyname_r_proto='$gethostbyname_r_proto'
21742 gethostent_r_proto='$gethostent_r_proto'
21743 getlogin_r_proto='$getlogin_r_proto'
21744 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21745 getnetbyname_r_proto='$getnetbyname_r_proto'
21746 getnetent_r_proto='$getnetent_r_proto'
21747 getprotobyname_r_proto='$getprotobyname_r_proto'
21748 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21749 getprotoent_r_proto='$getprotoent_r_proto'
21750 getpwent_r_proto='$getpwent_r_proto'
21751 getpwnam_r_proto='$getpwnam_r_proto'
21752 getpwuid_r_proto='$getpwuid_r_proto'
21753 getservbyname_r_proto='$getservbyname_r_proto'
21754 getservbyport_r_proto='$getservbyport_r_proto'
21755 getservent_r_proto='$getservent_r_proto'
21756 getspnam_r_proto='$getspnam_r_proto'
21757 gidformat='$gidformat'
21758 gidsign='$gidsign'
21759 gidsize='$gidsize'
21760 gidtype='$gidtype'
21761 glibpth='$glibpth'
21762 gmake='$gmake'
21763 gmtime_r_proto='$gmtime_r_proto'
21764 gnulibc_version='$gnulibc_version'
21765 grep='$grep'
21766 groupcat='$groupcat'
21767 groupstype='$groupstype'
21768 gzip='$gzip'
21769 h_fcntl='$h_fcntl'
21770 h_sysfile='$h_sysfile'
21771 hint='$hint'
21772 hostcat='$hostcat'
21773 html1dir='$html1dir'
21774 html1direxp='$html1direxp'
21775 html3dir='$html3dir'
21776 html3direxp='$html3direxp'
21777 i16size='$i16size'
21778 i16type='$i16type'
21779 i32size='$i32size'
21780 i32type='$i32type'
21781 i64size='$i64size'
21782 i64type='$i64type'
21783 i8size='$i8size'
21784 i8type='$i8type'
21785 i_arpainet='$i_arpainet'
21786 i_bsdioctl='$i_bsdioctl'
21787 i_crypt='$i_crypt'
21788 i_db='$i_db'
21789 i_dbm='$i_dbm'
21790 i_dirent='$i_dirent'
21791 i_dld='$i_dld'
21792 i_dlfcn='$i_dlfcn'
21793 i_fcntl='$i_fcntl'
21794 i_float='$i_float'
21795 i_fp='$i_fp'
21796 i_fp_class='$i_fp_class'
21797 i_gdbm='$i_gdbm'
21798 i_grp='$i_grp'
21799 i_ieeefp='$i_ieeefp'
21800 i_inttypes='$i_inttypes'
21801 i_langinfo='$i_langinfo'
21802 i_libutil='$i_libutil'
21803 i_limits='$i_limits'
21804 i_locale='$i_locale'
21805 i_machcthr='$i_machcthr'
21806 i_malloc='$i_malloc'
21807 i_math='$i_math'
21808 i_memory='$i_memory'
21809 i_mntent='$i_mntent'
21810 i_ndbm='$i_ndbm'
21811 i_netdb='$i_netdb'
21812 i_neterrno='$i_neterrno'
21813 i_netinettcp='$i_netinettcp'
21814 i_niin='$i_niin'
21815 i_poll='$i_poll'
21816 i_prot='$i_prot'
21817 i_pthread='$i_pthread'
21818 i_pwd='$i_pwd'
21819 i_rpcsvcdbm='$i_rpcsvcdbm'
21820 i_sfio='$i_sfio'
21821 i_sgtty='$i_sgtty'
21822 i_shadow='$i_shadow'
21823 i_socks='$i_socks'
21824 i_stdarg='$i_stdarg'
21825 i_stddef='$i_stddef'
21826 i_stdlib='$i_stdlib'
21827 i_string='$i_string'
21828 i_sunmath='$i_sunmath'
21829 i_sysaccess='$i_sysaccess'
21830 i_sysdir='$i_sysdir'
21831 i_sysfile='$i_sysfile'
21832 i_sysfilio='$i_sysfilio'
21833 i_sysin='$i_sysin'
21834 i_sysioctl='$i_sysioctl'
21835 i_syslog='$i_syslog'
21836 i_sysmman='$i_sysmman'
21837 i_sysmode='$i_sysmode'
21838 i_sysmount='$i_sysmount'
21839 i_sysndir='$i_sysndir'
21840 i_sysparam='$i_sysparam'
21841 i_sysresrc='$i_sysresrc'
21842 i_syssecrt='$i_syssecrt'
21843 i_sysselct='$i_sysselct'
21844 i_syssockio='$i_syssockio'
21845 i_sysstat='$i_sysstat'
21846 i_sysstatfs='$i_sysstatfs'
21847 i_sysstatvfs='$i_sysstatvfs'
21848 i_systime='$i_systime'
21849 i_systimek='$i_systimek'
21850 i_systimes='$i_systimes'
21851 i_systypes='$i_systypes'
21852 i_sysuio='$i_sysuio'
21853 i_sysun='$i_sysun'
21854 i_sysutsname='$i_sysutsname'
21855 i_sysvfs='$i_sysvfs'
21856 i_syswait='$i_syswait'
21857 i_termio='$i_termio'
21858 i_termios='$i_termios'
21859 i_time='$i_time'
21860 i_unistd='$i_unistd'
21861 i_ustat='$i_ustat'
21862 i_utime='$i_utime'
21863 i_values='$i_values'
21864 i_varargs='$i_varargs'
21865 i_varhdr='$i_varhdr'
21866 i_vfork='$i_vfork'
21867 ignore_versioned_solibs='$ignore_versioned_solibs'
21868 inc_version_list='$inc_version_list'
21869 inc_version_list_init='$inc_version_list_init'
21870 incpath='$incpath'
21871 inews='$inews'
21872 initialinstalllocation='$initialinstalllocation'
21873 installarchlib='$installarchlib'
21874 installbin='$installbin'
21875 installhtml1dir='$installhtml1dir'
21876 installhtml3dir='$installhtml3dir'
21877 installman1dir='$installman1dir'
21878 installman3dir='$installman3dir'
21879 installprefix='$installprefix'
21880 installprefixexp='$installprefixexp'
21881 installprivlib='$installprivlib'
21882 installscript='$installscript'
21883 installsitearch='$installsitearch'
21884 installsitebin='$installsitebin'
21885 installsitehtml1dir='$installsitehtml1dir'
21886 installsitehtml3dir='$installsitehtml3dir'
21887 installsitelib='$installsitelib'
21888 installsiteman1dir='$installsiteman1dir'
21889 installsiteman3dir='$installsiteman3dir'
21890 installsitescript='$installsitescript'
21891 installstyle='$installstyle'
21892 installusrbinperl='$installusrbinperl'
21893 installvendorarch='$installvendorarch'
21894 installvendorbin='$installvendorbin'
21895 installvendorhtml1dir='$installvendorhtml1dir'
21896 installvendorhtml3dir='$installvendorhtml3dir'
21897 installvendorlib='$installvendorlib'
21898 installvendorman1dir='$installvendorman1dir'
21899 installvendorman3dir='$installvendorman3dir'
21900 installvendorscript='$installvendorscript'
21901 intsize='$intsize'
21902 issymlink='$issymlink'
21903 ivdformat='$ivdformat'
21904 ivsize='$ivsize'
21905 ivtype='$ivtype'
21906 known_extensions='$known_extensions'
21907 ksh='$ksh'
21908 ld='$ld'
21909 lddlflags='$lddlflags'
21910 ldflags='$ldflags'
21911 ldflags_uselargefiles='$ldflags_uselargefiles'
21912 ldlibpthname='$ldlibpthname'
21913 less='$less'
21914 lib_ext='$lib_ext'
21915 libc='$libc'
21916 libperl='$libperl'
21917 libpth='$libpth'
21918 libs='$libs'
21919 libsdirs='$libsdirs'
21920 libsfiles='$libsfiles'
21921 libsfound='$libsfound'
21922 libspath='$libspath'
21923 libswanted='$libswanted'
21924 libswanted_uselargefiles='$libswanted_uselargefiles'
21925 line='$line'
21926 lint='$lint'
21927 lkflags='$lkflags'
21928 ln='$ln'
21929 lns='$lns'
21930 localtime_r_proto='$localtime_r_proto'
21931 locincpth='$locincpth'
21932 loclibpth='$loclibpth'
21933 longdblsize='$longdblsize'
21934 longlongsize='$longlongsize'
21935 longsize='$longsize'
21936 lp='$lp'
21937 lpr='$lpr'
21938 ls='$ls'
21939 lseeksize='$lseeksize'
21940 lseektype='$lseektype'
21941 mad='$mad'
21942 madlyh='$madlyh'
21943 madlyobj='$madlyobj'
21944 madlysrc='$madlysrc'
21945 mail='$mail'
21946 mailx='$mailx'
21947 make='$make'
21948 make_set_make='$make_set_make'
21949 mallocobj='$mallocobj'
21950 mallocsrc='$mallocsrc'
21951 malloctype='$malloctype'
21952 man1dir='$man1dir'
21953 man1direxp='$man1direxp'
21954 man1ext='$man1ext'
21955 man3dir='$man3dir'
21956 man3direxp='$man3direxp'
21957 man3ext='$man3ext'
21958 mips_type='$mips_type'
21959 mistrustnm='$mistrustnm'
21960 mkdir='$mkdir'
21961 mmaptype='$mmaptype'
21962 modetype='$modetype'
21963 more='$more'
21964 multiarch='$multiarch'
21965 mv='$mv'
21966 myarchname='$myarchname'
21967 mydomain='$mydomain'
21968 myhostname='$myhostname'
21969 myuname='$myuname'
21970 n='$n'
21971 need_va_copy='$need_va_copy'
21972 netdb_hlen_type='$netdb_hlen_type'
21973 netdb_host_type='$netdb_host_type'
21974 netdb_name_type='$netdb_name_type'
21975 netdb_net_type='$netdb_net_type'
21976 nm='$nm'
21977 nm_opt='$nm_opt'
21978 nm_so_opt='$nm_so_opt'
21979 nonxs_ext='$nonxs_ext'
21980 nroff='$nroff'
21981 nvEUformat='$nvEUformat'
21982 nvFUformat='$nvFUformat'
21983 nvGUformat='$nvGUformat'
21984 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21985 nveformat='$nveformat'
21986 nvfformat='$nvfformat'
21987 nvgformat='$nvgformat'
21988 nvsize='$nvsize'
21989 nvtype='$nvtype'
21990 o_nonblock='$o_nonblock'
21991 obj_ext='$obj_ext'
21992 old_pthread_create_joinable='$old_pthread_create_joinable'
21993 optimize='$optimize'
21994 orderlib='$orderlib'
21995 osname='$osname'
21996 osvers='$osvers'
21997 otherlibdirs='$otherlibdirs'
21998 package='$package'
21999 pager='$pager'
22000 passcat='$passcat'
22001 patchlevel='$patchlevel'
22002 path_sep='$path_sep'
22003 perl5='$perl5'
22004 perl='$perl'
22005 perl_patchlevel='$perl_patchlevel'
22006 perladmin='$perladmin'
22007 perllibs='$perllibs'
22008 perlpath='$perlpath'
22009 pg='$pg'
22010 phostname='$phostname'
22011 pidtype='$pidtype'
22012 plibpth='$plibpth'
22013 pmake='$pmake'
22014 pr='$pr'
22015 prefix='$prefix'
22016 prefixexp='$prefixexp'
22017 privlib='$privlib'
22018 privlibexp='$privlibexp'
22019 procselfexe='$procselfexe'
22020 prototype='$prototype'
22021 ptrsize='$ptrsize'
22022 quadkind='$quadkind'
22023 quadtype='$quadtype'
22024 randbits='$randbits'
22025 randfunc='$randfunc'
22026 random_r_proto='$random_r_proto'
22027 randseedtype='$randseedtype'
22028 ranlib='$ranlib'
22029 rd_nodata='$rd_nodata'
22030 readdir64_r_proto='$readdir64_r_proto'
22031 readdir_r_proto='$readdir_r_proto'
22032 revision='$revision'
22033 rm='$rm'
22034 rmail='$rmail'
22035 run='$run'
22036 runnm='$runnm'
22037 sPRIEUldbl='$sPRIEUldbl'
22038 sPRIFUldbl='$sPRIFUldbl'
22039 sPRIGUldbl='$sPRIGUldbl'
22040 sPRIXU64='$sPRIXU64'
22041 sPRId64='$sPRId64'
22042 sPRIeldbl='$sPRIeldbl'
22043 sPRIfldbl='$sPRIfldbl'
22044 sPRIgldbl='$sPRIgldbl'
22045 sPRIi64='$sPRIi64'
22046 sPRIo64='$sPRIo64'
22047 sPRIu64='$sPRIu64'
22048 sPRIx64='$sPRIx64'
22049 sSCNfldbl='$sSCNfldbl'
22050 sched_yield='$sched_yield'
22051 scriptdir='$scriptdir'
22052 scriptdirexp='$scriptdirexp'
22053 sed='$sed'
22054 seedfunc='$seedfunc'
22055 selectminbits='$selectminbits'
22056 selecttype='$selecttype'
22057 sendmail='$sendmail'
22058 setgrent_r_proto='$setgrent_r_proto'
22059 sethostent_r_proto='$sethostent_r_proto'
22060 setlocale_r_proto='$setlocale_r_proto'
22061 setnetent_r_proto='$setnetent_r_proto'
22062 setprotoent_r_proto='$setprotoent_r_proto'
22063 setpwent_r_proto='$setpwent_r_proto'
22064 setservent_r_proto='$setservent_r_proto'
22065 sh='$sh'
22066 shar='$shar'
22067 sharpbang='$sharpbang'
22068 shmattype='$shmattype'
22069 shortsize='$shortsize'
22070 shrpenv='$shrpenv'
22071 shsharp='$shsharp'
22072 sig_count='$sig_count'
22073 sig_name='$sig_name'
22074 sig_name_init='$sig_name_init'
22075 sig_num='$sig_num'
22076 sig_num_init='$sig_num_init'
22077 sig_size='$sig_size'
22078 signal_t='$signal_t'
22079 sitearch='$sitearch'
22080 sitearchexp='$sitearchexp'
22081 sitebin='$sitebin'
22082 sitebinexp='$sitebinexp'
22083 sitehtml1dir='$sitehtml1dir'
22084 sitehtml1direxp='$sitehtml1direxp'
22085 sitehtml3dir='$sitehtml3dir'
22086 sitehtml3direxp='$sitehtml3direxp'
22087 sitelib='$sitelib'
22088 sitelib_stem='$sitelib_stem'
22089 sitelibexp='$sitelibexp'
22090 siteman1dir='$siteman1dir'
22091 siteman1direxp='$siteman1direxp'
22092 siteman3dir='$siteman3dir'
22093 siteman3direxp='$siteman3direxp'
22094 siteprefix='$siteprefix'
22095 siteprefixexp='$siteprefixexp'
22096 sitescript='$sitescript'
22097 sitescriptexp='$sitescriptexp'
22098 sizesize='$sizesize'
22099 sizetype='$sizetype'
22100 sleep='$sleep'
22101 smail='$smail'
22102 so='$so'
22103 sockethdr='$sockethdr'
22104 socketlib='$socketlib'
22105 socksizetype='$socksizetype'
22106 sort='$sort'
22107 spackage='$spackage'
22108 spitshell='$spitshell'
22109 srand48_r_proto='$srand48_r_proto'
22110 srandom_r_proto='$srandom_r_proto'
22111 src='$src'
22112 ssizetype='$ssizetype'
22113 startperl='$startperl'
22114 startsh='$startsh'
22115 static_ext='$static_ext'
22116 stdchar='$stdchar'
22117 stdio_base='$stdio_base'
22118 stdio_bufsiz='$stdio_bufsiz'
22119 stdio_cnt='$stdio_cnt'
22120 stdio_filbuf='$stdio_filbuf'
22121 stdio_ptr='$stdio_ptr'
22122 stdio_stream_array='$stdio_stream_array'
22123 strerror_r_proto='$strerror_r_proto'
22124 strings='$strings'
22125 submit='$submit'
22126 subversion='$subversion'
22127 sysman='$sysman'
22128 tail='$tail'
22129 tar='$tar'
22130 targetarch='$targetarch'
22131 tbl='$tbl'
22132 tee='$tee'
22133 test='$test'
22134 timeincl='$timeincl'
22135 timetype='$timetype'
22136 tmpnam_r_proto='$tmpnam_r_proto'
22137 to='$to'
22138 touch='$touch'
22139 tr='$tr'
22140 trnl='$trnl'
22141 troff='$troff'
22142 ttyname_r_proto='$ttyname_r_proto'
22143 u16size='$u16size'
22144 u16type='$u16type'
22145 u32size='$u32size'
22146 u32type='$u32type'
22147 u64size='$u64size'
22148 u64type='$u64type'
22149 u8size='$u8size'
22150 u8type='$u8type'
22151 uidformat='$uidformat'
22152 uidsign='$uidsign'
22153 uidsize='$uidsize'
22154 uidtype='$uidtype'
22155 uname='$uname'
22156 uniq='$uniq'
22157 uquadtype='$uquadtype'
22158 use5005threads='$use5005threads'
22159 use64bitall='$use64bitall'
22160 use64bitint='$use64bitint'
22161 usecrosscompile='$usecrosscompile'
22162 usedl='$usedl'
22163 usefaststdio='$usefaststdio'
22164 useithreads='$useithreads'
22165 uselargefiles='$uselargefiles'
22166 uselongdouble='$uselongdouble'
22167 usemallocwrap='$usemallocwrap'
22168 usemorebits='$usemorebits'
22169 usemultiplicity='$usemultiplicity'
22170 usemymalloc='$usemymalloc'
22171 usenm='$usenm'
22172 useopcode='$useopcode'
22173 useperlio='$useperlio'
22174 useposix='$useposix'
22175 usereentrant='$usereentrant'
22176 userelocatableinc='$userelocatableinc'
22177 usesfio='$usesfio'
22178 useshrplib='$useshrplib'
22179 usesitecustomize='$usesitecustomize'
22180 usesocks='$usesocks'
22181 usethreads='$usethreads'
22182 usevendorprefix='$usevendorprefix'
22183 usevfork='$usevfork'
22184 usrinc='$usrinc'
22185 uuname='$uuname'
22186 uvXUformat='$uvXUformat'
22187 uvoformat='$uvoformat'
22188 uvsize='$uvsize'
22189 uvtype='$uvtype'
22190 uvuformat='$uvuformat'
22191 uvxformat='$uvxformat'
22192 vendorarch='$vendorarch'
22193 vendorarchexp='$vendorarchexp'
22194 vendorbin='$vendorbin'
22195 vendorbinexp='$vendorbinexp'
22196 vendorhtml1dir='$vendorhtml1dir'
22197 vendorhtml1direxp='$vendorhtml1direxp'
22198 vendorhtml3dir='$vendorhtml3dir'
22199 vendorhtml3direxp='$vendorhtml3direxp'
22200 vendorlib='$vendorlib'
22201 vendorlib_stem='$vendorlib_stem'
22202 vendorlibexp='$vendorlibexp'
22203 vendorman1dir='$vendorman1dir'
22204 vendorman1direxp='$vendorman1direxp'
22205 vendorman3dir='$vendorman3dir'
22206 vendorman3direxp='$vendorman3direxp'
22207 vendorprefix='$vendorprefix'
22208 vendorprefixexp='$vendorprefixexp'
22209 vendorscript='$vendorscript'
22210 vendorscriptexp='$vendorscriptexp'
22211 version='$version'
22212 version_patchlevel_string='$version_patchlevel_string'
22213 versiononly='$versiononly'
22214 vi='$vi'
22215 voidflags='$voidflags'
22216 xlibpth='$xlibpth'
22217 yacc='$yacc'
22218 yaccflags='$yaccflags'
22219 zcat='$zcat'
22220 zip='$zip'
22221 EOT
22222
22223 : Add in command line options if available
22224 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22225
22226 : add special variables
22227 $test -f $src/patchlevel.h && \
22228 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22229 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22230 echo "PERL_CONFIG_SH=true" >>config.sh
22231
22232 : propagate old symbols
22233 if $test -f UU/config.sh; then
22234         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22235         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22236         $sort | $uniq -u >UU/oldsyms
22237         set X `cat UU/oldsyms`
22238         shift
22239         case $# in
22240         0) ;;
22241         *)
22242                 cat <<EOM
22243 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22244 EOM
22245                 echo "# Variables propagated from previous config.sh file." >>config.sh
22246                 for sym in `cat UU/oldsyms`; do
22247                         echo "    Propagating $hint variable "'$'"$sym..."
22248                         eval 'tmp="$'"${sym}"'"'
22249                         echo "$tmp" | \
22250                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22251                 done
22252                 ;;
22253         esac
22254 fi
22255
22256 : Finish up by extracting the .SH files
22257 case "$alldone" in
22258 exit)
22259         $rm -rf UU
22260         echo "Extraction done."
22261         exit 0
22262         ;;
22263 cont)
22264         ;;
22265 '')
22266         dflt=''
22267         nostick=true
22268         $cat <<EOM
22269
22270 If you'd like to make any changes to the config.sh file before I begin
22271 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22272
22273 EOM
22274         rp="Press return or use a shell escape to edit config.sh:"
22275         . UU/myread
22276         nostick=''
22277         case "$ans" in
22278         '') ;;
22279         *) : in case they cannot read
22280                 sh 1>&4 -c "$ans";;
22281         esac
22282         ;;
22283 esac
22284
22285 : if this fails, just run all the .SH files by hand
22286 . ./config.sh
22287
22288 echo " "
22289 exec 1>&4
22290 pwd=`pwd`
22291 . ./UU/extract
22292 cd "$pwd"
22293
22294 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22295         dflt=y
22296         case "$silent" in
22297         true) ;;
22298         *)
22299                 $cat <<EOM
22300
22301 Now you need to generate make dependencies by running "$make depend".
22302 You might prefer to run it in background: "$make depend > makedepend.out &"
22303 It can take a while, so you might not want to run it right now.
22304
22305 EOM
22306                 ;;
22307         esac
22308         rp="Run $make depend now?"
22309         . UU/myread
22310         case "$ans" in
22311         y*)
22312                 $make depend && echo "Now you must run '$make'."
22313                 ;;
22314         *)
22315                 echo "You must run '$make depend' then '$make'."
22316                 ;;
22317         esac
22318 elif test -f [Mm]akefile; then
22319         echo " "
22320         echo "Now you must run a $make."
22321 else
22322         echo "Configure done."
22323 fi
22324
22325 if $test -f Policy.sh; then
22326     $cat <<EOM
22327
22328 If you compile $package on a different machine or from a different object
22329 directory, copy the Policy.sh file from this object directory to the
22330 new one before you run Configure -- this will help you with most of
22331 the policy defaults.
22332
22333 EOM
22334 fi
22335 if $test -f config.msg; then
22336     echo "Hmm.  I also noted the following information while running:"
22337     echo " "
22338     $cat config.msg >&4
22339     $rm -f config.msg
22340 fi
22341 $rm -f kit*isdone ark*isdone
22342 $rm -rf UU
22343
22344 : End of Configure
22345