This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
disable 'split /(?{ split "" })/' test until recursive split is fixed
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Mon Apr  3 12:00:10 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_dbl_dig=''
387 d_dbminitproto=''
388 d_difftime=''
389 d_dirfd=''
390 d_dlerror=''
391 d_dlopen=''
392 d_dlsymun=''
393 d_dosuid=''
394 d_suidsafe=''
395 d_drand48_r=''
396 drand48_r_proto=''
397 d_drand48proto=''
398 d_dup2=''
399 d_eaccess=''
400 d_endgrent=''
401 d_endgrent_r=''
402 endgrent_r_proto=''
403 d_endhent=''
404 d_endhostent_r=''
405 endhostent_r_proto=''
406 d_endnent=''
407 d_endnetent_r=''
408 endnetent_r_proto=''
409 d_endpent=''
410 d_endprotoent_r=''
411 endprotoent_r_proto=''
412 d_endpwent=''
413 d_endpwent_r=''
414 endpwent_r_proto=''
415 d_endsent=''
416 d_endservent_r=''
417 endservent_r_proto=''
418 d_faststdio=''
419 d_fchdir=''
420 d_fchmod=''
421 d_fchown=''
422 d_fcntl=''
423 d_fcntl_can_lock=''
424 d_fd_macros=''
425 d_fd_set=''
426 d_fds_bits=''
427 d_fgetpos=''
428 d_finite=''
429 d_finitel=''
430 d_flexfnam=''
431 d_flock=''
432 d_flockproto=''
433 d_fork=''
434 d_fp_class=''
435 d_fpclass=''
436 d_fpclassify=''
437 d_fpclassl=''
438 d_fpos64_t=''
439 d_frexpl=''
440 d_fs_data_s=''
441 d_fseeko=''
442 d_fsetpos=''
443 d_fstatfs=''
444 d_fsync=''
445 d_ftello=''
446 d_ftime=''
447 d_gettimeod=''
448 d_futimes=''
449 d_Gconvert=''
450 d_getcwd=''
451 d_getespwnam=''
452 d_getfsstat=''
453 d_getgrent=''
454 d_getgrent_r=''
455 getgrent_r_proto=''
456 d_getgrgid_r=''
457 getgrgid_r_proto=''
458 d_getgrnam_r=''
459 getgrnam_r_proto=''
460 d_getgrps=''
461 d_gethbyaddr=''
462 d_gethbyname=''
463 d_gethent=''
464 aphostname=''
465 d_gethname=''
466 d_phostname=''
467 d_uname=''
468 d_gethostbyaddr_r=''
469 gethostbyaddr_r_proto=''
470 d_gethostbyname_r=''
471 gethostbyname_r_proto=''
472 d_gethostent_r=''
473 gethostent_r_proto=''
474 d_gethostprotos=''
475 d_getitimer=''
476 d_getlogin=''
477 d_getlogin_r=''
478 getlogin_r_proto=''
479 d_getmnt=''
480 d_getmntent=''
481 d_getnbyaddr=''
482 d_getnbyname=''
483 d_getnent=''
484 d_getnetbyaddr_r=''
485 getnetbyaddr_r_proto=''
486 d_getnetbyname_r=''
487 getnetbyname_r_proto=''
488 d_getnetent_r=''
489 getnetent_r_proto=''
490 d_getnetprotos=''
491 d_getpagsz=''
492 d_getpent=''
493 d_getpgid=''
494 d_getpgrp2=''
495 d_bsdgetpgrp=''
496 d_getpgrp=''
497 d_getppid=''
498 d_getprior=''
499 d_getpbyname=''
500 d_getpbynumber=''
501 d_getprotobyname_r=''
502 getprotobyname_r_proto=''
503 d_getprotobynumber_r=''
504 getprotobynumber_r_proto=''
505 d_getprotoent_r=''
506 getprotoent_r_proto=''
507 d_getprotoprotos=''
508 d_getprpwnam=''
509 d_getpwent=''
510 d_getpwent_r=''
511 getpwent_r_proto=''
512 d_getpwnam_r=''
513 getpwnam_r_proto=''
514 d_getpwuid_r=''
515 getpwuid_r_proto=''
516 d_getsent=''
517 d_getservbyname_r=''
518 getservbyname_r_proto=''
519 d_getservbyport_r=''
520 getservbyport_r_proto=''
521 d_getservent_r=''
522 getservent_r_proto=''
523 d_getservprotos=''
524 d_getspnam=''
525 d_getspnam_r=''
526 getspnam_r_proto=''
527 d_getsbyname=''
528 d_getsbyport=''
529 d_gmtime_r=''
530 gmtime_r_proto=''
531 d_gnulibc=''
532 gnulibc_version=''
533 d_hasmntopt=''
534 d_htonl=''
535 d_ilogbl=''
536 d_inetaton=''
537 d_int64_t=''
538 d_isascii=''
539 d_isfinite=''
540 d_isinf=''
541 d_isnan=''
542 d_isnanl=''
543 d_killpg=''
544 d_lchown=''
545 d_ldbl_dig=''
546 d_libm_lib_version=''
547 d_link=''
548 d_localtime_r=''
549 localtime_r_proto=''
550 d_locconv=''
551 d_lockf=''
552 d_longdbl=''
553 longdblsize=''
554 d_longlong=''
555 longlongsize=''
556 d_lseekproto=''
557 d_lstat=''
558 d_madvise=''
559 d_malloc_good_size=''
560 d_malloc_size=''
561 d_mblen=''
562 d_mbstowcs=''
563 d_mbtowc=''
564 d_memchr=''
565 d_memcmp=''
566 d_memcpy=''
567 d_memmove=''
568 d_memset=''
569 d_mkdir=''
570 d_mkdtemp=''
571 d_mkfifo=''
572 d_mkstemp=''
573 d_mkstemps=''
574 d_mktime=''
575 d_mmap=''
576 mmaptype=''
577 d_modfl=''
578 d_modfl_pow32_bug=''
579 d_modflproto=''
580 d_mprotect=''
581 d_msg=''
582 d_msgctl=''
583 d_msgget=''
584 d_msghdr_s=''
585 d_msgrcv=''
586 d_msgsnd=''
587 d_msync=''
588 d_munmap=''
589 d_nice=''
590 d_nl_langinfo=''
591 d_off64_t=''
592 d_open3=''
593 d_fpathconf=''
594 d_pathconf=''
595 d_pause=''
596 d_pipe=''
597 d_poll=''
598 d_portable=''
599 d_procselfexe=''
600 procselfexe=''
601 d_old_pthread_create_joinable=''
602 old_pthread_create_joinable=''
603 d_pthread_atfork=''
604 d_pthread_attr_setscope=''
605 d_pthread_yield=''
606 d_sched_yield=''
607 sched_yield=''
608 d_qgcvt=''
609 d_random_r=''
610 random_r_proto=''
611 d_readdir64_r=''
612 readdir64_r_proto=''
613 d_readdir=''
614 d_rewinddir=''
615 d_seekdir=''
616 d_telldir=''
617 d_readdir_r=''
618 readdir_r_proto=''
619 d_readlink=''
620 d_readv=''
621 d_recvmsg=''
622 d_rename=''
623 d_rmdir=''
624 d_safebcpy=''
625 d_safemcpy=''
626 d_sanemcmp=''
627 d_sbrkproto=''
628 d_scalbnl=''
629 d_select=''
630 d_sem=''
631 d_semctl=''
632 d_semget=''
633 d_semop=''
634 d_sendmsg=''
635 d_setegid=''
636 d_seteuid=''
637 d_setgrent=''
638 d_setgrent_r=''
639 setgrent_r_proto=''
640 d_setgrps=''
641 d_sethent=''
642 d_sethostent_r=''
643 sethostent_r_proto=''
644 d_setitimer=''
645 d_setlinebuf=''
646 d_setlocale=''
647 d_setlocale_r=''
648 setlocale_r_proto=''
649 d_setnent=''
650 d_setnetent_r=''
651 setnetent_r_proto=''
652 d_setpent=''
653 d_setpgid=''
654 d_setpgrp2=''
655 d_bsdsetpgrp=''
656 d_setpgrp=''
657 d_setprior=''
658 d_setproctitle=''
659 d_setprotoent_r=''
660 setprotoent_r_proto=''
661 d_setpwent=''
662 d_setpwent_r=''
663 setpwent_r_proto=''
664 d_setregid=''
665 d_setresgid=''
666 d_setresuid=''
667 d_setreuid=''
668 d_setrgid=''
669 d_setruid=''
670 d_setsent=''
671 d_setservent_r=''
672 setservent_r_proto=''
673 d_setsid=''
674 d_setvbuf=''
675 d_sfio=''
676 usesfio=''
677 d_shm=''
678 d_shmat=''
679 d_shmatprototype=''
680 shmattype=''
681 d_shmctl=''
682 d_shmdt=''
683 d_shmget=''
684 d_sigaction=''
685 d_sigprocmask=''
686 d_sigsetjmp=''
687 usesitecustomize=''
688 d_snprintf=''
689 d_vsnprintf=''
690 d_sockatmark=''
691 d_sockatmarkproto=''
692 d_msg_ctrunc=''
693 d_msg_dontroute=''
694 d_msg_oob=''
695 d_msg_peek=''
696 d_msg_proxy=''
697 d_oldsock=''
698 d_scm_rights=''
699 d_socket=''
700 d_sockpair=''
701 sockethdr=''
702 socketlib=''
703 d_socklen_t=''
704 d_socks5_init=''
705 d_sprintf_returns_strlen=''
706 d_sqrtl=''
707 d_srand48_r=''
708 srand48_r_proto=''
709 d_srandom_r=''
710 srandom_r_proto=''
711 d_sresgproto=''
712 d_sresuproto=''
713 d_statblks=''
714 d_statfs_f_flags=''
715 d_statfs_s=''
716 d_fstatvfs=''
717 d_statvfs=''
718 d_stdio_cnt_lval=''
719 d_stdio_ptr_lval=''
720 d_stdio_ptr_lval_nochange_cnt=''
721 d_stdio_ptr_lval_sets_cnt=''
722 d_stdiobase=''
723 d_stdstdio=''
724 stdio_base=''
725 stdio_bufsiz=''
726 stdio_cnt=''
727 stdio_filbuf=''
728 stdio_ptr=''
729 d_index=''
730 d_strchr=''
731 d_strcoll=''
732 d_strctcpy=''
733 d_strerrm=''
734 d_strerror=''
735 d_sysernlst=''
736 d_syserrlst=''
737 d_strerror_r=''
738 strerror_r_proto=''
739 d_strftime=''
740 d_strlcat=''
741 d_strlcpy=''
742 d_strtod=''
743 d_strtol=''
744 d_strtold=''
745 d_strtoll=''
746 d_strtoq=''
747 d_strtoul=''
748 d_strtoull=''
749 d_strtouq=''
750 d_strxfrm=''
751 d_symlink=''
752 d_syscall=''
753 d_syscallproto=''
754 d_sysconf=''
755 d_system=''
756 d_tcgetpgrp=''
757 d_tcsetpgrp=''
758 d_telldirproto=''
759 d_time=''
760 timetype=''
761 clocktype=''
762 d_times=''
763 d_tmpnam_r=''
764 tmpnam_r_proto=''
765 d_truncate=''
766 d_ttyname_r=''
767 ttyname_r_proto=''
768 d_tzname=''
769 d_u32align=''
770 d_ualarm=''
771 d_umask=''
772 d_semctl_semid_ds=''
773 d_semctl_semun=''
774 d_union_semun=''
775 d_unordered=''
776 d_unsetenv=''
777 d_usleep=''
778 d_usleepproto=''
779 d_ustat=''
780 d_vfork=''
781 usevfork=''
782 d_voidsig=''
783 signal_t=''
784 d_volatile=''
785 d_charvspr=''
786 d_vprintf=''
787 d_wait4=''
788 d_waitpid=''
789 d_wcstombs=''
790 d_wctomb=''
791 d_writev=''
792 dlext=''
793 cccdlflags=''
794 ccdlflags=''
795 dlsrc=''
796 ld=''
797 lddlflags=''
798 usedl=''
799 doublesize=''
800 ebcdic=''
801 fflushNULL=''
802 fflushall=''
803 fpossize=''
804 fpostype=''
805 gccansipedantic=''
806 gccosandvers=''
807 gccversion=''
808 gidformat=''
809 gidsign=''
810 gidsize=''
811 gidtype=''
812 groupstype=''
813 h_fcntl=''
814 h_sysfile=''
815 html1dir=''
816 html1direxp=''
817 installhtml1dir=''
818 html3dir=''
819 html3direxp=''
820 installhtml3dir=''
821 i_arpainet=''
822 i_crypt=''
823 db_hashtype=''
824 db_prefixtype=''
825 db_version_major=''
826 db_version_minor=''
827 db_version_patch=''
828 i_db=''
829 i_dbm=''
830 i_rpcsvcdbm=''
831 d_dirnamlen=''
832 direntrytype=''
833 i_dirent=''
834 i_dld=''
835 i_dlfcn=''
836 i_fcntl=''
837 i_float=''
838 i_fp=''
839 i_fp_class=''
840 i_gdbm=''
841 d_grpasswd=''
842 i_grp=''
843 i_ieeefp=''
844 i_inttypes=''
845 i_langinfo=''
846 i_libutil=''
847 i_limits=''
848 i_locale=''
849 i_machcthr=''
850 i_malloc=''
851 i_math=''
852 i_memory=''
853 i_mntent=''
854 i_ndbm=''
855 i_netdb=''
856 i_neterrno=''
857 i_netinettcp=''
858 i_niin=''
859 i_sysin=''
860 i_poll=''
861 i_prot=''
862 i_pthread=''
863 d_pwage=''
864 d_pwchange=''
865 d_pwclass=''
866 d_pwcomment=''
867 d_pwexpire=''
868 d_pwgecos=''
869 d_pwpasswd=''
870 d_pwquota=''
871 i_pwd=''
872 i_sfio=''
873 i_shadow=''
874 i_socks=''
875 i_stddef=''
876 i_stdlib=''
877 i_string=''
878 strings=''
879 i_sunmath=''
880 i_sysaccess=''
881 i_sysdir=''
882 i_sysfile=''
883 d_voidtty=''
884 i_bsdioctl=''
885 i_sysfilio=''
886 i_sysioctl=''
887 i_syssockio=''
888 i_syslog=''
889 i_sysmman=''
890 i_sysmode=''
891 i_sysmount=''
892 i_sysndir=''
893 i_sysparam=''
894 i_sysresrc=''
895 i_syssecrt=''
896 i_sysselct=''
897 i_sysstat=''
898 i_sysstatfs=''
899 i_sysstatvfs=''
900 i_systimes=''
901 i_systypes=''
902 i_sysuio=''
903 i_sysun=''
904 i_sysutsname=''
905 i_sysvfs=''
906 i_syswait=''
907 i_sgtty=''
908 i_termio=''
909 i_termios=''
910 d_tm_tm_gmtoff=''
911 d_tm_tm_zone=''
912 i_systime=''
913 i_systimek=''
914 i_time=''
915 timeincl=''
916 i_unistd=''
917 i_ustat=''
918 i_utime=''
919 i_values=''
920 i_stdarg=''
921 i_varargs=''
922 i_varhdr=''
923 i_vfork=''
924 d_inc_version_list=''
925 inc_version_list=''
926 inc_version_list_init=''
927 installprefix=''
928 installprefixexp=''
929 installstyle=''
930 installusrbinperl=''
931 intsize=''
932 longsize=''
933 shortsize=''
934 issymlink=''
935 libc=''
936 ldlibpthname=''
937 libperl=''
938 shrpenv=''
939 useshrplib=''
940 glibpth=''
941 libpth=''
942 loclibpth=''
943 plibpth=''
944 xlibpth=''
945 ignore_versioned_solibs=''
946 libs=''
947 libsdirs=''
948 libsfiles=''
949 libsfound=''
950 libspath=''
951 lns=''
952 d_PRIEUldbl=''
953 d_PRIFUldbl=''
954 d_PRIGUldbl=''
955 d_PRIeldbl=''
956 d_PRIfldbl=''
957 d_PRIgldbl=''
958 d_SCNfldbl=''
959 sPRIEUldbl=''
960 sPRIFUldbl=''
961 sPRIGUldbl=''
962 sPRIeldbl=''
963 sPRIfldbl=''
964 sPRIgldbl=''
965 sSCNfldbl=''
966 lseeksize=''
967 lseektype=''
968 mad=''
969 madlyh=''
970 madlyobj=''
971 madlysrc=''
972 make_set_make=''
973 d_mymalloc=''
974 freetype=''
975 mallocobj=''
976 mallocsrc=''
977 malloctype=''
978 usemallocwrap=''
979 usemymalloc=''
980 installman1dir=''
981 man1dir=''
982 man1direxp=''
983 man1ext=''
984 installman3dir=''
985 man3dir=''
986 man3direxp=''
987 man3ext=''
988 modetype=''
989 multiarch=''
990 mydomain=''
991 myhostname=''
992 phostname=''
993 c=''
994 n=''
995 d_eofnblk=''
996 eagain=''
997 o_nonblock=''
998 rd_nodata=''
999 need_va_copy=''
1000 netdb_hlen_type=''
1001 netdb_host_type=''
1002 netdb_name_type=''
1003 netdb_net_type=''
1004 groupcat=''
1005 hostcat=''
1006 passcat=''
1007 orderlib=''
1008 ranlib=''
1009 d_perl_otherlibdirs=''
1010 otherlibdirs=''
1011 package=''
1012 spackage=''
1013 pager=''
1014 api_revision=''
1015 api_subversion=''
1016 api_version=''
1017 api_versionstring=''
1018 patchlevel=''
1019 perl_patchlevel=''
1020 revision=''
1021 subversion=''
1022 version=''
1023 version_patchlevel_string=''
1024 perl5=''
1025 perladmin=''
1026 perlpath=''
1027 d_nv_preserves_uv=''
1028 d_nv_zero_is_allbits_zero=''
1029 i16size=''
1030 i16type=''
1031 i32size=''
1032 i32type=''
1033 i64size=''
1034 i64type=''
1035 i8size=''
1036 i8type=''
1037 ivsize=''
1038 ivtype=''
1039 nv_preserves_uv_bits=''
1040 nvsize=''
1041 nvtype=''
1042 u16size=''
1043 u16type=''
1044 u32size=''
1045 u32type=''
1046 u64size=''
1047 u64type=''
1048 u8size=''
1049 u8type=''
1050 uvsize=''
1051 uvtype=''
1052 ivdformat=''
1053 nvEUformat=''
1054 nvFUformat=''
1055 nvGUformat=''
1056 nveformat=''
1057 nvfformat=''
1058 nvgformat=''
1059 uvXUformat=''
1060 uvoformat=''
1061 uvuformat=''
1062 uvxformat=''
1063 pidtype=''
1064 prefix=''
1065 prefixexp=''
1066 installprivlib=''
1067 privlib=''
1068 privlibexp=''
1069 prototype=''
1070 ptrsize=''
1071 d_PRIXU64=''
1072 d_PRId64=''
1073 d_PRIi64=''
1074 d_PRIo64=''
1075 d_PRIu64=''
1076 d_PRIx64=''
1077 sPRIXU64=''
1078 sPRId64=''
1079 sPRIi64=''
1080 sPRIo64=''
1081 sPRIu64=''
1082 sPRIx64=''
1083 d_quad=''
1084 quadkind=''
1085 quadtype=''
1086 uquadtype=''
1087 drand01=''
1088 randbits=''
1089 randfunc=''
1090 randseedtype=''
1091 seedfunc=''
1092 installscript=''
1093 scriptdir=''
1094 scriptdirexp=''
1095 selectminbits=''
1096 selecttype=''
1097 sh=''
1098 sig_count=''
1099 sig_name=''
1100 sig_name_init=''
1101 sig_num=''
1102 sig_num_init=''
1103 sig_size=''
1104 d_sitearch=''
1105 installsitearch=''
1106 sitearch=''
1107 sitearchexp=''
1108 installsitebin=''
1109 sitebin=''
1110 sitebinexp=''
1111 installsitehtml1dir=''
1112 sitehtml1dir=''
1113 sitehtml1direxp=''
1114 installsitehtml3dir=''
1115 sitehtml3dir=''
1116 sitehtml3direxp=''
1117 installsitelib=''
1118 sitelib=''
1119 sitelib_stem=''
1120 sitelibexp=''
1121 installsiteman1dir=''
1122 siteman1dir=''
1123 siteman1direxp=''
1124 installsiteman3dir=''
1125 siteman3dir=''
1126 siteman3direxp=''
1127 siteprefix=''
1128 siteprefixexp=''
1129 installsitescript=''
1130 sitescript=''
1131 sitescriptexp=''
1132 sizesize=''
1133 sizetype=''
1134 so=''
1135 socksizetype=''
1136 sharpbang=''
1137 shsharp=''
1138 spitshell=''
1139 src=''
1140 ssizetype=''
1141 startperl=''
1142 startsh=''
1143 stdchar=''
1144 d_stdio_stream_array=''
1145 stdio_stream_array=''
1146 sysman=''
1147 trnl=''
1148 uidformat=''
1149 uidsign=''
1150 uidsize=''
1151 uidtype=''
1152 archname64=''
1153 use64bitall=''
1154 use64bitint=''
1155 usefaststdio=''
1156 ccflags_uselargefiles=''
1157 ldflags_uselargefiles=''
1158 libswanted_uselargefiles=''
1159 uselargefiles=''
1160 uselongdouble=''
1161 usemorebits=''
1162 usemultiplicity=''
1163 nm_opt=''
1164 nm_so_opt=''
1165 runnm=''
1166 usenm=''
1167 useperlio=''
1168 usesocks=''
1169 d_oldpthreads=''
1170 use5005threads=''
1171 useithreads=''
1172 usereentrant=''
1173 usethreads=''
1174 incpath=''
1175 mips_type=''
1176 usrinc=''
1177 d_vendorarch=''
1178 installvendorarch=''
1179 vendorarch=''
1180 vendorarchexp=''
1181 d_vendorbin=''
1182 installvendorbin=''
1183 vendorbin=''
1184 vendorbinexp=''
1185 installvendorhtml1dir=''
1186 vendorhtml1dir=''
1187 vendorhtml1direxp=''
1188 installvendorhtml3dir=''
1189 vendorhtml3dir=''
1190 vendorhtml3direxp=''
1191 d_vendorlib=''
1192 installvendorlib=''
1193 vendorlib=''
1194 vendorlib_stem=''
1195 vendorlibexp=''
1196 installvendorman1dir=''
1197 vendorman1dir=''
1198 vendorman1direxp=''
1199 installvendorman3dir=''
1200 vendorman3dir=''
1201 vendorman3direxp=''
1202 usevendorprefix=''
1203 vendorprefix=''
1204 vendorprefixexp=''
1205 d_vendorscript=''
1206 installvendorscript=''
1207 vendorscript=''
1208 vendorscriptexp=''
1209 versiononly=''
1210 defvoidused=''
1211 voidflags=''
1212 yacc=''
1213 yaccflags=''
1214 CONFIG=''
1215
1216 define='define'
1217 undef='undef'
1218 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1219 rmlist=''
1220
1221 : We must find out about Eunice early
1222 eunicefix=':'
1223 if test -f /etc/unixtovms; then
1224         eunicefix=/etc/unixtovms
1225 fi
1226 if test -f /etc/unixtovms.exe; then
1227         eunicefix=/etc/unixtovms.exe
1228 fi
1229
1230 : Set executable suffix now -- needed before hints available
1231 if test -f "/libs/version.library"; then
1232 : Amiga OS
1233     _exe=""
1234 elif test -f "/system/gnu_library/bin/ar.pm"; then
1235 : Stratus VOS
1236     _exe=".pm"
1237 elif test -n "$DJGPP"; then
1238 : DOS DJGPP
1239     _exe=".exe"
1240 elif test -d c:/. -o -n "$is_os2" ; then
1241 : OS/2 or cygwin
1242     _exe=".exe"
1243 fi
1244
1245 i_whoami=''
1246 ccname=''
1247 ccversion=''
1248 perllibs=''
1249 : set useposix=false in your hint file to disable the POSIX extension.
1250 useposix=true
1251 : set useopcode=false in your hint file to disable the Opcode extension.
1252 useopcode=true
1253 : Trailing extension.  Override this in a hint file, if needed.
1254 : Extra object files, if any, needed on this platform.
1255 archobjs=''
1256 archname=''
1257 : Possible local include directories to search.
1258 : Set locincpth to "" in a hint file to defeat local include searches.
1259 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1260 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1261 :
1262 : no include file wanted by default
1263 inclwanted=''
1264
1265 groupstype=''
1266 libnames=''
1267 : change the next line if compiling for Xenix/286 on Xenix/386
1268 xlibpth='/usr/lib/386 /lib/386'
1269 : Possible local library directories to search.
1270 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1271 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1272
1273 : general looking path for locating libraries
1274 glibpth="/lib /usr/lib $xlibpth"
1275 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1276 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1277 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1278
1279 : Private path used by Configure to find libraries.  Its value
1280 : is prepended to libpth. This variable takes care of special
1281 : machines, like the mips.  Usually, it should be empty.
1282 plibpth=''
1283
1284 : default library list
1285 libswanted=''
1286 : some systems want to use only the non-versioned libso:s
1287 ignore_versioned_solibs=''
1288 siteman1dir=''
1289 siteman3dir=''
1290 sitescript=''
1291 archname64=''
1292 ccflags_uselargefiles=''
1293 ldflags_uselargefiles=''
1294 libswanted_uselargefiles=''
1295 : set usemultiplicity on the Configure command line to enable multiplicity.
1296 : set usesocks on the Configure command line to enable socks.
1297 : set usethreads on the Configure command line to enable threads.
1298 usereentrant='undef'
1299 : full support for void wanted by default
1300 defvoidused=15
1301
1302 : List of libraries we want.
1303 : If anyone needs extra -lxxx, put those in a hint file.
1304 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1305 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1306 : We probably want to search /usr/shlib before most other libraries.
1307 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1308 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1309 glibpth="/usr/shlib $glibpth"
1310 : Do not use vfork unless overridden by a hint file.
1311 usevfork=false
1312
1313 : Find the basic shell for Bourne shell scripts
1314 case "$sh" in
1315 '')
1316         case "$SYSTYPE" in
1317         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1318         *) xxx='/bin/sh';;
1319         esac
1320         if test -f "$xxx"; then
1321                 sh="$xxx"
1322         else
1323                 : Build up a list and do a single loop so we can 'break' out.
1324                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1325                 for xxx in sh bash ksh pdksh ash; do
1326                         for p in $pth; do
1327                                 try="$try ${p}/${xxx}"
1328                         done
1329                 done
1330                 for xxx in $try; do
1331                         if test -f "$xxx"; then
1332                                 sh="$xxx";
1333                                 break
1334                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1335                                 sh="$xxx";
1336                                 break
1337                         elif test -f "$xxx.exe"; then
1338                                 sh="$xxx";
1339                                 break
1340                         fi
1341                 done
1342         fi
1343         ;;
1344 esac
1345
1346 case "$sh" in
1347 '')     cat >&2 <<EOM
1348 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1349
1350 Usually it's in /bin/sh.  How did you even get this far?
1351 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1352 we'll try to straighten this all out.
1353 EOM
1354         exit 1
1355         ;;
1356 esac
1357
1358 : see if sh knows # comments
1359 if `$sh -c '#' >/dev/null 2>&1`; then
1360         shsharp=true
1361         spitshell=cat
1362         xcat=/bin/cat
1363         test -f $xcat$_exe || xcat=/usr/bin/cat
1364         if test ! -f $xcat$_exe; then
1365                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1366                         if test -f $p/cat$_exe; then
1367                                 xcat=$p/cat
1368                                 break
1369                         fi
1370                 done
1371                 if test ! -f $xcat$_exe; then
1372                         echo "Can't find cat anywhere!"
1373                         exit 1
1374                 fi
1375         fi
1376         echo "#!$xcat" >sharp
1377         $eunicefix sharp
1378         chmod +x sharp
1379         ./sharp > today
1380         if test -s today; then
1381                 sharpbang='#!'
1382         else
1383                 echo "#! $xcat" > sharp
1384                 $eunicefix sharp
1385                 chmod +x sharp
1386                 ./sharp > today
1387                 if test -s today; then
1388                         sharpbang='#! '
1389                 else
1390                         sharpbang=': use '
1391                 fi
1392         fi
1393 else
1394         echo " "
1395         echo "Your $sh doesn't grok # comments--I will strip them later on."
1396         shsharp=false
1397         cd ..
1398         echo "exec grep -v '^[  ]*#'" >spitshell
1399         chmod +x spitshell
1400         $eunicefix spitshell
1401         spitshell=`pwd`/spitshell
1402         cd UU
1403         echo "I presume that if # doesn't work, #! won't work either!"
1404         sharpbang=': use '
1405 fi
1406 rm -f sharp today
1407
1408 : figure out how to guarantee sh startup
1409 case "$startsh" in
1410 '') startsh=${sharpbang}${sh} ;;
1411 *)
1412 esac
1413 cat >sharp <<EOSS
1414 $startsh
1415 set abc
1416 test "$?abc" != 1
1417 EOSS
1418
1419 chmod +x sharp
1420 $eunicefix sharp
1421 if ./sharp; then
1422         : echo "Yup, it does."
1423 else
1424         echo "Hmm... '$startsh' does not guarantee sh startup..."
1425         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1426 fi
1427 rm -f sharp
1428
1429
1430 : Save command line options in file UU/cmdline.opt for later use in
1431 : generating config.sh.
1432 cat > cmdline.opt <<EOSH
1433 # Configure command line arguments.
1434 config_arg0='$0'
1435 config_args='$*'
1436 config_argc=$#
1437 EOSH
1438 argn=1
1439 args_exp=''
1440 args_sep=''
1441 for arg in "$@"; do
1442         cat >>cmdline.opt <<EOSH
1443 config_arg$argn='$arg'
1444 EOSH
1445         # Extreme backslashitis: replace each ' by '"'"'
1446         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1447 $arg
1448 EOC
1449         arg_exp=`cat cmdl.opt`
1450         args_exp="$args_exp$args_sep'$arg_exp'"
1451         argn=`expr $argn + 1`
1452         args_sep=' '
1453 done
1454 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1455 # used by ./hints/os2.sh
1456 rm -f cmdl.opt
1457
1458 : produce awk script to parse command line options
1459 cat >options.awk <<'EOF'
1460 BEGIN {
1461         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1462
1463         len = length(optstr);
1464         for (i = 1; i <= len; i++) {
1465                 c = substr(optstr, i, 1);
1466                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1467                 if (a == ":") {
1468                         arg[c] = 1;
1469                         i++;
1470                 }
1471                 opt[c] = 1;
1472         }
1473 }
1474 {
1475         expect = 0;
1476         str = $0;
1477         if (substr(str, 1, 1) != "-") {
1478                 printf("'%s'\n", str);
1479                 next;
1480         }
1481         len = length($0);
1482         for (i = 2; i <= len; i++) {
1483                 c = substr(str, i, 1);
1484                 if (!opt[c]) {
1485                         printf("-%s\n", substr(str, i));
1486                         next;
1487                 }
1488                 printf("-%s\n", c);
1489                 if (arg[c]) {
1490                         if (i < len)
1491                                 printf("'%s'\n", substr(str, i + 1));
1492                         else
1493                                 expect = 1;
1494                         next;
1495                 }
1496         }
1497 }
1498 END {
1499         if (expect)
1500                 print "?";
1501 }
1502 EOF
1503
1504 : process the command line options
1505 set X `for arg in "$@"; do echo "X$arg"; done |
1506         sed -e s/X// | awk -f options.awk`
1507 eval "set $*"
1508 shift
1509 rm -f options.awk
1510
1511 : set up default values
1512 fastread=''
1513 reuseval=false
1514 config_sh=''
1515 alldone=''
1516 error=''
1517 silent=''
1518 extractsh=''
1519 override=''
1520 knowitall=''
1521 rm -f optdef.sh posthint.sh
1522 cat >optdef.sh <<EOS
1523 $startsh
1524 EOS
1525
1526
1527 : option parsing
1528 while test $# -gt 0; do
1529         case "$1" in
1530         -d) shift; fastread=yes;;
1531         -e) shift; alldone=cont;;
1532         -f)
1533                 shift
1534                 cd ..
1535                 if test -r "$1"; then
1536                         config_sh="$1"
1537                 else
1538                         echo "$me: cannot read config file $1." >&2
1539                         error=true
1540                 fi
1541                 cd UU
1542                 shift;;
1543         -h) shift; error=true;;
1544         -r) shift; reuseval=true;;
1545         -s) shift; silent=true; realsilent=true;;
1546         -E) shift; alldone=exit;;
1547         -K) shift; knowitall=true;;
1548         -O) shift; override=true;;
1549         -S) shift; silent=true; extractsh=true;;
1550         -D)
1551                 shift
1552                 case "$1" in
1553                 *=)
1554                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1555                         echo "$me: ignoring -D $1" >&2
1556                         ;;
1557                 *=*) echo "$1" | \
1558                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1559                 *) echo "$1='define'" >> optdef.sh;;
1560                 esac
1561                 shift
1562                 ;;
1563         -U)
1564                 shift
1565                 case "$1" in
1566                 *=) echo "$1" >> optdef.sh;;
1567                 *=*)
1568                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1569                         echo "$me: ignoring -U $1" >&2
1570                         ;;
1571                 *) echo "$1='undef'" >> optdef.sh;;
1572                 esac
1573                 shift
1574                 ;;
1575         -A)
1576             shift
1577             xxx=''
1578             yyy="$1"
1579             zzz=''
1580             uuu=undef
1581             case "$yyy" in
1582             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1583                  case "$zzz" in
1584                  *:*) zzz='' ;;
1585                  *)   xxx=append
1586                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1587                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1588                  esac
1589                  ;;
1590             esac
1591             case "$xxx" in
1592             '')  case "$yyy" in
1593                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1594                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1595                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1596                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1597                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1598                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1599                  esac
1600                  ;;       
1601             esac
1602             case "$xxx" in
1603             append)
1604                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1605             clear)
1606                 echo "$yyy=''"                  >> posthint.sh ;;
1607             define)
1608                 case "$zzz" in
1609                 '') zzz=define ;;
1610                 esac
1611                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1612             eval)
1613                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1614             prepend)
1615                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1616             undef)
1617                 case "$zzz" in
1618                 '') zzz="$uuu" ;;
1619                 esac
1620                 echo "$yyy=$zzz"                >> posthint.sh ;;
1621             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1622             esac
1623             shift
1624             ;;
1625         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1626             exit 0;;
1627         --) break;;
1628         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1629         *) break;;
1630         esac
1631 done
1632
1633 case "$error" in
1634 true)
1635         cat >&2 <<EOM
1636 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1637                  [-U symbol] [-U symbol=] [-A command:symbol...]
1638   -d : use defaults for all answers.
1639   -e : go on without questioning past the production of config.sh.
1640   -f : specify an alternate default configuration file.
1641   -h : print this help message and exit (with an error status).
1642   -r : reuse C symbols value if possible (skips costly nm extraction).
1643   -s : silent mode, only echoes questions and essential information.
1644   -D : define symbol to have some value:
1645          -D symbol         symbol gets the value 'define'
1646          -D symbol=value   symbol gets the value 'value'
1647   -E : stop at the end of questions, after having produced config.sh.
1648   -K : do not use unless you know what you are doing.
1649   -O : let -D and -U override definitions from loaded configuration file.
1650   -S : perform variable substitutions on all .SH files (can mix with -f)
1651   -U : undefine symbol:
1652          -U symbol    symbol gets the value 'undef'
1653          -U symbol=   symbol gets completely empty
1654   -A : manipulate symbol after the platform specific hints have been applied:
1655          -A symbol=value                append " "value to symbol
1656          -A append:symbol=value         append value to symbol
1657          -A define:symbol=value         define symbol to have value
1658          -A clear:symbol                define symbol to be ''
1659          -A define:symbol               define symbol to be 'define'
1660          -A eval:symbol=value           define symbol to be eval of value
1661          -A prepend:symbol=value        prepend value to symbol
1662          -A undef:symbol                define symbol to be 'undef'
1663          -A undef:symbol=               define symbol to be ''
1664   -V : print version number and exit (with a zero status).
1665 EOM
1666         exit 1
1667         ;;
1668 esac
1669
1670 : Sanity checks
1671 case "$fastread$alldone" in
1672 yescont|yesexit) ;;
1673 *)
1674         case "$extractsh" in
1675         true) ;;
1676         *)
1677                 if test ! -t 0; then
1678                         echo "Say 'sh Configure', not 'sh <Configure'"
1679                         exit 1
1680                 fi
1681                 ;;
1682         esac
1683         ;;
1684 esac
1685
1686 exec 4>&1
1687 case "$silent" in
1688 true) exec 1>/dev/null;;
1689 esac
1690
1691 : run the defines and the undefines, if any, but leave the file out there...
1692 touch optdef.sh
1693 . ./optdef.sh
1694 : create the posthint manipulation script and leave the file out there...
1695 touch posthint.sh
1696
1697 : set package name
1698 package=perl5
1699 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1700 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1701 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1702 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1703 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1704 esac
1705
1706 : Some greps do not return status, grrr.
1707 echo "grimblepritz" >grimble
1708 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1709         contains=contains
1710 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1711         contains=grep
1712 else
1713         contains=contains
1714 fi
1715 rm -f grimble
1716 : the following should work in any shell
1717 case "$contains" in
1718 contains*)
1719         echo " "
1720         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1721         cat >contains <<'EOSS'
1722 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1723 EOSS
1724 chmod +x contains
1725 esac
1726
1727 : Find the path to the source tree
1728 case "$src" in
1729 '') case "$0" in
1730     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1731          case "$src" in
1732          /*)    ;;
1733          .)     ;;
1734          *)     src=`cd ../$src && pwd` ;;
1735          esac
1736          ;;
1737     *)   src='.';;
1738     esac;;
1739 esac
1740 case "$src" in
1741 '')     src=/
1742         rsrc=/
1743         ;;
1744 /*) rsrc="$src";;
1745 *) rsrc="../$src";;
1746 esac
1747 if test -f $rsrc/Configure && \
1748         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1749 then
1750    : found it, so we are ok.
1751 else
1752         rsrc=''
1753         for src in . .. ../.. ../../.. ../../../..; do
1754                 if test -f ../$src/Configure && \
1755                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1756                 then
1757                         rsrc=../$src
1758                         break
1759                 fi
1760         done
1761 fi
1762 case "$rsrc" in
1763 '')
1764         cat <<EOM >&4
1765
1766 Sorry, I can't seem to locate the source dir for $package.  Please start
1767 Configure with an explicit path -- i.e. /some/path/Configure.
1768
1769 EOM
1770         exit 1
1771         ;;
1772 ../.)   rsrc='..';;
1773 *)
1774         echo " "
1775         echo "Sources for $package found in \"$src\"." >&4
1776         ;;
1777 esac
1778
1779 : script used to extract .SH files with variable substitutions
1780 cat >extract <<'EOS'
1781 PERL_CONFIG_SH=true
1782 echo "Doing variable substitutions on .SH files..."
1783 if test -f MANIFEST; then
1784         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1785 else
1786         echo "(Looking for .SH files under the source directory.)"
1787         set x `(cd "$src"; find . -name "*.SH" -print)`
1788 fi
1789 shift
1790 case $# in
1791 0) set x `(cd "$src"; echo *.SH)`; shift;;
1792 esac
1793 if test ! -f "$src/$1"; then
1794         shift
1795 fi
1796 mkdir_p='
1797 name=$1;
1798 create="";
1799 while test $name; do
1800         if test ! -d "$name"; then
1801                 create="$name $create";
1802                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1803                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1804         else
1805                 name="";
1806         fi;
1807 done;
1808 for file in $create; do
1809         mkdir $file;
1810 done
1811 '
1812 for file in $*; do
1813         case "$src" in
1814         ".")
1815                 case "$file" in
1816                 */*)
1817                         dir=`expr X$file : 'X\(.*\)/'`
1818                         file=`expr X$file : 'X.*/\(.*\)'`
1819                         (cd "$dir" && . ./$file)
1820                         ;;
1821                 *)
1822                         . ./$file
1823                         ;;
1824                 esac
1825                 ;;
1826         *)
1827                 case "$file" in
1828                 */*)
1829                         dir=`expr X$file : 'X\(.*\)/'`
1830                         file=`expr X$file : 'X.*/\(.*\)'`
1831                         (set x $dir; shift; eval $mkdir_p)
1832                         sh <"$src/$dir/$file"
1833                         ;;
1834                 *)
1835                         sh <"$src/$file"
1836                         ;;
1837                 esac
1838                 ;;
1839         esac
1840 done
1841 if test -f "$src/config_h.SH"; then
1842         if test ! -f config.h; then
1843         : oops, they left it out of MANIFEST, probably, so do it anyway.
1844         . "$src/config_h.SH"
1845         fi
1846 fi
1847 EOS
1848
1849 : extract files and exit if asked to do so
1850 case "$extractsh" in
1851 true)
1852         case "$realsilent" in
1853         true) ;;
1854         *) exec 1>&4;;
1855         esac
1856         case "$config_sh" in
1857         '') config_sh='config.sh';;
1858         esac
1859         echo " "
1860         echo "Fetching answers from $config_sh..."
1861         cd ..
1862         . $config_sh
1863         test "$override" && . ./optdef.sh
1864         echo " "
1865         . UU/extract
1866         rm -rf UU
1867         echo "Extraction done."
1868         exit 0
1869         ;;
1870 esac
1871
1872 : Eunice requires " " instead of "", can you believe it
1873 echo " "
1874 : Here we go...
1875 echo "Beginning of configuration questions for $package."
1876
1877 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1878
1879 : first determine how to suppress newline on echo command
1880 echo " "
1881 echo "Checking echo to see how to suppress newlines..."
1882 (echo "hi there\c" ; echo " ") >.echotmp
1883 if $contains c .echotmp >/dev/null 2>&1 ; then
1884         echo "...using -n."
1885         n='-n'
1886         c=''
1887 else
1888         cat <<'EOM'
1889 ...using \c
1890 EOM
1891         n=''
1892         c='\c'
1893 fi
1894 echo $n "The star should be here-->$c"
1895 echo '*'
1896 rm -f .echotmp
1897
1898 : Now test for existence of everything in MANIFEST
1899 echo " "
1900 if test -f "$rsrc/MANIFEST"; then
1901         echo "First let's make sure your kit is complete.  Checking..." >&4
1902         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1903         rm -f missing
1904         tmppwd=`pwd`
1905         for filelist in x??; do
1906                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1907         done
1908         if test -s missing; then
1909                 cat missing >&4
1910                 cat >&4 <<'EOM'
1911
1912 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1913
1914 You have the option of continuing the configuration process, despite the
1915 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1916 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1917 and contact the author (perlbug@perl.org).
1918
1919 EOM
1920                 echo $n "Continue? [n] $c" >&4
1921                 read ans
1922                 case "$ans" in
1923                 y*)
1924                         echo "Continuing..." >&4
1925                         rm -f missing
1926                         ;;
1927                 *)
1928                         echo "ABORTING..." >&4
1929                         kill $$
1930                         ;;
1931                 esac
1932         else
1933                 echo "Looks good..."
1934         fi
1935 else
1936         echo "There is no MANIFEST file.  I hope your kit is complete !"
1937 fi
1938 rm -f missing x??
1939
1940 echo " "
1941 : Find the appropriate value for a newline for tr
1942 if test -n "$DJGPP"; then
1943        trnl='\012'
1944 fi
1945 if test X"$trnl" = X; then
1946         case "`echo foo|tr '\n' x 2>/dev/null`" in
1947         foox) trnl='\n' ;;
1948         esac
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\012' x 2>/dev/null`" in
1952         foox) trnl='\012' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1957        fooxy) trnl='\n\r' ;;
1958        esac
1959 fi
1960 if test X"$trnl" = X; then
1961         cat <<EOM >&2
1962
1963 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1964
1965 EOM
1966         exit 1
1967 fi
1968
1969 : compute the number of columns on the terminal for proper question formatting
1970 case "$COLUMNS" in
1971 '') COLUMNS='80';;
1972 esac
1973
1974 : set up the echo used in my read
1975 myecho="case \"\$xxxm\" in
1976 '') echo $n \"\$rp $c\" >&4;;
1977 *) case \"\$rp\" in
1978         '') echo $n \"[\$xxxm] $c\";;
1979         *)
1980                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1981                         echo \"\$rp\" >&4
1982                         echo $n \"[\$xxxm] $c\" >&4
1983                 else
1984                         echo $n \"\$rp [\$xxxm] $c\" >&4
1985                 fi
1986                 ;;
1987         esac;;
1988 esac"
1989
1990 : now set up to do reads with possible shell escape and default assignment
1991 cat <<EOSC >myread
1992 $startsh
1993 xxxm=\$dflt
1994 $myecho
1995 ans='!'
1996 case "\$fastread" in
1997 yes) case "\$dflt" in
1998         '') ;;
1999         *) ans='';
2000                 case "\$silent-\$rp" in
2001                 true-) ;;
2002                 *) echo " " >&4;;
2003                 esac;;
2004         esac;;
2005 *) case "\$silent" in
2006         true) case "\$rp" in
2007                 '') ans='';;
2008                 esac;;
2009         esac;;
2010 esac
2011 while expr "X\$ans" : "X!" >/dev/null; do
2012         read answ
2013         set x \$xxxm
2014         shift
2015         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2016         case  "\$answ" in
2017         "!")
2018                 sh 1>&4
2019                 echo " "
2020                 $myecho
2021                 ;;
2022         !*)
2023                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2024                 shift
2025                 sh 1>&4 -c "\$*"
2026                 echo " "
2027                 $myecho
2028                 ;;
2029         "\$ans")
2030                 case "\$ans" in
2031                 \\&*)
2032                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2033                         shift
2034                         case "\$1" in
2035                         -d)
2036                                 fastread=yes
2037                                 echo "(OK, I'll run with -d after this question.)" >&4
2038                                 ;;
2039                         -*)
2040                                 echo "*** Sorry, \$1 not supported yet." >&4
2041                                 ;;
2042                         esac
2043                         $myecho
2044                         ans=!
2045                         ;;
2046                 esac;;
2047         *)
2048                 case "\$aok" in
2049                 y)
2050                         echo "*** Substitution done -- please confirm."
2051                         xxxm="\$ans"
2052                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2053                         xxxm="\$ans"
2054                         ans=!
2055                         ;;
2056                 *)
2057                         echo "*** Error -- try again."
2058                         ans=!
2059                         ;;
2060                 esac
2061                 $myecho
2062                 ;;
2063         esac
2064         case "\$ans\$xxxm\$nostick" in
2065         '')
2066                 ans=!
2067                 $myecho
2068                 ;;
2069         esac
2070 done
2071 case "\$ans" in
2072 '') ans="\$xxxm";;
2073 esac
2074 EOSC
2075
2076 : create .config dir to save info across Configure sessions
2077 test -d ../.config || mkdir ../.config
2078 cat >../.config/README <<EOF
2079 This directory created by Configure to save information that should
2080 persist across sessions for $package.
2081
2082 You may safely delete it if you wish.
2083 EOF
2084
2085 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2086 case "$usedevel" in
2087 $define|true|[yY]*) ;;
2088 *) case "$xversion" in
2089    *[13579])
2090         cat >&4 <<EOH
2091 *** WHOA THERE!!! ***
2092
2093     This is an UNSTABLE DEVELOPMENT release.
2094     The version of this $package distribution is $xversion, that is, odd,
2095     (as opposed to even) and that signifies a development release.
2096     If you want a maintenance release, you want an even-numbered version.
2097
2098     Do ***NOT*** install this into production use.
2099     Data corruption and crashes are possible.
2100
2101     It is most seriously suggested that you do not continue any further
2102     unless you want to help in developing and debugging Perl.
2103
2104     If you *still* want to build perl, you can answer 'y' now,
2105     or pass -Dusedevel to Configure.
2106
2107 EOH
2108         rp='Do you really want to continue?'
2109         dflt='n'
2110         . ./myread
2111         case "$ans" in
2112         [yY]) echo >&4 "Okay, continuing."
2113               usedevel="$define" ;;
2114         *) echo >&4 "Okay, bye."
2115            exit 1
2116            ;;
2117         esac
2118         ;;
2119     esac
2120     ;;
2121 esac
2122 case "$usedevel" in
2123 $define|true|[yY]*)
2124         case "$versiononly" in
2125         '') versiononly="$define" ;;
2126         esac
2127         case "$installusrbinperl" in
2128         '') installusrbinperl="$undef" ;;
2129         esac
2130         ;;
2131 esac
2132
2133 : general instructions
2134 needman=true
2135 firsttime=true
2136 user=`(logname) 2>/dev/null`
2137 case "$user" in
2138 '') user=`whoami 2>&1`;;
2139 esac
2140 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2141         firsttime=false
2142         echo " "
2143         rp='Would you like to see the instructions?'
2144         dflt=n
2145         . ./myread
2146         case "$ans" in
2147         [yY]*) ;;
2148         *) needman=false;;
2149         esac
2150 fi
2151 if $needman; then
2152         cat <<EOH
2153
2154 This installation shell script will examine your system and ask you questions
2155 to determine how the perl5 package should be installed. If you get
2156 stuck on a question, you may use a ! shell escape to start a subshell or
2157 execute a command.  Many of the questions will have default answers in square
2158 brackets; typing carriage return will give you the default.
2159
2160 On some of the questions which ask for file or directory names you are allowed
2161 to use the ~name construct to specify the login directory belonging to "name",
2162 even if you don't have a shell which knows about that.  Questions where this is
2163 allowed will be marked "(~name ok)".
2164
2165 EOH
2166         rp=''
2167         dflt='Type carriage return to continue'
2168         . ./myread
2169         cat <<'EOH'
2170
2171 The prompter used in this script allows you to use shell variables and
2172 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2173 in the default answer, as if the default line was a set of arguments given to a
2174 script shell.  This means you may also use $* to repeat the whole default line,
2175 so you do not have to re-type everything to add something to the default.
2176
2177 Everytime there is a substitution, you will have to confirm.  If there is an
2178 error (e.g. an unmatched backtick), the default answer will remain unchanged
2179 and you will be prompted again.
2180
2181 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2182 the questions and use the computed defaults (or the previous answers if there
2183 was already a config.sh file). Type 'Configure -h' for a list of options.
2184 You may also start interactively and then answer '& -d' at any prompt to turn
2185 on the non-interactive behaviour for the remainder of the execution.
2186
2187 EOH
2188         . ./myread
2189         cat <<EOH
2190
2191 Much effort has been expended to ensure that this shell script will run on any
2192 Unix system.  If despite that it blows up on yours, your best bet is to edit
2193 Configure and run it again.  If you can't run Configure for some reason,
2194 you'll have to generate a config.sh file by hand.  Whatever problems you
2195 have, let me (perlbug@perl.org) know how I blew it.
2196
2197 This installation script affects things in two ways:
2198
2199 1) it may do direct variable substitutions on some of the files included
2200    in this kit.
2201 2) it builds a config.h file for inclusion in C programs.  You may edit
2202    any of these files as the need arises after running this script.
2203
2204 If you make a mistake on a question, there is no easy way to back up to it
2205 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2206 files.  Configure will offer to let you do this before it runs the SH files.
2207
2208 EOH
2209         dflt='Type carriage return to continue'
2210         . ./myread
2211         case "$firsttime" in
2212         true) echo $user >>../.config/instruct;;
2213         esac
2214 fi
2215
2216 : find out where common programs are
2217 echo " "
2218 echo "Locating common programs..." >&4
2219 cat <<EOSC >loc
2220 $startsh
2221 case \$# in
2222 0) exit 1;;
2223 esac
2224 thing=\$1
2225 shift
2226 dflt=\$1
2227 shift
2228 for dir in \$*; do
2229         case "\$thing" in
2230         .)
2231         if test -d \$dir/\$thing; then
2232                 echo \$dir
2233                 exit 0
2234         fi
2235         ;;
2236         *)
2237         for thisthing in \$dir/\$thing; do
2238                 : just loop through to pick last item
2239         done
2240         if test -f \$thisthing; then
2241                 echo \$thisthing
2242                 exit 0
2243         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2244                 echo \$thisthing
2245                 exit 0
2246         elif test -f \$dir/\$thing.exe; then
2247                 if test -n "$DJGPP"; then
2248                         echo \$dir/\$thing.exe
2249                 elif test "$eunicefix" != ":"; then
2250                         : on Eunice apparently
2251                         echo \$dir/\$thing
2252                         exit 0
2253                 fi
2254                 exit 0
2255         fi
2256         ;;
2257         esac
2258 done
2259 echo \$dflt
2260 exit 1
2261 EOSC
2262 chmod +x loc
2263 $eunicefix loc
2264 loclist="
2265 awk
2266 cat
2267 chmod
2268 comm
2269 cp
2270 echo
2271 expr
2272 grep
2273 ls
2274 mkdir
2275 rm
2276 sed
2277 sort
2278 touch
2279 tr
2280 uniq
2281 "
2282 trylist="
2283 Mcc
2284 ar
2285 bison
2286 byacc
2287 cpp
2288 csh
2289 date
2290 egrep
2291 gmake
2292 gzip
2293 less
2294 ln
2295 make
2296 more
2297 nm
2298 nroff
2299 pg
2300 test
2301 uname
2302 zip
2303 "
2304 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2305 pth="$pth /lib /usr/lib"
2306 for file in $loclist; do
2307         eval xxx=\$$file
2308         case "$xxx" in
2309         /*|?:[\\/]*)
2310                 if test -f "$xxx"; then
2311                         : ok
2312                 else
2313                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2314                         xxx=`./loc $file $file $pth`
2315                 fi
2316                 ;;
2317         '') xxx=`./loc $file $file $pth`;;
2318         *) xxx=`./loc $xxx $xxx $pth`;;
2319         esac
2320         eval $file=$xxx$_exe
2321         eval _$file=$xxx
2322         case "$xxx" in
2323         /*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         ?:[\\/]*)
2327                 echo $file is in $xxx.
2328                 ;;
2329         *)
2330                 echo "I don't know where '$file' is, and my life depends on it." >&4
2331                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2332                 exit 1
2333                 ;;
2334         esac
2335 done
2336 echo " "
2337 echo "Don't worry if any of the following aren't found..."
2338 say=offhand
2339 for file in $trylist; do
2340         eval xxx=\$$file
2341         case "$xxx" in
2342         /*|?:[\\/]*)
2343                 if test -f "$xxx"; then
2344                         : ok
2345                 else
2346                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2347                         xxx=`./loc $file $file $pth`
2348                 fi
2349                 ;;
2350         '') xxx=`./loc $file $file $pth`;;
2351         *) xxx=`./loc $xxx $xxx $pth`;;
2352         esac
2353         eval $file=$xxx$_exe
2354         eval _$file=$xxx
2355         case "$xxx" in
2356         /*)
2357                 echo $file is in $xxx.
2358                 ;;
2359         ?:[\\/]*)
2360                 echo $file is in $xxx.
2361                 ;;
2362         *)
2363                 echo "I don't see $file out there, $say."
2364                 say=either
2365                 ;;
2366         esac
2367 done
2368 case "$egrep" in
2369 egrep)
2370         echo "Substituting grep for egrep."
2371         egrep=$grep
2372         _egrep=$grep
2373         ;;
2374 esac
2375 case "$ln" in
2376 ln)
2377         echo "Substituting cp for ln."
2378         ln=$cp
2379         _ln=$cp
2380         ;;
2381 esac
2382 case "$make" in
2383 make)   
2384         case "$gmake" in
2385         gmake)
2386         echo "I can't find make or gmake, and my life depends on it." >&4
2387         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2388         exit 1
2389         ;;
2390         esac
2391         ;;
2392 esac    
2393 case "$gmake" in
2394 gmake)  ;;
2395 *)      # We can't have osname yet.
2396         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2397                 # Assume that gmake, if found, is definitely GNU make
2398                 # and prefer it over the system make.
2399                 echo "Substituting gmake for make."
2400                 make=$gmake
2401                 _make=$gmake
2402         fi
2403         ;;
2404 esac
2405 case "$test" in
2406 test)
2407         echo "Hopefully test is built into your sh."
2408         ;;
2409 *)
2410         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2411                 echo "Using the test built into your sh."
2412                 test=test
2413                 _test=test
2414         fi
2415         ;;
2416 esac
2417 case "$echo" in
2418 echo)
2419         echo "Hopefully echo is built into your sh."
2420         ;;
2421 '') ;;
2422 *)
2423         echo " "
2424 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2425         $echo $n "hi there$c" >foo1
2426         echo $n "hi there$c" >foo2
2427         if cmp foo1 foo2 >/dev/null 2>&1; then
2428                 echo "They are compatible.  In fact, they may be identical."
2429         else
2430                 case "$n" in
2431                 '-n') n='' c='\c';;
2432                 *) n='-n' c='';;
2433                 esac
2434                 cat <<FOO
2435 They are not compatible!  You are probably running ksh on a non-USG system.
2436 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2437 have echo built in and we may have to run some Bourne shell scripts.  That
2438 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2439
2440 FOO
2441                 $echo $n "The star should be here-->$c"
2442                 $echo "*"
2443         fi
2444         $rm -f foo1 foo2
2445         ;;
2446 esac
2447
2448 cat <<EOS >trygcc
2449 $startsh
2450 EOS
2451 cat <<'EOSC' >>trygcc
2452 case "$cc" in
2453 '') ;;
2454 *)  $rm -f try try.*
2455     $cat >try.c <<EOM
2456 int main(int argc, char *argv[]) {
2457   return 0;
2458 }
2459 EOM
2460     if $cc -o try $ccflags $ldflags try.c; then
2461        :
2462     else
2463         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2464         despair=yes
2465         trygcc=yes
2466         case "$cc" in
2467         *gcc*) trygcc=no ;;
2468         esac
2469         case "`$cc -v -c try.c 2>&1`" in
2470         *gcc*) trygcc=no ;;
2471         esac
2472         if $test X"$trygcc" = Xyes; then
2473             if gcc -o try -c try.c; then
2474                 echo " "
2475                 echo "You seem to have a working gcc, though." >&4
2476                 rp="Would you like to use it?"
2477                 dflt=y
2478                 if $test -f myread; then
2479                     . ./myread
2480                 else
2481                     if $test -f UU/myread; then
2482                         . ./UU/myread
2483                     else
2484                         echo "Cannot find myread, sorry.  Aborting." >&2
2485                         exit 1
2486                     fi
2487                 fi  
2488                 case "$ans" in
2489                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2490                        if $test -f usethreads.cbu; then
2491                            $cat >&4 <<EOM 
2492
2493 *** However, any setting of the C compiler flags (e.g. for thread support)
2494 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2495 *** (together with e.g. -Dusethreads).
2496
2497 EOM
2498                        fi;;
2499                 esac
2500             fi
2501         fi
2502     fi
2503     $rm -f try try.*
2504     ;;
2505 esac
2506 EOSC
2507
2508 cat <<EOS >checkcc
2509 $startsh
2510 EOS
2511 cat <<'EOSC' >>checkcc
2512 case "$cc" in        
2513 '') ;;
2514 *)  $rm -f try try.*              
2515     $cat >try.c <<EOM
2516 int main(int argc, char *argv[]) {
2517   return 0;
2518 }
2519 EOM
2520     if $cc -o try $ccflags $ldflags try.c; then
2521        :
2522     else
2523         if $test X"$despair" = Xyes; then
2524            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2525         fi
2526         $cat >&4 <<EOM         
2527 You need to find a working C compiler.
2528 Either (purchase and) install the C compiler supplied by your OS vendor,
2529 or for a free C compiler try http://gcc.gnu.org/
2530 I cannot continue any further, aborting.
2531 EOM
2532         exit 1
2533     fi
2534     $rm -f try try.*
2535     ;;
2536 esac
2537 EOSC
2538
2539 : determine whether symbolic links are supported
2540 echo " "
2541 $touch blurfl
2542 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2543         echo "Symbolic links are supported." >&4
2544         lns="$ln -s"
2545 else
2546         echo "Symbolic links are NOT supported." >&4
2547         lns="$ln"
2548 fi
2549 $rm -f blurfl sym
2550
2551 : determine whether symbolic links are supported
2552 echo " "
2553 case "$lns" in
2554 *"ln"*" -s")
2555         echo "Checking how to test for symbolic links..." >&4
2556         $lns blurfl sym
2557         if $test "X$issymlink" = X; then
2558                 case "$newsh" in
2559                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2560                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2561                 esac
2562                 if test $? = 0; then
2563                         issymlink="test -h"
2564                 else
2565                         echo "Your builtin 'test -h' may be broken." >&4
2566                         case "$test" in
2567                         /*)     ;;
2568                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2569                                 for p in $pth
2570                                 do
2571                                         if test -f "$p/$test"; then
2572                                                 test="$p/$test"
2573                                                 break
2574                                         fi
2575                                 done
2576                                 ;;
2577                         esac
2578                         case "$test" in
2579                         /*)
2580                                 echo "Trying external '$test -h'." >&4
2581                                 issymlink="$test -h"
2582                                 if $test ! -h sym >/dev/null 2>&1; then
2583                                         echo "External '$test -h' is broken, too." >&4
2584                                         issymlink=''
2585                                 fi
2586                                 ;;
2587                         *)      issymlink='' ;;
2588                         esac
2589                 fi              
2590         fi
2591         if $test "X$issymlink" = X; then
2592                 if $test -L sym 2>/dev/null; then
2593                         issymlink="$test -L"
2594                         echo "The builtin '$test -L' worked." >&4
2595                 fi
2596         fi
2597         if $test "X$issymlink" != X; then
2598                 echo "You can test for symbolic links with '$issymlink'." >&4
2599         else
2600                 echo "I do not know how you can test for symbolic links." >&4
2601         fi
2602         $rm -f blurfl sym
2603         ;;
2604 *)      echo "No symbolic links, so not testing for their testing..." >&4
2605         ;;
2606 esac
2607 echo " "
2608
2609
2610 case "$mksymlinks" in
2611 $define|true|[yY]*)
2612         case "$src" in
2613         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2614                 exit 1
2615                 ;;
2616         *)      case "$lns:$issymlink" in
2617                 *"ln"*" -s:"*"test -"?)
2618                         echo "Creating the symbolic links..." >&4
2619                         echo "(First creating the subdirectories...)" >&4
2620                         cd ..
2621                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2622                                 read directory
2623                                 test -z "$directory" && break
2624                                 mkdir -p $directory
2625                         done
2626                         # Sanity check 1.
2627                         if test ! -d t/base; then
2628                                 echo "Failed to create the subdirectories.  Aborting." >&4
2629                                 exit 1
2630                         fi
2631                         echo "(Then creating the symlinks...)" >&4
2632                         awk '{print $1}' $src/MANIFEST | while true; do
2633                                 read filename
2634                                 test -z "$filename" && break
2635                                 if test -f $filename; then
2636                                         if $issymlink $filename; then
2637                                                 rm -f $filename
2638                                         fi
2639                                 fi
2640                                 if test -f $filename; then
2641                                         echo "$filename already exists, not symlinking."
2642                                 else
2643                                         ln -s $src/$filename $filename
2644                                 fi
2645                         done
2646                         # Sanity check 2.
2647                         if test ! -f t/base/lex.t; then
2648                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2649                                 exit 1
2650                         fi
2651                         cd UU
2652                         ;;
2653                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2654                         ;;
2655                 esac
2656                 ;;
2657         esac
2658         ;;
2659 esac
2660
2661
2662 case "$usecrosscompile" in
2663 $define|true|[yY]*)
2664         $echo "Cross-compiling..."
2665         croak=''
2666         case "$cc" in
2667         *-*-gcc) # A cross-compiling gcc, probably.
2668             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2669             ar=$targetarch-ar
2670             # leave out ld, choosing it is more complex
2671             nm=$targetarch-nm
2672             ranlib=$targetarch-ranlib
2673             $echo 'extern int foo;' > try.c
2674             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2675             shift
2676             if $test $# -gt 0; then
2677                 incpth="$incpth $*"
2678                 incpth="`$echo $incpth|$sed 's/^ //'`"
2679                 echo "Guessing incpth '$incpth'." >&4
2680                 for i in $*; do
2681                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2682                     if $test -d $j; then
2683                         libpth="$libpth $j"
2684                     fi
2685                 done   
2686                 libpth="`$echo $libpth|$sed 's/^ //'`"
2687                 echo "Guessing libpth '$libpth'." >&4
2688             fi
2689             $rm -f try.c
2690             ;;
2691         esac
2692         case "$targetarch" in
2693         '') echo "Targetarch not defined." >&4; croak=y ;;
2694         *)  echo "Using targetarch $targetarch." >&4 ;;
2695         esac
2696         case "$incpth" in
2697         '') echo "Incpth not defined." >&4; croak=y ;;
2698         *)  echo "Using incpth '$incpth'." >&4 ;;
2699         esac
2700         case "$libpth" in
2701         '') echo "Libpth not defined." >&4; croak=y ;;
2702         *)  echo "Using libpth '$libpth'." >&4 ;;
2703         esac
2704         case "$usrinc" in
2705         '') for i in $incpth; do
2706                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2707                     usrinc=$i
2708                     echo "Guessing usrinc $usrinc." >&4
2709                     break
2710                 fi
2711             done
2712             case "$usrinc" in
2713             '') echo "Usrinc not defined." >&4; croak=y ;;
2714             esac
2715             ;;
2716         *)  echo "Using usrinc $usrinc." >&4 ;;
2717         esac
2718         case "$targethost" in
2719         '') echo "Targethost not defined." >&4; croak=y ;;
2720         *)  echo "Using targethost $targethost." >&4
2721         esac
2722         locincpth=' '
2723         loclibpth=' '
2724         case "$croak" in
2725         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2726         esac
2727         case "$src" in
2728         /*) run=$src/Cross/run
2729             targetmkdir=$src/Cross/mkdir
2730             to=$src/Cross/to
2731             from=$src/Cross/from
2732             ;;
2733         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2734             run=$pwd/Cross/run
2735             targetmkdir=$pwd/Cross/mkdir
2736             to=$pwd/Cross/to
2737             from=$pwd/Cross/from
2738             ;;
2739         esac
2740         case "$targetrun" in
2741         '') targetrun=ssh ;;
2742         esac
2743         case "$targetto" in
2744         '') targetto=scp ;;
2745         esac
2746         case "$targetfrom" in
2747         '') targetfrom=scp ;;
2748         esac
2749         run=$run-$targetrun
2750         to=$to-$targetto
2751         from=$from-$targetfrom
2752         case "$targetdir" in
2753         '')  targetdir=/tmp
2754              echo "Guessing targetdir $targetdir." >&4
2755              ;;
2756         esac
2757         case "$targetuser" in
2758         '')  targetuser=root
2759              echo "Guessing targetuser $targetuser." >&4
2760              ;;
2761         esac
2762         case "$targetfrom" in
2763         scp)    q=-q ;;
2764         *)      q='' ;;
2765         esac
2766         case "$targetrun" in
2767         ssh|rsh)
2768             cat >$run <<EOF
2769 #!/bin/sh
2770 case "\$1" in
2771 -cwd)
2772   shift
2773   cwd=\$1
2774   shift
2775   ;;
2776 esac
2777 case "\$cwd" in
2778 '') cwd=$targetdir ;;
2779 esac
2780 exe=\$1
2781 shift
2782 if $test ! -f \$exe.xok; then
2783   $to \$exe
2784   $touch \$exe.xok
2785 fi
2786 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2787 EOF
2788             ;;
2789         *)  echo "Unknown targetrun '$targetrun'" >&4
2790             exit 1
2791             ;;
2792         esac
2793         case "$targetmkdir" in
2794         */Cross/mkdir)
2795             cat >$targetmkdir <<EOF
2796 #!/bin/sh
2797 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2798 EOF
2799             $chmod a+rx $targetmkdir
2800             ;;
2801         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2802             exit 1
2803             ;;
2804         esac
2805         case "$targetto" in
2806         scp|rcp)
2807             cat >$to <<EOF
2808 #!/bin/sh
2809 for f in \$@
2810 do
2811   case "\$f" in
2812   /*)
2813     $targetmkdir \`dirname \$f\`
2814     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2815     ;;
2816   *)
2817     $targetmkdir $targetdir/\`dirname \$f\`
2818     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2819     ;;
2820   esac
2821 done
2822 exit 0
2823 EOF
2824             ;;
2825         cp) cat >$to <<EOF
2826 #!/bin/sh
2827 for f in \$@
2828 do
2829   case "\$f" in
2830   /*)
2831     $mkdir -p $targetdir/\`dirname \$f\`
2832     $cp \$f $targetdir/\$f || exit 1
2833     ;;
2834   *)
2835     $targetmkdir $targetdir/\`dirname \$f\`
2836     $cp \$f $targetdir/\$f || exit 1
2837     ;;
2838   esac
2839 done
2840 exit 0
2841 EOF
2842             ;;
2843         *)  echo "Unknown targetto '$targetto'" >&4
2844             exit 1
2845             ;;
2846         esac
2847         case "$targetfrom" in
2848         scp|rcp)
2849           cat >$from <<EOF
2850 #!/bin/sh
2851 for f in \$@
2852 do
2853   $rm -f \$f
2854   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2855 done
2856 exit 0
2857 EOF
2858             ;;
2859         cp) cat >$from <<EOF
2860 #!/bin/sh
2861 for f in \$@
2862 do
2863   $rm -f \$f
2864   cp $targetdir/\$f . || exit 1
2865 done
2866 exit 0
2867 EOF
2868             ;;
2869         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2870             exit 1
2871             ;;
2872         esac
2873         if $test ! -f $run; then
2874             echo "Target 'run' script '$run' not found." >&4
2875         else
2876             $chmod a+rx $run
2877         fi
2878         if $test ! -f $to; then
2879             echo "Target 'to' script '$to' not found." >&4
2880         else
2881             $chmod a+rx $to
2882         fi
2883         if $test ! -f $from; then
2884             echo "Target 'from' script '$from' not found." >&4
2885         else
2886             $chmod a+rx $from
2887         fi
2888         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2889             exit 1
2890         fi
2891         cat >&4 <<EOF
2892 Using '$run' for remote execution,
2893 and '$from' and '$to'
2894 for remote file transfer.
2895 EOF
2896         ;;
2897 *)      run=''
2898         to=:
2899         from=:
2900         usecrosscompile='undef'
2901         targetarch=''
2902         ;;
2903 esac
2904
2905 : see whether [:lower:] and [:upper:] are supported character classes
2906 echo " "
2907 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2908 ABYZ)
2909         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2910         up='[:upper:]'
2911         low='[:lower:]'
2912         ;;
2913 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2914         # (0xd9 and 0xe2), therefore that is a nice testing point.
2915         if test "X$up" = X -o "X$low" = X; then
2916             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2917             rs) up='[A-Z]'
2918                 low='[a-z]'
2919                 ;;
2920             esac
2921         fi
2922         if test "X$up" = X -o "X$low" = X; then
2923             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2924             rs) up='A-Z'
2925                 low='a-z'
2926                 ;;
2927             esac
2928         fi
2929         if test "X$up" = X -o "X$low" = X; then
2930             case "`echo RS | od -x 2>/dev/null`" in
2931             *D9E2*|*d9e2*)
2932                 echo "Hey, this might be EBCDIC." >&4
2933                 if test "X$up" = X -o "X$low" = X; then
2934                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2935                     rs) up='[A-IJ-RS-Z]'
2936                         low='[a-ij-rs-z]'
2937                         ;;
2938                     esac
2939                 fi
2940                 if test "X$up" = X -o "X$low" = X; then
2941                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2942                     rs) up='A-IJ-RS-Z'
2943                         low='a-ij-rs-z'
2944                         ;;
2945                     esac
2946                 fi
2947                 ;;
2948             esac
2949         fi
2950 esac
2951 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2952 rs)
2953     echo "Using $up and $low to convert case." >&4
2954     ;;
2955 *)
2956     echo "I don't know how to translate letters from upper to lower case." >&4
2957     echo "Your tr is not acting any way I know of." >&4
2958     exit 1
2959     ;;
2960 esac
2961 : set up the translation script tr, must be called with ./tr of course
2962 cat >tr <<EOSC
2963 $startsh
2964 case "\$1\$2" in
2965 '[A-Z][a-z]') exec $tr '$up' '$low';;
2966 '[a-z][A-Z]') exec $tr '$low' '$up';;
2967 esac
2968 exec $tr "\$@"
2969 EOSC
2970 chmod +x tr
2971 $eunicefix tr
2972
2973 : Try to determine whether config.sh was made on this system
2974 case "$config_sh" in
2975 '')
2976 myuname=`$uname -a 2>/dev/null`
2977 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2978 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2979 # because the A-Z/a-z are not consecutive.
2980 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2981         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2982 newmyuname="$myuname"
2983 dflt=n
2984 case "$knowitall" in
2985 '')
2986         if test -f ../config.sh; then
2987                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2988                         eval "`grep myuname= ../config.sh`"
2989                 fi
2990                 if test "X$myuname" = "X$newmyuname"; then
2991                         dflt=y
2992                 fi
2993         fi
2994         ;;
2995 *) dflt=y;;
2996 esac
2997
2998 : Get old answers from old config file if Configure was run on the
2999 : same system, otherwise use the hints.
3000 hint=default
3001 cd ..
3002 if test -f config.sh; then
3003         echo " "
3004         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3005         . UU/myread
3006         case "$ans" in
3007         n*|N*) echo "OK, I'll ignore it."
3008                 mv config.sh config.sh.old
3009                 myuname="$newmyuname"
3010                 ;;
3011         *)  echo "Fetching default answers from your old config.sh file..." >&4
3012                 tmp_n="$n"
3013                 tmp_c="$c"
3014                 tmp_sh="$sh"
3015                 . ./config.sh
3016                 cp config.sh UU
3017                 n="$tmp_n"
3018                 c="$tmp_c"
3019                 : Older versions did not always set $sh.  Catch re-use of such
3020                 : an old config.sh.
3021                 case "$sh" in
3022                 '') sh="$tmp_sh" ;;
3023                 esac
3024                 hint=previous
3025                 ;;
3026         esac
3027 fi
3028 . ./UU/checkcc
3029 if test ! -f config.sh; then
3030         $cat <<EOM
3031
3032 First time through, eh?  I have some defaults handy for some systems
3033 that need some extra help getting the Configure answers right:
3034
3035 EOM
3036         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3037         dflt=''
3038         : Half the following guesses are probably wrong... If you have better
3039         : tests or hints, please send them to perlbug@perl.org
3040         : The metaconfig authors would also appreciate a copy...
3041         $test -f /irix && osname=irix
3042         $test -f /xenix && osname=sco_xenix
3043         $test -f /dynix && osname=dynix
3044         $test -f /dnix && osname=dnix
3045         $test -f /lynx.os && osname=lynxos
3046         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3047         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3048         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3049         $test -f /bin/mips && /bin/mips && osname=mips
3050         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3051                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3052         $test -d /usr/apollo/bin && osname=apollo
3053         $test -f /etc/saf/_sactab && osname=svr4
3054         $test -d /usr/include/minix && osname=minix
3055         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3056         if $test -d /MachTen -o -d /MachTen_Folder; then
3057                 osname=machten
3058                 if $test -x /sbin/version; then
3059                         osvers=`/sbin/version | $awk '{print $2}' |
3060                         $sed -e 's/[A-Za-z]$//'`
3061                 elif $test -x /usr/etc/version; then
3062                         osvers=`/usr/etc/version | $awk '{print $2}' |
3063                         $sed -e 's/[A-Za-z]$//'`
3064                 else
3065                         osvers="$2.$3"
3066                 fi
3067         fi
3068
3069         $test -f /sys/posix.dll &&
3070                 $test -f /usr/bin/what &&
3071                 set X `/usr/bin/what /sys/posix.dll` &&
3072                 $test "$3" = UWIN &&
3073                 osname=uwin &&
3074                 osvers="$5"
3075
3076         if $test -f $uname; then
3077                 set X $myuname
3078                 shift
3079
3080                 case "$5" in
3081                 fps*) osname=fps ;;
3082                 mips*)
3083                         case "$4" in
3084                         umips) osname=umips ;;
3085                         *) osname=mips ;;
3086                         esac;;
3087                 [23]100) osname=mips ;;
3088                 next*) osname=next ;;
3089                 i386*)
3090                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3091                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3092                                 osname='sco'
3093                                 osvers=$tmp
3094                         elif $test -f /etc/kconfig; then
3095                                 osname=isc
3096                                 if test "$lns" = "$ln -s"; then
3097                                         osvers=4
3098                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3099                                         osvers=3
3100                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3101                                         osvers=2
3102                                 fi
3103                         fi
3104                         tmp=''
3105                         ;;
3106                 pc*)
3107                         if test -n "$DJGPP"; then
3108                                 osname=dos
3109                                 osvers=djgpp
3110                         fi
3111                         ;;
3112                 esac
3113
3114                 case "$1" in
3115                 aix) osname=aix
3116                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3117                         case "$tmp" in
3118                         # oslevel can fail with:
3119                         # oslevel: Unable to acquire lock.
3120                         *not\ found) osvers="$4"."$3" ;;
3121                         '<3240'|'<>3240') osvers=3.2.0 ;;
3122                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3123                         '=3250'|'>3250') osvers=3.2.5 ;;
3124                         *) osvers=$tmp;;
3125                         esac
3126                         ;;
3127                 bsd386) osname=bsd386
3128                         osvers=`$uname -r`
3129                         ;;
3130                 cygwin*) osname=cygwin
3131                         osvers="$3"
3132                         ;;
3133                 *dc.osx) osname=dcosx
3134                         osvers="$3"
3135                         ;;
3136                 dnix) osname=dnix
3137                         osvers="$3"
3138                         ;;
3139                 domainos) osname=apollo
3140                         osvers="$3"
3141                         ;;
3142                 dgux)   osname=dgux
3143                         osvers="$3"
3144                         ;;
3145                 dragonfly) osname=dragonfly
3146                         osvers="$3"
3147                         ;;
3148                 dynixptx*) osname=dynixptx
3149                         osvers=`echo "$4"|sed 's/^v//'`
3150                         ;;
3151                 freebsd) osname=freebsd
3152                         osvers="$3" ;;
3153                 genix)  osname=genix ;;
3154                 gnu)    osname=gnu
3155                         osvers="$3" ;;
3156                 hp*)    osname=hpux
3157                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3158                         ;;
3159                 irix*)  osname=irix
3160                         case "$3" in
3161                         4*) osvers=4 ;;
3162                         5*) osvers=5 ;;
3163                         *)      osvers="$3" ;;
3164                         esac
3165                         ;;
3166                 linux)  osname=linux
3167                         case "$3" in
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 MiNT)   osname=mint
3172                         ;;
3173                 netbsd*) osname=netbsd
3174                         osvers="$3"
3175                         ;;
3176                 news-os) osvers="$3"
3177                         case "$3" in
3178                         4*) osname=newsos4 ;;
3179                         *) osname=newsos ;;
3180                         esac
3181                         ;;
3182                 next*) osname=next ;;
3183                 nonstop-ux) osname=nonstopux ;;
3184                 openbsd) osname=openbsd
3185                         osvers="$3"
3186                         ;;
3187                 os2)    osname=os2
3188                         osvers="$4"
3189                         ;;
3190                 POSIX-BC | posix-bc ) osname=posix-bc
3191                         osvers="$3"
3192                         ;;
3193                 powerux | power_ux | powermax_os | powermaxos | \
3194                 powerunix | power_unix) osname=powerux
3195                         osvers="$3"
3196                         ;;
3197                 qnx) osname=qnx
3198                         osvers="$4"
3199                         ;;
3200                 solaris) osname=solaris
3201                         case "$3" in
3202                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3203                         *)      osvers="$3" ;;
3204                         esac
3205                         ;;
3206                 sunos) osname=sunos
3207                         case "$3" in
3208                         5*) osname=solaris
3209                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3210                         *)      osvers="$3" ;;
3211                         esac
3212                         ;;
3213                 titanos) osname=titanos
3214                         case "$3" in
3215                         1*) osvers=1 ;;
3216                         2*) osvers=2 ;;
3217                         3*) osvers=3 ;;
3218                         4*) osvers=4 ;;
3219                         *)      osvers="$3" ;;
3220                         esac
3221                         ;;
3222                 ultrix) osname=ultrix
3223                         osvers="$3"
3224                         ;;
3225                 osf1|mls+)      case "$5" in
3226                                 alpha)
3227                                         osname=dec_osf
3228                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3229                                         case "$osvers" in
3230                                         [1-9].[0-9]*) ;;
3231                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3232                                         esac
3233                                         ;;
3234                         hp*)    osname=hp_osf1  ;;
3235                         mips)   osname=mips_osf1 ;;
3236                         esac
3237                         ;;
3238                 # UnixWare 7.1.2 is known as Open UNIX 8
3239                 openunix|unixware) osname=svr5
3240                         osvers="$4"
3241                         ;;
3242                 uts)    osname=uts
3243                         osvers="$3"
3244                         ;;
3245                 vos) osvers="$3"
3246                         ;;
3247                 $2) case "$osname" in
3248                         *isc*) ;;
3249                         *freebsd*) ;;
3250                         svr*)
3251                                 : svr4.x or possibly later
3252                                 case "svr$3" in
3253                                 ${osname}*)
3254                                         osname=svr$3
3255                                         osvers=$4
3256                                         ;;
3257                                 esac
3258                                 case "$osname" in
3259                                 svr4.0)
3260                                         : Check for ESIX
3261                                         if test -f /stand/boot ; then
3262                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3263                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3264                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3265                                                         if test -n "$isesix"; then
3266                                                                 osname=esix4
3267                                                         fi
3268                                                 fi
3269                                         fi
3270                                         ;;
3271                                 esac
3272                                 ;;
3273                         *)      if test -f /etc/systemid; then
3274                                         osname=sco
3275                                         set `echo $3 | $sed 's/\./ /g'` $4
3276                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3277                                                 osvers=$1.$2.$3
3278                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3279                                                 osvers=$1.$2
3280                                         elif $test -f $src/hints/sco_$1.sh; then
3281                                                 osvers=$1
3282                                         fi
3283                                 else
3284                                         case "$osname" in
3285                                         '') : Still unknown.  Probably a generic Sys V.
3286                                                 osname="sysv"
3287                                                 osvers="$3"
3288                                                 ;;
3289                                         esac
3290                                 fi
3291                                 ;;
3292                         esac
3293                         ;;
3294                 *)      case "$osname" in
3295                         '') : Still unknown.  Probably a generic BSD.
3296                                 osname="$1"
3297                                 osvers="$3"
3298                                 ;;
3299                         esac
3300                         ;;
3301                 esac
3302         else
3303                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3304                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3305                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3306                                 osname=news_os
3307                         fi
3308                         $rm -f UU/kernel.what
3309                 elif test -d c:/. -o -n "$is_os2" ; then
3310                         set X $myuname
3311                         osname=os2
3312                         osvers="$5"
3313                 fi
3314         fi
3315
3316         case "$targetarch" in
3317         '') ;;
3318         *)  hostarch=$osname
3319             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3320             osvers=''
3321             ;;
3322         esac
3323
3324         : Now look for a hint file osname_osvers, unless one has been
3325         : specified already.
3326         case "$hintfile" in
3327         ''|' ')
3328                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3329                 : Also try without trailing minor version numbers.
3330                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3331                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3332                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3333                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3334                 case "$file" in
3335                 '') dflt=none ;;
3336                 *)  case "$osvers" in
3337                         '') dflt=$file
3338                                 ;;
3339                         *)  if $test -f $src/hints/$file.sh ; then
3340                                         dflt=$file
3341                                 elif $test -f $src/hints/$xfile.sh ; then
3342                                         dflt=$xfile
3343                                 elif $test -f $src/hints/$xxfile.sh ; then
3344                                         dflt=$xxfile
3345                                 elif $test -f $src/hints/$xxxfile.sh ; then
3346                                         dflt=$xxxfile
3347                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3348                                         dflt=$xxxxfile
3349                                 elif $test -f "$src/hints/${osname}.sh" ; then
3350                                         dflt="${osname}"
3351                                 else
3352                                         dflt=none
3353                                 fi
3354                                 ;;
3355                         esac
3356                         ;;
3357                 esac
3358                 if $test -f Policy.sh ; then
3359                         case "$dflt" in
3360                         *Policy*) ;;
3361                         none) dflt="Policy" ;;
3362                         *) dflt="Policy $dflt" ;;
3363                         esac
3364                 fi
3365                 ;;
3366         *)
3367                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3368                 ;;
3369         esac
3370
3371         if $test -f Policy.sh ; then
3372                 $cat <<EOM
3373
3374 There's also a Policy hint file available, which should make the
3375 site-specific (policy) questions easier to answer.
3376 EOM
3377
3378         fi
3379
3380         $cat <<EOM
3381
3382 You may give one or more space-separated answers, or "none" if appropriate.
3383 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3384 is a good thing.  DO NOT give a wrong version or a wrong OS.
3385
3386 EOM
3387
3388         rp="Which of these apply, if any?"
3389         . UU/myread
3390         tans=$ans
3391         for file in $tans; do
3392                 if $test X$file = XPolicy -a -f Policy.sh; then
3393                         . Policy.sh
3394                         $cat Policy.sh >> UU/config.sh
3395                 elif $test -f $src/hints/$file.sh; then
3396                         . $src/hints/$file.sh
3397                         $cat $src/hints/$file.sh >> UU/config.sh
3398                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3399                         : nothing
3400                 else
3401                         : Give one chance to correct a possible typo.
3402                         echo "$file.sh does not exist"
3403                         dflt=$file
3404                         rp="hint to use instead?"
3405                         . UU/myread
3406                         for file in $ans; do
3407                                 if $test -f "$src/hints/$file.sh"; then
3408                                         . $src/hints/$file.sh
3409                                         $cat $src/hints/$file.sh >> UU/config.sh
3410                                 elif $test X$ans = X -o X$ans = Xnone ; then
3411                                         : nothing
3412                                 else
3413                                         echo "$file.sh does not exist -- ignored."
3414                                 fi
3415                         done
3416                 fi
3417         done
3418
3419         hint=recommended
3420         : Remember our hint file for later.
3421         if $test -f "$src/hints/$file.sh" ; then
3422                 hintfile="$file"
3423         else
3424                 hintfile=''
3425         fi
3426 fi
3427 cd UU
3428 ;;
3429 *)
3430         echo " "
3431         echo "Fetching default answers from $config_sh..." >&4
3432         tmp_n="$n"
3433         tmp_c="$c"
3434         cd ..
3435         cp $config_sh config.sh 2>/dev/null
3436         chmod +w config.sh
3437         . ./config.sh
3438         cd UU
3439         cp ../config.sh .
3440         n="$tmp_n"
3441         c="$tmp_c"
3442         hint=previous
3443         ;;
3444 esac
3445 test "$override" && . ./optdef.sh
3446
3447 : Restore computed paths
3448 for file in $loclist $trylist; do
3449         eval $file="\$_$file"
3450 done
3451
3452 cat << EOM
3453
3454 Configure uses the operating system name and version to set some defaults.
3455 The default value is probably right if the name rings a bell. Otherwise,
3456 since spelling matters for me, either accept the default or answer "none"
3457 to leave it blank.
3458
3459 EOM
3460 case "$osname" in
3461         ''|' ')
3462                 case "$hintfile" in
3463                 ''|' '|none) dflt=none ;;
3464                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3465                 esac
3466                 ;;
3467         *) dflt="$osname" ;;
3468 esac
3469 rp="Operating system name?"
3470 . ./myread
3471 case "$ans" in
3472 none)  osname='' ;;
3473 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3474 esac
3475 echo " "
3476 case "$osvers" in
3477         ''|' ')
3478                 case "$hintfile" in
3479                 ''|' '|none) dflt=none ;;
3480                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3481                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3482                         case "$dflt" in
3483                         ''|' ') dflt=none ;;
3484                         esac
3485                         ;;
3486                 esac
3487                 ;;
3488         *) dflt="$osvers" ;;
3489 esac
3490 rp="Operating system version?"
3491 . ./myread
3492 case "$ans" in
3493 none)  osvers='' ;;
3494 *) osvers="$ans" ;;
3495 esac
3496
3497
3498 . ./posthint.sh
3499
3500 : who configured the system
3501 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3502 case "$cf_by" in
3503 "")
3504         cf_by=`(logname) 2>/dev/null`
3505         case "$cf_by" in
3506         "")
3507                 cf_by=`(whoami) 2>/dev/null`
3508                 case "$cf_by" in
3509                 "") cf_by=unknown ;;
3510                 esac ;;
3511         esac ;;
3512 esac
3513
3514 : decide how portable to be.  Allow command line overrides.
3515 case "$d_portable" in
3516 "$undef") ;;
3517 *)      d_portable="$define" ;;
3518 esac
3519
3520 : set up shell script to do ~ expansion
3521 cat >filexp <<EOSS
3522 $startsh
3523 : expand filename
3524 case "\$1" in
3525  ~/*|~)
3526         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3527         ;;
3528  ~*)
3529         if $test -f /bin/csh; then
3530                 /bin/csh -f -c "glob \$1"
3531                 failed=\$?
3532                 echo ""
3533                 exit \$failed
3534         else
3535                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3536                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3537                 if $test ! -d "\$dir"; then
3538                         me=\`basename \$0\`
3539                         echo "\$me: can't locate home directory for: \$name" >&2
3540                         exit 1
3541                 fi
3542                 case "\$1" in
3543                 */*)
3544                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3545                         ;;
3546                 *)
3547                         echo \$dir
3548                         ;;
3549                 esac
3550         fi
3551         ;;
3552 *)
3553         echo \$1
3554         ;;
3555 esac
3556 EOSS
3557 chmod +x filexp
3558 $eunicefix filexp
3559
3560 : now set up to get a file name
3561 cat <<EOS >getfile
3562 $startsh
3563 EOS
3564 cat <<'EOSC' >>getfile
3565 tilde=''
3566 fullpath=''
3567 already=''
3568 skip=''
3569 none_ok=''
3570 exp_file=''
3571 nopath_ok=''
3572 orig_rp="$rp"
3573 orig_dflt="$dflt"
3574 case "$gfpth" in
3575 '') gfpth='.' ;;
3576 esac
3577
3578 case "$fn" in
3579 *\(*)
3580         : getfile will accept an answer from the comma-separated list
3581         : enclosed in parentheses even if it does not meet other criteria.
3582         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3583         fn=`echo $fn | sed 's/(.*)//'`
3584         ;;
3585 esac
3586
3587 case "$fn" in
3588 *:*)
3589         loc_file=`expr $fn : '.*:\(.*\)'`
3590         fn=`expr $fn : '\(.*\):.*'`
3591         ;;
3592 esac
3593
3594 case "$fn" in
3595 *~*) tilde=true;;
3596 esac
3597 case "$fn" in
3598 */*) fullpath=true;;
3599 esac
3600 case "$fn" in
3601 *+*) skip=true;;
3602 esac
3603 case "$fn" in
3604 *n*) none_ok=true;;
3605 esac
3606 case "$fn" in
3607 *e*) exp_file=true;;
3608 esac
3609 case "$fn" in
3610 *p*) nopath_ok=true;;
3611 esac
3612
3613 case "$fn" in
3614 *f*) type='File';;
3615 *d*) type='Directory';;
3616 *l*) type='Locate';;
3617 esac
3618
3619 what="$type"
3620 case "$what" in
3621 Locate) what='File';;
3622 esac
3623
3624 case "$exp_file" in
3625 '')
3626         case "$d_portable" in
3627         "$define") ;;
3628         *) exp_file=true;;
3629         esac
3630         ;;
3631 esac
3632
3633 cd ..
3634 while test "$type"; do
3635         redo=''
3636         rp="$orig_rp"
3637         dflt="$orig_dflt"
3638         case "$tilde" in
3639         true) rp="$rp (~name ok)";;
3640         esac
3641         . UU/myread
3642         if test -f UU/getfile.ok && \
3643                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3644         then
3645                 value="$ans"
3646                 ansexp="$ans"
3647                 break
3648         fi
3649         case "$ans" in
3650         none)
3651                 value=''
3652                 ansexp=''
3653                 case "$none_ok" in
3654                 true) type='';;
3655                 esac
3656                 ;;
3657         *)
3658                 case "$tilde" in
3659                 '') value="$ans"
3660                         ansexp="$ans";;
3661                 *)
3662                         value=`UU/filexp $ans`
3663                         case $? in
3664                         0)
3665                                 if test "$ans" != "$value"; then
3666                                         echo "(That expands to $value on this system.)"
3667                                 fi
3668                                 ;;
3669                         *) value="$ans";;
3670                         esac
3671                         ansexp="$value"
3672                         case "$exp_file" in
3673                         '') value="$ans";;
3674                         esac
3675                         ;;
3676                 esac
3677                 case "$fullpath" in
3678                 true)
3679                         case "$ansexp" in
3680                         /*) value="$ansexp" ;;
3681                         [a-zA-Z]:/*) value="$ansexp" ;;
3682                         *)
3683                                 redo=true
3684                                 case "$already" in
3685                                 true)
3686                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3687                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3688                                         ;;
3689                                 *)
3690                                 echo "Please give a full path name, starting with slash." >&4
3691                                         case "$tilde" in
3692                                         true)
3693                                 echo "Note that using ~name is ok provided it expands well." >&4
3694                                                 already=true
3695                                                 ;;
3696                                         esac
3697                                 esac
3698                                 ;;
3699                         esac
3700                         ;;
3701                 esac
3702                 case "$redo" in
3703                 '')
3704                         case "$type" in
3705                         File)
3706                                 for fp in $gfpth; do
3707                                         if test "X$fp" = X.; then
3708                                             pf="$ansexp"
3709                                         else    
3710                                             pf="$fp/$ansexp"
3711                                         fi
3712                                         if test -f "$pf"; then
3713                                                 type=''
3714                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3715                                         then
3716                                                 echo "($value is not a plain file, but that's ok.)"
3717                                                 type=''
3718                                         fi
3719                                         if test X"$type" = X; then
3720                                             value="$pf"
3721                                             break
3722                                         fi
3723                                 done
3724                                 ;;
3725                         Directory)
3726                                 for fp in $gfpth; do
3727                                         if test "X$fp" = X.; then
3728                                             dir="$ans"
3729                                             direxp="$ansexp"
3730                                         else    
3731                                             dir="$fp/$ansexp"
3732                                             direxp="$fp/$ansexp"
3733                                         fi
3734                                         if test -d "$direxp"; then
3735                                                 type=''
3736                                                 value="$dir"
3737                                                 break
3738                                         fi
3739                                 done
3740                                 ;;
3741                         Locate)
3742                                 if test -d "$ansexp"; then
3743                                         echo "(Looking for $loc_file in directory $value.)"
3744                                         value="$value/$loc_file"
3745                                         ansexp="$ansexp/$loc_file"
3746                                 fi
3747                                 if test -f "$ansexp"; then
3748                                         type=''
3749                                 fi
3750                                 case "$nopath_ok" in
3751                                 true)   case "$value" in
3752                                         */*) ;;
3753                                         *)      echo "Assuming $value will be in people's path."
3754                                                 type=''
3755                                                 ;;
3756                                         esac
3757                                         ;;
3758                                 esac
3759                                 ;;
3760                         esac
3761
3762                         case "$skip" in
3763                         true) type='';
3764                         esac
3765
3766                         case "$type" in
3767                         '') ;;
3768                         *)
3769                                 if test "$fastread" = yes; then
3770                                         dflt=y
3771                                 else
3772                                         dflt=n
3773                                 fi
3774                                 rp="$what $value doesn't exist.  Use that name anyway?"
3775                                 . UU/myread
3776                                 dflt=''
3777                                 case "$ans" in
3778                                 y*) type='';;
3779                                 *) echo " ";;
3780                                 esac
3781                                 ;;
3782                         esac
3783                         ;;
3784                 esac
3785                 ;;
3786         esac
3787 done
3788 cd UU
3789 ans="$value"
3790 rp="$orig_rp"
3791 dflt="$orig_dflt"
3792 rm -f getfile.ok
3793 test "X$gfpthkeep" != Xy && gfpth=""
3794 EOSC
3795
3796 : determine root of directory hierarchy where package will be installed.
3797 case "$prefix" in
3798 '')
3799         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3800         ;;
3801 *?/)
3802         dflt=`echo "$prefix" | sed 's/.$//'`
3803         ;;
3804 *)
3805         dflt="$prefix"
3806         ;;
3807 esac
3808 $cat <<EOM
3809
3810 By default, $package will be installed in $dflt/bin, manual pages
3811 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3812 installation directories. Typically this is something like /usr/local.
3813 If you wish to have binaries under /usr/bin but other parts of the
3814 installation under /usr/local, that's ok: you will be prompted
3815 separately for each of the installation directories, the prefix being
3816 only used to set the defaults.
3817
3818 EOM
3819 fn=d~
3820 rp='Installation prefix to use?'
3821 . ./getfile
3822 oldprefix=''
3823 case "$prefix" in
3824 '') ;;
3825 *)
3826         case "$ans" in
3827         "$prefix") ;;
3828         *) oldprefix="$prefix";;
3829         esac
3830         ;;
3831 esac
3832 prefix="$ans"
3833 prefixexp="$ansexp"
3834
3835 case "$afsroot" in
3836 '')     afsroot=/afs ;;
3837 *)      afsroot=$afsroot ;;
3838 esac
3839
3840 : is AFS running?
3841 echo " "
3842 case "$afs" in
3843 $define|true)   afs=true ;;
3844 $undef|false)   afs=false ;;
3845 *)      if test -d $afsroot; then
3846                 afs=true
3847         else
3848                 afs=false
3849         fi
3850         ;;
3851 esac
3852 if $afs; then
3853         echo "AFS may be running... I'll be extra cautious then..." >&4
3854 else
3855         echo "AFS does not seem to be running..." >&4
3856 fi
3857
3858 : determine installation prefix for where package is to be installed.
3859 if $afs; then 
3860 $cat <<EOM
3861
3862 Since you are running AFS, I need to distinguish the directory in which
3863 files will reside from the directory in which they are installed (and from
3864 which they are presumably copied to the former directory by occult means).
3865
3866 EOM
3867         case "$installprefix" in
3868         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3869         *) dflt="$installprefix";;
3870         esac
3871 else
3872 $cat <<EOM
3873
3874 In some special cases, particularly when building $package for distribution,
3875 it is convenient to distinguish the directory in which files should be
3876 installed from the directory ($prefix) in which they will
3877 eventually reside.  For most users, these two directories are the same.
3878
3879 EOM
3880         case "$installprefix" in
3881         '') dflt=$prefix ;;
3882         *) dflt=$installprefix;;
3883         esac
3884 fi
3885 fn=d~
3886 rp='What installation prefix should I use for installing files?'
3887 . ./getfile
3888 installprefix="$ans"
3889 installprefixexp="$ansexp"
3890
3891 : Perform the prefixexp/installprefixexp correction if necessary
3892 cat <<EOS >installprefix
3893 $startsh
3894 EOS
3895 cat <<'EOSC' >>installprefix
3896 : Change installation prefix, if necessary.
3897 if $test X"$prefix" != X"$installprefix"; then
3898     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3899 else
3900     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3901 fi
3902 EOSC
3903 chmod +x installprefix
3904 $eunicefix installprefix
3905
3906 : Set variables such as privlib and privlibexp from the output of ./getfile
3907 : performing the prefixexp/installprefixexp correction if necessary.
3908 cat <<EOS >setprefixvar
3909 $startsh
3910 EOS
3911 cat <<'EOSC' >>setprefixvar
3912 eval "${prefixvar}=\"\$ans\""
3913 eval "${prefixvar}exp=\"\$ansexp\""
3914 . ./installprefix
3915 EOSC
3916 chmod +x setprefixvar
3917 $eunicefix setprefixvar
3918
3919 : set up the script used to warn in case of inconsistency
3920 cat <<EOS >whoa
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>whoa
3924 dflt=y
3925 echo " "
3926 echo "*** WHOA THERE!!! ***" >&4
3927 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3928 rp="    Keep the $hint value?"
3929 . ./myread
3930 case "$ans" in
3931 y) td=$was; tu=$was;;
3932 esac
3933 EOSC
3934
3935 : function used to set $1 to $val
3936 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3937 case "$val$was" in
3938 $define$undef) . ./whoa; eval "$var=\$td";;
3939 $undef$define) . ./whoa; eval "$var=\$tu";;
3940 *) eval "$var=$val";;
3941 esac'
3942
3943 case "$usesocks" in
3944 $define|true|[yY]*)     dflt='y';;
3945 *) dflt='n';;
3946 esac
3947 cat <<EOM
3948
3949 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3950 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3951 to use the PerlIO abstraction layer, this will be implicitly selected.
3952
3953 If this doesn't make any sense to you, just accept the default '$dflt'.
3954 EOM
3955 rp='Build Perl for SOCKS?'
3956 . ./myread
3957 case "$ans" in
3958 y|Y)    val="$define" ;;     
3959 *)      val="$undef" ;;
3960 esac
3961 set usesocks
3962 eval $setvar
3963
3964 case "$usesocks" in
3965 $define|true|[yY]*) useperlio="$define";;
3966 esac
3967
3968 case "$useperlio" in
3969 $define|true|[yY]*|'')  dflt='y';;
3970 *) dflt='n';;
3971 esac
3972 cat <<EOM
3973
3974 Previous version of $package used the standard IO mechanisms as
3975 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3976 alternate IO mechanisms via the PerlIO abstraction layer, but the
3977 stdio mechanism is still available if needed.  The abstraction layer
3978 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3979 Using PerlIO with sfio may cause problems with some extension modules.
3980
3981 If this doesn't make any sense to you, just accept the default '$dflt'.
3982 EOM
3983 rp='Use the PerlIO abstraction layer?'
3984 . ./myread
3985 case "$ans" in
3986 y|Y) 
3987         val="$define"
3988         ;;
3989 *)      
3990         echo "Ok, doing things the stdio way."
3991         val="$undef"
3992         ;;
3993 esac
3994 set useperlio
3995 eval $setvar 
3996
3997 case "$usesocks" in
3998 $define|true|[yY]*)
3999         case "$useperlio" in
4000         $define|true|[yY]*) ;;
4001         *)      cat >&4 <<EOM
4002
4003 You are using the SOCKS proxy protocol library which means that you
4004 should also use the PerlIO layer.  You may be headed for trouble.
4005
4006 EOM
4007                 ;;
4008         esac
4009         ;;
4010 esac
4011
4012         
4013 case "$usethreads" in
4014 $define|true|[yY]*)     dflt='y';;
4015 *)     # Catch case where user specified ithreads or 5005threads but
4016        # forgot -Dusethreads (A.D. 4/2002)
4017        case "$useithreads$use5005threads" in
4018        *$define*)      
4019                 case "$useperlio" in
4020                 "$define")      dflt='y' ;;
4021                 *)              dflt='n' ;;
4022                 esac
4023                 ;;
4024        *)       dflt='n';;
4025        esac
4026        ;;
4027 esac
4028 cat <<EOM
4029
4030 Perl can be built to take advantage of threads on some systems.
4031 To do so, Configure can be run with -Dusethreads.
4032
4033 Note that Perl built with threading support runs slightly slower
4034 and uses more memory than plain Perl. The current implementation
4035 is believed to be stable, but it is fairly new, and so should be
4036 treated with caution.
4037
4038 If this doesn't make any sense to you, just accept the default '$dflt'.
4039 EOM
4040 rp='Build a threading Perl?'
4041 . ./myread
4042 case "$ans" in
4043 y|Y)    val="$define" ;;
4044 *)      val="$undef" ;;
4045 esac
4046 set usethreads
4047 eval $setvar
4048
4049 case "$usethreads" in
4050 $define)
4051         $cat <<EOM
4052
4053 Since release 5.6, Perl has had two different threading implementations,
4054 the newer interpreter-based version (ithreads) with one interpreter per
4055 thread, and the older 5.005 version (5005threads).
4056 The 5005threads version is effectively unmaintained and will probably be
4057 removed in Perl 5.10, so there should be no need to build a Perl using it
4058 unless needed for backwards compatibility with some existing 5.005threads
4059 code.
4060
4061 EOM
4062         : Default to ithreads unless overridden on command line or with
4063         : old config.sh
4064         dflt='y'
4065         case "$use5005threads" in
4066                 $define|true|[yY]*) dflt='n';;
4067         esac
4068         case "$useithreads" in
4069                 $undef|false|[nN]*) dflt='n';;
4070         esac
4071         rp='Use the newer interpreter-based ithreads?'
4072         . ./myread
4073         case "$ans" in
4074         y|Y)    val="$define" ;;
4075         *)      val="$undef" ;;
4076         esac
4077         set useithreads
4078         eval $setvar
4079         : Now set use5005threads to the opposite value.
4080         case "$useithreads" in
4081         $define) val="$undef" ;;
4082         *) val="$define" ;;
4083         esac
4084         set use5005threads
4085         eval $setvar
4086         ;;
4087 *)
4088         useithreads="$undef"
4089         use5005threads="$undef"
4090         ;;
4091 esac
4092
4093 case "$useithreads$use5005threads" in
4094 "$define$define")
4095         $cat >&4 <<EOM
4096
4097 You cannot have both the ithreads and the 5.005 threads enabled
4098 at the same time.  Disabling the 5.005 threads since they are
4099 much less stable than the ithreads.
4100
4101 EOM
4102         use5005threads="$undef"
4103         ;;
4104 esac
4105
4106 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4107         cat >&4 <<EOF
4108 ***
4109 *** To build with ithreads you must also use the PerlIO layer.
4110 *** Cannot continue, aborting.
4111 ***
4112 EOF
4113         exit 1
4114 fi
4115
4116 case "$d_oldpthreads" in
4117 '')     : Configure tests would be welcome here.  For now, assume undef.
4118         val="$undef" ;;
4119 *)      val="$d_oldpthreads" ;;
4120 esac
4121 set d_oldpthreads
4122 eval $setvar
4123
4124
4125 : Look for a hint-file generated 'call-back-unit'.  If the
4126 : user has specified that a threading perl is to be built,
4127 : we may need to set or change some other defaults.
4128 if $test -f usethreads.cbu; then
4129     echo "Your platform has some specific hints regarding threaded builds, using them..."
4130     . ./usethreads.cbu
4131 else
4132     case "$usethreads" in
4133         "$define"|true|[yY]*)
4134                 $cat <<EOM
4135 (Your platform does not have any specific hints for threaded builds.
4136  Assuming POSIX threads, then.)
4137 EOM
4138         ;;
4139     esac
4140 fi
4141
4142 cat <<EOM
4143
4144 Perl can be built so that multiple Perl interpreters can coexist
4145 within the same Perl executable.
4146 EOM
4147
4148 case "$useithreads" in
4149 $define)
4150         cat <<EOM
4151 This multiple interpreter support is required for interpreter-based threads.
4152 EOM
4153         val="$define"
4154         ;;
4155 *)      case "$usemultiplicity" in
4156         $define|true|[yY]*)     dflt='y';;
4157         *) dflt='n';;
4158         esac
4159         echo " "
4160         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4161         rp='Build Perl for multiplicity?'
4162         . ./myread
4163         case "$ans" in
4164         y|Y)    val="$define" ;;
4165         *)      val="$undef" ;;
4166         esac
4167         ;;
4168 esac
4169 set usemultiplicity
4170 eval $setvar
4171
4172
4173 case "$usemorebits" in
4174 "$define"|true|[yY]*)
4175         use64bitint="$define"
4176         uselongdouble="$define"
4177         usemorebits="$define"
4178         ;;
4179 *)      usemorebits="$undef"
4180         ;;
4181 esac
4182
4183 : make some quick guesses about what we are up against
4184 echo " "
4185 $echo $n "Hmm...  $c"
4186 echo exit 1 >bsd
4187 echo exit 1 >usg
4188 echo exit 1 >v7
4189 echo exit 1 >osf1
4190 echo exit 1 >eunice
4191 echo exit 1 >xenix
4192 echo exit 1 >venix
4193 echo exit 1 >os2
4194 d_bsd="$undef"
4195 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4196 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4197 then
4198         echo "Looks kind of like an OSF/1 system, but we'll see..."
4199         echo exit 0 >osf1
4200 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4201         xxx=`./loc addbib blurfl $pth`
4202         if $test -f $xxx; then
4203         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4204                 echo exit 0 >bsd
4205                 echo exit 0 >usg
4206         else
4207                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4208                         echo "Looks kind of like an extended USG system, but we'll see..."
4209                 else
4210                         echo "Looks kind of like a USG system, but we'll see..."
4211                 fi
4212                 echo exit 0 >usg
4213         fi
4214 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4215         echo "Looks kind of like a BSD system, but we'll see..."
4216         d_bsd="$define"
4217         echo exit 0 >bsd
4218 else
4219         echo "Looks kind of like a Version 7 system, but we'll see..."
4220         echo exit 0 >v7
4221 fi
4222 case "$eunicefix" in
4223 *unixtovms*)
4224         $cat <<'EOI'
4225 There is, however, a strange, musty smell in the air that reminds me of
4226 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4227 EOI
4228         echo exit 0 >eunice
4229         d_eunice="$define"
4230 : it so happens the Eunice I know will not run shell scripts in Unix format
4231         ;;
4232 *)
4233         echo " "
4234         echo "Congratulations.  You aren't running Eunice."
4235         d_eunice="$undef"
4236         ;;
4237 esac
4238 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4239 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4240 : semicolon as a patch separator
4241 case "$p_" in
4242 :) ;;
4243 *)
4244         $cat <<'EOI'
4245 I have the feeling something is not exactly right, however...don't tell me...
4246 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4247 (Or you may be running DOS with DJGPP.)
4248 EOI
4249         echo exit 0 >os2
4250         ;;
4251 esac
4252 if test -f /xenix; then
4253         echo "Actually, this looks more like a XENIX system..."
4254         echo exit 0 >xenix
4255         d_xenix="$define"
4256 else
4257         echo " "
4258         echo "It's not Xenix..."
4259         d_xenix="$undef"
4260 fi
4261 chmod +x xenix
4262 $eunicefix xenix
4263 if test -f /venix; then
4264         echo "Actually, this looks more like a VENIX system..."
4265         echo exit 0 >venix
4266 else
4267         echo " "
4268         if ./xenix; then
4269                 : null
4270         else
4271                 echo "Nor is it Venix..."
4272         fi
4273 fi
4274 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4275 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4276 $rm -f foo
4277
4278 case "$cc" in
4279 '') dflt=cc;;
4280 *) dflt="$cc";;
4281 esac
4282 rp="Use which C compiler?"
4283 . ./myread
4284 cc="$ans"
4285
4286 : See if they have not cc but they do have gcc
4287 . ./trygcc
4288 : Look for a hint-file generated 'call-back-unit'.  Now that the
4289 : user has specified the compiler, we may need to set or change some
4290 : other defaults.
4291 if $test -f cc.cbu; then
4292     . ./cc.cbu
4293 fi
4294 . ./checkcc
4295
4296 echo " "
4297 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4298 $cat >try.c <<EOM
4299 #include <stdio.h>
4300 int main() {
4301 #ifdef __GNUC__
4302 #ifdef __VERSION__
4303         printf("%s\n", __VERSION__);
4304 #else
4305         printf("%s\n", "1");
4306 #endif
4307 #endif
4308         return(0);
4309 }
4310 EOM
4311 if $cc -o try $ccflags $ldflags try.c; then
4312         gccversion=`$run ./try`
4313         case "$gccversion" in
4314         '') echo "You are not using GNU cc." ;;
4315         *)  echo "You are using GNU cc $gccversion."
4316             ccname=gcc
4317             ;;
4318         esac
4319 else
4320         echo " "
4321         echo "*** WHOA THERE!!! ***" >&4
4322         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4323         case "$knowitall" in
4324         '')
4325         echo "    You'd better start hunting for one and let me know about it." >&4
4326                 exit 1
4327                 ;;
4328         esac
4329 fi
4330 $rm -f try try.*
4331 case "$gccversion" in
4332 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4333 esac
4334 case "$gccversion" in
4335 '') gccosandvers='' ;;
4336 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4337    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4338    gccshortvers=''
4339    case "$gccosandvers" in
4340    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4341    $osname$osvers) ;; # looking good
4342    $osname*) cat <<EOM >&4
4343
4344 *** WHOA THERE!!! ***
4345
4346     Your gcc has not been compiled for the exact release of
4347     your operating system ($gccosandvers versus $osname$osvers).
4348
4349     In general it is a good idea to keep gcc synchronized with
4350     the operating system because otherwise serious problems
4351     may ensue when trying to compile software, like Perl.
4352
4353     I'm trying to be optimistic here, though, and will continue.
4354     If later during the configuration and build icky compilation
4355     problems appear (headerfile conflicts being the most common
4356     manifestation), I suggest reinstalling the gcc to match
4357     your operating system release.
4358
4359 EOM
4360       ;;
4361    *) gccosandvers='' ;; # failed to parse, better be silent
4362    esac
4363    ;;
4364 esac
4365 case "$ccname" in
4366 '') ccname="$cc" ;;
4367 esac
4368
4369 # gcc 3.* complain about adding -Idirectories that they already know about,
4370 # so we will take those off from locincpth.
4371 case "$gccversion" in
4372 3*)
4373     echo "main(){}">try.c
4374     for incdir in $locincpth; do
4375        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4376              grep '^c[cp]p*[01]: warning: changing search order '`
4377        if test "X$warn" != X; then
4378            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4379        fi
4380     done
4381     $rm -f try try.*
4382 esac
4383
4384 : What should the include directory be ?
4385 echo " "
4386 $echo $n "Hmm...  $c"
4387 dflt='/usr/include'
4388 incpath=''
4389 mips_type=''
4390 if $test -f /bin/mips && /bin/mips; then
4391         echo "Looks like a MIPS system..."
4392         $cat >usr.c <<'EOCP'
4393 #ifdef SYSTYPE_BSD43
4394 /bsd43
4395 #endif
4396 EOCP
4397         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4398                 dflt='/bsd43/usr/include'
4399                 incpath='/bsd43'
4400                 mips_type='BSD 4.3'
4401         else
4402                 mips_type='System V'
4403         fi
4404         $rm -f usr.c usr.out
4405         echo "and you're compiling with the $mips_type compiler and libraries."
4406         xxx_prompt=y
4407         echo "exit 0" >mips
4408 else
4409         echo "Doesn't look like a MIPS system."
4410         xxx_prompt=n
4411         echo "exit 1" >mips
4412 fi
4413 chmod +x mips
4414 $eunicefix mips
4415 case "$usrinc" in
4416 '') ;;
4417 *) dflt="$usrinc";;
4418 esac
4419 case "$xxx_prompt" in
4420 y)      fn=d/
4421         echo " "
4422         rp='Where are the include files you want to use?'
4423         . ./getfile
4424         usrinc="$ans"
4425         ;;
4426 *)      usrinc="$dflt"
4427         ;;
4428 esac
4429
4430 : see how we invoke the C preprocessor
4431 echo " "
4432 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4433 cat <<'EOT' >testcpp.c
4434 #define ABC abc
4435 #define XYZ xyz
4436 ABC.XYZ
4437 EOT
4438 cd ..
4439 if test ! -f cppstdin; then
4440         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4441                 # AIX cc -E doesn't show the absolute headerfile
4442                 # locations but we'll cheat by using the -M flag.
4443                 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
4444         else
4445                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4446         fi
4447 else
4448         echo "Keeping your $hint cppstdin wrapper."
4449 fi
4450 chmod 755 cppstdin
4451 wrapper=`pwd`/cppstdin
4452 ok='false'
4453 cd UU
4454
4455 if $test "X$cppstdin" != "X" && \
4456         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4457         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4458 then
4459         echo "You used to use $cppstdin $cppminus so we'll use that again."
4460         case "$cpprun" in
4461         '') echo "But let's see if we can live without a wrapper..." ;;
4462         *)
4463                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4464                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4465                 then
4466                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4467                         ok='true'
4468                 else
4469                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4470                 fi
4471                 ;;
4472         esac
4473 else
4474         case "$cppstdin" in
4475         '') ;;
4476         *)
4477                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4478                 ;;
4479         esac
4480 fi
4481
4482 if $ok; then
4483         : nothing
4484 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4485         $cc -E <testcpp.c >testcpp.out 2>&1; \
4486         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4487         echo "Yup, it does."
4488         x_cpp="$cc -E"
4489         x_minus='';
4490 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4491         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4492         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4493         echo "Yup, it does."
4494         x_cpp="$cc -E"
4495         x_minus='-';
4496 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4497         $cc -P <testcpp.c >testcpp.out 2>&1; \
4498         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4499         echo "Yipee, that works!"
4500         x_cpp="$cc -P"
4501         x_minus='';
4502 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4503         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4504         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4505         echo "At long last!"
4506         x_cpp="$cc -P"
4507         x_minus='-';
4508 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4509         $cpp <testcpp.c >testcpp.out 2>&1; \
4510         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4511         echo "It works!"
4512         x_cpp="$cpp"
4513         x_minus='';
4514 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4515         $cpp - <testcpp.c >testcpp.out 2>&1; \
4516         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4517         echo "Hooray, it works!  I was beginning to wonder."
4518         x_cpp="$cpp"
4519         x_minus='-';
4520 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4521         $wrapper <testcpp.c >testcpp.out 2>&1; \
4522         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4523         x_cpp="$wrapper"
4524         x_minus=''
4525         echo "Eureka!"
4526 else
4527         dflt=''
4528         rp="No dice.  I can't find a C preprocessor.  Name one:"
4529         . ./myread
4530         x_cpp="$ans"
4531         x_minus=''
4532         $x_cpp <testcpp.c >testcpp.out 2>&1
4533         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4534                 echo "OK, that will do." >&4
4535         else
4536 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4537                 exit 1
4538         fi
4539 fi
4540
4541 case "$ok" in
4542 false)
4543         cppstdin="$x_cpp"
4544         cppminus="$x_minus"
4545         cpprun="$x_cpp"
4546         cpplast="$x_minus"
4547         set X $x_cpp
4548         shift
4549         case "$1" in
4550         "$cpp")
4551                 echo "Perhaps can we force $cc -E using a wrapper..."
4552                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4553                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4554                 then
4555                         echo "Yup, we can."
4556                         cppstdin="$wrapper"
4557                         cppminus='';
4558                 else
4559                         echo "Nope, we'll have to live without it..."
4560                 fi
4561                 ;;
4562         esac
4563         case "$cpprun" in
4564         "$wrapper")
4565                 cpprun=''
4566                 cpplast=''
4567                 ;;
4568         esac
4569         ;;
4570 esac
4571
4572 case "$cppstdin" in
4573 "$wrapper"|'cppstdin') ;;
4574 *) $rm -f $wrapper;;
4575 esac
4576 $rm -f testcpp.c testcpp.out
4577
4578 : Set private lib path
4579 case "$plibpth" in
4580 '') if ./mips; then
4581                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4582         fi;;
4583 esac
4584 case "$libpth" in
4585 ' ') dlist='';;
4586 '') dlist="$loclibpth $plibpth $glibpth";;
4587 *) dlist="$libpth";;
4588 esac
4589
4590 : Now check and see which directories actually exist, avoiding duplicates
4591 libpth=''
4592 for xxx in $dlist
4593 do
4594     if $test -d $xxx; then
4595                 case " $libpth " in
4596                 *" $xxx "*) ;;
4597                 *) libpth="$libpth $xxx";;
4598                 esac
4599     fi
4600 done
4601 $cat <<'EOM'
4602
4603 Some systems have incompatible or broken versions of libraries.  Among
4604 the directories listed in the question below, please remove any you
4605 know not to be holding relevant libraries, and add any that are needed.
4606 Say "none" for none.
4607
4608 EOM
4609 case "$libpth" in
4610 '') dflt='none';;
4611 *)
4612         set X $libpth
4613         shift
4614         dflt=${1+"$@"}
4615         ;;
4616 esac
4617 rp="Directories to use for library searches?"
4618 . ./myread
4619 case "$ans" in
4620 none) libpth=' ';;
4621 *) libpth="$ans";;
4622 esac
4623
4624 : compute shared library extension
4625 case "$so" in
4626 '')
4627         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4628                 dflt='sl'
4629         else
4630                 dflt='so'
4631         fi
4632         ;;
4633 *) dflt="$so";;
4634 esac
4635 $cat <<EOM
4636
4637 On some systems, shared libraries may be available.  Answer 'none' if
4638 you want to suppress searching of shared libraries for the remainder
4639 of this configuration.
4640
4641 EOM
4642 rp='What is the file extension used for shared libraries?'
4643 . ./myread
4644 so="$ans"
4645
4646 : Define several unixisms.
4647 : Hints files or command line option can be used to override them.
4648 : The convoluted testing is in case hints files set either the old
4649 : or the new name.
4650 case "$_exe" in
4651 '')     case "$exe_ext" in
4652         '')     ;;
4653         *)      _exe="$exe_ext" ;;
4654         esac
4655         ;;
4656 esac
4657 case "$_a" in
4658 '')     case "$lib_ext" in
4659     '') _a='.a';;
4660         *)      _a="$lib_ext" ;;
4661         esac
4662         ;;
4663 esac
4664 case "$_o" in
4665 '') case "$obj_ext" in
4666         '')     _o='.o';;
4667         *)      _o="$obj_ext";;
4668         esac
4669         ;;
4670 esac
4671 case "$p_" in
4672 '') case "$path_sep" in
4673         '')     p_=':';;
4674         *)      p_="$path_sep";;
4675         esac
4676         ;;
4677 esac
4678 exe_ext=$_exe
4679 lib_ext=$_a
4680 obj_ext=$_o
4681 path_sep=$p_
4682
4683 : Which makefile gets called first.  This is used by make depend.
4684 case "$firstmakefile" in
4685 '') firstmakefile='makefile';;
4686 esac
4687
4688 case "$ccflags" in
4689 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4690 esac
4691
4692 case "$uselongdouble" in
4693 $define|true|[yY]*)     dflt='y';;
4694 *) dflt='n';;
4695 esac
4696 cat <<EOM
4697
4698 Perl can be built to take advantage of long doubles which
4699 (if available) may give more accuracy and range for floating point numbers.
4700
4701 If this doesn't make any sense to you, just accept the default '$dflt'.
4702 EOM
4703 rp='Try to use long doubles if available?'
4704 . ./myread
4705 case "$ans" in
4706 y|Y)    val="$define"   ;;
4707 *)      val="$undef"    ;;
4708 esac
4709 set uselongdouble
4710 eval $setvar
4711
4712 case "$uselongdouble" in
4713 true|[yY]*) uselongdouble="$define" ;;
4714 esac
4715
4716 : Look for a hint-file generated 'call-back-unit'.  If the
4717 : user has specified that long doubles should be used,
4718 : we may need to set or change some other defaults.
4719 if $test -f uselongdouble.cbu; then
4720     echo "Your platform has some specific hints regarding long doubles, using them..."
4721     . ./uselongdouble.cbu
4722 else
4723     case "$uselongdouble" in
4724         $define)
4725                 $cat <<EOM
4726 (Your platform does not have any specific hints for long doubles.)
4727 EOM
4728         ;;
4729     esac
4730 fi
4731
4732 : Looking for optional libraries
4733 echo " "
4734 echo "Checking for optional libraries..." >&4
4735 case "$libs" in
4736 ' '|'') dflt='';;
4737 *) dflt="$libs";;
4738 esac
4739 case "$libswanted" in
4740 '') libswanted='c_s';;
4741 esac
4742 case "$usesocks" in
4743 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4744 esac
4745 libsfound=''
4746 libsfiles=''
4747 libsdirs=''
4748 libspath=''
4749 for thisdir in $libpth $xlibpth; do
4750   test -d $thisdir && libspath="$libspath $thisdir"
4751 done
4752 for thislib in $libswanted; do
4753         for thisdir in $libspath; do
4754             xxx=''
4755             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4756                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4757                 $test -f "$xxx" && eval $libscheck
4758                 $test -f "$xxx" && libstyle=shared
4759             fi
4760             if test ! -f "$xxx"; then
4761                 xxx=$thisdir/lib$thislib.$so
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$_a
4767                 $test -f "$xxx" && eval $libscheck
4768                 $test -f "$xxx" && libstyle=static
4769             fi
4770             if test ! -f "$xxx"; then
4771                 xxx=$thisdir/$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/lib${thislib}_s$_a
4777                 $test -f "$xxx" && eval $libscheck
4778                 $test -f "$xxx" && libstyle=static
4779                 $test -f "$xxx" && thislib=${thislib}_s
4780             fi
4781             if test ! -f "$xxx"; then
4782                 xxx=$thisdir/Slib$thislib$_a
4783                 $test -f "$xxx" && eval $libscheck
4784                 $test -f "$xxx" && libstyle=static
4785             fi
4786             if $test -f "$xxx"; then
4787                 case "$libstyle" in
4788                 shared) echo "Found -l$thislib (shared)." ;;
4789                 static) echo "Found -l$thislib." ;;
4790                 *)      echo "Found -l$thislib ($libstyle)." ;;
4791                 esac
4792                 case " $dflt " in
4793                 *"-l$thislib "*);;
4794                 *) dflt="$dflt -l$thislib"
4795                    libsfound="$libsfound $xxx"
4796                    yyy=`basename $xxx`
4797                    libsfiles="$libsfiles $yyy"
4798                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4799                    case " $libsdirs " in
4800                    *" $yyy "*) ;;
4801                    *) libsdirs="$libsdirs $yyy" ;;
4802                    esac
4803                    ;;
4804                 esac
4805                 break
4806             fi  
4807         done
4808         if $test ! -f "$xxx"; then
4809             echo "No -l$thislib."
4810         fi
4811 done
4812 set X $dflt
4813 shift
4814 dflt="$*"
4815 case "$libs" in
4816 '') dflt="$dflt";;
4817 *) dflt="$libs";;
4818 esac
4819 case "$dflt" in
4820 ' '|'') dflt='none';;
4821 esac
4822
4823 $cat <<EOM
4824
4825 In order to compile $package on your machine, a number of libraries
4826 are usually needed.  Include any other special libraries here as well.
4827 Say "none" for none.  The default list is almost always right.
4828 EOM
4829
4830 echo " "
4831 rp="What libraries to use?"
4832 . ./myread
4833 case "$ans" in
4834 none) libs=' ';;
4835 *) libs="$ans";;
4836 esac
4837
4838 : determine optimization, if desired, or use for debug flag also
4839 case "$optimize" in
4840 ' '|$undef) dflt='none';;
4841 '') dflt='-O';;
4842 *) dflt="$optimize";;
4843 esac
4844 $cat <<EOH
4845
4846 By default, $package compiles with the -O flag to use the optimizer.
4847 Alternately, you might want to use the symbolic debugger, which uses
4848 the -g flag (on traditional Unix systems).  Either flag can be
4849 specified here.  To use neither flag, specify the word "none".
4850
4851 EOH
4852 rp="What optimizer/debugger flag should be used?"
4853 . ./myread
4854 optimize="$ans"
4855 case "$optimize" in
4856 'none') optimize=" ";;
4857 esac
4858
4859 dflt=''
4860 : We will not override a previous value, but we might want to
4861 : augment a hint file
4862 case "$hint" in
4863 default|recommended)
4864         case "$gccversion" in
4865         1*) dflt='-fpcc-struct-return' ;;
4866         esac
4867         case "$optimize" in
4868         *-g*) dflt="$dflt -DDEBUGGING";;
4869         esac
4870         case "$gccversion" in
4871         2*) if test -d /etc/conf/kconfig.d &&
4872                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4873                 then
4874                         # Interactive Systems (ISC) POSIX mode.
4875                         dflt="$dflt -posix"
4876                 fi
4877                 ;;
4878         esac
4879         case "$gccversion" in
4880         1*) ;;
4881         2.[0-8]*) ;;
4882         ?*)     echo " "
4883                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4884                 echo 'int main(void) { return 0; }' > gcctest.c
4885                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4886                         echo "Yes, it does." 2>&1
4887                         case "$ccflags" in
4888                         *strict-aliasing*)
4889                                 echo "Leaving current flags $ccflags alone." 2>&1
4890                                 ;;
4891                         *) dflt="$dflt -fno-strict-aliasing" ;;
4892                         esac
4893                 else
4894                         echo "Nope, it doesn't, but that's ok." 2>&1
4895                 fi
4896                 ;;
4897         esac
4898         # For gcc, adding -pipe speeds up compilations for some, but apparently
4899         # some assemblers can't read from stdin.  (It also slows down compilations
4900         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4901         case "$gccversion" in
4902         ?*)     echo " "
4903                 echo "Checking if your compiler accepts -pipe" 2>&1
4904                 echo 'int main(void) { return 0; }' > gcctest.c
4905                 if $cc -pipe -o gcctest gcctest.c; then
4906                         echo "Yes, it does." 2>&1
4907                         case "$ccflags" in
4908                         *-pipe*)
4909                                 echo "Leaving current flags $ccflags alone." 2>&1
4910                                 ;;
4911                         *) dflt="$dflt -pipe" ;;
4912                         esac
4913                 else
4914                         echo "Nope, it doesn't, but that's ok." 2>&1
4915                 fi
4916
4917                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4918                 echo 'int main(void) { return 0; }' > gcctest.c
4919                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4920                         echo "Yes, it does." 2>&1
4921                         case "$ccflags" in
4922                         *-Wdeclaration-after-statement*)
4923                                 echo "Leaving current flags $ccflags alone." 2>&1
4924                                 ;;
4925                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4926                         esac
4927                 else
4928                         echo "Nope, it doesn't, but that's ok." 2>&1
4929                 fi
4930                 ;;
4931         esac
4932         ;;
4933 esac
4934
4935 case "$mips_type" in
4936 *BSD*|'') inclwanted="$locincpth $usrinc";;
4937 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4938 esac
4939 for thisincl in $inclwanted; do
4940         if $test -d $thisincl; then
4941                 if $test x$thisincl != x$usrinc; then
4942                         case "$dflt" in
4943                         *" -I$thisincl "*);;
4944                         *) dflt="$dflt -I$thisincl ";;
4945                         esac
4946                 fi
4947         fi
4948 done
4949
4950 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4951         xxx=true;
4952 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4953         xxx=true;
4954 else
4955         xxx=false;
4956 fi;
4957 if $xxx; then
4958         case "$dflt" in
4959         *$2*);;
4960         *) dflt="$dflt -D$2";;
4961         esac;
4962 fi'
4963
4964 set signal.h LANGUAGE_C; eval $inctest
4965
4966 case "$usesocks" in
4967 $define)
4968         ccflags="$ccflags -DSOCKS"
4969         ;;
4970 esac
4971
4972 case "$hint" in
4973 default|recommended) dflt="$ccflags $dflt" ;;
4974 *) dflt="$ccflags";;
4975 esac
4976
4977 case "$dflt" in
4978 ''|' ') dflt=none;;
4979 esac
4980
4981 $cat <<EOH
4982
4983 Your C compiler may want other flags.  For this question you should include
4984 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4985 but you should NOT include libraries or ld flags like -lwhatever.  If you
4986 want $package to honor its debug switch, you should include -DDEBUGGING here.
4987 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4988
4989 To use no flags, specify the word "none".
4990
4991 EOH
4992 set X $dflt
4993 shift
4994 dflt=${1+"$@"}
4995 rp="Any additional cc flags?"
4996 . ./myread
4997 case "$ans" in
4998 none) ccflags='';;
4999 *) ccflags="$ans";;
5000 esac
5001
5002 : the following weeds options from ccflags that are of no interest to cpp
5003 case "$cppflags" in
5004 '') cppflags="$ccflags" ;;
5005 *)  cppflags="$cppflags $ccflags" ;;
5006 esac
5007 case "$gccversion" in
5008 1*) cppflags="$cppflags -D__GNUC__"
5009 esac
5010 case "$mips_type" in
5011 '');;
5012 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5013 esac
5014 case "$cppflags" in
5015 '');;
5016 *)
5017         echo " "
5018         echo "Let me guess what the preprocessor flags are..." >&4
5019         set X $cppflags
5020         shift
5021         cppflags=''
5022         $cat >cpp.c <<'EOM'
5023 #define BLURFL foo
5024
5025 BLURFL xx LFRULB
5026 EOM
5027         previous=''
5028         for flag in $*
5029         do
5030                 case "$flag" in
5031                 -*) ftry="$flag";;
5032                 *) ftry="$previous $flag";;
5033                 esac
5034                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5035                         >cpp1.out 2>/dev/null && \
5036                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5037                         >cpp2.out 2>/dev/null && \
5038                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5039                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5040                 then
5041                         cppflags="$cppflags $ftry"
5042                         previous=''
5043                 else
5044                         previous="$flag"
5045                 fi
5046         done
5047         set X $cppflags
5048         shift
5049         cppflags=${1+"$@"}
5050         case "$cppflags" in
5051         *-*)  echo "They appear to be: $cppflags";;
5052         esac
5053         $rm -f cpp.c cpp?.out
5054         ;;
5055 esac
5056
5057 : flags used in final linking phase
5058 case "$ldflags" in
5059 '') if ./venix; then
5060                 dflt='-i -z'
5061         else
5062                 dflt=''
5063         fi
5064         case "$ccflags" in
5065         *-posix*) dflt="$dflt -posix" ;;
5066         esac
5067         ;;
5068 *) dflt="$ldflags";;
5069 esac
5070
5071 : Try to guess additional flags to pick up local libraries.
5072 for thislibdir in $libpth; do
5073         case " $loclibpth " in
5074         *" $thislibdir "*)
5075                 case "$dflt " in
5076                 *"-L$thislibdir "*) ;;
5077                 *)  dflt="$dflt -L$thislibdir" ;;
5078                 esac
5079                 ;;
5080         esac
5081 done
5082
5083 case "$dflt" in
5084 '') dflt='none' ;;
5085 esac
5086
5087 $cat <<EOH
5088
5089 Your C linker may need flags.  For this question you should
5090 include -L/whatever and any other flags used by the C linker, but you
5091 should NOT include libraries like -lwhatever.
5092
5093 Make sure you include the appropriate -L/path flags if your C linker
5094 does not normally search all of the directories you specified above,
5095 namely
5096         $libpth
5097 To use no flags, specify the word "none".
5098
5099 EOH
5100
5101 rp="Any additional ld flags (NOT including libraries)?"
5102 . ./myread
5103 case "$ans" in
5104 none) ldflags='';;
5105 *) ldflags="$ans";;
5106 esac
5107 rmlist="$rmlist pdp11"
5108
5109 : coherency check
5110 echo " "
5111 echo "Checking your choice of C compiler and flags for coherency..." >&4
5112 $cat > try.c <<'EOF'
5113 #include <stdio.h>
5114 int main() { printf("Ok\n"); return(0); }
5115 EOF
5116 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5117 shift
5118 $cat >try.msg <<'EOM'
5119 I've tried to compile and run the following simple program:
5120
5121 EOM
5122 $cat try.c >> try.msg
5123
5124 $cat >> try.msg <<EOM
5125
5126 I used the command:
5127
5128         $*
5129         $run ./try
5130
5131 and I got the following output:
5132
5133 EOM
5134 dflt=y
5135 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5136         if $sh -c "$run ./try" >>try.msg 2>&1; then
5137                 xxx=`$run ./try`
5138                 case "$xxx" in
5139                 "Ok") dflt=n ;;
5140                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5141                         case " $libs " in
5142                         *" -lsfio "*)
5143                                 cat >> try.msg <<'EOQS'
5144 If $libs contains -lsfio, and sfio is mis-configured, then it
5145 sometimes (apparently) runs and exits with a 0 status, but with no
5146 output!  It may have to do with sfio's use of _exit vs. exit.
5147
5148 EOQS
5149                                 rp="You have a big problem.  Shall I abort Configure"
5150                                 dflt=y
5151                                 ;;
5152                         esac
5153                         ;;
5154                 esac
5155         else
5156                 echo "The program compiled OK, but exited with status $?." >>try.msg
5157                 rp="You have a problem.  Shall I abort Configure"
5158                 dflt=y
5159         fi
5160 else
5161         echo "I can't compile the test program." >>try.msg
5162         rp="You have a BIG problem.  Shall I abort Configure"
5163         dflt=y
5164 fi
5165 case "$dflt" in
5166 y)
5167         $cat try.msg >&4
5168         case "$knowitall" in
5169         '')
5170                 echo "(The supplied flags or libraries might be incorrect.)"
5171                 ;;
5172         *) dflt=n;;
5173         esac
5174         echo " "
5175         . ./myread
5176         case "$ans" in
5177         n*|N*) ;;
5178         *)      echo "Ok.  Stopping Configure." >&4
5179                 exit 1
5180                 ;;
5181         esac
5182         ;;
5183 n) echo "OK, that should do.";;
5184 esac
5185 $rm -f try try.* core
5186
5187 : define a shorthand compile call
5188 compile='
5189 mc_file=$1;
5190 shift;
5191 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5192 : define a shorthand compile call for compilations that should be ok.
5193 compile_ok='
5194 mc_file=$1;
5195 shift;
5196 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5197
5198 : determine filename position in cpp output
5199 echo " "
5200 echo "Computing filename position in cpp output for #include directives..." >&4
5201 case "$osname" in
5202 vos) testaccess=-e ;;
5203 *)   testaccess=-r ;;
5204 esac
5205 echo '#include <stdio.h>' > foo.c
5206 $cat >fieldn <<EOF
5207 $startsh
5208 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5209 $grep '^[       ]*#.*stdio\.h' | \
5210 while read cline; do
5211         pos=1
5212         set \$cline
5213         while $test \$# -gt 0; do
5214                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5215                         echo "\$pos"
5216                         exit 0
5217                 fi
5218                 shift
5219                 pos=\`expr \$pos + 1\`
5220         done
5221 done
5222 EOF
5223 chmod +x fieldn
5224 fieldn=`./fieldn`
5225 $rm -f foo.c fieldn
5226 case $fieldn in
5227 '') pos='???';;
5228 1) pos=first;;
5229 2) pos=second;;
5230 3) pos=third;;
5231 *) pos="${fieldn}th";;
5232 esac
5233 echo "Your cpp writes the filename in the $pos field of the line."
5234
5235 case "$osname" in
5236 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5237 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5238 *)   cppfilter='' ;;
5239 esac
5240 : locate header file
5241 $cat >findhdr <<EOF
5242 $startsh
5243 wanted=\$1
5244 name=''
5245 for usrincdir in $usrinc
5246 do
5247         if test -f \$usrincdir/\$wanted; then
5248                 echo "\$usrincdir/\$wanted"
5249                 exit 0
5250         fi
5251 done
5252 awkprg='{ print \$$fieldn }'
5253 echo "#include <\$wanted>" > foo\$\$.c
5254 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5255 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5256 while read cline; do
5257         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5258         case "\$name" in
5259         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5260         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5261         *) exit 2;;
5262         esac;
5263 done;
5264 #
5265 # status = 0: grep returned 0 lines, case statement not executed
5266 # status = 1: headerfile found
5267 # status = 2: while loop executed, no headerfile found
5268 #
5269 status=\$?
5270 $rm -f foo\$\$.c;
5271 if test \$status -eq 1; then
5272         exit 0;
5273 fi
5274 exit 1
5275 EOF
5276 chmod +x findhdr
5277
5278 : define an alternate in-header-list? function
5279 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5280 cont=true; xxf="echo \"<\$1> found.\" >&4";
5281 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5282 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5283 esac;
5284 case $# in 4) instead=instead;; *) instead="at last";; esac;
5285 while $test "$cont"; do
5286         xxx=`./findhdr $1`
5287         var=$2; eval "was=\$$2";
5288         if $test "$xxx" && $test -r "$xxx";
5289         then eval $xxf;
5290         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5291                 cont="";
5292         else eval $xxnf;
5293         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5294         set $yyy; shift; shift; yyy=$@;
5295         case $# in 0) cont="";;
5296         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5297                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5298         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5299                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5300         esac;
5301 done;
5302 while $test "$yyy";
5303 do set $yyy; var=$2; eval "was=\$$2";
5304         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5305         set $yyy; shift; shift; yyy=$@;
5306 done'
5307
5308 : see if stdlib is available
5309 set stdlib.h i_stdlib
5310 eval $inhdr
5311
5312 : check for lengths of integral types
5313 echo " "
5314 case "$intsize" in
5315 '')
5316         echo "Checking to see how big your integers are..." >&4
5317         $cat >try.c <<EOCP
5318 #include <stdio.h>
5319 #$i_stdlib I_STDLIB
5320 #ifdef I_STDLIB
5321 #include <stdlib.h>
5322 #endif
5323 int main()
5324 {
5325         printf("intsize=%d;\n", (int)sizeof(int));
5326         printf("longsize=%d;\n", (int)sizeof(long));
5327         printf("shortsize=%d;\n", (int)sizeof(short));
5328         exit(0);
5329 }
5330 EOCP
5331         set try
5332         if eval $compile_ok && $run ./try > /dev/null; then
5333                 eval `$run ./try`
5334                 echo "Your integers are $intsize bytes long."
5335                 echo "Your long integers are $longsize bytes long."
5336                 echo "Your short integers are $shortsize bytes long."
5337         else
5338                 $cat >&4 <<EOM
5339 !
5340 Help! I can't compile and run the intsize test program: please enlighten me!
5341 (This is probably a misconfiguration in your system or libraries, and
5342 you really ought to fix it.  Still, I'll try anyway.)
5343 !
5344 EOM
5345                 dflt=4
5346                 rp="What is the size of an integer (in bytes)?"
5347                 . ./myread
5348                 intsize="$ans"
5349                 dflt=$intsize
5350                 rp="What is the size of a long integer (in bytes)?"
5351                 . ./myread
5352                 longsize="$ans"
5353                 dflt=2
5354                 rp="What is the size of a short integer (in bytes)?"
5355                 . ./myread
5356                 shortsize="$ans"
5357         fi
5358         ;;
5359 esac
5360 $rm -f try try.*
5361
5362 : check for long long
5363 echo " "
5364 echo "Checking to see if you have long long..." >&4
5365 echo 'int main() { long long x = 7; return 0; }' > try.c
5366 set try
5367 if eval $compile; then
5368         val="$define"
5369         echo "You have long long."
5370 else
5371         val="$undef"
5372         echo "You do not have long long."
5373 fi
5374 $rm try.*
5375 set d_longlong
5376 eval $setvar
5377
5378 : check for length of long long
5379 case "${d_longlong}${longlongsize}" in
5380 $define)
5381         echo " "
5382         echo "Checking to see how big your long longs are..." >&4
5383         $cat >try.c <<'EOCP'
5384 #include <stdio.h>
5385 int main()
5386 {
5387     printf("%d\n", (int)sizeof(long long));
5388     return(0);
5389 }
5390 EOCP
5391         set try
5392         if eval $compile_ok; then
5393                 longlongsize=`$run ./try`
5394                 echo "Your long longs are $longlongsize bytes long."
5395         else
5396                 dflt='8'
5397                 echo " "
5398                 echo "(I can't seem to compile the test program.  Guessing...)"
5399                 rp="What is the size of a long long (in bytes)?"
5400                 . ./myread
5401                 longlongsize="$ans"
5402         fi
5403         if $test "X$longsize" = "X$longlongsize"; then
5404                 echo "(That isn't any different from an ordinary long.)"
5405         fi      
5406         ;;
5407 esac
5408 $rm -f try.* try
5409
5410 : see if inttypes.h is available
5411 : we want a real compile instead of Inhdr because some systems
5412 : have an inttypes.h which includes non-existent headers
5413 echo " "
5414 $cat >try.c <<EOCP
5415 #include <inttypes.h>
5416 int main() {
5417         static int32_t foo32 = 0x12345678;
5418 }
5419 EOCP
5420 set try
5421 if eval $compile; then
5422         echo "<inttypes.h> found." >&4
5423         val="$define"
5424 else
5425         echo "<inttypes.h> NOT found." >&4
5426         val="$undef"
5427 fi
5428 $rm -f try.c try
5429 set i_inttypes
5430 eval $setvar
5431
5432 : check for int64_t
5433 echo " "
5434 echo "Checking to see if you have int64_t..." >&4
5435 $cat >try.c <<EOCP
5436 #include <sys/types.h>
5437 #$i_inttypes I_INTTYPES
5438 #ifdef I_INTTYPES
5439 #include <inttypes.h>
5440 #endif
5441 int main() { int64_t x = 7; }
5442 EOCP
5443 set try
5444 if eval $compile; then
5445         val="$define"
5446         echo "You have int64_t."
5447 else
5448         val="$undef"
5449         echo "You do not have int64_t."
5450 fi
5451 $rm -f try try.*
5452 set d_int64_t
5453 eval $setvar
5454
5455
5456 echo " "
5457 echo "Checking which 64-bit integer type we could use..." >&4
5458
5459 case "$intsize" in
5460 8) val=int
5461    set quadtype
5462    eval $setvar
5463    val='"unsigned int"'
5464    set uquadtype
5465    eval $setvar
5466    quadkind=1
5467    ;;
5468 *) case "$longsize" in
5469    8) val=long
5470       set quadtype
5471       eval $setvar
5472       val='"unsigned long"'
5473       set uquadtype
5474       eval $setvar
5475       quadkind=2
5476       ;;
5477    *) case "$d_longlong:$longlongsize" in
5478       define:8)
5479         val='"long long"'
5480         set quadtype
5481         eval $setvar
5482         val='"unsigned long long"'
5483         set uquadtype
5484         eval $setvar
5485         quadkind=3
5486         ;;
5487       *) case "$d_int64_t" in
5488          define)
5489            val=int64_t
5490            set quadtype
5491            eval $setvar
5492            val=uint64_t
5493            set uquadtype
5494            eval $setvar
5495            quadkind=4
5496            ;;
5497          esac
5498          ;;
5499       esac
5500       ;;
5501    esac
5502    ;;
5503 esac
5504
5505 case "$quadtype" in
5506 '')     echo "Alas, no 64-bit integer types in sight." >&4
5507         d_quad="$undef"
5508         ;;
5509 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5510         d_quad="$define"
5511         ;;
5512 esac
5513
5514
5515 case "$uselonglong" in
5516 "$define"|true|[yY]*)
5517         cat <<EOM >&4
5518
5519 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5520 EOM
5521         use64bitint="$define"
5522         ;;
5523 esac                          
5524 case "$use64bits" in
5525 "$define"|true|[yY]*)
5526         cat <<EOM >&4
5527
5528 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5529 EOM
5530         use64bitint="$define"
5531         ;;
5532 esac                          
5533 case "$use64bitints" in
5534 "$define"|true|[yY]*)
5535         cat <<EOM >&4
5536
5537 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5538 EOM
5539         use64bitint="$define"
5540         ;;
5541 esac                          
5542 case "$use64bitsint" in
5543 "$define"|true|[yY]*)
5544         cat <<EOM >&4
5545
5546 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5547 EOM
5548         use64bitint="$define"
5549         ;;
5550 esac                          
5551 case "$uselonglongs" in
5552 "$define"|true|[yY]*)
5553         cat <<EOM >&4
5554
5555 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5556 EOM
5557         use64bitint="$define"
5558         ;;
5559 esac                          
5560 case "$use64bitsall" in
5561 "$define"|true|[yY]*)
5562         cat <<EOM >&4
5563
5564 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5565 EOM
5566         use64bitall="$define"
5567         ;;
5568 esac                          
5569
5570 case "$ccflags" in
5571 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5572 esac
5573 case "$use64bitall" in
5574 "$define"|true|[yY]*) use64bitint="$define" ;;
5575 esac
5576
5577 case "$longsize" in
5578 8) cat <<EOM
5579
5580 You have natively 64-bit long integers.
5581 EOM
5582    val="$define"
5583    ;;
5584 *) case "$use64bitint" in
5585    "$define"|true|[yY]*) dflt='y';;
5586    *) dflt='n';;
5587    esac
5588    case "$d_quad" in
5589    "$define") ;;
5590    *) dflt='n' ;;
5591    esac
5592    cat <<EOM
5593
5594 Perl can be built to take advantage of 64-bit integer types
5595 on some systems.  To do so, Configure can be run with -Duse64bitint.
5596 Choosing this option will most probably introduce binary incompatibilities.
5597
5598 If this doesn't make any sense to you, just accept the default '$dflt'.
5599 (The default has been chosen based on your configuration.)
5600 EOM
5601    rp='Try to use 64-bit integers, if available?'
5602    . ./myread
5603    case "$ans" in
5604    [yY]*) val="$define" ;;
5605    *)     val="$undef"  ;;
5606    esac
5607    ;;
5608 esac
5609 set use64bitint
5610 eval $setvar
5611
5612 case "$use64bitall" in
5613 "$define"|true|[yY]*) dflt='y' ;;
5614 *) case "$longsize" in
5615    8) dflt='y' ;;
5616    *) dflt='n' ;;
5617    esac
5618    ;;
5619 esac    
5620 cat <<EOM
5621
5622 You may also choose to try maximal 64-bitness.  It means using as much
5623 64-bitness as possible on the platform.  This in turn means even more
5624 binary incompatibilities.  On the other hand, your platform may not
5625 have any more 64-bitness available than what you already have chosen.
5626
5627 If this doesn't make any sense to you, just accept the default '$dflt'.
5628 (The default has been chosen based on your configuration.)
5629 EOM
5630 rp='Try to use maximal 64-bit support, if available?'
5631 . ./myread
5632 case "$ans" in
5633 [yY]*) val="$define" ;;
5634 *)     val="$undef"  ;;
5635 esac
5636 set use64bitall
5637 eval $setvar
5638 case "$use64bitall" in
5639 "$define")
5640         case "$use64bitint" in
5641         "$undef")
5642                 cat <<EOM
5643
5644 Since you have chosen a maximally 64-bit build, I'm also turning on
5645 the use of 64-bit integers.
5646 EOM
5647                 use64bitint="$define" ;;
5648         esac
5649         ;;
5650 esac
5651
5652 : Look for a hint-file generated 'call-back-unit'.  If the
5653 : user has specified that a 64-bit perl is to be built,
5654 : we may need to set or change some other defaults.
5655 if $test -f use64bitint.cbu; then
5656         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5657         . ./use64bitint.cbu
5658 fi
5659 case "$use64bitint" in
5660 "$define"|true|[yY]*)
5661         case "$longsize" in
5662         4) case "$archname64" in
5663            '') archname64=64int ;;
5664            esac
5665            ;;
5666         esac
5667         ;;
5668 esac
5669
5670 : Look for a hint-file generated 'call-back-unit'.  If the
5671 : user has specified that a maximally 64-bit perl is to be built,
5672 : we may need to set or change some other defaults.
5673 if $test -f use64bitall.cbu; then
5674         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5675         . ./use64bitall.cbu
5676 fi
5677 case "$use64bitall" in
5678 "$define"|true|[yY]*)
5679         case "$longsize" in
5680         4) case "$archname64" in
5681            ''|64int) archname64=64all ;;
5682            esac
5683            ;;
5684         esac
5685         ;;
5686 esac
5687
5688 case "$d_quad:$use64bitint" in
5689 $undef:$define)
5690         cat >&4 <<EOF
5691
5692 *** You have chosen to use 64-bit integers,
5693 *** but none can be found.
5694 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5695 *** Cannot continue, aborting.
5696
5697 EOF
5698         exit 1
5699         ;;
5700 esac
5701
5702 : check for length of double
5703 echo " "
5704 case "$doublesize" in
5705 '')
5706         echo "Checking to see how big your double precision numbers are..." >&4
5707         $cat >try.c <<EOCP
5708 #include <stdio.h>
5709 #$i_stdlib I_STDLIB
5710 #ifdef I_STDLIB
5711 #include <stdlib.h>
5712 #endif
5713 int main()
5714 {
5715     printf("%d\n", (int)sizeof(double));
5716     exit(0);
5717 }
5718 EOCP
5719         set try
5720         if eval $compile_ok; then
5721                 doublesize=`$run ./try`
5722                 echo "Your double is $doublesize bytes long."
5723         else
5724                 dflt='8'
5725                 echo "(I can't seem to compile the test program.  Guessing...)"
5726                 rp="What is the size of a double precision number (in bytes)?"
5727                 . ./myread
5728                 doublesize="$ans"
5729         fi
5730         ;;
5731 esac
5732 $rm -f try.c try
5733
5734 : check for long doubles
5735 echo " "
5736 echo "Checking to see if you have long double..." >&4
5737 echo 'int main() { long double x = 7.0; }' > try.c
5738 set try
5739 if eval $compile; then
5740         val="$define"
5741         echo "You have long double."
5742 else
5743         val="$undef"
5744         echo "You do not have long double."
5745 fi
5746 $rm try.*
5747 set d_longdbl
5748 eval $setvar
5749
5750 : check for length of long double
5751 case "${d_longdbl}${longdblsize}" in
5752 $define)
5753         echo " "
5754         echo "Checking to see how big your long doubles are..." >&4
5755         $cat >try.c <<'EOCP'
5756 #include <stdio.h>
5757 int main()
5758 {
5759         printf("%d\n", sizeof(long double));
5760 }
5761 EOCP
5762         set try
5763         set try
5764         if eval $compile; then
5765                 longdblsize=`$run ./try`
5766                 echo "Your long doubles are $longdblsize bytes long."
5767         else
5768                 dflt='8'
5769                 echo " "
5770                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5771                 rp="What is the size of a long double (in bytes)?"
5772                 . ./myread
5773                 longdblsize="$ans"
5774         fi
5775         if $test "X$doublesize" = "X$longdblsize"; then
5776                 echo "That isn't any different from an ordinary double."
5777                 echo "I'll keep your setting anyway, but you may see some"
5778                 echo "harmless compilation warnings."
5779         fi      
5780         ;;
5781 esac
5782 $rm -f try.* try
5783
5784 : determine the architecture name
5785 echo " "
5786 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5787         tarch=`arch`"-$osname"
5788 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5789         if uname -m > tmparch 2>&1 ; then
5790                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5791                         -e 's/$/'"-$osname/" tmparch`
5792         else
5793                 tarch="$osname"
5794         fi
5795         $rm -f tmparch
5796 else
5797         tarch="$osname"
5798 fi
5799 case "$myarchname" in
5800 ''|"$tarch") ;;
5801 *)
5802         echo "(Your architecture name used to be $myarchname.)"
5803         archname=''
5804         ;;
5805 esac
5806 case "$targetarch" in
5807 '') ;;
5808 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5809 esac
5810 myarchname="$tarch"
5811 case "$archname" in
5812 '') dflt="$tarch";;
5813 *) dflt="$archname";;
5814 esac
5815 rp='What is your architecture name'
5816 . ./myread
5817 archname="$ans"
5818 case "$usethreads" in
5819 $define)
5820         echo "Threads selected." >&4
5821         case "$archname" in
5822         *-thread*) echo "...and architecture name already has -thread." >&4
5823                 ;;
5824         *)      archname="$archname-thread"
5825                 echo "...setting architecture name to $archname." >&4
5826                 ;;
5827         esac
5828         ;;
5829 esac
5830 case "$usemultiplicity" in
5831 $define)
5832         echo "Multiplicity selected." >&4
5833         case "$archname" in
5834         *-multi*) echo "...and architecture name already has -multi." >&4
5835                 ;;
5836         *)      archname="$archname-multi"
5837                 echo "...setting architecture name to $archname." >&4
5838                 ;;
5839         esac
5840         ;;
5841 esac
5842 case "$use64bitint$use64bitall" in
5843 *"$define"*)
5844         case "$archname64" in
5845         '')
5846                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5847                 ;;
5848         *)
5849                 case "$use64bitint" in
5850                 "$define") echo "64 bit integers selected." >&4 ;;
5851                 esac
5852                 case "$use64bitall" in
5853                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5854                 esac
5855                 case "$archname" in
5856                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5857                         ;;
5858                 *)      archname="$archname-$archname64"
5859                         echo "...setting architecture name to $archname." >&4
5860                         ;;
5861                 esac
5862                 ;;
5863         esac
5864 esac
5865 case "$uselongdouble" in
5866 $define)
5867         echo "Long doubles selected." >&4
5868         case "$longdblsize" in
5869         $doublesize)
5870                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5871                 ;;
5872         *)
5873                 case "$archname" in
5874                 *-ld*) echo "...and architecture name already has -ld." >&4
5875                         ;;
5876                 *)      archname="$archname-ld"
5877                         echo "...setting architecture name to $archname." >&4
5878                         ;;
5879                 esac
5880                 ;;
5881         esac
5882         ;;
5883 esac
5884 case "$useperlio" in
5885 $define)
5886         echo "Perlio selected." >&4
5887         ;;
5888 *)
5889         echo "Perlio not selected, using stdio." >&4
5890         case "$archname" in
5891         *-stdio*) echo "...and architecture name already has -stdio." >&4
5892                 ;;
5893         *)      archname="$archname-stdio"
5894                 echo "...setting architecture name to $archname." >&4
5895                 ;;
5896         esac
5897         ;;
5898 esac
5899 if $test -f archname.cbu; then
5900         echo "Your platform has some specific hints for architecture name, using them..."
5901         . ./archname.cbu
5902 fi
5903
5904 : set the prefixit variable, to compute a suitable default value
5905 prefixit='case "$3" in
5906 ""|none)
5907         case "$oldprefix" in
5908         "") eval "$1=\"\$$2\"";;
5909         *)
5910                 case "$3" in
5911                 "") eval "$1=";;
5912                 none)
5913                         eval "tp=\"\$$2\"";
5914                         case "$tp" in
5915                         ""|" ") eval "$1=\"\$$2\"";;
5916                         *) eval "$1=";;
5917                         esac;;
5918                 esac;;
5919         esac;;
5920 *)
5921         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5922         case "$tp" in
5923         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5924         /*-$oldprefix/*|\~*-$oldprefix/*)
5925                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5926         *) eval "$1=\"\$$2\"";;
5927         esac;;
5928 esac'
5929
5930 : get the patchlevel
5931 echo " "
5932 echo "Getting the current patchlevel..." >&4
5933 if $test -r $rsrc/patchlevel.h;then
5934         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5935         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5936         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5937         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5938         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5939         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5940         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5941 else
5942         revision=0
5943         patchlevel=0
5944         subversion=0
5945         api_revision=0
5946         api_version=0
5947         api_subversion=0
5948         perl_patchlevel=0
5949         $echo "(You do not have patchlevel.h.  Eek.)"
5950 fi
5951 if $test -r $rsrc/.patch ; then
5952         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5953                 perl_patchlevel=`cat $rsrc/.patch`
5954         fi
5955 fi
5956 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5957 version_patchlevel_string="version $patchlevel subversion $subversion"
5958 case "$perl_patchlevel" in
5959 0|'') ;;
5960 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5961 esac
5962
5963 $echo "(You have $package $version_patchlevel_string.)"
5964
5965 case "$osname" in
5966 dos|vms)
5967         : XXX Should be a Configure test for double-dots in filenames.
5968         version=`echo $revision $patchlevel $subversion | \
5969                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5970         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5971                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5972         ;;
5973 *)
5974         version=`echo $revision $patchlevel $subversion | \
5975                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5976         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5977                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5978         ;;
5979 esac
5980 : Special case the 5.005_xx maintenance series, which used 5.005
5981 : without any subversion label as a subdirectory in $sitelib
5982 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5983         api_versionstring='5.005'
5984 fi
5985
5986 : determine installation style
5987 : For now, try to deduce it from prefix unless it is already set.
5988 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5989 case "$installstyle" in
5990 '')     case "$prefix" in
5991                 *perl*) dflt='lib';;
5992                 *) dflt='lib/perl5' ;;
5993         esac
5994         ;;
5995 *)      dflt="$installstyle" ;;
5996 esac
5997 : Probably not worth prompting for this since we prompt for all
5998 : the directories individually, and the prompt would be too long and
5999 : confusing anyway.
6000 installstyle=$dflt
6001
6002 : determine where private library files go
6003 : Usual default is /usr/local/lib/perl5/$version.
6004 : Also allow things like /opt/perl/lib/$version, since
6005 : /opt/perl/lib/perl5... would be redundant.
6006 : The default "style" setting is made in installstyle.U
6007 case "$installstyle" in
6008 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6009 *)       set dflt privlib lib/$version ;;
6010 esac
6011 eval $prefixit
6012 $cat <<EOM
6013
6014 There are some auxiliary files for $package that need to be put into a
6015 private library directory that is accessible by everyone.
6016
6017 EOM
6018 fn=d~+
6019 rp='Pathname where the private library files will reside?'
6020 . ./getfile
6021 prefixvar=privlib
6022 . ./setprefixvar
6023
6024 : set the prefixup variable, to restore leading tilda escape
6025 prefixup='case "$prefixexp" in
6026 "$prefix") ;;
6027 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6028 esac'
6029
6030 : determine where public architecture dependent libraries go
6031 set archlib archlib
6032 eval $prefixit
6033 : privlib default is /usr/local/lib/$package/$version
6034 : archlib default is /usr/local/lib/$package/$version/$archname
6035 : privlib may have an optional trailing /share.
6036 tdflt=`echo $privlib | $sed 's,/share$,,'`
6037 tdflt=$tdflt/$archname
6038 case "$archlib" in
6039 '')     dflt=$tdflt
6040         ;;
6041 *)      dflt="$archlib"
6042     ;;
6043 esac
6044 $cat <<EOM
6045
6046 $spackage contains architecture-dependent library files.  If you are
6047 sharing libraries in a heterogeneous environment, you might store
6048 these files in a separate location.  Otherwise, you can just include
6049 them with the rest of the public library files.
6050
6051 EOM
6052 fn=d+~
6053 rp='Where do you want to put the public architecture-dependent libraries?'
6054 . ./getfile
6055 prefixvar=archlib
6056 . ./setprefixvar
6057 if $test X"$archlib" = X"$privlib"; then
6058         d_archlib="$undef"
6059 else
6060         d_archlib="$define"
6061 fi
6062
6063 : see if setuid scripts can be secure
6064 $cat <<EOM
6065
6066 Some kernels have a bug that prevents setuid #! scripts from being
6067 secure.  Some sites have disabled setuid #! scripts because of this.
6068
6069 First let's decide if your kernel supports secure setuid #! scripts.
6070 (If setuid #! scripts would be secure but have been disabled anyway,
6071 don't say that they are secure if asked.)
6072
6073 EOM
6074
6075 val="$undef"
6076 if $test -d /dev/fd; then
6077         echo "#!$ls" >reflect
6078         chmod +x,u+s reflect
6079         ./reflect >flect 2>&1
6080         if $contains "/dev/fd" flect >/dev/null; then
6081                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6082                 val="$define"
6083         else
6084                 $cat <<EOM
6085 If you are not sure if they are secure, I can check but I'll need a
6086 username and password different from the one you are using right now.
6087 If you don't have such a username or don't want me to test, simply
6088 enter 'none'.
6089
6090 EOM
6091                 rp='Other username to test security of setuid scripts with?'
6092                 dflt='none'
6093                 . ./myread
6094                 case "$ans" in
6095                 n|none)
6096                         case "$d_suidsafe" in
6097                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6098                                 dflt=n;;
6099                         "$undef")
6100                                 echo "Well, the $hint value is *not* secure." >&4
6101                                 dflt=n;;
6102                         *)      echo "Well, the $hint value *is* secure." >&4
6103                                 dflt=y;;
6104                         esac
6105                         ;;
6106                 *)
6107                         $rm -f reflect flect
6108                         echo "#!$ls" >reflect
6109                         chmod +x,u+s reflect
6110                         echo >flect
6111                         chmod a+w flect
6112                         echo '"su" will (probably) prompt you for '"$ans's password."
6113                         su $ans -c './reflect >flect'
6114                         if $contains "/dev/fd" flect >/dev/null; then
6115                                 echo "Okay, it looks like setuid scripts are secure." >&4
6116                                 dflt=y
6117                         else
6118                                 echo "I don't think setuid scripts are secure." >&4
6119                                 dflt=n
6120                         fi
6121                         ;;
6122                 esac
6123                 rp='Does your kernel have *secure* setuid scripts?'
6124                 . ./myread
6125                 case "$ans" in
6126                 [yY]*)  val="$define";;
6127                 *)      val="$undef";;
6128                 esac
6129         fi
6130 else
6131         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6132         echo "(That's for file descriptors, not floppy disks.)"
6133         val="$undef"
6134 fi
6135 set d_suidsafe
6136 eval $setvar
6137
6138 $rm -f reflect flect
6139
6140 : now see if they want to do setuid emulation
6141 echo " "
6142 val="$undef"
6143 case "$d_suidsafe" in
6144 "$define")
6145         val="$undef"
6146         echo "No need to emulate SUID scripts since they are secure here." >&4
6147         ;;
6148 *)
6149         $cat <<EOM
6150 Some systems have disabled setuid scripts, especially systems where
6151 setuid scripts cannot be secure.  On systems where setuid scripts have
6152 been disabled, the setuid/setgid bits on scripts are currently
6153 useless.  It is possible for $package to detect those bits and emulate
6154 setuid/setgid in a secure fashion.  This emulation will only work if
6155 setuid scripts have been disabled in your kernel.
6156
6157 EOM
6158         case "$d_dosuid" in
6159         "$define") dflt=y ;;
6160         *) dflt=n ;;
6161         esac
6162         rp="Do you want to do setuid/setgid emulation?"
6163         . ./myread
6164         case "$ans" in
6165         [yY]*)  val="$define";;
6166         *)      val="$undef";;
6167         esac
6168         ;;
6169 esac
6170 set d_dosuid
6171 eval $setvar
6172
6173 : determine where public executables go
6174 echo " "
6175 set dflt bin bin
6176 eval $prefixit
6177 fn=d~
6178 rp='Pathname where the public executables will reside?'
6179 . ./getfile
6180 if $test "X$ansexp" != "X$binexp"; then
6181         installbin=''
6182 fi
6183 prefixvar=bin
6184 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6185 . ./setprefixvar
6186
6187 case "$userelocatableinc" in
6188 $define|true|[yY]*)     dflt='y' ;;
6189 *)                      dflt='n' ;;
6190 esac
6191 cat <<EOM
6192
6193 Would you like to build Perl so that the installation is relocatable, so that
6194 library paths in @INC are determined relative to the path of the perl binary?
6195 This is not advised for system Perl installs, or if you need to run setid
6196 scripts or scripts under taint mode.
6197
6198 If this doesn't make any sense to you, just accept the default '$dflt'.
6199 EOM
6200 rp='Use relocatable @INC?'
6201 . ./myread
6202 case "$ans" in
6203 y|Y)    val="$define" ;;
6204 *)      val="$undef"  ;;
6205 esac
6206 set userelocatableinc
6207 eval $setvar
6208
6209 : Default prefix is now "up one level from where the binaries are"
6210 case "$userelocatableinc" in
6211 $define|true|[yY]*)
6212     initialinstalllocation="$binexp"
6213     bin=".../"
6214     binexp=".../"
6215     prefix=".../.."
6216     prefixexp=".../.."
6217     installprefixexp=".../.."
6218     ;;
6219 esac
6220
6221 : Find perl5.005 or later.
6222 echo "Looking for a previously installed perl5.005 or later... "
6223 case "$perl5" in
6224 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6225                 : Check if this perl is recent and can load a simple module
6226                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6227                         perl5=$tdir/perl
6228                         break;
6229                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6230                         perl5=$tdir/perl5
6231                         break;
6232                 fi
6233         done
6234         ;;
6235 *)      perl5="$perl5"
6236         ;;
6237 esac
6238 case "$perl5" in
6239 '')     echo "None found.  That's ok.";;
6240 *)      echo "Using $perl5." ;;
6241 esac
6242
6243 $cat <<EOM
6244
6245 After $package is installed, you may wish to install various
6246 add-on modules and utilities.  Typically, these add-ons will
6247 be installed under $prefix with the rest
6248 of this package.  However, you may wish to install such add-ons
6249 elsewhere under a different prefix.
6250
6251 If you do not wish to put everything under a single prefix, that's
6252 ok.  You will be prompted for the individual locations; this siteprefix
6253 is only used to suggest the defaults.
6254
6255 The default should be fine for most people.
6256
6257 EOM
6258 fn=d~+
6259 rp='Installation prefix to use for add-on modules and utilities?'
6260 : XXX Here might be another good place for an installstyle setting.
6261 case "$siteprefix" in
6262 '') dflt=$prefix ;;
6263 *)  dflt=$siteprefix ;;
6264 esac
6265 . ./getfile
6266 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6267 oldsiteprefix=''
6268 case "$siteprefix" in
6269 '') ;;
6270 *)      case "$ans" in
6271         "$prefix") ;;
6272         *) oldsiteprefix="$prefix";;
6273         esac
6274         ;;
6275 esac
6276 siteprefix="$ans"
6277 siteprefixexp="$ansexp"
6278
6279 : determine where site specific libraries go.
6280 : Usual default is /usr/local/lib/perl5/site_perl/$version
6281 : The default "style" setting is made in installstyle.U
6282 : XXX No longer works with Prefixit stuff.
6283 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6284 case "$sitelib" in
6285 '') case "$installstyle" in
6286         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6287         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6288         esac
6289         ;;
6290 *)      dflt="$sitelib"
6291         ;;
6292 esac
6293 $cat <<EOM
6294
6295 The installation process will create a directory for
6296 site-specific extensions and modules.  Most users find it convenient
6297 to place all site-specific files in this directory rather than in the
6298 main distribution directory.
6299
6300 EOM
6301 fn=d~+
6302 rp='Pathname for the site-specific library files?'
6303 . ./getfile
6304 prefixvar=sitelib
6305 . ./setprefixvar
6306 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6307
6308 : Determine list of previous versions to include in @INC
6309 $cat > getverlist <<EOPL
6310 #!$perl5 -w
6311 use File::Basename;
6312 \$api_versionstring = "$api_versionstring";
6313 \$version = "$version";
6314 \$stem = "$sitelib_stem";
6315 \$archname = "$archname";
6316 EOPL
6317         $cat >> getverlist <<'EOPL'
6318 # Can't have leading @ because metaconfig interprets it as a command!
6319 ;@inc_version_list=();
6320 # XXX Redo to do opendir/readdir?
6321 if (-d $stem) {
6322     chdir($stem);
6323     ;@candidates = glob("5.*");
6324 }
6325 else {
6326     ;@candidates = ();
6327 }
6328
6329 # XXX ToDo:  These comparisons must be reworked when two-digit
6330 # subversions come along, so that 5.7.10 compares as greater than
6331 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6332 # widespread that we can use the built-in version vectors rather
6333 # than reinventing them here.  For 5.6.0, however, we must
6334 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6335 foreach $d (@candidates) {
6336     if ($d lt $version) {
6337         if ($d ge $api_versionstring) {
6338             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6339         }
6340         elsif ($d ge "5.005") {
6341             unshift(@inc_version_list, grep { -d } $d);
6342         }
6343     }
6344     else {
6345         # Skip newer version.  I.e. don't look in
6346         # 5.7.0 if we're installing 5.6.1.
6347     }
6348 }
6349
6350 if (@inc_version_list) {
6351     print join(' ', @inc_version_list);
6352 }
6353 else {
6354     # Blank space to preserve value for next Configure run.
6355     print " ";
6356 }
6357 EOPL
6358 chmod +x getverlist
6359 case "$inc_version_list" in
6360 '')     if test -x "$perl5$exe_ext"; then
6361                 dflt=`$perl5 getverlist`
6362         else
6363                 dflt='none'
6364         fi
6365         ;;
6366 $undef) dflt='none' ;;
6367 *)  eval dflt=\"$inc_version_list\" ;;
6368 esac
6369 case "$dflt" in
6370 ''|' ') dflt=none ;;
6371 esac
6372 case "$dflt" in
6373 5.005) dflt=none ;;
6374 esac
6375 $cat <<EOM
6376
6377 In order to ease the process of upgrading, this version of perl
6378 can be configured to use modules built and installed with earlier
6379 versions of perl that were installed under $prefix.  Specify here
6380 the list of earlier versions that this version of perl should check.
6381 If Configure detected no earlier versions of perl installed under
6382 $prefix, then the list will be empty.  Answer 'none' to tell perl
6383 to not search earlier versions.
6384
6385 The default should almost always be sensible, so if you're not sure,
6386 just accept the default.
6387 EOM
6388
6389 rp='List of earlier versions to include in @INC?'
6390 . ./myread
6391 case "$ans" in
6392 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6393 *) inc_version_list="$ans" ;;
6394 esac
6395 case "$inc_version_list" in
6396 ''|' ')
6397         inc_version_list_init='0'
6398         d_inc_version_list="$undef"
6399         ;;
6400 *)      inc_version_list_init=`echo $inc_version_list |
6401                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6402         d_inc_version_list="$define"
6403         ;;
6404 esac
6405 $rm -f getverlist
6406
6407 : see if this is a malloc.h system
6408 : we want a real compile instead of Inhdr because some systems have a
6409 : malloc.h that just gives a compile error saying to use stdlib.h instead
6410 echo " "
6411 $cat >try.c <<EOCP
6412 #include <stdlib.h>
6413 #include <malloc.h>
6414 int main () { return 0; }
6415 EOCP
6416 set try
6417 if eval $compile; then
6418     echo "<malloc.h> found." >&4
6419     val="$define"
6420 else
6421     echo "<malloc.h> NOT found." >&4
6422     val="$undef"
6423 fi
6424 $rm -f try.c try
6425 set i_malloc
6426 eval $setvar
6427
6428 : check for void type
6429 echo " "
6430 echo "Checking to see how well your C compiler groks the void type..." >&4
6431 case "$voidflags" in
6432 '')
6433         $cat >try.c <<EOCP
6434 #$i_stdlib I_STDLIB
6435 #ifdef I_STDLIB
6436 #include <stdlib.h>
6437 #endif
6438 #if TRY & 1
6439 void sub() {
6440 #else
6441 sub() {
6442 #endif
6443         extern void moo();      /* function returning void */
6444         void (*goo)();          /* ptr to func returning void */
6445 #if TRY & 8
6446         void *hue;              /* generic ptr */
6447 #endif
6448 #if TRY & 2
6449         void (*foo[10])();
6450 #endif
6451
6452 #if TRY & 4
6453         if(goo == moo) {
6454                 exit(0);
6455         }
6456 #endif
6457         exit(0);
6458 }
6459 int main() { sub(); }
6460 EOCP
6461         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6462                 voidflags=$defvoidused
6463         echo "Good.  It appears to support void to the level $package wants.">&4
6464                 if $contains warning .out >/dev/null 2>&1; then
6465                         echo "However, you might get some warnings that look like this:"
6466                         $cat .out
6467                 fi
6468         else
6469 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6470                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6471                         echo "It supports 1..."
6472                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6473                                 echo "It also supports 2..."
6474                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6475                                         voidflags=7
6476                                         echo "And it supports 4 but not 8 definitely."
6477                                 else
6478                                         echo "It doesn't support 4..."
6479                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6480                                                 voidflags=11
6481                                                 echo "But it supports 8."
6482                                         else
6483                                                 voidflags=3
6484                                                 echo "Neither does it support 8."
6485                                         fi
6486                                 fi
6487                         else
6488                                 echo "It does not support 2..."
6489                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6490                                         voidflags=13
6491                                         echo "But it supports 4 and 8."
6492                                 else
6493                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6494                                                 voidflags=5
6495                                                 echo "And it supports 4 but has not heard about 8."
6496                                         else
6497                                                 echo "However it supports 8 but not 4."
6498                                         fi
6499                                 fi
6500                         fi
6501                 else
6502                         echo "There is no support at all for void."
6503                         voidflags=0
6504                 fi
6505         fi
6506 esac
6507 case "$voidflags" in
6508 "$defvoidused") ;;
6509 *)      $cat >&4 <<'EOM'
6510   Support flag bits are:
6511     1: basic void declarations.
6512     2: arrays of pointers to functions returning void.
6513     4: operations between pointers to and addresses of void functions.
6514     8: generic void pointers.
6515 EOM
6516         dflt="$voidflags";
6517         rp="Your void support flags add up to what?"
6518         . ./myread
6519         voidflags="$ans"
6520         ;;
6521 esac
6522 $rm -f try.* .out
6523
6524 : check for length of pointer
6525 echo " "
6526 case "$ptrsize" in
6527 '')
6528         echo "Checking to see how big your pointers are..." >&4
6529         if test "$voidflags" -gt 7; then
6530                 echo '#define VOID_PTR char *' > try.c
6531         else
6532                 echo '#define VOID_PTR void *' > try.c
6533         fi
6534         $cat >>try.c <<EOCP
6535 #include <stdio.h>
6536 #$i_stdlib I_STDLIB
6537 #ifdef I_STDLIB
6538 #include <stdlib.h>
6539 #endif
6540 int main()
6541 {
6542     printf("%d\n", (int)sizeof(VOID_PTR));
6543     exit(0);
6544 }
6545 EOCP
6546         set try
6547         if eval $compile_ok; then
6548                 ptrsize=`$run ./try`
6549                 echo "Your pointers are $ptrsize bytes long."
6550         else
6551                 dflt='4'
6552                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6553                 rp="What is the size of a pointer (in bytes)?"
6554                 . ./myread
6555                 ptrsize="$ans"
6556         fi
6557         ;;
6558 esac
6559 $rm -f try.c try
6560 case "$use64bitall" in
6561 "$define"|true|[yY]*)
6562         case "$ptrsize" in
6563         4)      cat <<EOM >&4
6564
6565 *** You have chosen a maximally 64-bit build,
6566 *** but your pointers are only 4 bytes wide.
6567 *** Please rerun Configure without -Duse64bitall.
6568 EOM
6569                 case "$d_quad" in
6570                 define)
6571                         cat <<EOM >&4
6572 *** Since you have quads, you could possibly try with -Duse64bitint.
6573 EOM
6574                         ;;
6575                 esac
6576                 cat <<EOM >&4
6577 *** Cannot continue, aborting.
6578
6579 EOM
6580
6581                 exit 1
6582                 ;;
6583         esac
6584         ;;
6585 esac
6586
6587
6588 : determine whether to use malloc wrapping
6589 echo " "
6590 case "$usemallocwrap" in
6591 [yY]*|true|$define)     dflt='y' ;;
6592 [nN]*|false|$undef)     dflt='n' ;;
6593 *)      case "$usedevel" in
6594         [yY]*|true|$define)     dflt='y' ;;
6595         *) dflt='n' ;;
6596         esac
6597         ;;
6598 esac
6599 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6600 . ./myread
6601 usemallocwrap="$ans"
6602 case "$ans" in
6603 y*|true)
6604         usemallocwrap="$define" ;;
6605 *)
6606         usemallocwrap="$undef" ;;
6607 esac
6608
6609 : determine which malloc to compile in
6610 echo " "
6611 case "$usemymalloc" in
6612 [yY]*|true|$define)     dflt='y' ;;
6613 [nN]*|false|$undef)     dflt='n' ;;
6614 *)      case "$ptrsize" in
6615         4) dflt='y' ;;
6616         *) dflt='n' ;;
6617         esac
6618         ;;
6619 esac
6620 rp="Do you wish to attempt to use the malloc that comes with $package?"
6621 . ./myread
6622 usemymalloc="$ans"
6623 case "$ans" in
6624 y*|true)
6625         usemymalloc='y'
6626         mallocsrc='malloc.c'
6627         mallocobj="malloc$_o"
6628         d_mymalloc="$define"
6629         case "$libs" in
6630         *-lmalloc*)
6631                 : Remove malloc from list of libraries to use
6632                 echo "Removing unneeded -lmalloc from library list" >&4
6633                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6634                 shift
6635                 libs="$*"
6636                 echo "libs = $libs" >&4
6637                 ;;
6638         esac
6639         ;;
6640 *)
6641         usemymalloc='n'
6642         mallocsrc=''
6643         mallocobj=''
6644         d_mymalloc="$undef"
6645         ;;
6646 esac
6647
6648 : compute the return types of malloc and free
6649 echo " "
6650 $cat >malloc.c <<END
6651 #$i_malloc I_MALLOC
6652 #$i_stdlib I_STDLIB
6653 #include <stdio.h>
6654 #include <sys/types.h>
6655 #ifdef I_MALLOC
6656 #include <malloc.h>
6657 #endif
6658 #ifdef I_STDLIB
6659 #include <stdlib.h>
6660 #endif
6661 #ifdef TRY_MALLOC
6662 void *malloc();
6663 #endif
6664 #ifdef TRY_FREE
6665 void free();
6666 #endif
6667 END
6668 case "$malloctype" in
6669 '')
6670         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6671                 malloctype='void *'
6672         else
6673                 malloctype='char *'
6674         fi
6675         ;;
6676 esac
6677 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6678
6679 case "$freetype" in
6680 '')
6681         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6682                 freetype='void'
6683         else
6684                 freetype='int'
6685         fi
6686         ;;
6687 esac
6688 echo "Your system uses $freetype free(), it would seem." >&4
6689 $rm -f malloc.[co]
6690 : determine where site specific architecture-dependent libraries go.
6691 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6692 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6693 : sitelib may have an optional trailing /share.
6694 case "$sitearch" in
6695 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6696         dflt="$dflt/$archname"
6697         ;;
6698 *)      dflt="$sitearch"
6699         ;;
6700 esac
6701 set sitearch sitearch none
6702 eval $prefixit
6703 $cat <<EOM
6704
6705 The installation process will also create a directory for
6706 architecture-dependent site-specific extensions and modules.
6707
6708 EOM
6709 fn=d~+
6710 rp='Pathname for the site-specific architecture-dependent library files?'
6711 . ./getfile
6712 prefixvar=sitearch
6713 . ./setprefixvar
6714 if $test X"$sitearch" = X"$sitelib"; then
6715         d_sitearch="$undef"
6716 else
6717         d_sitearch="$define"
6718 fi
6719
6720 $cat <<EOM
6721
6722 The installation process will also create a directory for
6723 vendor-supplied add-ons.  Vendors who supply perl with their system
6724 may find it convenient to place all vendor-supplied files in this
6725 directory rather than in the main distribution directory.  This will
6726 ease upgrades between binary-compatible maintenance versions of perl.
6727
6728 Of course you may also use these directories in whatever way you see
6729 fit.  For example, you might use them to access modules shared over a
6730 company-wide network.
6731
6732 The default answer should be fine for most people.
6733 This causes further questions about vendor add-ons to be skipped
6734 and no vendor-specific directories will be configured for perl.
6735
6736 EOM
6737 rp='Do you want to configure vendor-specific add-on directories?'
6738 case "$usevendorprefix" in
6739 define|true|[yY]*) dflt=y ;;
6740 *)      : User may have set vendorprefix directly on Configure command line.
6741         case "$vendorprefix" in
6742         ''|' ') dflt=n ;;
6743         *)      dflt=y ;;
6744         esac
6745         ;;
6746 esac
6747 . ./myread
6748 case "$ans" in
6749 [yY]*)  fn=d~+
6750         rp='Installation prefix to use for vendor-supplied add-ons?'
6751         case "$vendorprefix" in
6752         '') dflt='' ;;
6753         *)  dflt=$vendorprefix ;;
6754         esac
6755         . ./getfile
6756         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6757         oldvendorprefix=''
6758         case "$vendorprefix" in
6759         '') ;;
6760         *)      case "$ans" in
6761                 "$prefix") ;;
6762                 *) oldvendorprefix="$prefix";;
6763                 esac
6764                 ;;
6765         esac
6766         usevendorprefix="$define"
6767         vendorprefix="$ans"
6768         vendorprefixexp="$ansexp"
6769         ;;
6770 *)      usevendorprefix="$undef"
6771         vendorprefix=''
6772         vendorprefixexp=''
6773         ;;
6774 esac
6775
6776 case "$vendorprefix" in
6777 '')     d_vendorlib="$undef"
6778         vendorlib=''
6779         vendorlibexp=''
6780         ;;
6781 *)      d_vendorlib="$define"
6782         : determine where vendor-supplied modules go.
6783         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6784         case "$vendorlib" in
6785         '')
6786                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6787                 case "$installstyle" in
6788                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6789                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6790                 esac
6791                 ;;
6792         *)      dflt="$vendorlib"
6793                 ;;
6794         esac
6795         fn=d~+
6796         rp='Pathname for the vendor-supplied library files?'
6797         . ./getfile
6798         vendorlib="$ans"
6799         vendorlibexp="$ansexp"
6800         ;;
6801 esac
6802 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6803 prefixvar=vendorlib
6804 . ./installprefix
6805
6806 case "$vendorprefix" in
6807 '')     d_vendorarch="$undef"
6808         vendorarch=''
6809         vendorarchexp=''
6810         ;;
6811 *)      d_vendorarch="$define"
6812         : determine where vendor-supplied architecture-dependent libraries go.
6813         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6814         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6815         : vendorlib may have an optional trailing /share.
6816         case "$vendorarch" in
6817         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6818                 dflt="$dflt/$archname"
6819                 ;;
6820         *)      dflt="$vendorarch" ;;
6821         esac
6822         fn=d~+
6823         rp='Pathname for vendor-supplied architecture-dependent files?'
6824         . ./getfile
6825         vendorarch="$ans"
6826         vendorarchexp="$ansexp"
6827         ;;
6828 esac
6829 prefixvar=vendorarch
6830 . ./installprefix
6831
6832 : Final catch-all directories to search
6833 $cat <<EOM
6834
6835 Lastly, you can have perl look in other directories for extensions and
6836 modules in addition to those already specified.
6837 These directories will be searched after 
6838         $sitearch 
6839         $sitelib 
6840 EOM
6841 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6842 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6843 echo ' '
6844 case "$otherlibdirs" in
6845 ''|' ') dflt='none' ;;
6846 *)      dflt="$otherlibdirs" ;;
6847 esac
6848 $cat <<EOM
6849 Enter a colon-separated set of extra paths to include in perl's @INC
6850 search path, or enter 'none' for no extra paths.
6851
6852 EOM
6853
6854 rp='Colon-separated list of additional directories for perl to search?'
6855 . ./myread
6856 case "$ans" in
6857 ' '|''|none)    otherlibdirs=' ' ;;     
6858 *)      otherlibdirs="$ans" ;;
6859 esac
6860 case "$otherlibdirs" in
6861 ' ') val=$undef ;;
6862 *)      val=$define ;;
6863 esac
6864 set d_perl_otherlibdirs
6865 eval $setvar
6866
6867 : Cruising for prototypes
6868 echo " "
6869 echo "Checking out function prototypes..." >&4
6870 $cat >prototype.c <<EOCP
6871 #$i_stdlib I_STDLIB
6872 #ifdef I_STDLIB
6873 #include <stdlib.h>
6874 #endif
6875 int main(int argc, char *argv[]) {
6876         exit(0);}
6877 EOCP
6878 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6879         echo "Your C compiler appears to support function prototypes."
6880         val="$define"
6881 else
6882         echo "Your C compiler doesn't seem to understand function prototypes."
6883         val="$undef"
6884 fi
6885 set prototype
6886 eval $setvar
6887 $rm -f prototype*
6888
6889 case "$prototype" in
6890 "$define") ;;
6891 *)      ansi2knr='ansi2knr'
6892         echo " "
6893         cat <<EOM >&4
6894
6895 $me:  FATAL ERROR:
6896 This version of $package can only be compiled by a compiler that 
6897 understands function prototypes.  Unfortunately, your C compiler 
6898         $cc $ccflags
6899 doesn't seem to understand them.  Sorry about that.
6900
6901 If GNU cc is available for your system, perhaps you could try that instead.  
6902
6903 Eventually, we hope to support building Perl with pre-ANSI compilers.
6904 If you would like to help in that effort, please contact <perlbug@perl.org>.
6905
6906 Aborting Configure now.
6907 EOM
6908         exit 2
6909         ;;
6910 esac
6911
6912 echo " "
6913 case "$extras" in
6914 '') dflt='n';;
6915 *) dflt='y';;
6916 esac
6917 cat <<EOM
6918 Perl can be built with extra modules or bundles of modules which
6919 will be fetched from the CPAN and installed alongside Perl.
6920
6921 Notice that you will need access to the CPAN; either via the Internet,
6922 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6923 be asked later to configure the CPAN.pm module which will in turn do
6924 the installation of the rest of the extra modules or bundles.)
6925
6926 Notice also that if the modules require any external software such as
6927 libraries and headers (the libz library and the zlib.h header for the
6928 Compress::Zlib module, for example) you MUST have any such software
6929 already installed, this configuration process will NOT install such
6930 things for you.
6931
6932 If this doesn't make any sense to you, just accept the default '$dflt'.
6933 EOM
6934 rp='Install any extra modules (y or n)?'
6935 . ./myread
6936 case "$ans" in
6937 y|Y)
6938         cat <<EOM
6939
6940 Please list any extra modules or bundles to be installed from CPAN,
6941 with spaces between the names.  The names can be in any format the
6942 'install' command of CPAN.pm will understand.  (Answer 'none',
6943 without the quotes, to install no extra modules or bundles.)
6944 EOM
6945         rp='Extras?'
6946         dflt="$extras"
6947         . ./myread
6948         extras="$ans"
6949 esac
6950 case "$extras" in
6951 ''|'none')
6952         val=''
6953         $rm -f ../extras.lst
6954         ;;
6955 *)      echo "(Saving the list of extras for later...)"
6956         echo "$extras" > ../extras.lst
6957         val="'$extras'"
6958         ;;
6959 esac
6960 set extras
6961 eval $setvar
6962 echo " "
6963
6964 : determine where html pages for programs go
6965 set html1dir html1dir none
6966 eval $prefixit
6967 $cat <<EOM
6968
6969 If you wish to install html files for programs in $spackage, indicate
6970 the appropriate directory here.  To skip installing html files,
6971 answer "none".
6972 EOM
6973 case "$html1dir" in
6974 ''|none|$undef|' ') dflt=none ;;
6975 *) dflt=$html1dir ;;
6976 esac
6977 fn=dn+~
6978 rp="Directory for the main $spackage html pages?"
6979 . ./getfile
6980 prefixvar=html1dir
6981 . ./setprefixvar
6982 : Use ' ' for none so value is preserved next time through Configure
6983 $test X"$html1dir" = "X" && html1dir=' '
6984
6985 : determine where html pages for libraries and modules go
6986 set html3dir html3dir none
6987 eval $prefixit
6988 $cat <<EOM
6989
6990 If you wish to install html files for modules associated with $spackage,
6991 indicate the appropriate directory here.  To skip installing html files,
6992 answer "none".
6993 EOM
6994 : There is no obvious default.  If they have specified html1dir, then
6995 : try to key off that, possibly changing .../html1 into .../html3.
6996 case "$html3dir" in
6997 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6998 *) dflt=$html3dir ;;
6999 esac
7000 fn=dn+~
7001 rp="Directory for the $spackage module html pages?"
7002 . ./getfile
7003 prefixvar=html3dir
7004 . ./setprefixvar
7005 : Use ' ' for none so value is preserved next time through Configure
7006 $test X"$html3dir" = "X" && html3dir=' '
7007
7008 : determine whether to install perl also as /usr/bin/perl
7009
7010 echo " "
7011 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7012         $cat <<EOM
7013 Many scripts expect perl to be installed as /usr/bin/perl.
7014
7015 If you want to, I can install the perl you are about to compile
7016 as /usr/bin/perl (in addition to $bin/perl).
7017 EOM
7018         if test -f /usr/bin/perl; then
7019             $cat <<EOM
7020
7021 However, please note that because you already have a /usr/bin/perl,
7022 overwriting that with a new Perl would very probably cause problems.
7023 Therefore I'm assuming you don't want to do that (unless you insist).
7024
7025 EOM
7026             case "$installusrbinperl" in
7027             "$define"|[yY]*)    dflt='y';;
7028             *)                  dflt='n';;
7029             esac
7030         else
7031             $cat <<EOM
7032
7033 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7034
7035 EOM
7036             case "$installusrbinperl" in
7037             "$undef"|[nN]*)     dflt='n';;
7038             *)                  dflt='y';;
7039             esac
7040         fi
7041         rp="Do you want to install perl as /usr/bin/perl?"
7042         . ./myread
7043         case "$ans" in
7044         [yY]*)  val="$define";;
7045         *)      val="$undef" ;;
7046         esac
7047 else
7048         val="$undef"
7049 fi
7050 set installusrbinperl
7051 eval $setvar
7052
7053 echo " "
7054 echo "Checking for GNU C Library..." >&4
7055 cat >try.c <<'EOCP'
7056 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7057    alone are insufficient to distinguish different versions, such as
7058    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7059    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7060 */
7061 #include <stdio.h>
7062 int main(void)
7063 {
7064 #ifdef __GLIBC__
7065 #   ifdef __GLIBC_MINOR__
7066 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7067 #           include <gnu/libc-version.h>
7068             printf("%s\n",  gnu_get_libc_version());
7069 #       else
7070             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7071 #       endif
7072 #   else
7073         printf("%d\n",  __GLIBC__);
7074 #   endif
7075     return 0;
7076 #else
7077     return 1;
7078 #endif
7079 }
7080 EOCP
7081 set try
7082 if eval $compile_ok && $run ./try > glibc.ver; then
7083         val="$define"
7084         gnulibc_version=`$cat glibc.ver`
7085         echo "You are using the GNU C Library version $gnulibc_version"
7086 else
7087         val="$undef"
7088         gnulibc_version=''
7089         echo "You are not using the GNU C Library"
7090 fi
7091 $rm -f try try.* glibc.ver
7092 set d_gnulibc
7093 eval $setvar
7094
7095 : see if nm is to be used to determine whether a symbol is defined or not
7096 case "$usenm" in
7097 '')
7098         dflt=''
7099         case "$d_gnulibc" in
7100         "$define")
7101                 echo " "
7102                 echo "nm probably won't work on the GNU C Library." >&4
7103                 dflt=n
7104                 ;;
7105         esac
7106         case "$dflt" in
7107         '') 
7108                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7109                         echo " "
7110                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7111                         echo "'nm' won't be sufficient on this sytem." >&4
7112                         dflt=n
7113                 fi
7114                 ;;
7115         esac
7116         case "$dflt" in
7117         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7118                 if $test $dflt -gt 20; then
7119                         dflt=y
7120                 else
7121                         dflt=n
7122                 fi
7123                 ;;
7124         esac
7125         ;;
7126 *)
7127         case "$usenm" in
7128         true|$define) dflt=y;;
7129         *) dflt=n;;
7130         esac
7131         ;;
7132 esac
7133 $cat <<EOM
7134
7135 I can use $nm to extract the symbols from your C libraries. This
7136 is a time consuming task which may generate huge output on the disk (up
7137 to 3 megabytes) but that should make the symbols extraction faster. The
7138 alternative is to skip the 'nm' extraction part and to compile a small
7139 test program instead to determine whether each symbol is present. If
7140 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7141 this may be the best solution.
7142
7143 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7144
7145 EOM
7146 rp="Shall I use $nm to extract C symbols from the libraries?"
7147 . ./myread
7148 case "$ans" in
7149 [Nn]*) usenm=false;;
7150 *) usenm=true;;
7151 esac
7152
7153 runnm=$usenm
7154 case "$reuseval" in
7155 true) runnm=false;;
7156 esac
7157
7158 : nm options which may be necessary
7159 case "$nm_opt" in
7160 '') if $test -f /mach_boot; then
7161                 nm_opt=''       # Mach
7162         elif $test -d /usr/ccs/lib; then
7163                 nm_opt='-p'     # Solaris (and SunOS?)
7164         elif $test -f /dgux; then
7165                 nm_opt='-p'     # DG-UX
7166         elif $test -f /lib64/rld; then
7167                 nm_opt='-p'     # 64-bit Irix
7168         else
7169                 nm_opt=''
7170         fi;;
7171 esac
7172
7173 : nm options which may be necessary for shared libraries but illegal
7174 : for archive libraries.  Thank you, Linux.
7175 case "$nm_so_opt" in
7176 '')     case "$myuname" in
7177         *linux*|gnu*)
7178                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7179                         nm_so_opt='--dynamic'
7180                 fi
7181                 ;;
7182         esac
7183         ;;
7184 esac
7185
7186 case "$runnm" in
7187 true)
7188 : get list of predefined functions in a handy place
7189 echo " "
7190 case "$libc" in
7191 '') libc=unknown
7192         case "$libs" in
7193         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7194         esac
7195         ;;
7196 esac
7197 case "$libs" in
7198 '') ;;
7199 *)  for thislib in $libs; do
7200         case "$thislib" in
7201         -lc|-lc_s)
7202                 : Handle C library specially below.
7203                 ;;
7204         -l*)
7205                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7206                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7207                         :
7208                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7209                         :
7210                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7211                         :
7212                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7213                         :
7214                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7215                         :
7216                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7217                         :
7218                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7219                         :
7220                 else
7221                         try=''
7222                 fi
7223                 libnames="$libnames $try"
7224                 ;;
7225         *) libnames="$libnames $thislib" ;;
7226         esac
7227         done
7228         ;;
7229 esac
7230 xxx=normal
7231 case "$libc" in
7232 unknown)
7233         set /lib/libc.$so
7234         for xxx in $libpth; do
7235                 $test -r $1 || set $xxx/libc.$so
7236                 : The messy sed command sorts on library version numbers.
7237                 $test -r $1 || \
7238                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7239                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7240                                 h
7241                                 s/[0-9][0-9]*/0000&/g
7242                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7243                                 G
7244                                 s/\n/ /' | \
7245                          $sort | $sed -e 's/^.* //'`
7246                 eval set \$$#
7247         done
7248         $test -r $1 || set /usr/ccs/lib/libc.$so
7249         $test -r $1 || set /lib/libsys_s$_a
7250         ;;
7251 *)
7252         set blurfl
7253         ;;
7254 esac
7255 if $test -r "$1"; then
7256         echo "Your (shared) C library seems to be in $1."
7257         libc="$1"
7258 elif $test -r /lib/libc && $test -r /lib/clib; then
7259         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7260         xxx=apollo
7261         libc='/lib/clib /lib/libc'
7262         if $test -r /lib/syslib; then
7263                 echo "(Your math library is in /lib/syslib.)"
7264                 libc="$libc /lib/syslib"
7265         fi
7266 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7267         echo "Your C library seems to be in $libc, as you said before."
7268 elif $test -r $incpath/usr/lib/libc$_a; then
7269         libc=$incpath/usr/lib/libc$_a;
7270         echo "Your C library seems to be in $libc.  That's fine."
7271 elif $test -r /lib/libc$_a; then
7272         libc=/lib/libc$_a;
7273         echo "Your C library seems to be in $libc.  You're normal."
7274 else
7275         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7276                 :
7277         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7278                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7279         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7280                 :
7281         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7282                 :
7283         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7284                 :
7285         else
7286                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7287         fi
7288         if $test -r "$tans"; then
7289                 echo "Your C library seems to be in $tans, of all places."
7290                 libc=$tans
7291         else
7292                 libc='blurfl'
7293         fi
7294 fi
7295 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7296         dflt="$libc"
7297         cat <<EOM
7298
7299 If the guess above is wrong (which it might be if you're using a strange
7300 compiler, or your machine supports multiple models), you can override it here.
7301
7302 EOM
7303 else
7304         dflt=''
7305         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7306         cat >&4 <<EOM
7307 I can't seem to find your C library.  I've looked in the following places:
7308
7309 EOM
7310         $sed 's/^/      /' libpath
7311         cat <<EOM
7312
7313 None of these seems to contain your C library. I need to get its name...
7314
7315 EOM
7316 fi
7317 fn=f
7318 rp='Where is your C library?'
7319 . ./getfile
7320 libc="$ans"
7321
7322 echo " "
7323 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7324 set X `cat libnames`
7325 shift
7326 xxx=files
7327 case $# in 1) xxx=file; esac
7328 echo "Extracting names from the following $xxx for later perusal:" >&4
7329 echo " "
7330 $sed 's/^/      /' libnames >&4
7331 echo " "
7332 $echo $n "This may take a while...$c" >&4
7333
7334 for file in $*; do
7335         case $file in
7336         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7337         *) $nm $nm_opt $file 2>/dev/null;;
7338         esac
7339 done >libc.tmp
7340
7341 $echo $n ".$c"
7342 $grep fprintf libc.tmp > libc.ptf
7343 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7344 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7345 xxx='[ADTSIW]'
7346 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7347         eval $xscan;\
7348         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7349                 eval $xrun
7350 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7351         eval $xscan;\
7352         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7353                 eval $xrun
7354 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7355         eval $xscan;\
7356         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7357                 eval $xrun
7358 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7359         eval $xscan;\
7360         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7361                 eval $xrun
7362 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7363         eval $xscan;\
7364         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7365                 eval $xrun
7366 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7367         eval $xscan;\
7368         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7369                 eval $xrun
7370 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7371                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7372         eval $xscan;\
7373         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7374                 eval $xrun
7375 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7376         eval $xscan;\
7377         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7378                 eval $xrun
7379 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7380         eval $xscan;\
7381         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7382                 eval $xrun
7383 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7384         eval $xscan;\
7385         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7386                 eval $xrun
7387 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7388         eval $xscan;\
7389         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7390                 eval $xrun
7391 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7392         eval $xscan;\
7393         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7394                 eval $xrun
7395 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7396         eval $xscan;\
7397         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7398                 eval $xrun
7399 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7400         eval $xscan;\
7401         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7402                 eval $xrun
7403 else
7404         $nm -p $* 2>/dev/null >libc.tmp
7405         $grep fprintf libc.tmp > libc.ptf
7406         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7407                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7408         then
7409                 nm_opt='-p'
7410                 eval $xrun
7411         else
7412                 echo " "
7413                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7414                 com=''
7415                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7416                         for thisname in $libnames $libc; do
7417                                 $ar t $thisname >>libc.tmp
7418                         done
7419                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7420                         echo "Ok." >&4
7421                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7422                         # Repeat libc to extract forwarders to DLL entries too
7423                         for thisname in $libnames $libc; do
7424                                 $ar tv $thisname >>libc.tmp
7425                                 # Revision 50 of EMX has bug in $ar.
7426                                 # it will not extract forwarders to DLL entries
7427                                 # Use emximp which will extract exactly them.
7428                                 emximp -o tmp.imp $thisname \
7429                                     2>/dev/null && \
7430                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7431                                     < tmp.imp >>libc.tmp
7432                                 $rm tmp.imp
7433                         done
7434                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7435                         echo "Ok." >&4
7436                 else
7437                         echo "$ar didn't seem to work right." >&4
7438                         echo "Maybe this is a Cray...trying bld instead..." >&4
7439                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7440                         then
7441                                 for thisname in $libnames; do
7442                                         bld t $libnames | \
7443                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7444                                         $ar t $thisname >>libc.tmp
7445                                 done
7446                                 echo "Ok." >&4
7447                         else
7448                                 echo "That didn't work either.  Giving up." >&4
7449                                 exit 1
7450                         fi
7451                 fi
7452         fi
7453 fi
7454 nm_extract="$com"
7455 case "$PASE" in
7456 define)
7457     echo " "
7458     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7459     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7460     ;;
7461 *)  if $test -f /lib/syscalls.exp; then
7462         echo " "
7463         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7464         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7465     fi
7466     ;;
7467 esac
7468 ;;
7469 esac
7470 $rm -f libnames libpath
7471
7472 : see if dld is available
7473 set dld.h i_dld
7474 eval $inhdr
7475
7476 : is a C symbol defined?
7477 csym='tlook=$1;
7478 case "$3" in
7479 -v) tf=libc.tmp; tdc="";;
7480 -a) tf=libc.tmp; tdc="[]";;
7481 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7482 esac;
7483 tx=yes;
7484 case "$reuseval-$4" in
7485 true-) ;;
7486 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7487 esac;
7488 case "$tx" in
7489 yes)
7490         tval=false;
7491         if $test "$runnm" = true; then
7492                 if $contains $tlook $tf >/dev/null 2>&1; then
7493                         tval=true;
7494                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7495                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7496                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7497                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7498                         $rm -f try$_exe try.c core core.* try.core;
7499                 fi;
7500         else
7501                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7502                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7503                 $rm -f try$_exe try.c;
7504         fi;
7505         ;;
7506 *)
7507         case "$tval" in
7508         $define) tval=true;;
7509         *) tval=false;;
7510         esac;
7511         ;;
7512 esac;
7513 eval "$2=$tval"'
7514
7515 : define an is-in-libc? function
7516 inlibc='echo " "; td=$define; tu=$undef;
7517 sym=$1; var=$2; eval "was=\$$2";
7518 tx=yes;
7519 case "$reuseval$was" in
7520 true) ;;
7521 true*) tx=no;;
7522 esac;
7523 case "$tx" in
7524 yes)
7525         set $sym tres -f;
7526         eval $csym;
7527         case "$tres" in
7528         true)
7529                 echo "$sym() found." >&4;
7530                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7531         *)
7532                 echo "$sym() NOT found." >&4;
7533                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7534         esac;;
7535 *)
7536         case "$was" in
7537         $define) echo "$sym() found." >&4;;
7538         *) echo "$sym() NOT found." >&4;;
7539         esac;;
7540 esac'
7541
7542 : see if dlopen exists
7543 xxx_runnm="$runnm"
7544 runnm=false
7545 set dlopen d_dlopen
7546 eval $inlibc
7547 runnm="$xxx_runnm"
7548
7549 : determine which dynamic loading, if any, to compile in
7550 echo " "
7551 dldir="ext/DynaLoader"
7552 case "$usedl" in
7553 $define|y|true)
7554         dflt='y'
7555         usedl="$define"
7556         ;;
7557 $undef|n|false)
7558         dflt='n'
7559         usedl="$undef"
7560         ;;
7561 *) 
7562         dflt='n'
7563         case "$d_dlopen" in
7564             $define) dflt='y' ;;
7565         esac
7566         case "$i_dld" in
7567             $define) dflt='y' ;;
7568         esac
7569         : Does a dl_xxx.xs file exist for this operating system
7570         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7571         ;;
7572 esac
7573 rp="Do you wish to use dynamic loading?"
7574 . ./myread
7575 usedl="$ans"
7576 case "$ans" in
7577 y*) usedl="$define"
7578         case "$dlsrc" in
7579         '')
7580                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7581                         dflt="$dldir/dl_${osname}.xs"
7582                 elif $test "$d_dlopen" = "$define" ; then
7583                         dflt="$dldir/dl_dlopen.xs"
7584                 elif $test "$i_dld" = "$define" ; then
7585                         dflt="$dldir/dl_dld.xs"
7586                 else
7587                         dflt=''
7588                 fi
7589                 ;;
7590         *)      dflt="$dldir/$dlsrc"
7591                 ;;
7592         esac
7593     echo "The following dynamic loading files are available:"
7594         : Can not go over to $dldir because getfile has path hard-coded in.
7595         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7596         rp="Source file to use for dynamic loading"
7597         fn="fne"
7598         gfpth="$src"
7599         . ./getfile
7600         usedl="$define"
7601         : emulate basename
7602         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7603
7604         $cat << EOM
7605
7606 Some systems may require passing special flags to $cc -c to
7607 compile modules that will be used to create a shared library.
7608 To use no flags, say "none".
7609
7610 EOM
7611     case "$cccdlflags" in
7612     '') case "$gccversion" in
7613                 '') case "$osname" in
7614                         hpux)   dflt='+z' ;;
7615                         next)   dflt='none' ;;
7616                         irix*)  dflt='-KPIC' ;;
7617                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7618                         sunos)  dflt='-pic' ;;
7619                         *)      dflt='none' ;;
7620                     esac
7621                         ;;
7622                 *)  case "$osname" in
7623                         darwin) dflt='none' ;;
7624                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7625                         *)      dflt='-fpic' ;;
7626                     esac ;;
7627             esac ;;
7628         ' ') dflt='none' ;;
7629     *)  dflt="$cccdlflags" ;;
7630     esac
7631     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7632     . ./myread
7633     case "$ans" in
7634     none) cccdlflags=' ' ;;
7635     *) cccdlflags="$ans" ;;
7636     esac
7637
7638     cat << EOM
7639
7640 Some systems use ld to create libraries that can be dynamically loaded,
7641 while other systems (such as those using ELF) use $cc.
7642
7643 EOM
7644         case "$ld" in
7645         '')     $cat >try.c <<EOM
7646 /* Test for whether ELF binaries are produced */
7647 #include <fcntl.h>
7648 #$i_stdlib I_STDLIB
7649 #ifdef I_STDLIB
7650 #include <stdlib.h>
7651 #endif
7652 int main() {
7653         char b[4];
7654         int i = open("a.out",O_RDONLY);
7655         if(i == -1) 
7656                 exit(1); /* fail */
7657         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7658                 exit(0); /* succeed (yes, it's ELF) */
7659         else
7660                 exit(1); /* fail */
7661 }
7662 EOM
7663                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7664                         cat <<EOM
7665 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7666 EOM
7667                         dflt="$cc"
7668                 else
7669                         echo "I'll use ld to build dynamic libraries."
7670                         dflt='ld'
7671                 fi
7672                 rm -f try.c a.out
7673                 ;;
7674         *)      dflt="$ld"
7675                 ;;
7676         esac
7677
7678     rp="What command should be used to create dynamic libraries?"
7679     . ./myread
7680         ld="$ans"
7681
7682     cat << EOM
7683
7684 Some systems may require passing special flags to $ld to create a
7685 library that can be dynamically loaded.  If your ld flags include
7686 -L/other/path options to locate libraries outside your loader's normal
7687 search path, you may need to specify those -L options here as well.  To
7688 use no flags, say "none".
7689
7690 EOM
7691     case "$lddlflags" in
7692     '') case "$osname" in
7693                         beos) dflt='-nostart' ;;
7694                         hpux) dflt='-b';
7695                               case "$gccversion" in
7696                               '') dflt="$dflt +vnocompatwarnings" ;;
7697                               esac
7698                               ;;        
7699                         linux|irix*|gnu*)       dflt='-shared' ;;
7700                         next)  dflt='none' ;;
7701                         solaris) dflt='-G' ;;
7702                         sunos) dflt='-assert nodefinitions' ;;
7703                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7704                 *)     dflt='none' ;;
7705                         esac
7706                         ;;
7707     *) dflt="$lddlflags" ;;
7708     esac
7709
7710         : Try to guess additional flags to pick up local libraries.
7711         : Be careful not to append to a plain 'none'
7712         case "$dflt" in
7713         none) dflt='' ;;
7714         esac
7715         for thisflag in $ldflags; do
7716                 case "$thisflag" in
7717                 -L*|-R*|-Wl,-R*)
7718                         case " $dflt " in
7719                         *" $thisflag "*) ;;
7720                         *) dflt="$dflt $thisflag" ;;
7721                         esac
7722                         ;;
7723                 esac
7724         done
7725
7726         case "$dflt" in
7727         ''|' ') dflt='none' ;;
7728         esac
7729
7730     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7731     . ./myread
7732     case "$ans" in
7733     none) lddlflags=' ' ;;
7734     *) lddlflags="$ans" ;;
7735     esac
7736
7737         cat <<EOM
7738
7739 Some systems may require passing special flags to $cc to indicate that
7740 the resulting executable will use dynamic linking.  To use no flags,
7741 say "none".
7742
7743 EOM
7744     case "$ccdlflags" in
7745     '') case "$osname" in
7746             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7747             next|sunos) dflt='none' ;;
7748             *)          dflt='none' ;;
7749             esac ;;
7750     ' ')  dflt='none' ;;
7751     *)  dflt="$ccdlflags" ;;
7752     esac
7753     rp="Any special flags to pass to $cc to use dynamic linking?"
7754     . ./myread
7755     case "$ans" in
7756     none) ccdlflags=' ' ;;
7757     *) ccdlflags="$ans" ;;
7758     esac
7759     ;;
7760 *)  usedl="$undef"
7761         ld='ld'
7762     dlsrc='dl_none.xs'
7763     lddlflags=''
7764     ccdlflags=''
7765     ;;
7766 esac
7767
7768 also=''
7769 case "$usedl" in
7770 $undef)
7771         # No dynamic loading being used, so don't bother even to prompt.
7772         useshrplib='false'
7773         ;;
7774 *)      case "$useshrplib" in
7775         '')     case "$osname" in
7776                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7777                         dflt=y
7778                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7779                         ;;
7780                 next*)
7781                         case "$osvers" in
7782                         4*)     dflt=y
7783                                 also='Building a shared libperl is needed for MAB support.'
7784                                 ;;
7785                         *)      dflt=n
7786                                 ;;
7787                         esac
7788                         ;;
7789                 *)      dflt=n
7790                         ;;
7791                 esac
7792                 ;;
7793         $define|true|[Yy]*)
7794                 dflt=y
7795                 ;;
7796         *)      dflt=n
7797                 ;;
7798         esac
7799         $cat << EOM
7800
7801 The perl executable is normally obtained by linking perlmain.c with
7802 libperl${_a}, any static extensions (usually just DynaLoader), and
7803 any other libraries needed on this system (such as -lm, etc.).  Since
7804 your system supports dynamic loading, it is probably possible to build
7805 a shared libperl.$so.  If you will have more than one executable linked
7806 to libperl.$so, this will significantly reduce the size of each
7807 executable, but it may have a noticeable effect on performance.  The
7808 default is probably sensible for your system.
7809 $also
7810
7811 EOM
7812         rp="Build a shared libperl.$so (y/n)"
7813         . ./myread
7814         case "$ans" in
7815         true|$define|[Yy]*)
7816                 useshrplib='true'  ;;
7817         *)      useshrplib='false' ;;
7818         esac
7819         ;;
7820 esac
7821
7822 case "$useshrplib" in
7823 true)
7824         case "$libperl" in
7825         '')
7826                 # Figure out a good name for libperl.so.  Since it gets stored in
7827                 # a version-specific architecture-dependent library, the version
7828                 # number isn't really that important, except for making cc/ld happy.
7829                 #
7830                 # A name such as libperl.so.3.1
7831                 majmin="libperl.$so.$patchlevel.$subversion"
7832                 # A name such as libperl.so.301
7833                 majonly=`echo $patchlevel $subversion |
7834                         $awk '{printf "%d%02d", $1, $2}'`
7835                 majonly=libperl.$so.$majonly
7836                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7837                 # rely on figuring it out from the naming of libc.
7838                 case "${osname}${osvers}" in
7839                 next4*)
7840                         dflt=libperl.5.$so
7841                         # XXX How handle the --version stuff for MAB?
7842                         ;;
7843                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7844                         dflt=libperl.$so
7845                         ;;
7846                 cygwin*) # ld links against an importlib
7847                         dflt=libperl$lib_ext
7848                         ;;
7849                 *)      # Try to guess based on whether libc has major.minor.
7850                         case "$libc" in
7851                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7852                         *libc.$so.[0-9]*) dflt=$majonly ;;
7853                         *)      dflt=libperl.$so ;;
7854                         esac
7855                         ;;
7856                 esac
7857                 ;;
7858         *)      dflt=$libperl
7859                 ;;
7860         esac
7861         cat << EOM
7862
7863 I need to select a good name for the shared libperl.  If your system uses
7864 library names with major and minor numbers, then you might want something
7865 like $majmin.  Alternatively, if your system uses a single version
7866 number for shared libraries, then you might want to use $majonly.
7867 Or, your system might be quite happy with a simple libperl.$so.
7868
7869 Since the shared libperl will get installed into a version-specific
7870 architecture-dependent directory, the version number of the shared perl
7871 library probably isn't important, so the default should be o.k.
7872
7873 EOM
7874         rp='What name do you want to give to the shared libperl?'
7875         . ./myread
7876         libperl=$ans
7877         echo "Ok, I'll use $libperl"
7878         ;;
7879 *)
7880         libperl="libperl${_a}"
7881         ;;
7882 esac
7883
7884 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7885 case "$shrpdir" in
7886 '') ;;
7887 *)      $cat >&4 <<EOM
7888 WARNING:  Use of the shrpdir variable for the installation location of
7889 the shared $libperl is not supported.  It was never documented and
7890 will not work in this version.  Let me (perlbug@perl.org)
7891 know of any problems this may cause.
7892
7893 EOM
7894         case "$shrpdir" in
7895         "$archlibexp/CORE")
7896                 $cat >&4 <<EOM
7897 But your current setting of $shrpdir is
7898 the default anyway, so it's harmless.
7899 EOM
7900                 ;;
7901         *)
7902                 $cat >&4 <<EOM
7903 Further, your current attempted setting of $shrpdir
7904 conflicts with the value of $archlibexp/CORE
7905 that installperl will use.
7906 EOM
7907                 ;;
7908         esac
7909         ;;
7910 esac
7911
7912 # How will the perl executable find the installed shared $libperl?
7913 # Add $xxx to ccdlflags.
7914 # If we can't figure out a command-line option, use $shrpenv to
7915 # set env LD_RUN_PATH.  The main perl makefile uses this.
7916 shrpdir=$archlibexp/CORE
7917 xxx=''
7918 tmp_shrpenv=''
7919 if "$useshrplib"; then
7920     case "$osname" in 
7921         aix)
7922                 # We'll set it in Makefile.SH...
7923                 ;;
7924         solaris)
7925                 xxx="-R $shrpdir"
7926                 ;;
7927         freebsd|netbsd|openbsd|interix|dragonfly)
7928                 xxx="-Wl,-R$shrpdir"
7929                 ;;
7930         bsdos|linux|irix*|dec_osf|gnu*)
7931                 xxx="-Wl,-rpath,$shrpdir"
7932                 ;;
7933         next)
7934                 # next doesn't like the default...
7935                 ;;
7936         beos)
7937                 # beos doesn't like the default, either.
7938                 ;;
7939         hpux*)
7940                 # hpux doesn't like the default, either.
7941                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7942                 ;;
7943         *)
7944                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7945                 ;;
7946         esac
7947         case "$xxx" in
7948         '') ;;
7949         *)      
7950                 # Only add $xxx if it isn't already in ccdlflags.
7951                 case " $ccdlflags " in
7952                 *" $xxx "*)     ;;
7953                 *)      ccdlflags="$ccdlflags $xxx"
7954                         cat <<EOM >&4
7955
7956 Adding $xxx to the flags
7957 passed to $ld so that the perl executable will find the 
7958 installed shared $libperl.
7959
7960 EOM
7961                         ;;
7962                 esac
7963                 ;;
7964         esac
7965 fi
7966 # Fix ccdlflags in AIX for building external extensions.
7967 # (For building Perl itself bare -bE:perl.exp is needed,
7968 #  Makefile.SH takes care of this.)
7969 case "$osname" in
7970 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7971 esac
7972 # Respect a hint or command-line value.
7973 case "$shrpenv" in
7974 '') shrpenv="$tmp_shrpenv" ;;
7975 esac
7976 case "$ldlibpthname" in
7977 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7978 none)   ldlibpthname='' ;;
7979 esac
7980
7981 : determine where manual pages are on this system
7982 echo " "
7983 case "$sysman" in
7984 '') 
7985         syspath='/usr/share/man/man1 /usr/man/man1'
7986         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7987         syspath="$syspath /usr/man/u_man/man1"
7988         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7989         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7990         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7991         sysman=`./loc . /usr/man/man1 $syspath`
7992         ;;
7993 esac
7994 if $test -d "$sysman"; then
7995         echo "System manual is in $sysman." >&4
7996 else
7997         echo "Could not find manual pages in source form." >&4
7998 fi
7999
8000 : determine where manual pages go
8001 set man1dir man1dir none
8002 eval $prefixit
8003 $cat <<EOM
8004
8005 $spackage has manual pages available in source form.
8006 EOM
8007 case "$nroff" in
8008 nroff)
8009         echo "However, you don't have nroff, so they're probably useless to you."
8010         case "$man1dir" in
8011         '') man1dir="none";;
8012         esac;;
8013 esac
8014 echo "If you don't want the manual sources installed, answer 'none'."
8015 case "$man1dir" in
8016 ' ') dflt=none
8017         ;;
8018 '')
8019         lookpath="$prefixexp/share/man/man1"
8020         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8021         lookpath="$lookpath $prefixexp/man/p_man/man1"
8022         lookpath="$lookpath $prefixexp/man/u_man/man1"
8023         lookpath="$lookpath $prefixexp/man/man.1"
8024         case "$sysman" in
8025         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8026         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8027         esac
8028         set dflt
8029         eval $prefixup
8030         ;;
8031 *)  dflt="$man1dir"
8032         ;;
8033 esac
8034 echo " "
8035 fn=dn+~
8036 rp="Where do the main $spackage manual pages (source) go?"
8037 . ./getfile
8038 if $test "X$man1direxp" != "X$ansexp"; then
8039         installman1dir=''
8040 fi
8041 prefixvar=man1dir
8042 . ./setprefixvar
8043
8044 case "$man1dir" in
8045 '')     man1dir=' '
8046         installman1dir='';;
8047 esac
8048
8049 : What suffix to use on installed man pages
8050
8051 case "$man1dir" in
8052 ' ')
8053         man1ext='0'
8054         ;;
8055 *)
8056         rp="What suffix should be used for the main $spackage man pages?"
8057         case "$man1ext" in
8058         '')     case "$man1dir" in
8059                 *1)  dflt=1 ;;
8060                 *1p) dflt=1p ;;
8061                 *1pm) dflt=1pm ;;
8062                 *l) dflt=l;;
8063                 *n) dflt=n;;
8064                 *o) dflt=o;;
8065                 *p) dflt=p;;
8066                 *C) dflt=C;;
8067                 *L) dflt=L;;
8068                 *L1) dflt=L1;;
8069                 *) dflt=1;;
8070                 esac
8071                 ;;
8072         *)      dflt="$man1ext";;
8073         esac
8074         . ./myread
8075         man1ext="$ans"
8076         ;;
8077 esac
8078
8079 : see if we can have long filenames
8080 echo " "
8081 first=123456789abcdef
8082 $rm -f $first
8083 if (echo hi >$first) 2>/dev/null; then
8084         if $test -f 123456789abcde; then
8085                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8086                 val="$undef"
8087         else
8088                 echo 'You can have filenames longer than 14 characters.'>&4
8089                 val="$define"
8090         fi
8091 else
8092         $cat <<'EOM'
8093 You can't have filenames longer than 14 chars.
8094 You can't even think about them!
8095 EOM
8096         val="$undef"
8097 fi 
8098 set d_flexfnam
8099 eval $setvar
8100 $rm -rf 123456789abcde*
8101
8102 : determine where library module manual pages go
8103 set man3dir man3dir none
8104 eval $prefixit
8105 $cat <<EOM
8106
8107 $spackage has manual pages for many of the library modules.
8108 EOM
8109
8110 case "$nroff" in
8111 nroff)
8112         $cat <<'EOM'
8113 However, you don't have nroff, so they're probably useless to you.
8114 EOM
8115         case "$man3dir" in
8116         '') man3dir="none";;
8117         esac;;
8118 esac
8119
8120 case "$d_flexfnam" in
8121 undef)
8122         $cat <<'EOM'
8123 However, your system can't handle the long file names like File::Basename.3.
8124 EOM
8125         case "$man3dir" in
8126         '') man3dir="none";;
8127         esac;;
8128 esac
8129
8130 echo "If you don't want the manual sources installed, answer 'none'."
8131 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8132 case "$man3dir" in
8133 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8134         if $test -d "$privlib/man/man3"; then
8135                 cat <<EOM >&4
8136
8137 WARNING:  Previous versions of perl installed man3 pages into
8138 $privlib/man/man3.  This version will suggest a
8139 new default of $dflt.
8140 EOM
8141                 tdflt=$dflt
8142                 dflt='n'
8143                 rp='Do you wish to preserve the old behavior?(y/n)'
8144                 . ./myread
8145                 case "$ans" in
8146                 y*) dflt="$privlib/man/man3" ;;
8147                 *)  dflt=$tdflt ;;
8148                 esac
8149     fi
8150         ;;
8151 *)      dflt="$man3dir" ;;
8152 esac
8153 case "$dflt" in
8154 ' ') dflt=none ;;
8155 esac
8156 echo " "
8157 fn=dn+~
8158 rp="Where do the $package library man pages (source) go?"
8159 . ./getfile
8160 prefixvar=man3dir
8161 . ./setprefixvar
8162
8163 case "$man3dir" in
8164 '')     man3dir=' '
8165         installman3dir='';;
8166 esac
8167
8168 : What suffix to use on installed man pages
8169 case "$man3dir" in
8170 ' ')
8171         man3ext='0'
8172         ;;
8173 *)
8174         rp="What suffix should be used for the $package library man pages?"
8175         case "$man3ext" in
8176         '')     case "$man3dir" in
8177                 *3)  dflt=3 ;;
8178                 *3p) dflt=3p ;;
8179                 *3pm) dflt=3pm ;;
8180                 *l) dflt=l;;
8181                 *n) dflt=n;;
8182                 *o) dflt=o;;
8183                 *p) dflt=p;;
8184                 *C) dflt=C;;
8185                 *L) dflt=L;;
8186                 *L3) dflt=L3;;
8187                 *) dflt=3;;
8188                 esac
8189                 ;;
8190         *)      dflt="$man3ext";;
8191         esac
8192         . ./myread
8193         man3ext="$ans"
8194         ;;
8195 esac
8196
8197 : see if we have to deal with yellow pages, now NIS.
8198 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8199         if $test -f /usr/etc/nibindd; then
8200                 echo " "
8201                 echo "I'm fairly confident you're on a NeXT."
8202                 echo " "
8203                 rp='Do you get the hosts file via NetInfo?'
8204                 dflt=y
8205                 case "$hostcat" in
8206                 nidump*) ;;
8207                 '') ;;
8208                 *) dflt=n;;
8209                 esac
8210                 . ./myread
8211                 case "$ans" in
8212                 y*) hostcat='nidump hosts .';;
8213                 *)      case "$hostcat" in
8214                         nidump*) hostcat='';;
8215                         esac
8216                         ;;
8217                 esac
8218         fi
8219         case "$hostcat" in
8220         nidump*) ;;
8221         *)
8222                 case "$hostcat" in
8223                 *ypcat*) dflt=y;;
8224                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8225                                 dflt=y
8226                         else
8227                                 dflt=n
8228                         fi;;
8229                 *) dflt=n;;
8230                 esac
8231                 echo " "
8232                 rp='Are you getting the hosts file via yellow pages?'
8233                 . ./myread
8234                 case "$ans" in
8235                 y*) hostcat='ypcat hosts';;
8236                 *) hostcat='cat /etc/hosts';;
8237                 esac
8238                 ;;
8239         esac
8240 fi
8241 case "$hostcat" in
8242 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8243 esac
8244 case "$groupcat" in
8245 '') test -f /etc/group && groupcat='cat /etc/group';;
8246 esac
8247 case "$passcat" in
8248 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8249 esac
8250
8251 : now get the host name
8252 echo " "
8253 echo "Figuring out host name..." >&4
8254 case "$myhostname" in
8255 '') cont=true
8256         echo 'Maybe "hostname" will work...'
8257         if tans=`sh -c hostname 2>&1` ; then
8258                 myhostname=$tans
8259                 phostname=hostname
8260                 cont=''
8261         fi
8262         ;;
8263 *) cont='';;
8264 esac
8265 if $test "$cont"; then
8266         if ./xenix; then
8267                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8268                 if tans=`cat /etc/systemid 2>&1` ; then
8269                         myhostname=$tans
8270                         phostname='cat /etc/systemid'
8271                         echo "Whadyaknow.  Xenix always was a bit strange..."
8272                         cont=''
8273                 fi
8274         elif $test -r /etc/systemid; then
8275                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8276         fi
8277 fi
8278 if $test "$cont"; then
8279         echo 'No, maybe "uuname -l" will work...'
8280         if tans=`sh -c 'uuname -l' 2>&1` ; then
8281                 myhostname=$tans
8282                 phostname='uuname -l'
8283         else
8284                 echo 'Strange.  Maybe "uname -n" will work...'
8285                 if tans=`sh -c 'uname -n' 2>&1` ; then
8286                         myhostname=$tans
8287                         phostname='uname -n'
8288                 else
8289                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8290                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8291                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8292                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8293                         else
8294                                 case "$myhostname" in
8295                                 '') echo "Does this machine have an identity crisis or something?"
8296                                         phostname='';;
8297                                 *)
8298                                         echo "Well, you said $myhostname before..."
8299                                         phostname='echo $myhostname';;
8300                                 esac
8301                         fi
8302                 fi
8303         fi
8304 fi
8305 case "$myhostname" in
8306 '') myhostname=noname ;;
8307 esac
8308 : you do not want to know about this
8309 set $myhostname
8310 myhostname=$1
8311
8312 : verify guess
8313 if $test "$myhostname" ; then
8314         dflt=y
8315         rp='Your host name appears to be "'$myhostname'".'" Right?"
8316         . ./myread
8317         case "$ans" in
8318         y*) ;;
8319         *) myhostname='';;
8320         esac
8321 fi
8322
8323 : bad guess or no guess
8324 while $test "X$myhostname" = X ; do
8325         dflt=''
8326         rp="Please type the (one word) name of your host:"
8327         . ./myread
8328         myhostname="$ans"
8329 done
8330
8331 : translate upper to lower if necessary
8332 case "$myhostname" in
8333 *[A-Z]*)
8334         echo "(Normalizing case in your host name)"
8335         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8336         ;;
8337 esac
8338
8339 case "$myhostname" in
8340 *.*)
8341         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8342         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8343         echo "(Trimming domain name from host name--host name is now $myhostname)"
8344         ;;
8345 *) case "$mydomain" in
8346         '')
8347                 {
8348                         test "X$hostcat" = "Xypcat hosts" &&
8349                         ypmatch "$myhostname" hosts 2>/dev/null |\
8350                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8351                         $test -s hosts
8352                 } || {
8353                         test "X$hostcat" != "X" &&
8354                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8355                                         /[       ]$myhostname[  . ]/p" > hosts
8356                 }
8357                 tmp_re="[       . ]"
8358                 if $test -f hosts; then
8359                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8360                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8361                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8362                                 hosts | $sort | $uniq | \
8363                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8364                         case `$echo X$dflt` in
8365                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8366                                 dflt=.
8367                                 ;;
8368                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8369                                 ;;
8370                         esac
8371                 else
8372                         echo "(I cannot locate a hosts database anywhere)"
8373                         dflt=.
8374                 fi
8375                 case "$dflt" in
8376                 .)
8377                         tans=`./loc resolv.conf X /etc /usr/etc`
8378                         if $test -f "$tans"; then
8379                                 echo "(Attempting domain name extraction from $tans)"
8380                                 dflt=.`$sed -n -e 's/   / /g' \
8381                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8382                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8383                                 case "$dflt" in
8384                                 .) dflt=.`$sed -n -e 's/        / /g' \
8385                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8386                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8387                                         ;;
8388                                 esac
8389                         fi
8390                         ;;
8391                 esac
8392                 case "$dflt" in
8393                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8394                         dflt=.`sh -c domainname 2>/dev/null`
8395                         case "$dflt" in
8396                         '') dflt='.';;
8397                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8398                         esac
8399                         ;;
8400                 esac
8401                 case "$dflt$osname" in
8402                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8403                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8404                         ;;
8405                 esac
8406                 case "$dflt" in
8407                 .) echo "(Lost all hope -- silly guess then)"
8408                         dflt='.nonet'
8409                         ;;
8410                 esac
8411                 $rm -f hosts
8412                 ;;
8413         *) dflt="$mydomain";;
8414         esac;;
8415 esac
8416 echo " "
8417 rp="What is your domain name?"
8418 . ./myread
8419 tans="$ans"
8420 case "$ans" in
8421 '') ;;
8422 .*) ;;
8423 *) tans=".$tans";;
8424 esac
8425 mydomain="$tans"
8426
8427 : translate upper to lower if necessary
8428 case "$mydomain" in
8429 *[A-Z]*)
8430         echo "(Normalizing case in your domain name)"
8431         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8432         ;;
8433 esac
8434
8435 : a little sanity check here
8436 case "$phostname" in
8437 '') ;;
8438 *)
8439         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8440         $myhostname$mydomain|$myhostname) ;;
8441         *)
8442                 case "$phostname" in
8443                 sed*)
8444                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8445                         ;;
8446                 *)
8447                         echo "(That doesn't agree with your $phostname command, by the way.)"
8448                         ;;
8449                 esac
8450         ;;
8451         esac
8452         ;;
8453 esac
8454
8455 $cat <<EOM
8456
8457 I need to get your e-mail address in Internet format if possible, i.e.
8458 something like user@host.domain. Please answer accurately since I have
8459 no easy means to double check it. The default value provided below
8460 is most probably close to reality but may not be valid from outside
8461 your organization...
8462
8463 EOM
8464 cont=x
8465 while test "$cont"; do
8466         case "$cf_email" in
8467         '') dflt="$cf_by@$myhostname$mydomain";;
8468         *) dflt="$cf_email";;
8469         esac
8470         rp='What is your e-mail address?'
8471         . ./myread
8472         cf_email="$ans"
8473         case "$cf_email" in
8474         *@*.*) cont='' ;;
8475         *)
8476                 rp='Address does not look like an Internet one.  Use it anyway?'
8477                 case "$fastread" in
8478                 yes) dflt=y ;;
8479                 *) dflt=n ;;
8480                 esac
8481                 . ./myread
8482                 case "$ans" in
8483                 y*) cont='' ;;
8484                 *) echo " " ;;
8485                 esac
8486                 ;;
8487         esac
8488 done
8489
8490 $cat <<EOM
8491
8492 If you or somebody else will be maintaining perl at your site, please
8493 fill in the correct e-mail address here so that they may be contacted
8494 if necessary. Currently, the "perlbug" program included with perl
8495 will send mail to this address in addition to perlbug@perl.org. You may
8496 enter "none" for no administrator.
8497
8498 EOM
8499 case "$perladmin" in
8500 '') dflt="$cf_email";;
8501 *) dflt="$perladmin";;
8502 esac
8503 rp='Perl administrator e-mail address'
8504 . ./myread
8505 perladmin="$ans"
8506
8507 : determine whether to only install version-specific parts.
8508 echo " "
8509 $cat <<EOM
8510 Do you want to install only the version-specific parts of the perl
8511 distribution?  Usually you do *not* want to do this.
8512 EOM
8513 case "$versiononly" in
8514 "$define"|[Yy]*|true) dflt='y' ;;
8515 *) dflt='n';
8516 esac
8517 rp="Do you want to install only the version-specific parts of perl?"
8518 . ./myread
8519 case "$ans" in
8520 [yY]*)  val="$define";;
8521 *)      val="$undef" ;;
8522 esac
8523 set versiononly
8524 eval $setvar
8525
8526 case "$versiononly" in
8527 "$define") inc_version_list=''
8528            inc_version_list_init=0
8529            ;;
8530 esac
8531
8532 : figure out how to guarantee perl startup
8533 case "$startperl" in
8534 '')
8535         case "$sharpbang" in
8536         *!)
8537                 $cat <<EOH
8538
8539 I can use the #! construct to start perl on your system. This will
8540 make startup of perl scripts faster, but may cause problems if you
8541 want to share those scripts and perl is not in a standard place
8542 ($binexp/perl) on all your platforms. The alternative is to force
8543 a shell by starting the script with a single ':' character.
8544
8545 EOH
8546                 case "$versiononly" in
8547                 "$define")      dflt="$binexp/perl$version";;  
8548                 *)              dflt="$binexp/perl";;
8549                 esac
8550                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8551                 . ./myread
8552                 case "$ans" in
8553                 none)   startperl=": # use perl";;
8554                 *)      startperl="#!$ans"
8555                         if $test 30 -lt `echo "$ans" | wc -c`; then
8556                                 $cat >&4 <<EOM
8557
8558 WARNING:  Some systems limit the #! command to 32 characters.
8559 If you experience difficulty running Perl scripts with #!, try
8560 installing Perl in a directory with a shorter pathname.
8561
8562 EOM
8563                         fi ;;
8564                 esac
8565                 ;;
8566         *) startperl=": # use perl"
8567                 ;;
8568         esac
8569         ;;
8570 esac
8571 echo "I'll use $startperl to start perl scripts."
8572
8573 : figure best path for perl in scripts
8574 case "$perlpath" in
8575 '')
8576         case "$versiononly" in
8577         "$define")      perlpath="$binexp/perl$version";;
8578         *)              perlpath="$binexp/perl";;
8579         esac
8580         case "$startperl" in
8581         *!*) ;;
8582         *)
8583                 $cat <<EOH
8584
8585 I will use the "eval 'exec'" idiom to start Perl on your system.
8586 I can use the full path of your Perl binary for this purpose, but
8587 doing so may cause problems if you want to share those scripts and
8588 Perl is not always in a standard place ($binexp/perl).
8589
8590 EOH
8591                 dflt="$binexp/perl"
8592                 rp="What path shall I use in \"eval 'exec'\"?"
8593                 . ./myread
8594                 perlpath="$ans"
8595                 ;;
8596         esac
8597         ;;
8598 esac
8599 case "$startperl" in
8600 *!*)    ;;
8601 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8602 esac
8603
8604 : determine where public executable scripts go
8605 set scriptdir scriptdir
8606 eval $prefixit
8607 case "$scriptdir" in
8608 '')
8609         dflt="$bin"
8610         : guess some guesses
8611         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8612         $test -d /usr/share/bin     && dflt=/usr/share/bin
8613         $test -d /usr/local/script  && dflt=/usr/local/script
8614         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8615         $test -d $prefixexp/script  && dflt=$prefixexp/script
8616         set dflt
8617         eval $prefixup
8618         ;;
8619 *)  dflt="$scriptdir"
8620         ;;
8621 esac
8622 $cat <<EOM
8623
8624 Some installations have a separate directory just for executable scripts so
8625 that they can mount it across multiple architectures but keep the scripts in
8626 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8627 Or you might just lump your scripts in with all your other executables.
8628
8629 EOM
8630 fn=d~
8631 rp='Where do you keep publicly executable scripts?'
8632 . ./getfile
8633 if $test "X$ansexp" != "X$scriptdirexp"; then
8634         installscript=''
8635 fi
8636 installscriptdir=''
8637 prefixvar=scriptdir
8638 . ./setprefixvar
8639 : A little fix up for an irregularly named variable.
8640 installscript="$installscriptdir"
8641
8642 : determine where add-on public executables go
8643 case "$sitebin" in
8644 '')     dflt=$siteprefix/bin ;;
8645 *)      dflt=$sitebin ;;
8646 esac
8647 fn=d~
8648 rp='Pathname where the add-on public executables should be installed?'
8649 . ./getfile
8650 prefixvar=sitebin
8651 . ./setprefixvar
8652
8653 : determine where add-on html pages go
8654 : There is no standard location, so try to copy the previously-selected
8655 : directory structure for the core html pages.
8656 case "$sitehtml1dir" in
8657 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8658 *)     dflt=$sitehtml1dir ;;
8659 esac
8660 case "$dflt" in
8661 ''|' ') dflt=none ;;
8662 esac
8663 fn=dn+~
8664 rp='Pathname where the site-specific html pages should be installed?'
8665 . ./getfile
8666 prefixvar=sitehtml1dir
8667 . ./setprefixvar
8668
8669 : determine where add-on library html pages go
8670 : There is no standard location, so try to copy the previously-selected
8671 : directory structure for the core html pages.
8672 case "$sitehtml3dir" in
8673 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8674 *)     dflt=$sitehtml3dir ;;
8675 esac
8676 case "$dflt" in
8677 ''|' ') dflt=none ;;
8678 esac
8679 fn=dn+~
8680 rp='Pathname where the site-specific library html pages should be installed?'
8681 . ./getfile
8682 prefixvar=sitehtml3dir
8683 . ./setprefixvar
8684
8685 : determine where add-on manual pages go
8686 case "$siteman1dir" in
8687 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8688 *)      dflt=$siteman1dir ;;
8689 esac
8690 case "$dflt" in
8691 ''|' ') dflt=none ;;
8692 esac
8693 fn=dn+~
8694 rp='Pathname where the site-specific manual pages should be installed?'
8695 . ./getfile
8696 prefixvar=siteman1dir
8697 . ./setprefixvar
8698
8699 : determine where add-on library man pages go
8700 case "$siteman3dir" in
8701 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8702 *)      dflt=$siteman3dir ;;
8703 esac
8704 case "$dflt" in
8705 ''|' ') dflt=none ;;
8706 esac
8707 fn=dn+~
8708 rp='Pathname where the site-specific library manual pages should be installed?'
8709 . ./getfile
8710 prefixvar=siteman3dir
8711 . ./setprefixvar
8712
8713 : determine where add-on public executable scripts go
8714 case "$sitescript" in
8715 '')     dflt=$siteprefix/script
8716         $test -d $dflt || dflt=$sitebin ;;
8717 *)  dflt="$sitescript" ;;
8718 esac
8719 fn=d~+
8720 rp='Pathname where add-on public executable scripts should be installed?'
8721 . ./getfile
8722 prefixvar=sitescript
8723 . ./setprefixvar
8724
8725 case "$usefaststdio" in
8726 $define|true|[yY]*|'')
8727         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8728         case "$xversion" in
8729         [68])   dflt='y' ;;
8730         *)      dflt='n' ;;
8731         esac
8732         ;;
8733 *) dflt='n';;
8734 esac
8735 cat <<EOM
8736
8737 Perl can be built to use 'fast stdio', which means using the stdio
8738 library but also directly manipulating the stdio buffers to enable
8739 faster I/O.  Using stdio is better for backward compatibility (especially
8740 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8741 interface has been preferred instead of stdio.
8742
8743 If this doesn't make any sense to you, just accept the default '$dflt'.
8744 EOM
8745 rp='Use the "fast stdio" if available?'
8746 . ./myread
8747 case "$ans" in
8748 y|Y)    val="$define" ;;     
8749 *)      val="$undef" ;;
8750 esac
8751 set usefaststdio
8752 eval $setvar
8753
8754
8755 : define an is-a-typedef? function
8756 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8757 case "$inclist" in
8758 "") inclist="sys/types.h";;
8759 esac;
8760 eval "varval=\$$var";
8761 case "$varval" in
8762 "")
8763         $rm -f temp.c;
8764         for inc in $inclist; do
8765                 echo "#include <$inc>" >>temp.c;
8766         done;
8767         echo "#ifdef $type" >> temp.c;
8768         echo "printf(\"We have $type\");" >> temp.c;
8769         echo "#endif" >> temp.c;
8770         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8771         if $contains $type temp.E >/dev/null 2>&1; then
8772                 eval "$var=\$type";
8773         else
8774                 eval "$var=\$def";
8775         fi;
8776         $rm -f temp.?;;
8777 *) eval "$var=\$varval";;
8778 esac'
8779
8780 : define an is-a-typedef? function that prompts if the type is not available.
8781 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8782 case "$inclist" in
8783 "") inclist="sys/types.h";;
8784 esac;
8785 eval "varval=\$$var";
8786 case "$varval" in
8787 "")
8788         $rm -f temp.c;
8789         for inc in $inclist; do
8790                 echo "#include <$inc>" >>temp.c;
8791         done;
8792         echo "#ifdef $type" >> temp.c;
8793         echo "printf(\"We have $type\");" >> temp.c;
8794         echo "#endif" >> temp.c;
8795         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8796         echo " " ;
8797         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8798         if $contains $type temp.E >/dev/null 2>&1; then
8799                 echo "$type found." >&4;
8800                 eval "$var=\$type";
8801         else
8802                 echo "$type NOT found." >&4;
8803                 dflt="$def";
8804                 . ./myread ;
8805                 eval "$var=\$ans";
8806         fi;
8807         $rm -f temp.?;;
8808 *) eval "$var=\$varval";;
8809 esac'
8810
8811 : see what type lseek is declared as in the kernel
8812 rp="What is the type used for lseek's offset on this system?"
8813 set off_t lseektype long stdio.h sys/types.h
8814 eval $typedef_ask
8815
8816 echo " "
8817 echo "Checking to see how big your file offsets are..." >&4
8818 $cat >try.c <<EOCP
8819 #include <sys/types.h>
8820 #include <stdio.h>
8821 int main()
8822 {
8823     printf("%d\n", (int)sizeof($lseektype));
8824     return(0); 
8825 }
8826 EOCP
8827 set try
8828 if eval $compile_ok; then
8829         lseeksize=`$run ./try`
8830         echo "Your file offsets are $lseeksize bytes long."
8831 else
8832         dflt=$longsize
8833         echo " "
8834         echo "(I can't seem to compile the test program.  Guessing...)"
8835         rp="What is the size of your file offsets (in bytes)?"
8836         . ./myread
8837         lseeksize="$ans"
8838 fi
8839 $rm -f try.c try
8840
8841 : see what type file positions are declared as in the library
8842 rp="What is the type for file position used by fsetpos()?"
8843 set fpos_t fpostype long stdio.h sys/types.h
8844 eval $typedef_ask
8845
8846 echo " "
8847 case "$fpostype" in
8848 *_t) zzz="$fpostype"    ;;
8849 *)   zzz="fpos_t"       ;;
8850 esac
8851 echo "Checking the size of $zzz..." >&4 
8852 cat > try.c <<EOCP
8853 #include <sys/types.h>
8854 #include <stdio.h>
8855 #$i_stdlib I_STDLIB
8856 #ifdef I_STDLIB
8857 #include <stdlib.h>
8858 #endif
8859 int main() {
8860     printf("%d\n", (int)sizeof($fpostype));
8861     exit(0);
8862 }
8863 EOCP
8864 set try
8865 if eval $compile_ok; then
8866         yyy=`$run ./try`
8867         case "$yyy" in
8868         '')     fpossize=4
8869                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8870                 ;;
8871         *)      fpossize=$yyy
8872                 echo "Your $zzz is $fpossize bytes long."
8873                 ;;
8874         esac
8875 else
8876         dflt="$longsize"
8877         echo " " >&4
8878         echo "(I can't compile the test program.  Guessing...)" >&4
8879         rp="What is the size of your file positions (in bytes)?"
8880         . ./myread
8881         fpossize="$ans"
8882 fi
8883
8884 # Backward compatibility (uselfs is deprecated).
8885 case "$uselfs" in
8886 "$define"|true|[yY]*)
8887         cat <<EOM >&4
8888
8889 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8890 EOM
8891         uselargefiles="$define"
8892         ;;
8893 esac                          
8894
8895 case "$lseeksize:$fpossize" in
8896 8:8) cat <<EOM
8897
8898 You can have files larger than 2 gigabytes.
8899 EOM
8900    val="$define" ;;
8901 *)    case "$uselargefiles" in
8902    "$undef"|false|[nN]*) dflt='n' ;;
8903    *)   dflt='y' ;;
8904    esac
8905    cat <<EOM
8906
8907 Perl can be built to understand large files (files larger than 2 gigabytes)
8908 on some systems.  To do so, Configure can be run with -Duselargefiles.
8909
8910 If this doesn't make any sense to you, just accept the default '$dflt'.
8911 EOM
8912    rp='Try to understand large files, if available?'
8913    . ./myread
8914    case "$ans" in
8915    y|Y)         val="$define" ;;
8916    *)           val="$undef"  ;;
8917    esac
8918    ;;
8919 esac
8920 set uselargefiles
8921 eval $setvar
8922 : Look for a hint-file generated 'call-back-unit'.  If the
8923 : user has specified that a large files perl is to be built,
8924 : we may need to set or change some other defaults.
8925 if $test -f uselargefiles.cbu; then
8926         echo "Your platform has some specific hints regarding large file builds, using them..."
8927         . ./uselargefiles.cbu
8928 fi
8929 case "$uselargefiles" in
8930 "$define")
8931         if $test -f uselargefiles.cbu; then
8932                 echo " "
8933                 echo "Rechecking to see how big your file offsets are..." >&4
8934                 $cat >try.c <<EOCP
8935 #include <sys/types.h>
8936 #include <stdio.h>
8937 int main()
8938 {
8939     printf("%d\n", (int)sizeof($lseektype));
8940     return(0); 
8941 }
8942 EOCP
8943                 set try
8944                 if eval $compile_ok; then
8945                         lseeksize=`$run ./try`
8946                         $echo "Your file offsets are now $lseeksize bytes long."
8947                 else
8948                         dflt="$lseeksize"
8949                         echo " "
8950                         echo "(I can't seem to compile the test program.  Guessing...)"
8951                         rp="What is the size of your file offsets (in bytes)?"
8952                         . ./myread
8953                         lseeksize="$ans"
8954                 fi
8955                 case "$fpostype" in
8956                 *_t) zzz="$fpostype"    ;;
8957                 *)   zzz="fpos_t"       ;;
8958                 esac
8959                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8960                 $cat > try.c <<EOCP
8961 #include <sys/types.h>
8962 #include <stdio.h>
8963 #$i_stdlib I_STDLIB
8964 #ifdef I_STDLIB
8965 #include <stdlib.h>
8966 #endif
8967 int main() {
8968     printf("%d\n", (int)sizeof($fpostype));
8969     return(0);
8970 }
8971 EOCP
8972                 set try
8973                 if eval $compile_ok; then
8974                         yyy=`$run ./try`
8975                         dflt="$lseeksize"
8976                         case "$yyy" in
8977                         '')     echo " "
8978                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8979                                 ;;
8980                         *)      fpossize=$yyy
8981                                 echo " $fpossize bytes." >&4
8982                                 ;;
8983                         esac
8984                 else
8985                         dflt="$fpossize"
8986                         echo " "
8987                         echo "(I can't compile the test program.  Guessing...)" >&4
8988                         rp="What is the size of your file positions (in bytes)?"
8989                         . ./myread
8990                         fpossize="$ans"
8991                 fi
8992                 $rm -f try.c try
8993         fi
8994         ;;
8995 esac
8996
8997 case "$vendorprefix" in
8998 '')     d_vendorbin="$undef"
8999         vendorbin=''
9000         vendorbinexp=''
9001         ;;
9002 *)      d_vendorbin="$define"
9003         : determine where vendor-supplied executables go.
9004         case "$vendorbin" in
9005         '') dflt=$vendorprefix/bin ;;
9006         *)      dflt="$vendorbin" ;;
9007         esac
9008         fn=d~+
9009         rp='Pathname for the vendor-supplied executables directory?'
9010         . ./getfile
9011         vendorbin="$ans"
9012         vendorbinexp="$ansexp"
9013         ;;
9014 esac
9015 prefixvar=vendorbin
9016 . ./installprefix
9017
9018 case "$vendorprefix" in
9019 '')     vendorhtml1dir=''
9020         vendorhtml1direxp=''
9021         ;;
9022 *)      : determine where vendor-supplied html pages go.
9023         : There is no standard location, so try to copy the previously-selected
9024         : directory structure for the core html pages.
9025         : XXX Better default suggestions would be welcome.
9026         case "$vendorhtml1dir" in
9027         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9028         *)      dflt=$vendorhtml1dir ;;
9029         esac
9030         case "$dflt" in
9031         ''|' ') dflt=none ;;
9032         esac
9033         fn=dn+~
9034         rp='Pathname for the vendor-supplied html pages?'
9035         . ./getfile
9036         vendorhtml1dir="$ans"
9037         vendorhtml1direxp="$ansexp"
9038         ;;
9039 esac
9040 : Use ' ' for none so value is preserved next time through Configure
9041 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9042 prefixvar=vendorhtml1dir
9043 . ./installprefix
9044
9045 case "$vendorprefix" in
9046 '')     vendorhtml3dir=''
9047         vendorhtml3direxp=''
9048         ;;
9049 *)      : determine where vendor-supplied module html pages go.
9050         : There is no standard location, so try to copy the previously-selected
9051         : directory structure for the core html pages.
9052         : XXX Better default suggestions would be welcome.
9053         case "$vendorhtml3dir" in
9054         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9055         *)      dflt=$vendorhtml3dir ;;
9056         esac
9057         case "$dflt" in
9058         ''|' ') dflt=none ;;
9059         esac
9060         fn=dn+~
9061         rp='Pathname for the vendor-supplied html pages?'
9062         . ./getfile
9063         vendorhtml3dir="$ans"
9064         vendorhtml3direxp="$ansexp"
9065         ;;
9066 esac
9067 : Use ' ' for none so value is preserved next time through Configure
9068 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9069 prefixvar=vendorhtml3dir
9070 . ./installprefix
9071
9072 case "$vendorprefix" in
9073 '')     vendorman1dir=''
9074         vendorman1direxp=''
9075         ;;
9076 *)      : determine where vendor-supplied manual pages go.
9077         case "$vendorman1dir" in
9078         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9079         *)      dflt=$vendorman1dir ;;
9080         esac
9081         case "$dflt" in
9082         ''|' ') dflt=none ;;
9083         esac
9084         fn=nd~+
9085         rp='Pathname for the vendor-supplied manual section 1 pages?'
9086         . ./getfile
9087         vendorman1dir="$ans"
9088         vendorman1direxp="$ansexp"
9089         ;;
9090 esac
9091 : Use ' ' for none so value is preserved next time through Configure
9092 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9093 prefixvar=vendorman1dir
9094 . ./installprefix
9095
9096 case "$vendorprefix" in
9097 '')     vendorman3dir=''
9098         vendorman3direxp=''
9099         ;;
9100 *)      : determine where vendor-supplied module manual pages go.
9101         case "$vendorman3dir" in
9102         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9103         *)      dflt=$vendorman3dir ;;
9104         esac
9105         case "$dflt" in
9106         ''|' ') dflt=none ;;
9107         esac
9108         fn=nd~+
9109         rp='Pathname for the vendor-supplied manual section 3 pages?'
9110         . ./getfile
9111         vendorman3dir="$ans"
9112         vendorman3direxp="$ansexp"
9113         ;;
9114 esac
9115 : Use ' ' for none so value is preserved next time through Configure
9116 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9117 prefixvar=vendorman3dir
9118 . ./installprefix
9119
9120 case "$vendorprefix" in
9121 '')     d_vendorscript="$undef"
9122         vendorscript=''
9123         vendorscriptexp=''
9124         ;;
9125 *)      d_vendorscript="$define"
9126         : determine where vendor-supplied scripts go.
9127         case "$vendorscript" in
9128         '')     dflt=$vendorprefix/script
9129                 $test -d $dflt || dflt=$vendorbin ;;
9130         *)  dflt="$vendorscript" ;;
9131         esac
9132         $cat <<EOM
9133
9134 The installation process will create a directory for
9135 vendor-supplied scripts.
9136
9137 EOM
9138         fn=d~+
9139         rp='Pathname for the vendor-supplied scripts directory?'
9140         . ./getfile
9141         vendorscript="$ans"
9142         vendorscriptexp="$ansexp"
9143         ;;
9144 esac
9145 prefixvar=vendorscript
9146 . ./installprefix
9147
9148 : see if qgcvt exists
9149 set qgcvt d_qgcvt
9150 eval $inlibc
9151
9152 echo " "
9153
9154 if $test X"$d_longdbl" = X"$define"; then
9155
9156 echo "Checking how to print long doubles..." >&4
9157
9158 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9159         $cat >try.c <<'EOCP'
9160 #include <sys/types.h>
9161 #include <stdio.h>
9162 int main() {
9163   double d = 123.456;
9164   printf("%.3f\n", d);
9165 }
9166 EOCP
9167         set try
9168         if eval $compile; then
9169                 yyy=`$run ./try`
9170                 case "$yyy" in
9171                 123.456)
9172                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9173                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9174                         echo "We will use %f."
9175                         ;;
9176                 esac
9177         fi
9178 fi
9179
9180 if $test X"$sPRIfldbl" = X; then
9181         $cat >try.c <<'EOCP'
9182 #include <sys/types.h>
9183 #include <stdio.h>
9184 int main() {
9185   long double d = 123.456;
9186   printf("%.3Lf\n", d);
9187 }
9188 EOCP
9189         set try
9190         if eval $compile; then
9191                 yyy=`$run ./try`
9192                 case "$yyy" in
9193                 123.456)
9194                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9195                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9196                         echo "We will use %Lf."
9197                         ;;
9198                 esac
9199         fi
9200 fi
9201
9202 if $test X"$sPRIfldbl" = X; then
9203         $cat >try.c <<'EOCP'
9204 #include <sys/types.h>
9205 #include <stdio.h>
9206 int main() {
9207   long double d = 123.456;
9208   printf("%.3llf\n", d);
9209 }
9210 EOCP
9211         set try
9212         if eval $compile; then
9213                 yyy=`$run ./try`
9214                 case "$yyy" in
9215                 123.456)
9216                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9217                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9218                         echo "We will use %llf."
9219                         ;;
9220                 esac
9221         fi
9222 fi
9223
9224 if $test X"$sPRIfldbl" = X; then
9225         $cat >try.c <<'EOCP'
9226 #include <sys/types.h>
9227 #include <stdio.h>
9228 int main() {
9229   long double d = 123.456;
9230   printf("%.3lf\n", d);
9231 }
9232 EOCP
9233         set try
9234         if eval $compile; then
9235                 yyy=`$run ./try`
9236                 case "$yyy" in
9237                 123.456)
9238                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9239                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9240                         echo "We will use %lf."
9241                         ;;
9242                 esac
9243         fi
9244 fi
9245
9246 if $test X"$sPRIfldbl" = X; then
9247         echo "Cannot figure out how to print long doubles." >&4
9248 else
9249         sSCNfldbl=$sPRIfldbl    # expect consistency
9250 fi
9251
9252 $rm -f try try.*
9253
9254 fi # d_longdbl
9255
9256 case "$sPRIfldbl" in
9257 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9258         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9259         d_SCNfldbl="$undef";
9260         ;;
9261 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9262         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9263         d_SCNfldbl="$define";
9264         ;;
9265 esac
9266
9267 : Check how to convert floats to strings.
9268
9269 if test "X$d_Gconvert" = X; then
9270
9271 echo " "
9272 echo "Checking for an efficient way to convert floats to strings."
9273 echo " " > try.c
9274 case "$uselongdouble" in
9275 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9276 esac
9277 case "$d_longdbl" in
9278 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9279 esac
9280 case "$d_PRIgldbl" in
9281 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9282 esac
9283 $cat >>try.c <<EOP
9284 #ifdef TRY_gconvert
9285 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9286 char *myname = "gconvert";
9287 #endif
9288 #ifdef TRY_gcvt
9289 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9290 char *myname = "gcvt";
9291 #endif
9292 #ifdef TRY_qgcvt
9293 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9294 char *myname = "qgcvt";
9295 #define DOUBLETYPE long double
9296 #endif
9297 #ifdef TRY_sprintf
9298 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9299 #ifdef HAS_PRIgldbl
9300 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9301 #else
9302 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9303 #endif
9304 #else
9305 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9306 #endif
9307 char *myname = "sprintf";
9308 #endif
9309
9310 #ifndef DOUBLETYPE
9311 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9312 #define DOUBLETYPE long double
9313 #else
9314 #define DOUBLETYPE double
9315 #endif
9316 #endif
9317
9318 #include <stdio.h>
9319
9320 #define I_STDLIB $i_stdlib
9321 #ifdef I_STDLIB
9322 #include <stdlib.h>
9323 #endif
9324
9325 int
9326 checkit(expect, got)
9327 char *expect;
9328 char *got;
9329 {
9330     if (strcmp(expect, got)) {
9331                 printf("%s oddity:  Expected %s, got %s\n",
9332                         myname, expect, got);
9333                 exit(1);
9334         }
9335 }
9336
9337 int main()
9338
9339         char buf[64]; 
9340         buf[63] = '\0';
9341
9342         /* This must be 1st test on (which?) platform */
9343         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9344         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9345         checkit("0.1", buf);
9346
9347         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9348         checkit("0.01", buf);
9349
9350         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9351         checkit("0.001", buf);
9352
9353         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9354         checkit("0.0001", buf);
9355
9356         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9357         if (strlen(buf) > 5)
9358             checkit("9e-005", buf); /* for Microsoft ?? */
9359         else
9360             checkit("9e-05", buf);
9361
9362         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9363         checkit("1", buf);
9364
9365         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9366         checkit("1.1", buf);
9367
9368         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9369         checkit("1.01", buf);
9370
9371         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9372         checkit("1.001", buf);
9373
9374         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9375         checkit("1.0001", buf);
9376
9377         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9378         checkit("1.00001", buf);
9379
9380         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9381         checkit("1.000001", buf);
9382
9383         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9384         checkit("0", buf);
9385
9386         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9387         checkit("-1", buf);
9388
9389         /* Some Linux gcvt's give 1.e+5 here. */
9390         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9391         checkit("100000", buf);
9392         
9393         /* Some Linux gcvt's give -1.e+5 here. */
9394         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9395         checkit("-100000", buf);
9396
9397         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9398         checkit("123.456", buf);
9399
9400         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9401         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9402         /* 34 should be enough to scare even long double
9403          * places into using the e notation. */
9404         if (strlen(buf) > 5)
9405             checkit("1e+034", buf); /* for Microsoft */
9406         else
9407             checkit("1e+34", buf);
9408
9409         /* For Perl, if you add additional tests here, also add them to
9410          * t/base/num.t for benefit of platforms not using Configure or
9411          * overriding d_Gconvert */
9412
9413         exit(0);
9414 }
9415 EOP
9416 : first add preferred functions to our list
9417 xxx_list=""
9418 for xxx_convert in $gconvert_preference; do
9419     case $xxx_convert in
9420     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9421     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9422     esac 
9423 done
9424 : then add any others
9425 for xxx_convert in gconvert gcvt sprintf; do
9426     case "$xxx_list" in
9427     *$xxx_convert*) ;;
9428     *) xxx_list="$xxx_list $xxx_convert" ;;
9429     esac 
9430 done
9431
9432 case "$d_longdbl$uselongdouble" in
9433 "$define$define")
9434     : again, add prefered functions to our list first
9435     xxx_ld_list=""
9436     for xxx_convert in $gconvert_ld_preference; do
9437         case $xxx_convert in
9438         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9439         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9440         esac
9441     done
9442     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9443     for xxx_convert in qgcvt sprintf $xxx_list; do
9444         case "$xxx_ld_list" in
9445         $xxx_convert*|*" $xxx_convert"*) ;;
9446         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9447         esac
9448     done
9449     : if sprintf cannot do long doubles, move it to the end
9450     if test "$d_PRIgldbl" != "$define"; then
9451         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9452     fi
9453     : if no qgcvt, remove it
9454     if test "$d_qgcvt" != "$define"; then
9455         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9456     fi
9457     : use the ld_list
9458     xxx_list="$xxx_ld_list"
9459     ;;
9460 esac
9461
9462 for xxx_convert in $xxx_list; do
9463         echo "Trying $xxx_convert..."
9464         $rm -f try try$_o
9465         set try -DTRY_$xxx_convert
9466         if eval $compile; then
9467                 echo "$xxx_convert() found." >&4
9468                 if $run ./try; then
9469                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9470                         break;
9471                 else
9472                         echo "...But $xxx_convert didn't work as I expected."
9473                         xxx_convert=''
9474                 fi
9475         else
9476                 echo "$xxx_convert NOT found." >&4
9477         fi
9478 done
9479
9480 if test X$xxx_convert = X; then
9481     echo "*** WHOA THERE!!! ***" >&4
9482     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9483     xxx_convert=sprintf
9484 fi
9485
9486 case "$xxx_convert" in
9487 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9488 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9489 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9490 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9491    "$define$define$define")
9492       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9493    "$define$define$undef")
9494       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9495    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9496    esac
9497    ;;  
9498 esac
9499
9500 fi
9501
9502 : see if _fwalk exists
9503 set fwalk d__fwalk
9504 eval $inlibc
9505
9506 : Initialize h_fcntl
9507 h_fcntl=false
9508
9509 : Initialize h_sysfile
9510 h_sysfile=false
9511
9512 : access call always available on UNIX
9513 set access d_access
9514 eval $inlibc
9515
9516 : locate the flags for 'access()'
9517 case "$d_access" in
9518 "$define")
9519         echo " "
9520         $cat >access.c <<EOCP
9521 #include <sys/types.h>
9522 #ifdef I_FCNTL
9523 #include <fcntl.h>
9524 #endif
9525 #ifdef I_SYS_FILE
9526 #include <sys/file.h>
9527 #endif
9528 #ifdef I_UNISTD
9529 #include <unistd.h>
9530 #endif
9531 #$i_stdlib I_STDLIB
9532 #ifdef I_STDLIB
9533 #include <stdlib.h>
9534 #endif
9535 int main() {
9536         exit(R_OK);
9537 }
9538 EOCP
9539         : check sys/file.h first, no particular reason here
9540         if $test `./findhdr sys/file.h` && \
9541                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9542                 h_sysfile=true;
9543                 echo "<sys/file.h> defines the *_OK access constants." >&4
9544         elif $test `./findhdr fcntl.h` && \
9545                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9546                 h_fcntl=true;
9547                 echo "<fcntl.h> defines the *_OK access constants." >&4
9548         elif $test `./findhdr unistd.h` && \
9549                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9550                 echo "<unistd.h> defines the *_OK access constants." >&4
9551         else
9552                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9553         fi
9554         ;;
9555 esac
9556 $rm -f access*
9557
9558 : see if accessx exists
9559 set accessx d_accessx
9560 eval $inlibc
9561
9562 : see if aintl exists
9563 set aintl d_aintl
9564 eval $inlibc
9565
9566 : see if alarm exists
9567 set alarm d_alarm
9568 eval $inlibc
9569
9570 : see if POSIX threads are available
9571 set pthread.h i_pthread
9572 eval $inhdr
9573
9574 : define a fucntion to check prototypes
9575 $cat > protochk <<EOSH
9576 $startsh
9577 cc="$cc"
9578 optimize="$optimize"
9579 ccflags="$ccflags"
9580 prototype="$prototype"
9581 define="$define"
9582 rm=$rm
9583 usethreads=$usethreads
9584 i_pthread=$i_pthread
9585 pthread_h_first=$pthread_h_first
9586 EOSH
9587
9588 $cat >> protochk <<'EOSH'
9589
9590 $rm -f try.c
9591 foo="$1"
9592 shift
9593 while test $# -ge 2; do
9594         case "$1" in
9595                 $define) echo "#include <$2>" >> try.c ;;
9596                 literal) echo "$2" >> try.c ;;
9597         esac
9598     # Extra magic for the benefit of systems that need pthread.h
9599     # to be included early to correctly detect threadsafe functions.
9600     # Such functions must guarantee themselves, though, that the usethreads
9601     # and i_pthread have been defined, before calling protochk.
9602     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9603         echo "#include <pthread.h>" >> try.c
9604         pthread_h_done=yes
9605     fi
9606     shift 2
9607 done
9608 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9609 cat >> try.c <<'EOCP'
9610 #ifdef CAN_PROTOTYPE
9611 #define _(args) args
9612 #else
9613 #define _(args) ()
9614 #endif
9615 EOCP
9616 echo "$foo" >> try.c
9617 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9618 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9619 status=$?
9620 $rm -f try.[co]
9621 exit $status
9622 EOSH
9623 chmod +x protochk
9624 $eunicefix protochk
9625
9626 hasproto='varname=$1; func=$2; shift; shift;
9627 while $test $# -ge 2; do
9628         case "$1" in
9629         $define) echo "#include <$2>";;
9630         esac ;
9631     shift 2;
9632 done > try.c;
9633 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9634 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9635         echo "$func() prototype found.";
9636         val="$define";
9637 else
9638         echo "$func() prototype NOT found.";
9639         val="$undef";
9640 fi;
9641 set $varname;
9642 eval $setvar;
9643 $rm -f try.c tryout.c'
9644
9645 : see if sys/types.h has to be included
9646 set sys/types.h i_systypes
9647 eval $inhdr
9648
9649 : see if sys/select.h has to be included
9650 set sys/select.h i_sysselct
9651 eval $inhdr
9652
9653 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9654 while $test $# -ge 2; do
9655         case "$1" in
9656         $define) echo "#include <$2>";;
9657         esac ;
9658     shift 2;
9659 done > try.c;
9660 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9661 set try;
9662 if eval $compile; then
9663         val="$define";
9664 else
9665         val="$undef";
9666 fi;
9667 set $varname;
9668 eval $setvar;
9669 $rm -f try.c try.o'
9670
9671 : see if we should include time.h, sys/time.h, or both
9672 echo " "
9673 if test "X$timeincl" = X; then
9674         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9675         $echo $n "I'm now running the test program...$c"
9676         $cat >try.c <<EOCP
9677 #include <sys/types.h>
9678 #ifdef I_TIME
9679 #include <time.h>
9680 #endif
9681 #ifdef I_SYSTIME
9682 #ifdef SYSTIMEKERNEL
9683 #define KERNEL
9684 #endif
9685 #include <sys/time.h>
9686 #endif
9687 #ifdef I_SYSSELECT
9688 #include <sys/select.h>
9689 #endif
9690 #$i_stdlib I_STDLIB
9691 #ifdef I_STDLIB
9692 #include <stdlib.h>
9693 #endif
9694 int main()
9695 {
9696         struct tm foo;
9697 #ifdef S_TIMEVAL
9698         struct timeval bar;
9699 #endif
9700 #ifdef S_TIMEZONE
9701         struct timezone tzp;
9702 #endif
9703         if (foo.tm_sec == foo.tm_sec)
9704                 exit(0);
9705 #ifdef S_TIMEVAL
9706         if (bar.tv_sec == bar.tv_sec)
9707                 exit(0);
9708 #endif
9709         exit(1);
9710 }
9711 EOCP
9712         flags=''
9713         for s_timezone in '-DS_TIMEZONE' ''; do
9714         sysselect=''
9715         for s_timeval in '-DS_TIMEVAL' ''; do
9716         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9717         for i_time in '' '-DI_TIME'; do
9718         for i_systime in '-DI_SYSTIME' ''; do
9719                 case "$flags" in
9720                 '') $echo $n ".$c"
9721                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9722                         if eval $compile; then
9723                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9724                                 shift
9725                                 flags="$*"
9726                                 echo " "
9727                                 $echo $n "Succeeded with $flags$c"
9728                         fi
9729                         ;;
9730                 esac
9731         done
9732         done
9733         done
9734         done
9735         done
9736         timeincl=''
9737         echo " "
9738         case "$flags" in
9739         *SYSTIMEKERNEL*) i_systimek="$define"
9740                 timeincl=`./findhdr sys/time.h`
9741                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9742         *) i_systimek="$undef";;
9743         esac
9744         case "$flags" in
9745         *I_TIME*) i_time="$define"
9746                 timeincl=`./findhdr time.h`" $timeincl"
9747                 echo "We'll include <time.h>." >&4;;
9748         *) i_time="$undef";;
9749         esac
9750         case "$flags" in
9751         *I_SYSTIME*) i_systime="$define"
9752                 timeincl=`./findhdr sys/time.h`" $timeincl"
9753                 echo "We'll include <sys/time.h>." >&4;;
9754         *) i_systime="$undef";;
9755         esac
9756         $rm -f try.c try
9757 fi
9758 : see if struct tm knows about tm_zone
9759 case "$i_systime$i_time" in
9760 *$define*) 
9761         echo " "
9762         echo "Checking to see if your struct tm has tm_zone field..." >&4
9763         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9764         eval $hasfield
9765         ;;
9766 *)      val="$undef"
9767         set d_tm_tm_zone
9768         eval $setvar
9769         ;;
9770 esac
9771 case "$d_tm_tm_zone" in
9772 "$define")      echo "Yes, it does."   ;;
9773 *)              echo "No, it doesn't." ;;
9774 esac
9775 : see if struct tm knows about tm_gmtoff
9776 case "$i_systime$i_time" in
9777 *$define*) 
9778         echo " "
9779         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9780         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9781         eval $hasfield
9782         ;;
9783 *)      val="$undef"
9784         set d_tm_tm_gmtoff
9785         eval $setvar
9786         ;;
9787 esac
9788 case "$d_tm_tm_gmtoff" in
9789 "$define")      echo "Yes, it does."   ;;
9790 *)              echo "No, it doesn't." ;;
9791 esac
9792
9793 : see if asctime_r exists
9794 set asctime_r d_asctime_r
9795 eval $inlibc
9796 case "$d_asctime_r" in
9797 "$define")
9798         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9799         case "$d_asctime_r_proto:$usethreads" in
9800         ":define")      d_asctime_r_proto=define
9801                 set d_asctime_r_proto asctime_r $hdrs
9802                 eval $hasproto ;;
9803         *)      ;;
9804         esac
9805         case "$d_asctime_r_proto" in
9806         define)
9807         case "$asctime_r_proto" in
9808         ''|0) try='char* asctime_r(const struct tm*, char*);'
9809         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9810         esac
9811         case "$asctime_r_proto" in
9812         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9813         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9814         esac
9815         case "$asctime_r_proto" in
9816         ''|0) try='int asctime_r(const struct tm*, char*);'
9817         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9818         esac
9819         case "$asctime_r_proto" in
9820         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9821         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9822         esac
9823         case "$asctime_r_proto" in
9824         ''|0)   d_asctime_r=undef
9825                 asctime_r_proto=0
9826                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9827         * )     case "$asctime_r_proto" in
9828                 REENTRANT_PROTO*) ;;
9829                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9830                 esac
9831                 echo "Prototype: $try" ;;
9832         esac
9833         ;;
9834         *)      case "$usethreads" in
9835                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9836                 esac
9837                 d_asctime_r=undef
9838                 asctime_r_proto=0
9839                 ;;
9840         esac
9841         ;;
9842 *)      asctime_r_proto=0
9843         ;;
9844 esac
9845
9846 : see if atolf exists
9847 set atolf d_atolf
9848 eval $inlibc
9849
9850 : see if atoll exists
9851 set atoll d_atoll
9852 eval $inlibc
9853
9854 : Look for GCC-style attribute format
9855 case "$d_attribute_format" in
9856 '')
9857 echo " "
9858 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9859 $cat >attrib.c <<'EOCP'
9860 #include <stdio.h>
9861 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9862 EOCP
9863 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9864         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9865                 echo "Your C compiler doesn't support __attribute__((format))."
9866                 val="$undef"
9867         else
9868                 echo "Your C compiler supports __attribute__((format))."
9869                 val="$define"
9870         fi
9871 else
9872         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9873         val="$undef"
9874 fi
9875 ;;
9876 *) val="$d_attribute_format" ;;
9877 esac
9878 set d_attribute_format
9879 eval $setvar
9880 $rm -f attrib*
9881
9882 : Look for GCC-style attribute malloc
9883 case "$d_attribute_malloc" in
9884 '')
9885 echo " "
9886 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9887 $cat >attrib.c <<'EOCP'
9888 #include <stdio.h>
9889 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9890 EOCP
9891 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9892         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9893                 echo "Your C compiler doesn't support __attribute__((malloc))."
9894                 val="$undef"
9895         else
9896                 echo "Your C compiler supports __attribute__((malloc))."
9897                 val="$define"
9898         fi
9899 else
9900         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9901         val="$undef"
9902 fi
9903 ;;
9904 *) val="$d_attribute_malloc" ;;
9905 esac
9906 set d_attribute_malloc
9907 eval $setvar
9908 $rm -f attrib*
9909
9910 : Look for GCC-style attribute nonnull
9911 case "$d_attribute_nonnull" in
9912 '')
9913 echo " "
9914 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9915 $cat >attrib.c <<'EOCP'
9916 #include <stdio.h>
9917 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9918 EOCP
9919 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9920         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9921                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9922                 val="$undef"
9923         else
9924                 echo "Your C compiler supports __attribute__((nonnull))."
9925                 val="$define"
9926         fi
9927 else
9928         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9929         val="$undef"
9930 fi
9931 ;;
9932 *) val="$d_attribute_nonnull" ;;
9933 esac
9934 set d_attribute_nonnull
9935 eval $setvar
9936 $rm -f attrib*
9937
9938 : Look for GCC-style attribute noreturn
9939 case "$d_attribute_noreturn" in
9940 '')
9941 echo " "
9942 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9943 $cat >attrib.c <<'EOCP'
9944 #include <stdio.h>
9945 void fall_over_dead( void ) __attribute__((noreturn));
9946 EOCP
9947 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9948         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9949                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9950                 val="$undef"
9951         else
9952                 echo "Your C compiler supports __attribute__((noreturn))."
9953                 val="$define"
9954         fi
9955 else
9956         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9957         val="$undef"
9958 fi
9959 ;;
9960 *) val="$d_attribute_noreturn" ;;
9961 esac
9962 set d_attribute_noreturn
9963 eval $setvar
9964 $rm -f attrib*
9965
9966 : Look for GCC-style attribute pure
9967 case "$d_attribute_pure" in
9968 '')
9969 echo " "
9970 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
9971 $cat >attrib.c <<'EOCP'
9972 #include <stdio.h>
9973 int square( int n ) __attribute__((pure));
9974 EOCP
9975 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9976         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9977                 echo "Your C compiler doesn't support __attribute__((pure))."
9978                 val="$undef"
9979         else
9980                 echo "Your C compiler supports __attribute__((pure))."
9981                 val="$define"
9982         fi
9983 else
9984         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9985         val="$undef"
9986 fi
9987 ;;
9988 *) val="$d_attribute_pure" ;;
9989 esac
9990 set d_attribute_pure
9991 eval $setvar
9992 $rm -f attrib*
9993
9994 : Look for GCC-style attribute unused
9995 case "$d_attribute_unused" in
9996 '')
9997 echo " "
9998 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
9999 $cat >attrib.c <<'EOCP'
10000 #include <stdio.h>
10001 int do_something( int dummy __attribute__((unused)), int n );
10002 EOCP
10003 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10004         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10005                 echo "Your C compiler doesn't support __attribute__((unused))."
10006                 val="$undef"
10007         else
10008                 echo "Your C compiler supports __attribute__((unused))."
10009                 val="$define"
10010         fi
10011 else
10012         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10013         val="$undef"
10014 fi
10015 ;;
10016 *) val="$d_attribute_unused" ;;
10017 esac
10018 set d_attribute_unused
10019 eval $setvar
10020 $rm -f attrib*
10021
10022 : Look for GCC-style attribute warn_unused_result
10023 case "$d_attribute_warn_unused_result" in
10024 '')
10025 echo " "
10026 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10027 $cat >attrib.c <<'EOCP'
10028 #include <stdio.h>
10029 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10030 EOCP
10031 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10032         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10033                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10034                 val="$undef"
10035         else
10036                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10037                 val="$define"
10038         fi
10039 else
10040         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10041         val="$undef"
10042 fi
10043 ;;
10044 *) val="$d_attribute_warn_unused_result" ;;
10045 esac
10046 set d_attribute_warn_unused_result
10047 eval $setvar
10048 $rm -f attrib*
10049
10050 : see if bcmp exists
10051 set bcmp d_bcmp
10052 eval $inlibc
10053
10054 : see if bcopy exists
10055 set bcopy d_bcopy
10056 eval $inlibc
10057
10058 : see if this is a unistd.h system
10059 set unistd.h i_unistd
10060 eval $inhdr
10061
10062 : see if getpgrp exists
10063 set getpgrp d_getpgrp
10064 eval $inlibc
10065
10066 case "$d_getpgrp" in
10067 "$define")
10068         echo " "
10069         echo "Checking to see which flavor of getpgrp is in use..."
10070         $cat >try.c <<EOP
10071 #$i_unistd I_UNISTD
10072 #include <sys/types.h>
10073 #ifdef I_UNISTD
10074 #  include <unistd.h>
10075 #endif
10076 #$i_stdlib I_STDLIB
10077 #ifdef I_STDLIB
10078 #include <stdlib.h>
10079 #endif
10080 int main()
10081 {
10082         if (getuid() == 0) {
10083                 printf("(I see you are running Configure as super-user...)\n");
10084                 setuid(1);
10085         }
10086 #ifdef TRY_BSD_PGRP
10087         if (getpgrp(1) == 0)
10088                 exit(0);
10089 #else
10090         if (getpgrp() > 0)
10091                 exit(0);
10092 #endif
10093         exit(1);
10094 }
10095 EOP
10096         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10097                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10098                 val="$define"
10099         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10100                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10101                 val="$undef"
10102         else
10103                 echo "I can't seem to compile and run the test program."
10104                 if ./usg; then
10105                         xxx="a USG one, i.e. you use getpgrp()."
10106                 else
10107                         # SVR4 systems can appear rather BSD-ish.
10108                         case "$i_unistd" in
10109                         $undef)
10110                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10111                                 val="$define"
10112                                 ;;
10113                         $define)
10114                                 xxx="probably a USG one, i.e. you use getpgrp()."
10115                                 val="$undef"
10116                                 ;;
10117                         esac
10118                 fi
10119                 echo "Assuming your getpgrp is $xxx" >&4
10120         fi
10121         ;;
10122 *) val="$undef";;
10123 esac
10124 set d_bsdgetpgrp
10125 eval $setvar
10126 $rm -f try try.*
10127
10128 : see if setpgrp exists
10129 set setpgrp d_setpgrp
10130 eval $inlibc
10131
10132 case "$d_setpgrp" in
10133 "$define")
10134         echo " "
10135         echo "Checking to see which flavor of setpgrp is in use..."
10136         $cat >try.c <<EOP
10137 #$i_unistd I_UNISTD
10138 #include <sys/types.h>
10139 #ifdef I_UNISTD
10140 #  include <unistd.h>
10141 #endif
10142 #$i_stdlib I_STDLIB
10143 #ifdef I_STDLIB
10144 #include <stdlib.h>
10145 #endif
10146 int main()
10147 {
10148         if (getuid() == 0) {
10149                 printf("(I see you are running Configure as super-user...)\n");
10150                 setuid(1);
10151         }
10152 #ifdef TRY_BSD_PGRP
10153         if (-1 == setpgrp(1, 1))
10154                 exit(0);
10155 #else
10156         if (setpgrp() != -1)
10157                 exit(0);
10158 #endif
10159         exit(1);
10160 }
10161 EOP
10162         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10163                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10164                 val="$define"
10165         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10166                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10167                 val="$undef"
10168         else
10169                 echo "(I can't seem to compile and run the test program.)"
10170                 if ./usg; then
10171                         xxx="a USG one, i.e. you use setpgrp()."
10172                 else
10173                         # SVR4 systems can appear rather BSD-ish.
10174                         case "$i_unistd" in
10175                         $undef)
10176                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10177                                 val="$define"
10178                                 ;;
10179                         $define)
10180                                 xxx="probably a USG one, i.e. you use setpgrp()."
10181                                 val="$undef"
10182                                 ;;
10183                         esac
10184                 fi
10185                 echo "Assuming your setpgrp is $xxx" >&4
10186         fi
10187         ;;
10188 *) val="$undef";;
10189 esac
10190 set d_bsdsetpgrp
10191 eval $setvar
10192 $rm -f try try.*
10193 : Look for GCC-style __builtin_choose_expr
10194 case "$d_builtin_choose_expr" in
10195 '')
10196     echo " "
10197     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10198     $cat >try.c <<'EOCP'
10199 #include <assert.h>
10200 #include <stdlib.h>
10201 #include <stdio.h>
10202
10203 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10204
10205 int main(void) {
10206     assert( SYRINX(1) == 2112 );
10207     assert( SYRINX(1) != 5150 );
10208     assert( SYRINX(0) == 5150 );
10209     assert( SYRINX(0) != 2112 );
10210     puts( "All good!" );
10211     exit(0);
10212 }
10213
10214 EOCP
10215     set try
10216     if eval $compile; then
10217         echo "Your C compiler supports __builtin_choose_expr."
10218         val="$define"
10219     else
10220         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10221         val="$undef"
10222     fi
10223 ;;
10224 *) val="$d_builtin_choose_expr" ;;
10225 esac
10226
10227 set d_builtin_choose_expr
10228 eval $setvar
10229 $rm -f try.* try core core.try.*
10230
10231 : Look for GCC-style __builtin_expect
10232 case "$d_builtin_expect" in
10233 '')
10234     echo " "
10235     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10236     $cat >builtin.c <<'EOCP'
10237 int main(void) {
10238     int n = 50;
10239     if ( __builtin_expect(n, 0) ) n = 1;
10240 }
10241 EOCP
10242     set try
10243     if eval $compile; then
10244         echo "Your C compiler supports __builtin_choose_expr."
10245         val="$define"
10246     else
10247         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10248         val="$undef"
10249     fi
10250     ;;
10251 *) val="$d_builtin_expect" ;;
10252 esac
10253
10254 set d_builtin_expect
10255 eval $setvar
10256 $rm -f try.* try core core.try.*
10257
10258 : see if bzero exists
10259 set bzero d_bzero
10260 eval $inlibc
10261
10262 : see if signal is declared as pointer to function returning int or void
10263 echo " "
10264 xxx=`./findhdr signal.h`
10265 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10266 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10267         echo "You have int (*signal())() instead of void." >&4
10268         val="$undef"
10269 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10270         echo "You have void (*signal())()." >&4
10271         val="$define"
10272 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10273         echo "You have int (*signal())() instead of void." >&4
10274         val="$undef"
10275 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10276         echo "You have void (*signal())()." >&4
10277         val="$define"
10278 else
10279         case "$d_voidsig" in
10280         '')
10281         echo "I can't determine whether signal handler returns void or int..." >&4
10282                 dflt=void
10283                 rp="What type does your signal handler return?"
10284                 . ./myread
10285                 case "$ans" in
10286                 v*) val="$define";;
10287                 *) val="$undef";;
10288                 esac;;
10289         "$define")
10290                 echo "As you already told me, signal handler returns void." >&4
10291                 val="$define"
10292                 ;;
10293         *)      echo "As you already told me, signal handler returns int." >&4
10294                 val="$undef"
10295                 ;;
10296         esac
10297 fi
10298 set d_voidsig
10299 eval $setvar
10300 case "$d_voidsig" in
10301 "$define") signal_t="void";;
10302 *) signal_t="int";;
10303 esac
10304 $rm -f $$.tmp
10305
10306 : check for ability to cast large floats to 32-bit ints.
10307 echo " "
10308 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10309 if $test "$intsize" -ge 4; then
10310         xxx=int
10311 else
10312         xxx=long
10313 fi
10314 $cat >try.c <<EOCP
10315 #include <stdio.h>
10316 #$i_stdlib I_STDLIB
10317 #ifdef I_STDLIB
10318 #include <stdlib.h>
10319 #endif
10320 #include <sys/types.h>
10321 #include <signal.h>
10322 $signal_t blech(s) int s; { exit(3); }
10323 int main()
10324 {
10325         $xxx i32;
10326         double f, g;
10327         int result = 0;
10328         char str[16];
10329         signal(SIGFPE, blech);
10330
10331         /* Don't let compiler optimize the test away.  Store the number 
10332            in a writable string for gcc to pass to sscanf under HP/UX.
10333         */
10334         sprintf(str, "2147483647");
10335         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10336         g = 10 * f;
10337         i32  = ($xxx) g;
10338
10339         /* x86 processors will probably give 0x8000 0000, which is a
10340            sign change.  We don't want that.  We want to mimic SPARC
10341            behavior here, which is to preserve the sign and give
10342            back 0x7fff ffff.
10343         */
10344         if (i32 != ($xxx) f)
10345                 result |= 1;
10346         exit(result);
10347 }
10348 EOCP
10349 set try
10350 if eval $compile_ok; then
10351         $run ./try
10352         yyy=$?
10353 else
10354         echo "(I can't seem to compile the test program--assuming it can't)"
10355         yyy=1
10356 fi
10357 case "$yyy" in
10358 0)      val="$define"
10359         echo "Yup, it can."
10360         ;;
10361 *)      val="$undef"
10362         echo "Nope, it can't."
10363         ;;
10364 esac
10365 set d_casti32
10366 eval $setvar
10367 $rm -f try try.*
10368
10369 : check for ability to cast negative floats to unsigned
10370 echo " "
10371 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10372 $cat >try.c <<EOCP
10373 #include <stdio.h>
10374 #$i_stdlib I_STDLIB
10375 #ifdef I_STDLIB
10376 #include <stdlib.h>
10377 #endif
10378 #include <sys/types.h>
10379 #include <signal.h>
10380 $signal_t blech(s) int s; { exit(7); }
10381 $signal_t blech_in_list(s) int s; { exit(4); }
10382 unsigned long dummy_long(p) unsigned long p; { return p; }
10383 unsigned int dummy_int(p) unsigned int p; { return p; }
10384 unsigned short dummy_short(p) unsigned short p; { return p; }
10385 int main()
10386 {
10387         double f;
10388         unsigned long along;
10389         unsigned int aint;
10390         unsigned short ashort;
10391         int result = 0;
10392         char str[16];
10393         
10394         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10395            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10396            optimized the whole file away
10397         */
10398         /* Store the number in a writable string for gcc to pass to 
10399            sscanf under HP/UX.
10400         */
10401         sprintf(str, "-123");
10402         sscanf(str, "%lf", &f);  /* f = -123.; */
10403
10404         signal(SIGFPE, blech);
10405         along = (unsigned long)f;
10406         aint = (unsigned int)f;
10407         ashort = (unsigned short)f;
10408         if (along != (unsigned long)-123)
10409                 result |= 1;
10410         if (aint != (unsigned int)-123)
10411                 result |= 1;
10412         if (ashort != (unsigned short)-123)
10413                 result |= 1;
10414         sprintf(str, "1073741824.");
10415         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10416         f = f + f;
10417         along = 0;
10418         along = (unsigned long)f;
10419         if (along != 0x80000000)
10420                 result |= 2;
10421         f -= 1.;
10422         along = 0;
10423         along = (unsigned long)f;
10424         if (along != 0x7fffffff)
10425                 result |= 1;
10426         f += 2.;
10427         along = 0;
10428         along = (unsigned long)f;
10429         if (along != 0x80000001)
10430                 result |= 2;
10431         if (result)
10432                 exit(result);
10433         signal(SIGFPE, blech_in_list);
10434         sprintf(str, "123.");
10435         sscanf(str, "%lf", &f);  /* f = 123.; */
10436         along = dummy_long((unsigned long)f);
10437         aint = dummy_int((unsigned int)f);
10438         ashort = dummy_short((unsigned short)f);
10439         if (along != (unsigned long)123)
10440                 result |= 4;
10441         if (aint != (unsigned int)123)
10442                 result |= 4;
10443         if (ashort != (unsigned short)123)
10444                 result |= 4;
10445         exit(result);
10446
10447 }
10448 EOCP
10449 set try
10450 if eval $compile_ok; then
10451         $run ./try
10452         castflags=$?
10453 else
10454         echo "(I can't seem to compile the test program--assuming it can't)"
10455         castflags=7
10456 fi
10457 case "$castflags" in
10458 0)      val="$define"
10459         echo "Yup, it can."
10460         ;;
10461 *)      val="$undef"
10462         echo "Nope, it can't."
10463         ;;
10464 esac
10465 set d_castneg
10466 eval $setvar
10467 $rm -f try.*
10468
10469 : see if vprintf exists
10470 echo " "
10471 if set vprintf val -f d_vprintf; eval $csym; $val; then
10472         echo 'vprintf() found.' >&4
10473         val="$define"
10474         $cat >try.c <<EOF
10475 #include <varargs.h>
10476 #$i_stdlib I_STDLIB
10477 #ifdef I_STDLIB
10478 #include <stdlib.h>
10479 #endif
10480
10481 int main() { xxx("foo"); }
10482
10483 xxx(va_alist)
10484 va_dcl
10485 {
10486         va_list args;
10487         char buf[10];
10488
10489         va_start(args);
10490         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10491 }
10492 EOF
10493         set try
10494         if eval $compile && $run ./try; then
10495                 echo "Your vsprintf() returns (int)." >&4
10496                 val2="$undef"
10497         else
10498                 echo "Your vsprintf() returns (char*)." >&4
10499                 val2="$define"
10500         fi
10501 else
10502         echo 'vprintf() NOT found.' >&4
10503                 val="$undef"
10504                 val2="$undef"
10505 fi
10506 $rm -f try try.*
10507 set d_vprintf
10508 eval $setvar
10509 val=$val2
10510 set d_charvspr
10511 eval $setvar
10512
10513 : see if chown exists
10514 set chown d_chown
10515 eval $inlibc
10516
10517 : see if chroot exists
10518 set chroot d_chroot
10519 eval $inlibc
10520
10521 : see if chsize exists
10522 set chsize d_chsize
10523 eval $inlibc
10524
10525 : see if class exists
10526 set class d_class
10527 eval $inlibc
10528
10529 : see if clearenv exists
10530 set clearenv d_clearenv
10531 eval $inlibc
10532
10533 hasstruct='varname=$1; struct=$2; shift; shift;
10534 while $test $# -ge 2; do
10535         case "$1" in
10536         $define) echo "#include <$2>";;
10537         esac ;
10538     shift 2;
10539 done > try.c;
10540 echo "int main () { struct $struct foo; }" >> try.c;
10541 set try;
10542 if eval $compile; then
10543         val="$define";
10544 else
10545         val="$undef";
10546 fi;
10547 set $varname;
10548 eval $setvar;
10549 $rm -f try.c try.o'
10550
10551 socketlib=''
10552 sockethdr=''
10553 : see whether socket exists
10554 echo " "
10555 $echo $n "Hmm... $c" >&4
10556 if set socket val -f d_socket; eval $csym; $val; then
10557         echo "Looks like you have Berkeley networking support." >&4
10558         d_socket="$define"
10559         if set setsockopt val -f; eval $csym; $val; then
10560                 d_oldsock="$undef"
10561         else
10562                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10563                 d_oldsock="$define"
10564         fi
10565 else
10566         if $contains socklib libc.list >/dev/null 2>&1; then
10567                 echo "Looks like you have Berkeley networking support." >&4
10568                 d_socket="$define"
10569                 : we will have to assume that it supports the 4.2 BSD interface
10570                 d_oldsock="$undef"
10571         else
10572                 echo "You don't have Berkeley networking in libc$_a..." >&4
10573                 if test "X$d_socket" = "X$define"; then
10574                    echo "...but you seem to believe that you have sockets." >&4
10575                 else
10576                         for net in net socket
10577                         do
10578                                 if test -f /usr/lib/lib$net$_a; then
10579                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10580                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10581                                         if $contains socket libc.list >/dev/null 2>&1; then
10582                                                 d_socket="$define"
10583                                                 socketlib="-l$net"
10584                                                 case "$net" in
10585                                                 net)
10586                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10587                                                         sockethdr="-I/usr/netinclude"
10588                                                         ;;
10589                                                 esac
10590                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10591                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10592                                                         d_oldsock="$undef"
10593                                                 else
10594                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10595                                                         d_oldsock="$define"
10596                                                 fi
10597                                                 break
10598                                         fi
10599                                 fi
10600                         done
10601                         if test "X$d_socket" != "X$define"; then
10602                            echo "or anywhere else I see." >&4
10603                            d_socket="$undef"
10604                            d_oldsock="$undef"
10605                         fi
10606                 fi
10607         fi
10608 fi
10609
10610 : see if socketpair exists
10611 set socketpair d_sockpair
10612 eval $inlibc
10613
10614
10615 echo " "
10616 echo "Checking the availability of certain socket constants..." >&4
10617 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10618         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10619         $cat >try.c <<EOF
10620 #include <sys/types.h>
10621 #include <sys/socket.h>
10622 int main() {
10623     int i = $ENUM;
10624 }
10625 EOF
10626         val="$undef"
10627         set try; if eval $compile; then
10628                 val="$define"
10629         fi
10630         set d_${enum}; eval $setvar
10631         $rm -f try.c try
10632 done
10633
10634 : see if this is a sys/uio.h system
10635 set sys/uio.h i_sysuio
10636 eval $inhdr
10637
10638
10639 echo " "
10640 echo "Checking to see if your system supports struct cmsghdr..." >&4
10641 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10642 eval $hasstruct
10643 case "$d_cmsghdr_s" in
10644 "$define")      echo "Yes, it does."   ;;
10645 *)              echo "No, it doesn't." ;;
10646 esac
10647
10648
10649 : check for const keyword
10650 echo " "
10651 echo 'Checking to see if your C compiler knows about "const"...' >&4
10652 $cat >const.c <<'EOCP'
10653 typedef struct spug { int drokk; } spug;
10654 int main()
10655 {
10656         const char *foo;
10657         const spug y;
10658 }
10659 EOCP
10660 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10661         val="$define"
10662         echo "Yup, it does."
10663 else
10664         val="$undef"
10665         echo "Nope, it doesn't."
10666 fi
10667 set d_const
10668 eval $setvar
10669
10670 : see if copysignl exists
10671 set copysignl d_copysignl
10672 eval $inlibc
10673
10674 : see if crypt exists
10675 echo " "
10676 set crypt d_crypt
10677 eval $inlibc
10678 case "$d_crypt" in
10679 $define) cryptlib='' ;;
10680 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10681                 echo 'crypt() found.' >&4
10682                 val="$define"
10683                 cryptlib=''
10684         else
10685                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10686                 if $test -z "$cryptlib"; then
10687                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10688                 else
10689                         cryptlib=-lcrypt
10690                 fi
10691                 if $test -z "$cryptlib"; then
10692                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10693                 else
10694                         cryptlib=-lcrypt
10695                 fi
10696                 if $test -z "$cryptlib"; then
10697                         cryptlib=`./loc libcrypt$_a "" $libpth`
10698                 else
10699                         cryptlib=-lcrypt
10700                 fi
10701                 if $test -z "$cryptlib"; then
10702                         echo 'crypt() NOT found.' >&4
10703                         val="$undef"
10704                 else
10705                         val="$define"
10706                 fi
10707         fi
10708         set d_crypt
10709         eval $setvar
10710         ;;
10711 esac
10712
10713 : see if this is a crypt.h system
10714 set crypt.h i_crypt
10715 eval $inhdr
10716
10717 : see if crypt_r exists
10718 set crypt_r d_crypt_r
10719 eval $inlibc
10720 case "$d_crypt_r" in
10721 "$define")
10722         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10723         case "$d_crypt_r_proto:$usethreads" in
10724         ":define")      d_crypt_r_proto=define
10725                 set d_crypt_r_proto crypt_r $hdrs
10726                 eval $hasproto ;;
10727         *)      ;;
10728         esac
10729         case "$d_crypt_r_proto" in
10730         define)
10731         case "$crypt_r_proto" in
10732         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10733         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10734         esac
10735         case "$crypt_r_proto" in
10736         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10737         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10738         esac
10739         case "$crypt_r_proto" in
10740         ''|0)   d_crypt_r=undef
10741                 crypt_r_proto=0
10742                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10743         * )     case "$crypt_r_proto" in
10744                 REENTRANT_PROTO*) ;;
10745                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10746                 esac
10747                 echo "Prototype: $try" ;;
10748         esac
10749         ;;
10750         *)      case "$usethreads" in
10751                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10752                 esac
10753                 d_crypt_r=undef
10754                 crypt_r_proto=0
10755                 ;;
10756         esac
10757         ;;
10758 *)      crypt_r_proto=0
10759         ;;
10760 esac
10761
10762 : get csh whereabouts
10763 case "$csh" in
10764 'csh') val="$undef" ;;
10765 *) val="$define" ;;
10766 esac
10767 set d_csh
10768 eval $setvar
10769 : Respect a hint or command line value for full_csh.
10770 case "$full_csh" in
10771 '') full_csh=$csh ;;
10772 esac
10773
10774 : see if ctermid_r exists
10775 set ctermid_r d_ctermid_r
10776 eval $inlibc
10777 case "$d_ctermid_r" in
10778 "$define")
10779         hdrs="$i_systypes sys/types.h define stdio.h "
10780         case "$d_ctermid_r_proto:$usethreads" in
10781         ":define")      d_ctermid_r_proto=define
10782                 set d_ctermid_r_proto ctermid_r $hdrs
10783                 eval $hasproto ;;
10784         *)      ;;
10785         esac
10786         case "$d_ctermid_r_proto" in
10787         define)
10788         case "$ctermid_r_proto" in
10789         ''|0) try='char* ctermid_r(char*);'
10790         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10791         esac
10792         case "$ctermid_r_proto" in
10793         ''|0)   d_ctermid_r=undef
10794                 ctermid_r_proto=0
10795                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10796         * )     case "$ctermid_r_proto" in
10797                 REENTRANT_PROTO*) ;;
10798                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10799                 esac
10800                 echo "Prototype: $try" ;;
10801         esac
10802         ;;
10803         *)      case "$usethreads" in
10804                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10805                 esac
10806                 d_ctermid_r=undef
10807                 ctermid_r_proto=0
10808                 ;;
10809         esac
10810         ;;
10811 *)      ctermid_r_proto=0
10812         ;;
10813 esac
10814
10815 : see if ctime_r exists
10816 set ctime_r d_ctime_r
10817 eval $inlibc
10818 case "$d_ctime_r" in
10819 "$define")
10820         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10821         case "$d_ctime_r_proto:$usethreads" in
10822         ":define")      d_ctime_r_proto=define
10823                 set d_ctime_r_proto ctime_r $hdrs
10824                 eval $hasproto ;;
10825         *)      ;;
10826         esac
10827         case "$d_ctime_r_proto" in
10828         define)
10829         case "$ctime_r_proto" in
10830         ''|0) try='char* ctime_r(const time_t*, char*);'
10831         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10832         esac
10833         case "$ctime_r_proto" in
10834         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10835         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10836         esac
10837         case "$ctime_r_proto" in
10838         ''|0) try='int ctime_r(const time_t*, char*);'
10839         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10840         esac
10841         case "$ctime_r_proto" in
10842         ''|0) try='int ctime_r(const time_t*, char*, int);'
10843         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10844         esac
10845         case "$ctime_r_proto" in
10846         ''|0)   d_ctime_r=undef
10847                 ctime_r_proto=0
10848                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10849         * )     case "$ctime_r_proto" in
10850                 REENTRANT_PROTO*) ;;
10851                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10852                 esac
10853                 echo "Prototype: $try" ;;
10854         esac
10855         ;;
10856         *)      case "$usethreads" in
10857                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10858                 esac
10859                 d_ctime_r=undef
10860                 ctime_r_proto=0
10861                 ;;
10862         esac
10863         ;;
10864 *)      ctime_r_proto=0
10865         ;;
10866 esac
10867
10868 : see if cuserid exists
10869 set cuserid d_cuserid
10870 eval $inlibc
10871
10872 : see if this is a limits.h system
10873 set limits.h i_limits
10874 eval $inhdr
10875
10876 : see if this is a float.h system
10877 set float.h i_float
10878 eval $inhdr
10879
10880 : See if number of significant digits in a double precision number is known
10881 echo " "
10882 $cat >dbl_dig.c <<EOM
10883 #$i_limits I_LIMITS
10884 #$i_float I_FLOAT
10885 #ifdef I_LIMITS
10886 #include <limits.h>
10887 #endif
10888 #ifdef I_FLOAT
10889 #include <float.h>
10890 #endif
10891 #ifdef DBL_DIG
10892 printf("Contains DBL_DIG");
10893 #endif
10894 EOM
10895 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10896 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10897         echo "DBL_DIG found." >&4
10898         val="$define"
10899 else
10900         echo "DBL_DIG NOT found." >&4
10901         val="$undef"
10902 fi
10903 $rm -f dbl_dig.?
10904 set d_dbl_dig
10905 eval $setvar
10906
10907 : see if dbm.h is available
10908 : see if dbmclose exists
10909 set dbmclose d_dbmclose
10910 eval $inlibc
10911
10912 case "$d_dbmclose" in
10913 $define)
10914         set dbm.h i_dbm
10915         eval $inhdr
10916         case "$i_dbm" in
10917         $define)
10918                 val="$undef"
10919                 set i_rpcsvcdbm
10920                 eval $setvar
10921                 ;;
10922         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10923                 eval $inhdr
10924                 ;;
10925         esac
10926         ;;
10927 *)      echo "We won't be including <dbm.h>"
10928         val="$undef"
10929         set i_dbm
10930         eval $setvar
10931         val="$undef"
10932         set i_rpcsvcdbm
10933         eval $setvar
10934         ;;
10935 esac
10936
10937 : see if prototype for dbminit is available
10938 echo " "
10939 set d_dbminitproto dbminit $i_dbm dbm.h
10940 eval $hasproto
10941
10942 : see if difftime exists
10943 set difftime d_difftime
10944 eval $inlibc
10945
10946 : see if this is a dirent system
10947 echo " "
10948 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10949         val="$define"
10950         echo "<dirent.h> found." >&4
10951 else
10952         val="$undef"
10953         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10954                 echo "<sys/dir.h> found." >&4
10955                 echo " "
10956         else
10957                 xinc=`./findhdr sys/ndir.h`
10958         fi
10959         echo "<dirent.h> NOT found." >&4
10960 fi
10961 set i_dirent
10962 eval $setvar
10963
10964 : Look for type of directory structure.
10965 echo " "
10966 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10967
10968 case "$direntrytype" in
10969 ''|' ')
10970         case "$i_dirent" in
10971         $define) guess1='struct dirent' ;;
10972         *) guess1='struct direct'  ;;
10973         esac
10974         ;;
10975 *)      guess1="$direntrytype"
10976         ;;
10977 esac
10978
10979 case "$guess1" in
10980 'struct dirent') guess2='struct direct' ;;
10981 *) guess2='struct dirent' ;;
10982 esac
10983                 
10984 if $contains "$guess1" try.c >/dev/null 2>&1; then
10985         direntrytype="$guess1"
10986         echo "Your directory entries are $direntrytype." >&4
10987 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10988         direntrytype="$guess2"
10989         echo "Your directory entries seem to be $direntrytype." >&4
10990 else
10991         echo "I don't recognize your system's directory entries." >&4
10992         rp="What type is used for directory entries on this system?"
10993         dflt="$guess1"
10994         . ./myread
10995         direntrytype="$ans"
10996 fi
10997 $rm -f try.c
10998
10999
11000 : see if the directory entry stores field length
11001 echo " "
11002 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11003 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11004         echo "Good, your directory entry keeps length information in d_namlen." >&4
11005         val="$define"
11006 else
11007         echo "Your directory entry does not know about the d_namlen field." >&4
11008         val="$undef"
11009 fi
11010 set d_dirnamlen
11011 eval $setvar
11012 $rm -f try.c
11013
11014 : see if this is an sysdir system
11015 set sys/dir.h i_sysdir
11016 eval $inhdr
11017
11018 : see if this is an sysndir system
11019 set sys/ndir.h i_sysndir
11020 eval $inhdr
11021
11022 : Look for dirfd
11023 echo " "
11024 $cat >dirfd.c <<EOM
11025 #include <stdio.h>
11026 #$i_stdlib I_STDLIB
11027 #ifdef I_STDLIB
11028 #include <stdlib.h>
11029 #endif
11030 #$i_dirent I_DIRENT             /**/
11031 #$i_sysdir I_SYS_DIR            /**/
11032 #$i_sysndir I_SYS_NDIR          /**/
11033 #$i_systypes I_SYS_TYPES        /**/
11034 #if defined(I_SYS_TYPES)
11035 #include <sys/types.h>
11036 #endif
11037 #if defined(I_DIRENT)
11038 #include <dirent.h>
11039 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11040 #include <sys/dir.h>
11041 #endif
11042 #else
11043 #ifdef I_SYS_NDIR
11044 #include <sys/ndir.h>
11045 #else
11046 #ifdef I_SYS_DIR
11047 #ifdef hp9000s500
11048 #include <ndir.h>       /* may be wrong in the future */
11049 #else
11050 #include <sys/dir.h>
11051 #endif
11052 #endif
11053 #endif
11054 #endif 
11055 int main() {
11056         DIR *dirp = opendir(".");
11057         if (dirfd(dirp) >= 0)
11058                 exit(0);
11059         else
11060                 exit(1);
11061 }
11062 EOM
11063 val=$undef
11064 set dirfd
11065 if eval $compile; then
11066         val="$define"
11067 fi
11068 case "$val" in
11069 $define)        echo "dirfd() found." >&4       ;;
11070 *)              echo "dirfd() NOT found." >&4   ;;
11071 esac
11072 set d_dirfd
11073 eval $setvar
11074 $rm -f dirfd*
11075
11076 : see if dlerror exists
11077 xxx_runnm="$runnm"
11078 runnm=false
11079 set dlerror d_dlerror
11080 eval $inlibc
11081 runnm="$xxx_runnm"
11082
11083 : see if dlfcn is available
11084 set dlfcn.h i_dlfcn
11085 eval $inhdr
11086
11087 case "$usedl" in
11088 $define|y|true)
11089         $cat << EOM
11090
11091 On a few systems, the dynamically loaded modules that perl generates and uses
11092 will need a different extension than shared libs. The default will probably
11093 be appropriate.
11094
11095 EOM
11096         case "$dlext" in
11097         '')     dflt="$so" ;;
11098         *)      dflt="$dlext" ;;
11099         esac
11100         rp='What is the extension of dynamically loaded modules'
11101         . ./myread
11102         dlext="$ans"
11103         ;;
11104 *)
11105         dlext="none"
11106         ;;
11107 esac
11108
11109 : Check if dlsym need a leading underscore
11110 echo " "
11111 val="$undef"
11112
11113 case "$dlsrc" in
11114 dl_dlopen.xs)
11115         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11116         $cat >dyna.c <<'EOM'
11117 fred () { }
11118 EOM
11119
11120 $cat >fred.c<<EOM
11121
11122 #include <stdio.h>
11123 #$i_stdlib I_STDLIB
11124 #ifdef I_STDLIB
11125 #include <stdlib.h>
11126 #endif
11127 #$i_dlfcn I_DLFCN
11128 #ifdef I_DLFCN
11129 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11130 #else
11131 #include <sys/types.h>
11132 #include <nlist.h>
11133 #include <link.h>
11134 #endif
11135
11136 extern int fred() ;
11137
11138 int main()
11139 {
11140     void * handle ;
11141     void * symbol ;
11142 #ifndef RTLD_LAZY
11143     int mode = 1 ;
11144 #else
11145     int mode = RTLD_LAZY ;
11146 #endif
11147     handle = dlopen("./dyna.$dlext", mode) ;
11148     if (handle == NULL) {
11149         printf ("1\n") ;
11150         fflush (stdout) ;
11151         exit(0);
11152     }
11153     symbol = dlsym(handle, "fred") ;
11154     if (symbol == NULL) {
11155         /* try putting a leading underscore */
11156         symbol = dlsym(handle, "_fred") ;
11157         if (symbol == NULL) {
11158             printf ("2\n") ;
11159             fflush (stdout) ;
11160             exit(0);
11161         }
11162         printf ("3\n") ;
11163     }
11164     else
11165         printf ("4\n") ;
11166     fflush (stdout) ;
11167     exit(0);
11168 }
11169 EOM
11170         : Call the object file tmp-dyna.o in case dlext=o.
11171         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11172                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11173                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11174                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11175                 xxx=`$run ./fred`
11176                 case $xxx in
11177                 1)      echo "Test program failed using dlopen." >&4
11178                         echo "Perhaps you should not use dynamic loading." >&4;;
11179                 2)      echo "Test program failed using dlsym." >&4
11180                         echo "Perhaps you should not use dynamic loading." >&4;;
11181                 3)      echo "dlsym needs a leading underscore" >&4
11182                         val="$define" ;;
11183                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11184                 esac
11185         else
11186                 echo "I can't compile and run the test program." >&4
11187                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11188         fi
11189         ;;
11190 esac
11191                 
11192 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11193
11194 set d_dlsymun
11195 eval $setvar
11196
11197 : see if drand48_r exists
11198 set drand48_r d_drand48_r
11199 eval $inlibc
11200 case "$d_drand48_r" in
11201 "$define")
11202         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11203         case "$d_drand48_r_proto:$usethreads" in
11204         ":define")      d_drand48_r_proto=define
11205                 set d_drand48_r_proto drand48_r $hdrs
11206                 eval $hasproto ;;
11207         *)      ;;
11208         esac
11209         case "$d_drand48_r_proto" in
11210         define)
11211         case "$drand48_r_proto" in
11212         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11213         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11214         esac
11215         case "$drand48_r_proto" in
11216         ''|0)   d_drand48_r=undef
11217                 drand48_r_proto=0
11218                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11219         * )     case "$drand48_r_proto" in
11220                 REENTRANT_PROTO*) ;;
11221                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11222                 esac
11223                 echo "Prototype: $try" ;;
11224         esac
11225         ;;
11226         *)      case "$usethreads" in
11227                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11228                 esac
11229                 d_drand48_r=undef
11230                 drand48_r_proto=0
11231                 ;;
11232         esac
11233         ;;
11234 *)      drand48_r_proto=0
11235         ;;
11236 esac
11237
11238 : see if prototype for drand48 is available
11239 echo " "
11240 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11241 eval $hasproto
11242
11243 : see if dup2 exists
11244 set dup2 d_dup2
11245 eval $inlibc
11246
11247 : see if eaccess exists
11248 set eaccess d_eaccess
11249 eval $inlibc
11250
11251 : see if endgrent exists
11252 set endgrent d_endgrent
11253 eval $inlibc
11254
11255 : see if this is an grp system
11256 set grp.h i_grp
11257 eval $inhdr
11258
11259 case "$i_grp" in
11260 $define)
11261         xxx=`./findhdr grp.h`
11262         $cppstdin $cppflags $cppminus < $xxx >$$.h
11263
11264         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11265                 val="$define"
11266         else
11267                 val="$undef"
11268         fi
11269         set d_grpasswd
11270         eval $setvar
11271
11272         $rm -f $$.h
11273         ;;
11274 *)
11275         val="$undef";
11276         set d_grpasswd; eval $setvar
11277         ;;
11278 esac
11279
11280 : see if endgrent_r exists
11281 set endgrent_r d_endgrent_r
11282 eval $inlibc
11283 case "$d_endgrent_r" in
11284 "$define")
11285         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11286         case "$d_endgrent_r_proto:$usethreads" in
11287         ":define")      d_endgrent_r_proto=define
11288                 set d_endgrent_r_proto endgrent_r $hdrs
11289                 eval $hasproto ;;
11290         *)      ;;
11291         esac
11292         case "$d_endgrent_r_proto" in
11293         define)
11294         case "$endgrent_r_proto" in
11295         ''|0) try='int endgrent_r(FILE**);'
11296         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11297         esac
11298         case "$endgrent_r_proto" in
11299         ''|0) try='void endgrent_r(FILE**);'
11300         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11301         esac
11302         case "$endgrent_r_proto" in
11303         ''|0)   d_endgrent_r=undef
11304                 endgrent_r_proto=0
11305                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11306         * )     case "$endgrent_r_proto" in
11307                 REENTRANT_PROTO*) ;;
11308                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11309                 esac
11310                 echo "Prototype: $try" ;;
11311         esac
11312         ;;
11313         *)      case "$usethreads" in
11314                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11315                 esac
11316                 d_endgrent_r=undef
11317                 endgrent_r_proto=0
11318                 ;;
11319         esac
11320         ;;
11321 *)      endgrent_r_proto=0
11322         ;;
11323 esac
11324
11325 : see if endhostent exists
11326 set endhostent d_endhent
11327 eval $inlibc
11328
11329 : see if this is a netdb.h system
11330 set netdb.h i_netdb
11331 eval $inhdr
11332
11333 : see if endhostent_r exists
11334 set endhostent_r d_endhostent_r
11335 eval $inlibc
11336 case "$d_endhostent_r" in
11337 "$define")
11338         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11339         case "$d_endhostent_r_proto:$usethreads" in
11340         ":define")      d_endhostent_r_proto=define
11341                 set d_endhostent_r_proto endhostent_r $hdrs
11342                 eval $hasproto ;;
11343         *)      ;;
11344         esac
11345         case "$d_endhostent_r_proto" in
11346         define)
11347         case "$endhostent_r_proto" in
11348         ''|0) try='int endhostent_r(struct hostent_data*);'
11349         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11350         esac
11351         case "$endhostent_r_proto" in
11352         ''|0) try='void endhostent_r(struct hostent_data*);'
11353         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11354         esac
11355         case "$endhostent_r_proto" in
11356         ''|0)   d_endhostent_r=undef
11357                 endhostent_r_proto=0
11358                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11359         * )     case "$endhostent_r_proto" in
11360                 REENTRANT_PROTO*) ;;
11361                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11362                 esac
11363                 echo "Prototype: $try" ;;
11364         esac
11365         ;;
11366         *)      case "$usethreads" in
11367                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11368                 esac
11369                 d_endhostent_r=undef
11370                 endhostent_r_proto=0
11371                 ;;
11372         esac
11373         ;;
11374 *)      endhostent_r_proto=0
11375         ;;
11376 esac
11377
11378 : see if endnetent exists
11379 set endnetent d_endnent
11380 eval $inlibc
11381
11382 : see if endnetent_r exists
11383 set endnetent_r d_endnetent_r
11384 eval $inlibc
11385 case "$d_endnetent_r" in
11386 "$define")
11387         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11388         case "$d_endnetent_r_proto:$usethreads" in
11389         ":define")      d_endnetent_r_proto=define
11390                 set d_endnetent_r_proto endnetent_r $hdrs
11391                 eval $hasproto ;;
11392         *)      ;;
11393         esac
11394         case "$d_endnetent_r_proto" in
11395         define)
11396         case "$endnetent_r_proto" in
11397         ''|0) try='int endnetent_r(struct netent_data*);'
11398         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11399         esac
11400         case "$endnetent_r_proto" in
11401         ''|0) try='void endnetent_r(struct netent_data*);'
11402         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11403         esac
11404         case "$endnetent_r_proto" in
11405         ''|0)   d_endnetent_r=undef
11406                 endnetent_r_proto=0
11407                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11408         * )     case "$endnetent_r_proto" in
11409                 REENTRANT_PROTO*) ;;
11410                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11411                 esac
11412                 echo "Prototype: $try" ;;
11413         esac
11414         ;;
11415         *)      case "$usethreads" in
11416                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11417                 esac
11418                 d_endnetent_r=undef
11419                 endnetent_r_proto=0
11420                 ;;
11421         esac
11422         ;;
11423 *)      endnetent_r_proto=0
11424         ;;
11425 esac
11426
11427 : see if endprotoent exists
11428 set endprotoent d_endpent
11429 eval $inlibc
11430
11431 : see if endprotoent_r exists
11432 set endprotoent_r d_endprotoent_r
11433 eval $inlibc
11434 case "$d_endprotoent_r" in
11435 "$define")
11436         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11437         case "$d_endprotoent_r_proto:$usethreads" in
11438         ":define")      d_endprotoent_r_proto=define
11439                 set d_endprotoent_r_proto endprotoent_r $hdrs
11440                 eval $hasproto ;;
11441         *)      ;;
11442         esac
11443         case "$d_endprotoent_r_proto" in
11444         define)
11445         case "$endprotoent_r_proto" in
11446         ''|0) try='int endprotoent_r(struct protoent_data*);'
11447         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11448         esac
11449         case "$endprotoent_r_proto" in
11450         ''|0) try='void endprotoent_r(struct protoent_data*);'
11451         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11452         esac
11453         case "$endprotoent_r_proto" in
11454         ''|0)   d_endprotoent_r=undef
11455                 endprotoent_r_proto=0
11456                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11457         * )     case "$endprotoent_r_proto" in
11458                 REENTRANT_PROTO*) ;;
11459                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11460                 esac
11461                 echo "Prototype: $try" ;;
11462         esac
11463         ;;
11464         *)      case "$usethreads" in
11465                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11466                 esac
11467                 d_endprotoent_r=undef
11468                 endprotoent_r_proto=0
11469                 ;;
11470         esac
11471         ;;
11472 *)      endprotoent_r_proto=0
11473         ;;
11474 esac
11475
11476 : see if endpwent exists
11477 set endpwent d_endpwent
11478 eval $inlibc
11479
11480 : see if this is a pwd.h system
11481 set pwd.h i_pwd
11482 eval $inhdr
11483
11484 case "$i_pwd" in
11485 $define)
11486         xxx=`./findhdr pwd.h`
11487         $cppstdin $cppflags $cppminus < $xxx >$$.h
11488
11489         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11490                 val="$define"
11491         else
11492                 val="$undef"
11493         fi
11494         set d_pwquota
11495         eval $setvar
11496
11497         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11498                 val="$define"
11499         else
11500                 val="$undef"
11501         fi
11502         set d_pwage
11503         eval $setvar
11504
11505         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11506                 val="$define"
11507         else
11508                 val="$undef"
11509         fi
11510         set d_pwchange
11511         eval $setvar
11512
11513         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11514                 val="$define"
11515         else
11516                 val="$undef"
11517         fi
11518         set d_pwclass
11519         eval $setvar
11520
11521         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11522                 val="$define"
11523         else
11524                 val="$undef"
11525         fi
11526         set d_pwexpire
11527         eval $setvar
11528
11529         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11530                 val="$define"
11531         else
11532                 val="$undef"
11533         fi
11534         set d_pwcomment
11535         eval $setvar
11536
11537         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11538                 val="$define"
11539         else
11540                 val="$undef"
11541         fi
11542         set d_pwgecos
11543         eval $setvar
11544
11545         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11546                 val="$define"
11547         else
11548                 val="$undef"
11549         fi
11550         set d_pwpasswd
11551         eval $setvar
11552
11553         $rm -f $$.h
11554         ;;
11555 *)
11556         val="$undef"; 
11557         set d_pwquota; eval $setvar
11558         set d_pwage; eval $setvar
11559         set d_pwchange; eval $setvar
11560         set d_pwclass; eval $setvar
11561         set d_pwexpire; eval $setvar
11562         set d_pwcomment; eval $setvar
11563         set d_pwgecos; eval $setvar
11564         set d_pwpasswd; eval $setvar
11565         ;;
11566 esac
11567
11568 : see if endpwent_r exists
11569 set endpwent_r d_endpwent_r
11570 eval $inlibc
11571 case "$d_endpwent_r" in
11572 "$define")
11573         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11574         case "$d_endpwent_r_proto:$usethreads" in
11575         ":define")      d_endpwent_r_proto=define
11576                 set d_endpwent_r_proto endpwent_r $hdrs
11577                 eval $hasproto ;;
11578         *)      ;;
11579         esac
11580         case "$d_endpwent_r_proto" in
11581         define)
11582         case "$endpwent_r_proto" in
11583         ''|0) try='int endpwent_r(FILE**);'
11584         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11585         esac
11586         case "$endpwent_r_proto" in
11587         ''|0) try='void endpwent_r(FILE**);'
11588         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11589         esac
11590         case "$endpwent_r_proto" in
11591         ''|0)   d_endpwent_r=undef
11592                 endpwent_r_proto=0
11593                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11594         * )     case "$endpwent_r_proto" in
11595                 REENTRANT_PROTO*) ;;
11596                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11597                 esac
11598                 echo "Prototype: $try" ;;
11599         esac
11600         ;;
11601         *)      case "$usethreads" in
11602                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11603                 esac
11604                 d_endpwent_r=undef
11605                 endpwent_r_proto=0
11606                 ;;
11607         esac
11608         ;;
11609 *)      endpwent_r_proto=0
11610         ;;
11611 esac
11612
11613 : see if endservent exists
11614 set endservent d_endsent
11615 eval $inlibc
11616
11617 : see if endservent_r exists
11618 set endservent_r d_endservent_r
11619 eval $inlibc
11620 case "$d_endservent_r" in
11621 "$define")
11622         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11623         case "$d_endservent_r_proto:$usethreads" in
11624         ":define")      d_endservent_r_proto=define
11625                 set d_endservent_r_proto endservent_r $hdrs
11626                 eval $hasproto ;;
11627         *)      ;;
11628         esac
11629         case "$d_endservent_r_proto" in
11630         define)
11631         case "$endservent_r_proto" in
11632         ''|0) try='int endservent_r(struct servent_data*);'
11633         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11634         esac
11635         case "$endservent_r_proto" in
11636         ''|0) try='void endservent_r(struct servent_data*);'
11637         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11638         esac
11639         case "$endservent_r_proto" in
11640         ''|0)   d_endservent_r=undef
11641                 endservent_r_proto=0
11642                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11643         * )     case "$endservent_r_proto" in
11644                 REENTRANT_PROTO*) ;;
11645                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11646                 esac
11647                 echo "Prototype: $try" ;;
11648         esac
11649         ;;
11650         *)      case "$usethreads" in
11651                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11652                 esac
11653                 d_endservent_r=undef
11654                 endservent_r_proto=0
11655                 ;;
11656         esac
11657         ;;
11658 *)      endservent_r_proto=0
11659         ;;
11660 esac
11661
11662 : Locate the flags for 'open()'
11663 echo " "
11664 $cat >try.c <<EOCP
11665 #include <sys/types.h>
11666 #ifdef I_FCNTL
11667 #include <fcntl.h>
11668 #endif
11669 #ifdef I_SYS_FILE
11670 #include <sys/file.h>
11671 #endif
11672 #$i_stdlib I_STDLIB
11673 #ifdef I_STDLIB
11674 #include <stdlib.h>
11675 #endif
11676 int main() {
11677         if(O_RDONLY);
11678 #ifdef O_TRUNC
11679         exit(0);
11680 #else
11681         exit(1);
11682 #endif
11683 }
11684 EOCP
11685 : check sys/file.h first to get FREAD on Sun
11686 if $test `./findhdr sys/file.h` && \
11687                 set try -DI_SYS_FILE && eval $compile; then
11688         h_sysfile=true;
11689         echo "<sys/file.h> defines the O_* constants..." >&4
11690         if $run ./try; then
11691                 echo "and you have the 3 argument form of open()." >&4
11692                 val="$define"
11693         else
11694                 echo "but not the 3 argument form of open().  Oh, well." >&4
11695                 val="$undef"
11696         fi
11697 elif $test `./findhdr fcntl.h` && \
11698                 set try -DI_FCNTL && eval $compile; then
11699         h_fcntl=true;
11700         echo "<fcntl.h> defines the O_* constants..." >&4
11701         if $run ./try; then
11702                 echo "and you have the 3 argument form of open()." >&4
11703                 val="$define"
11704         else
11705                 echo "but not the 3 argument form of open().  Oh, well." >&4
11706                 val="$undef"
11707         fi
11708 else
11709         val="$undef"
11710         echo "I can't find the O_* constant definitions!  You got problems." >&4
11711 fi
11712 set d_open3
11713 eval $setvar
11714 $rm -f try try.*
11715
11716 : see which of string.h or strings.h is needed
11717 echo " "
11718 strings=`./findhdr string.h`
11719 if $test "$strings" && $test -r "$strings"; then
11720         echo "Using <string.h> instead of <strings.h>." >&4
11721         val="$define"
11722 else
11723         val="$undef"
11724         strings=`./findhdr strings.h`
11725         if $test "$strings" && $test -r "$strings"; then
11726                 echo "Using <strings.h> instead of <string.h>." >&4
11727         else
11728                 echo "No string header found -- You'll surely have problems." >&4
11729         fi
11730 fi
11731 set i_string
11732 eval $setvar
11733 case "$i_string" in
11734 "$undef") strings=`./findhdr strings.h`;;
11735 *)        strings=`./findhdr string.h`;;
11736 esac
11737
11738 : see if this is a sys/file.h system
11739 val=''
11740 set sys/file.h val
11741 eval $inhdr
11742
11743 : do we need to include sys/file.h ?
11744 case "$val" in
11745 "$define")
11746         echo " "
11747         if $h_sysfile; then
11748                 val="$define"
11749                 echo "We'll be including <sys/file.h>." >&4
11750         else
11751                 val="$undef"
11752                 echo "We won't be including <sys/file.h>." >&4
11753         fi
11754         ;;
11755 *)
11756         h_sysfile=false
11757         ;;
11758 esac
11759 set i_sysfile
11760 eval $setvar
11761
11762 : see if fcntl.h is there
11763 val=''
11764 set fcntl.h val
11765 eval $inhdr
11766
11767 : see if we can include fcntl.h
11768 case "$val" in
11769 "$define")
11770         echo " "
11771         if $h_fcntl; then
11772                 val="$define"
11773                 echo "We'll be including <fcntl.h>." >&4
11774         else
11775                 val="$undef"
11776                 if $h_sysfile; then
11777         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11778                 else
11779                         echo "We won't be including <fcntl.h>." >&4
11780                 fi
11781         fi
11782         ;;
11783 *)
11784         h_fcntl=false
11785         val="$undef"
11786         ;;
11787 esac
11788 set i_fcntl
11789 eval $setvar
11790
11791 : check for non-blocking I/O stuff
11792 case "$h_sysfile" in
11793 true) echo "#include <sys/file.h>" > head.c;;
11794 *)
11795        case "$h_fcntl" in
11796        true) echo "#include <fcntl.h>" > head.c;;
11797        *) echo "#include <sys/fcntl.h>" > head.c;;
11798        esac
11799        ;;
11800 esac
11801 echo " "
11802 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11803 case "$o_nonblock" in
11804 '')
11805         $cat head.c > try.c
11806         $cat >>try.c <<EOCP
11807 #include <stdio.h>
11808 #$i_stdlib I_STDLIB
11809 #ifdef I_STDLIB
11810 #include <stdlib.h>
11811 #endif
11812 #$i_fcntl I_FCNTL
11813 #ifdef I_FCNTL
11814 #include <fcntl.h>
11815 #endif
11816 int main() {
11817 #ifdef O_NONBLOCK
11818         printf("O_NONBLOCK\n");
11819         exit(0);
11820 #endif
11821 #ifdef O_NDELAY
11822         printf("O_NDELAY\n");
11823         exit(0);
11824 #endif
11825 #ifdef FNDELAY
11826         printf("FNDELAY\n");
11827         exit(0);
11828 #endif
11829         exit(0);
11830 }
11831 EOCP
11832         set try
11833         if eval $compile_ok; then
11834                 o_nonblock=`$run ./try`
11835                 case "$o_nonblock" in
11836                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11837                 *) echo "Seems like we can use $o_nonblock.";;
11838                 esac
11839         else
11840                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11841         fi
11842         ;;
11843 *) echo "Using $hint value $o_nonblock.";;
11844 esac
11845 $rm -f try try.* .out core
11846
11847 echo " "
11848 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11849 case "$eagain" in
11850 '')
11851         $cat head.c > try.c
11852         $cat >>try.c <<EOCP
11853 #include <errno.h>
11854 #include <sys/types.h>
11855 #include <signal.h>
11856 #include <stdio.h> 
11857 #$i_stdlib I_STDLIB
11858 #ifdef I_STDLIB
11859 #include <stdlib.h>
11860 #endif
11861 #$i_fcntl I_FCNTL
11862 #ifdef I_FCNTL
11863 #include <fcntl.h>
11864 #endif
11865 #define MY_O_NONBLOCK $o_nonblock
11866 #ifndef errno  /* XXX need better Configure test */
11867 extern int errno;
11868 #endif
11869 #$i_unistd I_UNISTD
11870 #ifdef I_UNISTD
11871 #include <unistd.h>
11872 #endif
11873 #$i_string I_STRING
11874 #ifdef I_STRING
11875 #include <string.h>
11876 #else
11877 #include <strings.h>
11878 #endif
11879 $signal_t blech(x) int x; { exit(3); }
11880 EOCP
11881         $cat >> try.c <<'EOCP'
11882 int main()
11883 {
11884         int pd[2];
11885         int pu[2];
11886         char buf[1];
11887         char string[100];
11888
11889         pipe(pd);       /* Down: child -> parent */
11890         pipe(pu);       /* Up: parent -> child */
11891         if (0 != fork()) {
11892                 int ret;
11893                 close(pd[1]);   /* Parent reads from pd[0] */
11894                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11895 #ifdef F_SETFL
11896                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11897                         exit(1);
11898 #else
11899                 exit(4);
11900 #endif
11901                 signal(SIGALRM, blech);
11902                 alarm(5);
11903                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11904                         exit(2);
11905                 sprintf(string, "%d\n", ret);
11906                 write(2, string, strlen(string));
11907                 alarm(0);
11908 #ifdef EAGAIN
11909                 if (errno == EAGAIN) {
11910                         printf("EAGAIN\n");
11911                         goto ok;
11912                 }
11913 #endif
11914 #ifdef EWOULDBLOCK
11915                 if (errno == EWOULDBLOCK)
11916                         printf("EWOULDBLOCK\n");
11917 #endif
11918         ok:
11919                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11920                 sleep(2);                               /* Give it time to close our pipe */
11921                 alarm(5);
11922                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11923                 alarm(0);
11924                 sprintf(string, "%d\n", ret);
11925                 write(4, string, strlen(string));
11926                 exit(0);
11927         }
11928
11929         close(pd[0]);                   /* We write to pd[1] */
11930         close(pu[1]);                   /* We read from pu[0] */
11931         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11932         close(pd[1]);                   /* Pipe pd is now fully closed! */
11933         exit(0);                                /* Bye bye, thank you for playing! */
11934 }
11935 EOCP
11936         set try
11937         if eval $compile_ok; then
11938                 echo "$startsh" >mtry
11939                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11940                 chmod +x mtry
11941                 ./mtry >/dev/null 2>&1
11942                 case $? in
11943                 0) eagain=`$cat try.out`;;
11944                 1) echo "Could not perform non-blocking setting!";;
11945                 2) echo "I did a successful read() for something that was not there!";;
11946                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11947                 4) echo "Could not find F_SETFL!";;
11948                 *) echo "Something terribly wrong happened during testing.";;
11949                 esac
11950                 rd_nodata=`$cat try.ret`
11951                 echo "A read() system call with no data present returns $rd_nodata."
11952                 case "$rd_nodata" in
11953                 0|-1) ;;
11954                 *)
11955                         echo "(That's peculiar, fixing that to be -1.)"
11956                         rd_nodata=-1
11957                         ;;
11958                 esac
11959                 case "$eagain" in
11960                 '')
11961                         echo "Forcing errno EAGAIN on read() with no data available."
11962                         eagain=EAGAIN
11963                         ;;
11964                 *)
11965                         echo "Your read() sets errno to $eagain when no data is available."
11966                         ;;
11967                 esac
11968                 status=`$cat try.err`
11969                 case "$status" in
11970                 0) echo "And it correctly returns 0 to signal EOF.";;
11971                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11972                 *) echo "However, your read() returns '$status' on EOF??";;
11973                 esac
11974                 val="$define"
11975                 if test "$status" = "$rd_nodata"; then
11976                         echo "WARNING: you can't distinguish between EOF and no data!"
11977                         val="$undef"
11978                 fi
11979         else
11980                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11981                 eagain=EAGAIN
11982         fi
11983         set d_eofnblk
11984         eval $setvar
11985         ;;
11986 *)
11987         echo "Using $hint value $eagain."
11988         echo "Your read() returns $rd_nodata when no data is present."
11989         case "$d_eofnblk" in
11990         "$define") echo "And you can see EOF because read() returns 0.";;
11991         "$undef") echo "But you can't see EOF status from read() returned value.";;
11992         *)
11993                 echo "(Assuming you can't see EOF status from read anyway.)"
11994                 d_eofnblk=$undef
11995                 ;;
11996         esac
11997         ;;
11998 esac
11999 $rm -f try try.* .out core head.c mtry
12000
12001 : see if _ptr and _cnt from stdio act std
12002 echo " "
12003
12004 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12005         echo "(Looks like you have stdio.h from BSD.)"
12006         case "$stdio_ptr" in
12007         '') stdio_ptr='((fp)->_p)'
12008                 ptr_lval=$define
12009                 ;;
12010         *)      ptr_lval=$d_stdio_ptr_lval;;
12011         esac
12012         case "$stdio_cnt" in
12013         '') stdio_cnt='((fp)->_r)'
12014                 cnt_lval=$define
12015                 ;;
12016         *)      cnt_lval=$d_stdio_cnt_lval;;
12017         esac
12018         case "$stdio_base" in
12019         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12020         esac
12021         case "$stdio_bufsiz" in
12022         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12023         esac
12024 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12025         echo "(Looks like you have stdio.h from Linux.)"
12026         case "$stdio_ptr" in
12027         '') stdio_ptr='((fp)->_IO_read_ptr)'
12028                 ptr_lval=$define
12029                 ;;
12030         *)      ptr_lval=$d_stdio_ptr_lval;;
12031         esac
12032         case "$stdio_cnt" in
12033         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12034                 cnt_lval=$undef
12035                 ;;
12036         *)      cnt_lval=$d_stdio_cnt_lval;;
12037         esac
12038         case "$stdio_base" in
12039         '') stdio_base='((fp)->_IO_read_base)';;
12040         esac
12041         case "$stdio_bufsiz" in
12042         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12043         esac
12044 else
12045         case "$stdio_ptr" in
12046         '') stdio_ptr='((fp)->_ptr)'
12047                 ptr_lval=$define
12048                 ;;
12049         *)      ptr_lval=$d_stdio_ptr_lval;;
12050         esac
12051         case "$stdio_cnt" in
12052         '') stdio_cnt='((fp)->_cnt)'
12053                 cnt_lval=$define
12054                 ;;
12055         *)      cnt_lval=$d_stdio_cnt_lval;;
12056         esac
12057         case "$stdio_base" in
12058         '') stdio_base='((fp)->_base)';;
12059         esac
12060         case "$stdio_bufsiz" in
12061         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12062         esac
12063 fi
12064
12065 : test whether _ptr and _cnt really work
12066 echo "Checking how std your stdio is..." >&4
12067 $cat >try.c <<EOP
12068 #include <stdio.h>
12069 #$i_stdlib I_STDLIB
12070 #ifdef I_STDLIB
12071 #include <stdlib.h>
12072 #endif
12073 #define FILE_ptr(fp)    $stdio_ptr
12074 #define FILE_cnt(fp)    $stdio_cnt
12075 int main() {
12076         FILE *fp = fopen("try.c", "r");
12077         char c = getc(fp);
12078         if (
12079                 18 <= FILE_cnt(fp) &&
12080                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12081         )
12082                 exit(0);
12083         exit(1);
12084 }
12085 EOP
12086 val="$undef"
12087 set try
12088 if eval $compile && $to try.c; then
12089         if $run ./try; then
12090                 echo "Your stdio acts pretty std."
12091                 val="$define"
12092         else
12093                 echo "Your stdio isn't very std."
12094         fi
12095 else
12096         echo "Your stdio doesn't appear very std."
12097 fi
12098 $rm -f try.c try
12099
12100 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12101 # direct buffer manipulation no longer works.  The Configure tests
12102 # should be changed to correctly detect this, but until then,
12103 # the following check should at least let perl compile and run.
12104 # (This quick fix should be updated before 5.8.1.)
12105 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12106 # A. Dougherty, June 3, 2002.
12107 case "$d_gnulibc" in
12108 $define)
12109         case "$gnulibc_version" in
12110         2.[01]*)  ;;
12111         2.2) ;;
12112         2.2.[0-9]) ;;
12113         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12114                 val="$undef"
12115                 ;;
12116         esac
12117         ;;
12118 esac
12119 set d_stdstdio
12120 eval $setvar
12121
12122 : Can _ptr be used as an lvalue?
12123 case "$d_stdstdio$ptr_lval" in
12124 $define$define) val=$define ;;
12125 *) val=$undef ;;
12126 esac
12127 set d_stdio_ptr_lval
12128 eval $setvar
12129
12130 : Can _cnt be used as an lvalue?
12131 case "$d_stdstdio$cnt_lval" in
12132 $define$define) val=$define ;;
12133 *) val=$undef ;;
12134 esac
12135 set d_stdio_cnt_lval
12136 eval $setvar
12137
12138
12139 : test whether setting _ptr sets _cnt as a side effect
12140 d_stdio_ptr_lval_sets_cnt="$undef"
12141 d_stdio_ptr_lval_nochange_cnt="$undef"
12142 case "$d_stdio_ptr_lval$d_stdstdio" in
12143 $define$define)
12144         echo "Checking to see what happens if we set the stdio ptr..." >&4
12145 $cat >try.c <<EOP
12146 #include <stdio.h>
12147 /* Can we scream? */
12148 /* Eat dust sed :-) */
12149 /* In the buffer space, no one can hear you scream. */
12150 #$i_stdlib I_STDLIB
12151 #ifdef I_STDLIB
12152 #include <stdlib.h>
12153 #endif
12154 #define FILE_ptr(fp)    $stdio_ptr
12155 #define FILE_cnt(fp)    $stdio_cnt
12156 #include <sys/types.h>
12157 int main() {
12158         FILE *fp = fopen("try.c", "r");
12159         int c;
12160         char *ptr;
12161         size_t cnt;
12162         if (!fp) {
12163             puts("Fail even to read");
12164             exit(1);
12165         }
12166         c = getc(fp); /* Read away the first # */
12167         if (c == EOF) {
12168             puts("Fail even to read");
12169             exit(1);
12170         }
12171         if (!(
12172                 18 <= FILE_cnt(fp) &&
12173                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12174         )) {
12175                 puts("Fail even to read");
12176                 exit (1);
12177         }
12178         ptr = (char*) FILE_ptr(fp);
12179         cnt = (size_t)FILE_cnt(fp);
12180
12181         FILE_ptr(fp) += 42;
12182
12183         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12184                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12185                 exit (1);
12186         }
12187         if (FILE_cnt(fp) <= 20) {
12188                 printf ("Fail (<20 chars to test)");
12189                 exit (1);
12190         }
12191         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12192                 puts("Fail compare");
12193                 exit (1);
12194         }
12195         if (cnt == FILE_cnt(fp)) {
12196                 puts("Pass_unchanged");
12197                 exit (0);
12198         }       
12199         if (FILE_cnt(fp) == (cnt - 42)) {
12200                 puts("Pass_changed");
12201                 exit (0);
12202         }
12203         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12204         return 1;
12205
12206 }
12207 EOP
12208         set try
12209         if eval $compile && $to try.c; then
12210                 case `$run ./try` in
12211                 Pass_changed)
12212                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12213                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12214                 Pass_unchanged)
12215                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12216                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12217                 Fail*)
12218                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12219                 *)
12220                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12221         esac
12222         else
12223                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12224         fi
12225         $rm -f try.c try
12226         ;;
12227 esac
12228
12229 : see if _base is also standard
12230 val="$undef"
12231 case "$d_stdstdio" in
12232 $define)
12233         $cat >try.c <<EOP
12234 #include <stdio.h>
12235 #$i_stdlib I_STDLIB
12236 #ifdef I_STDLIB
12237 #include <stdlib.h>
12238 #endif
12239 #define FILE_base(fp)   $stdio_base
12240 #define FILE_bufsiz(fp) $stdio_bufsiz
12241 int main() {
12242         FILE *fp = fopen("try.c", "r");
12243         char c = getc(fp);
12244         if (
12245                 19 <= FILE_bufsiz(fp) &&
12246                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12247         )
12248                 exit(0);
12249         exit(1);
12250 }
12251 EOP
12252         set try
12253         if eval $compile && $to try.c; then
12254                 if $run ./try; then
12255                         echo "And its _base field acts std."
12256                         val="$define"
12257                 else
12258                         echo "But its _base field isn't std."
12259                 fi
12260         else
12261                 echo "However, it seems to be lacking the _base field."
12262         fi
12263         $rm -f try.c try
12264         ;;
12265 esac
12266 set d_stdiobase
12267 eval $setvar
12268
12269 : see if fast_stdio exists
12270 val="$undef"
12271 case "$d_stdstdio:$d_stdio_ptr_lval" in
12272 "$define:$define")
12273         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12274         *$define*)
12275                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12276                 val="$define"
12277                 ;;
12278         esac
12279         ;;
12280 esac
12281 set d_faststdio
12282 eval $setvar
12283
12284
12285
12286 : see if fchdir exists
12287 set fchdir d_fchdir
12288 eval $inlibc
12289
12290 : see if fchmod exists
12291 set fchmod d_fchmod
12292 eval $inlibc
12293
12294 : see if fchown exists
12295 set fchown d_fchown
12296 eval $inlibc
12297
12298 : see if this is an fcntl system
12299 set fcntl d_fcntl
12300 eval $inlibc
12301
12302 echo " "
12303 : See if fcntl-based locking works.
12304 $cat >try.c <<EOCP
12305 #$i_stdlib I_STDLIB
12306 #ifdef I_STDLIB
12307 #include <stdlib.h>
12308 #endif
12309 #include <unistd.h>
12310 #include <fcntl.h>
12311 #include <signal.h>
12312 $signal_t blech(x) int x; { exit(3); }
12313 int main() {
12314 #if defined(F_SETLK) && defined(F_SETLKW)
12315      struct flock flock;
12316      int retval, fd;
12317      fd = open("try.c", O_RDONLY);
12318      flock.l_type = F_RDLCK;
12319      flock.l_whence = SEEK_SET;
12320      flock.l_start = flock.l_len = 0;
12321      signal(SIGALRM, blech);
12322      alarm(10);
12323      retval = fcntl(fd, F_SETLK, &flock);
12324      close(fd);
12325      (retval < 0 ? exit(2) : exit(0));
12326 #else
12327      exit(2);
12328 #endif
12329 }
12330 EOCP
12331 echo "Checking if fcntl-based file locking works... "
12332 case "$d_fcntl" in
12333 "$define")
12334         set try
12335         if eval $compile_ok; then
12336                 if $run ./try; then
12337                         echo "Yes, it seems to work."
12338                         val="$define"
12339                 else
12340                         echo "Nope, it didn't work."
12341                         val="$undef"
12342                         case "$?" in
12343                         3) $cat >&4 <<EOM
12344 ***
12345 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12346 *** This is (almost) impossible.
12347 *** If your NFS lock daemons are not feeling well, something like
12348 *** this may happen, please investigate.  Cannot continue, aborting.
12349 ***
12350 EOM
12351                                 exit 1
12352                                 ;;
12353                         esac
12354                 fi
12355         else
12356                 echo "I'm unable to compile the test program, so I'll assume not."
12357                 val="$undef"
12358         fi
12359         ;;
12360 *) val="$undef";
12361         echo "Nope, since you don't even have fcntl()."
12362         ;;
12363 esac
12364 set d_fcntl_can_lock
12365 eval $setvar
12366 $rm -f try*
12367
12368
12369 : check for fd_set items
12370 $cat <<EOM
12371
12372 Checking to see how well your C compiler handles fd_set and friends ...
12373 EOM
12374 $cat >try.c <<EOCP
12375 #$i_stdlib I_STDLIB
12376 #ifdef I_STDLIB
12377 #include <stdlib.h>
12378 #endif
12379 #$i_systime I_SYS_TIME
12380 #$i_sysselct I_SYS_SELECT
12381 #$d_socket HAS_SOCKET
12382 #include <sys/types.h>
12383 #ifdef HAS_SOCKET
12384 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12385 #endif
12386 #ifdef I_SYS_TIME
12387 #include <sys/time.h>
12388 #endif
12389 #ifdef I_SYS_SELECT
12390 #include <sys/select.h>
12391 #endif
12392 int main() {
12393         fd_set fds;
12394
12395 #ifdef TRYBITS
12396         if(fds.fds_bits);
12397 #endif
12398
12399 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12400         exit(0);
12401 #else
12402         exit(1);
12403 #endif
12404 }
12405 EOCP
12406 set try -DTRYBITS
12407 if eval $compile; then
12408         d_fds_bits="$define"
12409         d_fd_set="$define"
12410         echo "Well, your system knows about the normal fd_set typedef..." >&4
12411         if $run ./try; then
12412                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12413                 d_fd_macros="$define"
12414         else
12415                 $cat >&4 <<'EOM'
12416 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12417 EOM
12418                 d_fd_macros="$undef"
12419         fi
12420 else
12421         $cat <<'EOM'
12422 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12423 EOM
12424         set try
12425         if eval $compile; then
12426                 d_fds_bits="$undef"
12427                 d_fd_set="$define"
12428                 echo "Well, your system has some sort of fd_set available..." >&4
12429                 if $run ./try; then
12430                         echo "and you have the normal fd_set macros." >&4
12431                         d_fd_macros="$define"
12432                 else
12433                         $cat <<'EOM'
12434 but not the normal fd_set macros!  Gross!  More work for me...
12435 EOM
12436                         d_fd_macros="$undef"
12437                 fi
12438         else
12439         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12440                 d_fd_set="$undef"
12441                 d_fds_bits="$undef"
12442                 d_fd_macros="$undef"
12443         fi
12444 fi
12445 $rm -f try try.*
12446
12447 : see if fgetpos exists
12448 set fgetpos d_fgetpos
12449 eval $inlibc
12450
12451 : see if finite exists
12452 set finite d_finite
12453 eval $inlibc
12454
12455 : see if finitel exists
12456 set finitel d_finitel
12457 eval $inlibc
12458
12459 : see if flock exists
12460 set flock d_flock
12461 eval $inlibc
12462
12463 : see if prototype for flock is available
12464 echo " "
12465 set d_flockproto flock $i_sysfile sys/file.h
12466 eval $hasproto
12467
12468 : see if fork exists
12469 set fork d_fork
12470 eval $inlibc
12471
12472 : see if fp_class exists
12473 set fp_class d_fp_class
12474 eval $inlibc
12475
12476 : see if pathconf exists
12477 set pathconf d_pathconf
12478 eval $inlibc
12479
12480 : see if fpathconf exists
12481 set fpathconf d_fpathconf
12482 eval $inlibc
12483
12484 : see if fpclass exists
12485 set fpclass d_fpclass
12486 eval $inlibc
12487
12488 : see if fpclassify exists
12489 set fpclassify d_fpclassify
12490 eval $inlibc
12491
12492 : see if fpclassl exists
12493 set fpclassl d_fpclassl
12494 eval $inlibc
12495
12496
12497 : check for fpos64_t
12498 echo " "
12499 echo "Checking to see if you have fpos64_t..." >&4
12500 $cat >try.c <<EOCP
12501 #include <stdio.h>
12502 int main() { fpos64_t x = 7; }
12503 EOCP
12504 set try
12505 if eval $compile; then
12506         val="$define"
12507         echo "You have fpos64_t."
12508 else
12509         val="$undef"
12510         echo "You do not have fpos64_t."
12511         case "$fpossize" in
12512         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12513         esac
12514 fi
12515 $rm -f try.* try
12516 set d_fpos64_t
12517 eval $setvar
12518
12519 : see if frexpl exists
12520 set frexpl d_frexpl
12521 eval $inlibc
12522
12523 : see if this is a sys/param system
12524 set sys/param.h i_sysparam
12525 eval $inhdr
12526
12527 : see if this is a sys/mount.h system
12528 set sys/mount.h i_sysmount
12529 eval $inhdr
12530
12531
12532 echo " "
12533 echo "Checking to see if your system supports struct fs_data..." >&4
12534 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12535 eval $hasstruct
12536 case "$d_fs_data_s" in
12537 "$define")      echo "Yes, it does."   ;;
12538 *)              echo "No, it doesn't." ;;
12539 esac
12540
12541 : see if fseeko exists
12542 set fseeko d_fseeko
12543 eval $inlibc
12544 case "$longsize" in
12545 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12546 esac
12547
12548 : see if fsetpos exists
12549 set fsetpos d_fsetpos
12550 eval $inlibc
12551
12552
12553 : see if fstatfs exists
12554 set fstatfs d_fstatfs
12555 eval $inlibc
12556
12557
12558 : see if statvfs exists
12559 set statvfs d_statvfs
12560 eval $inlibc
12561
12562 : see if fstatvfs exists
12563 set fstatvfs d_fstatvfs
12564 eval $inlibc
12565
12566
12567 : see if fsync exists
12568 set fsync d_fsync
12569 eval $inlibc
12570
12571 : see if ftello exists
12572 set ftello d_ftello
12573 eval $inlibc
12574 case "$longsize" in
12575 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12576 esac
12577
12578 d_futimes="$undef"
12579 : check for a working futimes
12580 echo " "
12581 echo "Checking for a working futimes()" >&4
12582 $cat >try.c <<EOCP
12583 #include <stdio.h>
12584 #include <sys/time.h>
12585 #include <errno.h>
12586 #include <fcntl.h>
12587
12588 int main ()
12589 {
12590     int fd, rv;
12591     fd = open ("try.c", O_RDWR);
12592     if (-1 == fd) exit (1);
12593     rv = futimes (fd, NULL);
12594     exit (rv == -1 ? errno : 0);
12595 }
12596 EOCP
12597 set try
12598 if eval $compile; then
12599     `$run ./try`
12600     rc=$?
12601     case "$rc" in
12602         0)  echo "Yes, it does" >&4
12603             d_futimes="$define"
12604             ;;
12605         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12606             ;;
12607     esac
12608 else
12609     echo "No, it does not (probably harmless)\n" >&4
12610 fi
12611 $rm -f try.* try core core.try.*
12612
12613 : see if getcwd exists
12614 set getcwd d_getcwd
12615 eval $inlibc
12616
12617 : see if getespwnam exists
12618 set getespwnam d_getespwnam
12619 eval $inlibc
12620
12621
12622 : see if getfsstat exists
12623 set getfsstat d_getfsstat
12624 eval $inlibc
12625
12626 : see if getgrent exists
12627 set getgrent d_getgrent
12628 eval $inlibc
12629
12630 : see if getgrent_r exists
12631 set getgrent_r d_getgrent_r
12632 eval $inlibc
12633 case "$d_getgrent_r" in
12634 "$define")
12635         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12636         case "$d_getgrent_r_proto:$usethreads" in
12637         ":define")      d_getgrent_r_proto=define
12638                 set d_getgrent_r_proto getgrent_r $hdrs
12639                 eval $hasproto ;;
12640         *)      ;;
12641         esac
12642         case "$d_getgrent_r_proto" in
12643         define)
12644         case "$getgrent_r_proto" in
12645         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12646         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12647         esac
12648         case "$getgrent_r_proto" in
12649         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12650         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12651         esac
12652         case "$getgrent_r_proto" in
12653         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12654         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12655         esac
12656         case "$getgrent_r_proto" in
12657         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12658         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12659         esac
12660         case "$getgrent_r_proto" in
12661         ''|0) try='int getgrent_r(struct group*, char*, int);'
12662         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12663         esac
12664         case "$getgrent_r_proto" in
12665         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12666         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12667         esac
12668         case "$getgrent_r_proto" in
12669         ''|0)   d_getgrent_r=undef
12670                 getgrent_r_proto=0
12671                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12672         * )     case "$getgrent_r_proto" in
12673                 REENTRANT_PROTO*) ;;
12674                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12675                 esac
12676                 echo "Prototype: $try" ;;
12677         esac
12678         ;;
12679         *)      case "$usethreads" in
12680                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12681                 esac
12682                 d_getgrent_r=undef
12683                 getgrent_r_proto=0
12684                 ;;
12685         esac
12686         ;;
12687 *)      getgrent_r_proto=0
12688         ;;
12689 esac
12690
12691 : see if getgrgid_r exists
12692 set getgrgid_r d_getgrgid_r
12693 eval $inlibc
12694 case "$d_getgrgid_r" in
12695 "$define")
12696         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12697         case "$d_getgrgid_r_proto:$usethreads" in
12698         ":define")      d_getgrgid_r_proto=define
12699                 set d_getgrgid_r_proto getgrgid_r $hdrs
12700                 eval $hasproto ;;
12701         *)      ;;
12702         esac
12703         case "$d_getgrgid_r_proto" in
12704         define)
12705         case "$getgrgid_r_proto" in
12706         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12707         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12708         esac
12709         case "$getgrgid_r_proto" in
12710         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12711         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12712         esac
12713         case "$getgrgid_r_proto" in
12714         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12715         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12716         esac
12717         case "$getgrgid_r_proto" in
12718         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12719         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12720         esac
12721         case "$getgrgid_r_proto" in
12722         ''|0)   d_getgrgid_r=undef
12723                 getgrgid_r_proto=0
12724                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12725         * )     case "$getgrgid_r_proto" in
12726                 REENTRANT_PROTO*) ;;
12727                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12728                 esac
12729                 echo "Prototype: $try" ;;
12730         esac
12731         ;;
12732         *)      case "$usethreads" in
12733                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12734                 esac
12735                 d_getgrgid_r=undef
12736                 getgrgid_r_proto=0
12737                 ;;
12738         esac
12739         ;;
12740 *)      getgrgid_r_proto=0
12741         ;;
12742 esac
12743
12744 : see if getgrnam_r exists
12745 set getgrnam_r d_getgrnam_r
12746 eval $inlibc
12747 case "$d_getgrnam_r" in
12748 "$define")
12749         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12750         case "$d_getgrnam_r_proto:$usethreads" in
12751         ":define")      d_getgrnam_r_proto=define
12752                 set d_getgrnam_r_proto getgrnam_r $hdrs
12753                 eval $hasproto ;;
12754         *)      ;;
12755         esac
12756         case "$d_getgrnam_r_proto" in
12757         define)
12758         case "$getgrnam_r_proto" in
12759         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12760         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12761         esac
12762         case "$getgrnam_r_proto" in
12763         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12764         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12765         esac
12766         case "$getgrnam_r_proto" in
12767         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12768         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12769         esac
12770         case "$getgrnam_r_proto" in
12771         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12772         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12773         esac
12774         case "$getgrnam_r_proto" in
12775         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12776         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12777         esac
12778         case "$getgrnam_r_proto" in
12779         ''|0)   d_getgrnam_r=undef
12780                 getgrnam_r_proto=0
12781                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12782         * )     case "$getgrnam_r_proto" in
12783                 REENTRANT_PROTO*) ;;
12784                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12785                 esac
12786                 echo "Prototype: $try" ;;
12787         esac
12788         ;;
12789         *)      case "$usethreads" in
12790                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12791                 esac
12792                 d_getgrnam_r=undef
12793                 getgrnam_r_proto=0
12794                 ;;
12795         esac
12796         ;;
12797 *)      getgrnam_r_proto=0
12798         ;;
12799 esac
12800
12801 : see if gethostbyaddr exists
12802 set gethostbyaddr d_gethbyaddr
12803 eval $inlibc
12804
12805 : see if gethostbyname exists
12806 set gethostbyname d_gethbyname
12807 eval $inlibc
12808
12809 : see if gethostent exists
12810 set gethostent d_gethent
12811 eval $inlibc
12812
12813 : see how we will look up host name
12814 echo " "
12815 call=''
12816 if set gethostname val -f d_gethname; eval $csym; $val; then
12817         echo 'gethostname() found.' >&4
12818         d_gethname="$define"
12819         call=gethostname
12820 fi
12821 if set uname val -f d_uname; eval $csym; $val; then
12822         if ./xenix; then
12823                 $cat <<'EOM'
12824 uname() was found, but you're running xenix, and older versions of xenix
12825 have a broken uname(). If you don't really know whether your xenix is old
12826 enough to have a broken system call, use the default answer.
12827
12828 EOM
12829                 dflt=y
12830                 case "$d_uname" in
12831                 "$define") dflt=n;;
12832                 esac
12833                 rp='Is your uname() broken?'
12834                 . ./myread
12835                 case "$ans" in
12836                 n*) d_uname="$define"; call=uname;;
12837                 esac
12838         else
12839                 echo 'uname() found.' >&4
12840                 d_uname="$define"
12841                 case "$call" in
12842                 '') call=uname ;;
12843                 esac
12844         fi
12845 fi
12846 case "$d_gethname" in
12847 '') d_gethname="$undef";;
12848 esac
12849 case "$d_uname" in
12850 '') d_uname="$undef";;
12851 esac
12852 case "$d_uname$d_gethname" in
12853 *define*)
12854         dflt=n
12855         cat <<EOM
12856  
12857 Every now and then someone has a $call() that lies about the hostname
12858 but can't be fixed for political or economic reasons.  If you wish, I can
12859 pretend $call() isn't there and maybe compute hostname at run-time
12860 thanks to the '$phostname' command.
12861
12862 EOM
12863         rp="Shall I ignore $call() from now on?"
12864         . ./myread
12865         case "$ans" in
12866         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12867         esac;;
12868 esac
12869 case "$phostname" in
12870 '') aphostname='';;
12871 *) case "$aphostname" in
12872         /*) ;;
12873         *) set X $phostname
12874                 shift
12875                 file=$1
12876                 shift
12877                 file=`./loc $file $file $pth`
12878                 aphostname=`echo $file $*`
12879                 ;;
12880         esac
12881         ;;
12882 esac
12883 case "$d_uname$d_gethname" in
12884 *define*) ;;
12885 *)
12886         case "$phostname" in
12887         '')
12888                 echo "There will be no way for $package to get your hostname." >&4;;
12889         *)
12890         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12891                 ;;
12892         esac;;
12893 esac
12894 case "$d_phostname" in
12895 '') d_phostname="$undef";;
12896 esac
12897
12898 : see if gethostbyaddr_r exists
12899 set gethostbyaddr_r d_gethostbyaddr_r
12900 eval $inlibc
12901 case "$d_gethostbyaddr_r" in
12902 "$define")
12903         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12904         case "$d_gethostbyaddr_r_proto:$usethreads" in
12905         ":define")      d_gethostbyaddr_r_proto=define
12906                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12907                 eval $hasproto ;;
12908         *)      ;;
12909         esac
12910         case "$d_gethostbyaddr_r_proto" in
12911         define)
12912         case "$gethostbyaddr_r_proto" in
12913         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12914         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12915         esac
12916         case "$gethostbyaddr_r_proto" in
12917         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12918         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12919         esac
12920         case "$gethostbyaddr_r_proto" in
12921         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12922         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12923         esac
12924         case "$gethostbyaddr_r_proto" in
12925         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12926         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12927         esac
12928         case "$gethostbyaddr_r_proto" in
12929         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12930         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12931         esac
12932         case "$gethostbyaddr_r_proto" in
12933         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12934         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12935         esac
12936         case "$gethostbyaddr_r_proto" in
12937         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12938         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12939         esac
12940         case "$gethostbyaddr_r_proto" in
12941         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12942         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12943         esac
12944         case "$gethostbyaddr_r_proto" in
12945         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12946         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12947         esac
12948         case "$gethostbyaddr_r_proto" in
12949         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12950         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12951         esac
12952         case "$gethostbyaddr_r_proto" in
12953         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12954         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12955         esac
12956         case "$gethostbyaddr_r_proto" in
12957         ''|0)   d_gethostbyaddr_r=undef
12958                 gethostbyaddr_r_proto=0
12959                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12960         * )     case "$gethostbyaddr_r_proto" in
12961                 REENTRANT_PROTO*) ;;
12962                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12963                 esac
12964                 echo "Prototype: $try" ;;
12965         esac
12966         ;;
12967         *)      case "$usethreads" in
12968                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12969                 esac
12970                 d_gethostbyaddr_r=undef
12971                 gethostbyaddr_r_proto=0
12972                 ;;
12973         esac
12974         ;;
12975 *)      gethostbyaddr_r_proto=0
12976         ;;
12977 esac
12978
12979 : see if gethostbyname_r exists
12980 set gethostbyname_r d_gethostbyname_r
12981 eval $inlibc
12982 case "$d_gethostbyname_r" in
12983 "$define")
12984         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12985         case "$d_gethostbyname_r_proto:$usethreads" in
12986         ":define")      d_gethostbyname_r_proto=define
12987                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12988                 eval $hasproto ;;
12989         *)      ;;
12990         esac
12991         case "$d_gethostbyname_r_proto" in
12992         define)
12993         case "$gethostbyname_r_proto" in
12994         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12995         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12996         esac
12997         case "$gethostbyname_r_proto" in
12998         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12999         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13000         esac
13001         case "$gethostbyname_r_proto" in
13002         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13003         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13004         esac
13005         case "$gethostbyname_r_proto" in
13006         ''|0)   d_gethostbyname_r=undef
13007                 gethostbyname_r_proto=0
13008                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13009         * )     case "$gethostbyname_r_proto" in
13010                 REENTRANT_PROTO*) ;;
13011                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13012                 esac
13013                 echo "Prototype: $try" ;;
13014         esac
13015         ;;
13016         *)      case "$usethreads" in
13017                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13018                 esac
13019                 d_gethostbyname_r=undef
13020                 gethostbyname_r_proto=0
13021                 ;;
13022         esac
13023         ;;
13024 *)      gethostbyname_r_proto=0
13025         ;;
13026 esac
13027
13028 : see if gethostent_r exists
13029 set gethostent_r d_gethostent_r
13030 eval $inlibc
13031 case "$d_gethostent_r" in
13032 "$define")
13033         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13034         case "$d_gethostent_r_proto:$usethreads" in
13035         ":define")      d_gethostent_r_proto=define
13036                 set d_gethostent_r_proto gethostent_r $hdrs
13037                 eval $hasproto ;;
13038         *)      ;;
13039         esac
13040         case "$d_gethostent_r_proto" in
13041         define)
13042         case "$gethostent_r_proto" in
13043         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13044         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13045         esac
13046         case "$gethostent_r_proto" in
13047         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13048         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13049         esac
13050         case "$gethostent_r_proto" in
13051         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13052         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13053         esac
13054         case "$gethostent_r_proto" in
13055         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13056         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13057         esac
13058         case "$gethostent_r_proto" in
13059         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13060         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13061         esac
13062         case "$gethostent_r_proto" in
13063         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13064         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13065         esac
13066         case "$gethostent_r_proto" in
13067         ''|0)   d_gethostent_r=undef
13068                 gethostent_r_proto=0
13069                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13070         * )     case "$gethostent_r_proto" in
13071                 REENTRANT_PROTO*) ;;
13072                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13073                 esac
13074                 echo "Prototype: $try" ;;
13075         esac
13076         ;;
13077         *)      case "$usethreads" in
13078                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13079                 esac
13080                 d_gethostent_r=undef
13081                 gethostent_r_proto=0
13082                 ;;
13083         esac
13084         ;;
13085 *)      gethostent_r_proto=0
13086         ;;
13087 esac
13088
13089 : see if prototypes for various gethostxxx netdb.h functions are available
13090 echo " "
13091 set d_gethostprotos gethostent $i_netdb netdb.h
13092 eval $hasproto
13093
13094 : see if getitimer exists
13095 set getitimer d_getitimer
13096 eval $inlibc
13097
13098 : see if getlogin exists
13099 set getlogin d_getlogin
13100 eval $inlibc
13101
13102 : see if getlogin_r exists
13103 set getlogin_r d_getlogin_r
13104 eval $inlibc
13105 case "$d_getlogin_r" in
13106 "$define")
13107         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13108         case "$d_getlogin_r_proto:$usethreads" in
13109         ":define")      d_getlogin_r_proto=define
13110                 set d_getlogin_r_proto getlogin_r $hdrs
13111                 eval $hasproto ;;
13112         *)      ;;
13113         esac
13114         case "$d_getlogin_r_proto" in
13115         define)
13116         case "$getlogin_r_proto" in
13117         ''|0) try='int getlogin_r(char*, size_t);'
13118         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13119         esac
13120         case "$getlogin_r_proto" in
13121         ''|0) try='int getlogin_r(char*, int);'
13122         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13123         esac
13124         case "$getlogin_r_proto" in
13125         ''|0) try='char* getlogin_r(char*, size_t);'
13126         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13127         esac
13128         case "$getlogin_r_proto" in
13129         ''|0) try='char* getlogin_r(char*, int);'
13130         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13131         esac
13132         case "$getlogin_r_proto" in
13133         ''|0)   d_getlogin_r=undef
13134                 getlogin_r_proto=0
13135                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13136         * )     case "$getlogin_r_proto" in
13137                 REENTRANT_PROTO*) ;;
13138                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13139                 esac
13140                 echo "Prototype: $try" ;;
13141         esac
13142         ;;
13143         *)      case "$usethreads" in
13144                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13145                 esac
13146                 d_getlogin_r=undef
13147                 getlogin_r_proto=0
13148                 ;;
13149         esac
13150         ;;
13151 *)      getlogin_r_proto=0
13152         ;;
13153 esac
13154
13155 : see if getmnt exists
13156 set getmnt d_getmnt
13157 eval $inlibc
13158
13159 : see if getmntent exists
13160 set getmntent d_getmntent
13161 eval $inlibc
13162
13163 : see if getnetbyaddr exists
13164 set getnetbyaddr d_getnbyaddr
13165 eval $inlibc
13166
13167 : see if getnetbyname exists
13168 set getnetbyname d_getnbyname
13169 eval $inlibc
13170
13171 : see if getnetent exists
13172 set getnetent d_getnent
13173 eval $inlibc
13174
13175 : see if getnetbyaddr_r exists
13176 set getnetbyaddr_r d_getnetbyaddr_r
13177 eval $inlibc
13178 case "$d_getnetbyaddr_r" in
13179 "$define")
13180         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13181         case "$d_getnetbyaddr_r_proto:$usethreads" in
13182         ":define")      d_getnetbyaddr_r_proto=define
13183                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13184                 eval $hasproto ;;
13185         *)      ;;
13186         esac
13187         case "$d_getnetbyaddr_r_proto" in
13188         define)
13189         case "$getnetbyaddr_r_proto" in
13190         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13191         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13192         esac
13193         case "$getnetbyaddr_r_proto" in
13194         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13195         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13196         esac
13197         case "$getnetbyaddr_r_proto" in
13198         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13199         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13200         esac
13201         case "$getnetbyaddr_r_proto" in
13202         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13203         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13204         esac
13205         case "$getnetbyaddr_r_proto" in
13206         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13207         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13208         esac
13209         case "$getnetbyaddr_r_proto" in
13210         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13211         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13212         esac
13213         case "$getnetbyaddr_r_proto" in
13214         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13215         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13216         esac
13217         case "$getnetbyaddr_r_proto" in
13218         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13219         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13220         esac
13221         case "$getnetbyaddr_r_proto" in
13222         ''|0)   d_getnetbyaddr_r=undef
13223                 getnetbyaddr_r_proto=0
13224                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13225         * )     case "$getnetbyaddr_r_proto" in
13226                 REENTRANT_PROTO*) ;;
13227                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13228                 esac
13229                 echo "Prototype: $try" ;;
13230         esac
13231         ;;
13232         *)      case "$usethreads" in
13233                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13234                 esac
13235                 d_getnetbyaddr_r=undef
13236                 getnetbyaddr_r_proto=0
13237                 ;;
13238         esac
13239         ;;
13240 *)      getnetbyaddr_r_proto=0
13241         ;;
13242 esac
13243
13244 : see if getnetbyname_r exists
13245 set getnetbyname_r d_getnetbyname_r
13246 eval $inlibc
13247 case "$d_getnetbyname_r" in
13248 "$define")
13249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13250         case "$d_getnetbyname_r_proto:$usethreads" in
13251         ":define")      d_getnetbyname_r_proto=define
13252                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13253                 eval $hasproto ;;
13254         *)      ;;
13255         esac
13256         case "$d_getnetbyname_r_proto" in
13257         define)
13258         case "$getnetbyname_r_proto" in
13259         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13260         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13261         esac
13262         case "$getnetbyname_r_proto" in
13263         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13264         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13265         esac
13266         case "$getnetbyname_r_proto" in
13267         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13268         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13269         esac
13270         case "$getnetbyname_r_proto" in
13271         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13272         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13273         esac
13274         case "$getnetbyname_r_proto" in
13275         ''|0)   d_getnetbyname_r=undef
13276                 getnetbyname_r_proto=0
13277                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13278         * )     case "$getnetbyname_r_proto" in
13279                 REENTRANT_PROTO*) ;;
13280                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13281                 esac
13282                 echo "Prototype: $try" ;;
13283         esac
13284         ;;
13285         *)      case "$usethreads" in
13286                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13287                 esac
13288                 d_getnetbyname_r=undef
13289                 getnetbyname_r_proto=0
13290                 ;;
13291         esac
13292         ;;
13293 *)      getnetbyname_r_proto=0
13294         ;;
13295 esac
13296
13297 : see if getnetent_r exists
13298 set getnetent_r d_getnetent_r
13299 eval $inlibc
13300 case "$d_getnetent_r" in
13301 "$define")
13302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13303         case "$d_getnetent_r_proto:$usethreads" in
13304         ":define")      d_getnetent_r_proto=define
13305                 set d_getnetent_r_proto getnetent_r $hdrs
13306                 eval $hasproto ;;
13307         *)      ;;
13308         esac
13309         case "$d_getnetent_r_proto" in
13310         define)
13311         case "$getnetent_r_proto" in
13312         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13313         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13314         esac
13315         case "$getnetent_r_proto" in
13316         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13317         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13318         esac
13319         case "$getnetent_r_proto" in
13320         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13321         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13322         esac
13323         case "$getnetent_r_proto" in
13324         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13325         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13326         esac
13327         case "$getnetent_r_proto" in
13328         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13329         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13330         esac
13331         case "$getnetent_r_proto" in
13332         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13333         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13334         esac
13335         case "$getnetent_r_proto" in
13336         ''|0)   d_getnetent_r=undef
13337                 getnetent_r_proto=0
13338                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13339         * )     case "$getnetent_r_proto" in
13340                 REENTRANT_PROTO*) ;;
13341                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13342                 esac
13343                 echo "Prototype: $try" ;;
13344         esac
13345         ;;
13346         *)      case "$usethreads" in
13347                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13348                 esac
13349                 d_getnetent_r=undef
13350                 getnetent_r_proto=0
13351                 ;;
13352         esac
13353         ;;
13354 *)      getnetent_r_proto=0
13355         ;;
13356 esac
13357
13358 : see if prototypes for various getnetxxx netdb.h functions are available
13359 echo " "
13360 set d_getnetprotos getnetent $i_netdb netdb.h
13361 eval $hasproto
13362
13363 : see if getpagesize exists
13364 set getpagesize d_getpagsz
13365 eval $inlibc
13366
13367
13368 : see if getprotobyname exists
13369 set getprotobyname d_getpbyname
13370 eval $inlibc
13371
13372 : see if getprotobynumber exists
13373 set getprotobynumber d_getpbynumber
13374 eval $inlibc
13375
13376 : see if getprotoent exists
13377 set getprotoent d_getpent
13378 eval $inlibc
13379
13380 : see if getpgid exists
13381 set getpgid d_getpgid
13382 eval $inlibc
13383
13384 : see if getpgrp2 exists
13385 set getpgrp2 d_getpgrp2
13386 eval $inlibc
13387
13388 : see if getppid exists
13389 set getppid d_getppid
13390 eval $inlibc
13391
13392 : see if getpriority exists
13393 set getpriority d_getprior
13394 eval $inlibc
13395
13396 : see if getprotobyname_r exists
13397 set getprotobyname_r d_getprotobyname_r
13398 eval $inlibc
13399 case "$d_getprotobyname_r" in
13400 "$define")
13401         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13402         case "$d_getprotobyname_r_proto:$usethreads" in
13403         ":define")      d_getprotobyname_r_proto=define
13404                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13405                 eval $hasproto ;;
13406         *)      ;;
13407         esac
13408         case "$d_getprotobyname_r_proto" in
13409         define)
13410         case "$getprotobyname_r_proto" in
13411         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13412         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13413         esac
13414         case "$getprotobyname_r_proto" in
13415         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13416         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13417         esac
13418         case "$getprotobyname_r_proto" in
13419         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13420         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13421         esac
13422         case "$getprotobyname_r_proto" in
13423         ''|0)   d_getprotobyname_r=undef
13424                 getprotobyname_r_proto=0
13425                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13426         * )     case "$getprotobyname_r_proto" in
13427                 REENTRANT_PROTO*) ;;
13428                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13429                 esac
13430                 echo "Prototype: $try" ;;
13431         esac
13432         ;;
13433         *)      case "$usethreads" in
13434                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13435                 esac
13436                 d_getprotobyname_r=undef
13437                 getprotobyname_r_proto=0
13438                 ;;
13439         esac
13440         ;;
13441 *)      getprotobyname_r_proto=0
13442         ;;
13443 esac
13444
13445 : see if getprotobynumber_r exists
13446 set getprotobynumber_r d_getprotobynumber_r
13447 eval $inlibc
13448 case "$d_getprotobynumber_r" in
13449 "$define")
13450         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13451         case "$d_getprotobynumber_r_proto:$usethreads" in
13452         ":define")      d_getprotobynumber_r_proto=define
13453                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13454                 eval $hasproto ;;
13455         *)      ;;
13456         esac
13457         case "$d_getprotobynumber_r_proto" in
13458         define)
13459         case "$getprotobynumber_r_proto" in
13460         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13461         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13462         esac
13463         case "$getprotobynumber_r_proto" in
13464         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13465         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13466         esac
13467         case "$getprotobynumber_r_proto" in
13468         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13469         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13470         esac
13471         case "$getprotobynumber_r_proto" in
13472         ''|0)   d_getprotobynumber_r=undef
13473                 getprotobynumber_r_proto=0
13474                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13475         * )     case "$getprotobynumber_r_proto" in
13476                 REENTRANT_PROTO*) ;;
13477                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13478                 esac
13479                 echo "Prototype: $try" ;;
13480         esac
13481         ;;
13482         *)      case "$usethreads" in
13483                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13484                 esac
13485                 d_getprotobynumber_r=undef
13486                 getprotobynumber_r_proto=0
13487                 ;;
13488         esac
13489         ;;
13490 *)      getprotobynumber_r_proto=0
13491         ;;
13492 esac
13493
13494 : see if getprotoent_r exists
13495 set getprotoent_r d_getprotoent_r
13496 eval $inlibc
13497 case "$d_getprotoent_r" in
13498 "$define")
13499         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13500         case "$d_getprotoent_r_proto:$usethreads" in
13501         ":define")      d_getprotoent_r_proto=define
13502                 set d_getprotoent_r_proto getprotoent_r $hdrs
13503                 eval $hasproto ;;
13504         *)      ;;
13505         esac
13506         case "$d_getprotoent_r_proto" in
13507         define)
13508         case "$getprotoent_r_proto" in
13509         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13510         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13511         esac
13512         case "$getprotoent_r_proto" in
13513         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13514         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13515         esac
13516         case "$getprotoent_r_proto" in
13517         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13518         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13519         esac
13520         case "$getprotoent_r_proto" in
13521         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13522         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13523         esac
13524         case "$getprotoent_r_proto" in
13525         ''|0)   d_getprotoent_r=undef
13526                 getprotoent_r_proto=0
13527                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13528         * )     case "$getprotoent_r_proto" in
13529                 REENTRANT_PROTO*) ;;
13530                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13531                 esac
13532                 echo "Prototype: $try" ;;
13533         esac
13534         ;;
13535         *)      case "$usethreads" in
13536                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13537                 esac
13538                 d_getprotoent_r=undef
13539                 getprotoent_r_proto=0
13540                 ;;
13541         esac
13542         ;;
13543 *)      getprotoent_r_proto=0
13544         ;;
13545 esac
13546
13547 : see if prototypes for various getprotoxxx netdb.h functions are available
13548 echo " "
13549 set d_getprotoprotos getprotoent $i_netdb netdb.h
13550 eval $hasproto
13551
13552 : see if getprpwnam exists
13553 set getprpwnam d_getprpwnam
13554 eval $inlibc
13555
13556 : see if getpwent exists
13557 set getpwent d_getpwent
13558 eval $inlibc
13559
13560 : see if getpwent_r exists
13561 set getpwent_r d_getpwent_r
13562 eval $inlibc
13563 case "$d_getpwent_r" in
13564 "$define")
13565         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13566         case "$d_getpwent_r_proto:$usethreads" in
13567         ":define")      d_getpwent_r_proto=define
13568                 set d_getpwent_r_proto getpwent_r $hdrs
13569                 eval $hasproto ;;
13570         *)      ;;
13571         esac
13572         case "$d_getpwent_r_proto" in
13573         define)
13574         case "$getpwent_r_proto" in
13575         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13576         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13577         esac
13578         case "$getpwent_r_proto" in
13579         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13580         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13581         esac
13582         case "$getpwent_r_proto" in
13583         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13584         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13585         esac
13586         case "$getpwent_r_proto" in
13587         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13588         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13589         esac
13590         case "$getpwent_r_proto" in
13591         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13592         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13593         esac
13594         case "$getpwent_r_proto" in
13595         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13596         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13597         esac
13598         case "$getpwent_r_proto" in
13599         ''|0)   d_getpwent_r=undef
13600                 getpwent_r_proto=0
13601                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13602         * )     case "$getpwent_r_proto" in
13603                 REENTRANT_PROTO*) ;;
13604                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13605                 esac
13606                 echo "Prototype: $try" ;;
13607         esac
13608         ;;
13609         *)      case "$usethreads" in
13610                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13611                 esac
13612                 d_getpwent_r=undef
13613                 getpwent_r_proto=0
13614                 ;;
13615         esac
13616         ;;
13617 *)      getpwent_r_proto=0
13618         ;;
13619 esac
13620
13621 : see if getpwnam_r exists
13622 set getpwnam_r d_getpwnam_r
13623 eval $inlibc
13624 case "$d_getpwnam_r" in
13625 "$define")
13626         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13627         case "$d_getpwnam_r_proto:$usethreads" in
13628         ":define")      d_getpwnam_r_proto=define
13629                 set d_getpwnam_r_proto getpwnam_r $hdrs
13630                 eval $hasproto ;;
13631         *)      ;;
13632         esac
13633         case "$d_getpwnam_r_proto" in
13634         define)
13635         case "$getpwnam_r_proto" in
13636         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13637         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13638         esac
13639         case "$getpwnam_r_proto" in
13640         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13641         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13642         esac
13643         case "$getpwnam_r_proto" in
13644         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13645         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13646         esac
13647         case "$getpwnam_r_proto" in
13648         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13649         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13650         esac
13651         case "$getpwnam_r_proto" in
13652         ''|0)   d_getpwnam_r=undef
13653                 getpwnam_r_proto=0
13654                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13655         * )     case "$getpwnam_r_proto" in
13656                 REENTRANT_PROTO*) ;;
13657                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13658                 esac
13659                 echo "Prototype: $try" ;;
13660         esac
13661         ;;
13662         *)      case "$usethreads" in
13663                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13664                 esac
13665                 d_getpwnam_r=undef
13666                 getpwnam_r_proto=0
13667                 ;;
13668         esac
13669         ;;
13670 *)      getpwnam_r_proto=0
13671         ;;
13672 esac
13673
13674 : see if getpwuid_r exists
13675 set getpwuid_r d_getpwuid_r
13676 eval $inlibc
13677 case "$d_getpwuid_r" in
13678 "$define")
13679         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13680         case "$d_getpwuid_r_proto:$usethreads" in
13681         ":define")      d_getpwuid_r_proto=define
13682                 set d_getpwuid_r_proto getpwuid_r $hdrs
13683                 eval $hasproto ;;
13684         *)      ;;
13685         esac
13686         case "$d_getpwuid_r_proto" in
13687         define)
13688         case "$getpwuid_r_proto" in
13689         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13690         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13691         esac
13692         case "$getpwuid_r_proto" in
13693         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13694         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13695         esac
13696         case "$getpwuid_r_proto" in
13697         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13698         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13699         esac
13700         case "$getpwuid_r_proto" in
13701         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13702         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13703         esac
13704         case "$getpwuid_r_proto" in
13705         ''|0)   d_getpwuid_r=undef
13706                 getpwuid_r_proto=0
13707                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13708         * )     case "$getpwuid_r_proto" in
13709                 REENTRANT_PROTO*) ;;
13710                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13711                 esac
13712                 echo "Prototype: $try" ;;
13713         esac
13714         ;;
13715         *)      case "$usethreads" in
13716                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13717                 esac
13718                 d_getpwuid_r=undef
13719                 getpwuid_r_proto=0
13720                 ;;
13721         esac
13722         ;;
13723 *)      getpwuid_r_proto=0
13724         ;;
13725 esac
13726
13727
13728 : see if getservbyname exists
13729 set getservbyname d_getsbyname
13730 eval $inlibc
13731
13732 : see if getservbyport exists
13733 set getservbyport d_getsbyport
13734 eval $inlibc
13735
13736 : see if getservent exists
13737 set getservent d_getsent
13738 eval $inlibc
13739
13740 : see if getservbyname_r exists
13741 set getservbyname_r d_getservbyname_r
13742 eval $inlibc
13743 case "$d_getservbyname_r" in
13744 "$define")
13745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13746         case "$d_getservbyname_r_proto:$usethreads" in
13747         ":define")      d_getservbyname_r_proto=define
13748                 set d_getservbyname_r_proto getservbyname_r $hdrs
13749                 eval $hasproto ;;
13750         *)      ;;
13751         esac
13752         case "$d_getservbyname_r_proto" in
13753         define)
13754         case "$getservbyname_r_proto" in
13755         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13756         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13757         esac
13758         case "$getservbyname_r_proto" in
13759         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13760         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13761         esac
13762         case "$getservbyname_r_proto" in
13763         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13764         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13765         esac
13766         case "$getservbyname_r_proto" in
13767         ''|0)   d_getservbyname_r=undef
13768                 getservbyname_r_proto=0
13769                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13770         * )     case "$getservbyname_r_proto" in
13771                 REENTRANT_PROTO*) ;;
13772                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13773                 esac
13774                 echo "Prototype: $try" ;;
13775         esac
13776         ;;
13777         *)      case "$usethreads" in
13778                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13779                 esac
13780                 d_getservbyname_r=undef
13781                 getservbyname_r_proto=0
13782                 ;;
13783         esac
13784         ;;
13785 *)      getservbyname_r_proto=0
13786         ;;
13787 esac
13788
13789 : see if getservbyport_r exists
13790 set getservbyport_r d_getservbyport_r
13791 eval $inlibc
13792 case "$d_getservbyport_r" in
13793 "$define")
13794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13795         case "$d_getservbyport_r_proto:$usethreads" in
13796         ":define")      d_getservbyport_r_proto=define
13797                 set d_getservbyport_r_proto getservbyport_r $hdrs
13798                 eval $hasproto ;;
13799         *)      ;;
13800         esac
13801         case "$d_getservbyport_r_proto" in
13802         define)
13803         case "$getservbyport_r_proto" in
13804         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13805         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13806         esac
13807         case "$getservbyport_r_proto" in
13808         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13809         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13810         esac
13811         case "$getservbyport_r_proto" in
13812         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13813         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13814         esac
13815         case "$getservbyport_r_proto" in
13816         ''|0)   d_getservbyport_r=undef
13817                 getservbyport_r_proto=0
13818                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13819         * )     case "$getservbyport_r_proto" in
13820                 REENTRANT_PROTO*) ;;
13821                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13822                 esac
13823                 echo "Prototype: $try" ;;
13824         esac
13825         ;;
13826         *)      case "$usethreads" in
13827                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13828                 esac
13829                 d_getservbyport_r=undef
13830                 getservbyport_r_proto=0
13831                 ;;
13832         esac
13833         ;;
13834 *)      getservbyport_r_proto=0
13835         ;;
13836 esac
13837
13838 : see if getservent_r exists
13839 set getservent_r d_getservent_r
13840 eval $inlibc
13841 case "$d_getservent_r" in
13842 "$define")
13843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13844         case "$d_getservent_r_proto:$usethreads" in
13845         ":define")      d_getservent_r_proto=define
13846                 set d_getservent_r_proto getservent_r $hdrs
13847                 eval $hasproto ;;
13848         *)      ;;
13849         esac
13850         case "$d_getservent_r_proto" in
13851         define)
13852         case "$getservent_r_proto" in
13853         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13854         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13855         esac
13856         case "$getservent_r_proto" in
13857         ''|0) try='int getservent_r(struct servent*, char*, int);'
13858         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13859         esac
13860         case "$getservent_r_proto" in
13861         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13862         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13863         esac
13864         case "$getservent_r_proto" in
13865         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13866         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13867         esac
13868         case "$getservent_r_proto" in
13869         ''|0)   d_getservent_r=undef
13870                 getservent_r_proto=0
13871                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13872         * )     case "$getservent_r_proto" in
13873                 REENTRANT_PROTO*) ;;
13874                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13875                 esac
13876                 echo "Prototype: $try" ;;
13877         esac
13878         ;;
13879         *)      case "$usethreads" in
13880                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13881                 esac
13882                 d_getservent_r=undef
13883                 getservent_r_proto=0
13884                 ;;
13885         esac
13886         ;;
13887 *)      getservent_r_proto=0
13888         ;;
13889 esac
13890
13891 : see if prototypes for various getservxxx netdb.h functions are available
13892 echo " "
13893 set d_getservprotos getservent $i_netdb netdb.h
13894 eval $hasproto
13895
13896 : see if getspnam exists
13897 set getspnam d_getspnam
13898 eval $inlibc
13899
13900 : see if this is a shadow.h system
13901 set shadow.h i_shadow
13902 eval $inhdr
13903
13904 : see if getspnam_r exists
13905 set getspnam_r d_getspnam_r
13906 eval $inlibc
13907 case "$d_getspnam_r" in
13908 "$define")
13909         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13910         case "$d_getspnam_r_proto:$usethreads" in
13911         ":define")      d_getspnam_r_proto=define
13912                 set d_getspnam_r_proto getspnam_r $hdrs
13913                 eval $hasproto ;;
13914         *)      ;;
13915         esac
13916         case "$d_getspnam_r_proto" in
13917         define)
13918         case "$getspnam_r_proto" in
13919         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13920         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13921         esac
13922         case "$getspnam_r_proto" in
13923         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13924         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13925         esac
13926         case "$getspnam_r_proto" in
13927         ''|0)   d_getspnam_r=undef
13928                 getspnam_r_proto=0
13929                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13930         * )     case "$getspnam_r_proto" in
13931                 REENTRANT_PROTO*) ;;
13932                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13933                 esac
13934                 echo "Prototype: $try" ;;
13935         esac
13936         ;;
13937         *)      case "$usethreads" in
13938                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13939                 esac
13940                 d_getspnam_r=undef
13941                 getspnam_r_proto=0
13942                 ;;
13943         esac
13944         ;;
13945 *)      getspnam_r_proto=0
13946         ;;
13947 esac
13948
13949 : see if gettimeofday or ftime exists
13950 set gettimeofday d_gettimeod
13951 eval $inlibc
13952 case "$d_gettimeod" in
13953 "$undef")
13954         set ftime d_ftime 
13955         eval $inlibc
13956         ;;
13957 *)
13958         val="$undef"; set d_ftime; eval $setvar
13959         ;;
13960 esac
13961 case "$d_gettimeod$d_ftime" in
13962 "$undef$undef")
13963         echo " "
13964         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13965         ;;
13966 esac
13967
13968 : see if gmtime_r exists
13969 set gmtime_r d_gmtime_r
13970 eval $inlibc
13971 case "$d_gmtime_r" in
13972 "$define")
13973         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13974         case "$d_gmtime_r_proto:$usethreads" in
13975         ":define")      d_gmtime_r_proto=define
13976                 set d_gmtime_r_proto gmtime_r $hdrs
13977                 eval $hasproto ;;
13978         *)      ;;
13979         esac
13980         case "$d_gmtime_r_proto" in
13981         define)
13982         case "$gmtime_r_proto" in
13983         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13984         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13985         esac
13986         case "$gmtime_r_proto" in
13987         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13988         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13989         esac
13990         case "$gmtime_r_proto" in
13991         ''|0)   d_gmtime_r=undef
13992                 gmtime_r_proto=0
13993                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13994         * )     case "$gmtime_r_proto" in
13995                 REENTRANT_PROTO*) ;;
13996                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13997                 esac
13998                 echo "Prototype: $try" ;;
13999         esac
14000         ;;
14001         *)      case "$usethreads" in
14002                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14003                 esac
14004                 d_gmtime_r=undef
14005                 gmtime_r_proto=0
14006                 ;;
14007         esac
14008         ;;
14009 *)      gmtime_r_proto=0
14010         ;;
14011 esac
14012
14013 : see if hasmntopt exists
14014 set hasmntopt d_hasmntopt
14015 eval $inlibc
14016
14017 : see if this is a netinet/in.h or sys/in.h system
14018 set netinet/in.h i_niin sys/in.h i_sysin
14019 eval $inhdr
14020
14021 : see if arpa/inet.h has to be included
14022 set arpa/inet.h i_arpainet
14023 eval $inhdr
14024
14025 : see if htonl --and friends-- exists
14026 val=''
14027 set htonl val
14028 eval $inlibc
14029
14030 : Maybe they are macros.
14031 case "$val" in
14032 $undef)
14033         $cat >htonl.c <<EOM
14034 #include <stdio.h>
14035 #include <sys/types.h>
14036 #$i_niin I_NETINET_IN
14037 #$i_sysin I_SYS_IN
14038 #$i_arpainet I_ARPA_INET
14039 #ifdef I_NETINET_IN
14040 #include <netinet/in.h>
14041 #endif
14042 #ifdef I_SYS_IN
14043 #include <sys/in.h>
14044 #endif
14045 #ifdef I_ARPA_INET
14046 #include <arpa/inet.h>
14047 #endif
14048 #ifdef htonl
14049 printf("Defined as a macro.");
14050 #endif
14051 EOM
14052         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14053         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14054                 val="$define"
14055                 echo "But it seems to be defined as a macro." >&4
14056         fi
14057         $rm -f htonl.?
14058         ;;
14059 esac
14060 set d_htonl
14061 eval $setvar
14062
14063 : see if ilogbl exists
14064 set ilogbl d_ilogbl
14065 eval $inlibc
14066
14067 : index or strchr
14068 echo " "
14069 if set index val -f; eval $csym; $val; then
14070         if set strchr val -f d_strchr; eval $csym; $val; then
14071                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14072                         val="$define"
14073                         vali="$undef"
14074                         echo "strchr() found." >&4
14075                 else
14076                         val="$undef"
14077                         vali="$define"
14078                         echo "index() found." >&4
14079                 fi
14080         else
14081                 val="$undef"
14082                 vali="$define"
14083                 echo "index() found." >&4
14084         fi
14085 else
14086         if set strchr val -f d_strchr; eval $csym; $val; then
14087                 val="$define"
14088                 vali="$undef"
14089                 echo "strchr() found." >&4
14090         else
14091                 echo "No index() or strchr() found!" >&4
14092                 val="$undef"
14093                 vali="$undef"
14094         fi
14095 fi
14096 set d_strchr; eval $setvar
14097 val="$vali"
14098 set d_index; eval $setvar
14099
14100 : check whether inet_aton exists
14101 set inet_aton d_inetaton
14102 eval $inlibc
14103
14104 : Look for isascii
14105 echo " "
14106 $cat >isascii.c <<EOCP
14107 #include <stdio.h>
14108 #include <ctype.h>
14109 #$i_stdlib I_STDLIB
14110 #ifdef I_STDLIB
14111 #include <stdlib.h>
14112 #endif
14113 int main() {
14114         int c = 'A';
14115         if (isascii(c))
14116                 exit(0);
14117         else
14118                 exit(1);
14119 }
14120 EOCP
14121 set isascii
14122 if eval $compile; then
14123         echo "isascii() found." >&4
14124         val="$define"
14125 else
14126         echo "isascii() NOT found." >&4
14127         val="$undef"
14128 fi
14129 set d_isascii
14130 eval $setvar
14131 $rm -f isascii*
14132
14133 : see if isfinite exists
14134 set isfinite d_isfinite
14135 eval $inlibc
14136
14137 : see if isinf exists
14138 set isinf d_isinf
14139 eval $inlibc
14140
14141 : see if isnan exists
14142 set isnan d_isnan
14143 eval $inlibc
14144
14145 : see if isnanl exists
14146 set isnanl d_isnanl
14147 eval $inlibc
14148
14149 : see if killpg exists
14150 set killpg d_killpg
14151 eval $inlibc
14152
14153 : see if lchown exists
14154 echo " "
14155 $cat > try.c <<'EOCP'
14156 /* System header to define __stub macros and hopefully few prototypes,
14157     which can conflict with char lchown(); below.  */
14158 #include <assert.h>
14159 /* Override any gcc2 internal prototype to avoid an error.  */
14160 /* We use char because int might match the return type of a gcc2
14161    builtin and then its argument prototype would still apply.  */
14162 char lchown();
14163 int main() {
14164     /*  The GNU C library defines this for functions which it implements
14165         to always fail with ENOSYS.  Some functions are actually named
14166         something starting with __ and the normal name is an alias.  */
14167 #if defined (__stub_lchown) || defined (__stub___lchown)
14168 choke me
14169 #else
14170 lchown();
14171 #endif
14172 ; return 0; }
14173 EOCP
14174 set try
14175 if eval $compile; then
14176     $echo "lchown() found." >&4
14177     val="$define"
14178 else
14179     $echo "lchown() NOT found." >&4
14180     val="$undef"
14181 fi
14182 set d_lchown
14183 eval $setvar
14184
14185 : See if number of significant digits in a double precision number is known
14186 echo " "
14187 $cat >ldbl_dig.c <<EOM
14188 #$i_limits I_LIMITS
14189 #$i_float I_FLOAT
14190 #ifdef I_LIMITS
14191 #include <limits.h>
14192 #endif
14193 #ifdef I_FLOAT
14194 #include <float.h>
14195 #endif
14196 #ifdef LDBL_DIG
14197 printf("Contains LDBL_DIG");
14198 #endif
14199 EOM
14200 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14201 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14202         echo "LDBL_DIG found." >&4
14203         val="$define"
14204 else
14205         echo "LDBL_DIG NOT found." >&4
14206         val="$undef"
14207 fi
14208 $rm -f ldbl_dig.?
14209 set d_ldbl_dig
14210 eval $setvar
14211
14212 : see if this is a math.h system
14213 set math.h i_math
14214 eval $inhdr
14215
14216 d_libm_lib_version="$undef"
14217 case $i_math in
14218     $define)
14219         : check to see if math.h defines _LIB_VERSION
14220         echo " "
14221         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14222         $cat >try.c <<EOCP
14223 #include <unistd.h>
14224 #include <math.h>
14225 int main (int argc, char *argv[])
14226 {
14227     printf ("%d\n", _LIB_VERSION);
14228     return (0);
14229     } /* main */
14230 EOCP
14231         set try
14232         if eval $compile; then
14233             foo=`$run ./try`
14234             echo "Yes, it does ($foo)" >&4
14235             d_libm_lib_version="$define"
14236         else
14237             echo "No, it does not (probably harmless)\n" >&4
14238             fi
14239         $rm -f try.* try core core.try.*
14240         ;;
14241
14242     esac
14243
14244 : see if link exists
14245 set link d_link
14246 eval $inlibc
14247
14248 : see if localtime_r exists
14249 set localtime_r d_localtime_r
14250 eval $inlibc
14251 case "$d_localtime_r" in
14252 "$define")
14253         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14254         case "$d_localtime_r_proto:$usethreads" in
14255         ":define")      d_localtime_r_proto=define
14256                 set d_localtime_r_proto localtime_r $hdrs
14257                 eval $hasproto ;;
14258         *)      ;;
14259         esac
14260         case "$d_localtime_r_proto" in
14261         define)
14262         case "$localtime_r_proto" in
14263         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14264         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14265         esac
14266         case "$localtime_r_proto" in
14267         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14268         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14269         esac
14270         case "$localtime_r_proto" in
14271         ''|0)   d_localtime_r=undef
14272                 localtime_r_proto=0
14273                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14274         * )     case "$localtime_r_proto" in
14275                 REENTRANT_PROTO*) ;;
14276                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14277                 esac
14278                 echo "Prototype: $try" ;;
14279         esac
14280         ;;
14281         *)      case "$usethreads" in
14282                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14283                 esac
14284                 d_localtime_r=undef
14285                 localtime_r_proto=0
14286                 ;;
14287         esac
14288         ;;
14289 *)      localtime_r_proto=0
14290         ;;
14291 esac
14292
14293 : see if localeconv exists
14294 set localeconv d_locconv
14295 eval $inlibc
14296
14297 : see if lockf exists
14298 set lockf d_lockf
14299 eval $inlibc
14300
14301 : see if prototype for lseek is available
14302 echo " "
14303 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14304 eval $hasproto
14305
14306 : see if lstat exists
14307 set lstat d_lstat
14308 eval $inlibc
14309
14310 : see if madvise exists
14311 set madvise d_madvise
14312 eval $inlibc
14313
14314 : see if malloc_size exists
14315 set malloc_size d_malloc_size
14316 eval $inlibc
14317
14318 : see if malloc_size_good exists
14319 set malloc_good_size d_malloc_good_size
14320 eval $inlibc
14321
14322 : see if mblen exists
14323 set mblen d_mblen
14324 eval $inlibc
14325
14326 : see if mbstowcs exists
14327 set mbstowcs d_mbstowcs
14328 eval $inlibc
14329
14330 : see if mbtowc exists
14331 set mbtowc d_mbtowc
14332 eval $inlibc
14333
14334 : see if memchr exists
14335 set memchr d_memchr
14336 eval $inlibc
14337
14338 : see if memcmp exists
14339 set memcmp d_memcmp
14340 eval $inlibc
14341
14342 : see if memcpy exists
14343 set memcpy d_memcpy
14344 eval $inlibc
14345
14346 : see if memmove exists
14347 set memmove d_memmove
14348 eval $inlibc
14349
14350 : see if memset exists
14351 set memset d_memset
14352 eval $inlibc
14353
14354 : see if mkdir exists
14355 set mkdir d_mkdir
14356 eval $inlibc
14357
14358 : see if mkdtemp exists
14359 set mkdtemp d_mkdtemp
14360 eval $inlibc
14361
14362 : see if mkfifo exists
14363 set mkfifo d_mkfifo
14364 eval $inlibc
14365
14366 : see if mkstemp exists
14367 set mkstemp d_mkstemp
14368 eval $inlibc
14369
14370 : see if mkstemps exists
14371 set mkstemps d_mkstemps
14372 eval $inlibc
14373
14374 : see if mktime exists
14375 set mktime d_mktime
14376 eval $inlibc
14377
14378 : see if this is a sys/mman.h system
14379 set sys/mman.h i_sysmman
14380 eval $inhdr
14381
14382 : see if mmap exists
14383 set mmap d_mmap
14384 eval $inlibc
14385 : see what shmat returns
14386 : default to something harmless
14387 mmaptype='void *'
14388 case "$i_sysmman$d_mmap" in
14389 "$define$define")
14390         $cat >mmap.c <<'END'
14391 #include <sys/mman.h>
14392 void *mmap();
14393 END
14394         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14395                 mmaptype='void *'
14396         else
14397                 mmaptype='caddr_t'
14398         fi
14399         echo "and it returns ($mmaptype)." >&4
14400         ;;
14401 esac
14402
14403
14404
14405 : see if sqrtl exists
14406 set sqrtl d_sqrtl
14407 eval $inlibc
14408
14409 : see if scalbnl exists
14410 set scalbnl d_scalbnl
14411 eval $inlibc
14412
14413 : see if modfl exists
14414 set modfl d_modfl
14415 eval $inlibc
14416
14417 : see if prototype for modfl is available
14418 echo " "
14419 set d_modflproto modfl $i_math math.h
14420 eval $hasproto
14421
14422 d_modfl_pow32_bug="$undef"
14423
14424 case "$d_longdbl$d_modfl" in
14425 $define$define)
14426         $cat <<EOM
14427 Checking to see whether your modfl() is okay for large values...
14428 EOM
14429 $cat >try.c <<EOCP
14430 #include <math.h> 
14431 #include <stdio.h>
14432 EOCP
14433 if $test "X$d_modflproto" != "X$define"; then
14434         $cat >>try.c <<EOCP
14435 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14436 long double modfl (long double, long double *);
14437 EOCP
14438 fi
14439 $cat >>try.c <<EOCP
14440 int main() {
14441     long double nv = 4294967303.15;
14442     long double v, w;
14443     v = modfl(nv, &w);         
14444 #ifdef __GLIBC__
14445     printf("glibc");
14446 #endif
14447     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14448     return 0;
14449 }
14450 EOCP
14451         case "$osname:$gccversion" in
14452         aix:)   saveccflags="$ccflags"
14453                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14454         esac
14455         set try
14456         if eval $compile; then
14457                 foo=`$run ./try`
14458                 case "$foo" in
14459                 *" 4294967303.150000 1.150000 4294967302.000000")
14460                         echo >&4 "Your modfl() is broken for large values."
14461                         d_modfl_pow32_bug="$define"
14462                         case "$foo" in
14463                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14464                         ;;
14465                         esac
14466                         ;;
14467                 *" 4294967303.150000 0.150000 4294967303.000000")
14468                         echo >&4 "Your modfl() seems okay for large values."
14469                         ;;
14470                 *)      echo >&4 "I don't understand your modfl() at all."
14471                         d_modfl="$undef"
14472                         ;;
14473                 esac
14474                 $rm -f try.* try core core.try.*
14475         else
14476                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14477                 d_modfl="$undef"
14478         fi
14479         case "$osname:$gccversion" in
14480         aix:)   ccflags="$saveccflags" ;; # restore
14481         esac
14482         ;;
14483 esac
14484
14485 if $test "$uselongdouble" = "$define"; then
14486     message=""
14487     if $test "$d_sqrtl" != "$define"; then
14488         message="$message sqrtl"
14489     fi
14490     if $test "$d_modfl" != "$define"; then
14491         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14492             echo "You have both aintl and copysignl, so I can emulate modfl."
14493         else
14494             message="$message modfl"
14495         fi
14496     fi
14497     if $test "$d_frexpl" != "$define"; then
14498         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14499             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14500         else
14501             message="$message frexpl"
14502         fi
14503     fi
14504
14505     if $test "$message" != ""; then
14506         $cat <<EOM >&4
14507
14508 *** You requested the use of long doubles but you do not seem to have
14509 *** the following mathematical functions needed for long double support:
14510 ***    $message
14511 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14512 *** Cannot continue, aborting.
14513
14514 EOM
14515
14516         exit 1
14517     fi
14518 fi
14519
14520 : see if mprotect exists
14521 set mprotect d_mprotect
14522 eval $inlibc
14523
14524 : see if msgctl exists
14525 set msgctl d_msgctl
14526 eval $inlibc
14527
14528 : see if msgget exists
14529 set msgget d_msgget
14530 eval $inlibc
14531
14532 : see if msgsnd exists
14533 set msgsnd d_msgsnd
14534 eval $inlibc
14535
14536 : see if msgrcv exists
14537 set msgrcv d_msgrcv
14538 eval $inlibc
14539
14540 : see how much of the 'msg*(2)' library is present.
14541 h_msg=true
14542 echo " "
14543 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14544 *"$undef"*) h_msg=false;;
14545 esac
14546 case "$osname" in
14547 freebsd)
14548     case "`ipcs 2>&1`" in
14549     "SVID messages"*"not configured"*)
14550         echo "Your $osname does not have the msg*(2) configured." >&4
14551         h_msg=false
14552         val="$undef"
14553         set msgctl d_msgctl
14554         eval $setvar
14555         set msgget d_msgget
14556         eval $setvar
14557         set msgsnd d_msgsnd
14558         eval $setvar
14559         set msgrcv d_msgrcv
14560         eval $setvar
14561         ;;
14562     esac
14563     ;;
14564 esac
14565 : we could also check for sys/ipc.h ...
14566 if $h_msg && $test `./findhdr sys/msg.h`; then
14567         echo "You have the full msg*(2) library." >&4
14568         val="$define"
14569 else
14570         echo "You don't have the full msg*(2) library." >&4
14571         val="$undef"
14572 fi
14573 set d_msg
14574 eval $setvar
14575
14576
14577 echo " "
14578 echo "Checking to see if your system supports struct msghdr..." >&4
14579 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14580 eval $hasstruct
14581 case "$d_msghdr_s" in
14582 "$define")      echo "Yes, it does."   ;;
14583 *)              echo "No, it doesn't." ;;
14584 esac
14585
14586
14587 : see if msync exists
14588 set msync d_msync
14589 eval $inlibc
14590
14591 : see if munmap exists
14592 set munmap d_munmap
14593 eval $inlibc
14594
14595 : see if nice exists
14596 set nice d_nice
14597 eval $inlibc
14598
14599 : see if this is a langinfo.h system
14600 set langinfo.h i_langinfo
14601 eval $inhdr
14602
14603 : see if nl_langinfo exists
14604 set nl_langinfo d_nl_langinfo
14605 eval $inlibc
14606
14607 : check for length of character
14608 echo " "
14609 case "$charsize" in
14610 '')
14611         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14612         $cat >try.c <<EOCP
14613 #include <stdio.h>
14614 #$i_stdlib I_STDLIB
14615 #ifdef I_STDLIB
14616 #include <stdlib.h>
14617 #endif
14618 int main()
14619 {
14620     printf("%d\n", (int)sizeof(char));
14621     exit(0);
14622 }
14623 EOCP
14624         set try
14625         if eval $compile_ok; then
14626                 dflt=`$run ./try`
14627         else
14628                 dflt='1'
14629                 echo "(I can't seem to compile the test program.  Guessing...)"
14630         fi
14631         ;;
14632 *)
14633         dflt="$charsize"
14634         ;;
14635 esac
14636 rp="What is the size of a character (in bytes)?"
14637 . ./myread
14638 charsize="$ans"
14639 $rm -f try.c try
14640
14641 : check for volatile keyword
14642 echo " "
14643 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14644 $cat >try.c <<'EOCP'
14645 int main()
14646 {
14647         typedef struct _goo_struct goo_struct;
14648         goo_struct * volatile goo = ((goo_struct *)0);
14649         struct _goo_struct {
14650                 long long_int;
14651                 int reg_int;
14652                 char char_var;
14653         };
14654         typedef unsigned short foo_t;
14655         char *volatile foo;
14656         volatile int bar;
14657         volatile foo_t blech;
14658         foo = foo;
14659 }
14660 EOCP
14661 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14662         val="$define"
14663         echo "Yup, it does."
14664 else
14665         val="$undef"
14666         echo "Nope, it doesn't."
14667 fi
14668 set d_volatile
14669 eval $setvar
14670 $rm -f try.*
14671
14672
14673 echo " "
14674 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14675
14676 case "$use64bitint:$d_quad:$quadtype" in
14677 define:define:?*)
14678         ivtype="$quadtype"
14679         uvtype="$uquadtype"
14680         ivsize=8
14681         uvsize=8
14682         ;;
14683 *)      ivtype="long"
14684         uvtype="unsigned long"
14685         ivsize=$longsize
14686         uvsize=$longsize
14687         ;;
14688 esac
14689
14690 case "$uselongdouble:$d_longdbl" in
14691 define:define)
14692         nvtype="long double"
14693         nvsize=$longdblsize
14694         ;;
14695 *)      nvtype=double
14696         nvsize=$doublesize
14697         ;;
14698 esac
14699
14700 $echo "(IV will be "$ivtype", $ivsize bytes)"
14701 $echo "(UV will be "$uvtype", $uvsize bytes)"
14702 $echo "(NV will be "$nvtype", $nvsize bytes)"
14703
14704 $cat >try.c <<EOCP
14705 #$i_inttypes I_INTTYPES
14706 #ifdef I_INTTYPES
14707 #include <inttypes.h>
14708 #endif
14709 #include <stdio.h>
14710 int main() {
14711 #ifdef INT8
14712    int8_t i =  INT8_MAX;
14713   uint8_t u = UINT8_MAX;
14714   printf("int8_t\n");
14715 #endif
14716 #ifdef INT16
14717    int16_t i =  INT16_MAX;
14718   uint16_t i = UINT16_MAX;
14719   printf("int16_t\n");
14720 #endif
14721 #ifdef INT32
14722    int32_t i =  INT32_MAX;
14723   uint32_t u = UINT32_MAX;
14724   printf("int32_t\n");
14725 #endif
14726 }
14727 EOCP
14728
14729 case "$i8type" in
14730 '')     case "$charsize" in
14731         1)      i8type=char
14732                 u8type="unsigned char"
14733                 i8size=$charsize
14734                 u8size=$charsize
14735                 ;;
14736         esac
14737         ;;
14738 esac
14739 case "$i8type" in
14740 '')     set try -DINT8
14741         if eval $compile; then
14742                 case "`$run ./try`" in
14743                 int8_t) i8type=int8_t
14744                         u8type=uint8_t
14745                         i8size=1
14746                         u8size=1
14747                         ;;
14748                 esac
14749         fi
14750         ;;
14751 esac
14752 case "$i8type" in
14753 '')     if $test $charsize -ge 1; then
14754                 i8type=char
14755                 u8type="unsigned char"
14756                 i8size=$charsize
14757                 u8size=$charsize
14758         fi
14759         ;;
14760 esac
14761
14762 case "$i16type" in
14763 '')     case "$shortsize" in
14764         2)      i16type=short
14765                 u16type="unsigned short"
14766                 i16size=$shortsize
14767                 u16size=$shortsize
14768                 ;;
14769         esac
14770         ;;
14771 esac
14772 case "$i16type" in
14773 '')     set try -DINT16
14774         if eval $compile; then
14775                 case "`$run ./try`" in
14776                 int16_t)
14777                         i16type=int16_t
14778                         u16type=uint16_t
14779                         i16size=2
14780                         u16size=2
14781                         ;;
14782                 esac
14783         fi
14784         ;;
14785 esac
14786 case "$i16type" in
14787 '')     if $test $shortsize -ge 2; then
14788                 i16type=short
14789                 u16type="unsigned short"
14790                 i16size=$shortsize
14791                 u16size=$shortsize
14792         fi
14793         ;;
14794 esac
14795
14796 case "$i32type" in
14797 '')     case "$longsize" in
14798         4)      i32type=long
14799                 u32type="unsigned long"
14800                 i32size=$longsize
14801                 u32size=$longsize
14802                 ;;
14803         *)      case "$intsize" in
14804                 4)      i32type=int
14805                         u32type="unsigned int"
14806                         i32size=$intsize
14807                         u32size=$intsize
14808                         ;;
14809                 esac
14810                 ;;
14811         esac
14812         ;;
14813 esac
14814 case "$i32type" in
14815 '')     set try -DINT32
14816         if eval $compile; then
14817                 case "`$run ./try`" in
14818                 int32_t)
14819                         i32type=int32_t
14820                         u32type=uint32_t
14821                         i32size=4
14822                         u32size=4
14823                         ;;
14824                 esac
14825         fi
14826         ;;
14827 esac
14828 case "$i32type" in
14829 '')     if $test $intsize -ge 4; then
14830                 i32type=int
14831                 u32type="unsigned int"
14832                 i32size=$intsize
14833                 u32size=$intsize
14834         fi
14835         ;;
14836 esac
14837
14838 case "$i64type" in
14839 '')     case "$d_quad:$quadtype" in
14840         define:?*)
14841                 i64type="$quadtype"
14842                 u64type="$uquadtype"
14843                 i64size=8
14844                 u64size=8
14845                 ;;
14846         esac
14847         ;;
14848 esac
14849
14850 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14851 : volatile so that the compiler has to store it out to memory.
14852 if test X"$d_volatile" = X"$define"; then
14853         volatile=volatile
14854 fi
14855 $cat <<EOP >try.c
14856 #include <stdio.h>
14857 #$i_stdlib I_STDLIB
14858 #ifdef I_STDLIB
14859 #include <stdlib.h>
14860 #endif
14861 #include <sys/types.h>
14862 #include <signal.h>
14863 #ifdef SIGFPE
14864 $volatile int bletched = 0;
14865 $signal_t blech(s) int s; { bletched = 1; }
14866 #endif
14867 int main() {
14868     $uvtype u = 0;
14869     $nvtype d;
14870     int     n = 8 * $uvsize;
14871     int     i;
14872 #ifdef SIGFPE
14873     signal(SIGFPE, blech);
14874 #endif
14875
14876     for (i = 0; i < n; i++) {
14877       u = u << 1 | ($uvtype)1;
14878       d = ($nvtype)u;
14879       if (($uvtype)d != u)
14880         break;
14881       if (d <= 0)
14882         break;
14883       d = ($nvtype)(u - 1);
14884       if (($uvtype)d != (u - 1))
14885         break;
14886 #ifdef SIGFPE
14887       if (bletched) {
14888         break;
14889 #endif
14890       } 
14891     }
14892     printf("%d\n", ((i == n) ? -n : i));
14893     exit(0);
14894 }
14895 EOP
14896 set try
14897
14898 d_nv_preserves_uv="$undef"
14899 if eval $compile; then
14900         nv_preserves_uv_bits="`$run ./try`"
14901 fi
14902 case "$nv_preserves_uv_bits" in
14903 \-[1-9]*)       
14904         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14905         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14906         d_nv_preserves_uv="$define"
14907         ;;
14908 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14909         d_nv_preserves_uv="$undef" ;;
14910 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14911         nv_preserves_uv_bits="$undef" ;;
14912 esac
14913
14914 $rm -f try.* try
14915
14916 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14917 : volatile so that the compiler has to store it out to memory.
14918 if test X"$d_volatile" = X"$define"; then
14919         volatile=volatile
14920 fi
14921 $cat <<EOP >try.c
14922 #include <stdio.h>
14923 #$i_stdlib I_STDLIB
14924 #ifdef I_STDLIB
14925 #include <stdlib.h>
14926 #endif
14927 #$i_string I_STRING
14928 #ifdef I_STRING
14929 #  include <string.h>
14930 #else
14931 #  include <strings.h>
14932 #endif
14933 #include <sys/types.h>
14934 #include <signal.h>
14935 #ifdef SIGFPE
14936 $volatile int bletched = 0;
14937 $signal_t blech(s) int s; { bletched = 1; }
14938 #endif
14939
14940 int checkit($nvtype d, char *where) {
14941     unsigned char *p = (char *)&d;
14942     unsigned char *end = p + sizeof(d);
14943     int fail = 0;
14944
14945     while (p < end)
14946         fail += *p++;
14947
14948     if (!fail)
14949         return 0;
14950
14951     p = (char *)&d;
14952     printf("No - %s: 0x", where);
14953     while (p < end)
14954         printf ("%02X", *p++);
14955     printf("\n");
14956     return 1;
14957 }
14958
14959 int main(int argc, char **argv) {
14960     $nvtype d = 0.0;
14961     int fail = 0;
14962     fail += checkit(d, "0.0");
14963
14964     /* The compiler shouldn't be assuming that bletched is 0  */
14965     d = bletched;
14966
14967     fail += checkit(d, "bleched");
14968
14969 #ifdef SIGFPE
14970     signal(SIGFPE, blech);
14971 #endif
14972
14973     /* Paranoia - the compiler should have no way of knowing that ANSI says
14974        that argv[argc] will always be NULL.  Actually, if it did assume this it
14975        would be buggy, as this is C and main() can be called from elsewhere in
14976        the program.  */
14977     d = argv[argc] ? 1 : 0;
14978
14979     if (d) {
14980         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14981     }
14982
14983     fail += checkit(d, "ternary");
14984
14985     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14986
14987     if (d != 0.0) {
14988         printf("No - memset doesn't give 0.0\n");
14989         /* This might just blow up:  */
14990         printf("(gives %g)\n", d);
14991         return 1;
14992     }
14993     
14994 #ifdef SIGFPE
14995     if (bletched) {
14996         printf("No - something bleched\n");
14997         return 1;
14998     }
14999 #endif
15000     if (fail) {
15001       printf("No - %d fail(s)\n", fail);
15002       return 1;
15003     }
15004     printf("Yes\n");
15005     return 0;
15006 }
15007 EOP
15008 set try
15009
15010 d_nv_zero_is_allbits_zero="$undef"
15011 if eval $compile; then
15012     xxx="`$run ./try`"
15013     case "$?" in
15014         0)
15015             case "$xxx" in
15016                 Yes)  cat >&4 <<EOM
15017 0.0 is represented as all bits zero in memory
15018 EOM
15019                     d_nv_zero_is_allbits_zero="$define"
15020                     ;;
15021                 *)  cat >&4 <<EOM
15022 0.0 is not represented as all bits zero in memory
15023 EOM
15024                     d_nv_zero_is_allbits_zero="$undef"
15025                     ;;
15026             esac
15027             ;;
15028         *)  cat >&4 <<EOM
15029 0.0 is not represented as all bits zero in memory
15030 EOM
15031             d_nv_zero_is_allbits_zero="$undef"
15032             ;;
15033     esac
15034 fi
15035
15036 $rm -f try.* try
15037
15038
15039 : check for off64_t
15040 echo " "
15041 echo "Checking to see if you have off64_t..." >&4
15042 $cat >try.c <<EOCP
15043 #include <sys/types.h>
15044 #include <unistd.h>
15045 int main() { off64_t x = 7; }
15046 EOCP
15047 set try
15048 if eval $compile; then
15049         val="$define"
15050         echo "You have off64_t."
15051 else
15052         val="$undef"
15053         echo "You do not have off64_t."
15054         case "$lseeksize" in
15055         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15056         esac
15057 fi
15058 $rm -f try.* try
15059 set d_off64_t
15060 eval $setvar
15061
15062 : how to create joinable pthreads
15063 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15064         echo " "
15065         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15066         $cat >try.c <<'EOCP'
15067 #include <pthread.h>
15068 int main() {
15069     int detachstate = JOINABLE;
15070 }
15071 EOCP
15072         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15073         if eval $compile; then
15074                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15075                 val="$undef" # Yes, undef.
15076                 set d_old_pthread_create_joinable
15077                 eval $setvar
15078                 val=""
15079                 set old_pthread_create_joinable
15080                 eval $setvar
15081         else
15082                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15083                 if eval $compile; then
15084                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15085                         val="$define"
15086                         set d_old_pthread_create_joinable
15087                         eval $setvar
15088                         val=PTHREAD_CREATE_UNDETACHED
15089                         set old_pthread_create_joinable
15090                         eval $setvar
15091                 else            
15092                         set try -DJOINABLE=__UNDETACHED
15093                         if eval $compile; then
15094                                 echo "You seem to use __UNDETACHED." >&4
15095                                 val="$define"
15096                                 set d_old_pthread_create_joinable
15097                                 eval $setvar
15098                                 val=__UNDETACHED
15099                                 set old_pthread_create_joinable
15100                                 eval $setvar
15101                         else
15102                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15103                                 val="$define"
15104                                 set d_old_pthread_create_joinable
15105                                 eval $setvar
15106                                 val=0
15107                                 set old_pthread_create_joinable
15108                                 eval $setvar
15109                         fi
15110                 fi
15111         fi
15112         $rm -f try try.*
15113 else
15114     d_old_pthread_create_joinable="$undef"
15115     old_pthread_create_joinable=""
15116 fi
15117
15118 : see if pause exists
15119 set pause d_pause
15120 eval $inlibc
15121
15122 : see if pipe exists
15123 set pipe d_pipe
15124 eval $inlibc
15125
15126 : see if poll exists
15127 set poll d_poll
15128 eval $inlibc
15129
15130 : see if readlink exists
15131 set readlink d_readlink
15132 eval $inlibc
15133
15134 echo " "
15135 procselfexe=''
15136 val="$undef"
15137 case "$d_readlink" in
15138 "$define")
15139         if $issymlink /proc/self/exe ; then
15140                 $ls -l /proc/self/exe > reflect
15141                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15142                         echo "You have Linux-like /proc/self/exe."
15143                         procselfexe='"/proc/self/exe"'
15144                         val="$define"
15145                 fi
15146         fi
15147         if $issymlink /proc/curproc/file ; then
15148                 $ls -l /proc/curproc/file > reflect
15149                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15150                         echo "You have BSD-like /proc/curproc/file."
15151                         procselfexe='"/proc/curproc/file"'
15152                         val="$define"
15153                 fi
15154         fi
15155         ;;
15156 esac
15157 $rm -f reflect
15158 set d_procselfexe
15159 eval $setvar
15160
15161 : see whether the pthread_atfork exists
15162 $cat >try.c <<EOP
15163 #include <pthread.h>
15164 #include <stdio.h>
15165 int main() {
15166 #ifdef  PTHREAD_ATFORK
15167         pthread_atfork(NULL,NULL,NULL);
15168 #endif
15169 }
15170 EOP
15171
15172 : see if pthread_atfork exists
15173 set try -DPTHREAD_ATFORK
15174 if eval $compile; then
15175     val="$define"
15176 else
15177     val="$undef"
15178 fi
15179 case "$usethreads" in
15180 $define)
15181         case "$val" in
15182         $define) echo 'pthread_atfork found.' >&4        ;;
15183         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15184         esac
15185 esac
15186 set d_pthread_atfork
15187 eval $setvar
15188
15189 : see if pthread_attr_setscope exists
15190 set pthread_attr_setscope d_pthread_attr_setscope
15191 eval $inlibc
15192
15193
15194 : see whether the various POSIXish _yields exist
15195 $cat >try.c <<EOP
15196 #include <pthread.h>
15197 #include <stdio.h>
15198 int main() {
15199 #ifdef SCHED_YIELD
15200         sched_yield();
15201 #else
15202 #ifdef PTHREAD_YIELD
15203         pthread_yield();
15204 #else
15205 #ifdef PTHREAD_YIELD_NULL
15206         pthread_yield(NULL);
15207 #endif
15208 #endif
15209 #endif
15210 }
15211 EOP
15212 : see if sched_yield exists
15213 set try -DSCHED_YIELD
15214 if eval $compile; then
15215     val="$define"
15216     sched_yield='sched_yield()'
15217 else
15218     val="$undef"
15219 fi
15220 case "$usethreads" in
15221 $define)
15222         case "$val" in
15223         $define) echo 'sched_yield() found.' >&4        ;;
15224         *)       echo 'sched_yield() NOT found.' >&4    ;;
15225         esac
15226 esac
15227 set d_sched_yield
15228 eval $setvar
15229
15230 : see if pthread_yield exists
15231 set try -DPTHREAD_YIELD
15232 if eval $compile; then
15233     val="$define"
15234     case "$sched_yield" in
15235     '') sched_yield='pthread_yield()' ;;
15236     esac
15237 else
15238     set try -DPTHREAD_YIELD_NULL
15239     if eval $compile; then
15240         val="$define"
15241         case "$sched_yield" in
15242         '') sched_yield='pthread_yield(NULL)' ;;
15243         esac
15244     else
15245         val="$undef"
15246     fi
15247 fi
15248 case "$usethreads" in
15249 $define)
15250         case "$val" in
15251         $define) echo 'pthread_yield() found.' >&4      ;;
15252         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15253         esac
15254         ;;
15255 esac
15256 set d_pthread_yield
15257 eval $setvar
15258
15259 case "$sched_yield" in
15260 '') sched_yield=undef ;;
15261 esac
15262
15263 $rm -f try try.*
15264
15265 : see if random_r exists
15266 set random_r d_random_r
15267 eval $inlibc
15268 case "$d_random_r" in
15269 "$define")
15270         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15271         case "$d_random_r_proto:$usethreads" in
15272         ":define")      d_random_r_proto=define
15273                 set d_random_r_proto random_r $hdrs
15274                 eval $hasproto ;;
15275         *)      ;;
15276         esac
15277         case "$d_random_r_proto" in
15278         define)
15279         case "$random_r_proto" in
15280         ''|0) try='int random_r(int*, struct random_data*);'
15281         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15282         esac
15283         case "$random_r_proto" in
15284         ''|0) try='int random_r(long*, struct random_data*);'
15285         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15286         esac
15287         case "$random_r_proto" in
15288         ''|0) try='int random_r(struct random_data*, int32_t*);'
15289         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15290         esac
15291         case "$random_r_proto" in
15292         ''|0)   d_random_r=undef
15293                 random_r_proto=0
15294                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15295         * )     case "$random_r_proto" in
15296                 REENTRANT_PROTO*) ;;
15297                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15298                 esac
15299                 echo "Prototype: $try" ;;
15300         esac
15301         ;;
15302         *)      case "$usethreads" in
15303                 define) echo "random_r has no prototype, not using it." >&4 ;;
15304                 esac
15305                 d_random_r=undef
15306                 random_r_proto=0
15307                 ;;
15308         esac
15309         ;;
15310 *)      random_r_proto=0
15311         ;;
15312 esac
15313
15314 : see if readdir and friends exist
15315 set readdir d_readdir
15316 eval $inlibc
15317 set seekdir d_seekdir
15318 eval $inlibc
15319 set telldir d_telldir
15320 eval $inlibc
15321 set rewinddir d_rewinddir
15322 eval $inlibc
15323
15324 : see if readdir64_r exists
15325 set readdir64_r d_readdir64_r
15326 eval $inlibc
15327 case "$d_readdir64_r" in
15328 "$define")
15329         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15330         case "$d_readdir64_r_proto:$usethreads" in
15331         ":define")      d_readdir64_r_proto=define
15332                 set d_readdir64_r_proto readdir64_r $hdrs
15333                 eval $hasproto ;;
15334         *)      ;;
15335         esac
15336         case "$d_readdir64_r_proto" in
15337         define)
15338         case "$readdir64_r_proto" in
15339         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15340         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15341         esac
15342         case "$readdir64_r_proto" in
15343         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15344         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15345         esac
15346         case "$readdir64_r_proto" in
15347         ''|0)   d_readdir64_r=undef
15348                 readdir64_r_proto=0
15349                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15350         * )     case "$readdir64_r_proto" in
15351                 REENTRANT_PROTO*) ;;
15352                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15353                 esac
15354                 echo "Prototype: $try" ;;
15355         esac
15356         ;;
15357         *)      case "$usethreads" in
15358                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15359                 esac
15360                 d_readdir64_r=undef
15361                 readdir64_r_proto=0
15362                 ;;
15363         esac
15364         ;;
15365 *)      readdir64_r_proto=0
15366         ;;
15367 esac
15368
15369 : see if readdir_r exists
15370 set readdir_r d_readdir_r
15371 eval $inlibc
15372 case "$d_readdir_r" in
15373 "$define")
15374         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15375         case "$d_readdir_r_proto:$usethreads" in
15376         ":define")      d_readdir_r_proto=define
15377                 set d_readdir_r_proto readdir_r $hdrs
15378                 eval $hasproto ;;
15379         *)      ;;
15380         esac
15381         case "$d_readdir_r_proto" in
15382         define)
15383         case "$readdir_r_proto" in
15384         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15385         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15386         esac
15387         case "$readdir_r_proto" in
15388         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15389         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15390         esac
15391         case "$readdir_r_proto" in
15392         ''|0)   d_readdir_r=undef
15393                 readdir_r_proto=0
15394                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15395         * )     case "$readdir_r_proto" in
15396                 REENTRANT_PROTO*) ;;
15397                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15398                 esac
15399                 echo "Prototype: $try" ;;
15400         esac
15401         ;;
15402         *)      case "$usethreads" in
15403                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15404                 esac
15405                 d_readdir_r=undef
15406                 readdir_r_proto=0
15407                 ;;
15408         esac
15409         ;;
15410 *)      readdir_r_proto=0
15411         ;;
15412 esac
15413
15414 : see if readv exists
15415 set readv d_readv
15416 eval $inlibc
15417
15418 : see if recvmsg exists
15419 set recvmsg d_recvmsg
15420 eval $inlibc
15421
15422 : see if rename exists
15423 set rename d_rename
15424 eval $inlibc
15425
15426 : see if rmdir exists
15427 set rmdir d_rmdir
15428 eval $inlibc
15429
15430 : see if memory.h is available.
15431 val=''
15432 set memory.h val
15433 eval $inhdr
15434
15435 : See if it conflicts with string.h
15436 case "$val" in
15437 $define)
15438         case "$strings" in
15439         '') ;;
15440         *)
15441                 $cppstdin $cppflags $cppminus < $strings > mem.h
15442                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15443                         echo " "
15444                         echo "We won't be including <memory.h>."
15445                         val="$undef"
15446                 fi
15447                 $rm -f mem.h
15448                 ;;
15449         esac
15450 esac
15451 set i_memory
15452 eval $setvar
15453
15454 : can bcopy handle overlapping blocks?
15455 echo " "
15456 val="$undef"
15457 case "$d_memmove" in
15458 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15459 *)      case "$d_bcopy" in
15460         "$define")
15461                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15462                 $cat >try.c <<EOCP
15463 #$i_memory I_MEMORY
15464 #$i_stdlib I_STDLIB
15465 #$i_string I_STRING
15466 #$i_unistd I_UNISTD
15467 EOCP
15468         $cat >>try.c <<'EOCP'
15469 #include <stdio.h>
15470 #ifdef I_MEMORY
15471 #  include <memory.h>
15472 #endif
15473 #ifdef I_STDLIB
15474 #  include <stdlib.h>
15475 #endif
15476 #ifdef I_STRING
15477 #  include <string.h>
15478 #else
15479 #  include <strings.h>
15480 #endif
15481 #ifdef I_UNISTD
15482 #  include <unistd.h>  /* Needed for NetBSD */
15483 #endif
15484 int main()
15485 {
15486 char buf[128], abc[128];
15487 char *b;
15488 int len;
15489 int off;
15490 int align;
15491
15492 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15493    try to store the string in read-only memory. */
15494 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15495
15496 for (align = 7; align >= 0; align--) {
15497         for (len = 36; len; len--) {
15498                 b = buf+align;
15499                 bcopy(abc, b, len);
15500                 for (off = 1; off <= len; off++) {
15501                         bcopy(b, b+off, len);
15502                         bcopy(b+off, b, len);
15503                         if (bcmp(b, abc, len))
15504                                 exit(1);
15505                 }
15506         }
15507 }
15508 exit(0);
15509 }
15510 EOCP
15511                 set try
15512                 if eval $compile_ok; then
15513                         if ./try 2>/dev/null; then
15514                                 echo "Yes, it can."
15515                                 val="$define"
15516                         else
15517                                 echo "It can't, sorry."
15518                         fi
15519                 else
15520                         echo "(I can't compile the test program, so we'll assume not...)"
15521                 fi
15522                 ;;
15523         esac
15524         $rm -f try.* try core
15525         ;;
15526 esac
15527 set d_safebcpy
15528 eval $setvar
15529
15530 : can memcpy handle overlapping blocks?
15531 echo " "
15532 val="$undef"
15533 case "$d_memmove" in
15534 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15535 *)      case "$d_memcpy" in
15536         "$define")
15537                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15538                 $cat >try.c <<EOCP
15539 #$i_memory I_MEMORY
15540 #$i_stdlib I_STDLIB
15541 #$i_string I_STRING
15542 #$i_unistd I_UNISTD
15543 EOCP
15544         $cat >>try.c <<'EOCP'
15545 #include <stdio.h>
15546 #ifdef I_MEMORY
15547 #  include <memory.h>
15548 #endif
15549 #ifdef I_STDLIB
15550 #  include <stdlib.h>
15551 #endif
15552 #ifdef I_STRING
15553 #  include <string.h>
15554 #else
15555 #  include <strings.h>
15556 #endif
15557 #ifdef I_UNISTD
15558 #  include <unistd.h>  /* Needed for NetBSD */
15559 #endif
15560 int main()
15561 {
15562 char buf[128], abc[128];
15563 char *b;
15564 int len;
15565 int off;
15566 int align;
15567
15568 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15569    try to store the string in read-only memory. */
15570 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15571
15572 for (align = 7; align >= 0; align--) {
15573         for (len = 36; len; len--) {
15574                 b = buf+align;
15575                 memcpy(b, abc, len);
15576                 for (off = 1; off <= len; off++) {
15577                         memcpy(b+off, b, len);
15578                         memcpy(b, b+off, len);
15579                         if (memcmp(b, abc, len))
15580                                 exit(1);
15581                 }
15582         }
15583 }
15584 exit(0);
15585 }
15586 EOCP
15587                 set try
15588                 if eval $compile_ok; then
15589                         if ./try 2>/dev/null; then
15590                                 echo "Yes, it can."
15591                                 val="$define"
15592                         else
15593                                 echo "It can't, sorry."
15594                         fi
15595                 else
15596                         echo "(I can't compile the test program, so we'll assume not...)"
15597                 fi
15598                 ;;
15599         esac
15600         $rm -f try.* try core
15601         ;;
15602 esac
15603 set d_safemcpy
15604 eval $setvar
15605
15606 : can memcmp be trusted to compare relative magnitude?
15607 val="$undef"
15608 case "$d_memcmp" in
15609 "$define")
15610         echo " "
15611         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15612         $cat >try.c <<EOCP
15613 #$i_memory I_MEMORY
15614 #$i_stdlib I_STDLIB
15615 #$i_string I_STRING
15616 #$i_unistd I_UNISTD
15617 EOCP
15618         $cat >>try.c <<'EOCP'
15619 #include <stdio.h>
15620 #ifdef I_MEMORY
15621 #  include <memory.h>
15622 #endif
15623 #ifdef I_STDLIB
15624 #  include <stdlib.h>
15625 #endif
15626 #ifdef I_STRING
15627 #  include <string.h>
15628 #else
15629 #  include <strings.h>
15630 #endif
15631 #ifdef I_UNISTD
15632 #  include <unistd.h>  /* Needed for NetBSD */
15633 #endif
15634 int main()
15635 {
15636 char a = -1;
15637 char b = 0;
15638 if ((a < b) && memcmp(&a, &b, 1) < 0)
15639         exit(1);
15640 exit(0);
15641 }
15642 EOCP
15643         set try
15644         if eval $compile_ok; then
15645                 if $run ./try 2>/dev/null; then
15646                         echo "Yes, it can."
15647                         val="$define"
15648                 else
15649                         echo "No, it can't (it uses signed chars)."
15650                 fi
15651         else
15652                 echo "(I can't compile the test program, so we'll assume not...)"
15653         fi
15654         ;;
15655 esac
15656 $rm -f try.* try core
15657 set d_sanemcmp
15658 eval $setvar
15659
15660 : see if prototype for sbrk is available
15661 echo " "
15662 set d_sbrkproto sbrk $i_unistd unistd.h
15663 eval $hasproto
15664
15665 : see if select exists
15666 set select d_select
15667 eval $inlibc
15668
15669 : see if semctl exists
15670 set semctl d_semctl
15671 eval $inlibc
15672
15673 : see if semget exists
15674 set semget d_semget
15675 eval $inlibc
15676
15677 : see if semop exists
15678 set semop d_semop
15679 eval $inlibc
15680
15681 : see how much of the 'sem*(2)' library is present.
15682 h_sem=true
15683 echo " "
15684 case "$d_semctl$d_semget$d_semop" in
15685 *"$undef"*) h_sem=false;;
15686 esac
15687 case "$osname" in
15688 freebsd)
15689     case "`ipcs 2>&1`" in
15690     "SVID messages"*"not configured"*)
15691         echo "Your $osname does not have the sem*(2) configured." >&4
15692         h_sem=false
15693         val="$undef"
15694         set semctl d_semctl
15695         eval $setvar
15696         set semget d_semget
15697         eval $setvar
15698         set semop d_semop
15699         eval $setvar
15700         ;;
15701     esac
15702     ;;
15703 esac
15704 : we could also check for sys/ipc.h ...
15705 if $h_sem && $test `./findhdr sys/sem.h`; then
15706         echo "You have the full sem*(2) library." >&4
15707         val="$define"
15708 else
15709         echo "You don't have the full sem*(2) library." >&4
15710         val="$undef"
15711 fi
15712 set d_sem
15713 eval $setvar
15714
15715 : see whether sys/sem.h defines union semun
15716 echo " "
15717 $cat > try.c <<'END'
15718 #include <sys/types.h>
15719 #include <sys/ipc.h>
15720 #include <sys/sem.h>
15721 int main () { union semun semun; semun.buf = 0; }
15722 END
15723 set try
15724 if eval $compile; then
15725     echo "You have union semun in <sys/sem.h>." >&4
15726     val="$define"
15727 else
15728     echo "You do not have union semun in <sys/sem.h>." >&4
15729     val="$undef"
15730 fi
15731 $rm -f try try.c
15732 set d_union_semun
15733 eval $setvar
15734
15735 : see how to do semctl IPC_STAT
15736 case "$d_sem" in
15737 $define)
15738     echo " "
15739     $cat > try.h <<END
15740 #ifndef S_IRUSR
15741 #   ifdef S_IREAD
15742 #       define S_IRUSR S_IREAD
15743 #       define S_IWUSR S_IWRITE
15744 #       define S_IXUSR S_IEXEC
15745 #   else
15746 #       define S_IRUSR 0400
15747 #       define S_IWUSR 0200
15748 #       define S_IXUSR 0100
15749 #   endif
15750 #   define S_IRGRP (S_IRUSR>>3)
15751 #   define S_IWGRP (S_IWUSR>>3)
15752 #   define S_IXGRP (S_IXUSR>>3)
15753 #   define S_IROTH (S_IRUSR>>6)
15754 #   define S_IWOTH (S_IWUSR>>6)
15755 #   define S_IXOTH (S_IXUSR>>6)
15756 #endif
15757 #ifndef S_IRWXU
15758 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15759 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15760 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15761 #endif
15762 END
15763     : see whether semctl IPC_STAT can use union semun
15764     case "$d_semctl_semun" in
15765     '')
15766       val="$undef"
15767       $cat > try.c <<END
15768 #include <sys/types.h>
15769 #include <sys/ipc.h>
15770 #include <sys/sem.h>
15771 #include <sys/stat.h>
15772 #include <stdio.h>
15773 #include <errno.h>
15774 #include "try.h"
15775 #ifndef errno
15776 extern int errno;
15777 #endif
15778 #$d_union_semun HAS_UNION_SEMUN
15779 int main() {
15780     union semun
15781 #ifndef HAS_UNION_SEMUN
15782     {
15783         int val;
15784         struct semid_ds *buf;
15785         unsigned short *array;
15786     }
15787 #endif
15788     arg;
15789     int sem, st;
15790
15791 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15792     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15793     if (sem > -1) {
15794         struct semid_ds argbuf;
15795         arg.buf = &argbuf;
15796 #       ifdef IPC_STAT
15797         st = semctl(sem, 0, IPC_STAT, arg);
15798         if (st == 0)
15799             printf("semun\n");
15800         else
15801 #       endif /* IPC_STAT */
15802             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15803 #       ifdef IPC_RMID
15804         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15805 #       endif /* IPC_RMID */
15806             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15807     } else
15808 #endif /* IPC_PRIVATE && ... */
15809         printf("semget failed: errno = %d\n", errno);
15810   return 0;
15811 }
15812 END
15813       set try
15814       if eval $compile; then
15815           xxx=`$run ./try`
15816           case "$xxx" in
15817           semun) val="$define" ;;
15818           esac
15819       fi
15820       $rm -f try try.c
15821       set d_semctl_semun
15822       eval $setvar
15823       ;;
15824     esac
15825     case "$d_semctl_semun" in
15826     $define)
15827         echo "You can use union semun for semctl IPC_STAT." >&4
15828         also='also'
15829         ;;
15830     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15831         also=''
15832         ;;
15833     esac
15834
15835     : see whether semctl IPC_STAT can use struct semid_ds pointer
15836     case "$d_semctl_semid_ds" in
15837     '')
15838       val="$undef"
15839       $cat > try.c <<'END'
15840 #include <sys/types.h>
15841 #include <sys/ipc.h>
15842 #include <sys/sem.h>
15843 #include <sys/stat.h>
15844 #include "try.h"
15845 #include <stdio.h>
15846 #include <errno.h>
15847 #ifndef errno
15848 extern int errno;
15849 #endif
15850 int main() {
15851     struct semid_ds arg;
15852     int sem, st;
15853
15854 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15855     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15856     if (sem > -1) {
15857 #       ifdef IPC_STAT
15858         st = semctl(sem, 0, IPC_STAT, &arg);
15859         if (st == 0)
15860             printf("semid_ds\n");
15861         else
15862 #       endif /* IPC_STAT */
15863             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15864 #       ifdef IPC_RMID
15865         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15866 #       endif /* IPC_RMID */
15867             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15868     } else
15869 #endif /* IPC_PRIVATE && ... */
15870         printf("semget failed: errno = %d\n", errno);
15871
15872     return 0;
15873 }
15874 END
15875       set try
15876       if eval $compile; then
15877           xxx=`$run ./try`
15878           case "$xxx" in
15879           semid_ds) val="$define" ;;
15880           esac
15881       fi
15882       $rm -f try try.c
15883       set d_semctl_semid_ds
15884       eval $setvar
15885       ;;
15886     esac
15887     case "$d_semctl_semid_ds" in
15888     $define)
15889         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15890         ;;
15891     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15892         ;;
15893     esac
15894     $rm -f try.h
15895     ;;
15896 *)  val="$undef"
15897
15898     # We do not have the full sem*(2) library, so assume we can not
15899     # use either.
15900
15901     set d_semctl_semun
15902     eval $setvar
15903
15904     set d_semctl_semid_ds
15905     eval $setvar
15906     ;;
15907 esac
15908
15909 : see if sendmsg exists
15910 set sendmsg d_sendmsg
15911 eval $inlibc
15912
15913 : see if setegid exists
15914 set setegid d_setegid
15915 eval $inlibc
15916
15917 : see if seteuid exists
15918 set seteuid d_seteuid
15919 eval $inlibc
15920
15921 : see if setgrent exists
15922 set setgrent d_setgrent
15923 eval $inlibc
15924
15925 : see if setgrent_r exists
15926 set setgrent_r d_setgrent_r
15927 eval $inlibc
15928 case "$d_setgrent_r" in
15929 "$define")
15930         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15931         case "$d_setgrent_r_proto:$usethreads" in
15932         ":define")      d_setgrent_r_proto=define
15933                 set d_setgrent_r_proto setgrent_r $hdrs
15934                 eval $hasproto ;;
15935         *)      ;;
15936         esac
15937         case "$d_setgrent_r_proto" in
15938         define)
15939         case "$setgrent_r_proto" in
15940         ''|0) try='int setgrent_r(FILE**);'
15941         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15942         esac
15943         case "$setgrent_r_proto" in
15944         ''|0) try='void setgrent_r(FILE**);'
15945         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15946         esac
15947         case "$setgrent_r_proto" in
15948         ''|0)   d_setgrent_r=undef
15949                 setgrent_r_proto=0
15950                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15951         * )     case "$setgrent_r_proto" in
15952                 REENTRANT_PROTO*) ;;
15953                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15954                 esac
15955                 echo "Prototype: $try" ;;
15956         esac
15957         ;;
15958         *)      case "$usethreads" in
15959                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15960                 esac
15961                 d_setgrent_r=undef
15962                 setgrent_r_proto=0
15963                 ;;
15964         esac
15965         ;;
15966 *)      setgrent_r_proto=0
15967         ;;
15968 esac
15969
15970 : see if sethostent exists
15971 set sethostent d_sethent
15972 eval $inlibc
15973
15974 : see if sethostent_r exists
15975 set sethostent_r d_sethostent_r
15976 eval $inlibc
15977 case "$d_sethostent_r" in
15978 "$define")
15979         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15980         case "$d_sethostent_r_proto:$usethreads" in
15981         ":define")      d_sethostent_r_proto=define
15982                 set d_sethostent_r_proto sethostent_r $hdrs
15983                 eval $hasproto ;;
15984         *)      ;;
15985         esac
15986         case "$d_sethostent_r_proto" in
15987         define)
15988         case "$sethostent_r_proto" in
15989         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15990         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15991         esac
15992         case "$sethostent_r_proto" in
15993         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15994         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15995         esac
15996         case "$sethostent_r_proto" in
15997         ''|0)   d_sethostent_r=undef
15998                 sethostent_r_proto=0
15999                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16000         * )     case "$sethostent_r_proto" in
16001                 REENTRANT_PROTO*) ;;
16002                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16003                 esac
16004                 echo "Prototype: $try" ;;
16005         esac
16006         ;;
16007         *)      case "$usethreads" in
16008                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16009                 esac
16010                 d_sethostent_r=undef
16011                 sethostent_r_proto=0
16012                 ;;
16013         esac
16014         ;;
16015 *)      sethostent_r_proto=0
16016         ;;
16017 esac
16018
16019 : see if setitimer exists
16020 set setitimer d_setitimer
16021 eval $inlibc
16022
16023 : see if setlinebuf exists
16024 set setlinebuf d_setlinebuf
16025 eval $inlibc
16026
16027 : see if setlocale exists
16028 set setlocale d_setlocale
16029 eval $inlibc
16030
16031 : see if locale.h is available
16032 set locale.h i_locale
16033 eval $inhdr
16034
16035 : see if setlocale_r exists
16036 set setlocale_r d_setlocale_r
16037 eval $inlibc
16038 case "$d_setlocale_r" in
16039 "$define")
16040         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16041         case "$d_setlocale_r_proto:$usethreads" in
16042         ":define")      d_setlocale_r_proto=define
16043                 set d_setlocale_r_proto setlocale_r $hdrs
16044                 eval $hasproto ;;
16045         *)      ;;
16046         esac
16047         case "$d_setlocale_r_proto" in
16048         define)
16049         case "$setlocale_r_proto" in
16050         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16051         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16052         esac
16053         case "$setlocale_r_proto" in
16054         ''|0)   d_setlocale_r=undef
16055                 setlocale_r_proto=0
16056                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16057         * )     case "$setlocale_r_proto" in
16058                 REENTRANT_PROTO*) ;;
16059                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16060                 esac
16061                 echo "Prototype: $try" ;;
16062         esac
16063         ;;
16064         *)      case "$usethreads" in
16065                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16066                 esac
16067                 d_setlocale_r=undef
16068                 setlocale_r_proto=0
16069                 ;;
16070         esac
16071         ;;
16072 *)      setlocale_r_proto=0
16073         ;;
16074 esac
16075
16076 : see if setnetent exists
16077 set setnetent d_setnent
16078 eval $inlibc
16079
16080 : see if setnetent_r exists
16081 set setnetent_r d_setnetent_r
16082 eval $inlibc
16083 case "$d_setnetent_r" in
16084 "$define")
16085         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16086         case "$d_setnetent_r_proto:$usethreads" in
16087         ":define")      d_setnetent_r_proto=define
16088                 set d_setnetent_r_proto setnetent_r $hdrs
16089                 eval $hasproto ;;
16090         *)      ;;
16091         esac
16092         case "$d_setnetent_r_proto" in
16093         define)
16094         case "$setnetent_r_proto" in
16095         ''|0) try='int setnetent_r(int, struct netent_data*);'
16096         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16097         esac
16098         case "$setnetent_r_proto" in
16099         ''|0) try='void setnetent_r(int, struct netent_data*);'
16100         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16101         esac
16102         case "$setnetent_r_proto" in
16103         ''|0)   d_setnetent_r=undef
16104                 setnetent_r_proto=0
16105                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16106         * )     case "$setnetent_r_proto" in
16107                 REENTRANT_PROTO*) ;;
16108                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16109                 esac
16110                 echo "Prototype: $try" ;;
16111         esac
16112         ;;
16113         *)      case "$usethreads" in
16114                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16115                 esac
16116                 d_setnetent_r=undef
16117                 setnetent_r_proto=0
16118                 ;;
16119         esac
16120         ;;
16121 *)      setnetent_r_proto=0
16122         ;;
16123 esac
16124
16125 : see if setprotoent exists
16126 set setprotoent d_setpent
16127 eval $inlibc
16128
16129 : see if setpgid exists
16130 set setpgid d_setpgid
16131 eval $inlibc
16132
16133 : see if setpgrp2 exists
16134 set setpgrp2 d_setpgrp2
16135 eval $inlibc
16136
16137 : see if setpriority exists
16138 set setpriority d_setprior
16139 eval $inlibc
16140
16141 : see if setproctitle exists
16142 set setproctitle d_setproctitle
16143 eval $inlibc
16144
16145 : see if setprotoent_r exists
16146 set setprotoent_r d_setprotoent_r
16147 eval $inlibc
16148 case "$d_setprotoent_r" in
16149 "$define")
16150         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16151         case "$d_setprotoent_r_proto:$usethreads" in
16152         ":define")      d_setprotoent_r_proto=define
16153                 set d_setprotoent_r_proto setprotoent_r $hdrs
16154                 eval $hasproto ;;
16155         *)      ;;
16156         esac
16157         case "$d_setprotoent_r_proto" in
16158         define)
16159         case "$setprotoent_r_proto" in
16160         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16161         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16162         esac
16163         case "$setprotoent_r_proto" in
16164         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16165         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16166         esac
16167         case "$setprotoent_r_proto" in
16168         ''|0)   d_setprotoent_r=undef
16169                 setprotoent_r_proto=0
16170                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16171         * )     case "$setprotoent_r_proto" in
16172                 REENTRANT_PROTO*) ;;
16173                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16174                 esac
16175                 echo "Prototype: $try" ;;
16176         esac
16177         ;;
16178         *)      case "$usethreads" in
16179                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16180                 esac
16181                 d_setprotoent_r=undef
16182                 setprotoent_r_proto=0
16183                 ;;
16184         esac
16185         ;;
16186 *)      setprotoent_r_proto=0
16187         ;;
16188 esac
16189
16190 : see if setpwent exists
16191 set setpwent d_setpwent
16192 eval $inlibc
16193
16194 : see if setpwent_r exists
16195 set setpwent_r d_setpwent_r
16196 eval $inlibc
16197 case "$d_setpwent_r" in
16198 "$define")
16199         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16200         case "$d_setpwent_r_proto:$usethreads" in
16201         ":define")      d_setpwent_r_proto=define
16202                 set d_setpwent_r_proto setpwent_r $hdrs
16203                 eval $hasproto ;;
16204         *)      ;;
16205         esac
16206         case "$d_setpwent_r_proto" in
16207         define)
16208         case "$setpwent_r_proto" in
16209         ''|0) try='int setpwent_r(FILE**);'
16210         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16211         esac
16212         case "$setpwent_r_proto" in
16213         ''|0) try='void setpwent_r(FILE**);'
16214         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16215         esac
16216         case "$setpwent_r_proto" in
16217         ''|0)   d_setpwent_r=undef
16218                 setpwent_r_proto=0
16219                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16220         * )     case "$setpwent_r_proto" in
16221                 REENTRANT_PROTO*) ;;
16222                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16223                 esac
16224                 echo "Prototype: $try" ;;
16225         esac
16226         ;;
16227         *)      case "$usethreads" in
16228                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16229                 esac
16230                 d_setpwent_r=undef
16231                 setpwent_r_proto=0
16232                 ;;
16233         esac
16234         ;;
16235 *)      setpwent_r_proto=0
16236         ;;
16237 esac
16238
16239 : see if setregid exists
16240 set setregid d_setregid
16241 eval $inlibc
16242 set setresgid d_setresgid
16243 eval $inlibc
16244
16245 : see if setreuid exists
16246 set setreuid d_setreuid
16247 eval $inlibc
16248 set setresuid d_setresuid
16249 eval $inlibc
16250
16251 : see if setrgid exists
16252 set setrgid d_setrgid
16253 eval $inlibc
16254
16255 : see if setruid exists
16256 set setruid d_setruid
16257 eval $inlibc
16258
16259 : see if setservent exists
16260 set setservent d_setsent
16261 eval $inlibc
16262
16263 : see if setservent_r exists
16264 set setservent_r d_setservent_r
16265 eval $inlibc
16266 case "$d_setservent_r" in
16267 "$define")
16268         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16269         case "$d_setservent_r_proto:$usethreads" in
16270         ":define")      d_setservent_r_proto=define
16271                 set d_setservent_r_proto setservent_r $hdrs
16272                 eval $hasproto ;;
16273         *)      ;;
16274         esac
16275         case "$d_setservent_r_proto" in
16276         define)
16277         case "$setservent_r_proto" in
16278         ''|0) try='int setservent_r(int, struct servent_data*);'
16279         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16280         esac
16281         case "$setservent_r_proto" in
16282         ''|0) try='void setservent_r(int, struct servent_data*);'
16283         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16284         esac
16285         case "$setservent_r_proto" in
16286         ''|0)   d_setservent_r=undef
16287                 setservent_r_proto=0
16288                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16289         * )     case "$setservent_r_proto" in
16290                 REENTRANT_PROTO*) ;;
16291                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16292                 esac
16293                 echo "Prototype: $try" ;;
16294         esac
16295         ;;
16296         *)      case "$usethreads" in
16297                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16298                 esac
16299                 d_setservent_r=undef
16300                 setservent_r_proto=0
16301                 ;;
16302         esac
16303         ;;
16304 *)      setservent_r_proto=0
16305         ;;
16306 esac
16307
16308 : see if setsid exists
16309 set setsid d_setsid
16310 eval $inlibc
16311
16312 : see if setvbuf exists
16313 set setvbuf d_setvbuf
16314 eval $inlibc
16315
16316 : see if sfio.h is available
16317 set sfio.h i_sfio
16318 eval $inhdr
16319
16320
16321 : see if sfio library is available
16322 case "$i_sfio" in
16323 $define)
16324         val=''
16325         set sfreserve val
16326         eval $inlibc
16327         ;;
16328 *)
16329         val="$undef"
16330         ;;
16331 esac
16332 : Ok, but do we want to use it.
16333 case "$val" in
16334 $define)
16335         case "$usesfio" in
16336         true|$define|[yY]*) dflt='y';;
16337         *) dflt='n';;
16338         esac
16339         echo "$package can use the sfio library, but it is experimental."
16340         case "$useperlio" in
16341         "$undef")
16342             echo "For sfio also the PerlIO abstraction layer is needed."
16343             echo "Earlier you said you wouldn't want that."
16344             ;;
16345         esac
16346         rp="You seem to have sfio available, do you want to try using it?"
16347         . ./myread
16348         case "$ans" in
16349         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16350                 useperlio="$define"
16351                 val="$define"
16352                 ;;
16353         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16354                 val="$undef"
16355                 ;;
16356         esac
16357         ;;
16358 *)      case "$usesfio" in
16359         true|$define|[yY]*)
16360                 echo "Sorry, cannot find sfio on this machine." >&4
16361                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16362                 val="$undef"
16363                 ;;
16364         esac
16365         ;;
16366 esac
16367 set d_sfio
16368 eval $setvar
16369 case "$d_sfio" in
16370 $define) usesfio='true';;
16371 *) usesfio='false';;
16372 esac
16373 case "$d_sfio" in
16374 $define) ;;
16375 *)      : Remove sfio from list of libraries to use
16376         case "$libs" in
16377         *-lsfio*)
16378                 echo "Removing unneeded -lsfio from library list" >&4
16379                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16380                 shift
16381                 libs="$*"
16382                 echo "libs = $libs" >&4
16383                 ;;
16384         esac
16385 ;;
16386 esac
16387
16388
16389 : see if shmctl exists
16390 set shmctl d_shmctl
16391 eval $inlibc
16392
16393 : see if shmget exists
16394 set shmget d_shmget
16395 eval $inlibc
16396
16397 : see if shmat exists
16398 set shmat d_shmat
16399 eval $inlibc
16400 : see what shmat returns
16401 case "$d_shmat" in
16402 "$define")
16403         $cat >shmat.c <<'END'
16404 #include <sys/shm.h>
16405 void *shmat();
16406 END
16407         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16408                 shmattype='void *'
16409         else
16410                 shmattype='char *'
16411         fi
16412         echo "and it returns ($shmattype)." >&4
16413         : see if a prototype for shmat is available
16414         xxx=`./findhdr sys/shm.h`
16415         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16416         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16417                 val="$define"
16418         else
16419                 val="$undef"
16420         fi
16421         $rm -f shmat.[co]
16422         ;;
16423 *)
16424         val="$undef"
16425         ;;
16426 esac
16427 set d_shmatprototype
16428 eval $setvar
16429
16430 : see if shmdt exists
16431 set shmdt d_shmdt
16432 eval $inlibc
16433
16434 : see how much of the 'shm*(2)' library is present.
16435 h_shm=true
16436 echo " "
16437 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16438 *"$undef"*) h_shm=false;;
16439 esac
16440 case "$osname" in
16441 freebsd)
16442     case "`ipcs 2>&1`" in
16443     "SVID shared memory"*"not configured"*)
16444         echo "Your $osname does not have the shm*(2) configured." >&4
16445         h_shm=false
16446         val="$undef"
16447         set shmctl d_shmctl
16448         evat $setvar
16449         set shmget d_shmget
16450         evat $setvar
16451         set shmat d_shmat
16452         evat $setvar
16453         set shmdt d_shmdt
16454         evat $setvar
16455         ;;
16456     esac
16457     ;;
16458 esac
16459 : we could also check for sys/ipc.h ...
16460 if $h_shm && $test `./findhdr sys/shm.h`; then
16461         echo "You have the full shm*(2) library." >&4
16462         val="$define"
16463 else
16464         echo "You don't have the full shm*(2) library." >&4
16465         val="$undef"
16466 fi
16467 set d_shm
16468 eval $setvar
16469
16470 echo " "
16471 : see if we have sigaction
16472 if set sigaction val -f d_sigaction; eval $csym; $val; then
16473         echo 'sigaction() found.' >&4
16474         $cat > try.c <<EOP
16475 #include <stdio.h>
16476 #include <sys/types.h>
16477 #include <signal.h>
16478 #$i_stdlib I_STDLIB
16479 #ifdef I_STDLIB
16480 #include <stdlib.h>
16481 #endif
16482 int main()
16483 {
16484     struct sigaction act, oact;
16485     act.sa_flags = 0;
16486     oact.sa_handler = 0;
16487     /* so that act and oact are used */
16488     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16489 }
16490 EOP
16491         set try
16492         if eval $compile_ok; then
16493                 val="$define"
16494         else
16495                 echo "But you don't seem to have a useable struct sigaction." >&4
16496                 val="$undef"
16497         fi
16498 else
16499         echo 'sigaction NOT found.' >&4
16500         val="$undef"
16501 fi
16502 set d_sigaction; eval $setvar
16503 $rm -f try try$_o try.c
16504
16505 : see if sigprocmask exists
16506 set sigprocmask d_sigprocmask
16507 eval $inlibc
16508
16509 : see if sigsetjmp exists
16510 echo " "
16511 case "$d_sigsetjmp" in
16512 '')
16513         $cat >try.c <<EOP
16514 #include <setjmp.h>
16515 #$i_stdlib I_STDLIB
16516 #ifdef I_STDLIB
16517 #include <stdlib.h>
16518 #endif
16519 sigjmp_buf env;
16520 int set = 1;
16521 int main()
16522 {
16523         if (sigsetjmp(env,1))
16524                 exit(set);
16525         set = 0;
16526         siglongjmp(env, 1);
16527         exit(1);
16528 }
16529 EOP
16530         set try
16531         if eval $compile; then
16532                 if $run ./try >/dev/null 2>&1; then
16533                         echo "POSIX sigsetjmp found." >&4
16534                         val="$define"
16535                 else
16536                         $cat >&4 <<EOM
16537 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16538 I'll ignore them.
16539 EOM
16540                         val="$undef"
16541                 fi
16542         else
16543                 echo "sigsetjmp not found." >&4
16544                 val="$undef"
16545         fi
16546         ;;
16547 *) val="$d_sigsetjmp"
16548         case "$d_sigsetjmp" in
16549         $define) echo "POSIX sigsetjmp found." >&4;;
16550         $undef) echo "sigsetjmp not found." >&4;;
16551         esac
16552         ;;
16553 esac
16554 set d_sigsetjmp
16555 eval $setvar
16556 $rm -f try.c try
16557
16558 : see if snprintf exists
16559 set snprintf d_snprintf
16560 eval $inlibc
16561
16562 : see if vsnprintf exists
16563 set vsnprintf d_vsnprintf
16564 eval $inlibc
16565
16566 case "$d_snprintf-$d_vsnprintf" in
16567 "$define-$define")
16568     $cat <<EOM
16569 Checking whether your snprintf() and vsnprintf() work okay...
16570 EOM
16571     $cat >try.c <<'EOCP'
16572 /* v?snprintf testing logic courtesy of Russ Allbery.
16573  * According to C99:
16574  * - if the buffer is too short it still must be \0-terminated
16575  * - if the buffer is too short the potentially required length
16576  *   must be returned and not -1
16577  * - if the buffer is NULL the potentially required length
16578  *   must be returned and not -1 or core dump
16579  */
16580 #include <stdio.h>
16581 #include <stdarg.h>
16582
16583 char buf[2];
16584
16585 int test (char *format, ...)
16586 {
16587     va_list args;
16588     int count;
16589
16590     va_start (args, format);
16591     count = vsnprintf (buf, sizeof buf, format, args);
16592     va_end (args);
16593     return count;
16594 }
16595
16596 int main ()
16597 {
16598     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16599              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16600 }
16601 EOCP
16602     set try
16603     if eval $compile; then
16604         `$run ./try`
16605         case "$?" in
16606         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16607         *) cat <<EOM >&4
16608 Your snprintf() and snprintf() don't seem to be working okay.
16609 EOM
16610            d_snprintf="$undef"
16611            d_vsnprintf="$undef"
16612            ;;
16613         esac
16614     else
16615         echo "(I can't seem to compile the test program--assuming they don't)"
16616         d_snprintf="$undef"
16617         d_vsnprintf="$undef"
16618     fi
16619     $rm -f try.* try core core.try.*
16620     ;;
16621 esac
16622
16623 : see if sockatmark exists
16624 set sockatmark d_sockatmark
16625 eval $inlibc
16626
16627 : see if prototype for sockatmark is available
16628 echo " "
16629 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16630 eval $hasproto
16631
16632 : see if socks5_init exists
16633 set socks5_init d_socks5_init
16634 eval $inlibc
16635
16636 : see if sprintf returns the length of the string in the buffer as per ANSI
16637 $echo "Checking whether sprintf returns the length of the string..." >&4
16638 $cat <<EOP >try.c
16639 #include <stdio.h>
16640 #$i_stdlib I_STDLIB
16641 #ifdef I_STDLIB
16642 #include <stdlib.h>
16643 #endif
16644 #$i_string I_STRING
16645 #ifdef I_STRING
16646 #  include <string.h>
16647 #else
16648 #  include <strings.h>
16649 #endif
16650 #$i_math I_MATH
16651 #ifdef I_MATH
16652 #include <math.h>
16653 #endif
16654
16655 char buffer[256];
16656
16657 int check (size_t expect, int test) {
16658   size_t got = strlen(buffer);
16659   if (expect == got)
16660     return 0;
16661
16662   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16663        test, buffer);
16664   exit (test);
16665 }
16666
16667 int main(int argc, char **argv) {
16668   int test = 0;
16669
16670   check(sprintf(buffer, ""), ++test);
16671   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16672   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16673
16674   return 0;
16675 }
16676 EOP
16677 set try
16678
16679 d_sprintf_returns_strlen="$undef"
16680 if eval $compile; then
16681     xxx="`$run ./try`"
16682     case "$?" in
16683         0) cat >&4 <<EOM
16684 sprintf returns the length of the string (as ANSI says it should)
16685 EOM
16686         d_sprintf_returns_strlen="$define"
16687         ;;
16688         *) cat >&4 <<EOM
16689 sprintf does not return the length of the string (how old is this system?)
16690 EOM
16691         d_sprintf_returns_strlen="$undef"
16692         ;;
16693     esac
16694 fi
16695
16696 $rm -f try.* try
16697
16698 : see if srand48_r exists
16699 set srand48_r d_srand48_r
16700 eval $inlibc
16701 case "$d_srand48_r" in
16702 "$define")
16703         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16704         case "$d_srand48_r_proto:$usethreads" in
16705         ":define")      d_srand48_r_proto=define
16706                 set d_srand48_r_proto srand48_r $hdrs
16707                 eval $hasproto ;;
16708         *)      ;;
16709         esac
16710         case "$d_srand48_r_proto" in
16711         define)
16712         case "$srand48_r_proto" in
16713         ''|0) try='int srand48_r(long, struct drand48_data*);'
16714         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16715         esac
16716         case "$srand48_r_proto" in
16717         ''|0)   d_srand48_r=undef
16718                 srand48_r_proto=0
16719                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16720         * )     case "$srand48_r_proto" in
16721                 REENTRANT_PROTO*) ;;
16722                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16723                 esac
16724                 echo "Prototype: $try" ;;
16725         esac
16726         ;;
16727         *)      case "$usethreads" in
16728                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16729                 esac
16730                 d_srand48_r=undef
16731                 srand48_r_proto=0
16732                 ;;
16733         esac
16734         ;;
16735 *)      srand48_r_proto=0
16736         ;;
16737 esac
16738
16739 : see if srandom_r exists
16740 set srandom_r d_srandom_r
16741 eval $inlibc
16742 case "$d_srandom_r" in
16743 "$define")
16744         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16745         case "$d_srandom_r_proto:$usethreads" in
16746         ":define")      d_srandom_r_proto=define
16747                 set d_srandom_r_proto srandom_r $hdrs
16748                 eval $hasproto ;;
16749         *)      ;;
16750         esac
16751         case "$d_srandom_r_proto" in
16752         define)
16753         case "$srandom_r_proto" in
16754         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16755         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16756         esac
16757         case "$srandom_r_proto" in
16758         ''|0)   d_srandom_r=undef
16759                 srandom_r_proto=0
16760                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16761         * )     case "$srandom_r_proto" in
16762                 REENTRANT_PROTO*) ;;
16763                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16764                 esac
16765                 echo "Prototype: $try" ;;
16766         esac
16767         ;;
16768         *)      case "$usethreads" in
16769                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16770                 esac
16771                 d_srandom_r=undef
16772                 srandom_r_proto=0
16773                 ;;
16774         esac
16775         ;;
16776 *)      srandom_r_proto=0
16777         ;;
16778 esac
16779
16780 : see if prototype for setresgid is available
16781 echo " "
16782 set d_sresgproto setresgid $i_unistd unistd.h
16783 eval $hasproto
16784
16785 : see if prototype for setresuid is available
16786 echo " "
16787 set d_sresuproto setresuid $i_unistd unistd.h
16788 eval $hasproto
16789
16790 : see if sys/stat.h is available
16791 set sys/stat.h i_sysstat
16792 eval $inhdr
16793
16794
16795 : see if stat knows about block sizes
16796 echo " "
16797 echo "Checking to see if your struct stat has st_blocks field..." >&4
16798 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16799 eval $hasfield
16800
16801
16802 : see if this is a sys/vfs.h system
16803 set sys/vfs.h i_sysvfs
16804 eval $inhdr
16805
16806
16807 : see if this is a sys/statfs.h system
16808 set sys/statfs.h i_sysstatfs
16809 eval $inhdr
16810
16811
16812 echo " "
16813 echo "Checking to see if your system supports struct statfs..." >&4
16814 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
16815 eval $hasstruct
16816 case "$d_statfs_s" in
16817 "$define")      echo "Yes, it does."   ;;
16818 *)              echo "No, it doesn't." ;;
16819 esac
16820
16821
16822
16823 : see if struct statfs knows about f_flags
16824 case "$d_statfs_s" in
16825 define) 
16826         echo " "
16827         echo "Checking to see if your struct statfs has f_flags field..." >&4
16828         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
16829         eval $hasfield
16830         ;;
16831 *)      val="$undef"
16832         set d_statfs_f_flags
16833         eval $setvar
16834         ;;
16835 esac
16836 case "$d_statfs_f_flags" in
16837 "$define")      echo "Yes, it does."   ;;
16838 *)              echo "No, it doesn't." ;;
16839 esac
16840
16841 $cat >&4 <<EOM
16842 Checking how to access stdio streams by file descriptor number...
16843 EOM
16844 case "$stdio_stream_array" in
16845 '')     $cat >try.c <<EOCP
16846 #include <stdio.h>
16847 int main() {
16848   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16849     printf("yes\n");
16850 }
16851 EOCP
16852         for s in _iob __iob __sF
16853         do
16854                 set try -DSTDIO_STREAM_ARRAY=$s
16855                 if eval $compile; then
16856                         case "`$run ./try`" in
16857                         yes)    stdio_stream_array=$s; break ;;
16858                         esac
16859                 fi
16860         done
16861         $rm -f try.* try$exe_ext
16862 esac
16863 case "$stdio_stream_array" in
16864 '')     $cat >&4 <<EOM
16865 I can't figure out how to access stdio streams by file descriptor number.
16866 EOM
16867         d_stdio_stream_array="$undef"
16868         ;;
16869 *)      $cat >&4 <<EOM
16870 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16871 EOM
16872         d_stdio_stream_array="$define"
16873         ;;
16874 esac
16875
16876 : see if strcoll exists
16877 set strcoll d_strcoll
16878 eval $inlibc
16879
16880 : check for structure copying
16881 echo " "
16882 echo "Checking to see if your C compiler can copy structs..." >&4
16883 $cat >try.c <<'EOCP'
16884 int main()
16885 {
16886         struct blurfl {
16887                 int dyick;
16888         } foo, bar;
16889
16890         foo = bar;
16891 }
16892 EOCP
16893 if $cc -c try.c >/dev/null 2>&1 ; then
16894         val="$define"
16895         echo "Yup, it can."
16896 else
16897         val="$undef"
16898         echo "Nope, it can't."
16899 fi
16900 set d_strctcpy
16901 eval $setvar
16902 $rm -f try.*
16903
16904 : see if strerror and/or sys_errlist[] exist
16905 echo " "
16906 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16907     if set strerror val -f d_strerror; eval $csym; $val; then
16908                 echo 'strerror() found.' >&4
16909                 d_strerror="$define"
16910                 d_strerrm='strerror(e)'
16911                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16912                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16913                         d_syserrlst="$define"
16914                 else
16915                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16916                         d_syserrlst="$undef"
16917                 fi
16918     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16919                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16920                 echo 'strerror() found in string header.' >&4
16921                 d_strerror="$define"
16922                 d_strerrm='strerror(e)'
16923                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16924                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16925                                 d_syserrlst="$define"
16926                 else
16927                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16928                         d_syserrlst="$undef"
16929                 fi
16930     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16931                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16932                 d_strerror="$undef"
16933                 d_syserrlst="$define"
16934                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16935     else
16936                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16937                 d_strerror="$undef"
16938                 d_syserrlst="$undef"
16939                 d_strerrm='"unknown"'
16940     fi
16941 fi
16942
16943 : see if strerror_r exists
16944 set strerror_r d_strerror_r
16945 eval $inlibc
16946 case "$d_strerror_r" in
16947 "$define")
16948         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16949         case "$d_strerror_r_proto:$usethreads" in
16950         ":define")      d_strerror_r_proto=define
16951                 set d_strerror_r_proto strerror_r $hdrs
16952                 eval $hasproto ;;
16953         *)      ;;
16954         esac
16955         case "$d_strerror_r_proto" in
16956         define)
16957         case "$strerror_r_proto" in
16958         ''|0) try='int strerror_r(int, char*, size_t);'
16959         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16960         esac
16961         case "$strerror_r_proto" in
16962         ''|0) try='int strerror_r(int, char*, int);'
16963         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16964         esac
16965         case "$strerror_r_proto" in
16966         ''|0) try='char* strerror_r(int, char*, size_t);'
16967         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16968         esac
16969         case "$strerror_r_proto" in
16970         ''|0)   d_strerror_r=undef
16971                 strerror_r_proto=0
16972                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16973         * )     case "$strerror_r_proto" in
16974                 REENTRANT_PROTO*) ;;
16975                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16976                 esac
16977                 echo "Prototype: $try" ;;
16978         esac
16979         ;;
16980         *)      case "$usethreads" in
16981                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16982                 esac
16983                 d_strerror_r=undef
16984                 strerror_r_proto=0
16985                 ;;
16986         esac
16987         ;;
16988 *)      strerror_r_proto=0
16989         ;;
16990 esac
16991
16992 : see if strftime exists
16993 set strftime d_strftime
16994 eval $inlibc
16995
16996 : see if strlcat exists
16997 set strlcat d_strlcat
16998 eval $inlibc
16999
17000 : see if strlcpy exists
17001 set strlcpy d_strlcpy
17002 eval $inlibc
17003
17004 : see if strtod exists
17005 set strtod d_strtod
17006 eval $inlibc
17007
17008 : see if strtol exists
17009 set strtol d_strtol
17010 eval $inlibc
17011
17012 : see if strtold exists
17013 set strtold d_strtold
17014 eval $inlibc
17015
17016 : see if strtoll exists
17017 set strtoll d_strtoll
17018 eval $inlibc
17019
17020 case "$d_longlong-$d_strtoll" in
17021 "$define-$define")
17022         $cat <<EOM
17023 Checking whether your strtoll() works okay...
17024 EOM
17025         $cat >try.c <<'EOCP'
17026 #include <errno.h>
17027 #ifdef __hpux
17028 #define strtoll __strtoll
17029 #endif
17030 #ifdef __EMX__
17031 #define strtoll _strtoll
17032 #endif
17033 #include <stdio.h>
17034 extern long long int strtoll(char *s, char **, int); 
17035 static int bad = 0;
17036 int check(char *s, long long ell, int een) {
17037         long long gll;
17038         errno = 0;
17039         gll = strtoll(s, 0, 10);
17040         if (!((gll == ell) && (errno == een)))
17041                 bad++;
17042 }
17043 int main() {
17044         check(" 1",                                      1LL, 0);
17045         check(" 0",                                      0LL, 0);
17046         check("-1",                                     -1LL, 0);
17047         check("-9223372036854775808", -9223372036854775808LL, 0);
17048         check("-9223372036854775808", -9223372036854775808LL, 0);
17049         check(" 9223372036854775807",  9223372036854775807LL, 0);
17050         check("-9223372036854775808", -9223372036854775808LL, 0);
17051         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17052         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17053         if (!bad)
17054                 printf("ok\n");
17055 }
17056 EOCP
17057         set try
17058         if eval $compile; then
17059                 yyy=`$run ./try`
17060                 case "$yyy" in
17061                 ok) echo "Your strtoll() seems to be working okay." ;;
17062                 *) cat <<EOM >&4
17063 Your strtoll() doesn't seem to be working okay.
17064 EOM
17065                    d_strtoll="$undef"
17066                    ;;
17067                 esac
17068         else
17069                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17070                 d_strtoll="$undef"
17071         fi
17072         ;;
17073 esac
17074
17075 : see if strtoq exists
17076 set strtoq d_strtoq
17077 eval $inlibc
17078
17079 : see if strtoul exists
17080 set strtoul d_strtoul
17081 eval $inlibc
17082
17083 case "$d_strtoul" in
17084 "$define")
17085         $cat <<EOM
17086 Checking whether your strtoul() works okay...
17087 EOM
17088         $cat >try.c <<'EOCP'
17089 #include <errno.h>
17090 #include <stdio.h>
17091 extern unsigned long int strtoul(char *s, char **, int); 
17092 static int bad = 0;
17093 void check(char *s, unsigned long eul, int een) {
17094         unsigned long gul;
17095         errno = 0;
17096         gul = strtoul(s, 0, 10);
17097         if (!((gul == eul) && (errno == een)))
17098                 bad++;
17099 }
17100 int main() {
17101         check(" 1", 1L, 0);
17102         check(" 0", 0L, 0);
17103 EOCP
17104         case "$longsize" in
17105         8)
17106             $cat >>try.c <<'EOCP'
17107         check("18446744073709551615", 18446744073709551615UL, 0);
17108         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17109 #if 0 /* strtoul() for /^-/ strings is undefined. */
17110         check("-1", 18446744073709551615UL, 0);
17111         check("-18446744073709551614", 2, 0);
17112         check("-18446744073709551615", 1, 0);
17113         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17114         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17115 #endif
17116 EOCP
17117                 ;;
17118         4)
17119                     $cat >>try.c <<'EOCP'
17120         check("4294967295", 4294967295UL, 0);
17121         check("4294967296", 4294967295UL, ERANGE);
17122 #if 0 /* strtoul() for /^-/ strings is undefined. */
17123         check("-1", 4294967295UL, 0);
17124         check("-4294967294", 2, 0);
17125         check("-4294967295", 1, 0);
17126         check("-4294967296", 4294967295UL, ERANGE);
17127         check("-4294967297", 4294967295UL, ERANGE);
17128 #endif
17129 EOCP
17130                 ;;
17131         *)
17132 : Should we write these tests to be more portable by sprintf-ing
17133 : ~0 and then manipulating that char string as input for strtol?
17134                 ;;
17135         esac
17136         $cat >>try.c <<'EOCP'
17137         if (!bad)
17138                 printf("ok\n");
17139         return 0;
17140 }
17141 EOCP
17142         set try
17143         if eval $compile; then
17144                 case "`$run ./try`" in
17145                 ok) echo "Your strtoul() seems to be working okay." ;;
17146                 *) cat <<EOM >&4
17147 Your strtoul() doesn't seem to be working okay.
17148 EOM
17149                    d_strtoul="$undef"
17150                    ;;
17151                 esac
17152         fi
17153         ;;
17154 esac
17155
17156 : see if strtoull exists
17157 set strtoull d_strtoull
17158 eval $inlibc
17159
17160 case "$d_longlong-$d_strtoull" in
17161 "$define-$define")
17162         $cat <<EOM
17163 Checking whether your strtoull() works okay...
17164 EOM
17165         $cat >try.c <<'EOCP'
17166 #include <errno.h>
17167 #ifdef __hpux
17168 #define strtoull __strtoull
17169 #endif
17170 #include <stdio.h>
17171 extern unsigned long long int strtoull(char *s, char **, int); 
17172 static int bad = 0;
17173 int check(char *s, long long eull, int een) {
17174         long long gull;
17175         errno = 0;
17176         gull = strtoull(s, 0, 10);
17177         if (!((gull == eull) && (errno == een)))
17178                 bad++;
17179 }
17180 int main() {
17181         check(" 1",                                        1LL, 0);
17182         check(" 0",                                        0LL, 0);
17183         check("18446744073709551615",  18446744073709551615ULL, 0);
17184         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17185 #if 0 /* strtoull() for /^-/ strings is undefined. */
17186         check("-1",                    18446744073709551615ULL, 0);
17187         check("-18446744073709551614",                     2LL, 0);
17188         check("-18446744073709551615",                     1LL, 0);
17189         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17190         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17191 #endif
17192         if (!bad)
17193                 printf("ok\n");
17194 }
17195 EOCP
17196         set try
17197         if eval $compile; then
17198                 case "`$run ./try`" in
17199                 ok) echo "Your strtoull() seems to be working okay." ;;
17200                 *) cat <<EOM >&4
17201 Your strtoull() doesn't seem to be working okay.
17202 EOM
17203                    d_strtoull="$undef"
17204                    ;;
17205                 esac
17206         fi
17207         ;;
17208 esac
17209
17210 : see if strtouq exists
17211 set strtouq d_strtouq
17212 eval $inlibc
17213
17214 case "$d_strtouq" in
17215 "$define")
17216         $cat <<EOM
17217 Checking whether your strtouq() works okay...
17218 EOM
17219         $cat >try.c <<'EOCP'
17220 #include <errno.h>
17221 #include <stdio.h>
17222 extern unsigned long long int strtouq(char *s, char **, int); 
17223 static int bad = 0;
17224 void check(char *s, unsigned long long eull, int een) {
17225         unsigned long long gull;
17226         errno = 0;
17227         gull = strtouq(s, 0, 10);
17228         if (!((gull == eull) && (errno == een)))
17229                 bad++;
17230 }
17231 int main() {
17232         check(" 1",                                        1LL, 0);
17233         check(" 0",                                        0LL, 0);
17234         check("18446744073709551615",  18446744073709551615ULL, 0);
17235         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17236 #if 0 /* strtouq() for /^-/ strings is undefined. */
17237         check("-1",                    18446744073709551615ULL, 0);
17238         check("-18446744073709551614",                     2LL, 0);
17239         check("-18446744073709551615",                     1LL, 0);
17240         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17241         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17242 #endif
17243         if (!bad)
17244                 printf("ok\n");
17245         return 0;
17246 }
17247 EOCP
17248         set try
17249         if eval $compile; then
17250                 case "`$run ./try`" in
17251                 ok) echo "Your strtouq() seems to be working okay." ;;
17252                 *) cat <<EOM >&4
17253 Your strtouq() doesn't seem to be working okay.
17254 EOM
17255                    d_strtouq="$undef"
17256                    ;;
17257                 esac
17258         fi
17259         ;;
17260 esac
17261
17262 : see if strxfrm exists
17263 set strxfrm d_strxfrm
17264 eval $inlibc
17265
17266 : see if symlink exists
17267 set symlink d_symlink
17268 eval $inlibc
17269
17270 : see if syscall exists
17271 set syscall d_syscall
17272 eval $inlibc
17273
17274 : see if prototype for syscall is available
17275 echo " "
17276 set d_syscallproto syscall $i_unistd unistd.h
17277 eval $hasproto
17278
17279 : see if sysconf exists
17280 set sysconf d_sysconf
17281 eval $inlibc
17282
17283 : see if system exists
17284 set system d_system
17285 eval $inlibc
17286
17287 : see if tcgetpgrp exists
17288 set tcgetpgrp d_tcgetpgrp
17289 eval $inlibc
17290
17291 : see if tcsetpgrp exists
17292 set tcsetpgrp d_tcsetpgrp
17293 eval $inlibc
17294
17295 : see if prototype for telldir is available
17296 echo " "
17297 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17298 eval $hasproto
17299
17300 : see if time exists
17301 echo " "
17302 if test "X$d_time" = X -o X"$timetype" = X; then
17303     if set time val -f d_time; eval $csym; $val; then
17304                 echo 'time() found.' >&4
17305                 val="$define"
17306                 rp="What is the type returned by time() on this system?"
17307                 set time_t timetype long stdio.h sys/types.h
17308                 eval $typedef_ask
17309     else
17310                 echo 'time() not found, hope that will do.' >&4
17311                 val="$undef"
17312                 timetype='int';
17313     fi
17314     set d_time
17315     eval $setvar
17316 fi
17317
17318 : see if this is a sys/times.h system
17319 set sys/times.h i_systimes
17320 eval $inhdr
17321
17322 : see if times exists
17323 echo " "
17324 if set times val -f d_times; eval $csym; $val; then
17325         echo 'times() found.' >&4
17326         d_times="$define"
17327         inc=''
17328         case "$i_systimes" in
17329         "$define") inc='sys/times.h';;
17330         esac
17331         rp="What is the type returned by times() on this system?"
17332         set clock_t clocktype long stdio.h sys/types.h $inc
17333         eval $typedef_ask
17334 else
17335         echo 'times() NOT found, hope that will do.' >&4
17336         d_times="$undef"
17337         clocktype='int'
17338 fi
17339
17340 : see if tmpnam_r exists
17341 set tmpnam_r d_tmpnam_r
17342 eval $inlibc
17343 case "$d_tmpnam_r" in
17344 "$define")
17345         hdrs="$i_systypes sys/types.h define stdio.h "
17346         case "$d_tmpnam_r_proto:$usethreads" in
17347         ":define")      d_tmpnam_r_proto=define
17348                 set d_tmpnam_r_proto tmpnam_r $hdrs
17349                 eval $hasproto ;;
17350         *)      ;;
17351         esac
17352         case "$d_tmpnam_r_proto" in
17353         define)
17354         case "$tmpnam_r_proto" in
17355         ''|0) try='char* tmpnam_r(char*);'
17356         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17357         esac
17358         case "$tmpnam_r_proto" in
17359         ''|0)   d_tmpnam_r=undef
17360                 tmpnam_r_proto=0
17361                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17362         * )     case "$tmpnam_r_proto" in
17363                 REENTRANT_PROTO*) ;;
17364                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17365                 esac
17366                 echo "Prototype: $try" ;;
17367         esac
17368         ;;
17369         *)      case "$usethreads" in
17370                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17371                 esac
17372                 d_tmpnam_r=undef
17373                 tmpnam_r_proto=0
17374                 ;;
17375         esac
17376         ;;
17377 *)      tmpnam_r_proto=0
17378         ;;
17379 esac
17380
17381 : see if truncate exists
17382 set truncate d_truncate
17383 eval $inlibc
17384
17385 : see if ttyname_r exists
17386 set ttyname_r d_ttyname_r
17387 eval $inlibc
17388 case "$d_ttyname_r" in
17389 "$define")
17390         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17391         case "$d_ttyname_r_proto:$usethreads" in
17392         ":define")      d_ttyname_r_proto=define
17393                 set d_ttyname_r_proto ttyname_r $hdrs
17394                 eval $hasproto ;;
17395         *)      ;;
17396         esac
17397         case "$d_ttyname_r_proto" in
17398         define)
17399         case "$ttyname_r_proto" in
17400         ''|0) try='int ttyname_r(int, char*, size_t);'
17401         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17402         esac
17403         case "$ttyname_r_proto" in
17404         ''|0) try='int ttyname_r(int, char*, int);'
17405         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17406         esac
17407         case "$ttyname_r_proto" in
17408         ''|0) try='char* ttyname_r(int, char*, int);'
17409         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17410         esac
17411         case "$ttyname_r_proto" in
17412         ''|0)   d_ttyname_r=undef
17413                 ttyname_r_proto=0
17414                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17415         * )     case "$ttyname_r_proto" in
17416                 REENTRANT_PROTO*) ;;
17417                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17418                 esac
17419                 echo "Prototype: $try" ;;
17420         esac
17421         ;;
17422         *)      case "$usethreads" in
17423                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17424                 esac
17425                 d_ttyname_r=undef
17426                 ttyname_r_proto=0
17427                 ;;
17428         esac
17429         ;;
17430 *)      ttyname_r_proto=0
17431         ;;
17432 esac
17433
17434 : see if tzname[] exists
17435 echo " "
17436 if set tzname val -a d_tzname; eval $csym; $val; then
17437         val="$define"
17438         echo 'tzname[] found.' >&4
17439 else
17440         val="$undef"
17441         echo 'tzname[] NOT found.' >&4
17442 fi
17443 set d_tzname
17444 eval $setvar
17445
17446 case "$osname" in
17447 next|rhapsody|darwin) multiarch="$define" ;;
17448 esac
17449 case "$multiarch" in
17450 ''|[nN]*) multiarch="$undef" ;;
17451 esac
17452
17453 : check for ordering of bytes in a UV
17454 echo " "
17455 case "$usecrosscompile$multiarch" in
17456 *$define*)
17457         $cat <<EOM
17458 You seem to be either cross-compiling or doing a multiarchitecture build,
17459 skipping the byteorder check.
17460
17461 EOM
17462         byteorder='ffff'
17463         ;;
17464 *)
17465         case "$byteorder" in
17466         '')
17467                 $cat <<'EOM'
17468 In the following, larger digits indicate more significance.  A big-endian
17469 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17470 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17471 machines may have weird orders like 3412.  A Cray will report 87654321,
17472 an Alpha will report 12345678. If the test program works the default is
17473 probably right.
17474 I'm now running the test program...
17475 EOM
17476                 $cat >try.c <<EOCP
17477 #include <stdio.h>
17478 #$i_stdlib I_STDLIB
17479 #ifdef I_STDLIB
17480 #include <stdlib.h>
17481 #endif
17482 #include <sys/types.h>
17483 typedef $uvtype UV;
17484 int main()
17485 {
17486         int i;
17487         union {
17488                 UV l;
17489                 char c[$uvsize];
17490         } u;
17491
17492         if ($uvsize > 4)
17493                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17494         else
17495                 u.l = (UV)0x04030201;
17496         for (i = 0; i < $uvsize; i++)
17497                 printf("%c", u.c[i]+'0');
17498         printf("\n");
17499         exit(0);
17500 }
17501 EOCP
17502                 xxx_prompt=y
17503                 set try
17504                 if eval $compile && ./try > /dev/null; then
17505                         dflt=`$run ./try`
17506                         case "$dflt" in
17507                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17508                                 echo "(The test program ran ok.)"
17509                                 echo "byteorder=$dflt"
17510                                 xxx_prompt=n
17511                         ;;
17512                         ????|????????) echo "(The test program ran ok.)" ;;
17513                         *) echo "(The test program didn't run right for some reason.)" ;;
17514                         esac
17515                 else
17516                         dflt='4321'
17517                         cat <<'EOM'
17518 (I can't seem to compile the test program.  Guessing big-endian...)
17519 EOM
17520                 fi
17521                 case "$xxx_prompt" in
17522                 y)
17523                         rp="What is the order of bytes in $uvtype?"
17524                         . ./myread
17525                         byteorder="$ans"
17526                         ;;
17527                 *)      byteorder=$dflt
17528                         ;;
17529                 esac
17530                 ;;
17531         esac
17532         $rm -f try.c try
17533         ;;
17534 esac
17535
17536
17537 $cat <<EOM
17538
17539 Checking to see whether you can access character data unalignedly...
17540 EOM
17541 case "$d_u32align" in
17542 '')   $cat >try.c <<EOCP
17543 #include <stdio.h>
17544 #$i_stdlib I_STDLIB
17545 #ifdef I_STDLIB
17546 #include <stdlib.h>
17547 #endif
17548 #define U32 $u32type
17549 #define BYTEORDER 0x$byteorder
17550 #define U8 $u8type
17551 #include <signal.h>
17552 #ifdef SIGBUS
17553 $signal_t bletch(s) int s; { exit(4); }
17554 #endif
17555 int main() {
17556 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17557     U8 buf[8];
17558     U32 *up;
17559     int i;
17560
17561     if (sizeof(U32) != 4) {
17562         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17563         exit(1);
17564     }
17565
17566     fflush(stdout);
17567
17568 #ifdef SIGBUS
17569     signal(SIGBUS, bletch);
17570 #endif
17571
17572     buf[0] = 0;
17573     buf[1] = 0;
17574     buf[2] = 0;
17575     buf[3] = 1;
17576     buf[4] = 0;
17577     buf[5] = 0;
17578     buf[6] = 0;
17579     buf[7] = 1;
17580
17581     for (i = 0; i < 4; i++) {
17582         up = (U32*)(buf + i);
17583         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17584                (*up == 1 << (8*(3-i)))  /* little-endian */
17585               )
17586            )
17587         {
17588             printf("read failed (%x)\n", *up);
17589             exit(2);
17590         }
17591     }
17592
17593     /* write test */
17594     for (i = 0; i < 4; i++) {
17595         up = (U32*)(buf + i);
17596         *up = 0xBeef;
17597         if (*up != 0xBeef) {
17598             printf("write failed (%x)\n", *up);
17599             exit(3);
17600         }
17601     }
17602
17603     exit(0);
17604 #else
17605     printf("1\n");
17606     exit(1);
17607 #endif
17608     return 0;
17609 }
17610 EOCP
17611 set try
17612 if eval $compile_ok; then
17613         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17614         $run ./try 2>&1 >/dev/null
17615         case "$?" in
17616         0)      cat >&4 <<EOM
17617 You can access character data pretty unalignedly.
17618 EOM
17619                 d_u32align="$undef"
17620                 ;;
17621         *)      cat >&4 <<EOM
17622 It seems that you must access character data in an aligned manner.
17623 EOM
17624                 d_u32align="$define"
17625                 ;;
17626         esac
17627 else
17628         rp='Can you access character data at unaligned addresses?'
17629         dflt='n'
17630         . ./myread
17631         case "$ans" in
17632         [yY]*)  d_u32align="$undef"  ;;
17633         *)      d_u32align="$define" ;;
17634         esac
17635 fi
17636 $rm -f core core.try.* try.core
17637 ;;
17638 esac
17639
17640 : see if ualarm exists
17641 set ualarm d_ualarm
17642 eval $inlibc
17643
17644 : see if umask exists
17645 set umask d_umask
17646 eval $inlibc
17647
17648 : see if unordered exists
17649 set unordered d_unordered
17650 eval $inlibc
17651
17652 : see if unsetenv exists
17653 set unsetenv d_unsetenv
17654 eval $inlibc
17655
17656 : see if usleep exists
17657 set usleep d_usleep
17658 eval $inlibc
17659
17660 : see if prototype for usleep is available
17661 echo " "
17662 set d_usleepproto usleep $i_unistd unistd.h
17663 eval $hasproto
17664
17665 : see if ustat exists
17666 set ustat d_ustat
17667 eval $inlibc
17668
17669 : backward compatibility for d_hvfork
17670 if test X$d_hvfork != X; then
17671         d_vfork="$d_hvfork"
17672         d_hvfork=''
17673 fi
17674 : see if there is a vfork
17675 val=''
17676 set vfork val
17677 eval $inlibc
17678
17679 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17680 : perl on Solaris 2.x, and probably elsewhere.
17681 case "$val" in
17682 $define)
17683         echo " "
17684         case "$usevfork" in
17685         false) dflt='n';;
17686         *) dflt='y';;
17687         esac
17688         cat <<'EOM'
17689  
17690 Perl can only use a vfork() that doesn't suffer from strict
17691 restrictions on calling functions or modifying global data in
17692 the child.  For example, glibc-2.1 contains such a vfork()
17693 that is unsuitable.  If your system provides a proper fork()
17694 call, chances are that you do NOT want perl to use vfork().
17695
17696 EOM
17697         rp="Do you still want to use vfork()?"
17698         . ./myread
17699         case "$ans" in
17700         y|Y) ;;
17701         *)
17702                 echo "Ok, we won't use vfork()."
17703                 val="$undef"
17704                 ;;
17705         esac
17706         ;;
17707 esac
17708 set d_vfork
17709 eval $setvar
17710 case "$d_vfork" in
17711 $define) usevfork='true';;
17712 *) usevfork='false';;
17713 esac
17714
17715 : see if closedir exists
17716 set closedir d_closedir
17717 eval $inlibc
17718
17719 case "$d_closedir" in
17720 "$define")
17721         echo " "
17722         echo "Checking whether closedir() returns a status..." >&4
17723         cat > try.c <<EOM
17724 #$i_dirent I_DIRENT             /**/
17725 #$i_sysdir I_SYS_DIR            /**/
17726 #$i_sysndir I_SYS_NDIR          /**/
17727 #$i_systypes I_SYS_TYPES        /**/
17728
17729 #if defined(I_SYS_TYPES)
17730 #include <sys/types.h>
17731 #endif
17732 #if defined(I_DIRENT)
17733 #include <dirent.h>
17734 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17735 #include <sys/dir.h>
17736 #endif
17737 #else
17738 #ifdef I_SYS_NDIR
17739 #include <sys/ndir.h>
17740 #else
17741 #ifdef I_SYS_DIR
17742 #ifdef hp9000s500
17743 #include <ndir.h>       /* may be wrong in the future */
17744 #else
17745 #include <sys/dir.h>
17746 #endif
17747 #endif
17748 #endif
17749 #endif 
17750 int main() { return closedir(opendir(".")); }
17751 EOM
17752         set try
17753         if eval $compile_ok; then
17754                 if $run ./try > /dev/null 2>&1 ; then
17755                         echo "Yes, it does."
17756                         val="$undef"
17757                 else
17758                         echo "No, it doesn't."
17759                         val="$define"
17760                 fi
17761         else
17762                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17763                 val="$define"
17764         fi
17765         ;;
17766 *)
17767         val="$undef";
17768         ;;
17769 esac
17770 set d_void_closedir
17771 eval $setvar
17772 $rm -f try try.*
17773 : see if there is a wait4
17774 set wait4 d_wait4
17775 eval $inlibc
17776
17777 : see if waitpid exists
17778 set waitpid d_waitpid
17779 eval $inlibc
17780
17781 : see if wcstombs exists
17782 set wcstombs d_wcstombs
17783 eval $inlibc
17784
17785 : see if wctomb exists
17786 set wctomb d_wctomb
17787 eval $inlibc
17788
17789 : see if writev exists
17790 set writev d_writev
17791 eval $inlibc
17792
17793 : preserve RCS keywords in files with variable substitution, grrr
17794 Date='$Date'
17795 Id='$Id'
17796 Log='$Log'
17797 RCSfile='$RCSfile'
17798 Revision='$Revision'
17799
17800 : check for alignment requirements
17801 echo " "
17802 case "$usecrosscompile$multiarch" in
17803 *$define*)
17804         $cat <<EOM
17805 You seem to be either cross-compiling or doing a multiarchitecture build,
17806 skipping the memory alignment check.
17807
17808 EOM
17809         case "$alignbytes" in
17810         '') alignbytes=8 ;;
17811         esac
17812         ;;
17813 *)
17814         case "$alignbytes" in
17815         '') echo "Checking alignment constraints..." >&4
17816                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17817                         $cat >try.c <<'EOCP'
17818 typedef long double NV;
17819 EOCP
17820                 else
17821                         $cat >try.c <<'EOCP'
17822 typedef double NV;
17823 EOCP
17824                 fi
17825                 $cat >>try.c <<'EOCP'
17826 #include <stdio.h>
17827 struct foobar {
17828         char foo;
17829         NV bar;
17830 } try_algn;
17831 int main()
17832 {
17833     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17834     return(0);
17835 }
17836 EOCP
17837                 set try
17838                 if eval $compile_ok; then
17839                         dflt=`$run ./try`
17840                 else
17841                         dflt='8'
17842                         echo "(I can't seem to compile the test program...)"
17843                 fi
17844                 ;;
17845         *) dflt="$alignbytes"
17846                 ;;
17847         esac
17848         rp="Doubles must be aligned on a how-many-byte boundary?"
17849         . ./myread
17850         alignbytes="$ans"
17851         $rm -f try.c try
17852         ;;
17853 esac
17854
17855
17856 : set the base revision
17857 baserev=5.0
17858
17859 : how do we concatenate cpp tokens here?
17860 echo " "
17861 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17862 $cat >cpp_stuff.c <<'EOCP'
17863 #define RCAT(a,b)a/**/b
17864 #define ACAT(a,b)a ## b
17865 RCAT(Rei,ser)
17866 ACAT(Cir,cus)
17867 EOCP
17868 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17869 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17870         echo "Oh!  Smells like ANSI's been here." >&4
17871         echo "We can catify or stringify, separately or together!"
17872         cpp_stuff=42
17873 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17874         echo "Ah, yes!  The good old days!" >&4
17875         echo "However, in the good old days we don't know how to stringify and"
17876         echo "catify at the same time."
17877         cpp_stuff=1
17878 else
17879         $cat >&4 <<EOM
17880 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17881 You're going to have to edit the values of CAT[2-5] in config.h...
17882 EOM
17883         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17884 fi
17885 $rm -f cpp_stuff.*
17886
17887 : see if this is a db.h system
17888 set db.h i_db
17889 eval $inhdr
17890
17891 case "$i_db" in
17892 $define)
17893         : Check db version.
17894         echo " "
17895         echo "Checking Berkeley DB version ..." >&4
17896         $cat >try.c <<EOCP
17897 #$d_const HASCONST
17898 #ifndef HASCONST
17899 #define const
17900 #endif
17901 #include <sys/types.h>
17902 #include <stdio.h>
17903 #$i_stdlib I_STDLIB
17904 #ifdef I_STDLIB
17905 #include <stdlib.h>
17906 #endif
17907 #include <db.h>
17908 int main(int argc, char *argv[])
17909 {
17910 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17911     int Major, Minor, Patch ;
17912     unsigned long Version ;
17913     (void)db_version(&Major, &Minor, &Patch) ;
17914     if (argc == 2) {
17915         printf("%d %d %d %d %d %d\n",
17916                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17917                Major, Minor, Patch);
17918         exit(0);
17919     }
17920     printf("You have Berkeley DB Version 2 or greater.\n");
17921
17922     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17923                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17924     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17925                 Major, Minor, Patch) ;
17926
17927     /* check that db.h & libdb are compatible */
17928     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17929         printf("db.h and libdb are incompatible.\n") ;
17930         exit(3);        
17931     }
17932
17933     printf("db.h and libdb are compatible.\n") ;
17934
17935     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17936                 + DB_VERSION_PATCH ;
17937
17938     /* needs to be >= 2.3.4 */
17939     if (Version < 2003004) {
17940     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17941         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17942         exit(2);        
17943     }
17944
17945     exit(0);
17946 #else
17947 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17948     if (argc == 2) {
17949         printf("1 0 0\n");
17950         exit(0);
17951     }
17952     printf("You have Berkeley DB Version 1.\n");
17953     exit(0);    /* DB version < 2: the coast is clear. */
17954 #else
17955     exit(1);    /* <db.h> not Berkeley DB? */
17956 #endif
17957 #endif
17958 }
17959 EOCP
17960         set try
17961         if eval $compile_ok && $run ./try; then
17962                 echo 'Looks OK.' >&4
17963                 set `$run ./try 1`
17964                 db_version_major=$1
17965                 db_version_minor=$2
17966                 db_version_patch=$3
17967         else
17968                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17969                 i_db=$undef
17970                 case " $libs " in
17971                 *"-ldb "*)
17972                         : Remove db from list of libraries to use
17973                         echo "Removing unusable -ldb from library list" >&4
17974                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17975                         shift
17976                         libs="$*"
17977                         echo "libs = $libs" >&4
17978                         ;;
17979                 esac
17980         fi
17981         $rm -f try.*
17982         ;;
17983 esac
17984
17985 case "$i_db" in
17986 define)
17987         : Check the return type needed for hash 
17988         echo " "
17989         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17990         $cat >try.c <<EOCP
17991 #$d_const HASCONST
17992 #ifndef HASCONST
17993 #define const
17994 #endif
17995 #include <sys/types.h>
17996 #include <db.h>
17997
17998 #ifndef DB_VERSION_MAJOR
17999 u_int32_t hash_cb (ptr, size)
18000 const void *ptr;
18001 size_t size;
18002 {
18003 }
18004 HASHINFO info;
18005 int main()
18006 {
18007         info.hash = hash_cb;
18008 }
18009 #endif
18010 EOCP
18011         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18012                 if $contains warning try.out >>/dev/null 2>&1 ; then
18013                         db_hashtype='int'
18014                 else
18015                         db_hashtype='u_int32_t'
18016                 fi
18017         else
18018                 : XXX Maybe we should just give up here.
18019                 db_hashtype=u_int32_t
18020                 $cat try.out >&4
18021                 echo "Help:  I can't seem to compile the db test program." >&4
18022                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18023         fi
18024         $rm -f try.*
18025         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18026         ;;
18027 *)      db_hashtype=u_int32_t
18028         ;;
18029 esac
18030 case "$i_db" in
18031 define)
18032         : Check the return type needed for prefix 
18033         echo " "
18034         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18035         cat >try.c <<EOCP
18036 #$d_const HASCONST
18037 #ifndef HASCONST
18038 #define const
18039 #endif
18040 #include <sys/types.h>
18041 #include <db.h>
18042
18043 #ifndef DB_VERSION_MAJOR
18044 size_t prefix_cb (key1, key2)
18045 const DBT *key1;
18046 const DBT *key2;
18047 {
18048 }
18049 BTREEINFO info;
18050 int main()
18051 {
18052         info.prefix = prefix_cb;
18053 }
18054 #endif
18055 EOCP
18056         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18057                 if $contains warning try.out >>/dev/null 2>&1 ; then
18058                         db_prefixtype='int'
18059                 else
18060                         db_prefixtype='size_t'
18061                 fi
18062         else
18063                 db_prefixtype='size_t'
18064                 : XXX Maybe we should just give up here.
18065                 $cat try.out >&4
18066                 echo "Help:  I can't seem to compile the db test program." >&4
18067                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18068         fi
18069         $rm -f try.*
18070         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18071         ;;
18072 *)      db_prefixtype='size_t'
18073         ;;
18074 esac
18075
18076
18077 : How can we generate normalized random numbers ?
18078 echo " "
18079 echo "Looking for a random number function..." >&4
18080 case "$randfunc" in
18081 '')
18082         if set drand48 val -f; eval $csym; $val; then
18083                 dflt="drand48"
18084                 echo "Good, found drand48()." >&4
18085         elif set random val -f; eval $csym; $val; then
18086                 dflt="random"
18087                 echo "OK, found random()." >&4
18088         else
18089                 dflt="rand"
18090                 echo "Yick, looks like I have to use rand()." >&4
18091         fi
18092         echo " "
18093         ;;
18094 *)
18095         dflt="$randfunc"
18096         ;;
18097 esac
18098 cont=true
18099
18100 case "$ccflags" in
18101 *-Dmy_rand=*|*-Dmy_srand=*)
18102         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18103         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18104         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18105         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18106         ;;
18107 esac
18108
18109 while $test "$cont"; do
18110         rp="Use which function to generate random numbers?"
18111         . ./myread
18112         if $test "$ans" = "$dflt"; then
18113                 : null
18114         else
18115                 randbits=''
18116         fi
18117         randfunc="$ans"
18118         if set $ans val -f; eval $csym; $val; then
18119                 cont=''
18120         else
18121                 dflt=y
18122                 rp="I cannot find function $ans. Use that name anyway?"
18123                 . ./myread
18124                 dflt=rand
18125                 case "$ans" in
18126                         [yY]*) cont='';;
18127                 esac
18128         fi
18129         case "$cont" in
18130         '')
18131                 case "$randfunc" in
18132                 drand48)
18133                         drand01="drand48()"
18134                         seedfunc="srand48"
18135                         randbits=48
18136                         randseedtype=long
18137                         ;;
18138                 rand|random)
18139                         case "$randbits" in
18140                         '')
18141 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18142                                 $cat >try.c <<EOCP
18143 #$i_unistd I_UNISTD
18144 #$i_stdlib I_STDLIB
18145 #include <stdio.h>
18146 #ifdef I_UNISTD
18147 #  include <unistd.h>
18148 #endif
18149 #ifdef I_STDLIB
18150 #  include <stdlib.h>
18151 #endif
18152 int main()
18153 {
18154         register int i;
18155         register unsigned long tmp;
18156         register unsigned long max = 0L;
18157
18158         for (i = 1000; i; i--) {
18159                 tmp = (unsigned long) $randfunc();
18160                 if (tmp > max) max = tmp;
18161         }
18162         for (i = 0; max; i++)
18163                 max /= 2;
18164         printf("%d\n",i);
18165 }
18166 EOCP
18167                                 set try
18168                                 if eval $compile_ok; then
18169                                         dflt=`try`
18170                                 else
18171                                         dflt='?'
18172                                         echo "(I can't seem to compile the test program...)"
18173                                 fi
18174                                 ;;
18175                         *)
18176                                 dflt="$randbits"
18177                                 ;;
18178                         esac
18179                         rp="How many bits does your $randfunc() function produce?"
18180                         . ./myread
18181                         randbits="$ans"
18182                         $rm -f try.c try
18183                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18184                         seedfunc="s$randfunc"
18185                         randseedtype=unsigned
18186                         ;;
18187                 *)
18188                         dflt="31"
18189                         rp="How many bits does your $randfunc() function produce?"
18190                         . ./myread
18191                         randbits="$ans"
18192                         seedfunc="s$randfunc"
18193                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18194                         if set $seedfunc val -f; eval $csym; $val; then
18195                                 echo "(Using $seedfunc() to seed random generator)"
18196                         else
18197                                 echo "(Warning: no $seedfunc() to seed random generator)"
18198                                 seedfunc=rand
18199                         fi
18200                         randseedtype=unsigned
18201                         ;;
18202                 esac
18203                 ;;
18204         esac
18205 done
18206
18207 echo " "
18208 echo "Determining whether or not we are on an EBCDIC system..." >&4
18209 $cat >try.c <<'EOM'
18210 int main()
18211 {
18212   if ('M'==0xd4) return 0;
18213   return 1;
18214 }
18215 EOM
18216
18217 val=$undef
18218 set try
18219 if eval $compile_ok; then
18220         if $run ./try; then
18221                 echo "You seem to speak EBCDIC." >&4
18222                 val="$define"
18223         else
18224                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18225         fi
18226 else
18227         echo "I'm unable to compile the test program." >&4
18228         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18229 fi
18230 $rm -f try try.*
18231 set ebcdic
18232 eval $setvar
18233
18234 echo " "
18235 $cat >&4 <<EOM
18236 Checking how to flush all pending stdio output...
18237 EOM
18238 # I only know how to find the first 32 possibly open files on SunOS.
18239 # See also hints/sunos_4_1.sh and util.c  --AD
18240 case "$osname" in
18241 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18242 esac
18243 $cat >>try.c <<EOCP
18244 #include <stdio.h>
18245 #$i_stdlib I_STDLIB
18246 #ifdef I_STDLIB
18247 #include <stdlib.h>
18248 #endif
18249 #$i_unistd I_UNISTD
18250 #ifdef I_UNISTD
18251 # include <unistd.h>
18252 #endif
18253 #$d_sysconf HAS_SYSCONF
18254 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18255 #ifdef HAS_STDIO_STREAM_ARRAY
18256 # define STDIO_STREAM_ARRAY $stdio_stream_array
18257 #endif
18258 int main() {
18259   FILE* p;
18260   unlink("try.out");
18261   p = fopen("try.out", "w");
18262 #ifdef TRY_FPUTC
18263   fputc('x', p);
18264 #else
18265 # ifdef TRY_FPRINTF
18266   fprintf(p, "x");
18267 # endif
18268 #endif
18269 #ifdef TRY_FFLUSH_NULL
18270   fflush(NULL);
18271 #endif
18272 #ifdef TRY_FFLUSH_ALL
18273   {
18274     long open_max = -1;
18275 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18276     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18277 # else
18278 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18279     open_max = sysconf(_SC_OPEN_MAX);
18280 #  else
18281 #   ifdef FOPEN_MAX
18282     open_max = FOPEN_MAX;
18283 #   else
18284 #    ifdef OPEN_MAX
18285     open_max = OPEN_MAX;
18286 #    else
18287 #     ifdef _NFILE
18288     open_max = _NFILE;
18289 #     endif
18290 #    endif
18291 #   endif
18292 #  endif
18293 # endif 
18294 # ifdef HAS_STDIO_STREAM_ARRAY
18295     if (open_max > 0) {
18296       long i;
18297       for (i = 0; i < open_max; i++)
18298             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18299                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18300                 STDIO_STREAM_ARRAY[i]._flag)
18301                 fflush(&STDIO_STREAM_ARRAY[i]);
18302     }   
18303   }
18304 # endif
18305 #endif
18306   _exit(42);
18307 }
18308 EOCP
18309 : first we have to find out how _not_ to flush
18310 $to try.c
18311 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18312     output=''
18313     set try -DTRY_FPUTC
18314     if eval $compile; then
18315             $run ./try 2>/dev/null
18316             code="$?"
18317             $from try.out
18318             if $test ! -s try.out -a "X$code" = X42; then
18319                 output=-DTRY_FPUTC
18320             fi
18321     fi
18322     case "$output" in
18323     '')
18324             set try -DTRY_FPRINTF
18325             if eval $compile; then
18326                     $run ./try 2>/dev/null
18327                     code="$?"
18328                     $from try.out
18329                     if $test ! -s try.out -a "X$code" = X42; then
18330                         output=-DTRY_FPRINTF
18331                     fi
18332             fi
18333         ;;
18334     esac
18335 fi
18336 : check for fflush NULL behaviour
18337 case "$fflushNULL" in
18338 '')     set try -DTRY_FFLUSH_NULL $output
18339         if eval $compile; then
18340                 $run ./try 2>/dev/null
18341                 code="$?"
18342                 $from try.out
18343                 if $test -s try.out -a "X$code" = X42; then
18344                         fflushNULL="`$cat try.out`"
18345                 else
18346                         if $test "X$code" != X42; then
18347                                 $cat >&4 <<EOM
18348 (If this test failed, don't worry, we'll try another method shortly.)
18349 EOM
18350                         fi
18351                 fi
18352         fi
18353         $rm -f core try.core core.try.*
18354         case "$fflushNULL" in
18355         x)      $cat >&4 <<EOM
18356 Your fflush(NULL) works okay for output streams.
18357 Let's see if it clobbers input pipes...
18358 EOM
18359 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18360 # bug that improperly flushes the input end of pipes.  So we avoid the
18361 # autoflush on fork/system/exec support for now. :-(
18362 $cat >tryp.c <<EOCP
18363 #include <stdio.h>
18364 int
18365 main(int argc, char **argv)
18366 {
18367     char buf[1024];
18368     int i;
18369     char *bp = buf;
18370     while (1) {
18371         while ((i = getc(stdin)) != -1
18372                && (*bp++ = i) != '\n'
18373                && bp < &buf[1024])
18374         /* DO NOTHING */ ;
18375         *bp = '\0';
18376         fprintf(stdout, "%s", buf);
18377         fflush(NULL);
18378         if (i == -1)
18379             return 0;
18380         bp = buf;
18381     }
18382 }
18383 EOCP
18384                 fflushNULL="$define"
18385                 set tryp
18386                 if eval $compile; then
18387                     $rm -f tryp.out
18388                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18389                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18390                        $cat >&4 <<EOM
18391 fflush(NULL) seems to behave okay with input streams.
18392 EOM
18393                         fflushNULL="$define"
18394                     else
18395                         $cat >&4 <<EOM
18396 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18397 EOM
18398                         fflushNULL="$undef"
18399                     fi
18400                 fi
18401                 $rm -f core tryp.c tryp.core core.tryp.*
18402                 ;;
18403         '')     $cat >&4 <<EOM
18404 Your fflush(NULL) isn't working (contrary to ANSI C).
18405 EOM
18406                 fflushNULL="$undef"
18407                 ;;
18408         *)      $cat >&4 <<EOM
18409 Cannot figure out whether your fflush(NULL) works or not.
18410 I'm assuming it doesn't (contrary to ANSI C).
18411 EOM
18412                 fflushNULL="$undef"
18413                 ;;
18414         esac
18415         ;;
18416 $define|true|[yY]*)
18417         fflushNULL="$define"
18418         ;;
18419 *)
18420         fflushNULL="$undef"
18421         ;;
18422 esac
18423 : check explicit looping only if NULL did not work, and if the pipe
18424 : bug does not show up on an explicit flush too
18425 case "$fflushNULL" in
18426 "$undef")
18427         $cat >tryp.c <<EOCP
18428 #include <stdio.h>
18429 int
18430 main(int argc, char **argv)
18431 {
18432     char buf[1024];
18433     int i;
18434     char *bp = buf;
18435     while (1) {
18436         while ((i = getc(stdin)) != -1
18437                && (*bp++ = i) != '\n'
18438                && bp < &buf[1024])
18439         /* DO NOTHING */ ;
18440         *bp = '\0';
18441         fprintf(stdout, "%s", buf);
18442         fflush(stdin);
18443         if (i == -1)
18444             return 0;
18445         bp = buf;
18446     }
18447 }
18448 EOCP
18449         set tryp
18450         if eval $compile; then
18451             $rm -f tryp.out
18452             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18453             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18454                $cat >&4 <<EOM
18455 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18456 EOM
18457                 : now check for fflushall behaviour
18458                 case "$fflushall" in
18459                 '')     set try -DTRY_FFLUSH_ALL $output
18460                         if eval $compile; then
18461                                 $cat >&4 <<EOM
18462 (Now testing the other method--but note that this also may fail.)
18463 EOM
18464                                 $run ./try 2>/dev/null
18465                                 code=$?
18466                                 $from try.out
18467                                 if $test -s try.out -a "X$code" = X42; then
18468                                         fflushall="`$cat try.out`"
18469                                 fi
18470                         fi
18471                         $rm -f core try.core core.try.*
18472                         case "$fflushall" in
18473                         x)      $cat >&4 <<EOM
18474 Whew. Flushing explicitly all the stdio streams works.
18475 EOM
18476                                 fflushall="$define"
18477                                 ;;
18478                         '')     $cat >&4 <<EOM
18479 Sigh. Flushing explicitly all the stdio streams doesn't work.
18480 EOM
18481                                 fflushall="$undef"
18482                                 ;;
18483                         *)      $cat >&4 <<EOM
18484 Cannot figure out whether flushing stdio streams explicitly works or not.
18485 I'm assuming it doesn't.
18486 EOM
18487                                 fflushall="$undef"
18488                                 ;;
18489                         esac
18490                         ;;
18491                 "$define"|true|[yY]*)
18492                         fflushall="$define"
18493                         ;;
18494                 *)
18495                         fflushall="$undef"
18496                         ;;
18497                 esac
18498             else
18499                 $cat >&4 <<EOM
18500 All is futile.  Even fflush(stdin) clobbers input pipes!
18501 EOM
18502                 fflushall="$undef"
18503             fi
18504         else
18505             fflushall="$undef"
18506         fi
18507         $rm -f core tryp.c tryp.core core.tryp.*
18508         ;;
18509 *)      fflushall="$undef"
18510         ;;
18511 esac
18512
18513 case "$fflushNULL$fflushall" in
18514 undefundef)
18515         $cat <<EOM
18516 OK, I give up.  I cannot figure out how to flush pending stdio output.
18517 We won't be flushing handles at all before fork/exec/popen.
18518 EOM
18519         ;;
18520 esac
18521 $rm -f try.* try$exe_ext
18522
18523 : Store the full pathname to the ar program for use in the C program
18524 : Respect a hint or command line value for full_ar.
18525 case "$full_ar" in
18526 '') full_ar=$ar ;;
18527 esac
18528
18529 : Store the full pathname to the sed program for use in the C program
18530 full_sed=$sed
18531
18532 : see what type gids are declared as in the kernel
18533 echo " "
18534 echo "Looking for the type for group ids returned by getgid()."
18535 set gid_t gidtype xxx stdio.h sys/types.h
18536 eval $typedef
18537 case "$gidtype" in
18538 xxx)
18539         xxx=`./findhdr sys/user.h`
18540         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18541         case $1 in
18542         unsigned) dflt="$1 $2" ;;
18543         *) dflt="$1" ;;
18544         esac
18545         ;;
18546 *) dflt="$gidtype";;
18547 esac
18548 case "$gidtype" in
18549 gid_t) echo "gid_t found." ;;
18550 *)      rp="What is the type for group ids returned by getgid()?"
18551         . ./myread
18552         gidtype="$ans"
18553         ;;
18554 esac
18555
18556 echo " "
18557 case "$gidtype" in
18558 *_t) zzz="$gidtype"     ;;
18559 *)   zzz="gid"          ;;
18560 esac
18561 echo "Checking the size of $zzz..." >&4 
18562 cat > try.c <<EOCP
18563 #include <sys/types.h>
18564 #include <stdio.h>
18565 #$i_stdlib I_STDLIB
18566 #ifdef I_STDLIB
18567 #include <stdlib.h>
18568 #endif
18569 int main() {
18570     printf("%d\n", (int)sizeof($gidtype));
18571     exit(0);
18572 }
18573 EOCP
18574 set try
18575 if eval $compile_ok; then
18576         yyy=`$run ./try`
18577         case "$yyy" in
18578         '')     gidsize=4
18579                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18580                 ;;
18581         *)      gidsize=$yyy
18582                 echo "Your $zzz is $gidsize bytes long."
18583                 ;;
18584         esac
18585 else
18586         gidsize=4
18587         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18588 fi
18589
18590
18591 echo " "
18592 case "$gidtype" in
18593 *_t) zzz="$gidtype"     ;;
18594 *)   zzz="gid"          ;;
18595 esac
18596 echo "Checking the sign of $zzz..." >&4 
18597 cat > try.c <<EOCP
18598 #include <sys/types.h>
18599 #include <stdio.h>
18600 int main() {
18601         $gidtype foo = -1;
18602         if (foo < 0)
18603                 printf("-1\n");
18604         else
18605                 printf("1\n");
18606 }
18607 EOCP
18608 set try
18609 if eval $compile; then
18610         yyy=`$run ./try`
18611         case "$yyy" in
18612         '')     gidsign=1
18613                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18614                 ;;
18615         *)      gidsign=$yyy
18616                 case "$gidsign" in
18617                  1) echo "Your $zzz is unsigned." ;;
18618                 -1) echo "Your $zzz is signed."   ;;
18619                 esac
18620                 ;;
18621         esac
18622 else
18623         gidsign=1
18624         echo "(I can't compile the test program--guessing unsigned.)" >&4
18625 fi
18626
18627
18628 echo " "
18629
18630 if $test X"$quadtype" != X; then
18631
18632 echo "Checking how to print 64-bit integers..." >&4
18633
18634 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18635         $cat >try.c <<'EOCP'
18636 #include <sys/types.h>
18637 #include <stdio.h>
18638 int main() {
18639   int q = 12345678901;
18640   printf("%ld\n", q);
18641 }
18642 EOCP
18643         set try
18644         if eval $compile; then
18645                 yyy=`$run ./try`
18646                 case "$yyy" in
18647                 12345678901)
18648                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18649                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18650                         echo "We will use %d."
18651                         ;;
18652                 esac
18653         fi
18654 fi
18655
18656 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18657         $cat >try.c <<'EOCP'
18658 #include <sys/types.h>
18659 #include <stdio.h>
18660 int main() {
18661   long q = 12345678901;
18662   printf("%ld\n", q);
18663 }
18664 EOCP
18665         set try
18666         if eval $compile; then
18667                 yyy=`$run ./try`
18668                 case "$yyy" in
18669                 12345678901)
18670                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18671                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18672                         echo "We will use %ld."
18673                         ;;
18674                 esac
18675         fi
18676 fi
18677
18678 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18679         $cat >try.c <<'EOCP'
18680 #include <sys/types.h>
18681 #include <inttypes.h>
18682 #include <stdio.h>
18683 int main() {
18684   int64_t q = 12345678901;
18685   printf("%" PRId64 "\n", q);
18686 }
18687 EOCP
18688         set try
18689         if eval $compile; then
18690                 yyy=`$run ./try`
18691                 case "$yyy" in
18692                 12345678901)
18693                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18694                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18695                         echo "We will use the C9X style."
18696                         ;;
18697                 esac
18698         fi
18699 fi
18700
18701 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18702         $cat >try.c <<EOCP
18703 #include <sys/types.h>
18704 #include <stdio.h>
18705 int main() {
18706   $quadtype q = 12345678901;
18707   printf("%Ld\n", q);
18708 }
18709 EOCP
18710         set try
18711         if eval $compile; then
18712                 yyy=`$run ./try`
18713                 case "$yyy" in
18714                 12345678901)
18715                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18716                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18717                         echo "We will use %Ld."
18718                         ;;
18719                 esac
18720         fi
18721 fi
18722
18723 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18724         $cat >try.c <<'EOCP'
18725 #include <sys/types.h>
18726 #include <stdio.h>
18727 int main() {
18728   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18729   printf("%lld\n", q);
18730 }
18731 EOCP
18732         set try
18733         if eval $compile; then
18734                 yyy=`$run ./try`
18735                 case "$yyy" in
18736                 12345678901)
18737                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18738                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18739                         echo "We will use the %lld style."
18740                         ;;
18741                 esac
18742         fi
18743 fi
18744
18745 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18746         $cat >try.c <<EOCP
18747 #include <sys/types.h>
18748 #include <stdio.h>
18749 int main() {
18750   $quadtype q = 12345678901;
18751   printf("%qd\n", q);
18752 }
18753 EOCP
18754         set try
18755         if eval $compile; then
18756                 yyy=`$run ./try`
18757                 case "$yyy" in
18758                 12345678901)
18759                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18760                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18761                         echo "We will use %qd."
18762                         ;;
18763                 esac
18764         fi
18765 fi
18766
18767 if $test X"$sPRId64" = X; then
18768         echo "Cannot figure out how to print 64-bit integers." >&4
18769 fi
18770
18771 $rm -f try try.*
18772
18773 fi
18774
18775 case "$sPRId64" in
18776 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18777         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18778         ;;
18779 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18780         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18781         ;;
18782 esac
18783
18784
18785 echo " "
18786 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18787
18788 if $test X"$ivsize" = X8; then
18789         ivdformat="$sPRId64"
18790         uvuformat="$sPRIu64"
18791         uvoformat="$sPRIo64"
18792         uvxformat="$sPRIx64"
18793         uvXUformat="$sPRIXU64"
18794 else
18795         if $test X"$ivsize" = X"$longsize"; then
18796                 ivdformat='"ld"'
18797                 uvuformat='"lu"'
18798                 uvoformat='"lo"'
18799                 uvxformat='"lx"'
18800                 uvXUformat='"lX"'
18801         else
18802                 if $test X"$ivsize" = X"$intsize"; then
18803                         ivdformat='"d"'
18804                         uvuformat='"u"'
18805                         uvoformat='"o"'
18806                         uvxformat='"x"'
18807                         uvXUformat='"X"'
18808                 else
18809                         : far out
18810                         if $test X"$ivsize" = X"$shortsize"; then
18811                                 ivdformat='"hd"'
18812                                 uvuformat='"hu"'
18813                                 uvoformat='"ho"'
18814                                 uvxformat='"hx"'
18815                                 uvXUformat='"hX"'
18816                         fi
18817                 fi
18818         fi
18819 fi
18820
18821 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18822         nveformat="$sPRIeldbl"
18823         nvfformat="$sPRIfldbl"
18824         nvgformat="$sPRIgldbl"
18825         nvEUformat="$sPRIEUldbl"
18826         nvFUformat="$sPRIFUldbl"
18827         nvGUformat="$sPRIGUldbl"
18828 else
18829         nveformat='"e"'
18830         nvfformat='"f"'
18831         nvgformat='"g"'
18832         nvEUformat='"E"'
18833         nvFUformat='"F"'
18834         nvGUformat='"G"'
18835 fi
18836
18837 case "$ivdformat" in
18838 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18839     exit 1
18840     ;;
18841 esac
18842
18843
18844 echo " "
18845 $echo "Checking the format string to be used for gids..." >&4
18846
18847 case "$gidsign" in
18848 -1)     if $test X"$gidsize" = X"$ivsize"; then
18849                 gidformat="$ivdformat"
18850         else
18851                 if $test X"$gidsize" = X"$longsize"; then
18852                         gidformat='"ld"'
18853                 else
18854                         if $test X"$gidsize" = X"$intsize"; then
18855                                 gidformat='"d"'
18856                         else
18857                                 if $test X"$gidsize" = X"$shortsize"; then
18858                                         gidformat='"hd"'
18859                                 fi
18860                         fi
18861                 fi
18862         fi
18863         ;;
18864 *)      if $test X"$gidsize" = X"$uvsize"; then
18865                 gidformat="$uvuformat"
18866         else
18867                 if $test X"$gidsize" = X"$longsize"; then
18868                         gidformat='"lu"'
18869                 else
18870                         if $test X"$gidsize" = X"$intsize"; then
18871                                 gidformat='"u"'
18872                         else
18873                                 if $test X"$gidsize" = X"$shortsize"; then
18874                                         gidformat='"hu"'
18875                                 fi
18876                         fi
18877                 fi
18878         fi
18879         ;;
18880 esac
18881
18882 : see if getgroups exists
18883 set getgroups d_getgrps
18884 eval $inlibc
18885
18886 : see if setgroups exists
18887 set setgroups d_setgrps
18888 eval $inlibc
18889
18890
18891 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18892 echo " "
18893 case "$d_getgrps$d_setgrps" in
18894 *define*)
18895         case "$groupstype" in
18896         '') dflt="$gidtype" ;;
18897         *)  dflt="$groupstype" ;;
18898         esac
18899         $cat <<EOM
18900 What type of pointer is the second argument to getgroups() and setgroups()?
18901 Usually this is the same as group ids, $gidtype, but not always.
18902
18903 EOM
18904         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18905         . ./myread
18906         groupstype="$ans"
18907         ;;
18908 *)  groupstype="$gidtype";;
18909 esac
18910
18911
18912 case "$mad" in
18913 $define|true|[yY]*)     dflt='y' ;;
18914 *)                      dflt='n' ;;
18915 esac
18916 cat <<EOM
18917
18918 Would you like to build with Misc Attribute Decoration? This is development
18919 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18920 overhead on the interpreter.
18921
18922 If this doesn't make any sense to you, just accept the default '$dflt'.
18923 EOM
18924 rp='Build Perl with MAD?'
18925 . ./myread
18926 case "$ans" in
18927 y|Y)    val="$define"
18928         madlyh='madly.h madly.act madly.tab'
18929         madlysrc='madly.c'
18930         madlyobj="madly$_o" ;;
18931 *)      val="$undef"
18932         madlyh=''
18933         madlysrc=''
18934         madlyobj='' ;;
18935 esac
18936 set mad
18937 eval $setvar
18938
18939 echo " "
18940 echo "Checking if your $make program sets \$(MAKE)..." >&4
18941 case "$make_set_make" in
18942 '')
18943         $sed 's/^X //' > testmake.mak << 'EOF'
18944 Xall:
18945 X       @echo 'maketemp="$(MAKE)"'
18946 EOF
18947         case "`$make -f testmake.mak 2>/dev/null`" in
18948         *maketemp=*) make_set_make='#' ;;
18949         *)      make_set_make="MAKE=$make" ;;
18950         esac
18951         $rm -f testmake.mak
18952         ;;
18953 esac
18954 case "$make_set_make" in
18955 '#') echo "Yup, it does.";;
18956 *) echo "Nope, it doesn't.";;
18957 esac
18958
18959 : see what type is used for mode_t
18960 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18961 set mode_t modetype int stdio.h sys/types.h
18962 eval $typedef_ask
18963
18964 : see if stdarg is available
18965 echo " "
18966 if $test `./findhdr stdarg.h`; then
18967         echo "<stdarg.h> found." >&4
18968         valstd="$define"
18969 else
18970         echo "<stdarg.h> NOT found." >&4
18971         valstd="$undef"
18972 fi
18973
18974 : see if varags is available
18975 echo " "
18976 if $test `./findhdr varargs.h`; then
18977         echo "<varargs.h> found." >&4
18978 else
18979         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18980 fi
18981
18982 : set up the varargs testing programs
18983 $cat > varargs.c <<EOP
18984 #ifdef I_STDARG
18985 #include <stdarg.h>
18986 #endif
18987 #ifdef I_VARARGS
18988 #include <varargs.h>
18989 #endif
18990
18991 #ifdef I_STDARG
18992 int f(char *p, ...)
18993 #else
18994 int f(va_alist)
18995 va_dcl
18996 #endif
18997 {
18998         va_list ap;
18999 #ifndef I_STDARG
19000         char *p;
19001 #endif
19002 #ifdef I_STDARG
19003         va_start(ap,p);
19004 #else
19005         va_start(ap);
19006         p = va_arg(ap, char *);
19007 #endif
19008         va_end(ap);
19009 }
19010 EOP
19011 $cat > varargs <<EOP
19012 $startsh
19013 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19014         echo "true"
19015 else
19016         echo "false"
19017 fi
19018 $rm -f varargs$_o
19019 EOP
19020 chmod +x varargs
19021
19022 : now check which varargs header should be included
19023 echo " "
19024 i_varhdr=''
19025 case "$valstd" in
19026 "$define")
19027         if `./varargs I_STDARG`; then
19028                 val='stdarg.h'
19029         elif `./varargs I_VARARGS`; then
19030                 val='varargs.h'
19031         fi
19032         ;;
19033 *)
19034         if `./varargs I_VARARGS`; then
19035                 val='varargs.h'
19036         fi
19037         ;;
19038 esac
19039 case "$val" in
19040 '')
19041 echo "I could not find the definition for va_dcl... You have problems..." >&4
19042         val="$undef"; set i_stdarg; eval $setvar
19043         val="$undef"; set i_varargs; eval $setvar
19044         ;;
19045 *) 
19046         set i_varhdr
19047         eval $setvar
19048         case "$i_varhdr" in
19049         stdarg.h)
19050                 val="$define"; set i_stdarg; eval $setvar
19051                 val="$undef"; set i_varargs; eval $setvar
19052                 ;;
19053         varargs.h)
19054                 val="$undef"; set i_stdarg; eval $setvar
19055                 val="$define"; set i_varargs; eval $setvar
19056                 ;;
19057         esac
19058         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19059 esac
19060 $rm -f varargs*
19061
19062 : see if we need va_copy
19063 echo " "
19064 case "$i_stdarg" in
19065 "$define")
19066         $cat >try.c <<EOCP
19067 #include <stdarg.h>
19068 #include <stdio.h>
19069 #$i_stdlib I_STDLIB
19070 #ifdef I_STDLIB
19071 #include <stdlib.h>
19072 #endif
19073 #include <signal.h>
19074
19075 int
19076 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19077 {
19078   return vfprintf(f, fmt, *valp);
19079 }
19080  
19081 int    
19082 myvfprintf(FILE *f, const  char *fmt, va_list val)
19083 {
19084   return ivfprintf(f, fmt, &val);
19085 }
19086       
19087 int
19088 myprintf(char *fmt, ...) 
19089 {
19090   va_list val;
19091   va_start(val, fmt);
19092   return myvfprintf(stdout, fmt, val); 
19093 }         
19094
19095 int
19096 main(int ac, char **av)
19097 {
19098   signal(SIGSEGV, exit);
19099
19100   myprintf("%s%cs all right, then\n", "that", '\'');                            
19101   exit(0);      
19102 }
19103 EOCP
19104         set try
19105         if eval $compile && $run ./try 2>&1 >/dev/null; then
19106                 case "`$run ./try`" in
19107                 "that's all right, then")
19108                         okay=yes
19109                         ;;
19110                 esac
19111         fi
19112         case "$okay" in
19113         yes)    echo "It seems that you don't need va_copy()." >&4
19114                 need_va_copy="$undef"
19115                 ;;
19116         *)      echo "It seems that va_copy() or similar will be needed." >&4
19117                 need_va_copy="$define"
19118                 ;;
19119         esac
19120         $rm -f try.* core core.* *.core *.core.*
19121         ;;
19122 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19123         ;;
19124 esac
19125
19126 : see what type is used for size_t
19127 rp="What is the type used for the length parameter for string functions?"
19128 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19129 eval $typedef_ask
19130
19131 : check for type of arguments to gethostbyaddr. 
19132 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19133         case "$d_gethbyaddr" in
19134         $define)
19135                 $cat <<EOM
19136
19137 Checking to see what type of arguments are accepted by gethostbyaddr().
19138 EOM
19139                 hdrs="$define sys/types.h
19140                         $d_socket sys/socket.h 
19141                         $i_niin netinet/in.h 
19142                         $i_netdb netdb.h
19143                         $i_unistd unistd.h"
19144                 : The first arg can 'char *' or 'void *'
19145                 : The second arg is some of integral type
19146                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19147                         for yyy in size_t long int; do
19148                                 case "$netdb_host_type" in
19149                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19150                                         if ./protochk "$try" $hdrs; then
19151                                                 echo "Your system accepts $xxx for the first arg."
19152                                                 echo "...and $yyy for the second arg."
19153                                                 netdb_host_type="$xxx"
19154                                                 netdb_hlen_type="$yyy"
19155                                         fi
19156                                         ;;
19157                                 esac
19158                         done
19159                 done
19160                 : In case none of those worked, prompt the user.
19161                 case "$netdb_host_type" in
19162                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19163                         dflt='char *'
19164                         . ./myread
19165                         netdb_host_type=$ans
19166                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19167                         dflt="$sizetype"
19168                         . ./myread
19169                         netdb_hlen_type=$ans
19170                         ;;
19171                 esac
19172                 ;;
19173         *)      : no gethostbyaddr, so pick harmless defaults
19174                 netdb_host_type='char *'
19175                 netdb_hlen_type="$sizetype"
19176                 ;;
19177         esac
19178         # Remove the "const" if needed. -- but then we'll have a 
19179         # prototype clash!
19180         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19181 fi
19182
19183 : check for type of argument to gethostbyname. 
19184 if test "X$netdb_name_type" = X ; then
19185         case "$d_gethbyname" in
19186         $define)
19187                 $cat <<EOM
19188
19189 Checking to see what type of argument is accepted by gethostbyname().
19190 EOM
19191                 hdrs="$define sys/types.h
19192                         $d_socket sys/socket.h 
19193                         $i_niin netinet/in.h 
19194                         $i_netdb netdb.h
19195                         $i_unistd unistd.h"
19196                 for xxx in "const char *" "char *"; do
19197                         case "$netdb_name_type" in
19198                         '')     try="extern struct hostent *gethostbyname($xxx);"
19199                                 if ./protochk "$try" $hdrs; then
19200                                         echo "Your system accepts $xxx."
19201                                         netdb_name_type="$xxx"
19202                                 fi
19203                                 ;;
19204                         esac
19205                 done
19206                 : In case none of those worked, prompt the user.
19207                 case "$netdb_name_type" in
19208                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19209                         dflt='char *'
19210                         . ./myread
19211                         netdb_name_type=$ans
19212                         ;;
19213                 esac
19214                 ;;
19215         *)      : no gethostbyname, so pick harmless default
19216                 netdb_name_type='char *'
19217                 ;;
19218         esac
19219 fi
19220
19221 : check for type of 1st argument to getnetbyaddr. 
19222 if test "X$netdb_net_type" = X ; then
19223         case "$d_getnbyaddr" in
19224         $define)
19225                 $cat <<EOM
19226
19227 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19228 EOM
19229                 hdrs="$define sys/types.h
19230                         $d_socket sys/socket.h 
19231                         $i_niin netinet/in.h 
19232                         $i_netdb netdb.h
19233                         $i_unistd unistd.h"
19234                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19235                         case "$netdb_net_type" in
19236                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19237                                 if ./protochk "$try" $hdrs; then
19238                                         echo "Your system accepts $xxx."
19239                                         netdb_net_type="$xxx"
19240                                 fi
19241                                 ;;
19242                         esac
19243                 done
19244                 : In case none of those worked, prompt the user.
19245                 case "$netdb_net_type" in
19246                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19247                         dflt='long'
19248                         . ./myread
19249                         netdb_net_type=$ans
19250                         ;;
19251                 esac
19252                 ;;
19253         *)      : no getnetbyaddr, so pick harmless default
19254                 netdb_net_type='long'
19255                 ;;
19256         esac
19257 fi
19258 : locate the preferred pager for this system
19259 fn=f/
19260 case "$pager" in
19261 '')
19262         dflt=''
19263         case "$pg" in
19264         /*) dflt=$pg;;
19265         [a-zA-Z]:/*) dflt=$pg;;
19266         esac
19267         case "$more" in
19268         /*) dflt=$more;;
19269         [a-zA-Z]:/*) dflt=$more;;
19270         esac
19271         case "$less" in
19272         /*) dflt=$less;;
19273         [a-zA-Z]:/*) dflt=$less;;
19274         esac
19275         case "$dflt" in
19276         '') dflt=/usr/ucb/more;;
19277         esac
19278         ;;
19279 *)      dflt="$pager"
19280         : Instruct ./getfile to trust the hinted or previous pager value,
19281         : even if it does not begin with a slash.  For example, on os2,
19282         : pager might be cmd /c more.  See comments in UU/getfile.
19283         fn="f/($pager)"
19284         ;;
19285 esac
19286 echo " "
19287 rp='What pager is used on your system?'
19288 . ./getfile
19289 pager="$ans"
19290
19291 : see what type pids are declared as in the kernel
19292 rp="What is the type of process ids on this system?"
19293 set pid_t pidtype int stdio.h sys/types.h
19294 eval $typedef_ask
19295
19296 : see if ar generates random libraries by itself
19297 echo " "
19298 echo "Checking how to generate random libraries on your machine..." >&4
19299 echo 'int bar1() { return bar2(); }' > bar1.c
19300 echo 'int bar2() { return 2; }' > bar2.c
19301 $cat > foo.c <<EOP
19302 #$i_stdlib I_STDLIB
19303 #ifdef I_STDLIB
19304 #include <stdlib.h>
19305 #endif
19306 int main() { printf("%d\n", bar1()); exit(0); }
19307 EOP
19308 $cc $ccflags -c bar1.c >/dev/null 2>&1
19309 $cc $ccflags -c bar2.c >/dev/null 2>&1
19310 $cc $ccflags -c foo.c >/dev/null 2>&1
19311 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19312 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19313         $run ./foobar >/dev/null 2>&1; then
19314         echo "$ar appears to generate random libraries itself."
19315         orderlib=false
19316         if [ "X$ranlib" = "X" ]; then
19317             ranlib=":"
19318         fi
19319 elif $ar s bar$_a >/dev/null 2>&1 &&
19320         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19321         $run ./foobar >/dev/null 2>&1; then
19322                 echo "a table of contents needs to be added with '$ar s'."
19323                 orderlib=false
19324                 ranlib="$ar s"
19325 elif $ar ts bar$_a >/dev/null 2>&1 &&
19326         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19327         $run ./foobar >/dev/null 2>&1; then
19328                 echo "a table of contents needs to be added with '$ar ts'."
19329                 orderlib=false
19330                 ranlib="$ar ts"
19331 else
19332         case "$ranlib" in
19333         :) ranlib='';;
19334         '')
19335                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19336                 $test -f $ranlib || ranlib=''
19337                 ;;
19338         esac
19339         if $test -n "$ranlib"; then
19340                 echo "your system has '$ranlib'; we'll use that."
19341                 orderlib=false
19342         else
19343                 echo "your system doesn't seem to support random libraries"
19344                 echo "so we'll use lorder and tsort to order the libraries."
19345                 orderlib=true
19346                 ranlib=":"
19347         fi
19348 fi
19349 $rm -f foo* bar*
19350
19351 : check for type of arguments to select. 
19352 case "$selecttype" in
19353 '') case "$d_select" in
19354         $define)
19355                 echo " "
19356                 $cat <<EOM
19357 Checking to see what type of arguments are accepted by select().
19358 EOM
19359                 hdrs="$define sys/types.h
19360                         $i_systime sys/time.h 
19361                         $i_sysselct sys/select.h
19362                         $d_socket sys/socket.h"
19363                 : The first arg can be int, unsigned, or size_t
19364                 : The last arg may or may not be 'const'
19365                 val=''
19366                 : void pointer has been seen but using that
19367                 : breaks the selectminbits test
19368                 for xxx in 'fd_set *' 'int *'; do
19369                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19370                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19371                                         case "$val" in
19372                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19373                                                 if ./protochk "$try" $hdrs; then
19374                                                         echo "Your system accepts $xxx."
19375                                                         val="$xxx"
19376                                                 fi
19377                                                 ;;
19378                                         esac
19379                                 done
19380                         done
19381                 done
19382                 case "$val" in
19383                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19384                         case "$d_fd_set" in
19385                                 $define) dflt="fd_set *" ;;
19386                                 *)              dflt="int *" ;;
19387                         esac
19388                         . ./myread
19389                         val=$ans
19390                         ;;
19391                 esac
19392                 selecttype="$val"
19393                 ;;
19394         *)      : no select, so pick a harmless default
19395                 selecttype='int *'
19396                 ;;
19397         esac
19398         ;;
19399 esac
19400
19401 : check for the select 'width'
19402 case "$selectminbits" in
19403 '') safebits=`expr $ptrsize \* 8`
19404     case "$d_select" in
19405         $define)
19406                 $cat <<EOM
19407
19408 Checking to see on how many bits at a time your select() operates...
19409 EOM
19410                 $cat >try.c <<EOCP
19411 #include <sys/types.h>
19412 #$i_time I_TIME
19413 #$i_systime I_SYS_TIME
19414 #$i_systimek I_SYS_TIME_KERNEL
19415 #ifdef I_TIME
19416 #   include <time.h>
19417 #endif
19418 #ifdef I_SYS_TIME
19419 #   ifdef I_SYS_TIME_KERNEL
19420 #       define KERNEL
19421 #   endif
19422 #   include <sys/time.h>
19423 #   ifdef I_SYS_TIME_KERNEL
19424 #       undef KERNEL
19425 #   endif
19426 #endif
19427 #$i_sysselct I_SYS_SELECT
19428 #ifdef I_SYS_SELECT
19429 #include <sys/select.h>
19430 #endif
19431 #$d_socket HAS_SOCKET
19432 #ifdef HAS_SOCKET
19433 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19434 #endif
19435 #include <stdio.h>
19436 #$i_stdlib I_STDLIB
19437 #ifdef I_STDLIB
19438 #include <stdlib.h>
19439 #endif
19440 $selecttype b;
19441 #define S sizeof(*(b))
19442 #define MINBITS 64
19443 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19444 #define NBITS  (NBYTES * 8)
19445 int main() {
19446     char *s = malloc(NBYTES);
19447     struct timeval t;
19448     int i;
19449     FILE* fp;
19450     int fd;
19451
19452     if (!s)
19453         exit(1);
19454     fclose(stdin);
19455     fp = fopen("try.c", "r");
19456     if (fp == 0)
19457       exit(2);
19458     fd = fileno(fp);
19459     if (fd < 0)
19460       exit(3);
19461     b = ($selecttype)s;
19462     for (i = 0; i < NBITS; i++)
19463         FD_SET(i, b);
19464     t.tv_sec  = 0;
19465     t.tv_usec = 0;
19466     select(fd + 1, b, 0, 0, &t);
19467     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19468     free(s);
19469     printf("%d\n", i + 1);
19470     return 0;
19471 }
19472 EOCP
19473                 set try
19474                 if eval $compile_ok; then
19475                         selectminbits=`$run ./try`
19476                         case "$selectminbits" in
19477                         '')     cat >&4 <<EOM
19478 Cannot figure out on how many bits at a time your select() operates.
19479 I'll play safe and guess it is $safebits bits.
19480 EOM
19481                                 selectminbits=$safebits
19482                                 bits="$safebits bits"
19483                                 ;;
19484                         1)      bits="1 bit" ;;
19485                         *)      bits="$selectminbits bits" ;;
19486                         esac
19487                         echo "Your select() operates on $bits at a time." >&4
19488                 else
19489                         rp='What is the minimum number of bits your select() operates on?'
19490                         case "$byteorder" in
19491                         12345678)       dflt=64 ;;
19492                         1234)           dflt=32 ;;
19493                         *)              dflt=1  ;;
19494                         esac
19495                         . ./myread
19496                         val=$ans
19497                         selectminbits="$val"
19498                 fi
19499                 $rm -f try.* try
19500                 ;;
19501         *)      : no select, so pick a harmless default
19502                 selectminbits=$safebits
19503                 ;;
19504         esac
19505         ;;
19506 esac
19507
19508 : Trace out the files included by signal.h, then look for SIGxxx names.
19509 : Remove SIGARRAYSIZE used by HPUX.
19510 : Remove SIGSTKSIZE used by Linux.
19511 : Remove SIGSTKSZ used by Posix.
19512 : Remove SIGTYP void lines used by OS2.
19513 : Some cpps, like os390, dont give the file name anywhere
19514 if [ "X$fieldn" = X ]; then
19515         : Just make some guesses.  We check them later.
19516         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19517 else
19518         xxx=`echo '#include <signal.h>' |
19519         $cppstdin $cppminus $cppflags 2>/dev/null |
19520         $grep '^[       ]*#.*include' | 
19521         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19522 fi
19523 : Check this list of files to be sure we have parsed the cpp output ok.
19524 : This will also avoid potentially non-existent files, such 
19525 : as ../foo/bar.h
19526 xxxfiles=''
19527 for xx in $xxx /dev/null ; do
19528         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19529 done
19530 : If we have found no files, at least try signal.h
19531 case "$xxxfiles" in
19532 '')     xxxfiles=`./findhdr signal.h` ;;
19533 esac
19534 xxx=`awk '
19535 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19536         print substr($2, 4, 20)
19537 }
19538 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19539         print substr($3, 4, 20)
19540 }' $xxxfiles`
19541 : Append some common names just in case the awk scan failed.
19542 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19543 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19544 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19545 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19546 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19547
19548 : generate a few handy files for later
19549 $cat > signal.c <<EOCP
19550 #include <sys/types.h>
19551 #include <signal.h>
19552 #$i_stdlib I_STDLIB
19553 #ifdef I_STDLIB
19554 #include <stdlib.h>
19555 #endif
19556 #include <stdio.h>
19557 int main() {
19558
19559 /* Strange style to avoid deeply-nested #if/#else/#endif */
19560 #ifndef NSIG
19561 #  ifdef _NSIG
19562 #    define NSIG (_NSIG)
19563 #  endif
19564 #endif
19565
19566 #ifndef NSIG
19567 #  ifdef SIGMAX
19568 #    define NSIG (SIGMAX+1)
19569 #  endif
19570 #endif
19571
19572 #ifndef NSIG
19573 #  ifdef SIG_MAX
19574 #    define NSIG (SIG_MAX+1)
19575 #  endif
19576 #endif
19577
19578 #ifndef NSIG
19579 #  ifdef _SIG_MAX
19580 #    define NSIG (_SIG_MAX+1)
19581 #  endif
19582 #endif
19583
19584 #ifndef NSIG
19585 #  ifdef MAXSIG
19586 #    define NSIG (MAXSIG+1)
19587 #  endif
19588 #endif
19589
19590 #ifndef NSIG
19591 #  ifdef MAX_SIG
19592 #    define NSIG (MAX_SIG+1)
19593 #  endif
19594 #endif
19595
19596 #ifndef NSIG
19597 #  ifdef SIGARRAYSIZE
19598 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19599 #  endif
19600 #endif
19601
19602 #ifndef NSIG
19603 #  ifdef _sys_nsig
19604 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19605 #  endif
19606 #endif
19607
19608 /* Default to some arbitrary number that's big enough to get most
19609    of the common signals.
19610 */
19611 #ifndef NSIG
19612 #    define NSIG 50
19613 #endif
19614
19615 printf("NSIG %d\n", NSIG);
19616
19617 #ifndef JUST_NSIG
19618
19619 EOCP
19620
19621 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19622 {
19623         printf "#ifdef SIG"; printf $1; printf "\n"
19624         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19625         printf $1; printf ");\n"
19626         printf "#endif\n"
19627 }
19628 END {
19629         printf "#endif /* JUST_NSIG */\n";
19630         printf "exit(0);\n}\n";
19631 }
19632 ' >>signal.c
19633 $cat >signal.awk <<'EOP'
19634 BEGIN { ndups = 0 }
19635 $1 ~ /^NSIG$/ { nsig = $2 }
19636 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19637     if ($2 > maxsig) { maxsig = $2 }
19638     if (sig_name[$2]) {
19639         dup_name[ndups] = $1
19640         dup_num[ndups] = $2
19641         ndups++ 
19642     }
19643     else {
19644         sig_name[$2] = $1
19645         sig_num[$2] = $2
19646     }
19647 }
19648 END { 
19649     if (nsig == 0) {
19650         nsig = maxsig + 1
19651     }
19652     printf("NSIG %d\n", nsig);
19653     for (n = 1; n < nsig; n++) {
19654         if (sig_name[n]) {
19655             printf("%s %d\n", sig_name[n], sig_num[n])
19656         }
19657         else {
19658             printf("NUM%d %d\n", n, n) 
19659         }
19660     }
19661     for (n = 0; n < ndups; n++) {
19662         printf("%s %d\n", dup_name[n], dup_num[n])
19663     }
19664 }
19665 EOP
19666 $cat >signal_cmd <<EOS
19667 $startsh
19668 if $test -s signal.lst; then
19669     echo "Using your existing signal.lst file"
19670         exit 0
19671 fi
19672 xxx="$xxx"
19673 EOS
19674 $cat >>signal_cmd <<'EOS'
19675
19676 set signal
19677 if eval $compile_ok; then
19678         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19679 else
19680         echo "(I can't seem be able to compile the whole test program)" >&4
19681         echo "(I'll try it in little pieces.)" >&4
19682         set signal -DJUST_NSIG
19683         if eval $compile_ok; then
19684                 $run ./signal$_exe > signal.nsg
19685                 $cat signal.nsg
19686         else
19687                 echo "I can't seem to figure out how many signals you have." >&4
19688                 echo "Guessing 50." >&4
19689                 echo 'NSIG 50' > signal.nsg
19690         fi
19691         : Now look at all the signal names, one at a time.
19692         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19693                 $cat > signal.c <<EOCP
19694 #include <sys/types.h>
19695 #include <signal.h>
19696 #include <stdio.h>
19697 int main() {
19698 printf("$xx %d\n", SIG${xx});
19699 return 0;
19700 }
19701 EOCP
19702                 set signal
19703                 if eval $compile; then
19704                         echo "SIG${xx} found."
19705                         $run ./signal$_exe  >> signal.ls1
19706                 else
19707                         echo "SIG${xx} NOT found."
19708                 fi
19709         done
19710         if $test -s signal.ls1; then
19711                 $cat signal.nsg signal.ls1 |
19712                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19713         fi
19714
19715 fi
19716 if $test -s signal.lst; then
19717         :
19718 else
19719         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19720         echo 'kill -l' >signal
19721         set X `csh -f <signal`
19722         $rm -f signal
19723         shift
19724         case $# in
19725         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19726         esac
19727         echo $@ | $tr ' ' $trnl | \
19728             $awk '{ printf "%s %d\n", $1, ++s; }
19729                   END { printf "NSIG %d\n", ++s }' >signal.lst
19730 fi
19731 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19732 EOS
19733 chmod a+x signal_cmd
19734 $eunicefix signal_cmd
19735
19736 : generate list of signal names
19737 echo " "
19738 case "$sig_name_init" in
19739 '') doinit=yes ;;
19740 *)  case "$sig_num_init" in
19741     ''|*,*) doinit=yes ;;
19742     esac ;;
19743 esac
19744 case "$doinit" in
19745 yes)
19746         echo "Generating a list of signal names and numbers..." >&4
19747         . ./signal_cmd
19748         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19749         sig_name=`$awk 'BEGIN { printf "ZERO " }
19750                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19751         sig_num=`$awk  'BEGIN { printf "0 " }
19752                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19753         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19754                              !/^NSIG/   { printf "\"%s\", ", $1 }
19755                              END        { printf "0\n" }' signal.lst`
19756         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19757                              !/^NSIG/   { printf "%d, ", $2}
19758                              END        { printf "0\n"}' signal.lst`
19759         ;;
19760 esac
19761 echo "The following $sig_count signals are available:"
19762 echo " "
19763 echo $sig_name | $awk \
19764 'BEGIN { linelen = 0 }
19765 {
19766         for (i = 1; i <= NF; i++) {
19767                 name = "SIG" $i " "
19768                 linelen = linelen + length(name)
19769                 if (linelen > 70) {
19770                         printf "\n"
19771                         linelen = length(name)
19772                 }
19773                 printf "%s", name
19774         }
19775         printf "\n"
19776 }'
19777 sig_size=`echo $sig_name | awk '{print NF}'`
19778 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19779
19780 echo " "
19781 case "$sizetype" in
19782 *_t) zzz="$sizetype"    ;;
19783 *)   zzz="filesize"     ;;
19784 esac
19785 echo "Checking the size of $zzz..." >&4 
19786 cat > try.c <<EOCP
19787 #include <sys/types.h>
19788 #include <stdio.h>
19789 #$i_stdlib I_STDLIB
19790 #ifdef I_STDLIB
19791 #include <stdlib.h>
19792 #endif
19793 int main() {
19794     printf("%d\n", (int)sizeof($sizetype));
19795     exit(0);
19796 }
19797 EOCP
19798 set try
19799 if eval $compile_ok; then
19800         yyy=`$run ./try`
19801         case "$yyy" in
19802         '')     sizesize=4
19803                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19804                 ;;
19805         *)      sizesize=$yyy
19806                 echo "Your $zzz size is $sizesize bytes."
19807                 ;;
19808         esac
19809 else
19810         sizesize=4
19811         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19812 fi
19813
19814
19815 : check for socklen_t
19816 echo " "
19817 echo "Checking to see if you have socklen_t..." >&4
19818 $cat >try.c <<EOCP
19819 #include <sys/types.h>
19820 #$d_socket HAS_SOCKET
19821 #ifdef HAS_SOCKET
19822 #include <sys/socket.h>
19823 #endif
19824 int main() { socklen_t x = 16; }
19825 EOCP
19826 set try
19827 if eval $compile; then
19828         val="$define"
19829         echo "You have socklen_t."
19830 else
19831         val="$undef"
19832         echo "You do not have socklen_t."
19833         case "$sizetype" in
19834         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19835         esac
19836 fi
19837 $rm -f try try.*
19838 set d_socklen_t
19839 eval $setvar
19840
19841 : see if this is a socks.h system
19842 set socks.h i_socks
19843 eval $inhdr
19844
19845 : check for type of the size argument to socket calls
19846 case "$d_socket" in
19847 "$define")
19848         $cat <<EOM
19849
19850 Checking to see what type is the last argument of accept().
19851 EOM
19852         yyy=''
19853         case "$d_socklen_t" in
19854         "$define") yyy="$yyy socklen_t"
19855         esac
19856         yyy="$yyy $sizetype int long unsigned"
19857         for xxx in $yyy; do
19858                 case "$socksizetype" in
19859                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19860                         case "$usesocks" in
19861                         "$define")
19862                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19863                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19864                                         socksizetype="$xxx"
19865                                 fi
19866                                 ;;
19867                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19868                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19869                                         socksizetype="$xxx"
19870                                 fi
19871                                 ;;
19872                         esac
19873                         ;;
19874                 esac
19875         done
19876 : In case none of those worked, prompt the user.
19877         case "$socksizetype" in
19878         '')     rp='What is the type for socket address structure sizes?'
19879                 dflt='int'
19880                 . ./myread
19881                 socksizetype=$ans
19882                 ;;
19883         esac
19884         ;;
19885 *)      : no sockets, so pick relatively harmless default
19886         socksizetype='int'
19887         ;;
19888 esac
19889
19890 : see what type is used for signed size_t
19891 set ssize_t ssizetype int stdio.h sys/types.h
19892 eval $typedef
19893 dflt="$ssizetype"
19894 $cat > try.c <<EOM
19895 #include <stdio.h>
19896 #$i_stdlib I_STDLIB
19897 #ifdef I_STDLIB
19898 #include <stdlib.h>
19899 #endif
19900 #include <sys/types.h>
19901 #define Size_t $sizetype
19902 #define SSize_t $dflt
19903 int main()
19904 {
19905         if (sizeof(Size_t) == sizeof(SSize_t))
19906                 printf("$dflt\n");
19907         else if (sizeof(Size_t) == sizeof(int))
19908                 printf("int\n");
19909         else 
19910                 printf("long\n");
19911         exit(0);
19912 }
19913 EOM
19914 echo " "
19915 set try
19916 if eval $compile_ok && $run ./try > /dev/null; then
19917         ssizetype=`$run ./try`
19918         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19919 else
19920         $cat >&4 <<EOM
19921 Help! I can't compile and run the ssize_t test program: please enlighten me!
19922 (This is probably a misconfiguration in your system or libraries, and
19923 you really ought to fix it.  Still, I'll try anyway.)
19924
19925 I need a type that is the same size as $sizetype, but is guaranteed to
19926 be signed.  Common values are ssize_t, int and long.
19927
19928 EOM
19929         rp="What signed type is the same size as $sizetype?"
19930         . ./myread
19931         ssizetype="$ans"
19932 fi
19933 $rm -f try try.*
19934
19935 : see what type of char stdio uses.
19936 echo " "
19937 echo '#include <stdio.h>' > stdio.c
19938 $cppstdin $cppminus < stdio.c > stdioh
19939 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19940         echo "Your stdio uses unsigned chars." >&4
19941         stdchar="unsigned char"
19942 else
19943         echo "Your stdio uses signed chars." >&4
19944         stdchar="char"
19945 fi
19946 $rm -f stdio.* stdioh
19947
19948 : see what type uids are declared as in the kernel
19949 echo " "
19950 echo "Looking for the type for user ids returned by getuid()."
19951 set uid_t uidtype xxx stdio.h sys/types.h
19952 eval $typedef
19953 case "$uidtype" in
19954 xxx)
19955         xxx=`./findhdr sys/user.h`
19956         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19957         case $1 in
19958         unsigned) dflt="$1 $2" ;;
19959         *) dflt="$1" ;;
19960         esac
19961         ;;
19962 *) dflt="$uidtype";;
19963 esac
19964 case "$uidtype" in
19965 uid_t)  echo "uid_t found." ;;
19966 *)      rp="What is the type for user ids returned by getuid()?"
19967         . ./myread
19968         uidtype="$ans"
19969         ;;
19970 esac
19971
19972 echo " "
19973 case "$uidtype" in
19974 *_t) zzz="$uidtype"     ;;
19975 *)   zzz="uid"          ;;
19976 esac
19977 echo "Checking the size of $zzz..." >&4 
19978 cat > try.c <<EOCP
19979 #include <sys/types.h>
19980 #include <stdio.h>
19981 #$i_stdlib I_STDLIB
19982 #ifdef I_STDLIB
19983 #include <stdlib.h>
19984 #endif
19985 int main() {
19986     printf("%d\n", (int)sizeof($uidtype));
19987     exit(0);
19988 }
19989 EOCP
19990 set try
19991 if eval $compile_ok; then
19992         yyy=`$run ./try`
19993         case "$yyy" in
19994         '')     uidsize=4
19995                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19996                 ;;
19997         *)      uidsize=$yyy
19998                 echo "Your $zzz is $uidsize bytes long."
19999                 ;;
20000         esac
20001 else
20002         uidsize=4
20003         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20004 fi
20005
20006 echo " "
20007 case "$uidtype" in
20008 *_t) zzz="$uidtype"     ;;
20009 *)   zzz="uid"          ;;
20010 esac
20011 echo "Checking the sign of $zzz..." >&4
20012 cat > try.c <<EOCP
20013 #include <sys/types.h>
20014 #include <stdio.h>
20015 int main() {
20016         $uidtype foo = -1;
20017         if (foo < 0)
20018                 printf("-1\n");
20019         else
20020                 printf("1\n");
20021 }
20022 EOCP
20023 set try
20024 if eval $compile; then
20025         yyy=`$run ./try`
20026         case "$yyy" in
20027         '')     uidsign=1
20028                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20029                 ;;
20030         *)      uidsign=$yyy
20031                 case "$uidsign" in
20032                  1) echo "Your $zzz is unsigned." ;;
20033                 -1) echo "Your $zzz is signed."   ;;
20034                 esac
20035                 ;;
20036         esac
20037 else
20038         uidsign=1
20039         echo "(I can't compile the test program--guessing unsigned.)" >&4
20040 fi
20041
20042
20043
20044 echo " "
20045 $echo "Checking the format string to be used for uids..." >&4
20046
20047 case "$uidsign" in
20048 -1)     if $test X"$uidsize" = X"$ivsize"; then
20049                 uidformat="$ivdformat"
20050         else
20051                 if $test X"$uidsize" = X"$longsize"; then
20052                         uidformat='"ld"'
20053                 else
20054                         if $test X"$uidsize" = X"$intsize"; then
20055                                 uidformat='"d"'
20056                         else
20057                                 if $test X"$uidsize" = X"$shortsize"; then
20058                                         uidformat='"hd"'
20059                                 fi
20060                         fi
20061                 fi
20062         fi
20063         ;;
20064 *)      if $test X"$uidsize" = X"$uvsize"; then
20065                 uidformat="$uvuformat"
20066         else
20067                 if $test X"$uidsize" = X"$longsize"; then
20068                         uidformat='"lu"'
20069                 else
20070                         if $test X"$uidsize" = X"$intsize"; then
20071                                 uidformat='"u"'
20072                         else
20073                                 if $test X"$uidsize" = X"$shortsize"; then
20074                                         uidformat='"hu"'
20075                                 fi
20076                         fi
20077                 fi
20078         fi
20079         ;;
20080 esac
20081
20082
20083 case "$usesitecustomize" in
20084     $define|true|[Yy]*)
20085         usesitecustomize="$define"
20086         ;;
20087     *)
20088         usesitecustomize="$undef"
20089         ;;
20090     esac
20091
20092 : determine compiler compiler
20093 case "$yacc" in
20094 '')
20095         dflt=yacc;;
20096 *)
20097         dflt="$yacc";;
20098 esac
20099 echo " "
20100 comp='yacc'
20101 if $test -f "$byacc$_exe"; then
20102         dflt="$byacc"
20103         comp="byacc or $comp"
20104 fi
20105 if $test -f "$bison$_exe"; then
20106         comp="$comp or bison -y"
20107 fi
20108 rp="Which compiler compiler ($comp) shall I use?"
20109 . ./myread
20110 yacc="$ans"
20111 case "$yacc" in
20112 *bis*)
20113         case "$yacc" in
20114         *-y*) ;;
20115         *)
20116                 yacc="$yacc -y"
20117                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20118                 ;;
20119         esac
20120         ;;
20121 esac
20122
20123 : see if this is a fp.h system
20124 set fp.h i_fp
20125 eval $inhdr
20126
20127 : see if this is a fp_class.h system
20128 set fp_class.h i_fp_class
20129 eval $inhdr
20130
20131 : see if this is a ieeefp.h system
20132 case "$i_ieeefp" in
20133 '' ) set ieeefp.h i_ieeefp
20134      eval $inhdr
20135      ;;
20136 esac
20137
20138 : see if this is a libutil.h system
20139 set libutil.h i_libutil
20140 eval $inhdr
20141
20142 : see if mach cthreads are available
20143 if test "X$usethreads" = "X$define"; then
20144         set mach/cthreads.h i_machcthr
20145         eval $inhdr
20146 else
20147         i_machcthr="$undef"
20148 fi
20149
20150
20151
20152 : see if this is a mntent.h system
20153 set mntent.h i_mntent
20154 eval $inhdr
20155
20156 : see if ndbm.h is available
20157 set ndbm.h t_ndbm
20158 eval $inhdr
20159
20160 case "$t_ndbm" in
20161 $undef)
20162     # Some Linux distributions such as RedHat 7.1 put the
20163     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20164     if $test -f /usr/include/gdbm/ndbm.h; then
20165         echo '<gdbm/ndbm.h> found.'
20166         ccflags="$ccflags -I/usr/include/gdbm"
20167         cppflags="$cppflags -I/usr/include/gdbm"
20168         t_ndbm=$define
20169     fi
20170     ;;
20171 esac
20172
20173 case "$t_ndbm" in
20174 $define)
20175         : see if dbm_open exists
20176         set dbm_open d_dbm_open
20177         eval $inlibc
20178         case "$d_dbm_open" in
20179         $undef)
20180                 t_ndbm="$undef"
20181                 echo "We won't be including <ndbm.h>"
20182                 ;;
20183         esac
20184         ;;
20185 esac
20186 val="$t_ndbm"
20187 set i_ndbm
20188 eval $setvar
20189
20190 : see if net/errno.h is available
20191 val=''
20192 set net/errno.h val
20193 eval $inhdr
20194
20195 : Unfortunately, it causes problems on some systems.  Arrgh.
20196 case "$val" in
20197 $define)
20198         cat > try.c <<'EOM'
20199 #include <stdio.h>
20200 #include <errno.h>
20201 #include <net/errno.h>
20202 int func()
20203 {
20204         return ENOTSOCK;
20205 }
20206 EOM
20207         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20208                 echo "We'll be including <net/errno.h>." >&4
20209         else
20210                 echo "We won't be including <net/errno.h>." >&4
20211                 val="$undef"
20212         fi
20213         $rm -f try.* try
20214         ;;
20215 esac
20216 set i_neterrno
20217 eval $setvar
20218
20219 : see if netinet/tcp.h is available
20220 set netinet/tcp.h i_netinettcp
20221 eval $inhdr
20222
20223 : see if this is a poll.h system
20224 set poll.h i_poll
20225 eval $inhdr
20226
20227 : see if this is a prot.h system
20228 set prot.h i_prot
20229 eval $inhdr
20230
20231 echo " "
20232 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20233 $cat <<'EOSH' > Cppsym.know
20234 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20235 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20236 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20237 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20238 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20239 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20240 bull c cadmus clipper CMU COFF COMPILER_VERSION
20241 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20242 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20243 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20244 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20245 GLIBC GLIBC_MINOR
20246 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20247 H3050R H3050RX hbullx20 hcx host_mips
20248 hp200 hp300 hp700 HP700 hp800 hp9000
20249 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20250 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20251 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20252 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20253 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20254 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20255 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20256 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20257 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20258 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20259 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20260 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20261 MATH_HAS_NO_SIDE_EFFECTS
20262 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20263 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20264 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20265 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20266 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20267 NetBSD news1500 news1700 news1800 news1900 news3700
20268 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20269 ns32016 ns32332 ns32k nsc32000
20270 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20271 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20272 pc532 pdp11 PGC PIC plexus PORTAR posix
20273 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20274 POSIX_C_SOURCE POSIX_SOURCE POWER
20275 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20276 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20277 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20278 sony sony_news sonyrisc sparc sparclite spectrum
20279 stardent stdc STDC_EXT stratos sun sun3 sun386
20280 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20281 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20282 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20283 sysV68 sysV88 Tek4132 Tek4300 titan
20284 TM3200 TM5400 TM5600
20285 tower tower32 tower32_200 tower32_600 tower32_700
20286 tower32_800 tower32_850 tss
20287 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20288 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20289 unix UNIX95 UNIX99 unixpc unos
20290 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20291 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20292 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20293 USGr4 USGr4_2
20294 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20295 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20296 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20297 z8000
20298 EOSH
20299 # Maybe put other stuff here too.
20300 cat <<EOSH >>Cppsym.know
20301 $osname
20302 EOSH
20303 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20304 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20305 $cat Cppsym.know > Cppsym.c
20306 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20307 $rm -f Cppsym.a Cppsym.b Cppsym.c
20308 cat <<EOSH > Cppsym
20309 $startsh
20310 if $test \$# -gt 0; then
20311     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20312     if $test -s Cppsym.got; then
20313         $rm -f Cppsym.got
20314         exit 0
20315     fi
20316     $rm -f Cppsym.got
20317     exit 1
20318 else
20319     $tr " " "$trnl" | ./Cppsym.try
20320     exit 0
20321 fi
20322 EOSH
20323 chmod +x Cppsym
20324 $eunicefix Cppsym
20325 cat <<EOSH > Cppsym.try
20326 $startsh
20327 cat <<'EOCP' > try.c
20328 #include <stdio.h>
20329 #if cpp_stuff == 1
20330 #define STRINGIFY(a)    "a"
20331 #endif
20332 #if cpp_stuff == 42
20333 #define StGiFy(a)  #a
20334 #define STRINGIFY(a)    StGiFy(a)
20335 #endif
20336 #if $cpp_stuff != 1 && $cpp_stuff != 42
20337 #   include "Bletch: How does this C preprocessor stringify macros?"
20338 #endif
20339 int main() {
20340 EOCP
20341 $awk \\
20342 EOSH
20343 cat <<'EOSH' >> Cppsym.try
20344 'length($1) > 0 {
20345     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20346     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20347     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20348     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20349 }'       >> try.c
20350 echo 'return 0;}' >> try.c
20351 EOSH
20352 cat <<EOSH >> Cppsym.try
20353 ccflags="$ccflags"
20354 case "$osname-$gccversion" in
20355 irix-) ccflags="\$ccflags -woff 1178" ;;
20356 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20357 esac
20358 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20359 EOSH
20360 chmod +x Cppsym.try
20361 $eunicefix Cppsym.try
20362 ./Cppsym < Cppsym.know > Cppsym.true
20363 : Add in any linux cpp "predefined macros":
20364 case "$osname::$gccversion" in
20365   *linux*::*.*)
20366     tHdrH=_tmpHdr
20367     rm -f $tHdrH'.h' $tHdrH
20368     touch $tHdrH'.h'
20369     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20370        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20371        if [ -s $tHdrH'_cppsym.real' ]; then
20372           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20373        fi
20374     fi
20375     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20376   ;;
20377 esac
20378 : now check the C compiler for additional symbols
20379 postprocess_cc_v=''
20380 case "$osname" in
20381 aix) postprocess_cc_v="|$tr , ' '" ;;
20382 esac
20383 $cat >ccsym <<EOS
20384 $startsh
20385 $cat >tmp.c <<EOF
20386 extern int foo;
20387 EOF
20388 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20389 do
20390         case "\$i" in
20391         -D*) echo "\$i" | $sed 's/^-D//';;
20392         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20393         esac
20394 done
20395 $rm -f try.c
20396 EOS
20397 postprocess_cc_v=''
20398 chmod +x ccsym
20399 $eunicefix ccsym
20400 ./ccsym > ccsym1.raw
20401 if $test -s ccsym1.raw; then
20402        $sort ccsym1.raw | $uniq >ccsym.raw
20403 else
20404        mv ccsym1.raw ccsym.raw
20405 fi
20406
20407 $awk '/\=/ { print $0; next }
20408         { print $0"=1" }' ccsym.raw >ccsym.list
20409 $comm -13 Cppsym.true ccsym.list >ccsym.own
20410 $comm -12 Cppsym.true ccsym.list >ccsym.com
20411 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20412 also=''
20413 if $test -z ccsym.raw; then
20414         echo "Your C compiler doesn't seem to define any symbols!" >&4
20415         echo " "
20416         echo "However, your C preprocessor defines the following symbols:"
20417         $cat Cppsym.true
20418         ccsymbols=''
20419         cppsymbols=`$cat Cppsym.true`
20420         cppsymbols=`echo $cppsymbols`
20421         cppccsymbols="$cppsymbols"
20422 else
20423         if $test -s ccsym.com; then
20424                 echo "Your C compiler and pre-processor define these symbols:"
20425                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20426                 also='also '
20427                 symbols='ones'
20428                 cppccsymbols=`$cat ccsym.com`
20429                 cppccsymbols=`echo $cppccsymbols`
20430                 $test "$silent" || sleep 1
20431         fi
20432         if $test -s ccsym.cpp; then
20433                 $test "$also" && echo " "
20434                 echo "Your C pre-processor ${also}defines the following symbols:"
20435                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20436                 also='further '
20437                 cppsymbols=`$cat ccsym.cpp`
20438                 cppsymbols=`echo $cppsymbols`
20439                 $test "$silent" || sleep 1
20440         fi
20441         if $test -s ccsym.own; then
20442                 $test "$also" && echo " "
20443                 echo "Your C compiler ${also}defines the following cpp symbols:"
20444                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20445                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20446                 ccsymbols=`$cat ccsym.own`
20447                 ccsymbols=`echo $ccsymbols`
20448                 $test "$silent" || sleep 1
20449         fi
20450 fi
20451
20452 : see if this is a termio system
20453 val="$undef"
20454 val2="$undef"
20455 val3="$undef"
20456 if $test `./findhdr termios.h`; then
20457         set tcsetattr i_termios
20458         eval $inlibc
20459         val3="$i_termios"
20460 fi
20461 echo " "
20462 case "$val3" in
20463 "$define") echo "You have POSIX termios.h... good!" >&4;;
20464 *) if ./Cppsym pyr; then
20465                 case "`/bin/universe`" in
20466                 ucb) if $test `./findhdr sgtty.h`; then
20467                                 val2="$define"
20468                                 echo "<sgtty.h> found." >&4
20469                         else
20470                                 echo "System is pyramid with BSD universe."
20471                                 echo "<sgtty.h> not found--you could have problems." >&4
20472                         fi;;
20473                 *) if $test `./findhdr termio.h`; then
20474                                 val="$define"
20475                                 echo "<termio.h> found." >&4
20476                         else
20477                                 echo "System is pyramid with USG universe."
20478                                 echo "<termio.h> not found--you could have problems." >&4
20479                         fi;;
20480                 esac
20481         elif ./usg; then
20482                 if $test `./findhdr termio.h`; then
20483                         echo "<termio.h> found." >&4
20484                         val="$define"
20485                 elif $test `./findhdr sgtty.h`; then
20486                         echo "<sgtty.h> found." >&4
20487                         val2="$define"
20488                 else
20489 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20490                 fi
20491         else
20492                 if $test `./findhdr sgtty.h`; then
20493                         echo "<sgtty.h> found." >&4
20494                         val2="$define"
20495                 elif $test `./findhdr termio.h`; then
20496                         echo "<termio.h> found." >&4
20497                         val="$define"
20498                 else
20499 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20500                 fi
20501         fi;;
20502 esac
20503 set i_termio; eval $setvar
20504 val=$val2; set i_sgtty; eval $setvar
20505 val=$val3; set i_termios; eval $setvar
20506
20507 : see if stddef is available
20508 set stddef.h i_stddef
20509 eval $inhdr
20510
20511 : see if this is a sunmath.h system
20512 set sunmath.h i_sunmath
20513 eval $inhdr
20514
20515 : see if sys/access.h is available
20516 set sys/access.h i_sysaccess
20517 eval $inhdr
20518
20519 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20520 set sys/filio.h i_sysfilio
20521 eval $inhdr
20522 echo " "
20523 if $test `./findhdr sys/ioctl.h`; then
20524         val="$define"
20525         echo '<sys/ioctl.h> found.' >&4
20526 else
20527         val="$undef"
20528         if $test $i_sysfilio = "$define"; then
20529             echo '<sys/ioctl.h> NOT found.' >&4
20530         else
20531                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20532                 $test $i_termio = "$define" && xxx="termio.h"
20533                 $test $i_termios = "$define" && xxx="termios.h"
20534 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20535         fi
20536 fi
20537 set i_sysioctl
20538 eval $setvar
20539
20540 : see if socket ioctl defs are in sys/sockio.h
20541 echo " "
20542 xxx=`./findhdr sys/sockio.h`
20543 if $test "$xxx"; then
20544         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20545                 val="$define"
20546                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20547         else
20548                 val="$undef"
20549                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20550         fi
20551 else
20552         val="$undef"
20553         $cat <<EOM
20554 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20555 EOM
20556 fi
20557 set i_syssockio
20558 eval $setvar
20559
20560
20561 : see if this is a syslog.h system
20562 set syslog.h i_syslog
20563 eval $inhdr
20564
20565
20566 : see if this is a sys/mode.h system
20567 set sys/mode.h i_sysmode
20568 eval $inhdr
20569
20570 : see if sys/resource.h has to be included
20571 set sys/resource.h i_sysresrc
20572 eval $inhdr
20573
20574 : see if sys/security.h is available
20575 set sys/security.h i_syssecrt
20576 eval $inhdr
20577
20578 : see if this is a sys/statvfs.h system
20579 set sys/statvfs.h i_sysstatvfs
20580 eval $inhdr
20581
20582 : see if this is a sys/un.h system
20583 set sys/un.h i_sysun
20584 eval $inhdr
20585
20586
20587 : see if this is a sys/utsname.h system
20588 set sys/utsname.h i_sysutsname
20589 eval $inhdr
20590
20591 : see if this is a syswait system
20592 set sys/wait.h i_syswait
20593 eval $inhdr
20594
20595 : see if this is a ustat.h system
20596 set ustat.h i_ustat
20597 eval $inhdr
20598
20599 : see if this is an utime system
20600 set utime.h i_utime
20601 eval $inhdr
20602
20603 : see if this is a values.h system
20604 set values.h i_values
20605 eval $inhdr
20606
20607 : see if this is a vfork system
20608 case "$d_vfork" in
20609 "$define")
20610         set vfork.h i_vfork
20611         eval $inhdr
20612         ;;
20613 *)
20614         i_vfork="$undef"
20615         ;;
20616 esac
20617
20618 : see if gdbm.h is available
20619 set gdbm.h t_gdbm
20620 eval $inhdr
20621 case "$t_gdbm" in
20622 $define)
20623         : see if gdbm_open exists
20624         set gdbm_open d_gdbm_open
20625         eval $inlibc
20626         case "$d_gdbm_open" in
20627         $undef)
20628                 t_gdbm="$undef"
20629                 echo "We won't be including <gdbm.h>"
20630                 ;;
20631         esac
20632         ;;
20633 esac
20634 val="$t_gdbm"
20635 set i_gdbm
20636 eval $setvar
20637
20638 echo " "
20639 echo "Looking for extensions..." >&4
20640 : If we are using the old config.sh, known_extensions may contain
20641 : old or inaccurate or duplicate values.
20642 known_extensions=''
20643 nonxs_extensions=''
20644 : We do not use find because it might not be available.
20645 : We do not just use MANIFEST because the user may have dropped
20646 : some additional extensions into the source tree and expect them
20647 : to be built.
20648
20649 : Function to recursively find available extensions, ignoring DynaLoader
20650 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20651 find_extensions='
20652     for xxx in *; do
20653        case "$xxx" in
20654            DynaLoader|dynaload) ;;
20655            *)
20656            if $test -f $xxx/$xxx.xs; then
20657                known_extensions="$known_extensions $1$xxx";
20658            elif $test -f $xxx/Makefile.PL; then
20659                nonxs_extensions="$nonxs_extensions $1$xxx";
20660            else
20661                if $test -d $xxx -a $# -lt 10; then
20662                    set $1$xxx/ $*;
20663                    cd "$xxx";
20664                    eval $find_extensions;
20665                    cd ..;
20666                    shift;
20667                fi;
20668            fi
20669            ;;
20670        esac;
20671     done'
20672 tdir=`pwd`
20673 cd "$rsrc/ext"
20674 set X
20675 shift
20676 eval $find_extensions
20677 # Special case:  Add in threads/shared since it is not picked up by the
20678 # recursive find above (and adding in general recursive finding breaks
20679 # SDBM_File/sdbm).  A.D.  10/25/2001.
20680 known_extensions="$known_extensions threads/shared"
20681 set X $nonxs_extensions
20682 shift
20683 nonxs_extensions="$*"
20684 set X $known_extensions
20685 shift
20686 known_extensions="$*"
20687 cd "$tdir"
20688
20689 : Now see which are supported on this system.
20690 avail_ext=''
20691 for xxx in $known_extensions ; do
20692         case "$xxx" in
20693         DB_File|db_file)
20694                 case "$i_db" in
20695                 $define) avail_ext="$avail_ext $xxx" ;;
20696                 esac
20697                 ;;
20698         GDBM_File|gdbm_fil)
20699                 case "$i_gdbm" in 
20700                 $define) avail_ext="$avail_ext $xxx" ;;
20701                 esac
20702                 ;;
20703         I18N/Langinfo|i18n_lan)
20704                 case "$i_langinfo$d_nl_langinfo" in 
20705                 $define$define) avail_ext="$avail_ext $xxx" ;;
20706                 esac
20707                 ;;
20708         NDBM_File|ndbm_fil)
20709                 case "$i_ndbm" in
20710                 $define)
20711                     case "$osname-$use64bitint" in
20712                     hpux-define)
20713                         case "$libs" in
20714                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20715                         esac
20716                         ;;
20717                     *) avail_ext="$avail_ext $xxx" ;;
20718                     esac
20719                     ;;
20720                 esac
20721                 ;;
20722         ODBM_File|odbm_fil) 
20723                 case "${i_dbm}${i_rpcsvcdbm}" in
20724                 *"${define}"*)
20725                     case "$osname-$use64bitint" in
20726                     hpux-define)
20727                         case "$libs" in
20728                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20729                         esac
20730                         ;;
20731                     *) avail_ext="$avail_ext $xxx" ;;
20732                     esac
20733                     ;;
20734                 esac
20735                 ;;
20736         POSIX|posix)
20737                 case "$useposix" in
20738                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20739                 esac
20740                 ;;
20741         Opcode|opcode)
20742                 case "$useopcode" in
20743                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20744                 esac
20745                 ;;
20746         Socket|socket)
20747                 case "$d_socket" in 
20748                 true|$define|y)
20749                     case "$osname" in
20750                     beos) ;; # not unless BONE
20751                     *) avail_ext="$avail_ext $xxx" ;;
20752                     esac
20753                     ;;
20754                 esac
20755                 ;;
20756         Sys/Syslog|sys/syslog)
20757                 : XXX syslog requires socket
20758                 case "$d_socket" in 
20759                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20760                 esac
20761                 ;;
20762         Thread|thread)
20763                 case "$usethreads" in
20764                 true|$define|y)
20765                         case "$useithreads" in
20766                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20767                         esac
20768                 esac
20769                 ;;
20770         XS/APItest|xs/apitest)
20771                 # This is just for testing.  Skip it unless we have dynamic loading.
20772
20773                 case "$usedl" in
20774                 $define) avail_ext="$avail_ext $xxx" ;;
20775                 esac
20776                 ;;
20777         XS/Typemap|xs/typemap)
20778                 # This is just for testing.  Skip it unless we have dynamic loading.
20779                 case "$usedl" in
20780                 $define) avail_ext="$avail_ext $xxx" ;;
20781                 esac
20782                 ;;
20783         threads|threads/shared)
20784                 # threads and threads::shared are special cases.
20785                 # To stop people from asking "Perl 5.8.0 was supposed
20786                 # to have this new fancy threads implementation but my
20787                 # perl doesn't have it" and from people trying to
20788                 # (re)install the threads module using CPAN.pm and
20789                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20790                 # the threads.pm and threads/shared.pm will always be
20791                 # there, croaking informatively ("you need to rebuild
20792                 # all of Perl with threads, sorry") when threads haven't
20793                 # been compiled in.
20794                 # --jhi
20795                 avail_ext="$avail_ext $xxx"
20796                 ;;
20797         IPC/SysV|ipc/sysv)
20798                 : XXX Do we need a useipcsysv variable here
20799                 case "${d_msg}${d_sem}${d_shm}" in 
20800                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20801                 esac
20802                 ;;
20803         *)      avail_ext="$avail_ext $xxx"
20804                 ;;
20805         esac
20806 done
20807
20808 set X $avail_ext
20809 shift
20810 avail_ext="$*"
20811
20812 case "$onlyextensions" in
20813 '') ;;
20814 *)  keepextensions=''
20815     echo "You have requested that only certains extensions be included..." >&4
20816     for i in $onlyextensions; do
20817         case " $avail_ext " in
20818         *" $i "*)
20819             echo "Keeping extension $i."
20820             keepextensions="$keepextensions $i"
20821             ;;
20822         *) echo "Ignoring extension $i." ;;
20823         esac
20824     done
20825     avail_ext="$keepextensions"
20826     ;;
20827 esac
20828
20829 case "$noextensions" in
20830 '') ;;
20831 *)  keepextensions=''
20832     echo "You have requested that certain extensions be ignored..." >&4
20833     for i in $avail_ext; do
20834         case " $noextensions " in
20835         *" $i "*) echo "Ignoring extension $i." ;;
20836         *) echo "Keeping extension $i.";
20837            keepextensions="$keepextensions $i"
20838            ;;
20839         esac
20840     done
20841     avail_ext="$keepextensions"
20842     ;;
20843 esac
20844
20845 : Now see which nonxs extensions are supported on this system.
20846 : For now assume all are.
20847 nonxs_ext=''
20848 for xxx in $nonxs_extensions ; do
20849         case "$xxx" in
20850         *)      nonxs_ext="$nonxs_ext $xxx"
20851                 ;;
20852         esac
20853 done
20854
20855 set X $nonxs_ext
20856 shift
20857 nonxs_ext="$*"
20858
20859 case $usedl in
20860 $define)
20861         $cat <<EOM
20862 A number of extensions are supplied with $package.  You may choose to
20863 compile these extensions for dynamic loading (the default), compile
20864 them into the $package executable (static loading), or not include
20865 them at all.  Answer "none" to include no extensions.
20866 Note that DynaLoader is always built and need not be mentioned here.
20867
20868 EOM
20869         case "$dynamic_ext" in
20870         '')
20871                 : Exclude those listed in static_ext
20872                 dflt=''
20873                 for xxx in $avail_ext; do
20874                         case " $static_ext " in
20875                         *" $xxx "*) ;;
20876                         *) dflt="$dflt $xxx" ;;
20877                         esac
20878                 done
20879                 set X $dflt
20880                 shift
20881                 dflt="$*"
20882                 ;;
20883         *)      dflt="$dynamic_ext"
20884                 # Perhaps we are reusing an old out-of-date config.sh.
20885                 case "$hint" in
20886                 previous)
20887                         if test X"$dynamic_ext" != X"$avail_ext"; then
20888                                 $cat <<EOM
20889 NOTICE:  Your previous config.sh list may be incorrect. 
20890 The extensions now available to you are 
20891         ${avail_ext}
20892 but the default list from your previous config.sh is
20893         ${dynamic_ext} 
20894
20895 EOM
20896                         fi
20897                         ;;
20898                 esac
20899                 ;;
20900         esac
20901         case "$dflt" in
20902         '')     dflt=none;;
20903         esac
20904         rp="What extensions do you wish to load dynamically?"
20905         . ./myread
20906         case "$ans" in
20907         none) dynamic_ext=' ' ;;
20908         *) dynamic_ext="$ans" ;;
20909         esac
20910
20911         case "$static_ext" in
20912         '')
20913                 : Exclude those already listed in dynamic linking
20914                 dflt=''
20915                 for xxx in $avail_ext; do
20916                         case " $dynamic_ext " in
20917                         *" $xxx "*) ;;
20918                         *) dflt="$dflt $xxx" ;;
20919                         esac
20920                 done
20921                 set X $dflt
20922                 shift
20923                 dflt="$*"
20924                 ;;
20925         *)  dflt="$static_ext" 
20926                 ;;
20927         esac
20928
20929         case "$dflt" in
20930         '')     dflt=none;;
20931         esac
20932         rp="What extensions do you wish to load statically?"
20933         . ./myread
20934         case "$ans" in
20935         none) static_ext=' ' ;;
20936         *) static_ext="$ans" ;;
20937         esac
20938         ;;
20939 *)
20940         $cat <<EOM
20941 A number of extensions are supplied with $package.  Answer "none" 
20942 to include no extensions. 
20943 Note that DynaLoader is always built and need not be mentioned here.
20944
20945 EOM
20946         case "$static_ext" in
20947         '') dflt="$avail_ext" ;;
20948         *)      dflt="$static_ext"
20949                 # Perhaps we are reusing an old out-of-date config.sh.
20950                 case "$hint" in
20951                 previous)
20952                         if test X"$static_ext" != X"$avail_ext"; then
20953                                 $cat <<EOM
20954 NOTICE:  Your previous config.sh list may be incorrect. 
20955 The extensions now available to you are 
20956         ${avail_ext}
20957 but the default list from your previous config.sh is
20958         ${static_ext} 
20959
20960 EOM
20961                         fi
20962                         ;;
20963                 esac
20964                 ;;
20965         esac
20966         : Exclude those that are not xs extensions
20967         case "$dflt" in
20968         '')     dflt=none;;
20969         esac
20970         rp="What extensions do you wish to include?"
20971         . ./myread
20972         case "$ans" in
20973         none) static_ext=' ' ;;
20974         *) static_ext="$ans" ;;
20975         esac
20976         ;;
20977 esac
20978 #        
20979 # Encode is a special case.  If we are building Encode as a static
20980 # extension, we need to explicitly list its subextensions as well.
20981 # For other nested extensions, this is handled automatically by
20982 # the appropriate Makefile.PL.
20983 case " $static_ext " in
20984         *" Encode "*) # Add the subextensions of Encode
20985         cd "$rsrc/ext"
20986         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20987                 static_ext="$static_ext Encode/$xxx"
20988         done
20989         cd "$tdir"
20990         ;;
20991 esac
20992
20993 set X $dynamic_ext $static_ext $nonxs_ext
20994 shift
20995 extensions="$*"
20996
20997 # Sanity check:  We require an extension suitable for use with
20998 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20999 # should show up as failures in the test suite, but it's helpful to
21000 # catch them now.) The 'extensions' list is normally sorted
21001 # alphabetically, so we need to accept either
21002 #    DB_File ... Fcntl ... IO  ....
21003 # or something like
21004 #    Fcntl ... NDBM_File ... IO  ....
21005 case " $extensions"  in
21006 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21007 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21008 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21009 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21010    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21011    ;;
21012 esac
21013
21014 : Remove libraries needed only for extensions
21015 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21016 : The exception is SunOS 4.x, which needs them.
21017 case "${osname}X${osvers}" in
21018 sunos*X4*)
21019     perllibs="$libs"
21020     ;;
21021 *) case "$usedl" in
21022     $define|true|[yY]*)
21023             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21024             shift
21025             perllibs="$*"
21026             ;;
21027     *)  perllibs="$libs"
21028             ;;
21029     esac
21030     ;;
21031 esac
21032
21033 : Remove build directory name from cppstdin so it can be used from
21034 : either the present location or the final installed location.
21035 echo " "
21036 : Get out of the UU directory to get correct path name.
21037 cd ..
21038 case "$cppstdin" in
21039 `pwd`/cppstdin)
21040         echo "Stripping down cppstdin path name"
21041         cppstdin=cppstdin
21042         ;;
21043 esac
21044 cd UU
21045
21046 : end of configuration questions
21047 echo " "
21048 echo "End of configuration questions."
21049 echo " "
21050
21051 : back to where it started
21052 if test -d ../UU; then
21053         cd ..
21054 fi
21055
21056 : configuration may be patched via a 'config.arch' file
21057 if $test -f config.arch; then
21058         echo "I see a config.arch file, loading it."
21059         . ./config.arch
21060 fi
21061
21062 : configuration may be patched via a 'config.over' file
21063 if $test -f config.over; then
21064         echo " "
21065         dflt=y
21066         rp='I see a config.over file.  Do you wish to load it?'
21067         . UU/myread
21068         case "$ans" in
21069         n*) echo "OK, I'll ignore it.";;
21070         *)      . ./config.over
21071                 echo "Configuration override changes have been loaded."
21072                 ;;
21073         esac
21074 fi
21075
21076 : in case they want portability, strip down executable paths
21077 case "$d_portable" in
21078 "$define")
21079         echo " "
21080         echo "Stripping down executable paths..." >&4
21081         for file in $loclist $trylist; do
21082                 eval temp=\$$file
21083                 eval $file=`basename $temp`
21084         done
21085         ;;
21086 esac
21087
21088 : create config.sh file
21089 echo " "
21090 echo "Creating config.sh..." >&4
21091 $spitshell <<EOT >config.sh
21092 $startsh
21093 #
21094 # This file was produced by running the Configure script. It holds all the
21095 # definitions figured out by Configure. Should you modify one of these values,
21096 # do not forget to propagate your changes by running "Configure -der". You may
21097 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21098 #
21099
21100 # Package name      : $package
21101 # Source directory  : $src
21102 # Configuration time: $cf_time
21103 # Configured by     : $cf_by
21104 # Target system     : $myuname
21105
21106 Author='$Author'
21107 Date='$Date'
21108 Header='$Header'
21109 Id='$Id'
21110 Locker='$Locker'
21111 Log='$Log'
21112 Mcc='$Mcc'
21113 RCSfile='$RCSfile'
21114 Revision='$Revision'
21115 Source='$Source'
21116 State='$State'
21117 _a='$_a'
21118 _exe='$_exe'
21119 _o='$_o'
21120 afs='$afs'
21121 afsroot='$afsroot'
21122 alignbytes='$alignbytes'
21123 ansi2knr='$ansi2knr'
21124 aphostname='$aphostname'
21125 api_revision='$api_revision'
21126 api_subversion='$api_subversion'
21127 api_version='$api_version'
21128 api_versionstring='$api_versionstring'
21129 ar='$ar'
21130 archlib='$archlib'
21131 archlibexp='$archlibexp'
21132 archname64='$archname64'
21133 archname='$archname'
21134 archobjs='$archobjs'
21135 asctime_r_proto='$asctime_r_proto'
21136 awk='$awk'
21137 baserev='$baserev'
21138 bash='$bash'
21139 bin='$bin'
21140 binexp='$binexp'
21141 bison='$bison'
21142 byacc='$byacc'
21143 byteorder='$byteorder'
21144 c='$c'
21145 castflags='$castflags'
21146 cat='$cat'
21147 cc='$cc'
21148 cccdlflags='$cccdlflags'
21149 ccdlflags='$ccdlflags'
21150 ccflags='$ccflags'
21151 ccflags_uselargefiles='$ccflags_uselargefiles'
21152 ccname='$ccname'
21153 ccsymbols='$ccsymbols'
21154 ccversion='$ccversion'
21155 cf_by='$cf_by'
21156 cf_email='$cf_email'
21157 cf_time='$cf_time'
21158 charsize='$charsize'
21159 chgrp='$chgrp'
21160 chmod='$chmod'
21161 chown='$chown'
21162 clocktype='$clocktype'
21163 comm='$comm'
21164 compress='$compress'
21165 contains='$contains'
21166 cp='$cp'
21167 cpio='$cpio'
21168 cpp='$cpp'
21169 cpp_stuff='$cpp_stuff'
21170 cppccsymbols='$cppccsymbols'
21171 cppflags='$cppflags'
21172 cpplast='$cpplast'
21173 cppminus='$cppminus'
21174 cpprun='$cpprun'
21175 cppstdin='$cppstdin'
21176 cppsymbols='$cppsymbols'
21177 crypt_r_proto='$crypt_r_proto'
21178 cryptlib='$cryptlib'
21179 csh='$csh'
21180 ctermid_r_proto='$ctermid_r_proto'
21181 ctime_r_proto='$ctime_r_proto'
21182 d_Gconvert='$d_Gconvert'
21183 d_PRIEUldbl='$d_PRIEUldbl'
21184 d_PRIFUldbl='$d_PRIFUldbl'
21185 d_PRIGUldbl='$d_PRIGUldbl'
21186 d_PRIXU64='$d_PRIXU64'
21187 d_PRId64='$d_PRId64'
21188 d_PRIeldbl='$d_PRIeldbl'
21189 d_PRIfldbl='$d_PRIfldbl'
21190 d_PRIgldbl='$d_PRIgldbl'
21191 d_PRIi64='$d_PRIi64'
21192 d_PRIo64='$d_PRIo64'
21193 d_PRIu64='$d_PRIu64'
21194 d_PRIx64='$d_PRIx64'
21195 d_SCNfldbl='$d_SCNfldbl'
21196 d__fwalk='$d__fwalk'
21197 d_access='$d_access'
21198 d_accessx='$d_accessx'
21199 d_aintl='$d_aintl'
21200 d_alarm='$d_alarm'
21201 d_archlib='$d_archlib'
21202 d_asctime_r='$d_asctime_r'
21203 d_atolf='$d_atolf'
21204 d_atoll='$d_atoll'
21205 d_attribute_format='$d_attribute_format'
21206 d_attribute_malloc='$d_attribute_malloc'
21207 d_attribute_nonnull='$d_attribute_nonnull'
21208 d_attribute_noreturn='$d_attribute_noreturn'
21209 d_attribute_pure='$d_attribute_pure'
21210 d_attribute_unused='$d_attribute_unused'
21211 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21212 d_bcmp='$d_bcmp'
21213 d_bcopy='$d_bcopy'
21214 d_bsd='$d_bsd'
21215 d_bsdgetpgrp='$d_bsdgetpgrp'
21216 d_bsdsetpgrp='$d_bsdsetpgrp'
21217 d_builtin_choose_expr='$d_builtin_choose_expr'
21218 d_builtin_expect='$d_builtin_expect'
21219 d_bzero='$d_bzero'
21220 d_casti32='$d_casti32'
21221 d_castneg='$d_castneg'
21222 d_charvspr='$d_charvspr'
21223 d_chown='$d_chown'
21224 d_chroot='$d_chroot'
21225 d_chsize='$d_chsize'
21226 d_class='$d_class'
21227 d_clearenv='$d_clearenv'
21228 d_closedir='$d_closedir'
21229 d_cmsghdr_s='$d_cmsghdr_s'
21230 d_const='$d_const'
21231 d_copysignl='$d_copysignl'
21232 d_crypt='$d_crypt'
21233 d_crypt_r='$d_crypt_r'
21234 d_csh='$d_csh'
21235 d_ctermid_r='$d_ctermid_r'
21236 d_ctime_r='$d_ctime_r'
21237 d_cuserid='$d_cuserid'
21238 d_dbl_dig='$d_dbl_dig'
21239 d_dbminitproto='$d_dbminitproto'
21240 d_difftime='$d_difftime'
21241 d_dirfd='$d_dirfd'
21242 d_dirnamlen='$d_dirnamlen'
21243 d_dlerror='$d_dlerror'
21244 d_dlopen='$d_dlopen'
21245 d_dlsymun='$d_dlsymun'
21246 d_dosuid='$d_dosuid'
21247 d_drand48_r='$d_drand48_r'
21248 d_drand48proto='$d_drand48proto'
21249 d_dup2='$d_dup2'
21250 d_eaccess='$d_eaccess'
21251 d_endgrent='$d_endgrent'
21252 d_endgrent_r='$d_endgrent_r'
21253 d_endhent='$d_endhent'
21254 d_endhostent_r='$d_endhostent_r'
21255 d_endnent='$d_endnent'
21256 d_endnetent_r='$d_endnetent_r'
21257 d_endpent='$d_endpent'
21258 d_endprotoent_r='$d_endprotoent_r'
21259 d_endpwent='$d_endpwent'
21260 d_endpwent_r='$d_endpwent_r'
21261 d_endsent='$d_endsent'
21262 d_endservent_r='$d_endservent_r'
21263 d_eofnblk='$d_eofnblk'
21264 d_eunice='$d_eunice'
21265 d_faststdio='$d_faststdio'
21266 d_fchdir='$d_fchdir'
21267 d_fchmod='$d_fchmod'
21268 d_fchown='$d_fchown'
21269 d_fcntl='$d_fcntl'
21270 d_fcntl_can_lock='$d_fcntl_can_lock'
21271 d_fd_macros='$d_fd_macros'
21272 d_fd_set='$d_fd_set'
21273 d_fds_bits='$d_fds_bits'
21274 d_fgetpos='$d_fgetpos'
21275 d_finite='$d_finite'
21276 d_finitel='$d_finitel'
21277 d_flexfnam='$d_flexfnam'
21278 d_flock='$d_flock'
21279 d_flockproto='$d_flockproto'
21280 d_fork='$d_fork'
21281 d_fp_class='$d_fp_class'
21282 d_fpathconf='$d_fpathconf'
21283 d_fpclass='$d_fpclass'
21284 d_fpclassify='$d_fpclassify'
21285 d_fpclassl='$d_fpclassl'
21286 d_fpos64_t='$d_fpos64_t'
21287 d_frexpl='$d_frexpl'
21288 d_fs_data_s='$d_fs_data_s'
21289 d_fseeko='$d_fseeko'
21290 d_fsetpos='$d_fsetpos'
21291 d_fstatfs='$d_fstatfs'
21292 d_fstatvfs='$d_fstatvfs'
21293 d_fsync='$d_fsync'
21294 d_ftello='$d_ftello'
21295 d_ftime='$d_ftime'
21296 d_futimes='$d_futimes'
21297 d_getcwd='$d_getcwd'
21298 d_getespwnam='$d_getespwnam'
21299 d_getfsstat='$d_getfsstat'
21300 d_getgrent='$d_getgrent'
21301 d_getgrent_r='$d_getgrent_r'
21302 d_getgrgid_r='$d_getgrgid_r'
21303 d_getgrnam_r='$d_getgrnam_r'
21304 d_getgrps='$d_getgrps'
21305 d_gethbyaddr='$d_gethbyaddr'
21306 d_gethbyname='$d_gethbyname'
21307 d_gethent='$d_gethent'
21308 d_gethname='$d_gethname'
21309 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21310 d_gethostbyname_r='$d_gethostbyname_r'
21311 d_gethostent_r='$d_gethostent_r'
21312 d_gethostprotos='$d_gethostprotos'
21313 d_getitimer='$d_getitimer'
21314 d_getlogin='$d_getlogin'
21315 d_getlogin_r='$d_getlogin_r'
21316 d_getmnt='$d_getmnt'
21317 d_getmntent='$d_getmntent'
21318 d_getnbyaddr='$d_getnbyaddr'
21319 d_getnbyname='$d_getnbyname'
21320 d_getnent='$d_getnent'
21321 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21322 d_getnetbyname_r='$d_getnetbyname_r'
21323 d_getnetent_r='$d_getnetent_r'
21324 d_getnetprotos='$d_getnetprotos'
21325 d_getpagsz='$d_getpagsz'
21326 d_getpbyname='$d_getpbyname'
21327 d_getpbynumber='$d_getpbynumber'
21328 d_getpent='$d_getpent'
21329 d_getpgid='$d_getpgid'
21330 d_getpgrp2='$d_getpgrp2'
21331 d_getpgrp='$d_getpgrp'
21332 d_getppid='$d_getppid'
21333 d_getprior='$d_getprior'
21334 d_getprotobyname_r='$d_getprotobyname_r'
21335 d_getprotobynumber_r='$d_getprotobynumber_r'
21336 d_getprotoent_r='$d_getprotoent_r'
21337 d_getprotoprotos='$d_getprotoprotos'
21338 d_getprpwnam='$d_getprpwnam'
21339 d_getpwent='$d_getpwent'
21340 d_getpwent_r='$d_getpwent_r'
21341 d_getpwnam_r='$d_getpwnam_r'
21342 d_getpwuid_r='$d_getpwuid_r'
21343 d_getsbyname='$d_getsbyname'
21344 d_getsbyport='$d_getsbyport'
21345 d_getsent='$d_getsent'
21346 d_getservbyname_r='$d_getservbyname_r'
21347 d_getservbyport_r='$d_getservbyport_r'
21348 d_getservent_r='$d_getservent_r'
21349 d_getservprotos='$d_getservprotos'
21350 d_getspnam='$d_getspnam'
21351 d_getspnam_r='$d_getspnam_r'
21352 d_gettimeod='$d_gettimeod'
21353 d_gmtime_r='$d_gmtime_r'
21354 d_gnulibc='$d_gnulibc'
21355 d_grpasswd='$d_grpasswd'
21356 d_hasmntopt='$d_hasmntopt'
21357 d_htonl='$d_htonl'
21358 d_ilogbl='$d_ilogbl'
21359 d_inc_version_list='$d_inc_version_list'
21360 d_index='$d_index'
21361 d_inetaton='$d_inetaton'
21362 d_int64_t='$d_int64_t'
21363 d_isascii='$d_isascii'
21364 d_isfinite='$d_isfinite'
21365 d_isinf='$d_isinf'
21366 d_isnan='$d_isnan'
21367 d_isnanl='$d_isnanl'
21368 d_killpg='$d_killpg'
21369 d_lchown='$d_lchown'
21370 d_ldbl_dig='$d_ldbl_dig'
21371 d_libm_lib_version='$d_libm_lib_version'
21372 d_link='$d_link'
21373 d_localtime_r='$d_localtime_r'
21374 d_locconv='$d_locconv'
21375 d_lockf='$d_lockf'
21376 d_longdbl='$d_longdbl'
21377 d_longlong='$d_longlong'
21378 d_lseekproto='$d_lseekproto'
21379 d_lstat='$d_lstat'
21380 d_madvise='$d_madvise'
21381 d_malloc_good_size='$d_malloc_good_size'
21382 d_malloc_size='$d_malloc_size'
21383 d_mblen='$d_mblen'
21384 d_mbstowcs='$d_mbstowcs'
21385 d_mbtowc='$d_mbtowc'
21386 d_memchr='$d_memchr'
21387 d_memcmp='$d_memcmp'
21388 d_memcpy='$d_memcpy'
21389 d_memmove='$d_memmove'
21390 d_memset='$d_memset'
21391 d_mkdir='$d_mkdir'
21392 d_mkdtemp='$d_mkdtemp'
21393 d_mkfifo='$d_mkfifo'
21394 d_mkstemp='$d_mkstemp'
21395 d_mkstemps='$d_mkstemps'
21396 d_mktime='$d_mktime'
21397 d_mmap='$d_mmap'
21398 d_modfl='$d_modfl'
21399 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21400 d_modflproto='$d_modflproto'
21401 d_mprotect='$d_mprotect'
21402 d_msg='$d_msg'
21403 d_msg_ctrunc='$d_msg_ctrunc'
21404 d_msg_dontroute='$d_msg_dontroute'
21405 d_msg_oob='$d_msg_oob'
21406 d_msg_peek='$d_msg_peek'
21407 d_msg_proxy='$d_msg_proxy'
21408 d_msgctl='$d_msgctl'
21409 d_msgget='$d_msgget'
21410 d_msghdr_s='$d_msghdr_s'
21411 d_msgrcv='$d_msgrcv'
21412 d_msgsnd='$d_msgsnd'
21413 d_msync='$d_msync'
21414 d_munmap='$d_munmap'
21415 d_mymalloc='$d_mymalloc'
21416 d_nice='$d_nice'
21417 d_nl_langinfo='$d_nl_langinfo'
21418 d_nv_preserves_uv='$d_nv_preserves_uv'
21419 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21420 d_off64_t='$d_off64_t'
21421 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21422 d_oldpthreads='$d_oldpthreads'
21423 d_oldsock='$d_oldsock'
21424 d_open3='$d_open3'
21425 d_pathconf='$d_pathconf'
21426 d_pause='$d_pause'
21427 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21428 d_phostname='$d_phostname'
21429 d_pipe='$d_pipe'
21430 d_poll='$d_poll'
21431 d_portable='$d_portable'
21432 d_procselfexe='$d_procselfexe'
21433 d_pthread_atfork='$d_pthread_atfork'
21434 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21435 d_pthread_yield='$d_pthread_yield'
21436 d_pwage='$d_pwage'
21437 d_pwchange='$d_pwchange'
21438 d_pwclass='$d_pwclass'
21439 d_pwcomment='$d_pwcomment'
21440 d_pwexpire='$d_pwexpire'
21441 d_pwgecos='$d_pwgecos'
21442 d_pwpasswd='$d_pwpasswd'
21443 d_pwquota='$d_pwquota'
21444 d_qgcvt='$d_qgcvt'
21445 d_quad='$d_quad'
21446 d_random_r='$d_random_r'
21447 d_readdir64_r='$d_readdir64_r'
21448 d_readdir='$d_readdir'
21449 d_readdir_r='$d_readdir_r'
21450 d_readlink='$d_readlink'
21451 d_readv='$d_readv'
21452 d_recvmsg='$d_recvmsg'
21453 d_rename='$d_rename'
21454 d_rewinddir='$d_rewinddir'
21455 d_rmdir='$d_rmdir'
21456 d_safebcpy='$d_safebcpy'
21457 d_safemcpy='$d_safemcpy'
21458 d_sanemcmp='$d_sanemcmp'
21459 d_sbrkproto='$d_sbrkproto'
21460 d_scalbnl='$d_scalbnl'
21461 d_sched_yield='$d_sched_yield'
21462 d_scm_rights='$d_scm_rights'
21463 d_seekdir='$d_seekdir'
21464 d_select='$d_select'
21465 d_sem='$d_sem'
21466 d_semctl='$d_semctl'
21467 d_semctl_semid_ds='$d_semctl_semid_ds'
21468 d_semctl_semun='$d_semctl_semun'
21469 d_semget='$d_semget'
21470 d_semop='$d_semop'
21471 d_sendmsg='$d_sendmsg'
21472 d_setegid='$d_setegid'
21473 d_seteuid='$d_seteuid'
21474 d_setgrent='$d_setgrent'
21475 d_setgrent_r='$d_setgrent_r'
21476 d_setgrps='$d_setgrps'
21477 d_sethent='$d_sethent'
21478 d_sethostent_r='$d_sethostent_r'
21479 d_setitimer='$d_setitimer'
21480 d_setlinebuf='$d_setlinebuf'
21481 d_setlocale='$d_setlocale'
21482 d_setlocale_r='$d_setlocale_r'
21483 d_setnent='$d_setnent'
21484 d_setnetent_r='$d_setnetent_r'
21485 d_setpent='$d_setpent'
21486 d_setpgid='$d_setpgid'
21487 d_setpgrp2='$d_setpgrp2'
21488 d_setpgrp='$d_setpgrp'
21489 d_setprior='$d_setprior'
21490 d_setproctitle='$d_setproctitle'
21491 d_setprotoent_r='$d_setprotoent_r'
21492 d_setpwent='$d_setpwent'
21493 d_setpwent_r='$d_setpwent_r'
21494 d_setregid='$d_setregid'
21495 d_setresgid='$d_setresgid'
21496 d_setresuid='$d_setresuid'
21497 d_setreuid='$d_setreuid'
21498 d_setrgid='$d_setrgid'
21499 d_setruid='$d_setruid'
21500 d_setsent='$d_setsent'
21501 d_setservent_r='$d_setservent_r'
21502 d_setsid='$d_setsid'
21503 d_setvbuf='$d_setvbuf'
21504 d_sfio='$d_sfio'
21505 d_shm='$d_shm'
21506 d_shmat='$d_shmat'
21507 d_shmatprototype='$d_shmatprototype'
21508 d_shmctl='$d_shmctl'
21509 d_shmdt='$d_shmdt'
21510 d_shmget='$d_shmget'
21511 d_sigaction='$d_sigaction'
21512 d_sigprocmask='$d_sigprocmask'
21513 d_sigsetjmp='$d_sigsetjmp'
21514 d_sitearch='$d_sitearch'
21515 d_snprintf='$d_snprintf'
21516 d_sockatmark='$d_sockatmark'
21517 d_sockatmarkproto='$d_sockatmarkproto'
21518 d_socket='$d_socket'
21519 d_socklen_t='$d_socklen_t'
21520 d_sockpair='$d_sockpair'
21521 d_socks5_init='$d_socks5_init'
21522 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21523 d_sqrtl='$d_sqrtl'
21524 d_srand48_r='$d_srand48_r'
21525 d_srandom_r='$d_srandom_r'
21526 d_sresgproto='$d_sresgproto'
21527 d_sresuproto='$d_sresuproto'
21528 d_statblks='$d_statblks'
21529 d_statfs_f_flags='$d_statfs_f_flags'
21530 d_statfs_s='$d_statfs_s'
21531 d_statvfs='$d_statvfs'
21532 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21533 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21534 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21535 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21536 d_stdio_stream_array='$d_stdio_stream_array'
21537 d_stdiobase='$d_stdiobase'
21538 d_stdstdio='$d_stdstdio'
21539 d_strchr='$d_strchr'
21540 d_strcoll='$d_strcoll'
21541 d_strctcpy='$d_strctcpy'
21542 d_strerrm='$d_strerrm'
21543 d_strerror='$d_strerror'
21544 d_strerror_r='$d_strerror_r'
21545 d_strftime='$d_strftime'
21546 d_strlcat='$d_strlcat'
21547 d_strlcpy='$d_strlcpy'
21548 d_strtod='$d_strtod'
21549 d_strtol='$d_strtol'
21550 d_strtold='$d_strtold'
21551 d_strtoll='$d_strtoll'
21552 d_strtoq='$d_strtoq'
21553 d_strtoul='$d_strtoul'
21554 d_strtoull='$d_strtoull'
21555 d_strtouq='$d_strtouq'
21556 d_strxfrm='$d_strxfrm'
21557 d_suidsafe='$d_suidsafe'
21558 d_symlink='$d_symlink'
21559 d_syscall='$d_syscall'
21560 d_syscallproto='$d_syscallproto'
21561 d_sysconf='$d_sysconf'
21562 d_sysernlst='$d_sysernlst'
21563 d_syserrlst='$d_syserrlst'
21564 d_system='$d_system'
21565 d_tcgetpgrp='$d_tcgetpgrp'
21566 d_tcsetpgrp='$d_tcsetpgrp'
21567 d_telldir='$d_telldir'
21568 d_telldirproto='$d_telldirproto'
21569 d_time='$d_time'
21570 d_times='$d_times'
21571 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21572 d_tm_tm_zone='$d_tm_tm_zone'
21573 d_tmpnam_r='$d_tmpnam_r'
21574 d_truncate='$d_truncate'
21575 d_ttyname_r='$d_ttyname_r'
21576 d_tzname='$d_tzname'
21577 d_u32align='$d_u32align'
21578 d_ualarm='$d_ualarm'
21579 d_umask='$d_umask'
21580 d_uname='$d_uname'
21581 d_union_semun='$d_union_semun'
21582 d_unordered='$d_unordered'
21583 d_unsetenv='$d_unsetenv'
21584 d_usleep='$d_usleep'
21585 d_usleepproto='$d_usleepproto'
21586 d_ustat='$d_ustat'
21587 d_vendorarch='$d_vendorarch'
21588 d_vendorbin='$d_vendorbin'
21589 d_vendorlib='$d_vendorlib'
21590 d_vendorscript='$d_vendorscript'
21591 d_vfork='$d_vfork'
21592 d_void_closedir='$d_void_closedir'
21593 d_voidsig='$d_voidsig'
21594 d_voidtty='$d_voidtty'
21595 d_volatile='$d_volatile'
21596 d_vprintf='$d_vprintf'
21597 d_vsnprintf='$d_vsnprintf'
21598 d_wait4='$d_wait4'
21599 d_waitpid='$d_waitpid'
21600 d_wcstombs='$d_wcstombs'
21601 d_wctomb='$d_wctomb'
21602 d_writev='$d_writev'
21603 d_xenix='$d_xenix'
21604 date='$date'
21605 db_hashtype='$db_hashtype'
21606 db_prefixtype='$db_prefixtype'
21607 db_version_major='$db_version_major'
21608 db_version_minor='$db_version_minor'
21609 db_version_patch='$db_version_patch'
21610 defvoidused='$defvoidused'
21611 direntrytype='$direntrytype'
21612 dlext='$dlext'
21613 dlsrc='$dlsrc'
21614 doublesize='$doublesize'
21615 drand01='$drand01'
21616 drand48_r_proto='$drand48_r_proto'
21617 dynamic_ext='$dynamic_ext'
21618 eagain='$eagain'
21619 ebcdic='$ebcdic'
21620 echo='$echo'
21621 egrep='$egrep'
21622 emacs='$emacs'
21623 endgrent_r_proto='$endgrent_r_proto'
21624 endhostent_r_proto='$endhostent_r_proto'
21625 endnetent_r_proto='$endnetent_r_proto'
21626 endprotoent_r_proto='$endprotoent_r_proto'
21627 endpwent_r_proto='$endpwent_r_proto'
21628 endservent_r_proto='$endservent_r_proto'
21629 eunicefix='$eunicefix'
21630 exe_ext='$exe_ext'
21631 expr='$expr'
21632 extensions='$extensions'
21633 extras='$extras'
21634 fflushNULL='$fflushNULL'
21635 fflushall='$fflushall'
21636 find='$find'
21637 firstmakefile='$firstmakefile'
21638 flex='$flex'
21639 fpossize='$fpossize'
21640 fpostype='$fpostype'
21641 freetype='$freetype'
21642 from='$from'
21643 full_ar='$full_ar'
21644 full_csh='$full_csh'
21645 full_sed='$full_sed'
21646 gccansipedantic='$gccansipedantic'
21647 gccosandvers='$gccosandvers'
21648 gccversion='$gccversion'
21649 getgrent_r_proto='$getgrent_r_proto'
21650 getgrgid_r_proto='$getgrgid_r_proto'
21651 getgrnam_r_proto='$getgrnam_r_proto'
21652 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21653 gethostbyname_r_proto='$gethostbyname_r_proto'
21654 gethostent_r_proto='$gethostent_r_proto'
21655 getlogin_r_proto='$getlogin_r_proto'
21656 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21657 getnetbyname_r_proto='$getnetbyname_r_proto'
21658 getnetent_r_proto='$getnetent_r_proto'
21659 getprotobyname_r_proto='$getprotobyname_r_proto'
21660 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21661 getprotoent_r_proto='$getprotoent_r_proto'
21662 getpwent_r_proto='$getpwent_r_proto'
21663 getpwnam_r_proto='$getpwnam_r_proto'
21664 getpwuid_r_proto='$getpwuid_r_proto'
21665 getservbyname_r_proto='$getservbyname_r_proto'
21666 getservbyport_r_proto='$getservbyport_r_proto'
21667 getservent_r_proto='$getservent_r_proto'
21668 getspnam_r_proto='$getspnam_r_proto'
21669 gidformat='$gidformat'
21670 gidsign='$gidsign'
21671 gidsize='$gidsize'
21672 gidtype='$gidtype'
21673 glibpth='$glibpth'
21674 gmake='$gmake'
21675 gmtime_r_proto='$gmtime_r_proto'
21676 gnulibc_version='$gnulibc_version'
21677 grep='$grep'
21678 groupcat='$groupcat'
21679 groupstype='$groupstype'
21680 gzip='$gzip'
21681 h_fcntl='$h_fcntl'
21682 h_sysfile='$h_sysfile'
21683 hint='$hint'
21684 hostcat='$hostcat'
21685 html1dir='$html1dir'
21686 html1direxp='$html1direxp'
21687 html3dir='$html3dir'
21688 html3direxp='$html3direxp'
21689 i16size='$i16size'
21690 i16type='$i16type'
21691 i32size='$i32size'
21692 i32type='$i32type'
21693 i64size='$i64size'
21694 i64type='$i64type'
21695 i8size='$i8size'
21696 i8type='$i8type'
21697 i_arpainet='$i_arpainet'
21698 i_bsdioctl='$i_bsdioctl'
21699 i_crypt='$i_crypt'
21700 i_db='$i_db'
21701 i_dbm='$i_dbm'
21702 i_dirent='$i_dirent'
21703 i_dld='$i_dld'
21704 i_dlfcn='$i_dlfcn'
21705 i_fcntl='$i_fcntl'
21706 i_float='$i_float'
21707 i_fp='$i_fp'
21708 i_fp_class='$i_fp_class'
21709 i_gdbm='$i_gdbm'
21710 i_grp='$i_grp'
21711 i_ieeefp='$i_ieeefp'
21712 i_inttypes='$i_inttypes'
21713 i_langinfo='$i_langinfo'
21714 i_libutil='$i_libutil'
21715 i_limits='$i_limits'
21716 i_locale='$i_locale'
21717 i_machcthr='$i_machcthr'
21718 i_malloc='$i_malloc'
21719 i_math='$i_math'
21720 i_memory='$i_memory'
21721 i_mntent='$i_mntent'
21722 i_ndbm='$i_ndbm'
21723 i_netdb='$i_netdb'
21724 i_neterrno='$i_neterrno'
21725 i_netinettcp='$i_netinettcp'
21726 i_niin='$i_niin'
21727 i_poll='$i_poll'
21728 i_prot='$i_prot'
21729 i_pthread='$i_pthread'
21730 i_pwd='$i_pwd'
21731 i_rpcsvcdbm='$i_rpcsvcdbm'
21732 i_sfio='$i_sfio'
21733 i_sgtty='$i_sgtty'
21734 i_shadow='$i_shadow'
21735 i_socks='$i_socks'
21736 i_stdarg='$i_stdarg'
21737 i_stddef='$i_stddef'
21738 i_stdlib='$i_stdlib'
21739 i_string='$i_string'
21740 i_sunmath='$i_sunmath'
21741 i_sysaccess='$i_sysaccess'
21742 i_sysdir='$i_sysdir'
21743 i_sysfile='$i_sysfile'
21744 i_sysfilio='$i_sysfilio'
21745 i_sysin='$i_sysin'
21746 i_sysioctl='$i_sysioctl'
21747 i_syslog='$i_syslog'
21748 i_sysmman='$i_sysmman'
21749 i_sysmode='$i_sysmode'
21750 i_sysmount='$i_sysmount'
21751 i_sysndir='$i_sysndir'
21752 i_sysparam='$i_sysparam'
21753 i_sysresrc='$i_sysresrc'
21754 i_syssecrt='$i_syssecrt'
21755 i_sysselct='$i_sysselct'
21756 i_syssockio='$i_syssockio'
21757 i_sysstat='$i_sysstat'
21758 i_sysstatfs='$i_sysstatfs'
21759 i_sysstatvfs='$i_sysstatvfs'
21760 i_systime='$i_systime'
21761 i_systimek='$i_systimek'
21762 i_systimes='$i_systimes'
21763 i_systypes='$i_systypes'
21764 i_sysuio='$i_sysuio'
21765 i_sysun='$i_sysun'
21766 i_sysutsname='$i_sysutsname'
21767 i_sysvfs='$i_sysvfs'
21768 i_syswait='$i_syswait'
21769 i_termio='$i_termio'
21770 i_termios='$i_termios'
21771 i_time='$i_time'
21772 i_unistd='$i_unistd'
21773 i_ustat='$i_ustat'
21774 i_utime='$i_utime'
21775 i_values='$i_values'
21776 i_varargs='$i_varargs'
21777 i_varhdr='$i_varhdr'
21778 i_vfork='$i_vfork'
21779 ignore_versioned_solibs='$ignore_versioned_solibs'
21780 inc_version_list='$inc_version_list'
21781 inc_version_list_init='$inc_version_list_init'
21782 incpath='$incpath'
21783 inews='$inews'
21784 initialinstalllocation='$initialinstalllocation'
21785 installarchlib='$installarchlib'
21786 installbin='$installbin'
21787 installhtml1dir='$installhtml1dir'
21788 installhtml3dir='$installhtml3dir'
21789 installman1dir='$installman1dir'
21790 installman3dir='$installman3dir'
21791 installprefix='$installprefix'
21792 installprefixexp='$installprefixexp'
21793 installprivlib='$installprivlib'
21794 installscript='$installscript'
21795 installsitearch='$installsitearch'
21796 installsitebin='$installsitebin'
21797 installsitehtml1dir='$installsitehtml1dir'
21798 installsitehtml3dir='$installsitehtml3dir'
21799 installsitelib='$installsitelib'
21800 installsiteman1dir='$installsiteman1dir'
21801 installsiteman3dir='$installsiteman3dir'
21802 installsitescript='$installsitescript'
21803 installstyle='$installstyle'
21804 installusrbinperl='$installusrbinperl'
21805 installvendorarch='$installvendorarch'
21806 installvendorbin='$installvendorbin'
21807 installvendorhtml1dir='$installvendorhtml1dir'
21808 installvendorhtml3dir='$installvendorhtml3dir'
21809 installvendorlib='$installvendorlib'
21810 installvendorman1dir='$installvendorman1dir'
21811 installvendorman3dir='$installvendorman3dir'
21812 installvendorscript='$installvendorscript'
21813 intsize='$intsize'
21814 issymlink='$issymlink'
21815 ivdformat='$ivdformat'
21816 ivsize='$ivsize'
21817 ivtype='$ivtype'
21818 known_extensions='$known_extensions'
21819 ksh='$ksh'
21820 ld='$ld'
21821 lddlflags='$lddlflags'
21822 ldflags='$ldflags'
21823 ldflags_uselargefiles='$ldflags_uselargefiles'
21824 ldlibpthname='$ldlibpthname'
21825 less='$less'
21826 lib_ext='$lib_ext'
21827 libc='$libc'
21828 libperl='$libperl'
21829 libpth='$libpth'
21830 libs='$libs'
21831 libsdirs='$libsdirs'
21832 libsfiles='$libsfiles'
21833 libsfound='$libsfound'
21834 libspath='$libspath'
21835 libswanted='$libswanted'
21836 libswanted_uselargefiles='$libswanted_uselargefiles'
21837 line='$line'
21838 lint='$lint'
21839 lkflags='$lkflags'
21840 ln='$ln'
21841 lns='$lns'
21842 localtime_r_proto='$localtime_r_proto'
21843 locincpth='$locincpth'
21844 loclibpth='$loclibpth'
21845 longdblsize='$longdblsize'
21846 longlongsize='$longlongsize'
21847 longsize='$longsize'
21848 lp='$lp'
21849 lpr='$lpr'
21850 ls='$ls'
21851 lseeksize='$lseeksize'
21852 lseektype='$lseektype'
21853 mad='$mad'
21854 madlyh='$madlyh'
21855 madlyobj='$madlyobj'
21856 madlysrc='$madlysrc'
21857 mail='$mail'
21858 mailx='$mailx'
21859 make='$make'
21860 make_set_make='$make_set_make'
21861 mallocobj='$mallocobj'
21862 mallocsrc='$mallocsrc'
21863 malloctype='$malloctype'
21864 man1dir='$man1dir'
21865 man1direxp='$man1direxp'
21866 man1ext='$man1ext'
21867 man3dir='$man3dir'
21868 man3direxp='$man3direxp'
21869 man3ext='$man3ext'
21870 mips_type='$mips_type'
21871 mistrustnm='$mistrustnm'
21872 mkdir='$mkdir'
21873 mmaptype='$mmaptype'
21874 modetype='$modetype'
21875 more='$more'
21876 multiarch='$multiarch'
21877 mv='$mv'
21878 myarchname='$myarchname'
21879 mydomain='$mydomain'
21880 myhostname='$myhostname'
21881 myuname='$myuname'
21882 n='$n'
21883 need_va_copy='$need_va_copy'
21884 netdb_hlen_type='$netdb_hlen_type'
21885 netdb_host_type='$netdb_host_type'
21886 netdb_name_type='$netdb_name_type'
21887 netdb_net_type='$netdb_net_type'
21888 nm='$nm'
21889 nm_opt='$nm_opt'
21890 nm_so_opt='$nm_so_opt'
21891 nonxs_ext='$nonxs_ext'
21892 nroff='$nroff'
21893 nvEUformat='$nvEUformat'
21894 nvFUformat='$nvFUformat'
21895 nvGUformat='$nvGUformat'
21896 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21897 nveformat='$nveformat'
21898 nvfformat='$nvfformat'
21899 nvgformat='$nvgformat'
21900 nvsize='$nvsize'
21901 nvtype='$nvtype'
21902 o_nonblock='$o_nonblock'
21903 obj_ext='$obj_ext'
21904 old_pthread_create_joinable='$old_pthread_create_joinable'
21905 optimize='$optimize'
21906 orderlib='$orderlib'
21907 osname='$osname'
21908 osvers='$osvers'
21909 otherlibdirs='$otherlibdirs'
21910 package='$package'
21911 pager='$pager'
21912 passcat='$passcat'
21913 patchlevel='$patchlevel'
21914 path_sep='$path_sep'
21915 perl5='$perl5'
21916 perl='$perl'
21917 perl_patchlevel='$perl_patchlevel'
21918 perladmin='$perladmin'
21919 perllibs='$perllibs'
21920 perlpath='$perlpath'
21921 pg='$pg'
21922 phostname='$phostname'
21923 pidtype='$pidtype'
21924 plibpth='$plibpth'
21925 pmake='$pmake'
21926 pr='$pr'
21927 prefix='$prefix'
21928 prefixexp='$prefixexp'
21929 privlib='$privlib'
21930 privlibexp='$privlibexp'
21931 procselfexe='$procselfexe'
21932 prototype='$prototype'
21933 ptrsize='$ptrsize'
21934 quadkind='$quadkind'
21935 quadtype='$quadtype'
21936 randbits='$randbits'
21937 randfunc='$randfunc'
21938 random_r_proto='$random_r_proto'
21939 randseedtype='$randseedtype'
21940 ranlib='$ranlib'
21941 rd_nodata='$rd_nodata'
21942 readdir64_r_proto='$readdir64_r_proto'
21943 readdir_r_proto='$readdir_r_proto'
21944 revision='$revision'
21945 rm='$rm'
21946 rmail='$rmail'
21947 run='$run'
21948 runnm='$runnm'
21949 sPRIEUldbl='$sPRIEUldbl'
21950 sPRIFUldbl='$sPRIFUldbl'
21951 sPRIGUldbl='$sPRIGUldbl'
21952 sPRIXU64='$sPRIXU64'
21953 sPRId64='$sPRId64'
21954 sPRIeldbl='$sPRIeldbl'
21955 sPRIfldbl='$sPRIfldbl'
21956 sPRIgldbl='$sPRIgldbl'
21957 sPRIi64='$sPRIi64'
21958 sPRIo64='$sPRIo64'
21959 sPRIu64='$sPRIu64'
21960 sPRIx64='$sPRIx64'
21961 sSCNfldbl='$sSCNfldbl'
21962 sched_yield='$sched_yield'
21963 scriptdir='$scriptdir'
21964 scriptdirexp='$scriptdirexp'
21965 sed='$sed'
21966 seedfunc='$seedfunc'
21967 selectminbits='$selectminbits'
21968 selecttype='$selecttype'
21969 sendmail='$sendmail'
21970 setgrent_r_proto='$setgrent_r_proto'
21971 sethostent_r_proto='$sethostent_r_proto'
21972 setlocale_r_proto='$setlocale_r_proto'
21973 setnetent_r_proto='$setnetent_r_proto'
21974 setprotoent_r_proto='$setprotoent_r_proto'
21975 setpwent_r_proto='$setpwent_r_proto'
21976 setservent_r_proto='$setservent_r_proto'
21977 sh='$sh'
21978 shar='$shar'
21979 sharpbang='$sharpbang'
21980 shmattype='$shmattype'
21981 shortsize='$shortsize'
21982 shrpenv='$shrpenv'
21983 shsharp='$shsharp'
21984 sig_count='$sig_count'
21985 sig_name='$sig_name'
21986 sig_name_init='$sig_name_init'
21987 sig_num='$sig_num'
21988 sig_num_init='$sig_num_init'
21989 sig_size='$sig_size'
21990 signal_t='$signal_t'
21991 sitearch='$sitearch'
21992 sitearchexp='$sitearchexp'
21993 sitebin='$sitebin'
21994 sitebinexp='$sitebinexp'
21995 sitehtml1dir='$sitehtml1dir'
21996 sitehtml1direxp='$sitehtml1direxp'
21997 sitehtml3dir='$sitehtml3dir'
21998 sitehtml3direxp='$sitehtml3direxp'
21999 sitelib='$sitelib'
22000 sitelib_stem='$sitelib_stem'
22001 sitelibexp='$sitelibexp'
22002 siteman1dir='$siteman1dir'
22003 siteman1direxp='$siteman1direxp'
22004 siteman3dir='$siteman3dir'
22005 siteman3direxp='$siteman3direxp'
22006 siteprefix='$siteprefix'
22007 siteprefixexp='$siteprefixexp'
22008 sitescript='$sitescript'
22009 sitescriptexp='$sitescriptexp'
22010 sizesize='$sizesize'
22011 sizetype='$sizetype'
22012 sleep='$sleep'
22013 smail='$smail'
22014 so='$so'
22015 sockethdr='$sockethdr'
22016 socketlib='$socketlib'
22017 socksizetype='$socksizetype'
22018 sort='$sort'
22019 spackage='$spackage'
22020 spitshell='$spitshell'
22021 srand48_r_proto='$srand48_r_proto'
22022 srandom_r_proto='$srandom_r_proto'
22023 src='$src'
22024 ssizetype='$ssizetype'
22025 startperl='$startperl'
22026 startsh='$startsh'
22027 static_ext='$static_ext'
22028 stdchar='$stdchar'
22029 stdio_base='$stdio_base'
22030 stdio_bufsiz='$stdio_bufsiz'
22031 stdio_cnt='$stdio_cnt'
22032 stdio_filbuf='$stdio_filbuf'
22033 stdio_ptr='$stdio_ptr'
22034 stdio_stream_array='$stdio_stream_array'
22035 strerror_r_proto='$strerror_r_proto'
22036 strings='$strings'
22037 submit='$submit'
22038 subversion='$subversion'
22039 sysman='$sysman'
22040 tail='$tail'
22041 tar='$tar'
22042 targetarch='$targetarch'
22043 tbl='$tbl'
22044 tee='$tee'
22045 test='$test'
22046 timeincl='$timeincl'
22047 timetype='$timetype'
22048 tmpnam_r_proto='$tmpnam_r_proto'
22049 to='$to'
22050 touch='$touch'
22051 tr='$tr'
22052 trnl='$trnl'
22053 troff='$troff'
22054 ttyname_r_proto='$ttyname_r_proto'
22055 u16size='$u16size'
22056 u16type='$u16type'
22057 u32size='$u32size'
22058 u32type='$u32type'
22059 u64size='$u64size'
22060 u64type='$u64type'
22061 u8size='$u8size'
22062 u8type='$u8type'
22063 uidformat='$uidformat'
22064 uidsign='$uidsign'
22065 uidsize='$uidsize'
22066 uidtype='$uidtype'
22067 uname='$uname'
22068 uniq='$uniq'
22069 uquadtype='$uquadtype'
22070 use5005threads='$use5005threads'
22071 use64bitall='$use64bitall'
22072 use64bitint='$use64bitint'
22073 usecrosscompile='$usecrosscompile'
22074 usedl='$usedl'
22075 usefaststdio='$usefaststdio'
22076 useithreads='$useithreads'
22077 uselargefiles='$uselargefiles'
22078 uselongdouble='$uselongdouble'
22079 usemallocwrap='$usemallocwrap'
22080 usemorebits='$usemorebits'
22081 usemultiplicity='$usemultiplicity'
22082 usemymalloc='$usemymalloc'
22083 usenm='$usenm'
22084 useopcode='$useopcode'
22085 useperlio='$useperlio'
22086 useposix='$useposix'
22087 usereentrant='$usereentrant'
22088 userelocatableinc='$userelocatableinc'
22089 usesfio='$usesfio'
22090 useshrplib='$useshrplib'
22091 usesitecustomize='$usesitecustomize'
22092 usesocks='$usesocks'
22093 usethreads='$usethreads'
22094 usevendorprefix='$usevendorprefix'
22095 usevfork='$usevfork'
22096 usrinc='$usrinc'
22097 uuname='$uuname'
22098 uvXUformat='$uvXUformat'
22099 uvoformat='$uvoformat'
22100 uvsize='$uvsize'
22101 uvtype='$uvtype'
22102 uvuformat='$uvuformat'
22103 uvxformat='$uvxformat'
22104 vendorarch='$vendorarch'
22105 vendorarchexp='$vendorarchexp'
22106 vendorbin='$vendorbin'
22107 vendorbinexp='$vendorbinexp'
22108 vendorhtml1dir='$vendorhtml1dir'
22109 vendorhtml1direxp='$vendorhtml1direxp'
22110 vendorhtml3dir='$vendorhtml3dir'
22111 vendorhtml3direxp='$vendorhtml3direxp'
22112 vendorlib='$vendorlib'
22113 vendorlib_stem='$vendorlib_stem'
22114 vendorlibexp='$vendorlibexp'
22115 vendorman1dir='$vendorman1dir'
22116 vendorman1direxp='$vendorman1direxp'
22117 vendorman3dir='$vendorman3dir'
22118 vendorman3direxp='$vendorman3direxp'
22119 vendorprefix='$vendorprefix'
22120 vendorprefixexp='$vendorprefixexp'
22121 vendorscript='$vendorscript'
22122 vendorscriptexp='$vendorscriptexp'
22123 version='$version'
22124 version_patchlevel_string='$version_patchlevel_string'
22125 versiononly='$versiononly'
22126 vi='$vi'
22127 voidflags='$voidflags'
22128 xlibpth='$xlibpth'
22129 yacc='$yacc'
22130 yaccflags='$yaccflags'
22131 zcat='$zcat'
22132 zip='$zip'
22133 EOT
22134
22135 : Add in command line options if available
22136 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22137
22138 : add special variables
22139 $test -f $src/patchlevel.h && \
22140 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22141 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22142 echo "PERL_CONFIG_SH=true" >>config.sh
22143
22144 : propagate old symbols
22145 if $test -f UU/config.sh; then
22146         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22147         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22148         $sort | $uniq -u >UU/oldsyms
22149         set X `cat UU/oldsyms`
22150         shift
22151         case $# in
22152         0) ;;
22153         *)
22154                 cat <<EOM
22155 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22156 EOM
22157                 echo "# Variables propagated from previous config.sh file." >>config.sh
22158                 for sym in `cat UU/oldsyms`; do
22159                         echo "    Propagating $hint variable "'$'"$sym..."
22160                         eval 'tmp="$'"${sym}"'"'
22161                         echo "$tmp" | \
22162                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22163                 done
22164                 ;;
22165         esac
22166 fi
22167
22168 : Finish up by extracting the .SH files
22169 case "$alldone" in
22170 exit)
22171         $rm -rf UU
22172         echo "Extraction done."
22173         exit 0
22174         ;;
22175 cont)
22176         ;;
22177 '')
22178         dflt=''
22179         nostick=true
22180         $cat <<EOM
22181
22182 If you'd like to make any changes to the config.sh file before I begin
22183 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22184
22185 EOM
22186         rp="Press return or use a shell escape to edit config.sh:"
22187         . UU/myread
22188         nostick=''
22189         case "$ans" in
22190         '') ;;
22191         *) : in case they cannot read
22192                 sh 1>&4 -c "$ans";;
22193         esac
22194         ;;
22195 esac
22196
22197 : if this fails, just run all the .SH files by hand
22198 . ./config.sh
22199
22200 echo " "
22201 exec 1>&4
22202 pwd=`pwd`
22203 . ./UU/extract
22204 cd "$pwd"
22205
22206 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22207         dflt=y
22208         case "$silent" in
22209         true) ;;
22210         *)
22211                 $cat <<EOM
22212
22213 Now you need to generate make dependencies by running "$make depend".
22214 You might prefer to run it in background: "$make depend > makedepend.out &"
22215 It can take a while, so you might not want to run it right now.
22216
22217 EOM
22218                 ;;
22219         esac
22220         rp="Run $make depend now?"
22221         . UU/myread
22222         case "$ans" in
22223         y*)
22224                 $make depend && echo "Now you must run '$make'."
22225                 ;;
22226         *)
22227                 echo "You must run '$make depend' then '$make'."
22228                 ;;
22229         esac
22230 elif test -f [Mm]akefile; then
22231         echo " "
22232         echo "Now you must run a $make."
22233 else
22234         echo "Configure done."
22235 fi
22236
22237 if $test -f Policy.sh; then
22238     $cat <<EOM
22239
22240 If you compile $package on a different machine or from a different object
22241 directory, copy the Policy.sh file from this object directory to the
22242 new one before you run Configure -- this will help you with most of
22243 the policy defaults.
22244
22245 EOM
22246 fi
22247 if $test -f config.msg; then
22248     echo "Hmm.  I also noted the following information while running:"
22249     echo " "
22250     $cat config.msg >&4
22251     $rm -f config.msg
22252 fi
22253 $rm -f kit*isdone ark*isdone
22254 $rm -rf UU
22255
22256 : End of Configure
22257