RE: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Mon Nov  6 10:30:43 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_c99_variadic_macros=''
363 d_casti32=''
364 castflags=''
365 d_castneg=''
366 d_chown=''
367 d_chroot=''
368 d_chsize=''
369 d_class=''
370 d_clearenv=''
371 d_closedir=''
372 d_void_closedir=''
373 d_cmsghdr_s=''
374 d_const=''
375 d_copysignl=''
376 d_cplusplus=''
377 cryptlib=''
378 d_crypt=''
379 crypt_r_proto=''
380 d_crypt_r=''
381 d_csh=''
382 full_csh=''
383 d_ctermid=''
384 ctermid_r_proto=''
385 d_ctermid_r=''
386 ctime_r_proto=''
387 d_ctime_r=''
388 d_cuserid=''
389 d_dbl_dig=''
390 d_dbminitproto=''
391 d_difftime=''
392 d_dirfd=''
393 d_dlerror=''
394 d_dlopen=''
395 d_dlsymun=''
396 d_dosuid=''
397 d_suidsafe=''
398 d_drand48_r=''
399 drand48_r_proto=''
400 d_drand48proto=''
401 d_dup2=''
402 d_eaccess=''
403 d_endgrent=''
404 d_endgrent_r=''
405 endgrent_r_proto=''
406 d_endhent=''
407 d_endhostent_r=''
408 endhostent_r_proto=''
409 d_endnent=''
410 d_endnetent_r=''
411 endnetent_r_proto=''
412 d_endpent=''
413 d_endprotoent_r=''
414 endprotoent_r_proto=''
415 d_endpwent=''
416 d_endpwent_r=''
417 endpwent_r_proto=''
418 d_endsent=''
419 d_endservent_r=''
420 endservent_r_proto=''
421 d_faststdio=''
422 d_fchdir=''
423 d_fchmod=''
424 d_fchown=''
425 d_fcntl=''
426 d_fcntl_can_lock=''
427 d_fd_macros=''
428 d_fd_set=''
429 d_fds_bits=''
430 d_fgetpos=''
431 d_finite=''
432 d_finitel=''
433 d_flexfnam=''
434 d_flock=''
435 d_flockproto=''
436 d_fork=''
437 d_fp_class=''
438 d_fpclass=''
439 d_fpclassify=''
440 d_fpclassl=''
441 d_fpos64_t=''
442 d_frexpl=''
443 d_fs_data_s=''
444 d_fseeko=''
445 d_fsetpos=''
446 d_fstatfs=''
447 d_fsync=''
448 d_ftello=''
449 d_ftime=''
450 d_gettimeod=''
451 d_futimes=''
452 d_Gconvert=''
453 d_getcwd=''
454 d_getespwnam=''
455 d_getfsstat=''
456 d_getgrent=''
457 d_getgrent_r=''
458 getgrent_r_proto=''
459 d_getgrgid_r=''
460 getgrgid_r_proto=''
461 d_getgrnam_r=''
462 getgrnam_r_proto=''
463 d_getgrps=''
464 d_gethbyaddr=''
465 d_gethbyname=''
466 d_gethent=''
467 aphostname=''
468 d_gethname=''
469 d_phostname=''
470 d_uname=''
471 d_gethostbyaddr_r=''
472 gethostbyaddr_r_proto=''
473 d_gethostbyname_r=''
474 gethostbyname_r_proto=''
475 d_gethostent_r=''
476 gethostent_r_proto=''
477 d_gethostprotos=''
478 d_getitimer=''
479 d_getlogin=''
480 d_getlogin_r=''
481 getlogin_r_proto=''
482 d_getmnt=''
483 d_getmntent=''
484 d_getnbyaddr=''
485 d_getnbyname=''
486 d_getnent=''
487 d_getnetbyaddr_r=''
488 getnetbyaddr_r_proto=''
489 d_getnetbyname_r=''
490 getnetbyname_r_proto=''
491 d_getnetent_r=''
492 getnetent_r_proto=''
493 d_getnetprotos=''
494 d_getpagsz=''
495 d_getpent=''
496 d_getpgid=''
497 d_getpgrp2=''
498 d_bsdgetpgrp=''
499 d_getpgrp=''
500 d_getppid=''
501 d_getprior=''
502 d_getpbyname=''
503 d_getpbynumber=''
504 d_getprotobyname_r=''
505 getprotobyname_r_proto=''
506 d_getprotobynumber_r=''
507 getprotobynumber_r_proto=''
508 d_getprotoent_r=''
509 getprotoent_r_proto=''
510 d_getprotoprotos=''
511 d_getprpwnam=''
512 d_getpwent=''
513 d_getpwent_r=''
514 getpwent_r_proto=''
515 d_getpwnam_r=''
516 getpwnam_r_proto=''
517 d_getpwuid_r=''
518 getpwuid_r_proto=''
519 d_getsent=''
520 d_getservbyname_r=''
521 getservbyname_r_proto=''
522 d_getservbyport_r=''
523 getservbyport_r_proto=''
524 d_getservent_r=''
525 getservent_r_proto=''
526 d_getservprotos=''
527 d_getspnam=''
528 d_getspnam_r=''
529 getspnam_r_proto=''
530 d_getsbyname=''
531 d_getsbyport=''
532 d_gmtime_r=''
533 gmtime_r_proto=''
534 d_gnulibc=''
535 gnulibc_version=''
536 d_hasmntopt=''
537 d_htonl=''
538 d_ilogbl=''
539 d_inetaton=''
540 d_int64_t=''
541 d_isascii=''
542 d_isfinite=''
543 d_isinf=''
544 d_isnan=''
545 d_isnanl=''
546 d_killpg=''
547 d_lchown=''
548 d_ldbl_dig=''
549 d_libm_lib_version=''
550 d_link=''
551 d_localtime_r=''
552 d_localtime_r_needs_tzset=''
553 localtime_r_proto=''
554 d_locconv=''
555 d_lockf=''
556 d_longdbl=''
557 longdblsize=''
558 d_longlong=''
559 longlongsize=''
560 d_lseekproto=''
561 d_lstat=''
562 d_madvise=''
563 d_malloc_good_size=''
564 d_malloc_size=''
565 d_mblen=''
566 d_mbstowcs=''
567 d_mbtowc=''
568 d_memchr=''
569 d_memcmp=''
570 d_memcpy=''
571 d_memmove=''
572 d_memset=''
573 d_mkdir=''
574 d_mkdtemp=''
575 d_mkfifo=''
576 d_mkstemp=''
577 d_mkstemps=''
578 d_mktime=''
579 d_mmap=''
580 mmaptype=''
581 d_modfl=''
582 d_modfl_pow32_bug=''
583 d_modflproto=''
584 d_mprotect=''
585 d_msg=''
586 d_msgctl=''
587 d_msgget=''
588 d_msghdr_s=''
589 d_msgrcv=''
590 d_msgsnd=''
591 d_msync=''
592 d_munmap=''
593 d_nice=''
594 d_nl_langinfo=''
595 d_off64_t=''
596 d_open3=''
597 d_fpathconf=''
598 d_pathconf=''
599 d_pause=''
600 d_pipe=''
601 d_poll=''
602 d_portable=''
603 d_procselfexe=''
604 procselfexe=''
605 d_old_pthread_create_joinable=''
606 old_pthread_create_joinable=''
607 d_pthread_atfork=''
608 d_pthread_attr_setscope=''
609 d_pthread_yield=''
610 d_sched_yield=''
611 sched_yield=''
612 d_qgcvt=''
613 d_random_r=''
614 random_r_proto=''
615 d_readdir64_r=''
616 readdir64_r_proto=''
617 d_readdir=''
618 d_rewinddir=''
619 d_seekdir=''
620 d_telldir=''
621 d_readdir_r=''
622 readdir_r_proto=''
623 d_readlink=''
624 d_readv=''
625 d_recvmsg=''
626 d_rename=''
627 d_rmdir=''
628 d_safebcpy=''
629 d_safemcpy=''
630 d_sanemcmp=''
631 d_sbrkproto=''
632 d_scalbnl=''
633 d_select=''
634 d_sem=''
635 d_semctl=''
636 d_semget=''
637 d_semop=''
638 d_sendmsg=''
639 d_setegid=''
640 d_seteuid=''
641 d_setgrent=''
642 d_setgrent_r=''
643 setgrent_r_proto=''
644 d_setgrps=''
645 d_sethent=''
646 d_sethostent_r=''
647 sethostent_r_proto=''
648 d_setitimer=''
649 d_setlinebuf=''
650 d_setlocale=''
651 d_setlocale_r=''
652 setlocale_r_proto=''
653 d_setnent=''
654 d_setnetent_r=''
655 setnetent_r_proto=''
656 d_setpent=''
657 d_setpgid=''
658 d_setpgrp2=''
659 d_bsdsetpgrp=''
660 d_setpgrp=''
661 d_setprior=''
662 d_setproctitle=''
663 d_setprotoent_r=''
664 setprotoent_r_proto=''
665 d_setpwent=''
666 d_setpwent_r=''
667 setpwent_r_proto=''
668 d_setregid=''
669 d_setresgid=''
670 d_setresuid=''
671 d_setreuid=''
672 d_setrgid=''
673 d_setruid=''
674 d_setsent=''
675 d_setservent_r=''
676 setservent_r_proto=''
677 d_setsid=''
678 d_setvbuf=''
679 d_sfio=''
680 usesfio=''
681 d_shm=''
682 d_shmat=''
683 d_shmatprototype=''
684 shmattype=''
685 d_shmctl=''
686 d_shmdt=''
687 d_shmget=''
688 d_sigaction=''
689 d_sigprocmask=''
690 d_sigsetjmp=''
691 usesitecustomize=''
692 d_snprintf=''
693 d_vsnprintf=''
694 d_sockatmark=''
695 d_sockatmarkproto=''
696 d_msg_ctrunc=''
697 d_msg_dontroute=''
698 d_msg_oob=''
699 d_msg_peek=''
700 d_msg_proxy=''
701 d_oldsock=''
702 d_scm_rights=''
703 d_socket=''
704 d_sockpair=''
705 sockethdr=''
706 socketlib=''
707 d_socklen_t=''
708 d_socks5_init=''
709 d_sprintf_returns_strlen=''
710 d_sqrtl=''
711 d_srand48_r=''
712 srand48_r_proto=''
713 d_srandom_r=''
714 srandom_r_proto=''
715 d_sresgproto=''
716 d_sresuproto=''
717 d_statblks=''
718 d_statfs_f_flags=''
719 d_statfs_s=''
720 d_fstatvfs=''
721 d_statvfs=''
722 d_stdio_cnt_lval=''
723 d_stdio_ptr_lval=''
724 d_stdio_ptr_lval_nochange_cnt=''
725 d_stdio_ptr_lval_sets_cnt=''
726 d_stdiobase=''
727 d_stdstdio=''
728 stdio_base=''
729 stdio_bufsiz=''
730 stdio_cnt=''
731 stdio_filbuf=''
732 stdio_ptr=''
733 d_index=''
734 d_strchr=''
735 d_strcoll=''
736 d_strctcpy=''
737 d_strerrm=''
738 d_strerror=''
739 d_sysernlst=''
740 d_syserrlst=''
741 d_strerror_r=''
742 strerror_r_proto=''
743 d_strftime=''
744 d_strlcat=''
745 d_strlcpy=''
746 d_strtod=''
747 d_strtol=''
748 d_strtold=''
749 d_strtoll=''
750 d_strtoq=''
751 d_strtoul=''
752 d_strtoull=''
753 d_strtouq=''
754 d_strxfrm=''
755 d_symlink=''
756 d_syscall=''
757 d_syscallproto=''
758 d_sysconf=''
759 d_system=''
760 d_tcgetpgrp=''
761 d_tcsetpgrp=''
762 d_telldirproto=''
763 d_time=''
764 timetype=''
765 clocktype=''
766 d_times=''
767 d_tmpnam_r=''
768 tmpnam_r_proto=''
769 d_truncate=''
770 d_ttyname_r=''
771 ttyname_r_proto=''
772 d_tzname=''
773 d_u32align=''
774 d_ualarm=''
775 d_umask=''
776 d_semctl_semid_ds=''
777 d_semctl_semun=''
778 d_union_semun=''
779 d_unordered=''
780 d_unsetenv=''
781 d_usleep=''
782 d_usleepproto=''
783 d_ustat=''
784 d_vfork=''
785 usevfork=''
786 d_voidsig=''
787 signal_t=''
788 d_volatile=''
789 d_charvspr=''
790 d_vprintf=''
791 d_wait4=''
792 d_waitpid=''
793 d_wcstombs=''
794 d_wctomb=''
795 d_writev=''
796 dlext=''
797 cccdlflags=''
798 ccdlflags=''
799 dlsrc=''
800 ld=''
801 lddlflags=''
802 usedl=''
803 doublesize=''
804 ebcdic=''
805 fflushNULL=''
806 fflushall=''
807 fpossize=''
808 fpostype=''
809 gccansipedantic=''
810 gccosandvers=''
811 gccversion=''
812 gidformat=''
813 gidsign=''
814 gidsize=''
815 gidtype=''
816 groupstype=''
817 h_fcntl=''
818 h_sysfile=''
819 html1dir=''
820 html1direxp=''
821 installhtml1dir=''
822 html3dir=''
823 html3direxp=''
824 installhtml3dir=''
825 i_arpainet=''
826 i_crypt=''
827 db_hashtype=''
828 db_prefixtype=''
829 db_version_major=''
830 db_version_minor=''
831 db_version_patch=''
832 i_db=''
833 i_dbm=''
834 i_rpcsvcdbm=''
835 d_dirnamlen=''
836 direntrytype=''
837 i_dirent=''
838 i_dld=''
839 i_dlfcn=''
840 i_fcntl=''
841 i_float=''
842 i_fp=''
843 i_fp_class=''
844 i_gdbm=''
845 d_grpasswd=''
846 i_grp=''
847 i_ieeefp=''
848 i_inttypes=''
849 i_langinfo=''
850 i_libutil=''
851 i_limits=''
852 i_locale=''
853 i_machcthr=''
854 i_malloc=''
855 i_math=''
856 i_memory=''
857 i_mntent=''
858 i_ndbm=''
859 i_netdb=''
860 i_neterrno=''
861 i_netinettcp=''
862 i_niin=''
863 i_sysin=''
864 i_poll=''
865 i_prot=''
866 i_pthread=''
867 d_pwage=''
868 d_pwchange=''
869 d_pwclass=''
870 d_pwcomment=''
871 d_pwexpire=''
872 d_pwgecos=''
873 d_pwpasswd=''
874 d_pwquota=''
875 i_pwd=''
876 i_sfio=''
877 i_shadow=''
878 i_socks=''
879 i_stddef=''
880 i_stdlib=''
881 i_string=''
882 strings=''
883 i_sunmath=''
884 i_sysaccess=''
885 i_sysdir=''
886 i_sysfile=''
887 d_voidtty=''
888 i_bsdioctl=''
889 i_sysfilio=''
890 i_sysioctl=''
891 i_syssockio=''
892 i_syslog=''
893 i_sysmman=''
894 i_sysmode=''
895 i_sysmount=''
896 i_sysndir=''
897 i_sysparam=''
898 i_sysresrc=''
899 i_syssecrt=''
900 i_sysselct=''
901 i_sysstat=''
902 i_sysstatfs=''
903 i_sysstatvfs=''
904 i_systimes=''
905 i_systypes=''
906 i_sysuio=''
907 i_sysun=''
908 i_sysutsname=''
909 i_sysvfs=''
910 i_syswait=''
911 i_sgtty=''
912 i_termio=''
913 i_termios=''
914 d_tm_tm_gmtoff=''
915 d_tm_tm_zone=''
916 i_systime=''
917 i_systimek=''
918 i_time=''
919 timeincl=''
920 i_unistd=''
921 i_ustat=''
922 i_utime=''
923 i_values=''
924 i_stdarg=''
925 i_varargs=''
926 i_varhdr=''
927 i_vfork=''
928 d_inc_version_list=''
929 inc_version_list=''
930 inc_version_list_init=''
931 installprefix=''
932 installprefixexp=''
933 installstyle=''
934 installusrbinperl=''
935 intsize=''
936 longsize=''
937 shortsize=''
938 issymlink=''
939 libc=''
940 ldlibpthname=''
941 libperl=''
942 shrpenv=''
943 useshrplib=''
944 glibpth=''
945 libpth=''
946 loclibpth=''
947 plibpth=''
948 xlibpth=''
949 ignore_versioned_solibs=''
950 libs=''
951 libsdirs=''
952 libsfiles=''
953 libsfound=''
954 libspath=''
955 lns=''
956 d_PRIEUldbl=''
957 d_PRIFUldbl=''
958 d_PRIGUldbl=''
959 d_PRIeldbl=''
960 d_PRIfldbl=''
961 d_PRIgldbl=''
962 d_SCNfldbl=''
963 sPRIEUldbl=''
964 sPRIFUldbl=''
965 sPRIGUldbl=''
966 sPRIeldbl=''
967 sPRIfldbl=''
968 sPRIgldbl=''
969 sSCNfldbl=''
970 lseeksize=''
971 lseektype=''
972 mad=''
973 madlyh=''
974 madlyobj=''
975 madlysrc=''
976 make_set_make=''
977 d_mymalloc=''
978 freetype=''
979 mallocobj=''
980 mallocsrc=''
981 malloctype=''
982 usemallocwrap=''
983 usemymalloc=''
984 installman1dir=''
985 man1dir=''
986 man1direxp=''
987 man1ext=''
988 installman3dir=''
989 man3dir=''
990 man3direxp=''
991 man3ext=''
992 modetype=''
993 multiarch=''
994 mydomain=''
995 myhostname=''
996 phostname=''
997 c=''
998 n=''
999 d_eofnblk=''
1000 eagain=''
1001 o_nonblock=''
1002 rd_nodata=''
1003 need_va_copy=''
1004 netdb_hlen_type=''
1005 netdb_host_type=''
1006 netdb_name_type=''
1007 netdb_net_type=''
1008 groupcat=''
1009 hostcat=''
1010 passcat=''
1011 orderlib=''
1012 ranlib=''
1013 d_perl_otherlibdirs=''
1014 otherlibdirs=''
1015 package=''
1016 spackage=''
1017 pager=''
1018 api_revision=''
1019 api_subversion=''
1020 api_version=''
1021 api_versionstring=''
1022 patchlevel=''
1023 perl_patchlevel=''
1024 revision=''
1025 subversion=''
1026 version=''
1027 version_patchlevel_string=''
1028 perl5=''
1029 perladmin=''
1030 perlpath=''
1031 d_nv_preserves_uv=''
1032 d_nv_zero_is_allbits_zero=''
1033 i16size=''
1034 i16type=''
1035 i32size=''
1036 i32type=''
1037 i64size=''
1038 i64type=''
1039 i8size=''
1040 i8type=''
1041 ivsize=''
1042 ivtype=''
1043 nv_preserves_uv_bits=''
1044 nvsize=''
1045 nvtype=''
1046 u16size=''
1047 u16type=''
1048 u32size=''
1049 u32type=''
1050 u64size=''
1051 u64type=''
1052 u8size=''
1053 u8type=''
1054 uvsize=''
1055 uvtype=''
1056 ivdformat=''
1057 nvEUformat=''
1058 nvFUformat=''
1059 nvGUformat=''
1060 nveformat=''
1061 nvfformat=''
1062 nvgformat=''
1063 uvXUformat=''
1064 uvoformat=''
1065 uvuformat=''
1066 uvxformat=''
1067 pidtype=''
1068 prefix=''
1069 prefixexp=''
1070 installprivlib=''
1071 privlib=''
1072 privlibexp=''
1073 prototype=''
1074 ptrsize=''
1075 d_PRIXU64=''
1076 d_PRId64=''
1077 d_PRIi64=''
1078 d_PRIo64=''
1079 d_PRIu64=''
1080 d_PRIx64=''
1081 sPRIXU64=''
1082 sPRId64=''
1083 sPRIi64=''
1084 sPRIo64=''
1085 sPRIu64=''
1086 sPRIx64=''
1087 d_quad=''
1088 quadkind=''
1089 quadtype=''
1090 uquadtype=''
1091 drand01=''
1092 randbits=''
1093 randfunc=''
1094 randseedtype=''
1095 seedfunc=''
1096 installscript=''
1097 scriptdir=''
1098 scriptdirexp=''
1099 selectminbits=''
1100 selecttype=''
1101 sh=''
1102 sig_count=''
1103 sig_name=''
1104 sig_name_init=''
1105 sig_num=''
1106 sig_num_init=''
1107 sig_size=''
1108 d_sitearch=''
1109 installsitearch=''
1110 sitearch=''
1111 sitearchexp=''
1112 installsitebin=''
1113 sitebin=''
1114 sitebinexp=''
1115 installsitehtml1dir=''
1116 sitehtml1dir=''
1117 sitehtml1direxp=''
1118 installsitehtml3dir=''
1119 sitehtml3dir=''
1120 sitehtml3direxp=''
1121 installsitelib=''
1122 sitelib=''
1123 sitelib_stem=''
1124 sitelibexp=''
1125 installsiteman1dir=''
1126 siteman1dir=''
1127 siteman1direxp=''
1128 installsiteman3dir=''
1129 siteman3dir=''
1130 siteman3direxp=''
1131 siteprefix=''
1132 siteprefixexp=''
1133 installsitescript=''
1134 sitescript=''
1135 sitescriptexp=''
1136 sizesize=''
1137 sizetype=''
1138 so=''
1139 socksizetype=''
1140 sharpbang=''
1141 shsharp=''
1142 spitshell=''
1143 src=''
1144 ssizetype=''
1145 startperl=''
1146 startsh=''
1147 stdchar=''
1148 d_stdio_stream_array=''
1149 stdio_stream_array=''
1150 sysman=''
1151 trnl=''
1152 uidformat=''
1153 uidsign=''
1154 uidsize=''
1155 uidtype=''
1156 archname64=''
1157 use64bitall=''
1158 use64bitint=''
1159 usefaststdio=''
1160 ccflags_uselargefiles=''
1161 ldflags_uselargefiles=''
1162 libswanted_uselargefiles=''
1163 uselargefiles=''
1164 uselongdouble=''
1165 usemorebits=''
1166 usemultiplicity=''
1167 nm_opt=''
1168 nm_so_opt=''
1169 runnm=''
1170 usenm=''
1171 useperlio=''
1172 usesocks=''
1173 d_oldpthreads=''
1174 use5005threads=''
1175 useithreads=''
1176 usereentrant=''
1177 usethreads=''
1178 incpath=''
1179 mips_type=''
1180 usrinc=''
1181 d_vendorarch=''
1182 installvendorarch=''
1183 vendorarch=''
1184 vendorarchexp=''
1185 d_vendorbin=''
1186 installvendorbin=''
1187 vendorbin=''
1188 vendorbinexp=''
1189 installvendorhtml1dir=''
1190 vendorhtml1dir=''
1191 vendorhtml1direxp=''
1192 installvendorhtml3dir=''
1193 vendorhtml3dir=''
1194 vendorhtml3direxp=''
1195 d_vendorlib=''
1196 installvendorlib=''
1197 vendorlib=''
1198 vendorlib_stem=''
1199 vendorlibexp=''
1200 installvendorman1dir=''
1201 vendorman1dir=''
1202 vendorman1direxp=''
1203 installvendorman3dir=''
1204 vendorman3dir=''
1205 vendorman3direxp=''
1206 usevendorprefix=''
1207 vendorprefix=''
1208 vendorprefixexp=''
1209 d_vendorscript=''
1210 installvendorscript=''
1211 vendorscript=''
1212 vendorscriptexp=''
1213 versiononly=''
1214 defvoidused=''
1215 voidflags=''
1216 yacc=''
1217 yaccflags=''
1218 CONFIG=''
1219
1220 define='define'
1221 undef='undef'
1222 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1223 rmlist=''
1224
1225 : We must find out about Eunice early
1226 eunicefix=':'
1227 if test -f /etc/unixtovms; then
1228         eunicefix=/etc/unixtovms
1229 fi
1230 if test -f /etc/unixtovms.exe; then
1231         eunicefix=/etc/unixtovms.exe
1232 fi
1233
1234 : Set executable suffix now -- needed before hints available
1235 if test -f "/libs/version.library"; then
1236 : Amiga OS
1237     _exe=""
1238 elif test -f "/system/gnu_library/bin/ar.pm"; then
1239 : Stratus VOS
1240     _exe=".pm"
1241 elif test -n "$DJGPP"; then
1242 : DOS DJGPP
1243     _exe=".exe"
1244 elif test -d c:/. -o -n "$is_os2" ; then
1245 : OS/2 or cygwin
1246     _exe=".exe"
1247 fi
1248
1249 i_whoami=''
1250 ccname=''
1251 ccversion=''
1252 perllibs=''
1253 : set useposix=false in your hint file to disable the POSIX extension.
1254 useposix=true
1255 : set useopcode=false in your hint file to disable the Opcode extension.
1256 useopcode=true
1257 : Trailing extension.  Override this in a hint file, if needed.
1258 : Extra object files, if any, needed on this platform.
1259 archobjs=''
1260 archname=''
1261 : Possible local include directories to search.
1262 : Set locincpth to "" in a hint file to defeat local include searches.
1263 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1264 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1265 :
1266 : no include file wanted by default
1267 inclwanted=''
1268
1269 : Enable -DEBUGGING and -DDEBUGGING from the command line
1270 EBUGGING=''
1271 DEBUGGING=old
1272
1273 groupstype=''
1274 libnames=''
1275 : change the next line if compiling for Xenix/286 on Xenix/386
1276 xlibpth='/usr/lib/386 /lib/386'
1277 : Possible local library directories to search.
1278 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1279 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1280
1281 : general looking path for locating libraries
1282 glibpth="/lib /usr/lib $xlibpth"
1283 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1284 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1285 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1286
1287 : Private path used by Configure to find libraries.  Its value
1288 : is prepended to libpth. This variable takes care of special
1289 : machines, like the mips.  Usually, it should be empty.
1290 plibpth=''
1291
1292 : default library list
1293 libswanted=''
1294 : some systems want to use only the non-versioned libso:s
1295 ignore_versioned_solibs=''
1296 siteman1dir=''
1297 siteman3dir=''
1298 sitescript=''
1299 archname64=''
1300 ccflags_uselargefiles=''
1301 ldflags_uselargefiles=''
1302 libswanted_uselargefiles=''
1303 : set usemultiplicity on the Configure command line to enable multiplicity.
1304 : set usesocks on the Configure command line to enable socks.
1305 : set usethreads on the Configure command line to enable threads.
1306 usereentrant='undef'
1307 : full support for void wanted by default
1308 defvoidused=15
1309
1310 : List of libraries we want.
1311 : If anyone needs extra -lxxx, put those in a hint file.
1312 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1313 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1314 : We probably want to search /usr/shlib before most other libraries.
1315 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1316 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1317 glibpth="/usr/shlib $glibpth"
1318 : Do not use vfork unless overridden by a hint file.
1319 usevfork=false
1320
1321 : Find the basic shell for Bourne shell scripts
1322 case "$sh" in
1323 '')
1324         case "$SYSTYPE" in
1325         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1326         *) xxx='/bin/sh';;
1327         esac
1328         if test -f "$xxx"; then
1329                 sh="$xxx"
1330         else
1331                 : Build up a list and do a single loop so we can 'break' out.
1332                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1333                 for xxx in sh bash ksh pdksh ash; do
1334                         for p in $pth; do
1335                                 try="$try ${p}/${xxx}"
1336                         done
1337                 done
1338                 for xxx in $try; do
1339                         if test -f "$xxx"; then
1340                                 sh="$xxx";
1341                                 break
1342                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1343                                 sh="$xxx";
1344                                 break
1345                         elif test -f "$xxx.exe"; then
1346                                 sh="$xxx";
1347                                 break
1348                         fi
1349                 done
1350         fi
1351         ;;
1352 esac
1353
1354 case "$sh" in
1355 '')     cat >&2 <<EOM
1356 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1357
1358 Usually it's in /bin/sh.  How did you even get this far?
1359 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1360 we'll try to straighten this all out.
1361 EOM
1362         exit 1
1363         ;;
1364 esac
1365
1366 : see if sh knows # comments
1367 if `$sh -c '#' >/dev/null 2>&1`; then
1368         shsharp=true
1369         spitshell=cat
1370         xcat=/bin/cat
1371         test -f $xcat$_exe || xcat=/usr/bin/cat
1372         if test ! -f $xcat$_exe; then
1373                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1374                         if test -f $p/cat$_exe; then
1375                                 xcat=$p/cat
1376                                 break
1377                         fi
1378                 done
1379                 if test ! -f $xcat$_exe; then
1380                         echo "Can't find cat anywhere!"
1381                         exit 1
1382                 fi
1383         fi
1384         echo "#!$xcat" >sharp
1385         $eunicefix sharp
1386         chmod +x sharp
1387         ./sharp > today
1388         if test -s today; then
1389                 sharpbang='#!'
1390         else
1391                 echo "#! $xcat" > sharp
1392                 $eunicefix sharp
1393                 chmod +x sharp
1394                 ./sharp > today
1395                 if test -s today; then
1396                         sharpbang='#! '
1397                 else
1398                         sharpbang=': use '
1399                 fi
1400         fi
1401 else
1402         echo " "
1403         echo "Your $sh doesn't grok # comments--I will strip them later on."
1404         shsharp=false
1405         cd ..
1406         echo "exec grep -v '^[  ]*#'" >spitshell
1407         chmod +x spitshell
1408         $eunicefix spitshell
1409         spitshell=`pwd`/spitshell
1410         cd UU
1411         echo "I presume that if # doesn't work, #! won't work either!"
1412         sharpbang=': use '
1413 fi
1414 rm -f sharp today
1415
1416 : figure out how to guarantee sh startup
1417 case "$startsh" in
1418 '') startsh=${sharpbang}${sh} ;;
1419 *)
1420 esac
1421 cat >sharp <<EOSS
1422 $startsh
1423 set abc
1424 test "$?abc" != 1
1425 EOSS
1426
1427 chmod +x sharp
1428 $eunicefix sharp
1429 if ./sharp; then
1430         : echo "Yup, it does."
1431 else
1432         echo "Hmm... '$startsh' does not guarantee sh startup..."
1433         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1434 fi
1435 rm -f sharp
1436
1437
1438 : Save command line options in file UU/cmdline.opt for later use in
1439 : generating config.sh.
1440 cat > cmdline.opt <<EOSH
1441 # Configure command line arguments.
1442 config_arg0='$0'
1443 config_args='$*'
1444 config_argc=$#
1445 EOSH
1446 argn=1
1447 args_exp=''
1448 args_sep=''
1449 for arg in "$@"; do
1450         cat >>cmdline.opt <<EOSH
1451 config_arg$argn='$arg'
1452 EOSH
1453         # Extreme backslashitis: replace each ' by '"'"'
1454         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1455 $arg
1456 EOC
1457         arg_exp=`cat cmdl.opt`
1458         args_exp="$args_exp$args_sep'$arg_exp'"
1459         argn=`expr $argn + 1`
1460         args_sep=' '
1461 done
1462 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1463 # used by ./hints/os2.sh
1464 rm -f cmdl.opt
1465
1466 : produce awk script to parse command line options
1467 cat >options.awk <<'EOF'
1468 BEGIN {
1469         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1470
1471         len = length(optstr);
1472         for (i = 1; i <= len; i++) {
1473                 c = substr(optstr, i, 1);
1474                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1475                 if (a == ":") {
1476                         arg[c] = 1;
1477                         i++;
1478                 }
1479                 opt[c] = 1;
1480         }
1481 }
1482 {
1483         expect = 0;
1484         str = $0;
1485         if (substr(str, 1, 1) != "-") {
1486                 printf("'%s'\n", str);
1487                 next;
1488         }
1489         len = length($0);
1490         for (i = 2; i <= len; i++) {
1491                 c = substr(str, i, 1);
1492                 if (!opt[c]) {
1493                         printf("-%s\n", substr(str, i));
1494                         next;
1495                 }
1496                 printf("-%s\n", c);
1497                 if (arg[c]) {
1498                         if (i < len)
1499                                 printf("'%s'\n", substr(str, i + 1));
1500                         else
1501                                 expect = 1;
1502                         next;
1503                 }
1504         }
1505 }
1506 END {
1507         if (expect)
1508                 print "?";
1509 }
1510 EOF
1511
1512 : process the command line options
1513 set X `for arg in "$@"; do echo "X$arg"; done |
1514         sed -e s/X// | awk -f options.awk`
1515 eval "set $*"
1516 shift
1517 rm -f options.awk
1518
1519 : set up default values
1520 fastread=''
1521 reuseval=false
1522 config_sh=''
1523 alldone=''
1524 error=''
1525 silent=''
1526 extractsh=''
1527 override=''
1528 knowitall=''
1529 rm -f optdef.sh posthint.sh
1530 cat >optdef.sh <<EOS
1531 $startsh
1532 EOS
1533
1534
1535 : option parsing
1536 while test $# -gt 0; do
1537         case "$1" in
1538         -d) shift; fastread=yes;;
1539         -e) shift; alldone=cont;;
1540         -f)
1541                 shift
1542                 cd ..
1543                 if test -r "$1"; then
1544                         config_sh="$1"
1545                 else
1546                         echo "$me: cannot read config file $1." >&2
1547                         error=true
1548                 fi
1549                 cd UU
1550                 shift;;
1551         -h) shift; error=true;;
1552         -r) shift; reuseval=true;;
1553         -s) shift; silent=true; realsilent=true;;
1554         -E) shift; alldone=exit;;
1555         -K) shift; knowitall=true;;
1556         -O) shift; override=true;;
1557         -S) shift; silent=true; extractsh=true;;
1558         -D)
1559                 shift
1560                 case "$1" in
1561                 *=)
1562                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1563                         echo "$me: ignoring -D $1" >&2
1564                         ;;
1565                 *=*) echo "$1" | \
1566                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1567                 *) echo "$1='define'" >> optdef.sh;;
1568                 esac
1569                 shift
1570                 ;;
1571         -U)
1572                 shift
1573                 case "$1" in
1574                 *=) echo "$1" >> optdef.sh;;
1575                 *=*)
1576                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1577                         echo "$me: ignoring -U $1" >&2
1578                         ;;
1579                 *) echo "$1='undef'" >> optdef.sh;;
1580                 esac
1581                 shift
1582                 ;;
1583         -A)
1584             shift
1585             xxx=''
1586             yyy="$1"
1587             zzz=''
1588             uuu=undef
1589             case "$yyy" in
1590             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1591                  case "$zzz" in
1592                  *:*) zzz='' ;;
1593                  *)   xxx=append
1594                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1595                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1596                  esac
1597                  ;;
1598             esac
1599             case "$xxx" in
1600             '')  case "$yyy" in
1601                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1602                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1603                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1604                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1605                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1606                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1607                  esac
1608                  ;;       
1609             esac
1610             case "$xxx" in
1611             append)
1612                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1613             clear)
1614                 echo "$yyy=''"                  >> posthint.sh ;;
1615             define)
1616                 case "$zzz" in
1617                 '') zzz=define ;;
1618                 esac
1619                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1620             eval)
1621                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1622             prepend)
1623                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1624             undef)
1625                 case "$zzz" in
1626                 '') zzz="$uuu" ;;
1627                 esac
1628                 echo "$yyy=$zzz"                >> posthint.sh ;;
1629             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1630             esac
1631             shift
1632             ;;
1633         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1634             exit 0;;
1635         --) break;;
1636         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1637         *) break;;
1638         esac
1639 done
1640
1641 case "$error" in
1642 true)
1643         cat >&2 <<EOM
1644 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1645                  [-U symbol] [-U symbol=] [-A command:symbol...]
1646   -d : use defaults for all answers.
1647   -e : go on without questioning past the production of config.sh.
1648   -f : specify an alternate default configuration file.
1649   -h : print this help message and exit (with an error status).
1650   -r : reuse C symbols value if possible (skips costly nm extraction).
1651   -s : silent mode, only echoes questions and essential information.
1652   -D : define symbol to have some value:
1653          -D symbol         symbol gets the value 'define'
1654          -D symbol=value   symbol gets the value 'value'
1655   -E : stop at the end of questions, after having produced config.sh.
1656   -K : do not use unless you know what you are doing.
1657   -O : let -D and -U override definitions from loaded configuration file.
1658   -S : perform variable substitutions on all .SH files (can mix with -f)
1659   -U : undefine symbol:
1660          -U symbol    symbol gets the value 'undef'
1661          -U symbol=   symbol gets completely empty
1662   -A : manipulate symbol after the platform specific hints have been applied:
1663          -A symbol=value                append " "value to symbol
1664          -A append:symbol=value         append value to symbol
1665          -A define:symbol=value         define symbol to have value
1666          -A clear:symbol                define symbol to be ''
1667          -A define:symbol               define symbol to be 'define'
1668          -A eval:symbol=value           define symbol to be eval of value
1669          -A prepend:symbol=value        prepend value to symbol
1670          -A undef:symbol                define symbol to be 'undef'
1671          -A undef:symbol=               define symbol to be ''
1672   -V : print version number and exit (with a zero status).
1673 EOM
1674         exit 1
1675         ;;
1676 esac
1677
1678 : Sanity checks
1679 case "$fastread$alldone" in
1680 yescont|yesexit) ;;
1681 *)
1682         case "$extractsh" in
1683         true) ;;
1684         *)
1685                 if test ! -t 0; then
1686                         echo "Say 'sh Configure', not 'sh <Configure'"
1687                         exit 1
1688                 fi
1689                 ;;
1690         esac
1691         ;;
1692 esac
1693
1694 exec 4>&1
1695 case "$silent" in
1696 true) exec 1>/dev/null;;
1697 esac
1698
1699 : run the defines and the undefines, if any, but leave the file out there...
1700 touch optdef.sh
1701 . ./optdef.sh
1702 : create the posthint manipulation script and leave the file out there...
1703 touch posthint.sh
1704
1705 : set package name
1706 package=perl5
1707 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1708 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1709 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1710 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1711 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1712 esac
1713
1714 : Some greps do not return status, grrr.
1715 echo "grimblepritz" >grimble
1716 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1717         contains=contains
1718 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1719         contains=grep
1720 else
1721         contains=contains
1722 fi
1723 rm -f grimble
1724 : the following should work in any shell
1725 case "$contains" in
1726 contains*)
1727         echo " "
1728         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1729         cat >contains <<'EOSS'
1730 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1731 EOSS
1732 chmod +x contains
1733 esac
1734
1735 : Find the path to the source tree
1736 case "$src" in
1737 '') case "$0" in
1738     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1739          case "$src" in
1740          /*)    ;;
1741          .)     ;;
1742          *)     src=`cd ../$src && pwd` ;;
1743          esac
1744          ;;
1745     *)   src='.';;
1746     esac;;
1747 esac
1748 case "$src" in
1749 '')     src=/
1750         rsrc=/
1751         ;;
1752 /*) rsrc="$src";;
1753 *) rsrc="../$src";;
1754 esac
1755 if test -f $rsrc/Configure && \
1756         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1757 then
1758    : found it, so we are ok.
1759 else
1760         rsrc=''
1761         for src in . .. ../.. ../../.. ../../../..; do
1762                 if test -f ../$src/Configure && \
1763                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1764                 then
1765                         rsrc=../$src
1766                         break
1767                 fi
1768         done
1769 fi
1770 case "$rsrc" in
1771 '')
1772         cat <<EOM >&4
1773
1774 Sorry, I can't seem to locate the source dir for $package.  Please start
1775 Configure with an explicit path -- i.e. /some/path/Configure.
1776
1777 EOM
1778         exit 1
1779         ;;
1780 ../.)   rsrc='..';;
1781 *)
1782         echo " "
1783         echo "Sources for $package found in \"$src\"." >&4
1784         ;;
1785 esac
1786
1787 : script used to extract .SH files with variable substitutions
1788 cat >extract <<'EOS'
1789 PERL_CONFIG_SH=true
1790 echo "Doing variable substitutions on .SH files..."
1791 if test -f MANIFEST; then
1792         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1793 else
1794         echo "(Looking for .SH files under the source directory.)"
1795         set x `(cd "$src"; find . -name "*.SH" -print)`
1796 fi
1797 shift
1798 case $# in
1799 0) set x `(cd "$src"; echo *.SH)`; shift;;
1800 esac
1801 if test ! -f "$src/$1"; then
1802         shift
1803 fi
1804 mkdir_p='
1805 name=$1;
1806 create="";
1807 while test $name; do
1808         if test ! -d "$name"; then
1809                 create="$name $create";
1810                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1811                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1812         else
1813                 name="";
1814         fi;
1815 done;
1816 for file in $create; do
1817         mkdir $file;
1818 done
1819 '
1820 for file in $*; do
1821         case "$src" in
1822         ".")
1823                 case "$file" in
1824                 */*)
1825                         dir=`expr X$file : 'X\(.*\)/'`
1826                         file=`expr X$file : 'X.*/\(.*\)'`
1827                         (cd "$dir" && . ./$file)
1828                         ;;
1829                 *)
1830                         . ./$file
1831                         ;;
1832                 esac
1833                 ;;
1834         *)
1835                 case "$file" in
1836                 */*)
1837                         dir=`expr X$file : 'X\(.*\)/'`
1838                         file=`expr X$file : 'X.*/\(.*\)'`
1839                         (set x $dir; shift; eval $mkdir_p)
1840                         sh <"$src/$dir/$file"
1841                         ;;
1842                 *)
1843                         sh <"$src/$file"
1844                         ;;
1845                 esac
1846                 ;;
1847         esac
1848 done
1849 if test -f "$src/config_h.SH"; then
1850         if test ! -f config.h; then
1851         : oops, they left it out of MANIFEST, probably, so do it anyway.
1852         . "$src/config_h.SH"
1853         fi
1854 fi
1855 EOS
1856
1857 : extract files and exit if asked to do so
1858 case "$extractsh" in
1859 true)
1860         case "$realsilent" in
1861         true) ;;
1862         *) exec 1>&4;;
1863         esac
1864         case "$config_sh" in
1865         '') config_sh='config.sh';;
1866         esac
1867         echo " "
1868         echo "Fetching answers from $config_sh..."
1869         cd ..
1870         . $config_sh
1871         test "$override" && . ./optdef.sh
1872         echo " "
1873         . UU/extract
1874         rm -rf UU
1875         echo "Extraction done."
1876         exit 0
1877         ;;
1878 esac
1879
1880 : Eunice requires " " instead of "", can you believe it
1881 echo " "
1882 : Here we go...
1883 echo "Beginning of configuration questions for $package."
1884
1885 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1886
1887 : first determine how to suppress newline on echo command
1888 echo " "
1889 echo "Checking echo to see how to suppress newlines..."
1890 (echo "hi there\c" ; echo " ") >.echotmp
1891 if $contains c .echotmp >/dev/null 2>&1 ; then
1892         echo "...using -n."
1893         n='-n'
1894         c=''
1895 else
1896         cat <<'EOM'
1897 ...using \c
1898 EOM
1899         n=''
1900         c='\c'
1901 fi
1902 echo $n "The star should be here-->$c"
1903 echo '*'
1904 rm -f .echotmp
1905
1906 : Now test for existence of everything in MANIFEST
1907 echo " "
1908 if test -f "$rsrc/MANIFEST"; then
1909         echo "First let's make sure your kit is complete.  Checking..." >&4
1910         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1911         rm -f missing
1912         tmppwd=`pwd`
1913         for filelist in x??; do
1914                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1915         done
1916         if test -s missing; then
1917                 cat missing >&4
1918                 cat >&4 <<'EOM'
1919
1920 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1921
1922 You have the option of continuing the configuration process, despite the
1923 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1924 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1925 and contact the author (perlbug@perl.org).
1926
1927 EOM
1928                 echo $n "Continue? [n] $c" >&4
1929                 read ans
1930                 case "$ans" in
1931                 y*)
1932                         echo "Continuing..." >&4
1933                         rm -f missing
1934                         ;;
1935                 *)
1936                         echo "ABORTING..." >&4
1937                         kill $$
1938                         ;;
1939                 esac
1940         else
1941                 echo "Looks good..."
1942         fi
1943 else
1944         echo "There is no MANIFEST file.  I hope your kit is complete !"
1945 fi
1946 rm -f missing x??
1947
1948 echo " "
1949 : Find the appropriate value for a newline for tr
1950 if test -n "$DJGPP"; then
1951        trnl='\012'
1952 fi
1953 if test X"$trnl" = X; then
1954         case "`echo foo|tr '\n' x 2>/dev/null`" in
1955         foox) trnl='\n' ;;
1956         esac
1957 fi
1958 if test X"$trnl" = X; then
1959         case "`echo foo|tr '\012' x 2>/dev/null`" in
1960         foox) trnl='\012' ;;
1961         esac
1962 fi
1963 if test X"$trnl" = X; then
1964        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1965        fooxy) trnl='\n\r' ;;
1966        esac
1967 fi
1968 if test X"$trnl" = X; then
1969         cat <<EOM >&2
1970
1971 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1972
1973 EOM
1974         exit 1
1975 fi
1976
1977 : compute the number of columns on the terminal for proper question formatting
1978 case "$COLUMNS" in
1979 '') COLUMNS='80';;
1980 esac
1981
1982 : set up the echo used in my read
1983 myecho="case \"\$xxxm\" in
1984 '') echo $n \"\$rp $c\" >&4;;
1985 *) case \"\$rp\" in
1986         '') echo $n \"[\$xxxm] $c\";;
1987         *)
1988                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1989                         echo \"\$rp\" >&4
1990                         echo $n \"[\$xxxm] $c\" >&4
1991                 else
1992                         echo $n \"\$rp [\$xxxm] $c\" >&4
1993                 fi
1994                 ;;
1995         esac;;
1996 esac"
1997
1998 : now set up to do reads with possible shell escape and default assignment
1999 cat <<EOSC >myread
2000 $startsh
2001 xxxm=\$dflt
2002 $myecho
2003 ans='!'
2004 case "\$fastread" in
2005 yes) case "\$dflt" in
2006         '') ;;
2007         *) ans='';
2008                 case "\$silent-\$rp" in
2009                 true-) ;;
2010                 *) echo " " >&4;;
2011                 esac;;
2012         esac;;
2013 *) case "\$silent" in
2014         true) case "\$rp" in
2015                 '') ans='';;
2016                 esac;;
2017         esac;;
2018 esac
2019 while expr "X\$ans" : "X!" >/dev/null; do
2020         read answ
2021         set x \$xxxm
2022         shift
2023         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2024         case  "\$answ" in
2025         "!")
2026                 sh 1>&4
2027                 echo " "
2028                 $myecho
2029                 ;;
2030         !*)
2031                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2032                 shift
2033                 sh 1>&4 -c "\$*"
2034                 echo " "
2035                 $myecho
2036                 ;;
2037         "\$ans")
2038                 case "\$ans" in
2039                 \\&*)
2040                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2041                         shift
2042                         case "\$1" in
2043                         -d)
2044                                 fastread=yes
2045                                 echo "(OK, I'll run with -d after this question.)" >&4
2046                                 ;;
2047                         -*)
2048                                 echo "*** Sorry, \$1 not supported yet." >&4
2049                                 ;;
2050                         esac
2051                         $myecho
2052                         ans=!
2053                         ;;
2054                 esac;;
2055         *)
2056                 case "\$aok" in
2057                 y)
2058                         echo "*** Substitution done -- please confirm."
2059                         xxxm="\$ans"
2060                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2061                         xxxm="\$ans"
2062                         ans=!
2063                         ;;
2064                 *)
2065                         echo "*** Error -- try again."
2066                         ans=!
2067                         ;;
2068                 esac
2069                 $myecho
2070                 ;;
2071         esac
2072         case "\$ans\$xxxm\$nostick" in
2073         '')
2074                 ans=!
2075                 $myecho
2076                 ;;
2077         esac
2078 done
2079 case "\$ans" in
2080 '') ans="\$xxxm";;
2081 esac
2082 EOSC
2083
2084 : create .config dir to save info across Configure sessions
2085 test -d ../.config || mkdir ../.config
2086 cat >../.config/README <<EOF
2087 This directory created by Configure to save information that should
2088 persist across sessions for $package.
2089
2090 You may safely delete it if you wish.
2091 EOF
2092
2093 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2094 case "$usedevel" in
2095 $define|true|[yY]*) ;;
2096 *) case "$xversion" in
2097    *[13579])
2098         cat >&4 <<EOH
2099 *** WHOA THERE!!! ***
2100
2101     This is an UNSTABLE DEVELOPMENT release.
2102     The version of this $package distribution is $xversion, that is, odd,
2103     (as opposed to even) and that signifies a development release.
2104     If you want a maintenance release, you want an even-numbered version.
2105
2106     Do ***NOT*** install this into production use.
2107     Data corruption and crashes are possible.
2108
2109     It is most seriously suggested that you do not continue any further
2110     unless you want to help in developing and debugging Perl.
2111
2112     If you *still* want to build perl, you can answer 'y' now,
2113     or pass -Dusedevel to Configure.
2114
2115 EOH
2116         rp='Do you really want to continue?'
2117         dflt='n'
2118         . ./myread
2119         case "$ans" in
2120         [yY]) echo >&4 "Okay, continuing."
2121               usedevel="$define" ;;
2122         *) echo >&4 "Okay, bye."
2123            exit 1
2124            ;;
2125         esac
2126         ;;
2127     esac
2128     ;;
2129 esac
2130 case "$usedevel" in
2131 $define|true|[yY]*)
2132         case "$versiononly" in
2133         '') versiononly="$define" ;;
2134         esac
2135         case "$installusrbinperl" in
2136         '') installusrbinperl="$undef" ;;
2137         esac
2138         ;;
2139 esac
2140
2141 : general instructions
2142 needman=true
2143 firsttime=true
2144 user=`(logname) 2>/dev/null`
2145 case "$user" in
2146 '') user=`whoami 2>&1`;;
2147 esac
2148 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2149         firsttime=false
2150         echo " "
2151         rp='Would you like to see the instructions?'
2152         dflt=n
2153         . ./myread
2154         case "$ans" in
2155         [yY]*) ;;
2156         *) needman=false;;
2157         esac
2158 fi
2159 if $needman; then
2160         cat <<EOH
2161
2162 This installation shell script will examine your system and ask you questions
2163 to determine how the perl5 package should be installed. If you get
2164 stuck on a question, you may use a ! shell escape to start a subshell or
2165 execute a command.  Many of the questions will have default answers in square
2166 brackets; typing carriage return will give you the default.
2167
2168 On some of the questions which ask for file or directory names you are allowed
2169 to use the ~name construct to specify the login directory belonging to "name",
2170 even if you don't have a shell which knows about that.  Questions where this is
2171 allowed will be marked "(~name ok)".
2172
2173 EOH
2174         rp=''
2175         dflt='Type carriage return to continue'
2176         . ./myread
2177         cat <<'EOH'
2178
2179 The prompter used in this script allows you to use shell variables and
2180 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2181 in the default answer, as if the default line was a set of arguments given to a
2182 script shell.  This means you may also use $* to repeat the whole default line,
2183 so you do not have to re-type everything to add something to the default.
2184
2185 Everytime there is a substitution, you will have to confirm.  If there is an
2186 error (e.g. an unmatched backtick), the default answer will remain unchanged
2187 and you will be prompted again.
2188
2189 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2190 the questions and use the computed defaults (or the previous answers if there
2191 was already a config.sh file). Type 'Configure -h' for a list of options.
2192 You may also start interactively and then answer '& -d' at any prompt to turn
2193 on the non-interactive behaviour for the remainder of the execution.
2194
2195 EOH
2196         . ./myread
2197         cat <<EOH
2198
2199 Much effort has been expended to ensure that this shell script will run on any
2200 Unix system.  If despite that it blows up on yours, your best bet is to edit
2201 Configure and run it again.  If you can't run Configure for some reason,
2202 you'll have to generate a config.sh file by hand.  Whatever problems you
2203 have, let me (perlbug@perl.org) know how I blew it.
2204
2205 This installation script affects things in two ways:
2206
2207 1) it may do direct variable substitutions on some of the files included
2208    in this kit.
2209 2) it builds a config.h file for inclusion in C programs.  You may edit
2210    any of these files as the need arises after running this script.
2211
2212 If you make a mistake on a question, there is no easy way to back up to it
2213 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2214 files.  Configure will offer to let you do this before it runs the SH files.
2215
2216 EOH
2217         dflt='Type carriage return to continue'
2218         . ./myread
2219         case "$firsttime" in
2220         true) echo $user >>../.config/instruct;;
2221         esac
2222 fi
2223
2224 : find out where common programs are
2225 echo " "
2226 echo "Locating common programs..." >&4
2227 cat <<EOSC >loc
2228 $startsh
2229 case \$# in
2230 0) exit 1;;
2231 esac
2232 thing=\$1
2233 shift
2234 dflt=\$1
2235 shift
2236 for dir in \$*; do
2237         case "\$thing" in
2238         .)
2239         if test -d \$dir/\$thing; then
2240                 echo \$dir
2241                 exit 0
2242         fi
2243         ;;
2244         *)
2245         for thisthing in \$dir/\$thing; do
2246                 : just loop through to pick last item
2247         done
2248         if test -f \$thisthing; then
2249                 echo \$thisthing
2250                 exit 0
2251         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2252                 echo \$thisthing
2253                 exit 0
2254         elif test -f \$dir/\$thing.exe; then
2255                 if test -n "$DJGPP"; then
2256                         echo \$dir/\$thing.exe
2257                 elif test "$eunicefix" != ":"; then
2258                         : on Eunice apparently
2259                         echo \$dir/\$thing
2260                         exit 0
2261                 fi
2262                 exit 0
2263         fi
2264         ;;
2265         esac
2266 done
2267 echo \$dflt
2268 exit 1
2269 EOSC
2270 chmod +x loc
2271 $eunicefix loc
2272 loclist="
2273 awk
2274 cat
2275 chmod
2276 comm
2277 cp
2278 echo
2279 expr
2280 grep
2281 ls
2282 mkdir
2283 rm
2284 sed
2285 sort
2286 touch
2287 tr
2288 uniq
2289 "
2290 trylist="
2291 Mcc
2292 ar
2293 bison
2294 byacc
2295 cpp
2296 csh
2297 date
2298 egrep
2299 gmake
2300 gzip
2301 less
2302 ln
2303 make
2304 more
2305 nm
2306 nroff
2307 pg
2308 test
2309 uname
2310 zip
2311 "
2312 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2313 pth="$pth /lib /usr/lib"
2314 for file in $loclist; do
2315         eval xxx=\$$file
2316         case "$xxx" in
2317         /*|?:[\\/]*)
2318                 if test -f "$xxx"; then
2319                         : ok
2320                 else
2321                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2322                         xxx=`./loc $file $file $pth`
2323                 fi
2324                 ;;
2325         '') xxx=`./loc $file $file $pth`;;
2326         *) xxx=`./loc $xxx $xxx $pth`;;
2327         esac
2328         eval $file=$xxx$_exe
2329         eval _$file=$xxx
2330         case "$xxx" in
2331         /*)
2332                 echo $file is in $xxx.
2333                 ;;
2334         ?:[\\/]*)
2335                 echo $file is in $xxx.
2336                 ;;
2337         *)
2338                 echo "I don't know where '$file' is, and my life depends on it." >&4
2339                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2340                 exit 1
2341                 ;;
2342         esac
2343 done
2344 echo " "
2345 echo "Don't worry if any of the following aren't found..."
2346 say=offhand
2347 for file in $trylist; do
2348         eval xxx=\$$file
2349         case "$xxx" in
2350         /*|?:[\\/]*)
2351                 if test -f "$xxx"; then
2352                         : ok
2353                 else
2354                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2355                         xxx=`./loc $file $file $pth`
2356                 fi
2357                 ;;
2358         '') xxx=`./loc $file $file $pth`;;
2359         *) xxx=`./loc $xxx $xxx $pth`;;
2360         esac
2361         eval $file=$xxx$_exe
2362         eval _$file=$xxx
2363         case "$xxx" in
2364         /*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         ?:[\\/]*)
2368                 echo $file is in $xxx.
2369                 ;;
2370         *)
2371                 echo "I don't see $file out there, $say."
2372                 say=either
2373                 ;;
2374         esac
2375 done
2376 case "$egrep" in
2377 egrep)
2378         echo "Substituting grep for egrep."
2379         egrep=$grep
2380         _egrep=$grep
2381         ;;
2382 esac
2383 case "$ln" in
2384 ln)
2385         echo "Substituting cp for ln."
2386         ln=$cp
2387         _ln=$cp
2388         ;;
2389 esac
2390 case "$make" in
2391 make)   
2392         case "$gmake" in
2393         gmake)
2394         echo "I can't find make or gmake, and my life depends on it." >&4
2395         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2396         exit 1
2397         ;;
2398         esac
2399         ;;
2400 esac    
2401 case "$gmake" in
2402 gmake)  ;;
2403 *)      # We can't have osname yet.
2404         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2405                 # Assume that gmake, if found, is definitely GNU make
2406                 # and prefer it over the system make.
2407                 echo "Substituting gmake for make."
2408                 make=$gmake
2409                 _make=$gmake
2410         fi
2411         ;;
2412 esac
2413 case "$test" in
2414 test)
2415         echo "Hopefully test is built into your sh."
2416         ;;
2417 *)
2418         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2419                 echo "Using the test built into your sh."
2420                 test=test
2421                 _test=test
2422         fi
2423         ;;
2424 esac
2425 case "$echo" in
2426 echo)
2427         echo "Hopefully echo is built into your sh."
2428         ;;
2429 '') ;;
2430 *)
2431         echo " "
2432 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2433         $echo $n "hi there$c" >foo1
2434         echo $n "hi there$c" >foo2
2435         if cmp foo1 foo2 >/dev/null 2>&1; then
2436                 echo "They are compatible.  In fact, they may be identical."
2437         else
2438                 case "$n" in
2439                 '-n') n='' c='\c';;
2440                 *) n='-n' c='';;
2441                 esac
2442                 cat <<FOO
2443 They are not compatible!  You are probably running ksh on a non-USG system.
2444 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2445 have echo built in and we may have to run some Bourne shell scripts.  That
2446 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2447
2448 FOO
2449                 $echo $n "The star should be here-->$c"
2450                 $echo "*"
2451         fi
2452         $rm -f foo1 foo2
2453         ;;
2454 esac
2455
2456 cat <<EOS >trygcc
2457 $startsh
2458 EOS
2459 cat <<'EOSC' >>trygcc
2460 case "$cc" in
2461 '') ;;
2462 *)  $rm -f try try.*
2463     $cat >try.c <<EOM
2464 int main(int argc, char *argv[]) {
2465   return 0;
2466 }
2467 EOM
2468     if $cc -o try $ccflags $ldflags try.c; then
2469        :
2470     else
2471         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2472         despair=yes
2473         trygcc=yes
2474         case "$cc" in
2475         *gcc*) trygcc=no ;;
2476         esac
2477         case "`$cc -v -c try.c 2>&1`" in
2478         *gcc*) trygcc=no ;;
2479         esac
2480         if $test X"$trygcc" = Xyes; then
2481             if gcc -o try -c try.c; then
2482                 echo " "
2483                 echo "You seem to have a working gcc, though." >&4
2484                 rp="Would you like to use it?"
2485                 dflt=y
2486                 if $test -f myread; then
2487                     . ./myread
2488                 else
2489                     if $test -f UU/myread; then
2490                         . ./UU/myread
2491                     else
2492                         echo "Cannot find myread, sorry.  Aborting." >&2
2493                         exit 1
2494                     fi
2495                 fi  
2496                 case "$ans" in
2497                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2498                        if $test -f usethreads.cbu; then
2499                            $cat >&4 <<EOM 
2500
2501 *** However, any setting of the C compiler flags (e.g. for thread support)
2502 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2503 *** (together with e.g. -Dusethreads).
2504
2505 EOM
2506                        fi;;
2507                 esac
2508             fi
2509         fi
2510     fi
2511     $rm -f try try.*
2512     ;;
2513 esac
2514 EOSC
2515
2516 cat <<EOS >checkcc
2517 $startsh
2518 EOS
2519 cat <<'EOSC' >>checkcc
2520 case "$cc" in        
2521 '') ;;
2522 *)  $rm -f try try.*              
2523     $cat >try.c <<EOM
2524 int main(int argc, char *argv[]) {
2525   return 0;
2526 }
2527 EOM
2528     if $cc -o try $ccflags $ldflags try.c; then
2529        :
2530     else
2531         if $test X"$despair" = Xyes; then
2532            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2533         fi
2534         $cat >&4 <<EOM         
2535 You need to find a working C compiler.
2536 Either (purchase and) install the C compiler supplied by your OS vendor,
2537 or for a free C compiler try http://gcc.gnu.org/
2538 I cannot continue any further, aborting.
2539 EOM
2540         exit 1
2541     fi
2542     $rm -f try try.*
2543     ;;
2544 esac
2545 EOSC
2546
2547 : determine whether symbolic links are supported
2548 echo " "
2549 $touch blurfl
2550 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2551         echo "Symbolic links are supported." >&4
2552         lns="$ln -s"
2553 else
2554         echo "Symbolic links are NOT supported." >&4
2555         lns="$ln"
2556 fi
2557 $rm -f blurfl sym
2558
2559 : determine whether symbolic links are supported
2560 echo " "
2561 case "$lns" in
2562 *"ln"*" -s")
2563         echo "Checking how to test for symbolic links..." >&4
2564         $lns blurfl sym
2565         if $test "X$issymlink" = X; then
2566                 case "$newsh" in
2567                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2568                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2569                 esac
2570                 if test $? = 0; then
2571                         issymlink="test -h"
2572                 else
2573                         echo "Your builtin 'test -h' may be broken." >&4
2574                         case "$test" in
2575                         /*)     ;;
2576                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2577                                 for p in $pth
2578                                 do
2579                                         if test -f "$p/$test"; then
2580                                                 test="$p/$test"
2581                                                 break
2582                                         fi
2583                                 done
2584                                 ;;
2585                         esac
2586                         case "$test" in
2587                         /*)
2588                                 echo "Trying external '$test -h'." >&4
2589                                 issymlink="$test -h"
2590                                 if $test ! -h sym >/dev/null 2>&1; then
2591                                         echo "External '$test -h' is broken, too." >&4
2592                                         issymlink=''
2593                                 fi
2594                                 ;;
2595                         *)      issymlink='' ;;
2596                         esac
2597                 fi              
2598         fi
2599         if $test "X$issymlink" = X; then
2600                 if $test -L sym 2>/dev/null; then
2601                         issymlink="$test -L"
2602                         echo "The builtin '$test -L' worked." >&4
2603                 fi
2604         fi
2605         if $test "X$issymlink" != X; then
2606                 echo "You can test for symbolic links with '$issymlink'." >&4
2607         else
2608                 echo "I do not know how you can test for symbolic links." >&4
2609         fi
2610         $rm -f blurfl sym
2611         ;;
2612 *)      echo "No symbolic links, so not testing for their testing..." >&4
2613         ;;
2614 esac
2615 echo " "
2616
2617
2618 case "$mksymlinks" in
2619 $define|true|[yY]*)
2620         case "$src" in
2621         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2622                 exit 1
2623                 ;;
2624         *)      case "$lns:$issymlink" in
2625                 *"ln"*" -s:"*"test -"?)
2626                         echo "Creating the symbolic links..." >&4
2627                         echo "(First creating the subdirectories...)" >&4
2628                         cd ..
2629                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2630                                 read directory
2631                                 test -z "$directory" && break
2632                                 mkdir -p $directory
2633                         done
2634                         # Sanity check 1.
2635                         if test ! -d t/base; then
2636                                 echo "Failed to create the subdirectories.  Aborting." >&4
2637                                 exit 1
2638                         fi
2639                         echo "(Then creating the symlinks...)" >&4
2640                         awk '{print $1}' $src/MANIFEST | while true; do
2641                                 read filename
2642                                 test -z "$filename" && break
2643                                 if test -f $filename; then
2644                                         if $issymlink $filename; then
2645                                                 rm -f $filename
2646                                         fi
2647                                 fi
2648                                 if test -f $filename; then
2649                                         echo "$filename already exists, not symlinking."
2650                                 else
2651                                         ln -s $src/$filename $filename
2652                                 fi
2653                         done
2654                         # Sanity check 2.
2655                         if test ! -f t/base/lex.t; then
2656                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2657                                 exit 1
2658                         fi
2659                         cd UU
2660                         ;;
2661                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2662                         ;;
2663                 esac
2664                 ;;
2665         esac
2666         ;;
2667 esac
2668
2669
2670 case "$usecrosscompile" in
2671 $define|true|[yY]*)
2672         $echo "Cross-compiling..."
2673         croak=''
2674         case "$cc" in
2675         *-*-gcc) # A cross-compiling gcc, probably.
2676             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2677             ar=$targetarch-ar
2678             # leave out ld, choosing it is more complex
2679             nm=$targetarch-nm
2680             ranlib=$targetarch-ranlib
2681             $echo 'extern int foo;' > try.c
2682             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2683             shift
2684             if $test $# -gt 0; then
2685                 incpth="$incpth $*"
2686                 incpth="`$echo $incpth|$sed 's/^ //'`"
2687                 echo "Guessing incpth '$incpth'." >&4
2688                 for i in $*; do
2689                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2690                     if $test -d $j; then
2691                         libpth="$libpth $j"
2692                     fi
2693                 done   
2694                 libpth="`$echo $libpth|$sed 's/^ //'`"
2695                 echo "Guessing libpth '$libpth'." >&4
2696             fi
2697             $rm -f try.c
2698             ;;
2699         esac
2700         case "$targetarch" in
2701         '') echo "Targetarch not defined." >&4; croak=y ;;
2702         *)  echo "Using targetarch $targetarch." >&4 ;;
2703         esac
2704         case "$incpth" in
2705         '') echo "Incpth not defined." >&4; croak=y ;;
2706         *)  echo "Using incpth '$incpth'." >&4 ;;
2707         esac
2708         case "$libpth" in
2709         '') echo "Libpth not defined." >&4; croak=y ;;
2710         *)  echo "Using libpth '$libpth'." >&4 ;;
2711         esac
2712         case "$usrinc" in
2713         '') for i in $incpth; do
2714                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2715                     usrinc=$i
2716                     echo "Guessing usrinc $usrinc." >&4
2717                     break
2718                 fi
2719             done
2720             case "$usrinc" in
2721             '') echo "Usrinc not defined." >&4; croak=y ;;
2722             esac
2723             ;;
2724         *)  echo "Using usrinc $usrinc." >&4 ;;
2725         esac
2726         case "$targethost" in
2727         '') echo "Targethost not defined." >&4; croak=y ;;
2728         *)  echo "Using targethost $targethost." >&4
2729         esac
2730         locincpth=' '
2731         loclibpth=' '
2732         case "$croak" in
2733         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2734         esac
2735         case "$src" in
2736         /*) run=$src/Cross/run
2737             targetmkdir=$src/Cross/mkdir
2738             to=$src/Cross/to
2739             from=$src/Cross/from
2740             ;;
2741         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2742             run=$pwd/Cross/run
2743             targetmkdir=$pwd/Cross/mkdir
2744             to=$pwd/Cross/to
2745             from=$pwd/Cross/from
2746             ;;
2747         esac
2748         case "$targetrun" in
2749         '') targetrun=ssh ;;
2750         esac
2751         case "$targetto" in
2752         '') targetto=scp ;;
2753         esac
2754         case "$targetfrom" in
2755         '') targetfrom=scp ;;
2756         esac
2757         run=$run-$targetrun
2758         to=$to-$targetto
2759         from=$from-$targetfrom
2760         case "$targetdir" in
2761         '')  targetdir=/tmp
2762              echo "Guessing targetdir $targetdir." >&4
2763              ;;
2764         esac
2765         case "$targetuser" in
2766         '')  targetuser=root
2767              echo "Guessing targetuser $targetuser." >&4
2768              ;;
2769         esac
2770         case "$targetfrom" in
2771         scp)    q=-q ;;
2772         *)      q='' ;;
2773         esac
2774         case "$targetrun" in
2775         ssh|rsh)
2776             cat >$run <<EOF
2777 #!/bin/sh
2778 case "\$1" in
2779 -cwd)
2780   shift
2781   cwd=\$1
2782   shift
2783   ;;
2784 esac
2785 case "\$cwd" in
2786 '') cwd=$targetdir ;;
2787 esac
2788 exe=\$1
2789 shift
2790 if $test ! -f \$exe.xok; then
2791   $to \$exe
2792   $touch \$exe.xok
2793 fi
2794 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2795 EOF
2796             ;;
2797         *)  echo "Unknown targetrun '$targetrun'" >&4
2798             exit 1
2799             ;;
2800         esac
2801         case "$targetmkdir" in
2802         */Cross/mkdir)
2803             cat >$targetmkdir <<EOF
2804 #!/bin/sh
2805 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2806 EOF
2807             $chmod a+rx $targetmkdir
2808             ;;
2809         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2810             exit 1
2811             ;;
2812         esac
2813         case "$targetto" in
2814         scp|rcp)
2815             cat >$to <<EOF
2816 #!/bin/sh
2817 for f in \$@
2818 do
2819   case "\$f" in
2820   /*)
2821     $targetmkdir \`dirname \$f\`
2822     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2823     ;;
2824   *)
2825     $targetmkdir $targetdir/\`dirname \$f\`
2826     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2827     ;;
2828   esac
2829 done
2830 exit 0
2831 EOF
2832             ;;
2833         cp) cat >$to <<EOF
2834 #!/bin/sh
2835 for f in \$@
2836 do
2837   case "\$f" in
2838   /*)
2839     $mkdir -p $targetdir/\`dirname \$f\`
2840     $cp \$f $targetdir/\$f || exit 1
2841     ;;
2842   *)
2843     $targetmkdir $targetdir/\`dirname \$f\`
2844     $cp \$f $targetdir/\$f || exit 1
2845     ;;
2846   esac
2847 done
2848 exit 0
2849 EOF
2850             ;;
2851         *)  echo "Unknown targetto '$targetto'" >&4
2852             exit 1
2853             ;;
2854         esac
2855         case "$targetfrom" in
2856         scp|rcp)
2857           cat >$from <<EOF
2858 #!/bin/sh
2859 for f in \$@
2860 do
2861   $rm -f \$f
2862   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2863 done
2864 exit 0
2865 EOF
2866             ;;
2867         cp) cat >$from <<EOF
2868 #!/bin/sh
2869 for f in \$@
2870 do
2871   $rm -f \$f
2872   cp $targetdir/\$f . || exit 1
2873 done
2874 exit 0
2875 EOF
2876             ;;
2877         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2878             exit 1
2879             ;;
2880         esac
2881         if $test ! -f $run; then
2882             echo "Target 'run' script '$run' not found." >&4
2883         else
2884             $chmod a+rx $run
2885         fi
2886         if $test ! -f $to; then
2887             echo "Target 'to' script '$to' not found." >&4
2888         else
2889             $chmod a+rx $to
2890         fi
2891         if $test ! -f $from; then
2892             echo "Target 'from' script '$from' not found." >&4
2893         else
2894             $chmod a+rx $from
2895         fi
2896         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2897             exit 1
2898         fi
2899         cat >&4 <<EOF
2900 Using '$run' for remote execution,
2901 and '$from' and '$to'
2902 for remote file transfer.
2903 EOF
2904         ;;
2905 *)      run=''
2906         to=:
2907         from=:
2908         usecrosscompile='undef'
2909         targetarch=''
2910         ;;
2911 esac
2912
2913 : see whether [:lower:] and [:upper:] are supported character classes
2914 echo " "
2915 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2916 ABYZ)
2917         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2918         up='[:upper:]'
2919         low='[:lower:]'
2920         ;;
2921 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2922         # (0xd9 and 0xe2), therefore that is a nice testing point.
2923         if test "X$up" = X -o "X$low" = X; then
2924             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2925             rs) up='[A-Z]'
2926                 low='[a-z]'
2927                 ;;
2928             esac
2929         fi
2930         if test "X$up" = X -o "X$low" = X; then
2931             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2932             rs) up='A-Z'
2933                 low='a-z'
2934                 ;;
2935             esac
2936         fi
2937         if test "X$up" = X -o "X$low" = X; then
2938             case "`echo RS | od -x 2>/dev/null`" in
2939             *D9E2*|*d9e2*)
2940                 echo "Hey, this might be EBCDIC." >&4
2941                 if test "X$up" = X -o "X$low" = X; then
2942                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2943                     rs) up='[A-IJ-RS-Z]'
2944                         low='[a-ij-rs-z]'
2945                         ;;
2946                     esac
2947                 fi
2948                 if test "X$up" = X -o "X$low" = X; then
2949                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2950                     rs) up='A-IJ-RS-Z'
2951                         low='a-ij-rs-z'
2952                         ;;
2953                     esac
2954                 fi
2955                 ;;
2956             esac
2957         fi
2958 esac
2959 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2960 rs)
2961     echo "Using $up and $low to convert case." >&4
2962     ;;
2963 *)
2964     echo "I don't know how to translate letters from upper to lower case." >&4
2965     echo "Your tr is not acting any way I know of." >&4
2966     exit 1
2967     ;;
2968 esac
2969 : set up the translation script tr, must be called with ./tr of course
2970 cat >tr <<EOSC
2971 $startsh
2972 case "\$1\$2" in
2973 '[A-Z][a-z]') exec $tr '$up' '$low';;
2974 '[a-z][A-Z]') exec $tr '$low' '$up';;
2975 esac
2976 exec $tr "\$@"
2977 EOSC
2978 chmod +x tr
2979 $eunicefix tr
2980
2981 : Try to determine whether config.sh was made on this system
2982 case "$config_sh" in
2983 '')
2984 myuname=`$uname -a 2>/dev/null`
2985 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2986 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2987 # because the A-Z/a-z are not consecutive.
2988 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2989         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2990 newmyuname="$myuname"
2991 dflt=n
2992 case "$knowitall" in
2993 '')
2994         if test -f ../config.sh; then
2995                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2996                         eval "`grep myuname= ../config.sh`"
2997                 fi
2998                 if test "X$myuname" = "X$newmyuname"; then
2999                         dflt=y
3000                 fi
3001         fi
3002         ;;
3003 *) dflt=y;;
3004 esac
3005
3006 : Get old answers from old config file if Configure was run on the
3007 : same system, otherwise use the hints.
3008 hint=default
3009 cd ..
3010 if test -f config.sh; then
3011         echo " "
3012         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3013         . UU/myread
3014         case "$ans" in
3015         n*|N*) echo "OK, I'll ignore it."
3016                 mv config.sh config.sh.old
3017                 myuname="$newmyuname"
3018                 ;;
3019         *)  echo "Fetching default answers from your old config.sh file..." >&4
3020                 tmp_n="$n"
3021                 tmp_c="$c"
3022                 tmp_sh="$sh"
3023                 . ./config.sh
3024                 cp config.sh UU
3025                 n="$tmp_n"
3026                 c="$tmp_c"
3027                 : Older versions did not always set $sh.  Catch re-use of such
3028                 : an old config.sh.
3029                 case "$sh" in
3030                 '') sh="$tmp_sh" ;;
3031                 esac
3032                 hint=previous
3033                 ;;
3034         esac
3035 fi
3036 . ./UU/checkcc
3037 if test ! -f config.sh; then
3038         $cat <<EOM
3039
3040 First time through, eh?  I have some defaults handy for some systems
3041 that need some extra help getting the Configure answers right:
3042
3043 EOM
3044         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3045         dflt=''
3046         : Half the following guesses are probably wrong... If you have better
3047         : tests or hints, please send them to perlbug@perl.org
3048         : The metaconfig authors would also appreciate a copy...
3049         $test -f /irix && osname=irix
3050         $test -f /xenix && osname=sco_xenix
3051         $test -f /dynix && osname=dynix
3052         $test -f /dnix && osname=dnix
3053         $test -f /lynx.os && osname=lynxos
3054         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3055         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3056         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3057         $test -f /bin/mips && /bin/mips && osname=mips
3058         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3059                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3060         $test -d /usr/apollo/bin && osname=apollo
3061         $test -f /etc/saf/_sactab && osname=svr4
3062         $test -d /usr/include/minix && osname=minix
3063         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3064         if $test -d /MachTen -o -d /MachTen_Folder; then
3065                 osname=machten
3066                 if $test -x /sbin/version; then
3067                         osvers=`/sbin/version | $awk '{print $2}' |
3068                         $sed -e 's/[A-Za-z]$//'`
3069                 elif $test -x /usr/etc/version; then
3070                         osvers=`/usr/etc/version | $awk '{print $2}' |
3071                         $sed -e 's/[A-Za-z]$//'`
3072                 else
3073                         osvers="$2.$3"
3074                 fi
3075         fi
3076
3077         $test -f /sys/posix.dll &&
3078                 $test -f /usr/bin/what &&
3079                 set X `/usr/bin/what /sys/posix.dll` &&
3080                 $test "$3" = UWIN &&
3081                 osname=uwin &&
3082                 osvers="$5"
3083
3084         if $test -f $uname; then
3085                 set X $myuname
3086                 shift
3087
3088                 case "$5" in
3089                 fps*) osname=fps ;;
3090                 mips*)
3091                         case "$4" in
3092                         umips) osname=umips ;;
3093                         *) osname=mips ;;
3094                         esac;;
3095                 [23]100) osname=mips ;;
3096                 next*) osname=next ;;
3097                 i386*)
3098                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3099                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3100                                 osname='sco'
3101                                 osvers=$tmp
3102                         elif $test -f /etc/kconfig; then
3103                                 osname=isc
3104                                 if test "$lns" = "$ln -s"; then
3105                                         osvers=4
3106                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3107                                         osvers=3
3108                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3109                                         osvers=2
3110                                 fi
3111                         fi
3112                         tmp=''
3113                         ;;
3114                 pc*)
3115                         if test -n "$DJGPP"; then
3116                                 osname=dos
3117                                 osvers=djgpp
3118                         fi
3119                         ;;
3120                 esac
3121
3122                 case "$1" in
3123                 aix) osname=aix
3124                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3125                         case "$tmp" in
3126                         # oslevel can fail with:
3127                         # oslevel: Unable to acquire lock.
3128                         *not\ found) osvers="$4"."$3" ;;
3129                         '<3240'|'<>3240') osvers=3.2.0 ;;
3130                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3131                         '=3250'|'>3250') osvers=3.2.5 ;;
3132                         *) osvers=$tmp;;
3133                         esac
3134                         ;;
3135                 bsd386) osname=bsd386
3136                         osvers=`$uname -r`
3137                         ;;
3138                 cygwin*) osname=cygwin
3139                         osvers="$3"
3140                         ;;
3141                 *dc.osx) osname=dcosx
3142                         osvers="$3"
3143                         ;;
3144                 dnix) osname=dnix
3145                         osvers="$3"
3146                         ;;
3147                 domainos) osname=apollo
3148                         osvers="$3"
3149                         ;;
3150                 dgux)   osname=dgux
3151                         osvers="$3"
3152                         ;;
3153                 dragonfly) osname=dragonfly
3154                         osvers="$3"
3155                         ;;
3156                 dynixptx*) osname=dynixptx
3157                         osvers=`echo "$4"|sed 's/^v//'`
3158                         ;;
3159                 freebsd) osname=freebsd
3160                         osvers="$3" ;;
3161                 genix)  osname=genix ;;
3162                 gnu)    osname=gnu
3163                         osvers="$3" ;;
3164                 hp*)    osname=hpux
3165                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3166                         ;;
3167                 irix*)  osname=irix
3168                         case "$3" in
3169                         4*) osvers=4 ;;
3170                         5*) osvers=5 ;;
3171                         *)      osvers="$3" ;;
3172                         esac
3173                         ;;
3174                 linux)  osname=linux
3175                         case "$3" in
3176                         *)      osvers="$3" ;;
3177                         esac
3178                         ;;
3179                 MiNT)   osname=mint
3180                         ;;
3181                 netbsd*) osname=netbsd
3182                         osvers="$3"
3183                         ;;
3184                 news-os) osvers="$3"
3185                         case "$3" in
3186                         4*) osname=newsos4 ;;
3187                         *) osname=newsos ;;
3188                         esac
3189                         ;;
3190                 next*) osname=next ;;
3191                 nonstop-ux) osname=nonstopux ;;
3192                 openbsd) osname=openbsd
3193                         osvers="$3"
3194                         ;;
3195                 os2)    osname=os2
3196                         osvers="$4"
3197                         ;;
3198                 POSIX-BC | posix-bc ) osname=posix-bc
3199                         osvers="$3"
3200                         ;;
3201                 powerux | power_ux | powermax_os | powermaxos | \
3202                 powerunix | power_unix) osname=powerux
3203                         osvers="$3"
3204                         ;;
3205                 qnx) osname=qnx
3206                         osvers="$4"
3207                         ;;
3208                 solaris) osname=solaris
3209                         case "$3" in
3210                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3211                         *)      osvers="$3" ;;
3212                         esac
3213                         ;;
3214                 sunos) osname=sunos
3215                         case "$3" in
3216                         5*) osname=solaris
3217                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3218                         *)      osvers="$3" ;;
3219                         esac
3220                         ;;
3221                 titanos) osname=titanos
3222                         case "$3" in
3223                         1*) osvers=1 ;;
3224                         2*) osvers=2 ;;
3225                         3*) osvers=3 ;;
3226                         4*) osvers=4 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 ultrix) osname=ultrix
3231                         osvers="$3"
3232                         ;;
3233                 osf1|mls+)      case "$5" in
3234                                 alpha)
3235                                         osname=dec_osf
3236                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3237                                         case "$osvers" in
3238                                         [1-9].[0-9]*) ;;
3239                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3240                                         esac
3241                                         ;;
3242                         hp*)    osname=hp_osf1  ;;
3243                         mips)   osname=mips_osf1 ;;
3244                         esac
3245                         ;;
3246                 # UnixWare 7.1.2 is known as Open UNIX 8
3247                 openunix|unixware) osname=svr5
3248                         osvers="$4"
3249                         ;;
3250                 uts)    osname=uts
3251                         osvers="$3"
3252                         ;;
3253                 vos) osvers="$3"
3254                         ;;
3255                 $2) case "$osname" in
3256                         *isc*) ;;
3257                         *freebsd*) ;;
3258                         svr*)
3259                                 : svr4.x or possibly later
3260                                 case "svr$3" in
3261                                 ${osname}*)
3262                                         osname=svr$3
3263                                         osvers=$4
3264                                         ;;
3265                                 esac
3266                                 case "$osname" in
3267                                 svr4.0)
3268                                         : Check for ESIX
3269                                         if test -f /stand/boot ; then
3270                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3271                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3272                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3273                                                         if test -n "$isesix"; then
3274                                                                 osname=esix4
3275                                                         fi
3276                                                 fi
3277                                         fi
3278                                         ;;
3279                                 esac
3280                                 ;;
3281                         *)      if test -f /etc/systemid; then
3282                                         osname=sco
3283                                         set `echo $3 | $sed 's/\./ /g'` $4
3284                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3285                                                 osvers=$1.$2.$3
3286                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3287                                                 osvers=$1.$2
3288                                         elif $test -f $src/hints/sco_$1.sh; then
3289                                                 osvers=$1
3290                                         fi
3291                                 else
3292                                         case "$osname" in
3293                                         '') : Still unknown.  Probably a generic Sys V.
3294                                                 osname="sysv"
3295                                                 osvers="$3"
3296                                                 ;;
3297                                         esac
3298                                 fi
3299                                 ;;
3300                         esac
3301                         ;;
3302                 *)      case "$osname" in
3303                         '') : Still unknown.  Probably a generic BSD.
3304                                 osname="$1"
3305                                 osvers="$3"
3306                                 ;;
3307                         esac
3308                         ;;
3309                 esac
3310         else
3311                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3312                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3313                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3314                                 osname=news_os
3315                         fi
3316                         $rm -f UU/kernel.what
3317                 elif test -d c:/. -o -n "$is_os2" ; then
3318                         set X $myuname
3319                         osname=os2
3320                         osvers="$5"
3321                 fi
3322         fi
3323
3324         case "$targetarch" in
3325         '') ;;
3326         *)  hostarch=$osname
3327             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3328             osvers=''
3329             ;;
3330         esac
3331
3332         : Now look for a hint file osname_osvers, unless one has been
3333         : specified already.
3334         case "$hintfile" in
3335         ''|' ')
3336                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3337                 : Also try without trailing minor version numbers.
3338                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3339                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3340                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3341                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3342                 case "$file" in
3343                 '') dflt=none ;;
3344                 *)  case "$osvers" in
3345                         '') dflt=$file
3346                                 ;;
3347                         *)  if $test -f $src/hints/$file.sh ; then
3348                                         dflt=$file
3349                                 elif $test -f $src/hints/$xfile.sh ; then
3350                                         dflt=$xfile
3351                                 elif $test -f $src/hints/$xxfile.sh ; then
3352                                         dflt=$xxfile
3353                                 elif $test -f $src/hints/$xxxfile.sh ; then
3354                                         dflt=$xxxfile
3355                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3356                                         dflt=$xxxxfile
3357                                 elif $test -f "$src/hints/${osname}.sh" ; then
3358                                         dflt="${osname}"
3359                                 else
3360                                         dflt=none
3361                                 fi
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366                 if $test -f Policy.sh ; then
3367                         case "$dflt" in
3368                         *Policy*) ;;
3369                         none) dflt="Policy" ;;
3370                         *) dflt="Policy $dflt" ;;
3371                         esac
3372                 fi
3373                 ;;
3374         *)
3375                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3376                 ;;
3377         esac
3378
3379         if $test -f Policy.sh ; then
3380                 $cat <<EOM
3381
3382 There's also a Policy hint file available, which should make the
3383 site-specific (policy) questions easier to answer.
3384 EOM
3385
3386         fi
3387
3388         $cat <<EOM
3389
3390 You may give one or more space-separated answers, or "none" if appropriate.
3391 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3392 previous run of Configure, you may specify it as well as or instead of
3393 OS-specific hints.  If hints are provided for your OS, you should use them:
3394 although Perl can probably be built without hints on many platforms, using
3395 hints often improve performance and may enable features that Configure can't
3396 set up on its own. If there are no hints that match your OS, specify "none";
3397 DO NOT give a wrong version or a wrong OS.
3398
3399 EOM
3400
3401         rp="Which of these apply, if any?"
3402         . UU/myread
3403         tans=$ans
3404         for file in $tans; do
3405                 if $test X$file = XPolicy -a -f Policy.sh; then
3406                         . Policy.sh
3407                         $cat Policy.sh >> UU/config.sh
3408                 elif $test -f $src/hints/$file.sh; then
3409                         . $src/hints/$file.sh
3410                         $cat $src/hints/$file.sh >> UU/config.sh
3411                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3412                         : nothing
3413                 else
3414                         : Give one chance to correct a possible typo.
3415                         echo "$file.sh does not exist"
3416                         dflt=$file
3417                         rp="hint to use instead?"
3418                         . UU/myread
3419                         for file in $ans; do
3420                                 if $test -f "$src/hints/$file.sh"; then
3421                                         . $src/hints/$file.sh
3422                                         $cat $src/hints/$file.sh >> UU/config.sh
3423                                 elif $test X$ans = X -o X$ans = Xnone ; then
3424                                         : nothing
3425                                 else
3426                                         echo "$file.sh does not exist -- ignored."
3427                                 fi
3428                         done
3429                 fi
3430         done
3431
3432         hint=recommended
3433         : Remember our hint file for later.
3434         if $test -f "$src/hints/$file.sh" ; then
3435                 hintfile="$file"
3436         else
3437                 hintfile=''
3438         fi
3439 fi
3440 cd UU
3441 ;;
3442 *)
3443         echo " "
3444         echo "Fetching default answers from $config_sh..." >&4
3445         tmp_n="$n"
3446         tmp_c="$c"
3447         cd ..
3448         cp $config_sh config.sh 2>/dev/null
3449         chmod +w config.sh
3450         . ./config.sh
3451         cd UU
3452         cp ../config.sh .
3453         n="$tmp_n"
3454         c="$tmp_c"
3455         hint=previous
3456         ;;
3457 esac
3458 test "$override" && . ./optdef.sh
3459
3460 : Restore computed paths
3461 for file in $loclist $trylist; do
3462         eval $file="\$_$file"
3463 done
3464
3465 cat << EOM
3466
3467 Configure uses the operating system name and version to set some defaults.
3468 The default value is probably right if the name rings a bell. Otherwise,
3469 since spelling matters for me, either accept the default or answer "none"
3470 to leave it blank.
3471
3472 EOM
3473 case "$osname" in
3474         ''|' ')
3475                 case "$hintfile" in
3476                 ''|' '|none) dflt=none ;;
3477                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3478                 esac
3479                 ;;
3480         *) dflt="$osname" ;;
3481 esac
3482 rp="Operating system name?"
3483 . ./myread
3484 case "$ans" in
3485 none)  osname='' ;;
3486 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3487 esac
3488 echo " "
3489 case "$osvers" in
3490         ''|' ')
3491                 case "$hintfile" in
3492                 ''|' '|none) dflt=none ;;
3493                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3494                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3495                         case "$dflt" in
3496                         ''|' ') dflt=none ;;
3497                         esac
3498                         ;;
3499                 esac
3500                 ;;
3501         *) dflt="$osvers" ;;
3502 esac
3503 rp="Operating system version?"
3504 . ./myread
3505 case "$ans" in
3506 none)  osvers='' ;;
3507 *) osvers="$ans" ;;
3508 esac
3509
3510
3511 . ./posthint.sh
3512
3513 : who configured the system
3514 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3515 case "$cf_by" in
3516 "")
3517         cf_by=`(logname) 2>/dev/null`
3518         case "$cf_by" in
3519         "")
3520                 cf_by=`(whoami) 2>/dev/null`
3521                 case "$cf_by" in
3522                 "") cf_by=unknown ;;
3523                 esac ;;
3524         esac ;;
3525 esac
3526
3527 : decide how portable to be.  Allow command line overrides.
3528 case "$d_portable" in
3529 "$undef") ;;
3530 *)      d_portable="$define" ;;
3531 esac
3532
3533 : set up shell script to do ~ expansion
3534 cat >filexp <<EOSS
3535 $startsh
3536 : expand filename
3537 case "\$1" in
3538  ~/*|~)
3539         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3540         ;;
3541  ~*)
3542         if $test -f /bin/csh; then
3543                 /bin/csh -f -c "glob \$1"
3544                 failed=\$?
3545                 echo ""
3546                 exit \$failed
3547         else
3548                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3549                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3550                 if $test ! -d "\$dir"; then
3551                         me=\`basename \$0\`
3552                         echo "\$me: can't locate home directory for: \$name" >&2
3553                         exit 1
3554                 fi
3555                 case "\$1" in
3556                 */*)
3557                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3558                         ;;
3559                 *)
3560                         echo \$dir
3561                         ;;
3562                 esac
3563         fi
3564         ;;
3565 *)
3566         echo \$1
3567         ;;
3568 esac
3569 EOSS
3570 chmod +x filexp
3571 $eunicefix filexp
3572
3573 : now set up to get a file name
3574 cat <<EOS >getfile
3575 $startsh
3576 EOS
3577 cat <<'EOSC' >>getfile
3578 tilde=''
3579 fullpath=''
3580 already=''
3581 skip=''
3582 none_ok=''
3583 exp_file=''
3584 nopath_ok=''
3585 orig_rp="$rp"
3586 orig_dflt="$dflt"
3587 case "$gfpth" in
3588 '') gfpth='.' ;;
3589 esac
3590
3591 case "$fn" in
3592 *\(*)
3593         : getfile will accept an answer from the comma-separated list
3594         : enclosed in parentheses even if it does not meet other criteria.
3595         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3596         fn=`echo $fn | sed 's/(.*)//'`
3597         ;;
3598 esac
3599
3600 case "$fn" in
3601 *:*)
3602         loc_file=`expr $fn : '.*:\(.*\)'`
3603         fn=`expr $fn : '\(.*\):.*'`
3604         ;;
3605 esac
3606
3607 case "$fn" in
3608 *~*) tilde=true;;
3609 esac
3610 case "$fn" in
3611 */*) fullpath=true;;
3612 esac
3613 case "$fn" in
3614 *+*) skip=true;;
3615 esac
3616 case "$fn" in
3617 *n*) none_ok=true;;
3618 esac
3619 case "$fn" in
3620 *e*) exp_file=true;;
3621 esac
3622 case "$fn" in
3623 *p*) nopath_ok=true;;
3624 esac
3625
3626 case "$fn" in
3627 *f*) type='File';;
3628 *d*) type='Directory';;
3629 *l*) type='Locate';;
3630 esac
3631
3632 what="$type"
3633 case "$what" in
3634 Locate) what='File';;
3635 esac
3636
3637 case "$exp_file" in
3638 '')
3639         case "$d_portable" in
3640         "$define") ;;
3641         *) exp_file=true;;
3642         esac
3643         ;;
3644 esac
3645
3646 cd ..
3647 while test "$type"; do
3648         redo=''
3649         rp="$orig_rp"
3650         dflt="$orig_dflt"
3651         case "$tilde" in
3652         true) rp="$rp (~name ok)";;
3653         esac
3654         . UU/myread
3655         if test -f UU/getfile.ok && \
3656                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3657         then
3658                 value="$ans"
3659                 ansexp="$ans"
3660                 break
3661         fi
3662         case "$ans" in
3663         none)
3664                 value=''
3665                 ansexp=''
3666                 case "$none_ok" in
3667                 true) type='';;
3668                 esac
3669                 ;;
3670         *)
3671                 case "$tilde" in
3672                 '') value="$ans"
3673                         ansexp="$ans";;
3674                 *)
3675                         value=`UU/filexp $ans`
3676                         case $? in
3677                         0)
3678                                 if test "$ans" != "$value"; then
3679                                         echo "(That expands to $value on this system.)"
3680                                 fi
3681                                 ;;
3682                         *) value="$ans";;
3683                         esac
3684                         ansexp="$value"
3685                         case "$exp_file" in
3686                         '') value="$ans";;
3687                         esac
3688                         ;;
3689                 esac
3690                 case "$fullpath" in
3691                 true)
3692                         case "$ansexp" in
3693                         /*) value="$ansexp" ;;
3694                         [a-zA-Z]:/*) value="$ansexp" ;;
3695                         *)
3696                                 redo=true
3697                                 case "$already" in
3698                                 true)
3699                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3700                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3701                                         ;;
3702                                 *)
3703                                 echo "Please give a full path name, starting with slash." >&4
3704                                         case "$tilde" in
3705                                         true)
3706                                 echo "Note that using ~name is ok provided it expands well." >&4
3707                                                 already=true
3708                                                 ;;
3709                                         esac
3710                                 esac
3711                                 ;;
3712                         esac
3713                         ;;
3714                 esac
3715                 case "$redo" in
3716                 '')
3717                         case "$type" in
3718                         File)
3719                                 for fp in $gfpth; do
3720                                         if test "X$fp" = X.; then
3721                                             pf="$ansexp"
3722                                         else    
3723                                             pf="$fp/$ansexp"
3724                                         fi
3725                                         if test -f "$pf"; then
3726                                                 type=''
3727                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3728                                         then
3729                                                 echo "($value is not a plain file, but that's ok.)"
3730                                                 type=''
3731                                         fi
3732                                         if test X"$type" = X; then
3733                                             value="$pf"
3734                                             break
3735                                         fi
3736                                 done
3737                                 ;;
3738                         Directory)
3739                                 for fp in $gfpth; do
3740                                         if test "X$fp" = X.; then
3741                                             dir="$ans"
3742                                             direxp="$ansexp"
3743                                         else    
3744                                             dir="$fp/$ansexp"
3745                                             direxp="$fp/$ansexp"
3746                                         fi
3747                                         if test -d "$direxp"; then
3748                                                 type=''
3749                                                 value="$dir"
3750                                                 break
3751                                         fi
3752                                 done
3753                                 ;;
3754                         Locate)
3755                                 if test -d "$ansexp"; then
3756                                         echo "(Looking for $loc_file in directory $value.)"
3757                                         value="$value/$loc_file"
3758                                         ansexp="$ansexp/$loc_file"
3759                                 fi
3760                                 if test -f "$ansexp"; then
3761                                         type=''
3762                                 fi
3763                                 case "$nopath_ok" in
3764                                 true)   case "$value" in
3765                                         */*) ;;
3766                                         *)      echo "Assuming $value will be in people's path."
3767                                                 type=''
3768                                                 ;;
3769                                         esac
3770                                         ;;
3771                                 esac
3772                                 ;;
3773                         esac
3774
3775                         case "$skip" in
3776                         true) type='';
3777                         esac
3778
3779                         case "$type" in
3780                         '') ;;
3781                         *)
3782                                 if test "$fastread" = yes; then
3783                                         dflt=y
3784                                 else
3785                                         dflt=n
3786                                 fi
3787                                 rp="$what $value doesn't exist.  Use that name anyway?"
3788                                 . UU/myread
3789                                 dflt=''
3790                                 case "$ans" in
3791                                 y*) type='';;
3792                                 *) echo " ";;
3793                                 esac
3794                                 ;;
3795                         esac
3796                         ;;
3797                 esac
3798                 ;;
3799         esac
3800 done
3801 cd UU
3802 ans="$value"
3803 rp="$orig_rp"
3804 dflt="$orig_dflt"
3805 rm -f getfile.ok
3806 test "X$gfpthkeep" != Xy && gfpth=""
3807 EOSC
3808
3809 : determine root of directory hierarchy where package will be installed.
3810 case "$prefix" in
3811 '')
3812         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3813         ;;
3814 *?/)
3815         dflt=`echo "$prefix" | sed 's/.$//'`
3816         ;;
3817 *)
3818         dflt="$prefix"
3819         ;;
3820 esac
3821 $cat <<EOM
3822
3823 By default, $package will be installed in $dflt/bin, manual pages
3824 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3825 installation directories. Typically this is something like /usr/local.
3826 If you wish to have binaries under /usr/bin but other parts of the
3827 installation under /usr/local, that's ok: you will be prompted
3828 separately for each of the installation directories, the prefix being
3829 only used to set the defaults.
3830
3831 EOM
3832 fn=d~
3833 rp='Installation prefix to use?'
3834 . ./getfile
3835 oldprefix=''
3836 case "$prefix" in
3837 '') ;;
3838 *)
3839         case "$ans" in
3840         "$prefix") ;;
3841         *) oldprefix="$prefix";;
3842         esac
3843         ;;
3844 esac
3845 prefix="$ans"
3846 prefixexp="$ansexp"
3847
3848 case "$afsroot" in
3849 '')     afsroot=/afs ;;
3850 *)      afsroot=$afsroot ;;
3851 esac
3852
3853 : is AFS running?
3854 echo " "
3855 case "$afs" in
3856 $define|true)   afs=true ;;
3857 $undef|false)   afs=false ;;
3858 *)      if test -d $afsroot; then
3859                 afs=true
3860         else
3861                 afs=false
3862         fi
3863         ;;
3864 esac
3865 if $afs; then
3866         echo "AFS may be running... I'll be extra cautious then..." >&4
3867 else
3868         echo "AFS does not seem to be running..." >&4
3869 fi
3870
3871 : determine installation prefix for where package is to be installed.
3872 if $afs; then 
3873 $cat <<EOM
3874
3875 Since you are running AFS, I need to distinguish the directory in which
3876 files will reside from the directory in which they are installed (and from
3877 which they are presumably copied to the former directory by occult means).
3878
3879 EOM
3880         case "$installprefix" in
3881         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3882         *) dflt="$installprefix";;
3883         esac
3884 else
3885 $cat <<EOM
3886
3887 In some special cases, particularly when building $package for distribution,
3888 it is convenient to distinguish the directory in which files should be
3889 installed from the directory ($prefix) in which they will
3890 eventually reside.  For most users, these two directories are the same.
3891
3892 EOM
3893         case "$installprefix" in
3894         '') dflt=$prefix ;;
3895         *) dflt=$installprefix;;
3896         esac
3897 fi
3898 fn=d~
3899 rp='What installation prefix should I use for installing files?'
3900 . ./getfile
3901 installprefix="$ans"
3902 installprefixexp="$ansexp"
3903
3904 : Perform the prefixexp/installprefixexp correction if necessary
3905 cat <<EOS >installprefix
3906 $startsh
3907 EOS
3908 cat <<'EOSC' >>installprefix
3909 : Change installation prefix, if necessary.
3910 if $test X"$prefix" != X"$installprefix"; then
3911     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3912 else
3913     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3914 fi
3915 EOSC
3916 chmod +x installprefix
3917 $eunicefix installprefix
3918
3919 : Set variables such as privlib and privlibexp from the output of ./getfile
3920 : performing the prefixexp/installprefixexp correction if necessary.
3921 cat <<EOS >setprefixvar
3922 $startsh
3923 EOS
3924 cat <<'EOSC' >>setprefixvar
3925 eval "${prefixvar}=\"\$ans\""
3926 eval "${prefixvar}exp=\"\$ansexp\""
3927 . ./installprefix
3928 EOSC
3929 chmod +x setprefixvar
3930 $eunicefix setprefixvar
3931
3932 : set up the script used to warn in case of inconsistency
3933 cat <<EOS >whoa
3934 $startsh
3935 EOS
3936 cat <<'EOSC' >>whoa
3937 dflt=y
3938 echo " "
3939 echo "*** WHOA THERE!!! ***" >&4
3940 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3941 rp="    Keep the $hint value?"
3942 . ./myread
3943 case "$ans" in
3944 y) td=$was; tu=$was;;
3945 esac
3946 EOSC
3947
3948 : function used to set $1 to $val
3949 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3950 case "$val$was" in
3951 $define$undef) . ./whoa; eval "$var=\$td";;
3952 $undef$define) . ./whoa; eval "$var=\$tu";;
3953 *) eval "$var=$val";;
3954 esac'
3955
3956 case "$usesocks" in
3957 $define|true|[yY]*)     dflt='y';;
3958 *) dflt='n';;
3959 esac
3960 cat <<EOM
3961
3962 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3963 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3964 to use the PerlIO abstraction layer, this will be implicitly selected.
3965
3966 If this doesn't make any sense to you, just accept the default '$dflt'.
3967 EOM
3968 rp='Build Perl for SOCKS?'
3969 . ./myread
3970 case "$ans" in
3971 y|Y)    val="$define" ;;     
3972 *)      val="$undef" ;;
3973 esac
3974 set usesocks
3975 eval $setvar
3976
3977 case "$usesocks" in
3978 $define|true|[yY]*) useperlio="$define";;
3979 esac
3980
3981 case "$useperlio" in
3982 $define|true|[yY]*|'')  dflt='y';;
3983 *) dflt='n';;
3984 esac
3985 cat <<EOM
3986
3987 Previous version of $package used the standard IO mechanisms as
3988 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3989 alternate IO mechanisms via the PerlIO abstraction layer, but the
3990 stdio mechanism is still available if needed.  The abstraction layer
3991 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3992 Using PerlIO with sfio may cause problems with some extension modules.
3993
3994 If this doesn't make any sense to you, just accept the default '$dflt'.
3995 EOM
3996 rp='Use the PerlIO abstraction layer?'
3997 . ./myread
3998 case "$ans" in
3999 y|Y) 
4000         val="$define"
4001         ;;
4002 *)      
4003         echo "Ok, doing things the stdio way."
4004         val="$undef"
4005         ;;
4006 esac
4007 set useperlio
4008 eval $setvar 
4009
4010 case "$usesocks" in
4011 $define|true|[yY]*)
4012         case "$useperlio" in
4013         $define|true|[yY]*) ;;
4014         *)      cat >&4 <<EOM
4015
4016 You are using the SOCKS proxy protocol library which means that you
4017 should also use the PerlIO layer.  You may be headed for trouble.
4018
4019 EOM
4020                 ;;
4021         esac
4022         ;;
4023 esac
4024
4025         
4026 case "$usethreads" in
4027 $define|true|[yY]*)     dflt='y';;
4028 *)     # Catch case where user specified ithreads or 5005threads but
4029        # forgot -Dusethreads (A.D. 4/2002)
4030        case "$useithreads$use5005threads" in
4031        *$define*)      
4032                 case "$useperlio" in
4033                 "$define")      dflt='y' ;;
4034                 *)              dflt='n' ;;
4035                 esac
4036                 ;;
4037        *)       dflt='n';;
4038        esac
4039        ;;
4040 esac
4041 cat <<EOM
4042
4043 Perl can be built to take advantage of threads on some systems.
4044 To do so, Configure can be run with -Dusethreads.
4045
4046 Note that Perl built with threading support runs slightly slower
4047 and uses more memory than plain Perl. The current implementation
4048 is believed to be stable, but it is fairly new, and so should be
4049 treated with caution.
4050
4051 If this doesn't make any sense to you, just accept the default '$dflt'.
4052 EOM
4053 rp='Build a threading Perl?'
4054 . ./myread
4055 case "$ans" in
4056 y|Y)    val="$define" ;;
4057 *)      val="$undef" ;;
4058 esac
4059 set usethreads
4060 eval $setvar
4061
4062 case "$usethreads" in
4063 $define)
4064         $cat <<EOM
4065
4066 Since release 5.6, Perl has had two different threading implementations,
4067 the newer interpreter-based version (ithreads) with one interpreter per
4068 thread, and the older 5.005 version (5005threads).
4069 The 5005threads version is effectively unmaintained and will probably be
4070 removed in Perl 5.10, so there should be no need to build a Perl using it
4071 unless needed for backwards compatibility with some existing 5.005threads
4072 code.
4073
4074 EOM
4075         : Default to ithreads unless overridden on command line or with
4076         : old config.sh
4077         dflt='y'
4078         case "$use5005threads" in
4079                 $define|true|[yY]*) dflt='n';;
4080         esac
4081         case "$useithreads" in
4082                 $undef|false|[nN]*) dflt='n';;
4083         esac
4084         rp='Use the newer interpreter-based ithreads?'
4085         . ./myread
4086         case "$ans" in
4087         y|Y)    val="$define" ;;
4088         *)      val="$undef" ;;
4089         esac
4090         set useithreads
4091         eval $setvar
4092         : Now set use5005threads to the opposite value.
4093         case "$useithreads" in
4094         $define) val="$undef" ;;
4095         *) val="$define" ;;
4096         esac
4097         set use5005threads
4098         eval $setvar
4099         ;;
4100 *)
4101         useithreads="$undef"
4102         use5005threads="$undef"
4103         ;;
4104 esac
4105
4106 case "$useithreads$use5005threads" in
4107 "$define$define")
4108         $cat >&4 <<EOM
4109
4110 You cannot have both the ithreads and the 5.005 threads enabled
4111 at the same time.  Disabling the 5.005 threads since they are
4112 much less stable than the ithreads.
4113
4114 EOM
4115         use5005threads="$undef"
4116         ;;
4117 esac
4118
4119 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4120         cat >&4 <<EOF
4121 ***
4122 *** To build with ithreads you must also use the PerlIO layer.
4123 *** Cannot continue, aborting.
4124 ***
4125 EOF
4126         exit 1
4127 fi
4128
4129 case "$d_oldpthreads" in
4130 '')     : Configure tests would be welcome here.  For now, assume undef.
4131         val="$undef" ;;
4132 *)      val="$d_oldpthreads" ;;
4133 esac
4134 set d_oldpthreads
4135 eval $setvar
4136
4137
4138 : Look for a hint-file generated 'call-back-unit'.  If the
4139 : user has specified that a threading perl is to be built,
4140 : we may need to set or change some other defaults.
4141 if $test -f usethreads.cbu; then
4142     echo "Your platform has some specific hints regarding threaded builds, using them..."
4143     . ./usethreads.cbu
4144 else
4145     case "$usethreads" in
4146         "$define"|true|[yY]*)
4147                 $cat <<EOM
4148 (Your platform does not have any specific hints for threaded builds.
4149  Assuming POSIX threads, then.)
4150 EOM
4151         ;;
4152     esac
4153 fi
4154
4155 cat <<EOM
4156
4157 Perl can be built so that multiple Perl interpreters can coexist
4158 within the same Perl executable.
4159 EOM
4160
4161 case "$useithreads" in
4162 $define)
4163         cat <<EOM
4164 This multiple interpreter support is required for interpreter-based threads.
4165 EOM
4166         val="$define"
4167         ;;
4168 *)      case "$usemultiplicity" in
4169         $define|true|[yY]*)     dflt='y';;
4170         *) dflt='n';;
4171         esac
4172         echo " "
4173         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4174         rp='Build Perl for multiplicity?'
4175         . ./myread
4176         case "$ans" in
4177         y|Y)    val="$define" ;;
4178         *)      val="$undef" ;;
4179         esac
4180         ;;
4181 esac
4182 set usemultiplicity
4183 eval $setvar
4184
4185
4186 case "$usemorebits" in
4187 "$define"|true|[yY]*)
4188         use64bitint="$define"
4189         uselongdouble="$define"
4190         usemorebits="$define"
4191         ;;
4192 *)      usemorebits="$undef"
4193         ;;
4194 esac
4195
4196 : make some quick guesses about what we are up against
4197 echo " "
4198 $echo $n "Hmm...  $c"
4199 echo exit 1 >bsd
4200 echo exit 1 >usg
4201 echo exit 1 >v7
4202 echo exit 1 >osf1
4203 echo exit 1 >eunice
4204 echo exit 1 >xenix
4205 echo exit 1 >venix
4206 echo exit 1 >os2
4207 d_bsd="$undef"
4208 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4209 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4210 then
4211         echo "Looks kind of like an OSF/1 system, but we'll see..."
4212         echo exit 0 >osf1
4213 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4214         xxx=`./loc addbib blurfl $pth`
4215         if $test -f $xxx; then
4216         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4217                 echo exit 0 >bsd
4218                 echo exit 0 >usg
4219         else
4220                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4221                         echo "Looks kind of like an extended USG system, but we'll see..."
4222                 else
4223                         echo "Looks kind of like a USG system, but we'll see..."
4224                 fi
4225                 echo exit 0 >usg
4226         fi
4227 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4228         echo "Looks kind of like a BSD system, but we'll see..."
4229         d_bsd="$define"
4230         echo exit 0 >bsd
4231 else
4232         echo "Looks kind of like a Version 7 system, but we'll see..."
4233         echo exit 0 >v7
4234 fi
4235 case "$eunicefix" in
4236 *unixtovms*)
4237         $cat <<'EOI'
4238 There is, however, a strange, musty smell in the air that reminds me of
4239 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4240 EOI
4241         echo exit 0 >eunice
4242         d_eunice="$define"
4243 : it so happens the Eunice I know will not run shell scripts in Unix format
4244         ;;
4245 *)
4246         echo " "
4247         echo "Congratulations.  You aren't running Eunice."
4248         d_eunice="$undef"
4249         ;;
4250 esac
4251 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4252 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4253 : semicolon as a patch separator
4254 case "$p_" in
4255 :) ;;
4256 *)
4257         $cat <<'EOI'
4258 I have the feeling something is not exactly right, however...don't tell me...
4259 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4260 (Or you may be running DOS with DJGPP.)
4261 EOI
4262         echo exit 0 >os2
4263         ;;
4264 esac
4265 if test -f /xenix; then
4266         echo "Actually, this looks more like a XENIX system..."
4267         echo exit 0 >xenix
4268         d_xenix="$define"
4269 else
4270         echo " "
4271         echo "It's not Xenix..."
4272         d_xenix="$undef"
4273 fi
4274 chmod +x xenix
4275 $eunicefix xenix
4276 if test -f /venix; then
4277         echo "Actually, this looks more like a VENIX system..."
4278         echo exit 0 >venix
4279 else
4280         echo " "
4281         if ./xenix; then
4282                 : null
4283         else
4284                 echo "Nor is it Venix..."
4285         fi
4286 fi
4287 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4288 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4289 $rm -f foo
4290
4291 case "$cc" in
4292 '') dflt=cc;;
4293 *) dflt="$cc";;
4294 esac
4295 rp="Use which C compiler?"
4296 . ./myread
4297 cc="$ans"
4298
4299 : See if they have not cc but they do have gcc
4300 . ./trygcc
4301 : Look for a hint-file generated 'call-back-unit'.  Now that the
4302 : user has specified the compiler, we may need to set or change some
4303 : other defaults.
4304 if $test -f cc.cbu; then
4305     . ./cc.cbu
4306 fi
4307 . ./checkcc
4308
4309 echo " "
4310 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4311 $cat >try.c <<EOM
4312 #include <stdio.h>
4313 int main() {
4314 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4315 #ifdef __VERSION__
4316         printf("%s\n", __VERSION__);
4317 #else
4318         printf("%s\n", "1");
4319 #endif
4320 #endif
4321         return(0);
4322 }
4323 EOM
4324 if $cc -o try $ccflags $ldflags try.c; then
4325         gccversion=`$run ./try`
4326         case "$gccversion" in
4327         '') echo "You are not using GNU cc." ;;
4328         *)  echo "You are using GNU cc $gccversion."
4329             ccname=gcc
4330             ;;
4331         esac
4332 else
4333         echo " "
4334         echo "*** WHOA THERE!!! ***" >&4
4335         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4336         case "$knowitall" in
4337         '')
4338         echo "    You'd better start hunting for one and let me know about it." >&4
4339                 exit 1
4340                 ;;
4341         esac
4342 fi
4343 $rm -f try try.*
4344 case "$gccversion" in
4345 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4346 esac
4347 case "$gccversion" in
4348 '') gccosandvers='' ;;
4349 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4350    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4351    gccshortvers=''
4352    case "$gccosandvers" in
4353    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4354    $osname$osvers) ;; # looking good
4355    $osname*) cat <<EOM >&4
4356
4357 *** WHOA THERE!!! ***
4358
4359     Your gcc has not been compiled for the exact release of
4360     your operating system ($gccosandvers versus $osname$osvers).
4361
4362     In general it is a good idea to keep gcc synchronized with
4363     the operating system because otherwise serious problems
4364     may ensue when trying to compile software, like Perl.
4365
4366     I'm trying to be optimistic here, though, and will continue.
4367     If later during the configuration and build icky compilation
4368     problems appear (headerfile conflicts being the most common
4369     manifestation), I suggest reinstalling the gcc to match
4370     your operating system release.
4371
4372 EOM
4373       ;;
4374    *) gccosandvers='' ;; # failed to parse, better be silent
4375    esac
4376    ;;
4377 esac
4378 case "$ccname" in
4379 '') ccname="$cc" ;;
4380 esac
4381
4382 # gcc 3.* complain about adding -Idirectories that they already know about,
4383 # so we will take those off from locincpth.
4384 case "$gccversion" in
4385 3*)
4386     echo "main(){}">try.c
4387     for incdir in $locincpth; do
4388        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4389              grep '^c[cp]p*[01]: warning: changing search order '`
4390        if test "X$warn" != X; then
4391            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4392        fi
4393     done
4394     $rm -f try try.*
4395 esac
4396
4397 : What should the include directory be ?
4398 echo " "
4399 $echo $n "Hmm...  $c"
4400 dflt='/usr/include'
4401 incpath=''
4402 mips_type=''
4403 if $test -f /bin/mips && /bin/mips; then
4404         echo "Looks like a MIPS system..."
4405         $cat >usr.c <<'EOCP'
4406 #ifdef SYSTYPE_BSD43
4407 /bsd43
4408 #endif
4409 EOCP
4410         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4411                 dflt='/bsd43/usr/include'
4412                 incpath='/bsd43'
4413                 mips_type='BSD 4.3'
4414         else
4415                 mips_type='System V'
4416         fi
4417         $rm -f usr.c usr.out
4418         echo "and you're compiling with the $mips_type compiler and libraries."
4419         xxx_prompt=y
4420         echo "exit 0" >mips
4421 else
4422         echo "Doesn't look like a MIPS system."
4423         xxx_prompt=n
4424         echo "exit 1" >mips
4425 fi
4426 chmod +x mips
4427 $eunicefix mips
4428 case "$usrinc" in
4429 '') ;;
4430 *) dflt="$usrinc";;
4431 esac
4432 case "$xxx_prompt" in
4433 y)      fn=d/
4434         echo " "
4435         rp='Where are the include files you want to use?'
4436         . ./getfile
4437         usrinc="$ans"
4438         ;;
4439 *)      usrinc="$dflt"
4440         ;;
4441 esac
4442
4443 : see how we invoke the C preprocessor
4444 echo " "
4445 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4446 cat <<'EOT' >testcpp.c
4447 #define ABC abc
4448 #define XYZ xyz
4449 ABC.XYZ
4450 EOT
4451 cd ..
4452 if test ! -f cppstdin; then
4453         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4454                 # AIX cc -E doesn't show the absolute headerfile
4455                 # locations but we'll cheat by using the -M flag.
4456                 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
4457         else
4458                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4459         fi
4460 else
4461         echo "Keeping your $hint cppstdin wrapper."
4462 fi
4463 chmod 755 cppstdin
4464 wrapper=`pwd`/cppstdin
4465 ok='false'
4466 cd UU
4467
4468 if $test "X$cppstdin" != "X" && \
4469         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4470         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4471 then
4472         echo "You used to use $cppstdin $cppminus so we'll use that again."
4473         case "$cpprun" in
4474         '') echo "But let's see if we can live without a wrapper..." ;;
4475         *)
4476                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4477                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4478                 then
4479                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4480                         ok='true'
4481                 else
4482                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4483                 fi
4484                 ;;
4485         esac
4486 else
4487         case "$cppstdin" in
4488         '') ;;
4489         *)
4490                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4491                 ;;
4492         esac
4493 fi
4494
4495 if $ok; then
4496         : nothing
4497 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4498         $cc -E <testcpp.c >testcpp.out 2>&1; \
4499         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4500         echo "Yup, it does."
4501         x_cpp="$cc -E"
4502         x_minus='';
4503 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4504         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4505         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4506         echo "Yup, it does."
4507         x_cpp="$cc -E"
4508         x_minus='-';
4509 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4510         $cc -P <testcpp.c >testcpp.out 2>&1; \
4511         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4512         echo "Yipee, that works!"
4513         x_cpp="$cc -P"
4514         x_minus='';
4515 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4516         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4517         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4518         echo "At long last!"
4519         x_cpp="$cc -P"
4520         x_minus='-';
4521 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4522         $cpp <testcpp.c >testcpp.out 2>&1; \
4523         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4524         echo "It works!"
4525         x_cpp="$cpp"
4526         x_minus='';
4527 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4528         $cpp - <testcpp.c >testcpp.out 2>&1; \
4529         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4530         echo "Hooray, it works!  I was beginning to wonder."
4531         x_cpp="$cpp"
4532         x_minus='-';
4533 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4534         $wrapper <testcpp.c >testcpp.out 2>&1; \
4535         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4536         x_cpp="$wrapper"
4537         x_minus=''
4538         echo "Eureka!"
4539 else
4540         dflt=''
4541         rp="No dice.  I can't find a C preprocessor.  Name one:"
4542         . ./myread
4543         x_cpp="$ans"
4544         x_minus=''
4545         $x_cpp <testcpp.c >testcpp.out 2>&1
4546         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4547                 echo "OK, that will do." >&4
4548         else
4549 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4550                 exit 1
4551         fi
4552 fi
4553
4554 case "$ok" in
4555 false)
4556         cppstdin="$x_cpp"
4557         cppminus="$x_minus"
4558         cpprun="$x_cpp"
4559         cpplast="$x_minus"
4560         set X $x_cpp
4561         shift
4562         case "$1" in
4563         "$cpp")
4564                 echo "Perhaps can we force $cc -E using a wrapper..."
4565                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4566                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4567                 then
4568                         echo "Yup, we can."
4569                         cppstdin="$wrapper"
4570                         cppminus='';
4571                 else
4572                         echo "Nope, we'll have to live without it..."
4573                 fi
4574                 ;;
4575         esac
4576         case "$cpprun" in
4577         "$wrapper")
4578                 cpprun=''
4579                 cpplast=''
4580                 ;;
4581         esac
4582         ;;
4583 esac
4584
4585 case "$cppstdin" in
4586 "$wrapper"|'cppstdin') ;;
4587 *) $rm -f $wrapper;;
4588 esac
4589 $rm -f testcpp.c testcpp.out
4590
4591 : Set private lib path
4592 case "$plibpth" in
4593 '') if ./mips; then
4594                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4595         fi;;
4596 esac
4597 case "$libpth" in
4598 ' ') dlist='';;
4599 '') dlist="$loclibpth $plibpth $glibpth";;
4600 *) dlist="$libpth";;
4601 esac
4602
4603 : Now check and see which directories actually exist, avoiding duplicates
4604 libpth=''
4605 for xxx in $dlist
4606 do
4607     if $test -d $xxx; then
4608                 case " $libpth " in
4609                 *" $xxx "*) ;;
4610                 *) libpth="$libpth $xxx";;
4611                 esac
4612     fi
4613 done
4614 $cat <<'EOM'
4615
4616 Some systems have incompatible or broken versions of libraries.  Among
4617 the directories listed in the question below, please remove any you
4618 know not to be holding relevant libraries, and add any that are needed.
4619 Say "none" for none.
4620
4621 EOM
4622 case "$libpth" in
4623 '') dflt='none';;
4624 *)
4625         set X $libpth
4626         shift
4627         dflt=${1+"$@"}
4628         ;;
4629 esac
4630 rp="Directories to use for library searches?"
4631 . ./myread
4632 case "$ans" in
4633 none) libpth=' ';;
4634 *) libpth="$ans";;
4635 esac
4636
4637 : compute shared library extension
4638 case "$so" in
4639 '')
4640         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4641                 dflt='sl'
4642         else
4643                 dflt='so'
4644         fi
4645         ;;
4646 *) dflt="$so";;
4647 esac
4648 $cat <<EOM
4649
4650 On some systems, shared libraries may be available.  Answer 'none' if
4651 you want to suppress searching of shared libraries for the remainder
4652 of this configuration.
4653
4654 EOM
4655 rp='What is the file extension used for shared libraries?'
4656 . ./myread
4657 so="$ans"
4658
4659 : Define several unixisms.
4660 : Hints files or command line option can be used to override them.
4661 : The convoluted testing is in case hints files set either the old
4662 : or the new name.
4663 case "$_exe" in
4664 '')     case "$exe_ext" in
4665         '')     ;;
4666         *)      _exe="$exe_ext" ;;
4667         esac
4668         ;;
4669 esac
4670 case "$_a" in
4671 '')     case "$lib_ext" in
4672     '') _a='.a';;
4673         *)      _a="$lib_ext" ;;
4674         esac
4675         ;;
4676 esac
4677 case "$_o" in
4678 '') case "$obj_ext" in
4679         '')     _o='.o';;
4680         *)      _o="$obj_ext";;
4681         esac
4682         ;;
4683 esac
4684 case "$p_" in
4685 '') case "$path_sep" in
4686         '')     p_=':';;
4687         *)      p_="$path_sep";;
4688         esac
4689         ;;
4690 esac
4691 exe_ext=$_exe
4692 lib_ext=$_a
4693 obj_ext=$_o
4694 path_sep=$p_
4695
4696 : Which makefile gets called first.  This is used by make depend.
4697 case "$firstmakefile" in
4698 '') firstmakefile='makefile';;
4699 esac
4700
4701 case "$ccflags" in
4702 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4703 esac
4704
4705 case "$uselongdouble" in
4706 $define|true|[yY]*)     dflt='y';;
4707 *) dflt='n';;
4708 esac
4709 cat <<EOM
4710
4711 Perl can be built to take advantage of long doubles which
4712 (if available) may give more accuracy and range for floating point numbers.
4713
4714 If this doesn't make any sense to you, just accept the default '$dflt'.
4715 EOM
4716 rp='Try to use long doubles if available?'
4717 . ./myread
4718 case "$ans" in
4719 y|Y)    val="$define"   ;;
4720 *)      val="$undef"    ;;
4721 esac
4722 set uselongdouble
4723 eval $setvar
4724
4725 case "$uselongdouble" in
4726 true|[yY]*) uselongdouble="$define" ;;
4727 esac
4728
4729 : Look for a hint-file generated 'call-back-unit'.  If the
4730 : user has specified that long doubles should be used,
4731 : we may need to set or change some other defaults.
4732 if $test -f uselongdouble.cbu; then
4733     echo "Your platform has some specific hints regarding long doubles, using them..."
4734     . ./uselongdouble.cbu
4735 else
4736     case "$uselongdouble" in
4737         $define)
4738                 $cat <<EOM
4739 (Your platform does not have any specific hints for long doubles.)
4740 EOM
4741         ;;
4742     esac
4743 fi
4744
4745 : Looking for optional libraries
4746 echo " "
4747 echo "Checking for optional libraries..." >&4
4748 case "$libs" in
4749 ' '|'') dflt='';;
4750 *) dflt="$libs";;
4751 esac
4752 case "$libswanted" in
4753 '') libswanted='c_s';;
4754 esac
4755 case "$usesocks" in
4756 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4757 esac
4758 libsfound=''
4759 libsfiles=''
4760 libsdirs=''
4761 libspath=''
4762 for thisdir in $libpth $xlibpth; do
4763   test -d $thisdir && libspath="$libspath $thisdir"
4764 done
4765 for thislib in $libswanted; do
4766         for thisdir in $libspath; do
4767             xxx=''
4768             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4769                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4770                 $test -f "$xxx" && eval $libscheck
4771                 $test -f "$xxx" && libstyle=shared
4772             fi
4773             if test ! -f "$xxx"; then
4774                 xxx=$thisdir/lib$thislib.$so
4775                 $test -f "$xxx" && eval $libscheck
4776                 $test -f "$xxx" && libstyle=shared
4777             fi  
4778             if test ! -f "$xxx"; then
4779                 xxx=$thisdir/lib$thislib$_a
4780                 $test -f "$xxx" && eval $libscheck
4781                 $test -f "$xxx" && libstyle=static
4782             fi
4783             if test ! -f "$xxx"; then
4784                 xxx=$thisdir/$thislib$_a
4785                 $test -f "$xxx" && eval $libscheck
4786                 $test -f "$xxx" && libstyle=static
4787             fi
4788             if test ! -f "$xxx"; then
4789                 xxx=$thisdir/lib${thislib}_s$_a
4790                 $test -f "$xxx" && eval $libscheck
4791                 $test -f "$xxx" && libstyle=static
4792                 $test -f "$xxx" && thislib=${thislib}_s
4793             fi
4794             if test ! -f "$xxx"; then
4795                 xxx=$thisdir/Slib$thislib$_a
4796                 $test -f "$xxx" && eval $libscheck
4797                 $test -f "$xxx" && libstyle=static
4798             fi
4799             if $test -f "$xxx"; then
4800                 case "$libstyle" in
4801                 shared) echo "Found -l$thislib (shared)." ;;
4802                 static) echo "Found -l$thislib." ;;
4803                 *)      echo "Found -l$thislib ($libstyle)." ;;
4804                 esac
4805                 case " $dflt " in
4806                 *"-l$thislib "*);;
4807                 *) dflt="$dflt -l$thislib"
4808                    libsfound="$libsfound $xxx"
4809                    yyy=`basename $xxx`
4810                    libsfiles="$libsfiles $yyy"
4811                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4812                    case " $libsdirs " in
4813                    *" $yyy "*) ;;
4814                    *) libsdirs="$libsdirs $yyy" ;;
4815                    esac
4816                    ;;
4817                 esac
4818                 break
4819             fi  
4820         done
4821         if $test ! -f "$xxx"; then
4822             echo "No -l$thislib."
4823         fi
4824 done
4825 set X $dflt
4826 shift
4827 dflt="$*"
4828 case "$libs" in
4829 '') dflt="$dflt";;
4830 *) dflt="$libs";;
4831 esac
4832 case "$dflt" in
4833 ' '|'') dflt='none';;
4834 esac
4835
4836 $cat <<EOM
4837
4838 In order to compile $package on your machine, a number of libraries
4839 are usually needed.  Include any other special libraries here as well.
4840 Say "none" for none.  The default list is almost always right.
4841 EOM
4842
4843 echo " "
4844 rp="What libraries to use?"
4845 . ./myread
4846 case "$ans" in
4847 none) libs=' ';;
4848 *) libs="$ans";;
4849 esac
4850
4851 : determine optimization, if desired, or use for debug flag also
4852 case "$optimize" in
4853 ' '|$undef) dflt='none';;
4854 '') dflt='-O';;
4855 *) dflt="$optimize";;
4856 esac
4857 $cat <<EOH
4858
4859 By default, $package compiles with the -O flag to use the optimizer.
4860 Alternately, you might want to use the symbolic debugger, which uses
4861 the -g flag (on traditional Unix systems).  Either flag can be
4862 specified here.  To use neither flag, specify the word "none".
4863
4864 EOH
4865 rp="What optimizer/debugger flag should be used?"
4866 . ./myread
4867 optimize="$ans"
4868 case "$optimize" in
4869 'none') optimize=" ";;
4870 esac
4871
4872 : Check what DEBUGGING is required from the command line
4873 : -DEBUGGING      or -DDEBUGGING or
4874 : -DEBUGGING=both                       = -g + -DDEBUGGING
4875 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4876 : -DEBUGGING=none or -UDEBUGGING        =
4877 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4878 case "$EBUGGING" in
4879 '')     ;;
4880 *)      DEBUGGING=$EBUGGING ;;
4881 esac
4882
4883 case "$DEBUGGING" in
4884 -g|$define)
4885     case "$optimize" in
4886         *-g*) ;;
4887         *)    optimize="$optimize -g" ;;
4888     esac ;;
4889 none|$undef)
4890     case "$optimize" in
4891         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4892                 shift
4893                 optimize="$*"
4894                 ;;
4895     esac ;;
4896 esac
4897
4898 dflt=''
4899 case "$DEBUGGING" in
4900 both|$define) dflt='-DDEBUGGING'
4901 esac
4902
4903 : We will not override a previous value, but we might want to
4904 : augment a hint file
4905 case "$hint" in
4906 default|recommended)
4907         case "$gccversion" in
4908         1*) dflt="$dflt -fpcc-struct-return" ;;
4909         esac
4910         case "$optimize:$DEBUGGING" in
4911         *-g*:old) dflt="$dflt -DDEBUGGING";;
4912         esac
4913         case "$gccversion" in
4914         2*) if test -d /etc/conf/kconfig.d &&
4915                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4916                 then
4917                         # Interactive Systems (ISC) POSIX mode.
4918                         dflt="$dflt -posix"
4919                 fi
4920                 ;;
4921         esac
4922         case "$gccversion" in
4923         1*) ;;
4924         2.[0-8]*) ;;
4925         ?*)     echo " "
4926                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4927                 echo 'int main(void) { return 0; }' > gcctest.c
4928                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4929                         echo "Yes, it does." 2>&1
4930                         case "$ccflags" in
4931                         *strict-aliasing*)
4932                                 echo "Leaving current flags $ccflags alone." 2>&1
4933                                 ;;
4934                         *) dflt="$dflt -fno-strict-aliasing" ;;
4935                         esac
4936                 else
4937                         echo "Nope, it doesn't, but that's ok." 2>&1
4938                 fi
4939                 ;;
4940         esac
4941         # For gcc, adding -pipe speeds up compilations for some, but apparently
4942         # some assemblers can't read from stdin.  (It also slows down compilations
4943         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4944         case "$gccversion" in
4945         ?*)     echo " "
4946                 echo "Checking if your compiler accepts -pipe" 2>&1
4947                 echo 'int main(void) { return 0; }' > gcctest.c
4948                 if $cc -pipe -o gcctest gcctest.c; then
4949                         echo "Yes, it does." 2>&1
4950                         case "$ccflags" in
4951                         *-pipe*)
4952                                 echo "Leaving current flags $ccflags alone." 2>&1
4953                                 ;;
4954                         *) dflt="$dflt -pipe" ;;
4955                         esac
4956                 else
4957                         echo "Nope, it doesn't, but that's ok." 2>&1
4958                 fi
4959                 ;;
4960         esac
4961         ;;
4962 esac
4963
4964 case "$mips_type" in
4965 *BSD*|'') inclwanted="$locincpth $usrinc";;
4966 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4967 esac
4968 for thisincl in $inclwanted; do
4969         if $test -d $thisincl; then
4970                 if $test x$thisincl != x$usrinc; then
4971                         case "$dflt" in
4972                         *" -I$thisincl "*);;
4973                         *) dflt="$dflt -I$thisincl ";;
4974                         esac
4975                 fi
4976         fi
4977 done
4978
4979 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4980         xxx=true;
4981 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4982         xxx=true;
4983 else
4984         xxx=false;
4985 fi;
4986 if $xxx; then
4987         case "$dflt" in
4988         *$2*);;
4989         *) dflt="$dflt -D$2";;
4990         esac;
4991 fi'
4992
4993 set signal.h LANGUAGE_C; eval $inctest
4994
4995 case "$usesocks" in
4996 $define)
4997         ccflags="$ccflags -DSOCKS"
4998         ;;
4999 esac
5000
5001 case "$hint" in
5002 default|recommended) dflt="$ccflags $dflt" ;;
5003 *) dflt="$ccflags";;
5004 esac
5005
5006 case "$dflt" in
5007 ''|' ') dflt=none;;
5008 esac
5009
5010 $cat <<EOH
5011
5012 Your C compiler may want other flags.  For this question you should include
5013 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5014 but you should NOT include libraries or ld flags like -lwhatever.  If you
5015 want $package to honor its debug switch, you should include -DDEBUGGING here.
5016 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5017
5018 To use no flags, specify the word "none".
5019
5020 EOH
5021 set X $dflt
5022 shift
5023 dflt=${1+"$@"}
5024 rp="Any additional cc flags?"
5025 . ./myread
5026 case "$ans" in
5027 none) ccflags='';;
5028 *) ccflags="$ans";;
5029 esac
5030
5031 : the following weeds options from ccflags that are of no interest to cpp
5032 case "$cppflags" in
5033 '') cppflags="$ccflags" ;;
5034 *)  cppflags="$cppflags $ccflags" ;;
5035 esac
5036 case "$gccversion" in
5037 1*) cppflags="$cppflags -D__GNUC__"
5038 esac
5039 case "$mips_type" in
5040 '');;
5041 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5042 esac
5043 case "$cppflags" in
5044 '');;
5045 *)
5046         echo " "
5047         echo "Let me guess what the preprocessor flags are..." >&4
5048         set X $cppflags
5049         shift
5050         cppflags=''
5051         $cat >cpp.c <<'EOM'
5052 #define BLURFL foo
5053
5054 BLURFL xx LFRULB
5055 EOM
5056         previous=''
5057         for flag in $*
5058         do
5059                 case "$flag" in
5060                 -*) ftry="$flag";;
5061                 *) ftry="$previous $flag";;
5062                 esac
5063                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5064                         >cpp1.out 2>/dev/null && \
5065                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5066                         >cpp2.out 2>/dev/null && \
5067                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5068                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5069                 then
5070                         cppflags="$cppflags $ftry"
5071                         previous=''
5072                 else
5073                         previous="$flag"
5074                 fi
5075         done
5076         set X $cppflags
5077         shift
5078         cppflags=${1+"$@"}
5079         case "$cppflags" in
5080         *-*)  echo "They appear to be: $cppflags";;
5081         esac
5082         $rm -f cpp.c cpp?.out
5083         ;;
5084 esac
5085
5086 : flags used in final linking phase
5087 case "$ldflags" in
5088 '') if ./venix; then
5089                 dflt='-i -z'
5090         else
5091                 dflt=''
5092         fi
5093         case "$ccflags" in
5094         *-posix*) dflt="$dflt -posix" ;;
5095         esac
5096         ;;
5097 *) dflt="$ldflags";;
5098 esac
5099
5100 : Try to guess additional flags to pick up local libraries.
5101 for thislibdir in $libpth; do
5102         case " $loclibpth " in
5103         *" $thislibdir "*)
5104                 case "$dflt " in
5105                 *"-L$thislibdir "*) ;;
5106                 *)  dflt="$dflt -L$thislibdir" ;;
5107                 esac
5108                 ;;
5109         esac
5110 done
5111
5112 case "$dflt" in
5113 '') dflt='none' ;;
5114 esac
5115
5116 $cat <<EOH
5117
5118 Your C linker may need flags.  For this question you should
5119 include -L/whatever and any other flags used by the C linker, but you
5120 should NOT include libraries like -lwhatever.
5121
5122 Make sure you include the appropriate -L/path flags if your C linker
5123 does not normally search all of the directories you specified above,
5124 namely
5125         $libpth
5126 To use no flags, specify the word "none".
5127
5128 EOH
5129
5130 rp="Any additional ld flags (NOT including libraries)?"
5131 . ./myread
5132 case "$ans" in
5133 none) ldflags='';;
5134 *) ldflags="$ans";;
5135 esac
5136 rmlist="$rmlist pdp11"
5137
5138 : coherency check
5139 echo " "
5140 echo "Checking your choice of C compiler and flags for coherency..." >&4
5141 $cat > try.c <<'EOF'
5142 #include <stdio.h>
5143 int main() { printf("Ok\n"); return(0); }
5144 EOF
5145 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5146 shift
5147 $cat >try.msg <<'EOM'
5148 I've tried to compile and run the following simple program:
5149
5150 EOM
5151 $cat try.c >> try.msg
5152
5153 $cat >> try.msg <<EOM
5154
5155 I used the command:
5156
5157         $*
5158         $run ./try
5159
5160 and I got the following output:
5161
5162 EOM
5163 dflt=y
5164 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5165         if $sh -c "$run ./try" >>try.msg 2>&1; then
5166                 xxx=`$run ./try`
5167                 case "$xxx" in
5168                 "Ok") dflt=n ;;
5169                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5170                         case " $libs " in
5171                         *" -lsfio "*)
5172                                 cat >> try.msg <<'EOQS'
5173 If $libs contains -lsfio, and sfio is mis-configured, then it
5174 sometimes (apparently) runs and exits with a 0 status, but with no
5175 output!  It may have to do with sfio's use of _exit vs. exit.
5176
5177 EOQS
5178                                 rp="You have a big problem.  Shall I abort Configure"
5179                                 dflt=y
5180                                 ;;
5181                         esac
5182                         ;;
5183                 esac
5184         else
5185                 echo "The program compiled OK, but exited with status $?." >>try.msg
5186                 rp="You have a problem.  Shall I abort Configure"
5187                 dflt=y
5188         fi
5189 else
5190         echo "I can't compile the test program." >>try.msg
5191         rp="You have a BIG problem.  Shall I abort Configure"
5192         dflt=y
5193 fi
5194 case "$dflt" in
5195 y)
5196         $cat try.msg >&4
5197         case "$knowitall" in
5198         '')
5199                 echo "(The supplied flags or libraries might be incorrect.)"
5200                 ;;
5201         *) dflt=n;;
5202         esac
5203         echo " "
5204         . ./myread
5205         case "$ans" in
5206         n*|N*) ;;
5207         *)      echo "Ok.  Stopping Configure." >&4
5208                 exit 1
5209                 ;;
5210         esac
5211         ;;
5212 n) echo "OK, that should do.";;
5213 esac
5214 $rm -f try try.* core
5215
5216 : define a shorthand compile call
5217 compile='
5218 mc_file=$1;
5219 shift;
5220 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5221 : define a shorthand compile call for compilations that should be ok.
5222 compile_ok='
5223 mc_file=$1;
5224 shift;
5225 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5226
5227 : determine filename position in cpp output
5228 echo " "
5229 echo "Computing filename position in cpp output for #include directives..." >&4
5230 case "$osname" in
5231 vos) testaccess=-e ;;
5232 *)   testaccess=-r ;;
5233 esac
5234 echo '#include <stdio.h>' > foo.c
5235 $cat >fieldn <<EOF
5236 $startsh
5237 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5238 $grep '^[       ]*#.*stdio\.h' | \
5239 while read cline; do
5240         pos=1
5241         set \$cline
5242         while $test \$# -gt 0; do
5243                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5244                         echo "\$pos"
5245                         exit 0
5246                 fi
5247                 shift
5248                 pos=\`expr \$pos + 1\`
5249         done
5250 done
5251 EOF
5252 chmod +x fieldn
5253 fieldn=`./fieldn`
5254 $rm -f foo.c fieldn
5255 case $fieldn in
5256 '') pos='???';;
5257 1) pos=first;;
5258 2) pos=second;;
5259 3) pos=third;;
5260 *) pos="${fieldn}th";;
5261 esac
5262 echo "Your cpp writes the filename in the $pos field of the line."
5263
5264 case "$osname" in
5265 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5266 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5267 *)   cppfilter='' ;;
5268 esac
5269 : locate header file
5270 $cat >findhdr <<EOF
5271 $startsh
5272 wanted=\$1
5273 name=''
5274 for usrincdir in $usrinc
5275 do
5276         if test -f \$usrincdir/\$wanted; then
5277                 echo "\$usrincdir/\$wanted"
5278                 exit 0
5279         fi
5280 done
5281 awkprg='{ print \$$fieldn }'
5282 echo "#include <\$wanted>" > foo\$\$.c
5283 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5284 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5285 while read cline; do
5286         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5287         case "\$name" in
5288         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5289         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5290         *) exit 2;;
5291         esac;
5292 done;
5293 #
5294 # status = 0: grep returned 0 lines, case statement not executed
5295 # status = 1: headerfile found
5296 # status = 2: while loop executed, no headerfile found
5297 #
5298 status=\$?
5299 $rm -f foo\$\$.c;
5300 if test \$status -eq 1; then
5301         exit 0;
5302 fi
5303 exit 1
5304 EOF
5305 chmod +x findhdr
5306
5307 : define an alternate in-header-list? function
5308 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5309 cont=true; xxf="echo \"<\$1> found.\" >&4";
5310 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5311 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5312 esac;
5313 case $# in 4) instead=instead;; *) instead="at last";; esac;
5314 while $test "$cont"; do
5315         xxx=`./findhdr $1`
5316         var=$2; eval "was=\$$2";
5317         if $test "$xxx" && $test -r "$xxx";
5318         then eval $xxf;
5319         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5320                 cont="";
5321         else eval $xxnf;
5322         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5323         set $yyy; shift; shift; yyy=$@;
5324         case $# in 0) cont="";;
5325         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5326                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5327         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5328                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5329         esac;
5330 done;
5331 while $test "$yyy";
5332 do set $yyy; var=$2; eval "was=\$$2";
5333         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5334         set $yyy; shift; shift; yyy=$@;
5335 done'
5336
5337 : see if stdlib is available
5338 set stdlib.h i_stdlib
5339 eval $inhdr
5340
5341 : check for lengths of integral types
5342 echo " "
5343 case "$intsize" in
5344 '')
5345         echo "Checking to see how big your integers are..." >&4
5346         $cat >try.c <<EOCP
5347 #include <stdio.h>
5348 #$i_stdlib I_STDLIB
5349 #ifdef I_STDLIB
5350 #include <stdlib.h>
5351 #endif
5352 int main()
5353 {
5354         printf("intsize=%d;\n", (int)sizeof(int));
5355         printf("longsize=%d;\n", (int)sizeof(long));
5356         printf("shortsize=%d;\n", (int)sizeof(short));
5357         exit(0);
5358 }
5359 EOCP
5360         set try
5361         if eval $compile_ok && $run ./try > /dev/null; then
5362                 eval `$run ./try`
5363                 echo "Your integers are $intsize bytes long."
5364                 echo "Your long integers are $longsize bytes long."
5365                 echo "Your short integers are $shortsize bytes long."
5366         else
5367                 $cat >&4 <<EOM
5368 !
5369 Help! I can't compile and run the intsize test program: please enlighten me!
5370 (This is probably a misconfiguration in your system or libraries, and
5371 you really ought to fix it.  Still, I'll try anyway.)
5372 !
5373 EOM
5374                 dflt=4
5375                 rp="What is the size of an integer (in bytes)?"
5376                 . ./myread
5377                 intsize="$ans"
5378                 dflt=$intsize
5379                 rp="What is the size of a long integer (in bytes)?"
5380                 . ./myread
5381                 longsize="$ans"
5382                 dflt=2
5383                 rp="What is the size of a short integer (in bytes)?"
5384                 . ./myread
5385                 shortsize="$ans"
5386         fi
5387         ;;
5388 esac
5389 $rm -f try try.*
5390
5391 : check for long long
5392 echo " "
5393 echo "Checking to see if you have long long..." >&4
5394 echo 'int main() { long long x = 7; return 0; }' > try.c
5395 set try
5396 if eval $compile; then
5397         val="$define"
5398         echo "You have long long."
5399 else
5400         val="$undef"
5401         echo "You do not have long long."
5402 fi
5403 $rm try.*
5404 set d_longlong
5405 eval $setvar
5406
5407 : check for length of long long
5408 case "${d_longlong}${longlongsize}" in
5409 $define)
5410         echo " "
5411         echo "Checking to see how big your long longs are..." >&4
5412         $cat >try.c <<'EOCP'
5413 #include <stdio.h>
5414 int main()
5415 {
5416     printf("%d\n", (int)sizeof(long long));
5417     return(0);
5418 }
5419 EOCP
5420         set try
5421         if eval $compile_ok; then
5422                 longlongsize=`$run ./try`
5423                 echo "Your long longs are $longlongsize bytes long."
5424         else
5425                 dflt='8'
5426                 echo " "
5427                 echo "(I can't seem to compile the test program.  Guessing...)"
5428                 rp="What is the size of a long long (in bytes)?"
5429                 . ./myread
5430                 longlongsize="$ans"
5431         fi
5432         if $test "X$longsize" = "X$longlongsize"; then
5433                 echo "(That isn't any different from an ordinary long.)"
5434         fi      
5435         ;;
5436 esac
5437 $rm -f try.* try
5438
5439 : see if inttypes.h is available
5440 : we want a real compile instead of Inhdr because some systems
5441 : have an inttypes.h which includes non-existent headers
5442 echo " "
5443 $cat >try.c <<EOCP
5444 #include <inttypes.h>
5445 int main() {
5446         static int32_t foo32 = 0x12345678;
5447 }
5448 EOCP
5449 set try
5450 if eval $compile; then
5451         echo "<inttypes.h> found." >&4
5452         val="$define"
5453 else
5454         echo "<inttypes.h> NOT found." >&4
5455         val="$undef"
5456 fi
5457 $rm -f try.c try
5458 set i_inttypes
5459 eval $setvar
5460
5461 : check for int64_t
5462 echo " "
5463 echo "Checking to see if you have int64_t..." >&4
5464 $cat >try.c <<EOCP
5465 #include <sys/types.h>
5466 #$i_inttypes I_INTTYPES
5467 #ifdef I_INTTYPES
5468 #include <inttypes.h>
5469 #endif
5470 int main() { int64_t x = 7; }
5471 EOCP
5472 set try
5473 if eval $compile; then
5474         val="$define"
5475         echo "You have int64_t."
5476 else
5477         val="$undef"
5478         echo "You do not have int64_t."
5479 fi
5480 $rm -f try try.*
5481 set d_int64_t
5482 eval $setvar
5483
5484
5485 echo " "
5486 echo "Checking which 64-bit integer type we could use..." >&4
5487
5488 case "$intsize" in
5489 8) val=int
5490    set quadtype
5491    eval $setvar
5492    val='"unsigned int"'
5493    set uquadtype
5494    eval $setvar
5495    quadkind=1
5496    ;;
5497 *) case "$longsize" in
5498    8) val=long
5499       set quadtype
5500       eval $setvar
5501       val='"unsigned long"'
5502       set uquadtype
5503       eval $setvar
5504       quadkind=2
5505       ;;
5506    *) case "$d_longlong:$longlongsize" in
5507       define:8)
5508         val='"long long"'
5509         set quadtype
5510         eval $setvar
5511         val='"unsigned long long"'
5512         set uquadtype
5513         eval $setvar
5514         quadkind=3
5515         ;;
5516       *) case "$d_int64_t" in
5517          define)
5518            val=int64_t
5519            set quadtype
5520            eval $setvar
5521            val=uint64_t
5522            set uquadtype
5523            eval $setvar
5524            quadkind=4
5525            ;;
5526          esac
5527          ;;
5528       esac
5529       ;;
5530    esac
5531    ;;
5532 esac
5533
5534 case "$quadtype" in
5535 '')     echo "Alas, no 64-bit integer types in sight." >&4
5536         d_quad="$undef"
5537         ;;
5538 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5539         d_quad="$define"
5540         ;;
5541 esac
5542
5543
5544 case "$uselonglong" in
5545 "$define"|true|[yY]*)
5546         cat <<EOM >&4
5547
5548 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5549 EOM
5550         use64bitint="$define"
5551         ;;
5552 esac                          
5553 case "$use64bits" in
5554 "$define"|true|[yY]*)
5555         cat <<EOM >&4
5556
5557 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5558 EOM
5559         use64bitint="$define"
5560         ;;
5561 esac                          
5562 case "$use64bitints" in
5563 "$define"|true|[yY]*)
5564         cat <<EOM >&4
5565
5566 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5567 EOM
5568         use64bitint="$define"
5569         ;;
5570 esac                          
5571 case "$use64bitsint" in
5572 "$define"|true|[yY]*)
5573         cat <<EOM >&4
5574
5575 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5576 EOM
5577         use64bitint="$define"
5578         ;;
5579 esac                          
5580 case "$uselonglongs" in
5581 "$define"|true|[yY]*)
5582         cat <<EOM >&4
5583
5584 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5585 EOM
5586         use64bitint="$define"
5587         ;;
5588 esac                          
5589 case "$use64bitsall" in
5590 "$define"|true|[yY]*)
5591         cat <<EOM >&4
5592
5593 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5594 EOM
5595         use64bitall="$define"
5596         ;;
5597 esac                          
5598
5599 case "$ccflags" in
5600 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5601 esac
5602 case "$use64bitall" in
5603 "$define"|true|[yY]*) use64bitint="$define" ;;
5604 esac
5605
5606 case "$longsize" in
5607 8) cat <<EOM
5608
5609 You have natively 64-bit long integers.
5610 EOM
5611    val="$define"
5612    ;;
5613 *) case "$use64bitint" in
5614    "$define"|true|[yY]*) dflt='y';;
5615    *) dflt='n';;
5616    esac
5617    case "$d_quad" in
5618    "$define") ;;
5619    *) dflt='n' ;;
5620    esac
5621    cat <<EOM
5622
5623 Perl can be built to take advantage of 64-bit integer types
5624 on some systems.  To do so, Configure can be run with -Duse64bitint.
5625 Choosing this option will most probably introduce binary incompatibilities.
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 64-bit integers, if available?'
5631    . ./myread
5632    case "$ans" in
5633    [yY]*) val="$define" ;;
5634    *)     val="$undef"  ;;
5635    esac
5636    ;;
5637 esac
5638 set use64bitint
5639 eval $setvar
5640
5641 case "$use64bitall" in
5642 "$define"|true|[yY]*) dflt='y' ;;
5643 *) case "$longsize" in
5644    8) dflt='y' ;;
5645    *) dflt='n' ;;
5646    esac
5647    ;;
5648 esac    
5649 cat <<EOM
5650
5651 You may also choose to try maximal 64-bitness.  It means using as much
5652 64-bitness as possible on the platform.  This in turn means even more
5653 binary incompatibilities.  On the other hand, your platform may not
5654 have any more 64-bitness available than what you already have chosen.
5655
5656 If this doesn't make any sense to you, just accept the default '$dflt'.
5657 (The default has been chosen based on your configuration.)
5658 EOM
5659 rp='Try to use maximal 64-bit support, if available?'
5660 . ./myread
5661 case "$ans" in
5662 [yY]*) val="$define" ;;
5663 *)     val="$undef"  ;;
5664 esac
5665 set use64bitall
5666 eval $setvar
5667 case "$use64bitall" in
5668 "$define")
5669         case "$use64bitint" in
5670         "$undef")
5671                 cat <<EOM
5672
5673 Since you have chosen a maximally 64-bit build, I'm also turning on
5674 the use of 64-bit integers.
5675 EOM
5676                 use64bitint="$define" ;;
5677         esac
5678         ;;
5679 esac
5680
5681 : Look for a hint-file generated 'call-back-unit'.  If the
5682 : user has specified that a 64-bit perl is to be built,
5683 : we may need to set or change some other defaults.
5684 if $test -f use64bitint.cbu; then
5685         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5686         . ./use64bitint.cbu
5687 fi
5688 case "$use64bitint" in
5689 "$define"|true|[yY]*)
5690         case "$longsize" in
5691         4) case "$archname64" in
5692            '') archname64=64int ;;
5693            esac
5694            ;;
5695         esac
5696         ;;
5697 esac
5698
5699 : Look for a hint-file generated 'call-back-unit'.  If the
5700 : user has specified that a maximally 64-bit perl is to be built,
5701 : we may need to set or change some other defaults.
5702 if $test -f use64bitall.cbu; then
5703         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5704         . ./use64bitall.cbu
5705 fi
5706 case "$use64bitall" in
5707 "$define"|true|[yY]*)
5708         case "$longsize" in
5709         4) case "$archname64" in
5710            ''|64int) archname64=64all ;;
5711            esac
5712            ;;
5713         esac
5714         ;;
5715 esac
5716
5717 case "$d_quad:$use64bitint" in
5718 $undef:$define)
5719         cat >&4 <<EOF
5720
5721 *** You have chosen to use 64-bit integers,
5722 *** but none can be found.
5723 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5724 *** Cannot continue, aborting.
5725
5726 EOF
5727         exit 1
5728         ;;
5729 esac
5730
5731 : check for length of double
5732 echo " "
5733 case "$doublesize" in
5734 '')
5735         echo "Checking to see how big your double precision numbers are..." >&4
5736         $cat >try.c <<EOCP
5737 #include <stdio.h>
5738 #$i_stdlib I_STDLIB
5739 #ifdef I_STDLIB
5740 #include <stdlib.h>
5741 #endif
5742 int main()
5743 {
5744     printf("%d\n", (int)sizeof(double));
5745     exit(0);
5746 }
5747 EOCP
5748         set try
5749         if eval $compile_ok; then
5750                 doublesize=`$run ./try`
5751                 echo "Your double is $doublesize bytes long."
5752         else
5753                 dflt='8'
5754                 echo "(I can't seem to compile the test program.  Guessing...)"
5755                 rp="What is the size of a double precision number (in bytes)?"
5756                 . ./myread
5757                 doublesize="$ans"
5758         fi
5759         ;;
5760 esac
5761 $rm -f try.c try
5762
5763 : check for long doubles
5764 echo " "
5765 echo "Checking to see if you have long double..." >&4
5766 echo 'int main() { long double x = 7.0; }' > try.c
5767 set try
5768 if eval $compile; then
5769         val="$define"
5770         echo "You have long double."
5771 else
5772         val="$undef"
5773         echo "You do not have long double."
5774 fi
5775 $rm try.*
5776 set d_longdbl
5777 eval $setvar
5778
5779 : check for length of long double
5780 case "${d_longdbl}${longdblsize}" in
5781 $define)
5782         echo " "
5783         echo "Checking to see how big your long doubles are..." >&4
5784         $cat >try.c <<'EOCP'
5785 #include <stdio.h>
5786 int main()
5787 {
5788         printf("%d\n", sizeof(long double));
5789 }
5790 EOCP
5791         set try
5792         set try
5793         if eval $compile; then
5794                 longdblsize=`$run ./try`
5795                 echo "Your long doubles are $longdblsize bytes long."
5796         else
5797                 dflt='8'
5798                 echo " "
5799                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5800                 rp="What is the size of a long double (in bytes)?"
5801                 . ./myread
5802                 longdblsize="$ans"
5803         fi
5804         if $test "X$doublesize" = "X$longdblsize"; then
5805                 echo "That isn't any different from an ordinary double."
5806                 echo "I'll keep your setting anyway, but you may see some"
5807                 echo "harmless compilation warnings."
5808         fi      
5809         ;;
5810 esac
5811 $rm -f try.* try
5812
5813 : determine the architecture name
5814 echo " "
5815 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5816         tarch=`arch`"-$osname"
5817 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5818         if uname -m > tmparch 2>&1 ; then
5819                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5820                         -e 's/$/'"-$osname/" tmparch`
5821         else
5822                 tarch="$osname"
5823         fi
5824         $rm -f tmparch
5825 else
5826         tarch="$osname"
5827 fi
5828 case "$myarchname" in
5829 ''|"$tarch") ;;
5830 *)
5831         echo "(Your architecture name used to be $myarchname.)"
5832         archname=''
5833         ;;
5834 esac
5835 case "$targetarch" in
5836 '') ;;
5837 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5838 esac
5839 myarchname="$tarch"
5840 case "$archname" in
5841 '') dflt="$tarch";;
5842 *) dflt="$archname";;
5843 esac
5844 rp='What is your architecture name'
5845 . ./myread
5846 archname="$ans"
5847 case "$usethreads" in
5848 $define)
5849         echo "Threads selected." >&4
5850         case "$archname" in
5851         *-thread*) echo "...and architecture name already has -thread." >&4
5852                 ;;
5853         *)      archname="$archname-thread"
5854                 echo "...setting architecture name to $archname." >&4
5855                 ;;
5856         esac
5857         ;;
5858 esac
5859 case "$usemultiplicity" in
5860 $define)
5861         echo "Multiplicity selected." >&4
5862         case "$archname" in
5863         *-multi*) echo "...and architecture name already has -multi." >&4
5864                 ;;
5865         *)      archname="$archname-multi"
5866                 echo "...setting architecture name to $archname." >&4
5867                 ;;
5868         esac
5869         ;;
5870 esac
5871 case "$use64bitint$use64bitall" in
5872 *"$define"*)
5873         case "$archname64" in
5874         '')
5875                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5876                 ;;
5877         *)
5878                 case "$use64bitint" in
5879                 "$define") echo "64 bit integers selected." >&4 ;;
5880                 esac
5881                 case "$use64bitall" in
5882                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5883                 esac
5884                 case "$archname" in
5885                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5886                         ;;
5887                 *)      archname="$archname-$archname64"
5888                         echo "...setting architecture name to $archname." >&4
5889                         ;;
5890                 esac
5891                 ;;
5892         esac
5893 esac
5894 case "$uselongdouble" in
5895 $define)
5896         echo "Long doubles selected." >&4
5897         case "$longdblsize" in
5898         $doublesize)
5899                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5900                 ;;
5901         *)
5902                 case "$archname" in
5903                 *-ld*) echo "...and architecture name already has -ld." >&4
5904                         ;;
5905                 *)      archname="$archname-ld"
5906                         echo "...setting architecture name to $archname." >&4
5907                         ;;
5908                 esac
5909                 ;;
5910         esac
5911         ;;
5912 esac
5913 case "$useperlio" in
5914 $define)
5915         echo "Perlio selected." >&4
5916         ;;
5917 *)
5918         echo "Perlio not selected, using stdio." >&4
5919         case "$archname" in
5920         *-stdio*) echo "...and architecture name already has -stdio." >&4
5921                 ;;
5922         *)      archname="$archname-stdio"
5923                 echo "...setting architecture name to $archname." >&4
5924                 ;;
5925         esac
5926         ;;
5927 esac
5928 if $test -f archname.cbu; then
5929         echo "Your platform has some specific hints for architecture name, using them..."
5930         . ./archname.cbu
5931 fi
5932
5933 : set the prefixit variable, to compute a suitable default value
5934 prefixit='case "$3" in
5935 ""|none)
5936         case "$oldprefix" in
5937         "") eval "$1=\"\$$2\"";;
5938         *)
5939                 case "$3" in
5940                 "") eval "$1=";;
5941                 none)
5942                         eval "tp=\"\$$2\"";
5943                         case "$tp" in
5944                         ""|" ") eval "$1=\"\$$2\"";;
5945                         *) eval "$1=";;
5946                         esac;;
5947                 esac;;
5948         esac;;
5949 *)
5950         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5951         case "$tp" in
5952         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5953         /*-$oldprefix/*|\~*-$oldprefix/*)
5954                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5955         *) eval "$1=\"\$$2\"";;
5956         esac;;
5957 esac'
5958
5959 : get the patchlevel
5960 echo " "
5961 echo "Getting the current patchlevel..." >&4
5962 if $test -r $rsrc/patchlevel.h;then
5963         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5964         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5965         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5966         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5967         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5968         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5969         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5970 else
5971         revision=0
5972         patchlevel=0
5973         subversion=0
5974         api_revision=0
5975         api_version=0
5976         api_subversion=0
5977         perl_patchlevel=0
5978         $echo "(You do not have patchlevel.h.  Eek.)"
5979 fi
5980 if $test -r $rsrc/.patch ; then
5981         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5982                 perl_patchlevel=`cat $rsrc/.patch`
5983         fi
5984 fi
5985 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5986 version_patchlevel_string="version $patchlevel subversion $subversion"
5987 case "$perl_patchlevel" in
5988 0|'') ;;
5989 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5990 esac
5991
5992 $echo "(You have $package $version_patchlevel_string.)"
5993
5994 case "$osname" in
5995 dos|vms)
5996         : XXX Should be a Configure test for double-dots in filenames.
5997         version=`echo $revision $patchlevel $subversion | \
5998                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5999         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6000                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6001         ;;
6002 *)
6003         version=`echo $revision $patchlevel $subversion | \
6004                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6005         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6006                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6007         ;;
6008 esac
6009 : Special case the 5.005_xx maintenance series, which used 5.005
6010 : without any subversion label as a subdirectory in $sitelib
6011 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6012         api_versionstring='5.005'
6013 fi
6014
6015 : determine installation style
6016 : For now, try to deduce it from prefix unless it is already set.
6017 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6018 case "$installstyle" in
6019 '')     case "$prefix" in
6020                 *perl*) dflt='lib';;
6021                 *) dflt='lib/perl5' ;;
6022         esac
6023         ;;
6024 *)      dflt="$installstyle" ;;
6025 esac
6026 : Probably not worth prompting for this since we prompt for all
6027 : the directories individually, and the prompt would be too long and
6028 : confusing anyway.
6029 installstyle=$dflt
6030
6031 : determine where public executables go
6032 echo " "
6033 set dflt bin bin
6034 eval $prefixit
6035 fn=d~
6036 rp='Pathname where the public executables will reside?'
6037 . ./getfile
6038 if $test "X$ansexp" != "X$binexp"; then
6039         installbin=''
6040 fi
6041 prefixvar=bin
6042 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6043 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6044 :     this via initialinstalllocation
6045 . ./setprefixvar
6046
6047 case "$userelocatableinc" in
6048 $define|true|[yY]*)     dflt='y' ;;
6049 *)                      dflt='n' ;;
6050 esac
6051 cat <<EOM
6052
6053 Would you like to build Perl so that the installation is relocatable, so that
6054 library paths in @INC are determined relative to the path of the perl binary?
6055 This is not advised for system Perl installs, or if you need to run setid
6056 scripts or scripts under taint mode.
6057
6058 If this doesn't make any sense to you, just accept the default '$dflt'.
6059 EOM
6060 rp='Use relocatable @INC?'
6061 . ./myread
6062 case "$ans" in
6063 y|Y)    val="$define" ;;
6064 *)      val="$undef"  ;;
6065 esac
6066 set userelocatableinc
6067 eval $setvar
6068
6069 initialinstalllocation="$binexp"
6070 : Default prefix is now "up one level from where the binaries are"
6071 case "$userelocatableinc" in
6072 $define|true|[yY]*)
6073     bin=".../"
6074     binexp=".../"
6075     prefix=".../.."
6076     prefixexp=".../.."
6077     installprefixexp=".../.."
6078     ;;
6079 esac
6080
6081 : determine where private library files go
6082 : Usual default is /usr/local/lib/perl5/$version.
6083 : Also allow things like /opt/perl/lib/$version, since
6084 : /opt/perl/lib/perl5... would be redundant.
6085 : The default "style" setting is made in installstyle.U
6086 case "$installstyle" in
6087 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6088 *)       set dflt privlib lib/$version ;;
6089 esac
6090 eval $prefixit
6091 $cat <<EOM
6092
6093 There are some auxiliary files for $package that need to be put into a
6094 private library directory that is accessible by everyone.
6095
6096 EOM
6097 fn=$binexp
6098 fn=d~+
6099 rp='Pathname where the private library files will reside?'
6100 . ./getfile
6101 prefixvar=privlib
6102 . ./setprefixvar
6103
6104 : set the prefixup variable, to restore leading tilda escape
6105 prefixup='case "$prefixexp" in
6106 "$prefix") ;;
6107 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6108 esac'
6109
6110 : determine where public architecture dependent libraries go
6111 set archlib archlib
6112 eval $prefixit
6113 : privlib default is /usr/local/lib/$package/$version
6114 : archlib default is /usr/local/lib/$package/$version/$archname
6115 : privlib may have an optional trailing /share.
6116 tdflt=`echo $privlib | $sed 's,/share$,,'`
6117 tdflt=$tdflt/$archname
6118 case "$archlib" in
6119 '')     dflt=$tdflt
6120         ;;
6121 *)      dflt="$archlib"
6122     ;;
6123 esac
6124 $cat <<EOM
6125
6126 $spackage contains architecture-dependent library files.  If you are
6127 sharing libraries in a heterogeneous environment, you might store
6128 these files in a separate location.  Otherwise, you can just include
6129 them with the rest of the public library files.
6130
6131 EOM
6132 fn=$binexp
6133 fn=d+~
6134 rp='Where do you want to put the public architecture-dependent libraries?'
6135 . ./getfile
6136 prefixvar=archlib
6137 . ./setprefixvar
6138 if $test X"$archlib" = X"$privlib"; then
6139         d_archlib="$undef"
6140 else
6141         d_archlib="$define"
6142 fi
6143
6144 : see if setuid scripts can be secure
6145 $cat <<EOM
6146
6147 Some kernels have a bug that prevents setuid #! scripts from being
6148 secure.  Some sites have disabled setuid #! scripts because of this.
6149
6150 First let's decide if your kernel supports secure setuid #! scripts.
6151 (If setuid #! scripts would be secure but have been disabled anyway,
6152 don't say that they are secure if asked.)
6153
6154 EOM
6155
6156 val="$undef"
6157 if $test -d /dev/fd; then
6158         echo "#!$ls" >reflect
6159         chmod +x,u+s reflect
6160         ./reflect >flect 2>&1
6161         if $contains "/dev/fd" flect >/dev/null; then
6162                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6163                 val="$define"
6164         else
6165                 $cat <<EOM
6166 If you are not sure if they are secure, I can check but I'll need a
6167 username and password different from the one you are using right now.
6168 If you don't have such a username or don't want me to test, simply
6169 enter 'none'.
6170
6171 EOM
6172                 rp='Other username to test security of setuid scripts with?'
6173                 dflt='none'
6174                 . ./myread
6175                 case "$ans" in
6176                 n|none)
6177                         case "$d_suidsafe" in
6178                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6179                                 dflt=n;;
6180                         "$undef")
6181                                 echo "Well, the $hint value is *not* secure." >&4
6182                                 dflt=n;;
6183                         *)      echo "Well, the $hint value *is* secure." >&4
6184                                 dflt=y;;
6185                         esac
6186                         ;;
6187                 *)
6188                         $rm -f reflect flect
6189                         echo "#!$ls" >reflect
6190                         chmod +x,u+s reflect
6191                         echo >flect
6192                         chmod a+w flect
6193                         echo '"su" will (probably) prompt you for '"$ans's password."
6194                         su $ans -c './reflect >flect'
6195                         if $contains "/dev/fd" flect >/dev/null; then
6196                                 echo "Okay, it looks like setuid scripts are secure." >&4
6197                                 dflt=y
6198                         else
6199                                 echo "I don't think setuid scripts are secure." >&4
6200                                 dflt=n
6201                         fi
6202                         ;;
6203                 esac
6204                 rp='Does your kernel have *secure* setuid scripts?'
6205                 . ./myread
6206                 case "$ans" in
6207                 [yY]*)  val="$define";;
6208                 *)      val="$undef";;
6209                 esac
6210         fi
6211 else
6212         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6213         echo "(That's for file descriptors, not floppy disks.)"
6214         val="$undef"
6215 fi
6216 set d_suidsafe
6217 eval $setvar
6218
6219 $rm -f reflect flect
6220
6221 : now see if they want to do setuid emulation
6222 echo " "
6223 val="$undef"
6224 case "$d_suidsafe" in
6225 "$define")
6226         val="$undef"
6227         echo "No need to emulate SUID scripts since they are secure here." >&4
6228         ;;
6229 *)
6230         $cat <<EOM
6231 Some systems have disabled setuid scripts, especially systems where
6232 setuid scripts cannot be secure.  On systems where setuid scripts have
6233 been disabled, the setuid/setgid bits on scripts are currently
6234 useless.  It is possible for $package to detect those bits and emulate
6235 setuid/setgid in a secure fashion.  This emulation will only work if
6236 setuid scripts have been disabled in your kernel.
6237
6238 EOM
6239         case "$d_dosuid" in
6240         "$define") dflt=y ;;
6241         *) dflt=n ;;
6242         esac
6243         rp="Do you want to do setuid/setgid emulation?"
6244         . ./myread
6245         case "$ans" in
6246         [yY]*)  val="$define";;
6247         *)      val="$undef";;
6248         esac
6249         ;;
6250 esac
6251 set d_dosuid
6252 eval $setvar
6253
6254 : Find perl5.005 or later.
6255 echo "Looking for a previously installed perl5.005 or later... "
6256 case "$perl5" in
6257 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6258                 : Check if this perl is recent and can load a simple module
6259                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6260                         perl5=$tdir/perl
6261                         break;
6262                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6263                         perl5=$tdir/perl5
6264                         break;
6265                 fi
6266         done
6267         ;;
6268 *)      perl5="$perl5"
6269         ;;
6270 esac
6271 case "$perl5" in
6272 '')     echo "None found.  That's ok.";;
6273 *)      echo "Using $perl5." ;;
6274 esac
6275
6276 $cat <<EOM
6277
6278 After $package is installed, you may wish to install various
6279 add-on modules and utilities.  Typically, these add-ons will
6280 be installed under $prefix with the rest
6281 of this package.  However, you may wish to install such add-ons
6282 elsewhere under a different prefix.
6283
6284 If you do not wish to put everything under a single prefix, that's
6285 ok.  You will be prompted for the individual locations; this siteprefix
6286 is only used to suggest the defaults.
6287
6288 The default should be fine for most people.
6289
6290 EOM
6291 fn=d~+
6292 rp='Installation prefix to use for add-on modules and utilities?'
6293 : XXX Here might be another good place for an installstyle setting.
6294 case "$siteprefix" in
6295 '') dflt=$prefix ;;
6296 *)  dflt=$siteprefix ;;
6297 esac
6298 . ./getfile
6299 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6300 oldsiteprefix=''
6301 case "$siteprefix" in
6302 '') ;;
6303 *)      case "$ans" in
6304         "$prefix") ;;
6305         *) oldsiteprefix="$prefix";;
6306         esac
6307         ;;
6308 esac
6309 siteprefix="$ans"
6310 siteprefixexp="$ansexp"
6311
6312 : determine where site specific libraries go.
6313 : Usual default is /usr/local/lib/perl5/site_perl/$version
6314 : The default "style" setting is made in installstyle.U
6315 : XXX No longer works with Prefixit stuff.
6316 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6317 case "$sitelib" in
6318 '') case "$installstyle" in
6319         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6320         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6321         esac
6322         ;;
6323 *)      dflt="$sitelib"
6324         ;;
6325 esac
6326 $cat <<EOM
6327
6328 The installation process will create a directory for
6329 site-specific extensions and modules.  Most users find it convenient
6330 to place all site-specific files in this directory rather than in the
6331 main distribution directory.
6332
6333 EOM
6334 fn=d~+
6335 rp='Pathname for the site-specific library files?'
6336 . ./getfile
6337 prefixvar=sitelib
6338 . ./setprefixvar
6339 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6340
6341 : Determine list of previous versions to include in @INC
6342 $cat > getverlist <<EOPL
6343 #!$perl5 -w
6344 use File::Basename;
6345 \$api_versionstring = "$api_versionstring";
6346 \$version = "$version";
6347 \$stem = "$sitelib_stem";
6348 \$archname = "$archname";
6349 EOPL
6350         $cat >> getverlist <<'EOPL'
6351 # The list found is store twice for each entry: the original name, and
6352 # the binary broken down version as pack "sss", so sorting is easy and
6353 # unambiguous. This will work for all versions that have a maximum of
6354 # three digit groups, separate by '.'s or '_'s. Names are extended with
6355 # ".0.0" to ensure at least three elements for the pack.
6356 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6357
6358 # Can't have leading @ because metaconfig interprets it as a command!
6359 ;@inc_version_list=();
6360 # XXX Redo to do opendir/readdir?
6361 if (-d $stem) {
6362     chdir($stem);
6363     ;@candidates = map {
6364         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6365 }
6366 else {
6367     ;@candidates = ();
6368 }
6369
6370 ($pversion, $aversion, $vsn5005) = map {
6371     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6372 foreach $d (@candidates) {
6373     if ($d->[1] lt $pversion) {
6374         if ($d->[1] ge $aversion) {
6375             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6376         }
6377         elsif ($d->[1] ge $vsn5005) {
6378             unshift(@inc_version_list, grep { -d } $d->[0]);
6379         }
6380     }
6381     else {
6382         # Skip newer version.  I.e. don't look in
6383         # 5.7.0 if we're installing 5.6.1.
6384     }
6385 }
6386
6387 if (@inc_version_list) {
6388     print join(' ', @inc_version_list);
6389 }
6390 else {
6391     # Blank space to preserve value for next Configure run.
6392     print " ";
6393 }
6394 EOPL
6395 chmod +x getverlist
6396 case "$inc_version_list" in
6397 '')     if test -x "$perl5$exe_ext"; then
6398                 dflt=`$perl5 getverlist`
6399         else
6400                 dflt='none'
6401         fi
6402         ;;
6403 $undef) dflt='none' ;;
6404 *)  eval dflt=\"$inc_version_list\" ;;
6405 esac
6406 case "$dflt" in
6407 ''|' ') dflt=none ;;
6408 esac
6409 case "$dflt" in
6410 5.005) dflt=none ;;
6411 esac
6412 $cat <<EOM
6413
6414 In order to ease the process of upgrading, this version of perl
6415 can be configured to use modules built and installed with earlier
6416 versions of perl that were installed under $prefix.  Specify here
6417 the list of earlier versions that this version of perl should check.
6418 If Configure detected no earlier versions of perl installed under
6419 $prefix, then the list will be empty.  Answer 'none' to tell perl
6420 to not search earlier versions.
6421
6422 The default should almost always be sensible, so if you're not sure,
6423 just accept the default.
6424 EOM
6425
6426 rp='List of earlier versions to include in @INC?'
6427 . ./myread
6428 case "$ans" in
6429 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6430 *) inc_version_list="$ans" ;;
6431 esac
6432 case "$inc_version_list" in
6433 ''|' ')
6434         inc_version_list_init='0'
6435         d_inc_version_list="$undef"
6436         ;;
6437 *)      inc_version_list_init=`echo $inc_version_list |
6438                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6439         d_inc_version_list="$define"
6440         ;;
6441 esac
6442 $rm -f getverlist
6443
6444 : see if this is a malloc.h system
6445 : we want a real compile instead of Inhdr because some systems have a
6446 : malloc.h that just gives a compile error saying to use stdlib.h instead
6447 echo " "
6448 $cat >try.c <<EOCP
6449 #include <stdlib.h>
6450 #include <malloc.h>
6451 int main () { return 0; }
6452 EOCP
6453 set try
6454 if eval $compile; then
6455     echo "<malloc.h> found." >&4
6456     val="$define"
6457 else
6458     echo "<malloc.h> NOT found." >&4
6459     val="$undef"
6460 fi
6461 $rm -f try.c try
6462 set i_malloc
6463 eval $setvar
6464
6465 : check for void type
6466 echo " "
6467 echo "Checking to see how well your C compiler groks the void type..." >&4
6468 case "$voidflags" in
6469 '')
6470         $cat >try.c <<EOCP
6471 #$i_stdlib I_STDLIB
6472 #ifdef I_STDLIB
6473 #include <stdlib.h>
6474 #endif
6475 #if TRY & 1
6476 void sub() {
6477 #else
6478 sub() {
6479 #endif
6480         extern void moo();      /* function returning void */
6481         void (*goo)();          /* ptr to func returning void */
6482 #if TRY & 8
6483         void *hue;              /* generic ptr */
6484 #endif
6485 #if TRY & 2
6486         void (*foo[10])();
6487 #endif
6488
6489 #if TRY & 4
6490         if(goo == moo) {
6491                 exit(0);
6492         }
6493 #endif
6494         exit(0);
6495 }
6496 int main() { sub(); }
6497 EOCP
6498         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6499                 voidflags=$defvoidused
6500         echo "Good.  It appears to support void to the level $package wants.">&4
6501                 if $contains warning .out >/dev/null 2>&1; then
6502                         echo "However, you might get some warnings that look like this:"
6503                         $cat .out
6504                 fi
6505         else
6506 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6507                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6508                         echo "It supports 1..."
6509                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6510                                 echo "It also supports 2..."
6511                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6512                                         voidflags=7
6513                                         echo "And it supports 4 but not 8 definitely."
6514                                 else
6515                                         echo "It doesn't support 4..."
6516                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6517                                                 voidflags=11
6518                                                 echo "But it supports 8."
6519                                         else
6520                                                 voidflags=3
6521                                                 echo "Neither does it support 8."
6522                                         fi
6523                                 fi
6524                         else
6525                                 echo "It does not support 2..."
6526                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6527                                         voidflags=13
6528                                         echo "But it supports 4 and 8."
6529                                 else
6530                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6531                                                 voidflags=5
6532                                                 echo "And it supports 4 but has not heard about 8."
6533                                         else
6534                                                 echo "However it supports 8 but not 4."
6535                                         fi
6536                                 fi
6537                         fi
6538                 else
6539                         echo "There is no support at all for void."
6540                         voidflags=0
6541                 fi
6542         fi
6543 esac
6544 case "$voidflags" in
6545 "$defvoidused") ;;
6546 *)      $cat >&4 <<'EOM'
6547   Support flag bits are:
6548     1: basic void declarations.
6549     2: arrays of pointers to functions returning void.
6550     4: operations between pointers to and addresses of void functions.
6551     8: generic void pointers.
6552 EOM
6553         dflt="$voidflags";
6554         rp="Your void support flags add up to what?"
6555         . ./myread
6556         voidflags="$ans"
6557         ;;
6558 esac
6559 $rm -f try.* .out
6560
6561 : check for length of pointer
6562 echo " "
6563 case "$ptrsize" in
6564 '')
6565         echo "Checking to see how big your pointers are..." >&4
6566         if test "$voidflags" -gt 7; then
6567                 echo '#define VOID_PTR char *' > try.c
6568         else
6569                 echo '#define VOID_PTR void *' > try.c
6570         fi
6571         $cat >>try.c <<EOCP
6572 #include <stdio.h>
6573 #$i_stdlib I_STDLIB
6574 #ifdef I_STDLIB
6575 #include <stdlib.h>
6576 #endif
6577 int main()
6578 {
6579     printf("%d\n", (int)sizeof(VOID_PTR));
6580     exit(0);
6581 }
6582 EOCP
6583         set try
6584         if eval $compile_ok; then
6585                 ptrsize=`$run ./try`
6586                 echo "Your pointers are $ptrsize bytes long."
6587         else
6588                 dflt='4'
6589                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6590                 rp="What is the size of a pointer (in bytes)?"
6591                 . ./myread
6592                 ptrsize="$ans"
6593         fi
6594         ;;
6595 esac
6596 $rm -f try.c try
6597 case "$use64bitall" in
6598 "$define"|true|[yY]*)
6599         case "$ptrsize" in
6600         4)      cat <<EOM >&4
6601
6602 *** You have chosen a maximally 64-bit build,
6603 *** but your pointers are only 4 bytes wide.
6604 *** Please rerun Configure without -Duse64bitall.
6605 EOM
6606                 case "$d_quad" in
6607                 define)
6608                         cat <<EOM >&4
6609 *** Since you have quads, you could possibly try with -Duse64bitint.
6610 EOM
6611                         ;;
6612                 esac
6613                 cat <<EOM >&4
6614 *** Cannot continue, aborting.
6615
6616 EOM
6617
6618                 exit 1
6619                 ;;
6620         esac
6621         ;;
6622 esac
6623
6624
6625 : determine whether to use malloc wrapping
6626 echo " "
6627 case "$usemallocwrap" in
6628 [yY]*|true|$define)     dflt='y' ;;
6629 [nN]*|false|$undef)     dflt='n' ;;
6630 *)      case "$usedevel" in
6631         [yY]*|true|$define)     dflt='y' ;;
6632         *) dflt='n' ;;
6633         esac
6634         ;;
6635 esac
6636 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6637 . ./myread
6638 usemallocwrap="$ans"
6639 case "$ans" in
6640 y*|true)
6641         usemallocwrap="$define" ;;
6642 *)
6643         usemallocwrap="$undef" ;;
6644 esac
6645
6646 : determine which malloc to compile in
6647 echo " "
6648 case "$usemymalloc" in
6649 [yY]*|true|$define)     dflt='y' ;;
6650 [nN]*|false|$undef)     dflt='n' ;;
6651 *)      case "$ptrsize" in
6652         4) dflt='y' ;;
6653         *) dflt='n' ;;
6654         esac
6655         ;;
6656 esac
6657 rp="Do you wish to attempt to use the malloc that comes with $package?"
6658 . ./myread
6659 usemymalloc="$ans"
6660 case "$ans" in
6661 y*|true)
6662         usemymalloc='y'
6663         mallocsrc='malloc.c'
6664         mallocobj="malloc$_o"
6665         d_mymalloc="$define"
6666         case "$libs" in
6667         *-lmalloc*)
6668                 : Remove malloc from list of libraries to use
6669                 echo "Removing unneeded -lmalloc from library list" >&4
6670                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6671                 shift
6672                 libs="$*"
6673                 echo "libs = $libs" >&4
6674                 ;;
6675         esac
6676         ;;
6677 *)
6678         usemymalloc='n'
6679         mallocsrc=''
6680         mallocobj=''
6681         d_mymalloc="$undef"
6682         ;;
6683 esac
6684
6685 : compute the return types of malloc and free
6686 echo " "
6687 $cat >malloc.c <<END
6688 #$i_malloc I_MALLOC
6689 #$i_stdlib I_STDLIB
6690 #include <stdio.h>
6691 #include <sys/types.h>
6692 #ifdef I_MALLOC
6693 #include <malloc.h>
6694 #endif
6695 #ifdef I_STDLIB
6696 #include <stdlib.h>
6697 #endif
6698 #ifdef TRY_MALLOC
6699 void *malloc();
6700 #endif
6701 #ifdef TRY_FREE
6702 void free();
6703 #endif
6704 END
6705 case "$malloctype" in
6706 '')
6707         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6708                 malloctype='void *'
6709         else
6710                 malloctype='char *'
6711         fi
6712         ;;
6713 esac
6714 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6715
6716 case "$freetype" in
6717 '')
6718         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6719                 freetype='void'
6720         else
6721                 freetype='int'
6722         fi
6723         ;;
6724 esac
6725 echo "Your system uses $freetype free(), it would seem." >&4
6726 $rm -f malloc.[co]
6727 : determine where site specific architecture-dependent libraries go.
6728 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6729 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6730 : sitelib may have an optional trailing /share.
6731 case "$sitearch" in
6732 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6733         dflt="$dflt/$archname"
6734         ;;
6735 *)      dflt="$sitearch"
6736         ;;
6737 esac
6738 set sitearch sitearch none
6739 eval $prefixit
6740 $cat <<EOM
6741
6742 The installation process will also create a directory for
6743 architecture-dependent site-specific extensions and modules.
6744
6745 EOM
6746 fn=d~+
6747 rp='Pathname for the site-specific architecture-dependent library files?'
6748 . ./getfile
6749 prefixvar=sitearch
6750 . ./setprefixvar
6751 if $test X"$sitearch" = X"$sitelib"; then
6752         d_sitearch="$undef"
6753 else
6754         d_sitearch="$define"
6755 fi
6756
6757 $cat <<EOM
6758
6759 The installation process will also create a directory for
6760 vendor-supplied add-ons.  Vendors who supply perl with their system
6761 may find it convenient to place all vendor-supplied files in this
6762 directory rather than in the main distribution directory.  This will
6763 ease upgrades between binary-compatible maintenance versions of perl.
6764
6765 Of course you may also use these directories in whatever way you see
6766 fit.  For example, you might use them to access modules shared over a
6767 company-wide network.
6768
6769 The default answer should be fine for most people.
6770 This causes further questions about vendor add-ons to be skipped
6771 and no vendor-specific directories will be configured for perl.
6772
6773 EOM
6774 rp='Do you want to configure vendor-specific add-on directories?'
6775 case "$usevendorprefix" in
6776 define|true|[yY]*) dflt=y ;;
6777 *)      : User may have set vendorprefix directly on Configure command line.
6778         case "$vendorprefix" in
6779         ''|' ') dflt=n ;;
6780         *)      dflt=y ;;
6781         esac
6782         ;;
6783 esac
6784 . ./myread
6785 case "$ans" in
6786 [yY]*)  fn=d~+
6787         rp='Installation prefix to use for vendor-supplied add-ons?'
6788         case "$vendorprefix" in
6789         '') dflt='' ;;
6790         *)  dflt=$vendorprefix ;;
6791         esac
6792         . ./getfile
6793         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6794         oldvendorprefix=''
6795         case "$vendorprefix" in
6796         '') ;;
6797         *)      case "$ans" in
6798                 "$prefix") ;;
6799                 *) oldvendorprefix="$prefix";;
6800                 esac
6801                 ;;
6802         esac
6803         usevendorprefix="$define"
6804         vendorprefix="$ans"
6805         vendorprefixexp="$ansexp"
6806         ;;
6807 *)      usevendorprefix="$undef"
6808         vendorprefix=''
6809         vendorprefixexp=''
6810         ;;
6811 esac
6812
6813 case "$vendorprefix" in
6814 '')     d_vendorlib="$undef"
6815         vendorlib=''
6816         vendorlibexp=''
6817         ;;
6818 *)      d_vendorlib="$define"
6819         : determine where vendor-supplied modules go.
6820         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6821         case "$vendorlib" in
6822         '')
6823                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6824                 case "$installstyle" in
6825                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6826                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6827                 esac
6828                 ;;
6829         *)      dflt="$vendorlib"
6830                 ;;
6831         esac
6832         fn=d~+
6833         rp='Pathname for the vendor-supplied library files?'
6834         . ./getfile
6835         vendorlib="$ans"
6836         vendorlibexp="$ansexp"
6837         ;;
6838 esac
6839 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6840 prefixvar=vendorlib
6841 . ./installprefix
6842
6843 case "$vendorprefix" in
6844 '')     d_vendorarch="$undef"
6845         vendorarch=''
6846         vendorarchexp=''
6847         ;;
6848 *)      d_vendorarch="$define"
6849         : determine where vendor-supplied architecture-dependent libraries go.
6850         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6851         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6852         : vendorlib may have an optional trailing /share.
6853         case "$vendorarch" in
6854         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6855                 dflt="$dflt/$archname"
6856                 ;;
6857         *)      dflt="$vendorarch" ;;
6858         esac
6859         fn=d~+
6860         rp='Pathname for vendor-supplied architecture-dependent files?'
6861         . ./getfile
6862         vendorarch="$ans"
6863         vendorarchexp="$ansexp"
6864         ;;
6865 esac
6866 prefixvar=vendorarch
6867 . ./installprefix
6868
6869 : Final catch-all directories to search
6870 $cat <<EOM
6871
6872 Lastly, you can have perl look in other directories for extensions and
6873 modules in addition to those already specified.
6874 These directories will be searched after 
6875         $sitearch 
6876         $sitelib 
6877 EOM
6878 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6879 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6880 echo ' '
6881 case "$otherlibdirs" in
6882 ''|' ') dflt='none' ;;
6883 *)      dflt="$otherlibdirs" ;;
6884 esac
6885 $cat <<EOM
6886 Enter a colon-separated set of extra paths to include in perl's @INC
6887 search path, or enter 'none' for no extra paths.
6888
6889 EOM
6890
6891 rp='Colon-separated list of additional directories for perl to search?'
6892 . ./myread
6893 case "$ans" in
6894 ' '|''|none)    otherlibdirs=' ' ;;     
6895 *)      otherlibdirs="$ans" ;;
6896 esac
6897 case "$otherlibdirs" in
6898 ' ') val=$undef ;;
6899 *)      val=$define ;;
6900 esac
6901 set d_perl_otherlibdirs
6902 eval $setvar
6903
6904 : Cruising for prototypes
6905 echo " "
6906 echo "Checking out function prototypes..." >&4
6907 $cat >prototype.c <<EOCP
6908 #$i_stdlib I_STDLIB
6909 #ifdef I_STDLIB
6910 #include <stdlib.h>
6911 #endif
6912 int main(int argc, char *argv[]) {
6913         exit(0);}
6914 EOCP
6915 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6916         echo "Your C compiler appears to support function prototypes."
6917         val="$define"
6918 else
6919         echo "Your C compiler doesn't seem to understand function prototypes."
6920         val="$undef"
6921 fi
6922 set prototype
6923 eval $setvar
6924 $rm -f prototype*
6925
6926 case "$prototype" in
6927 "$define") ;;
6928 *)      ansi2knr='ansi2knr'
6929         echo " "
6930         cat <<EOM >&4
6931
6932 $me:  FATAL ERROR:
6933 This version of $package can only be compiled by a compiler that 
6934 understands function prototypes.  Unfortunately, your C compiler 
6935         $cc $ccflags
6936 doesn't seem to understand them.  Sorry about that.
6937
6938 If GNU cc is available for your system, perhaps you could try that instead.  
6939
6940 Eventually, we hope to support building Perl with pre-ANSI compilers.
6941 If you would like to help in that effort, please contact <perlbug@perl.org>.
6942
6943 Aborting Configure now.
6944 EOM
6945         exit 2
6946         ;;
6947 esac
6948
6949 echo " "
6950 case "$extras" in
6951 '') dflt='n';;
6952 *) dflt='y';;
6953 esac
6954 cat <<EOM
6955 Perl can be built with extra modules or bundles of modules which
6956 will be fetched from the CPAN and installed alongside Perl.
6957
6958 Notice that you will need access to the CPAN; either via the Internet,
6959 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6960 be asked later to configure the CPAN.pm module which will in turn do
6961 the installation of the rest of the extra modules or bundles.)
6962
6963 Notice also that if the modules require any external software such as
6964 libraries and headers (the libz library and the zlib.h header for the
6965 Compress::Zlib module, for example) you MUST have any such software
6966 already installed, this configuration process will NOT install such
6967 things for you.
6968
6969 If this doesn't make any sense to you, just accept the default '$dflt'.
6970 EOM
6971 rp='Install any extra modules (y or n)?'
6972 . ./myread
6973 case "$ans" in
6974 y|Y)
6975         cat <<EOM
6976
6977 Please list any extra modules or bundles to be installed from CPAN,
6978 with spaces between the names.  The names can be in any format the
6979 'install' command of CPAN.pm will understand.  (Answer 'none',
6980 without the quotes, to install no extra modules or bundles.)
6981 EOM
6982         rp='Extras?'
6983         dflt="$extras"
6984         . ./myread
6985         extras="$ans"
6986 esac
6987 case "$extras" in
6988 ''|'none')
6989         val=''
6990         $rm -f ../extras.lst
6991         ;;
6992 *)      echo "(Saving the list of extras for later...)"
6993         echo "$extras" > ../extras.lst
6994         val="'$extras'"
6995         ;;
6996 esac
6997 set extras
6998 eval $setvar
6999 echo " "
7000
7001 : determine where html pages for programs go
7002 set html1dir html1dir none
7003 eval $prefixit
7004 $cat <<EOM
7005
7006 If you wish to install html files for programs in $spackage, indicate
7007 the appropriate directory here.  To skip installing html files,
7008 answer "none".
7009 EOM
7010 case "$html1dir" in
7011 ''|none|$undef|' ') dflt=none ;;
7012 *) dflt=$html1dir ;;
7013 esac
7014 fn=dn+~
7015 rp="Directory for the main $spackage html pages?"
7016 . ./getfile
7017 prefixvar=html1dir
7018 . ./setprefixvar
7019 : Use ' ' for none so value is preserved next time through Configure
7020 $test X"$html1dir" = "X" && html1dir=' '
7021
7022 : determine where html pages for libraries and modules go
7023 set html3dir html3dir none
7024 eval $prefixit
7025 $cat <<EOM
7026
7027 If you wish to install html files for modules associated with $spackage,
7028 indicate the appropriate directory here.  To skip installing html files,
7029 answer "none".
7030 EOM
7031 : There is no obvious default.  If they have specified html1dir, then
7032 : try to key off that, possibly changing .../html1 into .../html3.
7033 case "$html3dir" in
7034 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7035 *) dflt=$html3dir ;;
7036 esac
7037 fn=dn+~
7038 rp="Directory for the $spackage module html pages?"
7039 . ./getfile
7040 prefixvar=html3dir
7041 . ./setprefixvar
7042 : Use ' ' for none so value is preserved next time through Configure
7043 $test X"$html3dir" = "X" && html3dir=' '
7044
7045 : determine whether to install perl also as /usr/bin/perl
7046
7047 echo " "
7048 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7049         $cat <<EOM
7050 Many scripts expect perl to be installed as /usr/bin/perl.
7051
7052 If you want to, I can install the perl you are about to compile
7053 as /usr/bin/perl (in addition to $bin/perl).
7054 EOM
7055         if test -f /usr/bin/perl; then
7056             $cat <<EOM
7057
7058 However, please note that because you already have a /usr/bin/perl,
7059 overwriting that with a new Perl would very probably cause problems.
7060 Therefore I'm assuming you don't want to do that (unless you insist).
7061
7062 EOM
7063             case "$installusrbinperl" in
7064             "$define"|[yY]*)    dflt='y';;
7065             *)                  dflt='n';;
7066             esac
7067         else
7068             $cat <<EOM
7069
7070 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7071
7072 EOM
7073             case "$installusrbinperl" in
7074             "$undef"|[nN]*)     dflt='n';;
7075             *)                  dflt='y';;
7076             esac
7077         fi
7078         rp="Do you want to install perl as /usr/bin/perl?"
7079         . ./myread
7080         case "$ans" in
7081         [yY]*)  val="$define";;
7082         *)      val="$undef" ;;
7083         esac
7084 else
7085         val="$undef"
7086 fi
7087 set installusrbinperl
7088 eval $setvar
7089
7090 echo " "
7091 echo "Checking for GNU C Library..." >&4
7092 cat >try.c <<'EOCP'
7093 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7094    alone are insufficient to distinguish different versions, such as
7095    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7096    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7097 */
7098 #include <stdio.h>
7099 int main(void)
7100 {
7101 #ifdef __GLIBC__
7102 #   ifdef __GLIBC_MINOR__
7103 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7104 #           include <gnu/libc-version.h>
7105             printf("%s\n",  gnu_get_libc_version());
7106 #       else
7107             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7108 #       endif
7109 #   else
7110         printf("%d\n",  __GLIBC__);
7111 #   endif
7112     return 0;
7113 #else
7114     return 1;
7115 #endif
7116 }
7117 EOCP
7118 set try
7119 if eval $compile_ok && $run ./try > glibc.ver; then
7120         val="$define"
7121         gnulibc_version=`$cat glibc.ver`
7122         echo "You are using the GNU C Library version $gnulibc_version"
7123 else
7124         val="$undef"
7125         gnulibc_version=''
7126         echo "You are not using the GNU C Library"
7127 fi
7128 $rm -f try try.* glibc.ver
7129 set d_gnulibc
7130 eval $setvar
7131
7132 : see if nm is to be used to determine whether a symbol is defined or not
7133 case "$usenm" in
7134 '')
7135         dflt=''
7136         case "$d_gnulibc" in
7137         "$define")
7138                 echo " "
7139                 echo "nm probably won't work on the GNU C Library." >&4
7140                 dflt=n
7141                 ;;
7142         esac
7143         case "$dflt" in
7144         '') 
7145                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7146                         echo " "
7147                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7148                         echo "'nm' won't be sufficient on this sytem." >&4
7149                         dflt=n
7150                 fi
7151                 ;;
7152         esac
7153         case "$dflt" in
7154         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7155                 if $test $dflt -gt 20; then
7156                         dflt=y
7157                 else
7158                         dflt=n
7159                 fi
7160                 ;;
7161         esac
7162         ;;
7163 *)
7164         case "$usenm" in
7165         true|$define) dflt=y;;
7166         *) dflt=n;;
7167         esac
7168         ;;
7169 esac
7170 $cat <<EOM
7171
7172 I can use $nm to extract the symbols from your C libraries. This
7173 is a time consuming task which may generate huge output on the disk (up
7174 to 3 megabytes) but that should make the symbols extraction faster. The
7175 alternative is to skip the 'nm' extraction part and to compile a small
7176 test program instead to determine whether each symbol is present. If
7177 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7178 this may be the best solution.
7179
7180 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7181
7182 EOM
7183 rp="Shall I use $nm to extract C symbols from the libraries?"
7184 . ./myread
7185 case "$ans" in
7186 [Nn]*) usenm=false;;
7187 *) usenm=true;;
7188 esac
7189
7190 runnm=$usenm
7191 case "$reuseval" in
7192 true) runnm=false;;
7193 esac
7194
7195 : nm options which may be necessary
7196 case "$nm_opt" in
7197 '') if $test -f /mach_boot; then
7198                 nm_opt=''       # Mach
7199         elif $test -d /usr/ccs/lib; then
7200                 nm_opt='-p'     # Solaris (and SunOS?)
7201         elif $test -f /dgux; then
7202                 nm_opt='-p'     # DG-UX
7203         elif $test -f /lib64/rld; then
7204                 nm_opt='-p'     # 64-bit Irix
7205         else
7206                 nm_opt=''
7207         fi;;
7208 esac
7209
7210 : nm options which may be necessary for shared libraries but illegal
7211 : for archive libraries.  Thank you, Linux.
7212 case "$nm_so_opt" in
7213 '')     case "$myuname" in
7214         *linux*|gnu*)
7215                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7216                         nm_so_opt='--dynamic'
7217                 fi
7218                 ;;
7219         esac
7220         ;;
7221 esac
7222
7223 case "$runnm" in
7224 true)
7225 : get list of predefined functions in a handy place
7226 echo " "
7227 case "$libc" in
7228 '') libc=unknown
7229         case "$libs" in
7230         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7231         esac
7232         ;;
7233 esac
7234 case "$libs" in
7235 '') ;;
7236 *)  for thislib in $libs; do
7237         case "$thislib" in
7238         -lc|-lc_s)
7239                 : Handle C library specially below.
7240                 ;;
7241         -l*)
7242                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7243                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7244                         :
7245                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7246                         :
7247                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7248                         :
7249                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7250                         :
7251                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7252                         :
7253                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7254                         :
7255                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7256                         :
7257                 else
7258                         try=''
7259                 fi
7260                 libnames="$libnames $try"
7261                 ;;
7262         *) libnames="$libnames $thislib" ;;
7263         esac
7264         done
7265         ;;
7266 esac
7267 xxx=normal
7268 case "$libc" in
7269 unknown)
7270         set /lib/libc.$so
7271         for xxx in $libpth; do
7272                 $test -r $1 || set $xxx/libc.$so
7273                 : The messy sed command sorts on library version numbers.
7274                 $test -r $1 || \
7275                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7276                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7277                                 h
7278                                 s/[0-9][0-9]*/0000&/g
7279                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7280                                 G
7281                                 s/\n/ /' | \
7282                          $sort | $sed -e 's/^.* //'`
7283                 eval set \$$#
7284         done
7285         $test -r $1 || set /usr/ccs/lib/libc.$so
7286         $test -r $1 || set /lib/libsys_s$_a
7287         ;;
7288 *)
7289         set blurfl
7290         ;;
7291 esac
7292 if $test -r "$1"; then
7293         echo "Your (shared) C library seems to be in $1."
7294         libc="$1"
7295 elif $test -r /lib/libc && $test -r /lib/clib; then
7296         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7297         xxx=apollo
7298         libc='/lib/clib /lib/libc'
7299         if $test -r /lib/syslib; then
7300                 echo "(Your math library is in /lib/syslib.)"
7301                 libc="$libc /lib/syslib"
7302         fi
7303 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7304         echo "Your C library seems to be in $libc, as you said before."
7305 elif $test -r $incpath/usr/lib/libc$_a; then
7306         libc=$incpath/usr/lib/libc$_a;
7307         echo "Your C library seems to be in $libc.  That's fine."
7308 elif $test -r /lib/libc$_a; then
7309         libc=/lib/libc$_a;
7310         echo "Your C library seems to be in $libc.  You're normal."
7311 else
7312         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7313                 :
7314         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7315                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7316         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7317                 :
7318         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7319                 :
7320         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7321                 :
7322         else
7323                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7324         fi
7325         if $test -r "$tans"; then
7326                 echo "Your C library seems to be in $tans, of all places."
7327                 libc=$tans
7328         else
7329                 libc='blurfl'
7330         fi
7331 fi
7332 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7333         dflt="$libc"
7334         cat <<EOM
7335
7336 If the guess above is wrong (which it might be if you're using a strange
7337 compiler, or your machine supports multiple models), you can override it here.
7338
7339 EOM
7340 else
7341         dflt=''
7342         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7343         cat >&4 <<EOM
7344 I can't seem to find your C library.  I've looked in the following places:
7345
7346 EOM
7347         $sed 's/^/      /' libpath
7348         cat <<EOM
7349
7350 None of these seems to contain your C library. I need to get its name...
7351
7352 EOM
7353 fi
7354 fn=f
7355 rp='Where is your C library?'
7356 . ./getfile
7357 libc="$ans"
7358
7359 echo " "
7360 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7361 set X `cat libnames`
7362 shift
7363 xxx=files
7364 case $# in 1) xxx=file; esac
7365 echo "Extracting names from the following $xxx for later perusal:" >&4
7366 echo " "
7367 $sed 's/^/      /' libnames >&4
7368 echo " "
7369 $echo $n "This may take a while...$c" >&4
7370
7371 for file in $*; do
7372         case $file in
7373         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7374         *) $nm $nm_opt $file 2>/dev/null;;
7375         esac
7376 done >libc.tmp
7377
7378 $echo $n ".$c"
7379 $grep fprintf libc.tmp > libc.ptf
7380 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7381 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7382 xxx='[ADTSIW]'
7383 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7384         eval $xscan;\
7385         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7386                 eval $xrun
7387 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7388         eval $xscan;\
7389         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7390                 eval $xrun
7391 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7392         eval $xscan;\
7393         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7394                 eval $xrun
7395 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7400         eval $xscan;\
7401         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7402                 eval $xrun
7403 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7404         eval $xscan;\
7405         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7406                 eval $xrun
7407 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7408                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7409         eval $xscan;\
7410         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7411                 eval $xrun
7412 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7413         eval $xscan;\
7414         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7415                 eval $xrun
7416 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7417         eval $xscan;\
7418         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7419                 eval $xrun
7420 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7421         eval $xscan;\
7422         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7423                 eval $xrun
7424 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7425         eval $xscan;\
7426         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7427                 eval $xrun
7428 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7429         eval $xscan;\
7430         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7431                 eval $xrun
7432 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7433         eval $xscan;\
7434         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7435                 eval $xrun
7436 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7437         eval $xscan;\
7438         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7439                 eval $xrun
7440 else
7441         $nm -p $* 2>/dev/null >libc.tmp
7442         $grep fprintf libc.tmp > libc.ptf
7443         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7444                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7445         then
7446                 nm_opt='-p'
7447                 eval $xrun
7448         else
7449                 echo " "
7450                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7451                 com=''
7452                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7453                         for thisname in $libnames $libc; do
7454                                 $ar t $thisname >>libc.tmp
7455                         done
7456                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7457                         echo "Ok." >&4
7458                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7459                         # Repeat libc to extract forwarders to DLL entries too
7460                         for thisname in $libnames $libc; do
7461                                 $ar tv $thisname >>libc.tmp
7462                                 # Revision 50 of EMX has bug in $ar.
7463                                 # it will not extract forwarders to DLL entries
7464                                 # Use emximp which will extract exactly them.
7465                                 emximp -o tmp.imp $thisname \
7466                                     2>/dev/null && \
7467                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7468                                     < tmp.imp >>libc.tmp
7469                                 $rm tmp.imp
7470                         done
7471                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7472                         echo "Ok." >&4
7473                 else
7474                         echo "$ar didn't seem to work right." >&4
7475                         echo "Maybe this is a Cray...trying bld instead..." >&4
7476                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7477                         then
7478                                 for thisname in $libnames; do
7479                                         bld t $libnames | \
7480                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7481                                         $ar t $thisname >>libc.tmp
7482                                 done
7483                                 echo "Ok." >&4
7484                         else
7485                                 echo "That didn't work either.  Giving up." >&4
7486                                 exit 1
7487                         fi
7488                 fi
7489         fi
7490 fi
7491 nm_extract="$com"
7492 case "$PASE" in
7493 define)
7494     echo " "
7495     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7496     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7497     ;;
7498 *)  if $test -f /lib/syscalls.exp; then
7499         echo " "
7500         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7501         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7502     fi
7503     ;;
7504 esac
7505 ;;
7506 esac
7507 $rm -f libnames libpath
7508
7509 : see if dld is available
7510 set dld.h i_dld
7511 eval $inhdr
7512
7513 : is a C symbol defined?
7514 csym='tlook=$1;
7515 case "$3" in
7516 -v) tf=libc.tmp; tdc="";;
7517 -a) tf=libc.tmp; tdc="[]";;
7518 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7519 esac;
7520 tx=yes;
7521 case "$reuseval-$4" in
7522 true-) ;;
7523 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7524 esac;
7525 case "$tx" in
7526 yes)
7527         tval=false;
7528         if $test "$runnm" = true; then
7529                 if $contains $tlook $tf >/dev/null 2>&1; then
7530                         tval=true;
7531                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7532                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7533                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7534                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7535                         $rm -f try$_exe try.c core core.* try.core;
7536                 fi;
7537         else
7538                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7539                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7540                 $rm -f try$_exe try.c;
7541         fi;
7542         ;;
7543 *)
7544         case "$tval" in
7545         $define) tval=true;;
7546         *) tval=false;;
7547         esac;
7548         ;;
7549 esac;
7550 eval "$2=$tval"'
7551
7552 : define an is-in-libc? function
7553 inlibc='echo " "; td=$define; tu=$undef;
7554 sym=$1; var=$2; eval "was=\$$2";
7555 tx=yes;
7556 case "$reuseval$was" in
7557 true) ;;
7558 true*) tx=no;;
7559 esac;
7560 case "$tx" in
7561 yes)
7562         set $sym tres -f;
7563         eval $csym;
7564         case "$tres" in
7565         true)
7566                 echo "$sym() found." >&4;
7567                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7568         *)
7569                 echo "$sym() NOT found." >&4;
7570                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7571         esac;;
7572 *)
7573         case "$was" in
7574         $define) echo "$sym() found." >&4;;
7575         *) echo "$sym() NOT found." >&4;;
7576         esac;;
7577 esac'
7578
7579
7580 echo " "
7581 echo "Checking for C++..." >&4
7582 cat >try.c <<'EOCP'
7583 #include <stdio.h>
7584 int main(void)
7585 {
7586 #ifdef __cplusplus
7587     printf("define\n");
7588 #else
7589     printf("undef\n");
7590 #endif
7591     return 0;
7592 }
7593 EOCP
7594 set try
7595 if eval $compile_ok && $run ./try >cplusplus$$; then
7596         val=`$cat cplusplus$$`
7597         echo "You are using a C++ compiler."
7598 else
7599         val="$undef"
7600         echo "You are not using a C++ compiler."
7601 fi
7602 $rm -f try try.* cplusplus$$
7603 set d_cplusplus
7604 eval $setvar
7605
7606 : see if dlopen exists
7607 xxx_runnm="$runnm"
7608 xxx_ccflags="$ccflags"
7609 runnm=false
7610 : with g++ one needs -shared to get is-in-libc to work for dlopen
7611 case "$gccversion" in
7612 '')     ;;
7613 *)      case "$d_cplusplus" in
7614         "$define") ccflags="$ccflags -shared" ;;
7615         esac
7616         ;;
7617 esac
7618 set dlopen d_dlopen
7619 eval $inlibc
7620 runnm="$xxx_runnm"
7621 ccflags="$xxx_ccflags"
7622
7623 : see if this is a unistd.h system
7624 set unistd.h i_unistd
7625 eval $inhdr
7626
7627 : determine which dynamic loading, if any, to compile in
7628 echo " "
7629 dldir="ext/DynaLoader"
7630 case "$usedl" in
7631 $define|y|true)
7632         dflt='y'
7633         usedl="$define"
7634         ;;
7635 $undef|n|false)
7636         dflt='n'
7637         usedl="$undef"
7638         ;;
7639 *) 
7640         dflt='n'
7641         case "$d_dlopen" in
7642             $define) dflt='y' ;;
7643         esac
7644         case "$i_dld" in
7645             $define) dflt='y' ;;
7646         esac
7647         : Does a dl_xxx.xs file exist for this operating system
7648         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7649         ;;
7650 esac
7651 rp="Do you wish to use dynamic loading?"
7652 . ./myread
7653 usedl="$ans"
7654 case "$ans" in
7655 y*) usedl="$define"
7656         case "$dlsrc" in
7657         '')
7658                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7659                         dflt="$dldir/dl_${osname}.xs"
7660                 elif $test "$d_dlopen" = "$define" ; then
7661                         dflt="$dldir/dl_dlopen.xs"
7662                 elif $test "$i_dld" = "$define" ; then
7663                         dflt="$dldir/dl_dld.xs"
7664                 else
7665                         dflt=''
7666                 fi
7667                 ;;
7668         *)      dflt="$dldir/$dlsrc"
7669                 ;;
7670         esac
7671     echo "The following dynamic loading files are available:"
7672         : Can not go over to $dldir because getfile has path hard-coded in.
7673         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7674         rp="Source file to use for dynamic loading"
7675         fn="fne"
7676         gfpth="$src"
7677         . ./getfile
7678         usedl="$define"
7679         : emulate basename
7680         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7681
7682         $cat << EOM
7683
7684 Some systems may require passing special flags to $cc -c to
7685 compile modules that will be used to create a shared library.
7686 To use no flags, say "none".
7687
7688 EOM
7689     case "$cccdlflags" in
7690     '') case "$gccversion" in
7691                 '') case "$osname" in
7692                         hpux)   dflt='+z' ;;
7693                         next)   dflt='none' ;;
7694                         irix*)  dflt='-KPIC' ;;
7695                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7696                         sunos)  dflt='-pic' ;;
7697                         *)      dflt='none' ;;
7698                     esac
7699                         ;;
7700                 *)  case "$osname" in
7701                         darwin) dflt='none' ;;
7702                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7703                         *)      dflt='-fpic' ;;
7704                     esac ;;
7705             esac ;;
7706         ' ') dflt='none' ;;
7707     *)  dflt="$cccdlflags" ;;
7708     esac
7709     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7710     . ./myread
7711     case "$ans" in
7712     none) cccdlflags=' ' ;;
7713     *) cccdlflags="$ans" ;;
7714     esac
7715
7716     cat << EOM
7717
7718 Some systems use ld to create libraries that can be dynamically loaded,
7719 while other systems (such as those using ELF) use $cc.
7720
7721 EOM
7722         case "$ld" in
7723         '')     $cat >try.c <<EOM
7724 /* Test for whether ELF binaries are produced */
7725 #include <fcntl.h>
7726 #$i_stdlib I_STDLIB
7727 #ifdef I_STDLIB
7728 #include <stdlib.h>
7729 #endif
7730 #$i_unistd I_UNISTD
7731 #ifdef I_UNISTD
7732 #include <unistd.h>
7733 #endif
7734 int main() {
7735         char b[4];
7736         int i = open("a.out",O_RDONLY);
7737         if(i == -1) 
7738                 exit(1); /* fail */
7739         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7740                 exit(0); /* succeed (yes, it's ELF) */
7741         else
7742                 exit(1); /* fail */
7743 }
7744 EOM
7745                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7746                         cat <<EOM
7747 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7748 EOM
7749                         dflt="$cc"
7750                 else
7751                         echo "I'll use ld to build dynamic libraries."
7752                         dflt='ld'
7753                 fi
7754                 rm -f try.c a.out
7755                 ;;
7756         *)      dflt="$ld"
7757                 ;;
7758         esac
7759
7760     rp="What command should be used to create dynamic libraries?"
7761     . ./myread
7762         ld="$ans"
7763
7764     cat << EOM
7765
7766 Some systems may require passing special flags to $ld to create a
7767 library that can be dynamically loaded.  If your ld flags include
7768 -L/other/path options to locate libraries outside your loader's normal
7769 search path, you may need to specify those -L options here as well.  To
7770 use no flags, say "none".
7771
7772 EOM
7773     case "$lddlflags" in
7774     '') case "$osname" in
7775                         beos) dflt='-nostart' ;;
7776                         hpux) dflt='-b';
7777                               case "$gccversion" in
7778                               '') dflt="$dflt +vnocompatwarnings" ;;
7779                               esac
7780                               ;;        
7781                         linux|irix*|gnu*)       dflt='-shared' ;;
7782                         next)  dflt='none' ;;
7783                         solaris) dflt='-G' ;;
7784                         sunos) dflt='-assert nodefinitions' ;;
7785                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7786                 *)     dflt='none' ;;
7787                         esac
7788                         ;;
7789     *) dflt="$lddlflags" ;;
7790     esac
7791
7792         : Try to guess additional flags to pick up local libraries.
7793         : Be careful not to append to a plain 'none'
7794         case "$dflt" in
7795         none) dflt='' ;;
7796         esac
7797         for thisflag in $ldflags; do
7798                 case "$thisflag" in
7799                 -L*|-R*|-Wl,-R*)
7800                         case " $dflt " in
7801                         *" $thisflag "*) ;;
7802                         *) dflt="$dflt $thisflag" ;;
7803                         esac
7804                         ;;
7805                 esac
7806         done
7807
7808         case "$dflt" in
7809         ''|' ') dflt='none' ;;
7810         esac
7811
7812     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7813     . ./myread
7814     case "$ans" in
7815     none) lddlflags=' ' ;;
7816     *) lddlflags="$ans" ;;
7817     esac
7818
7819         cat <<EOM
7820
7821 Some systems may require passing special flags to $cc to indicate that
7822 the resulting executable will use dynamic linking.  To use no flags,
7823 say "none".
7824
7825 EOM
7826     case "$ccdlflags" in
7827     '') case "$osname" in
7828             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7829             next|sunos) dflt='none' ;;
7830             *)          dflt='none' ;;
7831             esac ;;
7832     ' ')  dflt='none' ;;
7833     *)  dflt="$ccdlflags" ;;
7834     esac
7835     rp="Any special flags to pass to $cc to use dynamic linking?"
7836     . ./myread
7837     case "$ans" in
7838     none) ccdlflags=' ' ;;
7839     *) ccdlflags="$ans" ;;
7840     esac
7841     ;;
7842 *)  usedl="$undef"
7843         ld='ld'
7844     dlsrc='dl_none.xs'
7845     lddlflags=''
7846     ccdlflags=''
7847     ;;
7848 esac
7849
7850 also=''
7851 case "$usedl" in
7852 $undef)
7853         # No dynamic loading being used, so don't bother even to prompt.
7854         useshrplib='false'
7855         ;;
7856 *)      case "$useshrplib" in
7857         '')     case "$osname" in
7858                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7859                         dflt=y
7860                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7861                         ;;
7862                 next*)
7863                         case "$osvers" in
7864                         4*)     dflt=y
7865                                 also='Building a shared libperl is needed for MAB support.'
7866                                 ;;
7867                         *)      dflt=n
7868                                 ;;
7869                         esac
7870                         ;;
7871                 *)      dflt=n
7872                         ;;
7873                 esac
7874                 ;;
7875         $define|true|[Yy]*)
7876                 dflt=y
7877                 ;;
7878         *)      dflt=n
7879                 ;;
7880         esac
7881         $cat << EOM
7882
7883 The perl executable is normally obtained by linking perlmain.c with
7884 libperl${_a}, any static extensions (usually just DynaLoader), and
7885 any other libraries needed on this system (such as -lm, etc.).  Since
7886 your system supports dynamic loading, it is probably possible to build
7887 a shared libperl.$so.  If you will have more than one executable linked
7888 to libperl.$so, this will significantly reduce the size of each
7889 executable, but it may have a noticeable effect on performance.  The
7890 default is probably sensible for your system.
7891 $also
7892
7893 EOM
7894         rp="Build a shared libperl.$so (y/n)"
7895         . ./myread
7896         case "$ans" in
7897         true|$define|[Yy]*)
7898                 useshrplib='true'  ;;
7899         *)      useshrplib='false' ;;
7900         esac
7901         ;;
7902 esac
7903
7904 case "$useshrplib" in
7905 true)
7906         case "$libperl" in
7907         '')
7908                 # Figure out a good name for libperl.so.  Since it gets stored in
7909                 # a version-specific architecture-dependent library, the version
7910                 # number isn't really that important, except for making cc/ld happy.
7911                 #
7912                 # A name such as libperl.so.3.1
7913                 majmin="libperl.$so.$patchlevel.$subversion"
7914                 # A name such as libperl.so.301
7915                 majonly=`echo $patchlevel $subversion |
7916                         $awk '{printf "%d%02d", $1, $2}'`
7917                 majonly=libperl.$so.$majonly
7918                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7919                 # rely on figuring it out from the naming of libc.
7920                 case "${osname}${osvers}" in
7921                 next4*)
7922                         dflt=libperl.5.$so
7923                         # XXX How handle the --version stuff for MAB?
7924                         ;;
7925                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7926                         dflt=libperl.$so
7927                         ;;
7928                 cygwin*) # ld links against an importlib
7929                         dflt=libperl$lib_ext
7930                         ;;
7931                 *)      # Try to guess based on whether libc has major.minor.
7932                         case "$libc" in
7933                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7934                         *libc.$so.[0-9]*) dflt=$majonly ;;
7935                         *)      dflt=libperl.$so ;;
7936                         esac
7937                         ;;
7938                 esac
7939                 ;;
7940         *)      dflt=$libperl
7941                 ;;
7942         esac
7943         cat << EOM
7944
7945 I need to select a good name for the shared libperl.  If your system uses
7946 library names with major and minor numbers, then you might want something
7947 like $majmin.  Alternatively, if your system uses a single version
7948 number for shared libraries, then you might want to use $majonly.
7949 Or, your system might be quite happy with a simple libperl.$so.
7950
7951 Since the shared libperl will get installed into a version-specific
7952 architecture-dependent directory, the version number of the shared perl
7953 library probably isn't important, so the default should be o.k.
7954
7955 EOM
7956         rp='What name do you want to give to the shared libperl?'
7957         . ./myread
7958         libperl=$ans
7959         echo "Ok, I'll use $libperl"
7960         ;;
7961 *)
7962         libperl="libperl${_a}"
7963         ;;
7964 esac
7965
7966 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7967 case "$shrpdir" in
7968 '') ;;
7969 *)      $cat >&4 <<EOM
7970 WARNING:  Use of the shrpdir variable for the installation location of
7971 the shared $libperl is not supported.  It was never documented and
7972 will not work in this version.  Let me (perlbug@perl.org)
7973 know of any problems this may cause.
7974
7975 EOM
7976         case "$shrpdir" in
7977         "$archlibexp/CORE")
7978                 $cat >&4 <<EOM
7979 But your current setting of $shrpdir is
7980 the default anyway, so it's harmless.
7981 EOM
7982                 ;;
7983         *)
7984                 $cat >&4 <<EOM
7985 Further, your current attempted setting of $shrpdir
7986 conflicts with the value of $archlibexp/CORE
7987 that installperl will use.
7988 EOM
7989                 ;;
7990         esac
7991         ;;
7992 esac
7993
7994 # How will the perl executable find the installed shared $libperl?
7995 # Add $xxx to ccdlflags.
7996 # If we can't figure out a command-line option, use $shrpenv to
7997 # set env LD_RUN_PATH.  The main perl makefile uses this.
7998 shrpdir=$archlibexp/CORE
7999 xxx=''
8000 tmp_shrpenv=''
8001 if "$useshrplib"; then
8002     case "$osname" in 
8003         aix)
8004                 # We'll set it in Makefile.SH...
8005                 ;;
8006         solaris)
8007                 xxx="-R $shrpdir"
8008                 ;;
8009         freebsd|netbsd|openbsd|interix|dragonfly)
8010                 xxx="-Wl,-R$shrpdir"
8011                 ;;
8012         bsdos|linux|irix*|dec_osf|gnu*)
8013                 xxx="-Wl,-rpath,$shrpdir"
8014                 ;;
8015         next)
8016                 # next doesn't like the default...
8017                 ;;
8018         beos)
8019                 # beos doesn't like the default, either.
8020                 ;;
8021         hpux*)
8022                 # hpux doesn't like the default, either.
8023                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8024                 ;;
8025         *)
8026                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8027                 ;;
8028         esac
8029         case "$xxx" in
8030         '') ;;
8031         *)      
8032                 # Only add $xxx if it isn't already in ccdlflags.
8033                 case " $ccdlflags " in
8034                 *" $xxx "*)     ;;
8035                 *)      ccdlflags="$ccdlflags $xxx"
8036                         cat <<EOM >&4
8037
8038 Adding $xxx to the flags
8039 passed to $ld so that the perl executable will find the 
8040 installed shared $libperl.
8041
8042 EOM
8043                         ;;
8044                 esac
8045                 ;;
8046         esac
8047 fi
8048 # Fix ccdlflags in AIX for building external extensions.
8049 # (For building Perl itself bare -bE:perl.exp is needed,
8050 #  Makefile.SH takes care of this.)
8051 case "$osname" in
8052 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8053 esac
8054 # Respect a hint or command-line value.
8055 case "$shrpenv" in
8056 '') shrpenv="$tmp_shrpenv" ;;
8057 esac
8058 case "$ldlibpthname" in
8059 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8060 none)   ldlibpthname='' ;;
8061 esac
8062
8063 : determine where manual pages are on this system
8064 echo " "
8065 case "$sysman" in
8066 '') 
8067         syspath='/usr/share/man/man1 /usr/man/man1'
8068         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8069         syspath="$syspath /usr/man/u_man/man1"
8070         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8071         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8072         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8073         sysman=`./loc . /usr/man/man1 $syspath`
8074         ;;
8075 esac
8076 if $test -d "$sysman"; then
8077         echo "System manual is in $sysman." >&4
8078 else
8079         echo "Could not find manual pages in source form." >&4
8080 fi
8081
8082 : determine where manual pages go
8083 set man1dir man1dir none
8084 eval $prefixit
8085 $cat <<EOM
8086
8087 $spackage has manual pages available in source form.
8088 EOM
8089 case "$nroff" in
8090 nroff)
8091         echo "However, you don't have nroff, so they're probably useless to you."
8092         case "$man1dir" in
8093         '') man1dir="none";;
8094         esac;;
8095 esac
8096 echo "If you don't want the manual sources installed, answer 'none'."
8097 case "$man1dir" in
8098 ' ') dflt=none
8099         ;;
8100 '')
8101         lookpath="$prefixexp/share/man/man1"
8102         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8103         lookpath="$lookpath $prefixexp/man/p_man/man1"
8104         lookpath="$lookpath $prefixexp/man/u_man/man1"
8105         lookpath="$lookpath $prefixexp/man/man.1"
8106         case "$sysman" in
8107         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8108         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8109         esac
8110         set dflt
8111         eval $prefixup
8112         ;;
8113 *)  dflt="$man1dir"
8114         ;;
8115 esac
8116 echo " "
8117 fn=dn+~
8118 rp="Where do the main $spackage manual pages (source) go?"
8119 . ./getfile
8120 if $test "X$man1direxp" != "X$ansexp"; then
8121         installman1dir=''
8122 fi
8123 prefixvar=man1dir
8124 . ./setprefixvar
8125
8126 case "$man1dir" in
8127 '')     man1dir=' '
8128         installman1dir='';;
8129 esac
8130
8131 : What suffix to use on installed man pages
8132
8133 case "$man1dir" in
8134 ' ')
8135         man1ext='0'
8136         ;;
8137 *)
8138         rp="What suffix should be used for the main $spackage man pages?"
8139         case "$man1ext" in
8140         '')     case "$man1dir" in
8141                 *1)  dflt=1 ;;
8142                 *1p) dflt=1p ;;
8143                 *1pm) dflt=1pm ;;
8144                 *l) dflt=l;;
8145                 *n) dflt=n;;
8146                 *o) dflt=o;;
8147                 *p) dflt=p;;
8148                 *C) dflt=C;;
8149                 *L) dflt=L;;
8150                 *L1) dflt=L1;;
8151                 *) dflt=1;;
8152                 esac
8153                 ;;
8154         *)      dflt="$man1ext";;
8155         esac
8156         . ./myread
8157         man1ext="$ans"
8158         ;;
8159 esac
8160
8161 : see if we can have long filenames
8162 echo " "
8163 first=123456789abcdef
8164 $rm -f $first
8165 if (echo hi >$first) 2>/dev/null; then
8166         if $test -f 123456789abcde; then
8167                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8168                 val="$undef"
8169         else
8170                 echo 'You can have filenames longer than 14 characters.'>&4
8171                 val="$define"
8172         fi
8173 else
8174         $cat <<'EOM'
8175 You can't have filenames longer than 14 chars.
8176 You can't even think about them!
8177 EOM
8178         val="$undef"
8179 fi 
8180 set d_flexfnam
8181 eval $setvar
8182 $rm -rf 123456789abcde*
8183
8184 : determine where library module manual pages go
8185 set man3dir man3dir none
8186 eval $prefixit
8187 $cat <<EOM
8188
8189 $spackage has manual pages for many of the library modules.
8190 EOM
8191
8192 case "$nroff" in
8193 nroff)
8194         $cat <<'EOM'
8195 However, you don't have nroff, so they're probably useless to you.
8196 EOM
8197         case "$man3dir" in
8198         '') man3dir="none";;
8199         esac;;
8200 esac
8201
8202 case "$d_flexfnam" in
8203 undef)
8204         $cat <<'EOM'
8205 However, your system can't handle the long file names like File::Basename.3.
8206 EOM
8207         case "$man3dir" in
8208         '') man3dir="none";;
8209         esac;;
8210 esac
8211
8212 echo "If you don't want the manual sources installed, answer 'none'."
8213 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8214 case "$man3dir" in
8215 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8216         if $test -d "$privlib/man/man3"; then
8217                 cat <<EOM >&4
8218
8219 WARNING:  Previous versions of perl installed man3 pages into
8220 $privlib/man/man3.  This version will suggest a
8221 new default of $dflt.
8222 EOM
8223                 tdflt=$dflt
8224                 dflt='n'
8225                 rp='Do you wish to preserve the old behavior?(y/n)'
8226                 . ./myread
8227                 case "$ans" in
8228                 y*) dflt="$privlib/man/man3" ;;
8229                 *)  dflt=$tdflt ;;
8230                 esac
8231     fi
8232         ;;
8233 *)      dflt="$man3dir" ;;
8234 esac
8235 case "$dflt" in
8236 ' ') dflt=none ;;
8237 esac
8238 echo " "
8239 fn=dn+~
8240 rp="Where do the $package library man pages (source) go?"
8241 . ./getfile
8242 prefixvar=man3dir
8243 . ./setprefixvar
8244
8245 case "$man3dir" in
8246 '')     man3dir=' '
8247         installman3dir='';;
8248 esac
8249
8250 : What suffix to use on installed man pages
8251 case "$man3dir" in
8252 ' ')
8253         man3ext='0'
8254         ;;
8255 *)
8256         rp="What suffix should be used for the $package library man pages?"
8257         case "$man3ext" in
8258         '')     case "$man3dir" in
8259                 *3)  dflt=3 ;;
8260                 *3p) dflt=3p ;;
8261                 *3pm) dflt=3pm ;;
8262                 *l) dflt=l;;
8263                 *n) dflt=n;;
8264                 *o) dflt=o;;
8265                 *p) dflt=p;;
8266                 *C) dflt=C;;
8267                 *L) dflt=L;;
8268                 *L3) dflt=L3;;
8269                 *) dflt=3;;
8270                 esac
8271                 ;;
8272         *)      dflt="$man3ext";;
8273         esac
8274         . ./myread
8275         man3ext="$ans"
8276         ;;
8277 esac
8278
8279 : see if we have to deal with yellow pages, now NIS.
8280 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8281         if $test -f /usr/etc/nibindd; then
8282                 echo " "
8283                 echo "I'm fairly confident you're on a NeXT."
8284                 echo " "
8285                 rp='Do you get the hosts file via NetInfo?'
8286                 dflt=y
8287                 case "$hostcat" in
8288                 nidump*) ;;
8289                 '') ;;
8290                 *) dflt=n;;
8291                 esac
8292                 . ./myread
8293                 case "$ans" in
8294                 y*) hostcat='nidump hosts .';;
8295                 *)      case "$hostcat" in
8296                         nidump*) hostcat='';;
8297                         esac
8298                         ;;
8299                 esac
8300         fi
8301         case "$hostcat" in
8302         nidump*) ;;
8303         *)
8304                 case "$hostcat" in
8305                 *ypcat*) dflt=y;;
8306                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8307                                 dflt=y
8308                         else
8309                                 dflt=n
8310                         fi;;
8311                 *) dflt=n;;
8312                 esac
8313                 echo " "
8314                 rp='Are you getting the hosts file via yellow pages?'
8315                 . ./myread
8316                 case "$ans" in
8317                 y*) hostcat='ypcat hosts';;
8318                 *) hostcat='cat /etc/hosts';;
8319                 esac
8320                 ;;
8321         esac
8322 fi
8323 case "$hostcat" in
8324 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8325 esac
8326 case "$groupcat" in
8327 '') test -f /etc/group && groupcat='cat /etc/group';;
8328 esac
8329 case "$passcat" in
8330 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8331 esac
8332
8333 : now get the host name
8334 echo " "
8335 echo "Figuring out host name..." >&4
8336 case "$myhostname" in
8337 '') cont=true
8338         echo 'Maybe "hostname" will work...'
8339         if tans=`sh -c hostname 2>&1` ; then
8340                 myhostname=$tans
8341                 phostname=hostname
8342                 cont=''
8343         fi
8344         ;;
8345 *) cont='';;
8346 esac
8347 if $test "$cont"; then
8348         if ./xenix; then
8349                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8350                 if tans=`cat /etc/systemid 2>&1` ; then
8351                         myhostname=$tans
8352                         phostname='cat /etc/systemid'
8353                         echo "Whadyaknow.  Xenix always was a bit strange..."
8354                         cont=''
8355                 fi
8356         elif $test -r /etc/systemid; then
8357                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8358         fi
8359 fi
8360 if $test "$cont"; then
8361         echo 'No, maybe "uuname -l" will work...'
8362         if tans=`sh -c 'uuname -l' 2>&1` ; then
8363                 myhostname=$tans
8364                 phostname='uuname -l'
8365         else
8366                 echo 'Strange.  Maybe "uname -n" will work...'
8367                 if tans=`sh -c 'uname -n' 2>&1` ; then
8368                         myhostname=$tans
8369                         phostname='uname -n'
8370                 else
8371                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8372                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8373                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8374                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8375                         else
8376                                 case "$myhostname" in
8377                                 '') echo "Does this machine have an identity crisis or something?"
8378                                         phostname='';;
8379                                 *)
8380                                         echo "Well, you said $myhostname before..."
8381                                         phostname='echo $myhostname';;
8382                                 esac
8383                         fi
8384                 fi
8385         fi
8386 fi
8387 case "$myhostname" in
8388 '') myhostname=noname ;;
8389 esac
8390 : you do not want to know about this
8391 set $myhostname
8392 myhostname=$1
8393
8394 : verify guess
8395 if $test "$myhostname" ; then
8396         dflt=y
8397         rp='Your host name appears to be "'$myhostname'".'" Right?"
8398         . ./myread
8399         case "$ans" in
8400         y*) ;;
8401         *) myhostname='';;
8402         esac
8403 fi
8404
8405 : bad guess or no guess
8406 while $test "X$myhostname" = X ; do
8407         dflt=''
8408         rp="Please type the (one word) name of your host:"
8409         . ./myread
8410         myhostname="$ans"
8411 done
8412
8413 : translate upper to lower if necessary
8414 case "$myhostname" in
8415 *[A-Z]*)
8416         echo "(Normalizing case in your host name)"
8417         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8418         ;;
8419 esac
8420
8421 case "$myhostname" in
8422 *.*)
8423         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8424         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8425         echo "(Trimming domain name from host name--host name is now $myhostname)"
8426         ;;
8427 *) case "$mydomain" in
8428         '')
8429                 {
8430                         test "X$hostcat" = "Xypcat hosts" &&
8431                         ypmatch "$myhostname" hosts 2>/dev/null |\
8432                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8433                         $test -s hosts
8434                 } || {
8435                         test "X$hostcat" != "X" &&
8436                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8437                                         /[       ]$myhostname[  . ]/p" > hosts
8438                 }
8439                 tmp_re="[       . ]"
8440                 if $test -f hosts; then
8441                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8442                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8443                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8444                                 hosts | $sort | $uniq | \
8445                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8446                         case `$echo X$dflt` in
8447                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8448                                 dflt=.
8449                                 ;;
8450                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8451                                 ;;
8452                         esac
8453                 else
8454                         echo "(I cannot locate a hosts database anywhere)"
8455                         dflt=.
8456                 fi
8457                 case "$dflt" in
8458                 .)
8459                         tans=`./loc resolv.conf X /etc /usr/etc`
8460                         if $test -f "$tans"; then
8461                                 echo "(Attempting domain name extraction from $tans)"
8462                                 dflt=.`$sed -n -e 's/   / /g' \
8463                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8464                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8465                                 case "$dflt" in
8466                                 .) dflt=.`$sed -n -e 's/        / /g' \
8467                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8468                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8469                                         ;;
8470                                 esac
8471                         fi
8472                         ;;
8473                 esac
8474                 case "$dflt" in
8475                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8476                         dflt=.`sh -c domainname 2>/dev/null`
8477                         case "$dflt" in
8478                         '') dflt='.';;
8479                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8480                         esac
8481                         ;;
8482                 esac
8483                 case "$dflt$osname" in
8484                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8485                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8486                         ;;
8487                 esac
8488                 case "$dflt" in
8489                 .) echo "(Lost all hope -- silly guess then)"
8490                         dflt='.nonet'
8491                         ;;
8492                 esac
8493                 $rm -f hosts
8494                 ;;
8495         *) dflt="$mydomain";;
8496         esac;;
8497 esac
8498 echo " "
8499 rp="What is your domain name?"
8500 . ./myread
8501 tans="$ans"
8502 case "$ans" in
8503 '') ;;
8504 .*) ;;
8505 *) tans=".$tans";;
8506 esac
8507 mydomain="$tans"
8508
8509 : translate upper to lower if necessary
8510 case "$mydomain" in
8511 *[A-Z]*)
8512         echo "(Normalizing case in your domain name)"
8513         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8514         ;;
8515 esac
8516
8517 : a little sanity check here
8518 case "$phostname" in
8519 '') ;;
8520 *)
8521         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8522         $myhostname$mydomain|$myhostname) ;;
8523         *)
8524                 case "$phostname" in
8525                 sed*)
8526                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8527                         ;;
8528                 *)
8529                         echo "(That doesn't agree with your $phostname command, by the way.)"
8530                         ;;
8531                 esac
8532         ;;
8533         esac
8534         ;;
8535 esac
8536
8537 $cat <<EOM
8538
8539 I need to get your e-mail address in Internet format if possible, i.e.
8540 something like user@host.domain. Please answer accurately since I have
8541 no easy means to double check it. The default value provided below
8542 is most probably close to reality but may not be valid from outside
8543 your organization...
8544
8545 EOM
8546 cont=x
8547 while test "$cont"; do
8548         case "$cf_email" in
8549         '') dflt="$cf_by@$myhostname$mydomain";;
8550         *) dflt="$cf_email";;
8551         esac
8552         rp='What is your e-mail address?'
8553         . ./myread
8554         cf_email="$ans"
8555         case "$cf_email" in
8556         *@*.*) cont='' ;;
8557         *)
8558                 rp='Address does not look like an Internet one.  Use it anyway?'
8559                 case "$fastread" in
8560                 yes) dflt=y ;;
8561                 *) dflt=n ;;
8562                 esac
8563                 . ./myread
8564                 case "$ans" in
8565                 y*) cont='' ;;
8566                 *) echo " " ;;
8567                 esac
8568                 ;;
8569         esac
8570 done
8571
8572 $cat <<EOM
8573
8574 If you or somebody else will be maintaining perl at your site, please
8575 fill in the correct e-mail address here so that they may be contacted
8576 if necessary. Currently, the "perlbug" program included with perl
8577 will send mail to this address in addition to perlbug@perl.org. You may
8578 enter "none" for no administrator.
8579
8580 EOM
8581 case "$perladmin" in
8582 '') dflt="$cf_email";;
8583 *) dflt="$perladmin";;
8584 esac
8585 rp='Perl administrator e-mail address'
8586 . ./myread
8587 perladmin="$ans"
8588
8589 : determine whether to only install version-specific parts.
8590 echo " "
8591 $cat <<EOM
8592 Do you want to install only the version-specific parts of the perl
8593 distribution?  Usually you do *not* want to do this.
8594 EOM
8595 case "$versiononly" in
8596 "$define"|[Yy]*|true) dflt='y' ;;
8597 *) dflt='n';
8598 esac
8599 rp="Do you want to install only the version-specific parts of perl?"
8600 . ./myread
8601 case "$ans" in
8602 [yY]*)  val="$define";;
8603 *)      val="$undef" ;;
8604 esac
8605 set versiononly
8606 eval $setvar
8607
8608 case "$versiononly" in
8609 "$define") inc_version_list=''
8610            inc_version_list_init=0
8611            ;;
8612 esac
8613
8614 : figure out how to guarantee perl startup
8615 : XXX Note that this currently takes advantage of the bug that binexp ignores
8616 :     the Configure -Dinstallprefix setting, which in turn means that under
8617 :     relocatable @INC, initialinstalllocation is what binexp started as.
8618 case "$startperl" in
8619 '')
8620         case "$sharpbang" in
8621         *!)
8622                 $cat <<EOH
8623
8624 I can use the #! construct to start perl on your system. This will
8625 make startup of perl scripts faster, but may cause problems if you
8626 want to share those scripts and perl is not in a standard place
8627 ($initialinstalllocation/perl) on all your platforms. The alternative
8628 is to force a shell by starting the script with a single ':' character.
8629
8630 EOH
8631                 case "$versiononly" in
8632                 "$define")      dflt="$initialinstalllocation/perl$version";;
8633                 *)              dflt="$initialinstalllocation/perl";;
8634                 esac
8635                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8636                 . ./myread
8637                 case "$ans" in
8638                 none)   startperl=": # use perl";;
8639                 *)      startperl="#!$ans"
8640                         if $test 30 -lt `echo "$ans" | wc -c`; then
8641                                 $cat >&4 <<EOM
8642
8643 WARNING:  Some systems limit the #! command to 32 characters.
8644 If you experience difficulty running Perl scripts with #!, try
8645 installing Perl in a directory with a shorter pathname.
8646
8647 EOM
8648                         fi ;;
8649                 esac
8650                 ;;
8651         *) startperl=": # use perl"
8652                 ;;
8653         esac
8654         ;;
8655 esac
8656 echo "I'll use $startperl to start perl scripts."
8657
8658 : figure best path for perl in scripts
8659 case "$perlpath" in
8660 '')
8661         case "$versiononly" in
8662         "$define")      perlpath="$initialinstalllocation/perl$version";;
8663         *)              perlpath="$initialinstalllocation/perl";;
8664         esac
8665         case "$startperl" in
8666         *!*) ;;
8667         *)
8668                 $cat <<EOH
8669
8670 I will use the "eval 'exec'" idiom to start Perl on your system.
8671 I can use the full path of your Perl binary for this purpose, but
8672 doing so may cause problems if you want to share those scripts and
8673 Perl is not always in a standard place ($initialinstalllocation/perl).
8674
8675 EOH
8676                 dflt="$initialinstalllocation/perl"
8677                 rp="What path shall I use in \"eval 'exec'\"?"
8678                 . ./myread
8679                 perlpath="$ans"
8680                 ;;
8681         esac
8682         ;;
8683 esac
8684 case "$startperl" in
8685 *!*)    ;;
8686 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8687 esac
8688
8689 : determine where public executable scripts go
8690 set scriptdir scriptdir
8691 eval $prefixit
8692 case "$scriptdir" in
8693 '')
8694         dflt="$bin"
8695         : guess some guesses
8696         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8697         $test -d /usr/share/bin     && dflt=/usr/share/bin
8698         $test -d /usr/local/script  && dflt=/usr/local/script
8699         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8700         $test -d $prefixexp/script  && dflt=$prefixexp/script
8701         set dflt
8702         eval $prefixup
8703         ;;
8704 *)  dflt="$scriptdir"
8705         ;;
8706 esac
8707 $cat <<EOM
8708
8709 Some installations have a separate directory just for executable scripts so
8710 that they can mount it across multiple architectures but keep the scripts in
8711 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8712 Or you might just lump your scripts in with all your other executables.
8713
8714 EOM
8715 fn=d~
8716 rp='Where do you keep publicly executable scripts?'
8717 . ./getfile
8718 if $test "X$ansexp" != "X$scriptdirexp"; then
8719         installscript=''
8720 fi
8721 installscriptdir=''
8722 prefixvar=scriptdir
8723 . ./setprefixvar
8724 : A little fix up for an irregularly named variable.
8725 installscript="$installscriptdir"
8726
8727 : determine where add-on public executables go
8728 case "$sitebin" in
8729 '')     dflt=$siteprefix/bin ;;
8730 *)      dflt=$sitebin ;;
8731 esac
8732 fn=d~
8733 rp='Pathname where the add-on public executables should be installed?'
8734 . ./getfile
8735 prefixvar=sitebin
8736 . ./setprefixvar
8737
8738 : determine where add-on html pages go
8739 : There is no standard location, so try to copy the previously-selected
8740 : directory structure for the core html pages.
8741 case "$sitehtml1dir" in
8742 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8743 *)     dflt=$sitehtml1dir ;;
8744 esac
8745 case "$dflt" in
8746 ''|' ') dflt=none ;;
8747 esac
8748 fn=dn+~
8749 rp='Pathname where the site-specific html pages should be installed?'
8750 . ./getfile
8751 prefixvar=sitehtml1dir
8752 . ./setprefixvar
8753
8754 : determine where add-on library html pages go
8755 : There is no standard location, so try to copy the previously-selected
8756 : directory structure for the core html pages.
8757 case "$sitehtml3dir" in
8758 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8759 *)     dflt=$sitehtml3dir ;;
8760 esac
8761 case "$dflt" in
8762 ''|' ') dflt=none ;;
8763 esac
8764 fn=dn+~
8765 rp='Pathname where the site-specific library html pages should be installed?'
8766 . ./getfile
8767 prefixvar=sitehtml3dir
8768 . ./setprefixvar
8769
8770 : determine where add-on manual pages go
8771 case "$siteman1dir" in
8772 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8773 *)      dflt=$siteman1dir ;;
8774 esac
8775 case "$dflt" in
8776 ''|' ') dflt=none ;;
8777 esac
8778 fn=dn+~
8779 rp='Pathname where the site-specific manual pages should be installed?'
8780 . ./getfile
8781 prefixvar=siteman1dir
8782 . ./setprefixvar
8783
8784 : determine where add-on library man pages go
8785 case "$siteman3dir" in
8786 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8787 *)      dflt=$siteman3dir ;;
8788 esac
8789 case "$dflt" in
8790 ''|' ') dflt=none ;;
8791 esac
8792 fn=dn+~
8793 rp='Pathname where the site-specific library manual pages should be installed?'
8794 . ./getfile
8795 prefixvar=siteman3dir
8796 . ./setprefixvar
8797
8798 : determine where add-on public executable scripts go
8799 case "$sitescript" in
8800 '')     dflt=$siteprefix/script
8801         $test -d $dflt || dflt=$sitebin ;;
8802 *)  dflt="$sitescript" ;;
8803 esac
8804 fn=d~+
8805 rp='Pathname where add-on public executable scripts should be installed?'
8806 . ./getfile
8807 prefixvar=sitescript
8808 . ./setprefixvar
8809
8810 case "$usefaststdio" in
8811 $define|true|[yY]*|'')
8812         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8813         case "$xversion" in
8814         [68])   dflt='y' ;;
8815         *)      dflt='n' ;;
8816         esac
8817         ;;
8818 *) dflt='n';;
8819 esac
8820 cat <<EOM
8821
8822 Perl can be built to use 'fast stdio', which means using the stdio
8823 library but also directly manipulating the stdio buffers to enable
8824 faster I/O.  Using stdio is better for backward compatibility (especially
8825 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8826 interface has been preferred instead of stdio.
8827
8828 If this doesn't make any sense to you, just accept the default '$dflt'.
8829 EOM
8830 rp='Use the "fast stdio" if available?'
8831 . ./myread
8832 case "$ans" in
8833 y|Y)    val="$define" ;;     
8834 *)      val="$undef" ;;
8835 esac
8836 set usefaststdio
8837 eval $setvar
8838
8839
8840 : define an is-a-typedef? function
8841 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8842 case "$inclist" in
8843 "") inclist="sys/types.h";;
8844 esac;
8845 eval "varval=\$$var";
8846 case "$varval" in
8847 "")
8848         $rm -f temp.c;
8849         for inc in $inclist; do
8850                 echo "#include <$inc>" >>temp.c;
8851         done;
8852         echo "#ifdef $type" >> temp.c;
8853         echo "printf(\"We have $type\");" >> temp.c;
8854         echo "#endif" >> temp.c;
8855         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8856         if $contains $type temp.E >/dev/null 2>&1; then
8857                 eval "$var=\$type";
8858         else
8859                 eval "$var=\$def";
8860         fi;
8861         $rm -f temp.?;;
8862 *) eval "$var=\$varval";;
8863 esac'
8864
8865 : define an is-a-typedef? function that prompts if the type is not available.
8866 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8867 case "$inclist" in
8868 "") inclist="sys/types.h";;
8869 esac;
8870 eval "varval=\$$var";
8871 case "$varval" in
8872 "")
8873         $rm -f temp.c;
8874         for inc in $inclist; do
8875                 echo "#include <$inc>" >>temp.c;
8876         done;
8877         echo "#ifdef $type" >> temp.c;
8878         echo "printf(\"We have $type\");" >> temp.c;
8879         echo "#endif" >> temp.c;
8880         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8881         echo " " ;
8882         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8883         if $contains $type temp.E >/dev/null 2>&1; then
8884                 echo "$type found." >&4;
8885                 eval "$var=\$type";
8886         else
8887                 echo "$type NOT found." >&4;
8888                 dflt="$def";
8889                 . ./myread ;
8890                 eval "$var=\$ans";
8891         fi;
8892         $rm -f temp.?;;
8893 *) eval "$var=\$varval";;
8894 esac'
8895
8896 : see what type lseek is declared as in the kernel
8897 rp="What is the type used for lseek's offset on this system?"
8898 set off_t lseektype long stdio.h sys/types.h
8899 eval $typedef_ask
8900
8901 echo " "
8902 echo "Checking to see how big your file offsets are..." >&4
8903 $cat >try.c <<EOCP
8904 #include <sys/types.h>
8905 #include <stdio.h>
8906 int main()
8907 {
8908     printf("%d\n", (int)sizeof($lseektype));
8909     return(0); 
8910 }
8911 EOCP
8912 set try
8913 if eval $compile_ok; then
8914         lseeksize=`$run ./try`
8915         echo "Your file offsets are $lseeksize bytes long."
8916 else
8917         dflt=$longsize
8918         echo " "
8919         echo "(I can't seem to compile the test program.  Guessing...)"
8920         rp="What is the size of your file offsets (in bytes)?"
8921         . ./myread
8922         lseeksize="$ans"
8923 fi
8924 $rm -f try.c try
8925
8926 : see what type file positions are declared as in the library
8927 rp="What is the type for file position used by fsetpos()?"
8928 set fpos_t fpostype long stdio.h sys/types.h
8929 eval $typedef_ask
8930
8931 echo " "
8932 case "$fpostype" in
8933 *_t) zzz="$fpostype"    ;;
8934 *)   zzz="fpos_t"       ;;
8935 esac
8936 echo "Checking the size of $zzz..." >&4 
8937 cat > try.c <<EOCP
8938 #include <sys/types.h>
8939 #include <stdio.h>
8940 #$i_stdlib I_STDLIB
8941 #ifdef I_STDLIB
8942 #include <stdlib.h>
8943 #endif
8944 int main() {
8945     printf("%d\n", (int)sizeof($fpostype));
8946     exit(0);
8947 }
8948 EOCP
8949 set try
8950 if eval $compile_ok; then
8951         yyy=`$run ./try`
8952         case "$yyy" in
8953         '')     fpossize=4
8954                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8955                 ;;
8956         *)      fpossize=$yyy
8957                 echo "Your $zzz is $fpossize bytes long."
8958                 ;;
8959         esac
8960 else
8961         dflt="$longsize"
8962         echo " " >&4
8963         echo "(I can't compile the test program.  Guessing...)" >&4
8964         rp="What is the size of your file positions (in bytes)?"
8965         . ./myread
8966         fpossize="$ans"
8967 fi
8968
8969 # Backward compatibility (uselfs is deprecated).
8970 case "$uselfs" in
8971 "$define"|true|[yY]*)
8972         cat <<EOM >&4
8973
8974 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8975 EOM
8976         uselargefiles="$define"
8977         ;;
8978 esac                          
8979
8980 case "$lseeksize:$fpossize" in
8981 8:8) cat <<EOM
8982
8983 You can have files larger than 2 gigabytes.
8984 EOM
8985    val="$define" ;;
8986 *)    case "$uselargefiles" in
8987    "$undef"|false|[nN]*) dflt='n' ;;
8988    *)   dflt='y' ;;
8989    esac
8990    cat <<EOM
8991
8992 Perl can be built to understand large files (files larger than 2 gigabytes)
8993 on some systems.  To do so, Configure can be run with -Duselargefiles.
8994
8995 If this doesn't make any sense to you, just accept the default '$dflt'.
8996 EOM
8997    rp='Try to understand large files, if available?'
8998    . ./myread
8999    case "$ans" in
9000    y|Y)         val="$define" ;;
9001    *)           val="$undef"  ;;
9002    esac
9003    ;;
9004 esac
9005 set uselargefiles
9006 eval $setvar
9007 : Look for a hint-file generated 'call-back-unit'.  If the
9008 : user has specified that a large files perl is to be built,
9009 : we may need to set or change some other defaults.
9010 if $test -f uselargefiles.cbu; then
9011         echo "Your platform has some specific hints regarding large file builds, using them..."
9012         . ./uselargefiles.cbu
9013 fi
9014 case "$uselargefiles" in
9015 "$define")
9016         if $test -f uselargefiles.cbu; then
9017                 echo " "
9018                 echo "Rechecking to see how big your file offsets are..." >&4
9019                 $cat >try.c <<EOCP
9020 #include <sys/types.h>
9021 #include <stdio.h>
9022 int main()
9023 {
9024     printf("%d\n", (int)sizeof($lseektype));
9025     return(0); 
9026 }
9027 EOCP
9028                 set try
9029                 if eval $compile_ok; then
9030                         lseeksize=`$run ./try`
9031                         $echo "Your file offsets are now $lseeksize bytes long."
9032                 else
9033                         dflt="$lseeksize"
9034                         echo " "
9035                         echo "(I can't seem to compile the test program.  Guessing...)"
9036                         rp="What is the size of your file offsets (in bytes)?"
9037                         . ./myread
9038                         lseeksize="$ans"
9039                 fi
9040                 case "$fpostype" in
9041                 *_t) zzz="$fpostype"    ;;
9042                 *)   zzz="fpos_t"       ;;
9043                 esac
9044                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9045                 $cat > try.c <<EOCP
9046 #include <sys/types.h>
9047 #include <stdio.h>
9048 #$i_stdlib I_STDLIB
9049 #ifdef I_STDLIB
9050 #include <stdlib.h>
9051 #endif
9052 int main() {
9053     printf("%d\n", (int)sizeof($fpostype));
9054     return(0);
9055 }
9056 EOCP
9057                 set try
9058                 if eval $compile_ok; then
9059                         yyy=`$run ./try`
9060                         dflt="$lseeksize"
9061                         case "$yyy" in
9062                         '')     echo " "
9063                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9064                                 ;;
9065                         *)      fpossize=$yyy
9066                                 echo " $fpossize bytes." >&4
9067                                 ;;
9068                         esac
9069                 else
9070                         dflt="$fpossize"
9071                         echo " "
9072                         echo "(I can't compile the test program.  Guessing...)" >&4
9073                         rp="What is the size of your file positions (in bytes)?"
9074                         . ./myread
9075                         fpossize="$ans"
9076                 fi
9077                 $rm -f try.c try
9078         fi
9079         ;;
9080 esac
9081
9082 case "$vendorprefix" in
9083 '')     d_vendorbin="$undef"
9084         vendorbin=''
9085         vendorbinexp=''
9086         ;;
9087 *)      d_vendorbin="$define"
9088         : determine where vendor-supplied executables go.
9089         case "$vendorbin" in
9090         '') dflt=$vendorprefix/bin ;;
9091         *)      dflt="$vendorbin" ;;
9092         esac
9093         fn=d~+
9094         rp='Pathname for the vendor-supplied executables directory?'
9095         . ./getfile
9096         vendorbin="$ans"
9097         vendorbinexp="$ansexp"
9098         ;;
9099 esac
9100 prefixvar=vendorbin
9101 . ./installprefix
9102
9103 case "$vendorprefix" in
9104 '')     vendorhtml1dir=''
9105         vendorhtml1direxp=''
9106         ;;
9107 *)      : determine where vendor-supplied html pages go.
9108         : There is no standard location, so try to copy the previously-selected
9109         : directory structure for the core html pages.
9110         : XXX Better default suggestions would be welcome.
9111         case "$vendorhtml1dir" in
9112         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9113         *)      dflt=$vendorhtml1dir ;;
9114         esac
9115         case "$dflt" in
9116         ''|' ') dflt=none ;;
9117         esac
9118         fn=dn+~
9119         rp='Pathname for the vendor-supplied html pages?'
9120         . ./getfile
9121         vendorhtml1dir="$ans"
9122         vendorhtml1direxp="$ansexp"
9123         ;;
9124 esac
9125 : Use ' ' for none so value is preserved next time through Configure
9126 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9127 prefixvar=vendorhtml1dir
9128 . ./installprefix
9129
9130 case "$vendorprefix" in
9131 '')     vendorhtml3dir=''
9132         vendorhtml3direxp=''
9133         ;;
9134 *)      : determine where vendor-supplied module html pages go.
9135         : There is no standard location, so try to copy the previously-selected
9136         : directory structure for the core html pages.
9137         : XXX Better default suggestions would be welcome.
9138         case "$vendorhtml3dir" in
9139         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9140         *)      dflt=$vendorhtml3dir ;;
9141         esac
9142         case "$dflt" in
9143         ''|' ') dflt=none ;;
9144         esac
9145         fn=dn+~
9146         rp='Pathname for the vendor-supplied html pages?'
9147         . ./getfile
9148         vendorhtml3dir="$ans"
9149         vendorhtml3direxp="$ansexp"
9150         ;;
9151 esac
9152 : Use ' ' for none so value is preserved next time through Configure
9153 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9154 prefixvar=vendorhtml3dir
9155 . ./installprefix
9156
9157 case "$vendorprefix" in
9158 '')     vendorman1dir=''
9159         vendorman1direxp=''
9160         ;;
9161 *)      : determine where vendor-supplied manual pages go.
9162         case "$vendorman1dir" in
9163         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9164         *)      dflt=$vendorman1dir ;;
9165         esac
9166         case "$dflt" in
9167         ''|' ') dflt=none ;;
9168         esac
9169         fn=nd~+
9170         rp='Pathname for the vendor-supplied manual section 1 pages?'
9171         . ./getfile
9172         vendorman1dir="$ans"
9173         vendorman1direxp="$ansexp"
9174         ;;
9175 esac
9176 : Use ' ' for none so value is preserved next time through Configure
9177 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9178 prefixvar=vendorman1dir
9179 . ./installprefix
9180
9181 case "$vendorprefix" in
9182 '')     vendorman3dir=''
9183         vendorman3direxp=''
9184         ;;
9185 *)      : determine where vendor-supplied module manual pages go.
9186         case "$vendorman3dir" in
9187         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9188         *)      dflt=$vendorman3dir ;;
9189         esac
9190         case "$dflt" in
9191         ''|' ') dflt=none ;;
9192         esac
9193         fn=nd~+
9194         rp='Pathname for the vendor-supplied manual section 3 pages?'
9195         . ./getfile
9196         vendorman3dir="$ans"
9197         vendorman3direxp="$ansexp"
9198         ;;
9199 esac
9200 : Use ' ' for none so value is preserved next time through Configure
9201 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9202 prefixvar=vendorman3dir
9203 . ./installprefix
9204
9205 case "$vendorprefix" in
9206 '')     d_vendorscript="$undef"
9207         vendorscript=''
9208         vendorscriptexp=''
9209         ;;
9210 *)      d_vendorscript="$define"
9211         : determine where vendor-supplied scripts go.
9212         case "$vendorscript" in
9213         '')     dflt=$vendorprefix/script
9214                 $test -d $dflt || dflt=$vendorbin ;;
9215         *)  dflt="$vendorscript" ;;
9216         esac
9217         $cat <<EOM
9218
9219 The installation process will create a directory for
9220 vendor-supplied scripts.
9221
9222 EOM
9223         fn=d~+
9224         rp='Pathname for the vendor-supplied scripts directory?'
9225         . ./getfile
9226         vendorscript="$ans"
9227         vendorscriptexp="$ansexp"
9228         ;;
9229 esac
9230 prefixvar=vendorscript
9231 . ./installprefix
9232
9233 : see if qgcvt exists
9234 set qgcvt d_qgcvt
9235 eval $inlibc
9236
9237 echo " "
9238
9239 if $test X"$d_longdbl" = X"$define"; then
9240
9241 echo "Checking how to print long doubles..." >&4
9242
9243 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9244         $cat >try.c <<'EOCP'
9245 #include <sys/types.h>
9246 #include <stdio.h>
9247 int main() {
9248   double d = 123.456;
9249   printf("%.3f\n", d);
9250 }
9251 EOCP
9252         set try
9253         if eval $compile; then
9254                 yyy=`$run ./try`
9255                 case "$yyy" in
9256                 123.456)
9257                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9258                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9259                         echo "We will use %f."
9260                         ;;
9261                 esac
9262         fi
9263 fi
9264
9265 if $test X"$sPRIfldbl" = X; then
9266         $cat >try.c <<'EOCP'
9267 #include <sys/types.h>
9268 #include <stdio.h>
9269 int main() {
9270   long double d = 123.456;
9271   printf("%.3Lf\n", d);
9272 }
9273 EOCP
9274         set try
9275         if eval $compile; then
9276                 yyy=`$run ./try`
9277                 case "$yyy" in
9278                 123.456)
9279                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9280                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9281                         echo "We will use %Lf."
9282                         ;;
9283                 esac
9284         fi
9285 fi
9286
9287 if $test X"$sPRIfldbl" = X; then
9288         $cat >try.c <<'EOCP'
9289 #include <sys/types.h>
9290 #include <stdio.h>
9291 int main() {
9292   long double d = 123.456;
9293   printf("%.3llf\n", d);
9294 }
9295 EOCP
9296         set try
9297         if eval $compile; then
9298                 yyy=`$run ./try`
9299                 case "$yyy" in
9300                 123.456)
9301                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9302                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9303                         echo "We will use %llf."
9304                         ;;
9305                 esac
9306         fi
9307 fi
9308
9309 if $test X"$sPRIfldbl" = X; then
9310         $cat >try.c <<'EOCP'
9311 #include <sys/types.h>
9312 #include <stdio.h>
9313 int main() {
9314   long double d = 123.456;
9315   printf("%.3lf\n", d);
9316 }
9317 EOCP
9318         set try
9319         if eval $compile; then
9320                 yyy=`$run ./try`
9321                 case "$yyy" in
9322                 123.456)
9323                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9324                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9325                         echo "We will use %lf."
9326                         ;;
9327                 esac
9328         fi
9329 fi
9330
9331 if $test X"$sPRIfldbl" = X; then
9332         echo "Cannot figure out how to print long doubles." >&4
9333 else
9334         sSCNfldbl=$sPRIfldbl    # expect consistency
9335 fi
9336
9337 $rm -f try try.*
9338
9339 fi # d_longdbl
9340
9341 case "$sPRIfldbl" in
9342 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9343         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9344         d_SCNfldbl="$undef";
9345         ;;
9346 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9347         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9348         d_SCNfldbl="$define";
9349         ;;
9350 esac
9351
9352 : Check how to convert floats to strings.
9353
9354 if test "X$d_Gconvert" = X; then
9355
9356 echo " "
9357 echo "Checking for an efficient way to convert floats to strings."
9358 echo " " > try.c
9359 case "$uselongdouble" in
9360 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9361 esac
9362 case "$d_longdbl" in
9363 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9364 esac
9365 case "$d_PRIgldbl" in
9366 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9367 esac
9368 $cat >>try.c <<EOP
9369 #ifdef TRY_gconvert
9370 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9371 char *myname = "gconvert";
9372 #endif
9373 #ifdef TRY_gcvt
9374 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9375 char *myname = "gcvt";
9376 #endif
9377 #ifdef TRY_qgcvt
9378 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9379 char *myname = "qgcvt";
9380 #define DOUBLETYPE long double
9381 #endif
9382 #ifdef TRY_sprintf
9383 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9384 #ifdef HAS_PRIgldbl
9385 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9386 #else
9387 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9388 #endif
9389 #else
9390 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9391 #endif
9392 char *myname = "sprintf";
9393 #endif
9394
9395 #ifndef DOUBLETYPE
9396 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9397 #define DOUBLETYPE long double
9398 #else
9399 #define DOUBLETYPE double
9400 #endif
9401 #endif
9402
9403 #include <stdio.h>
9404
9405 #define I_STDLIB $i_stdlib
9406 #ifdef I_STDLIB
9407 #include <stdlib.h>
9408 #endif
9409
9410 int
9411 checkit(expect, got)
9412 char *expect;
9413 char *got;
9414 {
9415     if (strcmp(expect, got)) {
9416                 printf("%s oddity:  Expected %s, got %s\n",
9417                         myname, expect, got);
9418                 exit(1);
9419         }
9420 }
9421
9422 int main()
9423
9424         char buf[64]; 
9425         buf[63] = '\0';
9426
9427         /* This must be 1st test on (which?) platform */
9428         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9429         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9430         checkit("0.1", buf);
9431
9432         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9433         checkit("0.01", buf);
9434
9435         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9436         checkit("0.001", buf);
9437
9438         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9439         checkit("0.0001", buf);
9440
9441         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9442         if (strlen(buf) > 5)
9443             checkit("9e-005", buf); /* for Microsoft ?? */
9444         else
9445             checkit("9e-05", buf);
9446
9447         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9448         checkit("1", buf);
9449
9450         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9451         checkit("1.1", buf);
9452
9453         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9454         checkit("1.01", buf);
9455
9456         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9457         checkit("1.001", buf);
9458
9459         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9460         checkit("1.0001", buf);
9461
9462         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9463         checkit("1.00001", buf);
9464
9465         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9466         checkit("1.000001", buf);
9467
9468         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9469         checkit("0", buf);
9470
9471         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9472         checkit("-1", buf);
9473
9474         /* Some Linux gcvt's give 1.e+5 here. */
9475         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9476         checkit("100000", buf);
9477         
9478         /* Some Linux gcvt's give -1.e+5 here. */
9479         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9480         checkit("-100000", buf);
9481
9482         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9483         checkit("123.456", buf);
9484
9485         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9486         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9487         /* 34 should be enough to scare even long double
9488          * places into using the e notation. */
9489         if (strlen(buf) > 5)
9490             checkit("1e+034", buf); /* for Microsoft */
9491         else
9492             checkit("1e+34", buf);
9493
9494         /* For Perl, if you add additional tests here, also add them to
9495          * t/base/num.t for benefit of platforms not using Configure or
9496          * overriding d_Gconvert */
9497
9498         exit(0);
9499 }
9500 EOP
9501 : first add preferred functions to our list
9502 xxx_list=""
9503 for xxx_convert in $gconvert_preference; do
9504     case $xxx_convert in
9505     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9506     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9507     esac 
9508 done
9509 : then add any others
9510 for xxx_convert in gconvert gcvt sprintf; do
9511     case "$xxx_list" in
9512     *$xxx_convert*) ;;
9513     *) xxx_list="$xxx_list $xxx_convert" ;;
9514     esac 
9515 done
9516
9517 case "$d_longdbl$uselongdouble" in
9518 "$define$define")
9519     : again, add prefered functions to our list first
9520     xxx_ld_list=""
9521     for xxx_convert in $gconvert_ld_preference; do
9522         case $xxx_convert in
9523         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9524         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9525         esac
9526     done
9527     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9528     for xxx_convert in qgcvt sprintf $xxx_list; do
9529         case "$xxx_ld_list" in
9530         $xxx_convert*|*" $xxx_convert"*) ;;
9531         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9532         esac
9533     done
9534     : if sprintf cannot do long doubles, move it to the end
9535     if test "$d_PRIgldbl" != "$define"; then
9536         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9537     fi
9538     : if no qgcvt, remove it
9539     if test "$d_qgcvt" != "$define"; then
9540         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9541     fi
9542     : use the ld_list
9543     xxx_list="$xxx_ld_list"
9544     ;;
9545 esac
9546
9547 for xxx_convert in $xxx_list; do
9548         echo "Trying $xxx_convert..."
9549         $rm -f try try$_o
9550         set try -DTRY_$xxx_convert
9551         if eval $compile; then
9552                 echo "$xxx_convert() found." >&4
9553                 if $run ./try; then
9554                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9555                         break;
9556                 else
9557                         echo "...But $xxx_convert didn't work as I expected."
9558                         xxx_convert=''
9559                 fi
9560         else
9561                 echo "$xxx_convert NOT found." >&4
9562         fi
9563 done
9564
9565 if test X$xxx_convert = X; then
9566     echo "*** WHOA THERE!!! ***" >&4
9567     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9568     xxx_convert=sprintf
9569 fi
9570
9571 case "$xxx_convert" in
9572 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9573 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9574 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9575 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9576    "$define$define$define")
9577       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9578    "$define$define$undef")
9579       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9580    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9581    esac
9582    ;;  
9583 esac
9584
9585 fi
9586
9587 : see if _fwalk exists
9588 set fwalk d__fwalk
9589 eval $inlibc
9590
9591 : Initialize h_fcntl
9592 h_fcntl=false
9593
9594 : Initialize h_sysfile
9595 h_sysfile=false
9596
9597 : access call always available on UNIX
9598 set access d_access
9599 eval $inlibc
9600
9601 : locate the flags for 'access()'
9602 case "$d_access" in
9603 "$define")
9604         echo " "
9605         $cat >access.c <<EOCP
9606 #include <sys/types.h>
9607 #ifdef I_FCNTL
9608 #include <fcntl.h>
9609 #endif
9610 #ifdef I_SYS_FILE
9611 #include <sys/file.h>
9612 #endif
9613 #ifdef I_UNISTD
9614 #include <unistd.h>
9615 #endif
9616 #$i_stdlib I_STDLIB
9617 #ifdef I_STDLIB
9618 #include <stdlib.h>
9619 #endif
9620 int main() {
9621         exit(R_OK);
9622 }
9623 EOCP
9624         : check sys/file.h first, no particular reason here
9625         if $test `./findhdr sys/file.h` && \
9626                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9627                 h_sysfile=true;
9628                 echo "<sys/file.h> defines the *_OK access constants." >&4
9629         elif $test `./findhdr fcntl.h` && \
9630                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9631                 h_fcntl=true;
9632                 echo "<fcntl.h> defines the *_OK access constants." >&4
9633         elif $test `./findhdr unistd.h` && \
9634                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9635                 echo "<unistd.h> defines the *_OK access constants." >&4
9636         else
9637                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9638         fi
9639         ;;
9640 esac
9641 $rm -f access*
9642
9643 : see if accessx exists
9644 set accessx d_accessx
9645 eval $inlibc
9646
9647 : see if aintl exists
9648 set aintl d_aintl
9649 eval $inlibc
9650
9651 : see if alarm exists
9652 set alarm d_alarm
9653 eval $inlibc
9654
9655 : see if POSIX threads are available
9656 set pthread.h i_pthread
9657 eval $inhdr
9658
9659 : define a fucntion to check prototypes
9660 $cat > protochk <<EOSH
9661 $startsh
9662 cc="$cc"
9663 optimize="$optimize"
9664 ccflags="$ccflags"
9665 prototype="$prototype"
9666 define="$define"
9667 rm=$rm
9668 usethreads=$usethreads
9669 i_pthread=$i_pthread
9670 pthread_h_first=$pthread_h_first
9671 EOSH
9672
9673 $cat >> protochk <<'EOSH'
9674
9675 $rm -f try.c
9676 foo="$1"
9677 shift
9678 while test $# -ge 2; do
9679         case "$1" in
9680                 $define) echo "#include <$2>" >> try.c ;;
9681                 literal) echo "$2" >> try.c ;;
9682         esac
9683     # Extra magic for the benefit of systems that need pthread.h
9684     # to be included early to correctly detect threadsafe functions.
9685     # Such functions must guarantee themselves, though, that the usethreads
9686     # and i_pthread have been defined, before calling protochk.
9687     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9688         echo "#include <pthread.h>" >> try.c
9689         pthread_h_done=yes
9690     fi
9691     shift 2
9692 done
9693 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9694 cat >> try.c <<'EOCP'
9695 #ifdef CAN_PROTOTYPE
9696 #define _(args) args
9697 #else
9698 #define _(args) ()
9699 #endif
9700 EOCP
9701 echo "$foo" >> try.c
9702 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9703 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9704 status=$?
9705 $rm -f try.[co]
9706 exit $status
9707 EOSH
9708 chmod +x protochk
9709 $eunicefix protochk
9710
9711 hasproto='varname=$1; func=$2; shift; shift;
9712 while $test $# -ge 2; do
9713         case "$1" in
9714         $define) echo "#include <$2>";;
9715         esac ;
9716     shift 2;
9717 done > try.c;
9718 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9719 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9720         echo "$func() prototype found.";
9721         val="$define";
9722 else
9723         echo "$func() prototype NOT found.";
9724         val="$undef";
9725 fi;
9726 set $varname;
9727 eval $setvar;
9728 $rm -f try.c tryout.c'
9729
9730 : see if sys/types.h has to be included
9731 set sys/types.h i_systypes
9732 eval $inhdr
9733
9734 : see if sys/select.h has to be included
9735 set sys/select.h i_sysselct
9736 eval $inhdr
9737
9738 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9739 while $test $# -ge 2; do
9740         case "$1" in
9741         $define) echo "#include <$2>";;
9742         esac ;
9743     shift 2;
9744 done > try.c;
9745 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9746 set try;
9747 if eval $compile; then
9748         val="$define";
9749 else
9750         val="$undef";
9751 fi;
9752 set $varname;
9753 eval $setvar;
9754 $rm -f try.c try.o'
9755
9756 : see if we should include time.h, sys/time.h, or both
9757 echo " "
9758 if test "X$timeincl" = X; then
9759         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9760         $echo $n "I'm now running the test program...$c"
9761         $cat >try.c <<EOCP
9762 #include <sys/types.h>
9763 #ifdef I_TIME
9764 #include <time.h>
9765 #endif
9766 #ifdef I_SYSTIME
9767 #ifdef SYSTIMEKERNEL
9768 #define KERNEL
9769 #endif
9770 #include <sys/time.h>
9771 #endif
9772 #ifdef I_SYSSELECT
9773 #include <sys/select.h>
9774 #endif
9775 #$i_stdlib I_STDLIB
9776 #ifdef I_STDLIB
9777 #include <stdlib.h>
9778 #endif
9779 int main()
9780 {
9781         struct tm foo;
9782 #ifdef S_TIMEVAL
9783         struct timeval bar;
9784 #endif
9785 #ifdef S_TIMEZONE
9786         struct timezone tzp;
9787 #endif
9788         if (foo.tm_sec == foo.tm_sec)
9789                 exit(0);
9790 #ifdef S_TIMEVAL
9791         if (bar.tv_sec == bar.tv_sec)
9792                 exit(0);
9793 #endif
9794         exit(1);
9795 }
9796 EOCP
9797         flags=''
9798         for s_timezone in '-DS_TIMEZONE' ''; do
9799         sysselect=''
9800         for s_timeval in '-DS_TIMEVAL' ''; do
9801         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9802         for i_time in '' '-DI_TIME'; do
9803         for i_systime in '-DI_SYSTIME' ''; do
9804                 case "$flags" in
9805                 '') $echo $n ".$c"
9806                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9807                         if eval $compile; then
9808                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9809                                 shift
9810                                 flags="$*"
9811                                 echo " "
9812                                 $echo $n "Succeeded with $flags$c"
9813                         fi
9814                         ;;
9815                 esac
9816         done
9817         done
9818         done
9819         done
9820         done
9821         timeincl=''
9822         echo " "
9823         case "$flags" in
9824         *SYSTIMEKERNEL*) i_systimek="$define"
9825                 timeincl=`./findhdr sys/time.h`
9826                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9827         *) i_systimek="$undef";;
9828         esac
9829         case "$flags" in
9830         *I_TIME*) i_time="$define"
9831                 timeincl=`./findhdr time.h`" $timeincl"
9832                 echo "We'll include <time.h>." >&4;;
9833         *) i_time="$undef";;
9834         esac
9835         case "$flags" in
9836         *I_SYSTIME*) i_systime="$define"
9837                 timeincl=`./findhdr sys/time.h`" $timeincl"
9838                 echo "We'll include <sys/time.h>." >&4;;
9839         *) i_systime="$undef";;
9840         esac
9841         $rm -f try.c try
9842 fi
9843 : see if struct tm knows about tm_zone
9844 case "$i_systime$i_time" in
9845 *$define*) 
9846         echo " "
9847         echo "Checking to see if your struct tm has tm_zone field..." >&4
9848         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9849         eval $hasfield
9850         ;;
9851 *)      val="$undef"
9852         set d_tm_tm_zone
9853         eval $setvar
9854         ;;
9855 esac
9856 case "$d_tm_tm_zone" in
9857 "$define")      echo "Yes, it does."   ;;
9858 *)              echo "No, it doesn't." ;;
9859 esac
9860 : see if struct tm knows about tm_gmtoff
9861 case "$i_systime$i_time" in
9862 *$define*) 
9863         echo " "
9864         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9865         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9866         eval $hasfield
9867         ;;
9868 *)      val="$undef"
9869         set d_tm_tm_gmtoff
9870         eval $setvar
9871         ;;
9872 esac
9873 case "$d_tm_tm_gmtoff" in
9874 "$define")      echo "Yes, it does."   ;;
9875 *)              echo "No, it doesn't." ;;
9876 esac
9877
9878 : see if asctime_r exists
9879 set asctime_r d_asctime_r
9880 eval $inlibc
9881 case "$d_asctime_r" in
9882 "$define")
9883         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9884         case "$d_asctime_r_proto:$usethreads" in
9885         ":define")      d_asctime_r_proto=define
9886                 set d_asctime_r_proto asctime_r $hdrs
9887                 eval $hasproto ;;
9888         *)      ;;
9889         esac
9890         case "$d_asctime_r_proto" in
9891         define)
9892         case "$asctime_r_proto" in
9893         ''|0) try='char* asctime_r(const struct tm*, char*);'
9894         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9895         esac
9896         case "$asctime_r_proto" in
9897         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9898         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9899         esac
9900         case "$asctime_r_proto" in
9901         ''|0) try='int asctime_r(const struct tm*, char*);'
9902         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9903         esac
9904         case "$asctime_r_proto" in
9905         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9906         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9907         esac
9908         case "$asctime_r_proto" in
9909         ''|0)   d_asctime_r=undef
9910                 asctime_r_proto=0
9911                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9912         * )     case "$asctime_r_proto" in
9913                 REENTRANT_PROTO*) ;;
9914                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9915                 esac
9916                 echo "Prototype: $try" ;;
9917         esac
9918         ;;
9919         *)      case "$usethreads" in
9920                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9921                 esac
9922                 d_asctime_r=undef
9923                 asctime_r_proto=0
9924                 ;;
9925         esac
9926         ;;
9927 *)      asctime_r_proto=0
9928         ;;
9929 esac
9930
9931 : see if atolf exists
9932 set atolf d_atolf
9933 eval $inlibc
9934
9935 : see if atoll exists
9936 set atoll d_atoll
9937 eval $inlibc
9938
9939 : Look for GCC-style attribute format
9940 case "$d_attribute_format" in
9941 '')
9942 echo " "
9943 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9944 $cat >attrib.c <<'EOCP'
9945 #include <stdio.h>
9946 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9947 EOCP
9948 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9949         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9950                 echo "Your C compiler doesn't support __attribute__((format))."
9951                 val="$undef"
9952         else
9953                 echo "Your C compiler supports __attribute__((format))."
9954                 val="$define"
9955         fi
9956 else
9957         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9958         val="$undef"
9959 fi
9960 ;;
9961 *) val="$d_attribute_format" ;;
9962 esac
9963 set d_attribute_format
9964 eval $setvar
9965 $rm -f attrib*
9966
9967 : Look for GCC-style attribute malloc
9968 case "$d_attribute_malloc" in
9969 '')
9970 echo " "
9971 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9972 $cat >attrib.c <<'EOCP'
9973 #include <stdio.h>
9974 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9975 EOCP
9976 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9977         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9978                 echo "Your C compiler doesn't support __attribute__((malloc))."
9979                 val="$undef"
9980         else
9981                 echo "Your C compiler supports __attribute__((malloc))."
9982                 val="$define"
9983         fi
9984 else
9985         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9986         val="$undef"
9987 fi
9988 ;;
9989 *) val="$d_attribute_malloc" ;;
9990 esac
9991 set d_attribute_malloc
9992 eval $setvar
9993 $rm -f attrib*
9994
9995 : Look for GCC-style attribute nonnull
9996 case "$d_attribute_nonnull" in
9997 '')
9998 echo " "
9999 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10000 $cat >attrib.c <<'EOCP'
10001 #include <stdio.h>
10002 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10003 EOCP
10004 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10005         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10006                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10007                 val="$undef"
10008         else
10009                 echo "Your C compiler supports __attribute__((nonnull))."
10010                 val="$define"
10011         fi
10012 else
10013         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10014         val="$undef"
10015 fi
10016 ;;
10017 *) val="$d_attribute_nonnull" ;;
10018 esac
10019 set d_attribute_nonnull
10020 eval $setvar
10021 $rm -f attrib*
10022
10023 : Look for GCC-style attribute noreturn
10024 case "$d_attribute_noreturn" in
10025 '')
10026 echo " "
10027 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10028 $cat >attrib.c <<'EOCP'
10029 #include <stdio.h>
10030 void fall_over_dead( void ) __attribute__((noreturn));
10031 EOCP
10032 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10033         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10034                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10035                 val="$undef"
10036         else
10037                 echo "Your C compiler supports __attribute__((noreturn))."
10038                 val="$define"
10039         fi
10040 else
10041         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10042         val="$undef"
10043 fi
10044 ;;
10045 *) val="$d_attribute_noreturn" ;;
10046 esac
10047 set d_attribute_noreturn
10048 eval $setvar
10049 $rm -f attrib*
10050
10051 : Look for GCC-style attribute pure
10052 case "$d_attribute_pure" in
10053 '')
10054 echo " "
10055 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10056 $cat >attrib.c <<'EOCP'
10057 #include <stdio.h>
10058 int square( int n ) __attribute__((pure));
10059 EOCP
10060 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10061         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10062                 echo "Your C compiler doesn't support __attribute__((pure))."
10063                 val="$undef"
10064         else
10065                 echo "Your C compiler supports __attribute__((pure))."
10066                 val="$define"
10067         fi
10068 else
10069         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10070         val="$undef"
10071 fi
10072 ;;
10073 *) val="$d_attribute_pure" ;;
10074 esac
10075 set d_attribute_pure
10076 eval $setvar
10077 $rm -f attrib*
10078
10079 : Look for GCC-style attribute unused
10080 case "$d_attribute_unused" in
10081 '')
10082 echo " "
10083 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10084 $cat >attrib.c <<'EOCP'
10085 #include <stdio.h>
10086 int do_something( int dummy __attribute__((unused)), int n );
10087 EOCP
10088 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10089         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10090                 echo "Your C compiler doesn't support __attribute__((unused))."
10091                 val="$undef"
10092         else
10093                 echo "Your C compiler supports __attribute__((unused))."
10094                 val="$define"
10095         fi
10096 else
10097         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10098         val="$undef"
10099 fi
10100 ;;
10101 *) val="$d_attribute_unused" ;;
10102 esac
10103 set d_attribute_unused
10104 eval $setvar
10105 $rm -f attrib*
10106
10107 : Look for GCC-style attribute warn_unused_result
10108 case "$d_attribute_warn_unused_result" in
10109 '')
10110 echo " "
10111 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10112 $cat >attrib.c <<'EOCP'
10113 #include <stdio.h>
10114 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10115 EOCP
10116 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10117         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10118                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10119                 val="$undef"
10120         else
10121                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10122                 val="$define"
10123         fi
10124 else
10125         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10126         val="$undef"
10127 fi
10128 ;;
10129 *) val="$d_attribute_warn_unused_result" ;;
10130 esac
10131 set d_attribute_warn_unused_result
10132 eval $setvar
10133 $rm -f attrib*
10134
10135 : see if bcmp exists
10136 set bcmp d_bcmp
10137 eval $inlibc
10138
10139 : see if bcopy exists
10140 set bcopy d_bcopy
10141 eval $inlibc
10142
10143 : see if getpgrp exists
10144 set getpgrp d_getpgrp
10145 eval $inlibc
10146
10147 case "$d_getpgrp" in
10148 "$define")
10149         echo " "
10150         echo "Checking to see which flavor of getpgrp is in use..."
10151         $cat >try.c <<EOP
10152 #$i_unistd I_UNISTD
10153 #include <sys/types.h>
10154 #ifdef I_UNISTD
10155 #  include <unistd.h>
10156 #endif
10157 #$i_stdlib I_STDLIB
10158 #ifdef I_STDLIB
10159 #include <stdlib.h>
10160 #endif
10161 int main()
10162 {
10163         if (getuid() == 0) {
10164                 printf("(I see you are running Configure as super-user...)\n");
10165                 setuid(1);
10166         }
10167 #ifdef TRY_BSD_PGRP
10168         if (getpgrp(1) == 0)
10169                 exit(0);
10170 #else
10171         if (getpgrp() > 0)
10172                 exit(0);
10173 #endif
10174         exit(1);
10175 }
10176 EOP
10177         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10178                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10179                 val="$define"
10180         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10181                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10182                 val="$undef"
10183         else
10184                 echo "I can't seem to compile and run the test program."
10185                 if ./usg; then
10186                         xxx="a USG one, i.e. you use getpgrp()."
10187                 else
10188                         # SVR4 systems can appear rather BSD-ish.
10189                         case "$i_unistd" in
10190                         $undef)
10191                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10192                                 val="$define"
10193                                 ;;
10194                         $define)
10195                                 xxx="probably a USG one, i.e. you use getpgrp()."
10196                                 val="$undef"
10197                                 ;;
10198                         esac
10199                 fi
10200                 echo "Assuming your getpgrp is $xxx" >&4
10201         fi
10202         ;;
10203 *) val="$undef";;
10204 esac
10205 set d_bsdgetpgrp
10206 eval $setvar
10207 $rm -f try try.*
10208
10209 : see if setpgrp exists
10210 set setpgrp d_setpgrp
10211 eval $inlibc
10212
10213 case "$d_setpgrp" in
10214 "$define")
10215         echo " "
10216         echo "Checking to see which flavor of setpgrp is in use..."
10217         $cat >try.c <<EOP
10218 #$i_unistd I_UNISTD
10219 #include <sys/types.h>
10220 #ifdef I_UNISTD
10221 #  include <unistd.h>
10222 #endif
10223 #$i_stdlib I_STDLIB
10224 #ifdef I_STDLIB
10225 #include <stdlib.h>
10226 #endif
10227 int main()
10228 {
10229         if (getuid() == 0) {
10230                 printf("(I see you are running Configure as super-user...)\n");
10231                 setuid(1);
10232         }
10233 #ifdef TRY_BSD_PGRP
10234         if (-1 == setpgrp(1, 1))
10235                 exit(0);
10236 #else
10237         if (setpgrp() != -1)
10238                 exit(0);
10239 #endif
10240         exit(1);
10241 }
10242 EOP
10243         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10244                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10245                 val="$define"
10246         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10247                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10248                 val="$undef"
10249         else
10250                 echo "(I can't seem to compile and run the test program.)"
10251                 if ./usg; then
10252                         xxx="a USG one, i.e. you use setpgrp()."
10253                 else
10254                         # SVR4 systems can appear rather BSD-ish.
10255                         case "$i_unistd" in
10256                         $undef)
10257                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10258                                 val="$define"
10259                                 ;;
10260                         $define)
10261                                 xxx="probably a USG one, i.e. you use setpgrp()."
10262                                 val="$undef"
10263                                 ;;
10264                         esac
10265                 fi
10266                 echo "Assuming your setpgrp is $xxx" >&4
10267         fi
10268         ;;
10269 *) val="$undef";;
10270 esac
10271 set d_bsdsetpgrp
10272 eval $setvar
10273 $rm -f try try.*
10274 : Look for GCC-style __builtin_choose_expr
10275 case "$d_builtin_choose_expr" in
10276 '')
10277     echo " "
10278     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10279     $cat >try.c <<'EOCP'
10280 #include <assert.h>
10281 #include <stdlib.h>
10282 #include <stdio.h>
10283
10284 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10285
10286 int main(void) {
10287     assert( SYRINX(1) == 2112 );
10288     assert( SYRINX(1) != 5150 );
10289     assert( SYRINX(0) == 5150 );
10290     assert( SYRINX(0) != 2112 );
10291     puts( "All good!" );
10292     exit(0);
10293 }
10294
10295 EOCP
10296     set try
10297     if eval $compile; then
10298         echo "Your C compiler supports __builtin_choose_expr."
10299         val="$define"
10300     else
10301         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10302         val="$undef"
10303     fi
10304 ;;
10305 *) val="$d_builtin_choose_expr" ;;
10306 esac
10307
10308 set d_builtin_choose_expr
10309 eval $setvar
10310 $rm -f try.* try core core.try.*
10311
10312 : Look for GCC-style __builtin_expect
10313 case "$d_builtin_expect" in
10314 '')
10315     echo " "
10316     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10317     $cat >builtin.c <<'EOCP'
10318 int main(void) {
10319     int n = 50;
10320     if ( __builtin_expect(n, 0) ) n = 1;
10321 }
10322 EOCP
10323     set try
10324     if eval $compile; then
10325         echo "Your C compiler supports __builtin_choose_expr."
10326         val="$define"
10327     else
10328         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10329         val="$undef"
10330     fi
10331     ;;
10332 *) val="$d_builtin_expect" ;;
10333 esac
10334
10335 set d_builtin_expect
10336 eval $setvar
10337 $rm -f try.* try core core.try.*
10338
10339 : see if bzero exists
10340 set bzero d_bzero
10341 eval $inlibc
10342
10343 : see if stdarg is available
10344 echo " "
10345 if $test `./findhdr stdarg.h`; then
10346         echo "<stdarg.h> found." >&4
10347         valstd="$define"
10348 else
10349         echo "<stdarg.h> NOT found." >&4
10350         valstd="$undef"
10351 fi
10352
10353 : see if varags is available
10354 echo " "
10355 if $test `./findhdr varargs.h`; then
10356         echo "<varargs.h> found." >&4
10357 else
10358         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10359 fi
10360
10361 : set up the varargs testing programs
10362 $cat > varargs.c <<EOP
10363 #ifdef I_STDARG
10364 #include <stdarg.h>
10365 #endif
10366 #ifdef I_VARARGS
10367 #include <varargs.h>
10368 #endif
10369
10370 #ifdef I_STDARG
10371 int f(char *p, ...)
10372 #else
10373 int f(va_alist)
10374 va_dcl
10375 #endif
10376 {
10377         va_list ap;
10378 #ifndef I_STDARG
10379         char *p;
10380 #endif
10381 #ifdef I_STDARG
10382         va_start(ap,p);
10383 #else
10384         va_start(ap);
10385         p = va_arg(ap, char *);
10386 #endif
10387         va_end(ap);
10388         return 0;
10389 }
10390 EOP
10391 $cat > varargs <<EOP
10392 $startsh
10393 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10394         echo "true"
10395 else
10396         echo "false"
10397 fi
10398 $rm -f varargs$_o
10399 EOP
10400 chmod +x varargs
10401
10402 : now check which varargs header should be included
10403 echo " "
10404 i_varhdr=''
10405 case "$valstd" in
10406 "$define")
10407         if `./varargs I_STDARG`; then
10408                 val='stdarg.h'
10409         elif `./varargs I_VARARGS`; then
10410                 val='varargs.h'
10411         fi
10412         ;;
10413 *)
10414         if `./varargs I_VARARGS`; then
10415                 val='varargs.h'
10416         fi
10417         ;;
10418 esac
10419 case "$val" in
10420 '')
10421 echo "I could not find the definition for va_dcl... You have problems..." >&4
10422         val="$undef"; set i_stdarg; eval $setvar
10423         val="$undef"; set i_varargs; eval $setvar
10424         ;;
10425 *) 
10426         set i_varhdr
10427         eval $setvar
10428         case "$i_varhdr" in
10429         stdarg.h)
10430                 val="$define"; set i_stdarg; eval $setvar
10431                 val="$undef"; set i_varargs; eval $setvar
10432                 ;;
10433         varargs.h)
10434                 val="$undef"; set i_stdarg; eval $setvar
10435                 val="$define"; set i_varargs; eval $setvar
10436                 ;;
10437         esac
10438         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10439 esac
10440 $rm -f varargs*
10441
10442 : see if the Compiler supports C99 variadic macros
10443 case "$i_stdarg$i_stdlib" in
10444     "$define$define")
10445     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10446     $cat >try.c <<EOCP
10447 #include <stdio.h>
10448 #include <stdarg.h>
10449
10450 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10451
10452 int main() {
10453   char buf[20];
10454   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10455   puts(buf);
10456   return 0;
10457 }
10458 EOCP
10459     set try
10460     if eval $compile && $run ./try 2>&1 >/dev/null; then
10461         case "`$run ./try`" in
10462             "123 456 789")
10463             echo "You have C99 variadic macros." >&4
10464             d_c99_variadic_macros="$define"
10465             ;;
10466             *)
10467             echo "You don't have functional C99 variadic macros." >&4
10468             d_c99_variadic_macros="$undef"
10469             ;;
10470         esac
10471     else
10472         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10473         d_c99_variadic_macros="$undef"
10474     fi
10475     $rm -f try.* try core core.try.*
10476     ;;
10477     *)
10478     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10479     d_c99_variadic_macros="$undef"
10480     ;;
10481 esac
10482
10483 : see if signal is declared as pointer to function returning int or void
10484 echo " "
10485 xxx=`./findhdr signal.h`
10486 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10487 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10488         echo "You have int (*signal())() instead of void." >&4
10489         val="$undef"
10490 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10491         echo "You have void (*signal())()." >&4
10492         val="$define"
10493 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10494         echo "You have int (*signal())() instead of void." >&4
10495         val="$undef"
10496 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10497         echo "You have void (*signal())()." >&4
10498         val="$define"
10499 else
10500         case "$d_voidsig" in
10501         '')
10502         echo "I can't determine whether signal handler returns void or int..." >&4
10503                 dflt=void
10504                 rp="What type does your signal handler return?"
10505                 . ./myread
10506                 case "$ans" in
10507                 v*) val="$define";;
10508                 *) val="$undef";;
10509                 esac;;
10510         "$define")
10511                 echo "As you already told me, signal handler returns void." >&4
10512                 val="$define"
10513                 ;;
10514         *)      echo "As you already told me, signal handler returns int." >&4
10515                 val="$undef"
10516                 ;;
10517         esac
10518 fi
10519 set d_voidsig
10520 eval $setvar
10521 case "$d_voidsig" in
10522 "$define") signal_t="void";;
10523 *) signal_t="int";;
10524 esac
10525 $rm -f $$.tmp
10526
10527 : check for ability to cast large floats to 32-bit ints.
10528 echo " "
10529 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10530 if $test "$intsize" -ge 4; then
10531         xxx=int
10532 else
10533         xxx=long
10534 fi
10535 $cat >try.c <<EOCP
10536 #include <stdio.h>
10537 #$i_stdlib I_STDLIB
10538 #ifdef I_STDLIB
10539 #include <stdlib.h>
10540 #endif
10541 #include <sys/types.h>
10542 #include <signal.h>
10543 $signal_t blech(int s) { exit(3); }
10544 int main()
10545 {
10546         $xxx i32;
10547         double f, g;
10548         int result = 0;
10549         char str[16];
10550         signal(SIGFPE, blech);
10551
10552         /* Don't let compiler optimize the test away.  Store the number 
10553            in a writable string for gcc to pass to sscanf under HP/UX.
10554         */
10555         sprintf(str, "2147483647");
10556         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10557         g = 10 * f;
10558         i32  = ($xxx) g;
10559
10560         /* x86 processors will probably give 0x8000 0000, which is a
10561            sign change.  We don't want that.  We want to mimic SPARC
10562            behavior here, which is to preserve the sign and give
10563            back 0x7fff ffff.
10564         */
10565         if (i32 != ($xxx) f)
10566                 result |= 1;
10567         exit(result);
10568 }
10569 EOCP
10570 set try
10571 if eval $compile_ok; then
10572         $run ./try
10573         yyy=$?
10574 else
10575         echo "(I can't seem to compile the test program--assuming it can't)"
10576         yyy=1
10577 fi
10578 case "$yyy" in
10579 0)      val="$define"
10580         echo "Yup, it can."
10581         ;;
10582 *)      val="$undef"
10583         echo "Nope, it can't."
10584         ;;
10585 esac
10586 set d_casti32
10587 eval $setvar
10588 $rm -f try try.*
10589
10590 : check for ability to cast negative floats to unsigned
10591 echo " "
10592 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10593 $cat >try.c <<EOCP
10594 #include <stdio.h>
10595 #$i_stdlib I_STDLIB
10596 #ifdef I_STDLIB
10597 #include <stdlib.h>
10598 #endif
10599 #include <sys/types.h>
10600 #include <signal.h>
10601 $signal_t blech(int s) { exit(7); }
10602 $signal_t blech_in_list(int s) { exit(4); }
10603 unsigned long dummy_long(unsigned long p) { return p; }
10604 unsigned int dummy_int(unsigned int p) { return p; }
10605 unsigned short dummy_short(unsigned short p) { return p; }
10606 int main()
10607 {
10608         double f;
10609         unsigned long along;
10610         unsigned int aint;
10611         unsigned short ashort;
10612         int result = 0;
10613         char str[16];
10614         
10615         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10616            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10617            optimized the whole file away
10618         */
10619         /* Store the number in a writable string for gcc to pass to 
10620            sscanf under HP/UX.
10621         */
10622         sprintf(str, "-123");
10623         sscanf(str, "%lf", &f);  /* f = -123.; */
10624
10625         signal(SIGFPE, blech);
10626         along = (unsigned long)f;
10627         aint = (unsigned int)f;
10628         ashort = (unsigned short)f;
10629         if (along != (unsigned long)-123)
10630                 result |= 1;
10631         if (aint != (unsigned int)-123)
10632                 result |= 1;
10633         if (ashort != (unsigned short)-123)
10634                 result |= 1;
10635         sprintf(str, "1073741824.");
10636         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10637         f = f + f;
10638         along = 0;
10639         along = (unsigned long)f;
10640         if (along != 0x80000000)
10641                 result |= 2;
10642         f -= 1.;
10643         along = 0;
10644         along = (unsigned long)f;
10645         if (along != 0x7fffffff)
10646                 result |= 1;
10647         f += 2.;
10648         along = 0;
10649         along = (unsigned long)f;
10650         if (along != 0x80000001)
10651                 result |= 2;
10652         if (result)
10653                 exit(result);
10654         signal(SIGFPE, blech_in_list);
10655         sprintf(str, "123.");
10656         sscanf(str, "%lf", &f);  /* f = 123.; */
10657         along = dummy_long((unsigned long)f);
10658         aint = dummy_int((unsigned int)f);
10659         ashort = dummy_short((unsigned short)f);
10660         if (along != (unsigned long)123)
10661                 result |= 4;
10662         if (aint != (unsigned int)123)
10663                 result |= 4;
10664         if (ashort != (unsigned short)123)
10665                 result |= 4;
10666         exit(result);
10667
10668 }
10669 EOCP
10670 set try
10671 if eval $compile_ok; then
10672         $run ./try
10673         castflags=$?
10674 else
10675         echo "(I can't seem to compile the test program--assuming it can't)"
10676         castflags=7
10677 fi
10678 case "$castflags" in
10679 0)      val="$define"
10680         echo "Yup, it can."
10681         ;;
10682 *)      val="$undef"
10683         echo "Nope, it can't."
10684         ;;
10685 esac
10686 set d_castneg
10687 eval $setvar
10688 $rm -f try.*
10689
10690 : see if vprintf exists
10691 echo " "
10692 if set vprintf val -f d_vprintf; eval $csym; $val; then
10693         echo 'vprintf() found.' >&4
10694         val="$define"
10695         $cat >try.c <<EOF
10696 #include <varargs.h>
10697 #$i_stdlib I_STDLIB
10698 #ifdef I_STDLIB
10699 #include <stdlib.h>
10700 #endif
10701
10702 int main() { xxx("foo"); }
10703
10704 xxx(va_alist)
10705 va_dcl
10706 {
10707         va_list args;
10708         char buf[10];
10709
10710         va_start(args);
10711         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10712 }
10713 EOF
10714         set try
10715         if eval $compile && $run ./try; then
10716                 echo "Your vsprintf() returns (int)." >&4
10717                 val2="$undef"
10718         else
10719                 echo "Your vsprintf() returns (char*)." >&4
10720                 val2="$define"
10721         fi
10722 else
10723         echo 'vprintf() NOT found.' >&4
10724                 val="$undef"
10725                 val2="$undef"
10726 fi
10727 $rm -f try try.*
10728 set d_vprintf
10729 eval $setvar
10730 val=$val2
10731 set d_charvspr
10732 eval $setvar
10733
10734 : see if chown exists
10735 set chown d_chown
10736 eval $inlibc
10737
10738 : see if chroot exists
10739 set chroot d_chroot
10740 eval $inlibc
10741
10742 : see if chsize exists
10743 set chsize d_chsize
10744 eval $inlibc
10745
10746 : see if class exists
10747 set class d_class
10748 eval $inlibc
10749
10750 : see if clearenv exists
10751 set clearenv d_clearenv
10752 eval $inlibc
10753
10754 hasstruct='varname=$1; struct=$2; shift; shift;
10755 while $test $# -ge 2; do
10756         case "$1" in
10757         $define) echo "#include <$2>";;
10758         esac ;
10759     shift 2;
10760 done > try.c;
10761 echo "int main () { struct $struct foo; }" >> try.c;
10762 set try;
10763 if eval $compile; then
10764         val="$define";
10765 else
10766         val="$undef";
10767 fi;
10768 set $varname;
10769 eval $setvar;
10770 $rm -f try.c try.o'
10771
10772 socketlib=''
10773 sockethdr=''
10774 : see whether socket exists
10775 echo " "
10776 $echo $n "Hmm... $c" >&4
10777 if set socket val -f d_socket; eval $csym; $val; then
10778         echo "Looks like you have Berkeley networking support." >&4
10779         d_socket="$define"
10780         if set setsockopt val -f; eval $csym; $val; then
10781                 d_oldsock="$undef"
10782         else
10783                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10784                 d_oldsock="$define"
10785         fi
10786 else
10787         if $contains socklib libc.list >/dev/null 2>&1; then
10788                 echo "Looks like you have Berkeley networking support." >&4
10789                 d_socket="$define"
10790                 : we will have to assume that it supports the 4.2 BSD interface
10791                 d_oldsock="$undef"
10792         else
10793                 echo "You don't have Berkeley networking in libc$_a..." >&4
10794                 if test "X$d_socket" = "X$define"; then
10795                    echo "...but you seem to believe that you have sockets." >&4
10796                 else
10797                         for net in net socket
10798                         do
10799                                 if test -f /usr/lib/lib$net$_a; then
10800                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10801                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10802                                         if $contains socket libc.list >/dev/null 2>&1; then
10803                                                 d_socket="$define"
10804                                                 socketlib="-l$net"
10805                                                 case "$net" in
10806                                                 net)
10807                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10808                                                         sockethdr="-I/usr/netinclude"
10809                                                         ;;
10810                                                 esac
10811                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10812                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10813                                                         d_oldsock="$undef"
10814                                                 else
10815                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10816                                                         d_oldsock="$define"
10817                                                 fi
10818                                                 break
10819                                         fi
10820                                 fi
10821                         done
10822                         if test "X$d_socket" != "X$define"; then
10823                            echo "or anywhere else I see." >&4
10824                            d_socket="$undef"
10825                            d_oldsock="$undef"
10826                         fi
10827                 fi
10828         fi
10829 fi
10830
10831 : see if socketpair exists
10832 set socketpair d_sockpair
10833 eval $inlibc
10834
10835
10836 echo " "
10837 echo "Checking the availability of certain socket constants..." >&4
10838 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10839         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10840         $cat >try.c <<EOF
10841 #include <sys/types.h>
10842 #include <sys/socket.h>
10843 int main() {
10844     int i = $ENUM;
10845 }
10846 EOF
10847         val="$undef"
10848         set try; if eval $compile; then
10849                 val="$define"
10850         fi
10851         set d_${enum}; eval $setvar
10852         $rm -f try.c try
10853 done
10854
10855 : see if this is a sys/uio.h system
10856 set sys/uio.h i_sysuio
10857 eval $inhdr
10858
10859
10860 echo " "
10861 echo "Checking to see if your system supports struct cmsghdr..." >&4
10862 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10863 eval $hasstruct
10864 case "$d_cmsghdr_s" in
10865 "$define")      echo "Yes, it does."   ;;
10866 *)              echo "No, it doesn't." ;;
10867 esac
10868
10869
10870 : check for const keyword
10871 echo " "
10872 echo 'Checking to see if your C compiler knows about "const"...' >&4
10873 $cat >const.c <<'EOCP'
10874 typedef struct spug { int drokk; } spug;
10875 int main()
10876 {
10877         const char *foo;
10878         const spug y = { 0 };
10879 }
10880 EOCP
10881 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10882         val="$define"
10883         echo "Yup, it does."
10884 else
10885         val="$undef"
10886         echo "Nope, it doesn't."
10887 fi
10888 set d_const
10889 eval $setvar
10890
10891 : see if copysignl exists
10892 set copysignl d_copysignl
10893 eval $inlibc
10894
10895 : see if crypt exists
10896 echo " "
10897 set crypt d_crypt
10898 eval $inlibc
10899 case "$d_crypt" in
10900 $define) cryptlib='' ;;
10901 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10902                 echo 'crypt() found.' >&4
10903                 val="$define"
10904                 cryptlib=''
10905         else
10906                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10907                 if $test -z "$cryptlib"; then
10908                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10909                 else
10910                         cryptlib=-lcrypt
10911                 fi
10912                 if $test -z "$cryptlib"; then
10913                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10914                 else
10915                         cryptlib=-lcrypt
10916                 fi
10917                 if $test -z "$cryptlib"; then
10918                         cryptlib=`./loc libcrypt$_a "" $libpth`
10919                 else
10920                         cryptlib=-lcrypt
10921                 fi
10922                 if $test -z "$cryptlib"; then
10923                         echo 'crypt() NOT found.' >&4
10924                         val="$undef"
10925                 else
10926                         val="$define"
10927                 fi
10928         fi
10929         set d_crypt
10930         eval $setvar
10931         ;;
10932 esac
10933
10934 : see if this is a crypt.h system
10935 set crypt.h i_crypt
10936 eval $inhdr
10937
10938 : see if crypt_r exists
10939 set crypt_r d_crypt_r
10940 eval $inlibc
10941 case "$d_crypt_r" in
10942 "$define")
10943         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10944         case "$d_crypt_r_proto:$usethreads" in
10945         ":define")      d_crypt_r_proto=define
10946                 set d_crypt_r_proto crypt_r $hdrs
10947                 eval $hasproto ;;
10948         *)      ;;
10949         esac
10950         case "$d_crypt_r_proto" in
10951         define)
10952         case "$crypt_r_proto" in
10953         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10954         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10955         esac
10956         case "$crypt_r_proto" in
10957         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10958         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10959         esac
10960         case "$crypt_r_proto" in
10961         ''|0)   d_crypt_r=undef
10962                 crypt_r_proto=0
10963                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10964         * )     case "$crypt_r_proto" in
10965                 REENTRANT_PROTO*) ;;
10966                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10967                 esac
10968                 echo "Prototype: $try" ;;
10969         esac
10970         ;;
10971         *)      case "$usethreads" in
10972                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10973                 esac
10974                 d_crypt_r=undef
10975                 crypt_r_proto=0
10976                 ;;
10977         esac
10978         ;;
10979 *)      crypt_r_proto=0
10980         ;;
10981 esac
10982
10983 : get csh whereabouts
10984 case "$csh" in
10985 'csh') val="$undef" ;;
10986 *) val="$define" ;;
10987 esac
10988 set d_csh
10989 eval $setvar
10990 : Respect a hint or command line value for full_csh.
10991 case "$full_csh" in
10992 '') full_csh=$csh ;;
10993 esac
10994
10995 : see if ctermid exists
10996 set ctermid d_ctermid
10997 eval $inlibc
10998
10999 : see if ctermid_r exists
11000 set ctermid_r d_ctermid_r
11001 eval $inlibc
11002 case "$d_ctermid_r" in
11003 "$define")
11004         hdrs="$i_systypes sys/types.h define stdio.h "
11005         case "$d_ctermid_r_proto:$usethreads" in
11006         ":define")      d_ctermid_r_proto=define
11007                 set d_ctermid_r_proto ctermid_r $hdrs
11008                 eval $hasproto ;;
11009         *)      ;;
11010         esac
11011         case "$d_ctermid_r_proto" in
11012         define)
11013         case "$ctermid_r_proto" in
11014         ''|0) try='char* ctermid_r(char*);'
11015         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11016         esac
11017         case "$ctermid_r_proto" in
11018         ''|0)   d_ctermid_r=undef
11019                 ctermid_r_proto=0
11020                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11021         * )     case "$ctermid_r_proto" in
11022                 REENTRANT_PROTO*) ;;
11023                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11024                 esac
11025                 echo "Prototype: $try" ;;
11026         esac
11027         ;;
11028         *)      case "$usethreads" in
11029                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11030                 esac
11031                 d_ctermid_r=undef
11032                 ctermid_r_proto=0
11033                 ;;
11034         esac
11035         ;;
11036 *)      ctermid_r_proto=0
11037         ;;
11038 esac
11039
11040 : see if ctime_r exists
11041 set ctime_r d_ctime_r
11042 eval $inlibc
11043 case "$d_ctime_r" in
11044 "$define")
11045         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11046         case "$d_ctime_r_proto:$usethreads" in
11047         ":define")      d_ctime_r_proto=define
11048                 set d_ctime_r_proto ctime_r $hdrs
11049                 eval $hasproto ;;
11050         *)      ;;
11051         esac
11052         case "$d_ctime_r_proto" in
11053         define)
11054         case "$ctime_r_proto" in
11055         ''|0) try='char* ctime_r(const time_t*, char*);'
11056         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11057         esac
11058         case "$ctime_r_proto" in
11059         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11060         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11061         esac
11062         case "$ctime_r_proto" in
11063         ''|0) try='int ctime_r(const time_t*, char*);'
11064         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11065         esac
11066         case "$ctime_r_proto" in
11067         ''|0) try='int ctime_r(const time_t*, char*, int);'
11068         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11069         esac
11070         case "$ctime_r_proto" in
11071         ''|0)   d_ctime_r=undef
11072                 ctime_r_proto=0
11073                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11074         * )     case "$ctime_r_proto" in
11075                 REENTRANT_PROTO*) ;;
11076                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11077                 esac
11078                 echo "Prototype: $try" ;;
11079         esac
11080         ;;
11081         *)      case "$usethreads" in
11082                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11083                 esac
11084                 d_ctime_r=undef
11085                 ctime_r_proto=0
11086                 ;;
11087         esac
11088         ;;
11089 *)      ctime_r_proto=0
11090         ;;
11091 esac
11092
11093 : see if cuserid exists
11094 set cuserid d_cuserid
11095 eval $inlibc
11096
11097 : see if this is a limits.h system
11098 set limits.h i_limits
11099 eval $inhdr
11100
11101 : see if this is a float.h system
11102 set float.h i_float
11103 eval $inhdr
11104
11105 : See if number of significant digits in a double precision number is known
11106 echo " "
11107 $cat >dbl_dig.c <<EOM
11108 #$i_limits I_LIMITS
11109 #$i_float I_FLOAT
11110 #ifdef I_LIMITS
11111 #include <limits.h>
11112 #endif
11113 #ifdef I_FLOAT
11114 #include <float.h>
11115 #endif
11116 #ifdef DBL_DIG
11117 printf("Contains DBL_DIG");
11118 #endif
11119 EOM
11120 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11121 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11122         echo "DBL_DIG found." >&4
11123         val="$define"
11124 else
11125         echo "DBL_DIG NOT found." >&4
11126         val="$undef"
11127 fi
11128 $rm -f dbl_dig.?
11129 set d_dbl_dig
11130 eval $setvar
11131
11132 : see if dbm.h is available
11133 : see if dbmclose exists
11134 set dbmclose d_dbmclose
11135 eval $inlibc
11136
11137 case "$d_dbmclose" in
11138 $define)
11139         set dbm.h i_dbm
11140         eval $inhdr
11141         case "$i_dbm" in
11142         $define)
11143                 val="$undef"
11144                 set i_rpcsvcdbm
11145                 eval $setvar
11146                 ;;
11147         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11148                 eval $inhdr
11149                 ;;
11150         esac
11151         ;;
11152 *)      echo "We won't be including <dbm.h>"
11153         val="$undef"
11154         set i_dbm
11155         eval $setvar
11156         val="$undef"
11157         set i_rpcsvcdbm
11158         eval $setvar
11159         ;;
11160 esac
11161
11162 : see if prototype for dbminit is available
11163 echo " "
11164 set d_dbminitproto dbminit $i_dbm dbm.h
11165 eval $hasproto
11166
11167 : see if difftime exists
11168 set difftime d_difftime
11169 eval $inlibc
11170
11171 : see if this is a dirent system
11172 echo " "
11173 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11174         val="$define"
11175         echo "<dirent.h> found." >&4
11176 else
11177         val="$undef"
11178         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11179                 echo "<sys/dir.h> found." >&4
11180                 echo " "
11181         else
11182                 xinc=`./findhdr sys/ndir.h`
11183         fi
11184         echo "<dirent.h> NOT found." >&4
11185 fi
11186 set i_dirent
11187 eval $setvar
11188
11189 : Look for type of directory structure.
11190 echo " "
11191 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11192
11193 case "$direntrytype" in
11194 ''|' ')
11195         case "$i_dirent" in
11196         $define) guess1='struct dirent' ;;
11197         *) guess1='struct direct'  ;;
11198         esac
11199         ;;
11200 *)      guess1="$direntrytype"
11201         ;;
11202 esac
11203
11204 case "$guess1" in
11205 'struct dirent') guess2='struct direct' ;;
11206 *) guess2='struct dirent' ;;
11207 esac
11208                 
11209 if $contains "$guess1" try.c >/dev/null 2>&1; then
11210         direntrytype="$guess1"
11211         echo "Your directory entries are $direntrytype." >&4
11212 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11213         direntrytype="$guess2"
11214         echo "Your directory entries seem to be $direntrytype." >&4
11215 else
11216         echo "I don't recognize your system's directory entries." >&4
11217         rp="What type is used for directory entries on this system?"
11218         dflt="$guess1"
11219         . ./myread
11220         direntrytype="$ans"
11221 fi
11222 $rm -f try.c
11223
11224
11225 : see if the directory entry stores field length
11226 echo " "
11227 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11228 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11229         echo "Good, your directory entry keeps length information in d_namlen." >&4
11230         val="$define"
11231 else
11232         echo "Your directory entry does not know about the d_namlen field." >&4
11233         val="$undef"
11234 fi
11235 set d_dirnamlen
11236 eval $setvar
11237 $rm -f try.c
11238
11239 : see if this is an sysdir system
11240 set sys/dir.h i_sysdir
11241 eval $inhdr
11242
11243 : see if this is an sysndir system
11244 set sys/ndir.h i_sysndir
11245 eval $inhdr
11246
11247 : Look for dirfd
11248 echo " "
11249 $cat >dirfd.c <<EOM
11250 #include <stdio.h>
11251 #$i_stdlib I_STDLIB
11252 #ifdef I_STDLIB
11253 #include <stdlib.h>
11254 #endif
11255 #$i_dirent I_DIRENT             /**/
11256 #$i_sysdir I_SYS_DIR            /**/
11257 #$i_sysndir I_SYS_NDIR          /**/
11258 #$i_systypes I_SYS_TYPES        /**/
11259 #if defined(I_SYS_TYPES)
11260 #include <sys/types.h>
11261 #endif
11262 #if defined(I_DIRENT)
11263 #include <dirent.h>
11264 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11265 #include <sys/dir.h>
11266 #endif
11267 #else
11268 #ifdef I_SYS_NDIR
11269 #include <sys/ndir.h>
11270 #else
11271 #ifdef I_SYS_DIR
11272 #ifdef hp9000s500
11273 #include <ndir.h>       /* may be wrong in the future */
11274 #else
11275 #include <sys/dir.h>
11276 #endif
11277 #endif
11278 #endif
11279 #endif 
11280 int main() {
11281         DIR *dirp = opendir(".");
11282         if (dirfd(dirp) >= 0)
11283                 exit(0);
11284         else
11285                 exit(1);
11286 }
11287 EOM
11288 val=$undef
11289 set dirfd
11290 if eval $compile; then
11291         val="$define"
11292 fi
11293 case "$val" in
11294 $define)        echo "dirfd() found." >&4       ;;
11295 *)              echo "dirfd() NOT found." >&4   ;;
11296 esac
11297 set d_dirfd
11298 eval $setvar
11299 $rm -f dirfd*
11300
11301 : see if dlerror exists
11302 xxx_runnm="$runnm"
11303 runnm=false
11304 set dlerror d_dlerror
11305 eval $inlibc
11306 runnm="$xxx_runnm"
11307
11308 : see if dlfcn is available
11309 set dlfcn.h i_dlfcn
11310 eval $inhdr
11311
11312 case "$usedl" in
11313 $define|y|true)
11314         $cat << EOM
11315
11316 On a few systems, the dynamically loaded modules that perl generates and uses
11317 will need a different extension than shared libs. The default will probably
11318 be appropriate.
11319
11320 EOM
11321         case "$dlext" in
11322         '')     dflt="$so" ;;
11323         *)      dflt="$dlext" ;;
11324         esac
11325         rp='What is the extension of dynamically loaded modules'
11326         . ./myread
11327         dlext="$ans"
11328         ;;
11329 *)
11330         dlext="none"
11331         ;;
11332 esac
11333
11334 : Check if dlsym need a leading underscore
11335 echo " "
11336 val="$undef"
11337
11338 case "$dlsrc" in
11339 dl_dlopen.xs)
11340         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11341         $cat >dyna.c <<'EOM'
11342 fred () { }
11343 EOM
11344
11345 $cat >fred.c<<EOM
11346
11347 #include <stdio.h>
11348 #$i_stdlib I_STDLIB
11349 #ifdef I_STDLIB
11350 #include <stdlib.h>
11351 #endif
11352 #$i_dlfcn I_DLFCN
11353 #ifdef I_DLFCN
11354 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11355 #else
11356 #include <sys/types.h>
11357 #include <nlist.h>
11358 #include <link.h>
11359 #endif
11360
11361 extern int fred() ;
11362
11363 int main()
11364 {
11365     void * handle ;
11366     void * symbol ;
11367 #ifndef RTLD_LAZY
11368     int mode = 1 ;
11369 #else
11370     int mode = RTLD_LAZY ;
11371 #endif
11372     handle = dlopen("./dyna.$dlext", mode) ;
11373     if (handle == NULL) {
11374         printf ("1\n") ;
11375         fflush (stdout) ;
11376         exit(0);
11377     }
11378     symbol = dlsym(handle, "fred") ;
11379     if (symbol == NULL) {
11380         /* try putting a leading underscore */
11381         symbol = dlsym(handle, "_fred") ;
11382         if (symbol == NULL) {
11383             printf ("2\n") ;
11384             fflush (stdout) ;
11385             exit(0);
11386         }
11387         printf ("3\n") ;
11388     }
11389     else
11390         printf ("4\n") ;
11391     fflush (stdout) ;
11392     exit(0);
11393 }
11394 EOM
11395         : Call the object file tmp-dyna.o in case dlext=o.
11396         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11397                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11398                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11399                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11400                 xxx=`$run ./fred`
11401                 case $xxx in
11402                 1)      echo "Test program failed using dlopen." >&4
11403                         echo "Perhaps you should not use dynamic loading." >&4;;
11404                 2)      echo "Test program failed using dlsym." >&4
11405                         echo "Perhaps you should not use dynamic loading." >&4;;
11406                 3)      echo "dlsym needs a leading underscore" >&4
11407                         val="$define" ;;
11408                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11409                 esac
11410         else
11411                 echo "I can't compile and run the test program." >&4
11412                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11413         fi
11414         ;;
11415 esac
11416                 
11417 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11418
11419 set d_dlsymun
11420 eval $setvar
11421
11422 : see if drand48_r exists
11423 set drand48_r d_drand48_r
11424 eval $inlibc
11425 case "$d_drand48_r" in
11426 "$define")
11427         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11428         case "$d_drand48_r_proto:$usethreads" in
11429         ":define")      d_drand48_r_proto=define
11430                 set d_drand48_r_proto drand48_r $hdrs
11431                 eval $hasproto ;;
11432         *)      ;;
11433         esac
11434         case "$d_drand48_r_proto" in
11435         define)
11436         case "$drand48_r_proto" in
11437         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11438         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11439         esac
11440         case "$drand48_r_proto" in
11441         ''|0)   d_drand48_r=undef
11442                 drand48_r_proto=0
11443                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11444         * )     case "$drand48_r_proto" in
11445                 REENTRANT_PROTO*) ;;
11446                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11447                 esac
11448                 echo "Prototype: $try" ;;
11449         esac
11450         ;;
11451         *)      case "$usethreads" in
11452                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11453                 esac
11454                 d_drand48_r=undef
11455                 drand48_r_proto=0
11456                 ;;
11457         esac
11458         ;;
11459 *)      drand48_r_proto=0
11460         ;;
11461 esac
11462
11463 : see if prototype for drand48 is available
11464 echo " "
11465 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11466 eval $hasproto
11467
11468 : see if dup2 exists
11469 set dup2 d_dup2
11470 eval $inlibc
11471
11472 : see if eaccess exists
11473 set eaccess d_eaccess
11474 eval $inlibc
11475
11476 : see if endgrent exists
11477 set endgrent d_endgrent
11478 eval $inlibc
11479
11480 : see if this is an grp system
11481 set grp.h i_grp
11482 eval $inhdr
11483
11484 case "$i_grp" in
11485 $define)
11486         xxx=`./findhdr grp.h`
11487         $cppstdin $cppflags $cppminus < $xxx >$$.h
11488
11489         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11490                 val="$define"
11491         else
11492                 val="$undef"
11493         fi
11494         set d_grpasswd
11495         eval $setvar
11496
11497         $rm -f $$.h
11498         ;;
11499 *)
11500         val="$undef";
11501         set d_grpasswd; eval $setvar
11502         ;;
11503 esac
11504
11505 : see if endgrent_r exists
11506 set endgrent_r d_endgrent_r
11507 eval $inlibc
11508 case "$d_endgrent_r" in
11509 "$define")
11510         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11511         case "$d_endgrent_r_proto:$usethreads" in
11512         ":define")      d_endgrent_r_proto=define
11513                 set d_endgrent_r_proto endgrent_r $hdrs
11514                 eval $hasproto ;;
11515         *)      ;;
11516         esac
11517         case "$d_endgrent_r_proto" in
11518         define)
11519         case "$endgrent_r_proto" in
11520         ''|0) try='int endgrent_r(FILE**);'
11521         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11522         esac
11523         case "$endgrent_r_proto" in
11524         ''|0) try='void endgrent_r(FILE**);'
11525         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11526         esac
11527         case "$endgrent_r_proto" in
11528         ''|0)   d_endgrent_r=undef
11529                 endgrent_r_proto=0
11530                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11531         * )     case "$endgrent_r_proto" in
11532                 REENTRANT_PROTO*) ;;
11533                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11534                 esac
11535                 echo "Prototype: $try" ;;
11536         esac
11537         ;;
11538         *)      case "$usethreads" in
11539                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11540                 esac
11541                 d_endgrent_r=undef
11542                 endgrent_r_proto=0
11543                 ;;
11544         esac
11545         ;;
11546 *)      endgrent_r_proto=0
11547         ;;
11548 esac
11549
11550 : see if endhostent exists
11551 set endhostent d_endhent
11552 eval $inlibc
11553
11554 : see if this is a netdb.h system
11555 set netdb.h i_netdb
11556 eval $inhdr
11557
11558 : see if endhostent_r exists
11559 set endhostent_r d_endhostent_r
11560 eval $inlibc
11561 case "$d_endhostent_r" in
11562 "$define")
11563         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11564         case "$d_endhostent_r_proto:$usethreads" in
11565         ":define")      d_endhostent_r_proto=define
11566                 set d_endhostent_r_proto endhostent_r $hdrs
11567                 eval $hasproto ;;
11568         *)      ;;
11569         esac
11570         case "$d_endhostent_r_proto" in
11571         define)
11572         case "$endhostent_r_proto" in
11573         ''|0) try='int endhostent_r(struct hostent_data*);'
11574         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11575         esac
11576         case "$endhostent_r_proto" in
11577         ''|0) try='void endhostent_r(struct hostent_data*);'
11578         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11579         esac
11580         case "$endhostent_r_proto" in
11581         ''|0)   d_endhostent_r=undef
11582                 endhostent_r_proto=0
11583                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11584         * )     case "$endhostent_r_proto" in
11585                 REENTRANT_PROTO*) ;;
11586                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11587                 esac
11588                 echo "Prototype: $try" ;;
11589         esac
11590         ;;
11591         *)      case "$usethreads" in
11592                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11593                 esac
11594                 d_endhostent_r=undef
11595                 endhostent_r_proto=0
11596                 ;;
11597         esac
11598         ;;
11599 *)      endhostent_r_proto=0
11600         ;;
11601 esac
11602
11603 : see if endnetent exists
11604 set endnetent d_endnent
11605 eval $inlibc
11606
11607 : see if endnetent_r exists
11608 set endnetent_r d_endnetent_r
11609 eval $inlibc
11610 case "$d_endnetent_r" in
11611 "$define")
11612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11613         case "$d_endnetent_r_proto:$usethreads" in
11614         ":define")      d_endnetent_r_proto=define
11615                 set d_endnetent_r_proto endnetent_r $hdrs
11616                 eval $hasproto ;;
11617         *)      ;;
11618         esac
11619         case "$d_endnetent_r_proto" in
11620         define)
11621         case "$endnetent_r_proto" in
11622         ''|0) try='int endnetent_r(struct netent_data*);'
11623         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11624         esac
11625         case "$endnetent_r_proto" in
11626         ''|0) try='void endnetent_r(struct netent_data*);'
11627         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11628         esac
11629         case "$endnetent_r_proto" in
11630         ''|0)   d_endnetent_r=undef
11631                 endnetent_r_proto=0
11632                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11633         * )     case "$endnetent_r_proto" in
11634                 REENTRANT_PROTO*) ;;
11635                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11636                 esac
11637                 echo "Prototype: $try" ;;
11638         esac
11639         ;;
11640         *)      case "$usethreads" in
11641                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11642                 esac
11643                 d_endnetent_r=undef
11644                 endnetent_r_proto=0
11645                 ;;
11646         esac
11647         ;;
11648 *)      endnetent_r_proto=0
11649         ;;
11650 esac
11651
11652 : see if endprotoent exists
11653 set endprotoent d_endpent
11654 eval $inlibc
11655
11656 : see if endprotoent_r exists
11657 set endprotoent_r d_endprotoent_r
11658 eval $inlibc
11659 case "$d_endprotoent_r" in
11660 "$define")
11661         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11662         case "$d_endprotoent_r_proto:$usethreads" in
11663         ":define")      d_endprotoent_r_proto=define
11664                 set d_endprotoent_r_proto endprotoent_r $hdrs
11665                 eval $hasproto ;;
11666         *)      ;;
11667         esac
11668         case "$d_endprotoent_r_proto" in
11669         define)
11670         case "$endprotoent_r_proto" in
11671         ''|0) try='int endprotoent_r(struct protoent_data*);'
11672         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11673         esac
11674         case "$endprotoent_r_proto" in
11675         ''|0) try='void endprotoent_r(struct protoent_data*);'
11676         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11677         esac
11678         case "$endprotoent_r_proto" in
11679         ''|0)   d_endprotoent_r=undef
11680                 endprotoent_r_proto=0
11681                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11682         * )     case "$endprotoent_r_proto" in
11683                 REENTRANT_PROTO*) ;;
11684                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11685                 esac
11686                 echo "Prototype: $try" ;;
11687         esac
11688         ;;
11689         *)      case "$usethreads" in
11690                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11691                 esac
11692                 d_endprotoent_r=undef
11693                 endprotoent_r_proto=0
11694                 ;;
11695         esac
11696         ;;
11697 *)      endprotoent_r_proto=0
11698         ;;
11699 esac
11700
11701 : see if endpwent exists
11702 set endpwent d_endpwent
11703 eval $inlibc
11704
11705 : see if this is a pwd.h system
11706 set pwd.h i_pwd
11707 eval $inhdr
11708
11709 case "$i_pwd" in
11710 $define)
11711         xxx=`./findhdr pwd.h`
11712         $cppstdin $cppflags $cppminus < $xxx >$$.h
11713
11714         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11715                 val="$define"
11716         else
11717                 val="$undef"
11718         fi
11719         set d_pwquota
11720         eval $setvar
11721
11722         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11723                 val="$define"
11724         else
11725                 val="$undef"
11726         fi
11727         set d_pwage
11728         eval $setvar
11729
11730         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11731                 val="$define"
11732         else
11733                 val="$undef"
11734         fi
11735         set d_pwchange
11736         eval $setvar
11737
11738         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11739                 val="$define"
11740         else
11741                 val="$undef"
11742         fi
11743         set d_pwclass
11744         eval $setvar
11745
11746         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11747                 val="$define"
11748         else
11749                 val="$undef"
11750         fi
11751         set d_pwexpire
11752         eval $setvar
11753
11754         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11755                 val="$define"
11756         else
11757                 val="$undef"
11758         fi
11759         set d_pwcomment
11760         eval $setvar
11761
11762         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11763                 val="$define"
11764         else
11765                 val="$undef"
11766         fi
11767         set d_pwgecos
11768         eval $setvar
11769
11770         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11771                 val="$define"
11772         else
11773                 val="$undef"
11774         fi
11775         set d_pwpasswd
11776         eval $setvar
11777
11778         $rm -f $$.h
11779         ;;
11780 *)
11781         val="$undef"; 
11782         set d_pwquota; eval $setvar
11783         set d_pwage; eval $setvar
11784         set d_pwchange; eval $setvar
11785         set d_pwclass; eval $setvar
11786         set d_pwexpire; eval $setvar
11787         set d_pwcomment; eval $setvar
11788         set d_pwgecos; eval $setvar
11789         set d_pwpasswd; eval $setvar
11790         ;;
11791 esac
11792
11793 : see if endpwent_r exists
11794 set endpwent_r d_endpwent_r
11795 eval $inlibc
11796 case "$d_endpwent_r" in
11797 "$define")
11798         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11799         case "$d_endpwent_r_proto:$usethreads" in
11800         ":define")      d_endpwent_r_proto=define
11801                 set d_endpwent_r_proto endpwent_r $hdrs
11802                 eval $hasproto ;;
11803         *)      ;;
11804         esac
11805         case "$d_endpwent_r_proto" in
11806         define)
11807         case "$endpwent_r_proto" in
11808         ''|0) try='int endpwent_r(FILE**);'
11809         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11810         esac
11811         case "$endpwent_r_proto" in
11812         ''|0) try='void endpwent_r(FILE**);'
11813         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11814         esac
11815         case "$endpwent_r_proto" in
11816         ''|0)   d_endpwent_r=undef
11817                 endpwent_r_proto=0
11818                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11819         * )     case "$endpwent_r_proto" in
11820                 REENTRANT_PROTO*) ;;
11821                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11822                 esac
11823                 echo "Prototype: $try" ;;
11824         esac
11825         ;;
11826         *)      case "$usethreads" in
11827                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11828                 esac
11829                 d_endpwent_r=undef
11830                 endpwent_r_proto=0
11831                 ;;
11832         esac
11833         ;;
11834 *)      endpwent_r_proto=0
11835         ;;
11836 esac
11837
11838 : see if endservent exists
11839 set endservent d_endsent
11840 eval $inlibc
11841
11842 : see if endservent_r exists
11843 set endservent_r d_endservent_r
11844 eval $inlibc
11845 case "$d_endservent_r" in
11846 "$define")
11847         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11848         case "$d_endservent_r_proto:$usethreads" in
11849         ":define")      d_endservent_r_proto=define
11850                 set d_endservent_r_proto endservent_r $hdrs
11851                 eval $hasproto ;;
11852         *)      ;;
11853         esac
11854         case "$d_endservent_r_proto" in
11855         define)
11856         case "$endservent_r_proto" in
11857         ''|0) try='int endservent_r(struct servent_data*);'
11858         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11859         esac
11860         case "$endservent_r_proto" in
11861         ''|0) try='void endservent_r(struct servent_data*);'
11862         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11863         esac
11864         case "$endservent_r_proto" in
11865         ''|0)   d_endservent_r=undef
11866                 endservent_r_proto=0
11867                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11868         * )     case "$endservent_r_proto" in
11869                 REENTRANT_PROTO*) ;;
11870                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11871                 esac
11872                 echo "Prototype: $try" ;;
11873         esac
11874         ;;
11875         *)      case "$usethreads" in
11876                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11877                 esac
11878                 d_endservent_r=undef
11879                 endservent_r_proto=0
11880                 ;;
11881         esac
11882         ;;
11883 *)      endservent_r_proto=0
11884         ;;
11885 esac
11886
11887 : Locate the flags for 'open()'
11888 echo " "
11889 $cat >try.c <<EOCP
11890 #include <sys/types.h>
11891 #ifdef I_FCNTL
11892 #include <fcntl.h>
11893 #endif
11894 #ifdef I_SYS_FILE
11895 #include <sys/file.h>
11896 #endif
11897 #$i_stdlib I_STDLIB
11898 #ifdef I_STDLIB
11899 #include <stdlib.h>
11900 #endif
11901 int main() {
11902         if(O_RDONLY);
11903 #ifdef O_TRUNC
11904         exit(0);
11905 #else
11906         exit(1);
11907 #endif
11908 }
11909 EOCP
11910 : check sys/file.h first to get FREAD on Sun
11911 if $test `./findhdr sys/file.h` && \
11912                 set try -DI_SYS_FILE && eval $compile; then
11913         h_sysfile=true;
11914         echo "<sys/file.h> defines the O_* constants..." >&4
11915         if $run ./try; then
11916                 echo "and you have the 3 argument form of open()." >&4
11917                 val="$define"
11918         else
11919                 echo "but not the 3 argument form of open().  Oh, well." >&4
11920                 val="$undef"
11921         fi
11922 elif $test `./findhdr fcntl.h` && \
11923                 set try -DI_FCNTL && eval $compile; then
11924         h_fcntl=true;
11925         echo "<fcntl.h> defines the O_* constants..." >&4
11926         if $run ./try; then
11927                 echo "and you have the 3 argument form of open()." >&4
11928                 val="$define"
11929         else
11930                 echo "but not the 3 argument form of open().  Oh, well." >&4
11931                 val="$undef"
11932         fi
11933 else
11934         val="$undef"
11935         echo "I can't find the O_* constant definitions!  You got problems." >&4
11936 fi
11937 set d_open3
11938 eval $setvar
11939 $rm -f try try.*
11940
11941 : see which of string.h or strings.h is needed
11942 echo " "
11943 strings=`./findhdr string.h`
11944 if $test "$strings" && $test -r "$strings"; then
11945         echo "Using <string.h> instead of <strings.h>." >&4
11946         val="$define"
11947 else
11948         val="$undef"
11949         strings=`./findhdr strings.h`
11950         if $test "$strings" && $test -r "$strings"; then
11951                 echo "Using <strings.h> instead of <string.h>." >&4
11952         else
11953                 echo "No string header found -- You'll surely have problems." >&4
11954         fi
11955 fi
11956 set i_string
11957 eval $setvar
11958 case "$i_string" in
11959 "$undef") strings=`./findhdr strings.h`;;
11960 *)        strings=`./findhdr string.h`;;
11961 esac
11962
11963 : see if this is a sys/file.h system
11964 val=''
11965 set sys/file.h val
11966 eval $inhdr
11967
11968 : do we need to include sys/file.h ?
11969 case "$val" in
11970 "$define")
11971         echo " "
11972         if $h_sysfile; then
11973                 val="$define"
11974                 echo "We'll be including <sys/file.h>." >&4
11975         else
11976                 val="$undef"
11977                 echo "We won't be including <sys/file.h>." >&4
11978         fi
11979         ;;
11980 *)
11981         h_sysfile=false
11982         ;;
11983 esac
11984 set i_sysfile
11985 eval $setvar
11986
11987 : see if fcntl.h is there
11988 val=''
11989 set fcntl.h val
11990 eval $inhdr
11991
11992 : see if we can include fcntl.h
11993 case "$val" in
11994 "$define")
11995         echo " "
11996         if $h_fcntl; then
11997                 val="$define"
11998                 echo "We'll be including <fcntl.h>." >&4
11999         else
12000                 val="$undef"
12001                 if $h_sysfile; then
12002         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12003                 else
12004                         echo "We won't be including <fcntl.h>." >&4
12005                 fi
12006         fi
12007         ;;
12008 *)
12009         h_fcntl=false
12010         val="$undef"
12011         ;;
12012 esac
12013 set i_fcntl
12014 eval $setvar
12015
12016 : check for non-blocking I/O stuff
12017 case "$h_sysfile" in
12018 true) echo "#include <sys/file.h>" > head.c;;
12019 *)
12020        case "$h_fcntl" in
12021        true) echo "#include <fcntl.h>" > head.c;;
12022        *) echo "#include <sys/fcntl.h>" > head.c;;
12023        esac
12024        ;;
12025 esac
12026 echo " "
12027 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12028 case "$o_nonblock" in
12029 '')
12030         $cat head.c > try.c
12031         $cat >>try.c <<EOCP
12032 #include <stdio.h>
12033 #$i_stdlib I_STDLIB
12034 #ifdef I_STDLIB
12035 #include <stdlib.h>
12036 #endif
12037 #$i_fcntl I_FCNTL
12038 #ifdef I_FCNTL
12039 #include <fcntl.h>
12040 #endif
12041 int main() {
12042 #ifdef O_NONBLOCK
12043         printf("O_NONBLOCK\n");
12044         exit(0);
12045 #endif
12046 #ifdef O_NDELAY
12047         printf("O_NDELAY\n");
12048         exit(0);
12049 #endif
12050 #ifdef FNDELAY
12051         printf("FNDELAY\n");
12052         exit(0);
12053 #endif
12054         exit(0);
12055 }
12056 EOCP
12057         set try
12058         if eval $compile_ok; then
12059                 o_nonblock=`$run ./try`
12060                 case "$o_nonblock" in
12061                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12062                 *) echo "Seems like we can use $o_nonblock.";;
12063                 esac
12064         else
12065                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12066         fi
12067         ;;
12068 *) echo "Using $hint value $o_nonblock.";;
12069 esac
12070 $rm -f try try.* .out core
12071
12072 echo " "
12073 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12074 case "$eagain" in
12075 '')
12076         $cat head.c > try.c
12077         $cat >>try.c <<EOCP
12078 #include <errno.h>
12079 #include <sys/types.h>
12080 #include <signal.h>
12081 #include <stdio.h> 
12082 #$i_stdlib I_STDLIB
12083 #ifdef I_STDLIB
12084 #include <stdlib.h>
12085 #endif
12086 #$i_fcntl I_FCNTL
12087 #ifdef I_FCNTL
12088 #include <fcntl.h>
12089 #endif
12090 #define MY_O_NONBLOCK $o_nonblock
12091 #ifndef errno  /* XXX need better Configure test */
12092 extern int errno;
12093 #endif
12094 #$i_unistd I_UNISTD
12095 #ifdef I_UNISTD
12096 #include <unistd.h>
12097 #endif
12098 #$i_string I_STRING
12099 #ifdef I_STRING
12100 #include <string.h>
12101 #else
12102 #include <strings.h>
12103 #endif
12104 $signal_t blech(int x) { exit(3); }
12105 EOCP
12106         $cat >> try.c <<'EOCP'
12107 int main()
12108 {
12109         int pd[2];
12110         int pu[2];
12111         char buf[1];
12112         char string[100];
12113
12114         pipe(pd);       /* Down: child -> parent */
12115         pipe(pu);       /* Up: parent -> child */
12116         if (0 != fork()) {
12117                 int ret;
12118                 close(pd[1]);   /* Parent reads from pd[0] */
12119                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12120 #ifdef F_SETFL
12121                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12122                         exit(1);
12123 #else
12124                 exit(4);
12125 #endif
12126                 signal(SIGALRM, blech);
12127                 alarm(5);
12128                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12129                         exit(2);
12130                 sprintf(string, "%d\n", ret);
12131                 write(2, string, strlen(string));
12132                 alarm(0);
12133 #ifdef EAGAIN
12134                 if (errno == EAGAIN) {
12135                         printf("EAGAIN\n");
12136                         goto ok;
12137                 }
12138 #endif
12139 #ifdef EWOULDBLOCK
12140                 if (errno == EWOULDBLOCK)
12141                         printf("EWOULDBLOCK\n");
12142 #endif
12143         ok:
12144                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12145                 sleep(2);                               /* Give it time to close our pipe */
12146                 alarm(5);
12147                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12148                 alarm(0);
12149                 sprintf(string, "%d\n", ret);
12150                 write(4, string, strlen(string));
12151                 exit(0);
12152         }
12153
12154         close(pd[0]);                   /* We write to pd[1] */
12155         close(pu[1]);                   /* We read from pu[0] */
12156         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12157         close(pd[1]);                   /* Pipe pd is now fully closed! */
12158         exit(0);                                /* Bye bye, thank you for playing! */
12159 }
12160 EOCP
12161         set try
12162         if eval $compile_ok; then
12163                 echo "$startsh" >mtry
12164                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12165                 chmod +x mtry
12166                 ./mtry >/dev/null 2>&1
12167                 case $? in
12168                 0) eagain=`$cat try.out`;;
12169                 1) echo "Could not perform non-blocking setting!";;
12170                 2) echo "I did a successful read() for something that was not there!";;
12171                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12172                 4) echo "Could not find F_SETFL!";;
12173                 *) echo "Something terribly wrong happened during testing.";;
12174                 esac
12175                 rd_nodata=`$cat try.ret`
12176                 echo "A read() system call with no data present returns $rd_nodata."
12177                 case "$rd_nodata" in
12178                 0|-1) ;;
12179                 *)
12180                         echo "(That's peculiar, fixing that to be -1.)"
12181                         rd_nodata=-1
12182                         ;;
12183                 esac
12184                 case "$eagain" in
12185                 '')
12186                         echo "Forcing errno EAGAIN on read() with no data available."
12187                         eagain=EAGAIN
12188                         ;;
12189                 *)
12190                         echo "Your read() sets errno to $eagain when no data is available."
12191                         ;;
12192                 esac
12193                 status=`$cat try.err`
12194                 case "$status" in
12195                 0) echo "And it correctly returns 0 to signal EOF.";;
12196                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12197                 *) echo "However, your read() returns '$status' on EOF??";;
12198                 esac
12199                 val="$define"
12200                 if test "$status" = "$rd_nodata"; then
12201                         echo "WARNING: you can't distinguish between EOF and no data!"
12202                         val="$undef"
12203                 fi
12204         else
12205                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12206                 eagain=EAGAIN
12207         fi
12208         set d_eofnblk
12209         eval $setvar
12210         ;;
12211 *)
12212         echo "Using $hint value $eagain."
12213         echo "Your read() returns $rd_nodata when no data is present."
12214         case "$d_eofnblk" in
12215         "$define") echo "And you can see EOF because read() returns 0.";;
12216         "$undef") echo "But you can't see EOF status from read() returned value.";;
12217         *)
12218                 echo "(Assuming you can't see EOF status from read anyway.)"
12219                 d_eofnblk=$undef
12220                 ;;
12221         esac
12222         ;;
12223 esac
12224 $rm -f try try.* .out core head.c mtry
12225
12226 : see if _ptr and _cnt from stdio act std
12227 echo " "
12228
12229 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12230         echo "(Looks like you have stdio.h from BSD.)"
12231         case "$stdio_ptr" in
12232         '') stdio_ptr='((fp)->_p)'
12233                 ptr_lval=$define
12234                 ;;
12235         *)      ptr_lval=$d_stdio_ptr_lval;;
12236         esac
12237         case "$stdio_cnt" in
12238         '') stdio_cnt='((fp)->_r)'
12239                 cnt_lval=$define
12240                 ;;
12241         *)      cnt_lval=$d_stdio_cnt_lval;;
12242         esac
12243         case "$stdio_base" in
12244         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12245         esac
12246         case "$stdio_bufsiz" in
12247         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12248         esac
12249 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12250         echo "(Looks like you have stdio.h from Linux.)"
12251         case "$stdio_ptr" in
12252         '') stdio_ptr='((fp)->_IO_read_ptr)'
12253                 ptr_lval=$define
12254                 ;;
12255         *)      ptr_lval=$d_stdio_ptr_lval;;
12256         esac
12257         case "$stdio_cnt" in
12258         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12259                 cnt_lval=$undef
12260                 ;;
12261         *)      cnt_lval=$d_stdio_cnt_lval;;
12262         esac
12263         case "$stdio_base" in
12264         '') stdio_base='((fp)->_IO_read_base)';;
12265         esac
12266         case "$stdio_bufsiz" in
12267         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12268         esac
12269 else
12270         case "$stdio_ptr" in
12271         '') stdio_ptr='((fp)->_ptr)'
12272                 ptr_lval=$define
12273                 ;;
12274         *)      ptr_lval=$d_stdio_ptr_lval;;
12275         esac
12276         case "$stdio_cnt" in
12277         '') stdio_cnt='((fp)->_cnt)'
12278                 cnt_lval=$define
12279                 ;;
12280         *)      cnt_lval=$d_stdio_cnt_lval;;
12281         esac
12282         case "$stdio_base" in
12283         '') stdio_base='((fp)->_base)';;
12284         esac
12285         case "$stdio_bufsiz" in
12286         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12287         esac
12288 fi
12289
12290 : test whether _ptr and _cnt really work
12291 echo "Checking how std your stdio is..." >&4
12292 $cat >try.c <<EOP
12293 #include <stdio.h>
12294 #$i_stdlib I_STDLIB
12295 #ifdef I_STDLIB
12296 #include <stdlib.h>
12297 #endif
12298 #define FILE_ptr(fp)    $stdio_ptr
12299 #define FILE_cnt(fp)    $stdio_cnt
12300 int main() {
12301         FILE *fp = fopen("try.c", "r");
12302         char c = getc(fp);
12303         if (
12304                 18 <= FILE_cnt(fp) &&
12305                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12306         )
12307                 exit(0);
12308         exit(1);
12309 }
12310 EOP
12311 val="$undef"
12312 set try
12313 if eval $compile && $to try.c; then
12314         if $run ./try; then
12315                 echo "Your stdio acts pretty std."
12316                 val="$define"
12317         else
12318                 echo "Your stdio isn't very std."
12319         fi
12320 else
12321         echo "Your stdio doesn't appear very std."
12322 fi
12323 $rm -f try.c try
12324
12325 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12326 # direct buffer manipulation no longer works.  The Configure tests
12327 # should be changed to correctly detect this, but until then,
12328 # the following check should at least let perl compile and run.
12329 # (This quick fix should be updated before 5.8.1.)
12330 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12331 # A. Dougherty, June 3, 2002.
12332 case "$d_gnulibc" in
12333 $define)
12334         case "$gnulibc_version" in
12335         2.[01]*)  ;;
12336         2.2) ;;
12337         2.2.[0-9]) ;;
12338         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12339                 val="$undef"
12340                 ;;
12341         esac
12342         ;;
12343 esac
12344 set d_stdstdio
12345 eval $setvar
12346
12347 : Can _ptr be used as an lvalue?
12348 case "$d_stdstdio$ptr_lval" in
12349 $define$define) val=$define ;;
12350 *) val=$undef ;;
12351 esac
12352 set d_stdio_ptr_lval
12353 eval $setvar
12354
12355 : Can _cnt be used as an lvalue?
12356 case "$d_stdstdio$cnt_lval" in
12357 $define$define) val=$define ;;
12358 *) val=$undef ;;
12359 esac
12360 set d_stdio_cnt_lval
12361 eval $setvar
12362
12363
12364 : test whether setting _ptr sets _cnt as a side effect
12365 d_stdio_ptr_lval_sets_cnt="$undef"
12366 d_stdio_ptr_lval_nochange_cnt="$undef"
12367 case "$d_stdio_ptr_lval$d_stdstdio" in
12368 $define$define)
12369         echo "Checking to see what happens if we set the stdio ptr..." >&4
12370 $cat >try.c <<EOP
12371 #include <stdio.h>
12372 /* Can we scream? */
12373 /* Eat dust sed :-) */
12374 /* In the buffer space, no one can hear you scream. */
12375 #$i_stdlib I_STDLIB
12376 #ifdef I_STDLIB
12377 #include <stdlib.h>
12378 #endif
12379 #define FILE_ptr(fp)    $stdio_ptr
12380 #define FILE_cnt(fp)    $stdio_cnt
12381 #include <sys/types.h>
12382 int main() {
12383         FILE *fp = fopen("try.c", "r");
12384         int c;
12385         char *ptr;
12386         size_t cnt;
12387         if (!fp) {
12388             puts("Fail even to read");
12389             exit(1);
12390         }
12391         c = getc(fp); /* Read away the first # */
12392         if (c == EOF) {
12393             puts("Fail even to read");
12394             exit(1);
12395         }
12396         if (!(
12397                 18 <= FILE_cnt(fp) &&
12398                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12399         )) {
12400                 puts("Fail even to read");
12401                 exit (1);
12402         }
12403         ptr = (char*) FILE_ptr(fp);
12404         cnt = (size_t)FILE_cnt(fp);
12405
12406         FILE_ptr(fp) += 42;
12407
12408         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12409                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12410                 exit (1);
12411         }
12412         if (FILE_cnt(fp) <= 20) {
12413                 printf ("Fail (<20 chars to test)");
12414                 exit (1);
12415         }
12416         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12417                 puts("Fail compare");
12418                 exit (1);
12419         }
12420         if (cnt == FILE_cnt(fp)) {
12421                 puts("Pass_unchanged");
12422                 exit (0);
12423         }       
12424         if (FILE_cnt(fp) == (cnt - 42)) {
12425                 puts("Pass_changed");
12426                 exit (0);
12427         }
12428         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12429         return 1;
12430
12431 }
12432 EOP
12433         set try
12434         if eval $compile && $to try.c; then
12435                 case `$run ./try` in
12436                 Pass_changed)
12437                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12438                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12439                 Pass_unchanged)
12440                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12441                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12442                 Fail*)
12443                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12444                 *)
12445                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12446         esac
12447         else
12448                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12449         fi
12450         $rm -f try.c try
12451         ;;
12452 esac
12453
12454 : see if _base is also standard
12455 val="$undef"
12456 case "$d_stdstdio" in
12457 $define)
12458         $cat >try.c <<EOP
12459 #include <stdio.h>
12460 #$i_stdlib I_STDLIB
12461 #ifdef I_STDLIB
12462 #include <stdlib.h>
12463 #endif
12464 #define FILE_base(fp)   $stdio_base
12465 #define FILE_bufsiz(fp) $stdio_bufsiz
12466 int main() {
12467         FILE *fp = fopen("try.c", "r");
12468         char c = getc(fp);
12469         if (
12470                 19 <= FILE_bufsiz(fp) &&
12471                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12472         )
12473                 exit(0);
12474         exit(1);
12475 }
12476 EOP
12477         set try
12478         if eval $compile && $to try.c; then
12479                 if $run ./try; then
12480                         echo "And its _base field acts std."
12481                         val="$define"
12482                 else
12483                         echo "But its _base field isn't std."
12484                 fi
12485         else
12486                 echo "However, it seems to be lacking the _base field."
12487         fi
12488         $rm -f try.c try
12489         ;;
12490 esac
12491 set d_stdiobase
12492 eval $setvar
12493
12494 : see if fast_stdio exists
12495 val="$undef"
12496 case "$d_stdstdio:$d_stdio_ptr_lval" in
12497 "$define:$define")
12498         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12499         *$define*)
12500                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12501                 val="$define"
12502                 ;;
12503         esac
12504         ;;
12505 esac
12506 set d_faststdio
12507 eval $setvar
12508
12509
12510
12511 : see if fchdir exists
12512 set fchdir d_fchdir
12513 eval $inlibc
12514
12515 : see if fchmod exists
12516 set fchmod d_fchmod
12517 eval $inlibc
12518
12519 : see if fchown exists
12520 set fchown d_fchown
12521 eval $inlibc
12522
12523 : see if this is an fcntl system
12524 set fcntl d_fcntl
12525 eval $inlibc
12526
12527 echo " "
12528 : See if fcntl-based locking works.
12529 $cat >try.c <<EOCP
12530 #$i_stdlib I_STDLIB
12531 #ifdef I_STDLIB
12532 #include <stdlib.h>
12533 #endif
12534 #include <unistd.h>
12535 #include <fcntl.h>
12536 #include <signal.h>
12537 $signal_t blech(int x) { exit(3); }
12538 int main() {
12539 #if defined(F_SETLK) && defined(F_SETLKW)
12540      struct flock flock;
12541      int retval, fd;
12542      fd = open("try.c", O_RDONLY);
12543      flock.l_type = F_RDLCK;
12544      flock.l_whence = SEEK_SET;
12545      flock.l_start = flock.l_len = 0;
12546      signal(SIGALRM, blech);
12547      alarm(10);
12548      retval = fcntl(fd, F_SETLK, &flock);
12549      close(fd);
12550      (retval < 0 ? exit(2) : exit(0));
12551 #else
12552      exit(2);
12553 #endif
12554 }
12555 EOCP
12556 echo "Checking if fcntl-based file locking works... "
12557 case "$d_fcntl" in
12558 "$define")
12559         set try
12560         if eval $compile_ok; then
12561                 if $run ./try; then
12562                         echo "Yes, it seems to work."
12563                         val="$define"
12564                 else
12565                         echo "Nope, it didn't work."
12566                         val="$undef"
12567                         case "$?" in
12568                         3) $cat >&4 <<EOM
12569 ***
12570 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12571 *** This is (almost) impossible.
12572 *** If your NFS lock daemons are not feeling well, something like
12573 *** this may happen, please investigate.  Cannot continue, aborting.
12574 ***
12575 EOM
12576                                 exit 1
12577                                 ;;
12578                         esac
12579                 fi
12580         else
12581                 echo "I'm unable to compile the test program, so I'll assume not."
12582                 val="$undef"
12583         fi
12584         ;;
12585 *) val="$undef";
12586         echo "Nope, since you don't even have fcntl()."
12587         ;;
12588 esac
12589 set d_fcntl_can_lock
12590 eval $setvar
12591 $rm -f try*
12592
12593
12594 : check for fd_set items
12595 $cat <<EOM
12596
12597 Checking to see how well your C compiler handles fd_set and friends ...
12598 EOM
12599 $cat >try.c <<EOCP
12600 #$i_stdlib I_STDLIB
12601 #ifdef I_STDLIB
12602 #include <stdlib.h>
12603 #endif
12604 #$i_systime I_SYS_TIME
12605 #$i_sysselct I_SYS_SELECT
12606 #$d_socket HAS_SOCKET
12607 #include <sys/types.h>
12608 #ifdef HAS_SOCKET
12609 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12610 #endif
12611 #ifdef I_SYS_TIME
12612 #include <sys/time.h>
12613 #endif
12614 #ifdef I_SYS_SELECT
12615 #include <sys/select.h>
12616 #endif
12617 int main() {
12618         fd_set fds;
12619
12620 #ifdef TRYBITS
12621         if(fds.fds_bits);
12622 #endif
12623
12624 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12625         exit(0);
12626 #else
12627         exit(1);
12628 #endif
12629 }
12630 EOCP
12631 set try -DTRYBITS
12632 if eval $compile; then
12633         d_fds_bits="$define"
12634         d_fd_set="$define"
12635         echo "Well, your system knows about the normal fd_set typedef..." >&4
12636         if $run ./try; then
12637                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12638                 d_fd_macros="$define"
12639         else
12640                 $cat >&4 <<'EOM'
12641 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12642 EOM
12643                 d_fd_macros="$undef"
12644         fi
12645 else
12646         $cat <<'EOM'
12647 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12648 EOM
12649         set try
12650         if eval $compile; then
12651                 d_fds_bits="$undef"
12652                 d_fd_set="$define"
12653                 echo "Well, your system has some sort of fd_set available..." >&4
12654                 if $run ./try; then
12655                         echo "and you have the normal fd_set macros." >&4
12656                         d_fd_macros="$define"
12657                 else
12658                         $cat <<'EOM'
12659 but not the normal fd_set macros!  Gross!  More work for me...
12660 EOM
12661                         d_fd_macros="$undef"
12662                 fi
12663         else
12664         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12665                 d_fd_set="$undef"
12666                 d_fds_bits="$undef"
12667                 d_fd_macros="$undef"
12668         fi
12669 fi
12670 $rm -f try try.*
12671
12672 : see if fgetpos exists
12673 set fgetpos d_fgetpos
12674 eval $inlibc
12675
12676 : see if finite exists
12677 set finite d_finite
12678 eval $inlibc
12679
12680 : see if finitel exists
12681 set finitel d_finitel
12682 eval $inlibc
12683
12684 : see if flock exists
12685 set flock d_flock
12686 eval $inlibc
12687
12688 : see if prototype for flock is available
12689 echo " "
12690 set d_flockproto flock $i_sysfile sys/file.h
12691 eval $hasproto
12692
12693 : see if fork exists
12694 set fork d_fork
12695 eval $inlibc
12696
12697 : see if fp_class exists
12698 set fp_class d_fp_class
12699 eval $inlibc
12700
12701 : see if pathconf exists
12702 set pathconf d_pathconf
12703 eval $inlibc
12704
12705 : see if fpathconf exists
12706 set fpathconf d_fpathconf
12707 eval $inlibc
12708
12709 : see if fpclass exists
12710 set fpclass d_fpclass
12711 eval $inlibc
12712
12713 : see if fpclassify exists
12714 set fpclassify d_fpclassify
12715 eval $inlibc
12716
12717 : see if fpclassl exists
12718 set fpclassl d_fpclassl
12719 eval $inlibc
12720
12721
12722 : check for fpos64_t
12723 echo " "
12724 echo "Checking to see if you have fpos64_t..." >&4
12725 $cat >try.c <<EOCP
12726 #include <stdio.h>
12727 int main() { fpos64_t x = 7; }
12728 EOCP
12729 set try
12730 if eval $compile; then
12731         val="$define"
12732         echo "You have fpos64_t."
12733 else
12734         val="$undef"
12735         echo "You do not have fpos64_t."
12736         case "$fpossize" in
12737         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12738         esac
12739 fi
12740 $rm -f try.* try
12741 set d_fpos64_t
12742 eval $setvar
12743
12744 : see if frexpl exists
12745 set frexpl d_frexpl
12746 eval $inlibc
12747
12748 : see if this is a sys/param system
12749 set sys/param.h i_sysparam
12750 eval $inhdr
12751
12752 : see if this is a sys/mount.h system
12753 set sys/mount.h i_sysmount
12754 eval $inhdr
12755
12756
12757 echo " "
12758 echo "Checking to see if your system supports struct fs_data..." >&4
12759 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12760 eval $hasstruct
12761 case "$d_fs_data_s" in
12762 "$define")      echo "Yes, it does."   ;;
12763 *)              echo "No, it doesn't." ;;
12764 esac
12765
12766 : see if fseeko exists
12767 set fseeko d_fseeko
12768 eval $inlibc
12769 case "$longsize" in
12770 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12771 esac
12772
12773 : see if fsetpos exists
12774 set fsetpos d_fsetpos
12775 eval $inlibc
12776
12777
12778 : see if fstatfs exists
12779 set fstatfs d_fstatfs
12780 eval $inlibc
12781
12782
12783 : see if statvfs exists
12784 set statvfs d_statvfs
12785 eval $inlibc
12786
12787 : see if fstatvfs exists
12788 set fstatvfs d_fstatvfs
12789 eval $inlibc
12790
12791
12792 : see if fsync exists
12793 set fsync d_fsync
12794 eval $inlibc
12795
12796 : see if ftello exists
12797 set ftello d_ftello
12798 eval $inlibc
12799 case "$longsize" in
12800 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12801 esac
12802
12803 d_futimes="$undef"
12804 : check for a working futimes
12805 echo " "
12806 echo "Checking for a working futimes()" >&4
12807 $cat >try.c <<EOCP
12808 #include <stdio.h>
12809 #include <sys/time.h>
12810 #include <errno.h>
12811 #include <fcntl.h>
12812
12813 int main ()
12814 {
12815     int fd, rv;
12816     fd = open ("try.c", O_RDWR);
12817     if (-1 == fd) exit (1);
12818     rv = futimes (fd, NULL);
12819     exit (rv == -1 ? errno : 0);
12820 }
12821 EOCP
12822 set try
12823 if eval $compile; then
12824     `$run ./try`
12825     rc=$?
12826     case "$rc" in
12827         0)  echo "Yes, it does" >&4
12828             d_futimes="$define"
12829             ;;
12830         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12831             ;;
12832     esac
12833 else
12834     echo "No, it does not (probably harmless)\n" >&4
12835 fi
12836 $rm -f try.* try core core.try.*
12837
12838 : see if getcwd exists
12839 set getcwd d_getcwd
12840 eval $inlibc
12841
12842 : see if getespwnam exists
12843 set getespwnam d_getespwnam
12844 eval $inlibc
12845
12846
12847 : see if getfsstat exists
12848 set getfsstat d_getfsstat
12849 eval $inlibc
12850
12851 : see if getgrent exists
12852 set getgrent d_getgrent
12853 eval $inlibc
12854
12855 : see if getgrent_r exists
12856 set getgrent_r d_getgrent_r
12857 eval $inlibc
12858 case "$d_getgrent_r" in
12859 "$define")
12860         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12861         case "$d_getgrent_r_proto:$usethreads" in
12862         ":define")      d_getgrent_r_proto=define
12863                 set d_getgrent_r_proto getgrent_r $hdrs
12864                 eval $hasproto ;;
12865         *)      ;;
12866         esac
12867         case "$d_getgrent_r_proto" in
12868         define)
12869         case "$getgrent_r_proto" in
12870         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12871         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12872         esac
12873         case "$getgrent_r_proto" in
12874         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12875         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12876         esac
12877         case "$getgrent_r_proto" in
12878         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12879         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12880         esac
12881         case "$getgrent_r_proto" in
12882         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12883         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12884         esac
12885         case "$getgrent_r_proto" in
12886         ''|0) try='int getgrent_r(struct group*, char*, int);'
12887         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12888         esac
12889         case "$getgrent_r_proto" in
12890         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12891         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12892         esac
12893         case "$getgrent_r_proto" in
12894         ''|0)   d_getgrent_r=undef
12895                 getgrent_r_proto=0
12896                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12897         * )     case "$getgrent_r_proto" in
12898                 REENTRANT_PROTO*) ;;
12899                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12900                 esac
12901                 echo "Prototype: $try" ;;
12902         esac
12903         ;;
12904         *)      case "$usethreads" in
12905                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12906                 esac
12907                 d_getgrent_r=undef
12908                 getgrent_r_proto=0
12909                 ;;
12910         esac
12911         ;;
12912 *)      getgrent_r_proto=0
12913         ;;
12914 esac
12915
12916 : see if getgrgid_r exists
12917 set getgrgid_r d_getgrgid_r
12918 eval $inlibc
12919 case "$d_getgrgid_r" in
12920 "$define")
12921         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12922         case "$d_getgrgid_r_proto:$usethreads" in
12923         ":define")      d_getgrgid_r_proto=define
12924                 set d_getgrgid_r_proto getgrgid_r $hdrs
12925                 eval $hasproto ;;
12926         *)      ;;
12927         esac
12928         case "$d_getgrgid_r_proto" in
12929         define)
12930         case "$getgrgid_r_proto" in
12931         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12932         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12933         esac
12934         case "$getgrgid_r_proto" in
12935         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12936         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12937         esac
12938         case "$getgrgid_r_proto" in
12939         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12940         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12941         esac
12942         case "$getgrgid_r_proto" in
12943         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12944         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12945         esac
12946         case "$getgrgid_r_proto" in
12947         ''|0)   d_getgrgid_r=undef
12948                 getgrgid_r_proto=0
12949                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12950         * )     case "$getgrgid_r_proto" in
12951                 REENTRANT_PROTO*) ;;
12952                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12953                 esac
12954                 echo "Prototype: $try" ;;
12955         esac
12956         ;;
12957         *)      case "$usethreads" in
12958                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12959                 esac
12960                 d_getgrgid_r=undef
12961                 getgrgid_r_proto=0
12962                 ;;
12963         esac
12964         ;;
12965 *)      getgrgid_r_proto=0
12966         ;;
12967 esac
12968
12969 : see if getgrnam_r exists
12970 set getgrnam_r d_getgrnam_r
12971 eval $inlibc
12972 case "$d_getgrnam_r" in
12973 "$define")
12974         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12975         case "$d_getgrnam_r_proto:$usethreads" in
12976         ":define")      d_getgrnam_r_proto=define
12977                 set d_getgrnam_r_proto getgrnam_r $hdrs
12978                 eval $hasproto ;;
12979         *)      ;;
12980         esac
12981         case "$d_getgrnam_r_proto" in
12982         define)
12983         case "$getgrnam_r_proto" in
12984         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12985         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12986         esac
12987         case "$getgrnam_r_proto" in
12988         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12989         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12990         esac
12991         case "$getgrnam_r_proto" in
12992         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12993         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12994         esac
12995         case "$getgrnam_r_proto" in
12996         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12997         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12998         esac
12999         case "$getgrnam_r_proto" in
13000         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13001         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13002         esac
13003         case "$getgrnam_r_proto" in
13004         ''|0)   d_getgrnam_r=undef
13005                 getgrnam_r_proto=0
13006                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13007         * )     case "$getgrnam_r_proto" in
13008                 REENTRANT_PROTO*) ;;
13009                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13010                 esac
13011                 echo "Prototype: $try" ;;
13012         esac
13013         ;;
13014         *)      case "$usethreads" in
13015                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13016                 esac
13017                 d_getgrnam_r=undef
13018                 getgrnam_r_proto=0
13019                 ;;
13020         esac
13021         ;;
13022 *)      getgrnam_r_proto=0
13023         ;;
13024 esac
13025
13026 : see if gethostbyaddr exists
13027 set gethostbyaddr d_gethbyaddr
13028 eval $inlibc
13029
13030 : see if gethostbyname exists
13031 set gethostbyname d_gethbyname
13032 eval $inlibc
13033
13034 : see if gethostent exists
13035 set gethostent d_gethent
13036 eval $inlibc
13037
13038 : see how we will look up host name
13039 echo " "
13040 call=''
13041 if set gethostname val -f d_gethname; eval $csym; $val; then
13042         echo 'gethostname() found.' >&4
13043         d_gethname="$define"
13044         call=gethostname
13045 fi
13046 if set uname val -f d_uname; eval $csym; $val; then
13047         if ./xenix; then
13048                 $cat <<'EOM'
13049 uname() was found, but you're running xenix, and older versions of xenix
13050 have a broken uname(). If you don't really know whether your xenix is old
13051 enough to have a broken system call, use the default answer.
13052
13053 EOM
13054                 dflt=y
13055                 case "$d_uname" in
13056                 "$define") dflt=n;;
13057                 esac
13058                 rp='Is your uname() broken?'
13059                 . ./myread
13060                 case "$ans" in
13061                 n*) d_uname="$define"; call=uname;;
13062                 esac
13063         else
13064                 echo 'uname() found.' >&4
13065                 d_uname="$define"
13066                 case "$call" in
13067                 '') call=uname ;;
13068                 esac
13069         fi
13070 fi
13071 case "$d_gethname" in
13072 '') d_gethname="$undef";;
13073 esac
13074 case "$d_uname" in
13075 '') d_uname="$undef";;
13076 esac
13077 case "$d_uname$d_gethname" in
13078 *define*)
13079         dflt=n
13080         cat <<EOM
13081  
13082 Every now and then someone has a $call() that lies about the hostname
13083 but can't be fixed for political or economic reasons.  If you wish, I can
13084 pretend $call() isn't there and maybe compute hostname at run-time
13085 thanks to the '$phostname' command.
13086
13087 EOM
13088         rp="Shall I ignore $call() from now on?"
13089         . ./myread
13090         case "$ans" in
13091         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13092         esac;;
13093 esac
13094 case "$phostname" in
13095 '') aphostname='';;
13096 *) case "$aphostname" in
13097         /*) ;;
13098         *) set X $phostname
13099                 shift
13100                 file=$1
13101                 shift
13102                 file=`./loc $file $file $pth`
13103                 aphostname=`echo $file $*`
13104                 ;;
13105         esac
13106         ;;
13107 esac
13108 case "$d_uname$d_gethname" in
13109 *define*) ;;
13110 *)
13111         case "$phostname" in
13112         '')
13113                 echo "There will be no way for $package to get your hostname." >&4;;
13114         *)
13115         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13116                 ;;
13117         esac;;
13118 esac
13119 case "$d_phostname" in
13120 '') d_phostname="$undef";;
13121 esac
13122
13123 : see if gethostbyaddr_r exists
13124 set gethostbyaddr_r d_gethostbyaddr_r
13125 eval $inlibc
13126 case "$d_gethostbyaddr_r" in
13127 "$define")
13128         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13129         case "$d_gethostbyaddr_r_proto:$usethreads" in
13130         ":define")      d_gethostbyaddr_r_proto=define
13131                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13132                 eval $hasproto ;;
13133         *)      ;;
13134         esac
13135         case "$d_gethostbyaddr_r_proto" in
13136         define)
13137         case "$gethostbyaddr_r_proto" in
13138         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13139         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13140         esac
13141         case "$gethostbyaddr_r_proto" in
13142         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13143         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13144         esac
13145         case "$gethostbyaddr_r_proto" in
13146         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13147         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13148         esac
13149         case "$gethostbyaddr_r_proto" in
13150         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13151         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13152         esac
13153         case "$gethostbyaddr_r_proto" in
13154         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13155         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13156         esac
13157         case "$gethostbyaddr_r_proto" in
13158         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13159         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13160         esac
13161         case "$gethostbyaddr_r_proto" in
13162         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13163         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13164         esac
13165         case "$gethostbyaddr_r_proto" in
13166         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13167         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13168         esac
13169         case "$gethostbyaddr_r_proto" in
13170         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13171         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13172         esac
13173         case "$gethostbyaddr_r_proto" in
13174         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13175         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13176         esac
13177         case "$gethostbyaddr_r_proto" in
13178         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13179         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13180         esac
13181         case "$gethostbyaddr_r_proto" in
13182         ''|0)   d_gethostbyaddr_r=undef
13183                 gethostbyaddr_r_proto=0
13184                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13185         * )     case "$gethostbyaddr_r_proto" in
13186                 REENTRANT_PROTO*) ;;
13187                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13188                 esac
13189                 echo "Prototype: $try" ;;
13190         esac
13191         ;;
13192         *)      case "$usethreads" in
13193                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13194                 esac
13195                 d_gethostbyaddr_r=undef
13196                 gethostbyaddr_r_proto=0
13197                 ;;
13198         esac
13199         ;;
13200 *)      gethostbyaddr_r_proto=0
13201         ;;
13202 esac
13203
13204 : see if gethostbyname_r exists
13205 set gethostbyname_r d_gethostbyname_r
13206 eval $inlibc
13207 case "$d_gethostbyname_r" in
13208 "$define")
13209         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13210         case "$d_gethostbyname_r_proto:$usethreads" in
13211         ":define")      d_gethostbyname_r_proto=define
13212                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13213                 eval $hasproto ;;
13214         *)      ;;
13215         esac
13216         case "$d_gethostbyname_r_proto" in
13217         define)
13218         case "$gethostbyname_r_proto" in
13219         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13220         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13221         esac
13222         case "$gethostbyname_r_proto" in
13223         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13224         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13225         esac
13226         case "$gethostbyname_r_proto" in
13227         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13228         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13229         esac
13230         case "$gethostbyname_r_proto" in
13231         ''|0)   d_gethostbyname_r=undef
13232                 gethostbyname_r_proto=0
13233                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13234         * )     case "$gethostbyname_r_proto" in
13235                 REENTRANT_PROTO*) ;;
13236                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13237                 esac
13238                 echo "Prototype: $try" ;;
13239         esac
13240         ;;
13241         *)      case "$usethreads" in
13242                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13243                 esac
13244                 d_gethostbyname_r=undef
13245                 gethostbyname_r_proto=0
13246                 ;;
13247         esac
13248         ;;
13249 *)      gethostbyname_r_proto=0
13250         ;;
13251 esac
13252
13253 : see if gethostent_r exists
13254 set gethostent_r d_gethostent_r
13255 eval $inlibc
13256 case "$d_gethostent_r" in
13257 "$define")
13258         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13259         case "$d_gethostent_r_proto:$usethreads" in
13260         ":define")      d_gethostent_r_proto=define
13261                 set d_gethostent_r_proto gethostent_r $hdrs
13262                 eval $hasproto ;;
13263         *)      ;;
13264         esac
13265         case "$d_gethostent_r_proto" in
13266         define)
13267         case "$gethostent_r_proto" in
13268         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13269         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13270         esac
13271         case "$gethostent_r_proto" in
13272         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13273         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13274         esac
13275         case "$gethostent_r_proto" in
13276         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13277         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13278         esac
13279         case "$gethostent_r_proto" in
13280         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13281         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13282         esac
13283         case "$gethostent_r_proto" in
13284         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13285         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13286         esac
13287         case "$gethostent_r_proto" in
13288         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13289         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13290         esac
13291         case "$gethostent_r_proto" in
13292         ''|0)   d_gethostent_r=undef
13293                 gethostent_r_proto=0
13294                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13295         * )     case "$gethostent_r_proto" in
13296                 REENTRANT_PROTO*) ;;
13297                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13298                 esac
13299                 echo "Prototype: $try" ;;
13300         esac
13301         ;;
13302         *)      case "$usethreads" in
13303                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13304                 esac
13305                 d_gethostent_r=undef
13306                 gethostent_r_proto=0
13307                 ;;
13308         esac
13309         ;;
13310 *)      gethostent_r_proto=0
13311         ;;
13312 esac
13313
13314 : see if prototypes for various gethostxxx netdb.h functions are available
13315 echo " "
13316 set d_gethostprotos gethostent $i_netdb netdb.h
13317 eval $hasproto
13318
13319 : see if getitimer exists
13320 set getitimer d_getitimer
13321 eval $inlibc
13322
13323 : see if getlogin exists
13324 set getlogin d_getlogin
13325 eval $inlibc
13326
13327 : see if getlogin_r exists
13328 set getlogin_r d_getlogin_r
13329 eval $inlibc
13330 case "$d_getlogin_r" in
13331 "$define")
13332         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13333         case "$d_getlogin_r_proto:$usethreads" in
13334         ":define")      d_getlogin_r_proto=define
13335                 set d_getlogin_r_proto getlogin_r $hdrs
13336                 eval $hasproto ;;
13337         *)      ;;
13338         esac
13339         case "$d_getlogin_r_proto" in
13340         define)
13341         case "$getlogin_r_proto" in
13342         ''|0) try='int getlogin_r(char*, size_t);'
13343         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13344         esac
13345         case "$getlogin_r_proto" in
13346         ''|0) try='int getlogin_r(char*, int);'
13347         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13348         esac
13349         case "$getlogin_r_proto" in
13350         ''|0) try='char* getlogin_r(char*, size_t);'
13351         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13352         esac
13353         case "$getlogin_r_proto" in
13354         ''|0) try='char* getlogin_r(char*, int);'
13355         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13356         esac
13357         case "$getlogin_r_proto" in
13358         ''|0)   d_getlogin_r=undef
13359                 getlogin_r_proto=0
13360                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13361         * )     case "$getlogin_r_proto" in
13362                 REENTRANT_PROTO*) ;;
13363                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13364                 esac
13365                 echo "Prototype: $try" ;;
13366         esac
13367         ;;
13368         *)      case "$usethreads" in
13369                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13370                 esac
13371                 d_getlogin_r=undef
13372                 getlogin_r_proto=0
13373                 ;;
13374         esac
13375         ;;
13376 *)      getlogin_r_proto=0
13377         ;;
13378 esac
13379
13380 : see if getmnt exists
13381 set getmnt d_getmnt
13382 eval $inlibc
13383
13384 : see if getmntent exists
13385 set getmntent d_getmntent
13386 eval $inlibc
13387
13388 : see if getnetbyaddr exists
13389 set getnetbyaddr d_getnbyaddr
13390 eval $inlibc
13391
13392 : see if getnetbyname exists
13393 set getnetbyname d_getnbyname
13394 eval $inlibc
13395
13396 : see if getnetent exists
13397 set getnetent d_getnent
13398 eval $inlibc
13399
13400 : see if getnetbyaddr_r exists
13401 set getnetbyaddr_r d_getnetbyaddr_r
13402 eval $inlibc
13403 case "$d_getnetbyaddr_r" in
13404 "$define")
13405         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13406         case "$d_getnetbyaddr_r_proto:$usethreads" in
13407         ":define")      d_getnetbyaddr_r_proto=define
13408                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13409                 eval $hasproto ;;
13410         *)      ;;
13411         esac
13412         case "$d_getnetbyaddr_r_proto" in
13413         define)
13414         case "$getnetbyaddr_r_proto" in
13415         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13416         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13417         esac
13418         case "$getnetbyaddr_r_proto" in
13419         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13420         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13421         esac
13422         case "$getnetbyaddr_r_proto" in
13423         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13424         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13425         esac
13426         case "$getnetbyaddr_r_proto" in
13427         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13428         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13429         esac
13430         case "$getnetbyaddr_r_proto" in
13431         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13432         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13433         esac
13434         case "$getnetbyaddr_r_proto" in
13435         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13436         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13437         esac
13438         case "$getnetbyaddr_r_proto" in
13439         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13440         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13441         esac
13442         case "$getnetbyaddr_r_proto" in
13443         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13444         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13445         esac
13446         case "$getnetbyaddr_r_proto" in
13447         ''|0)   d_getnetbyaddr_r=undef
13448                 getnetbyaddr_r_proto=0
13449                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13450         * )     case "$getnetbyaddr_r_proto" in
13451                 REENTRANT_PROTO*) ;;
13452                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13453                 esac
13454                 echo "Prototype: $try" ;;
13455         esac
13456         ;;
13457         *)      case "$usethreads" in
13458                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13459                 esac
13460                 d_getnetbyaddr_r=undef
13461                 getnetbyaddr_r_proto=0
13462                 ;;
13463         esac
13464         ;;
13465 *)      getnetbyaddr_r_proto=0
13466         ;;
13467 esac
13468
13469 : see if getnetbyname_r exists
13470 set getnetbyname_r d_getnetbyname_r
13471 eval $inlibc
13472 case "$d_getnetbyname_r" in
13473 "$define")
13474         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13475         case "$d_getnetbyname_r_proto:$usethreads" in
13476         ":define")      d_getnetbyname_r_proto=define
13477                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13478                 eval $hasproto ;;
13479         *)      ;;
13480         esac
13481         case "$d_getnetbyname_r_proto" in
13482         define)
13483         case "$getnetbyname_r_proto" in
13484         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13485         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13486         esac
13487         case "$getnetbyname_r_proto" in
13488         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13489         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13490         esac
13491         case "$getnetbyname_r_proto" in
13492         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13493         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13494         esac
13495         case "$getnetbyname_r_proto" in
13496         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13497         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13498         esac
13499         case "$getnetbyname_r_proto" in
13500         ''|0)   d_getnetbyname_r=undef
13501                 getnetbyname_r_proto=0
13502                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13503         * )     case "$getnetbyname_r_proto" in
13504                 REENTRANT_PROTO*) ;;
13505                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13506                 esac
13507                 echo "Prototype: $try" ;;
13508         esac
13509         ;;
13510         *)      case "$usethreads" in
13511                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13512                 esac
13513                 d_getnetbyname_r=undef
13514                 getnetbyname_r_proto=0
13515                 ;;
13516         esac
13517         ;;
13518 *)      getnetbyname_r_proto=0
13519         ;;
13520 esac
13521
13522 : see if getnetent_r exists
13523 set getnetent_r d_getnetent_r
13524 eval $inlibc
13525 case "$d_getnetent_r" in
13526 "$define")
13527         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13528         case "$d_getnetent_r_proto:$usethreads" in
13529         ":define")      d_getnetent_r_proto=define
13530                 set d_getnetent_r_proto getnetent_r $hdrs
13531                 eval $hasproto ;;
13532         *)      ;;
13533         esac
13534         case "$d_getnetent_r_proto" in
13535         define)
13536         case "$getnetent_r_proto" in
13537         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13538         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13539         esac
13540         case "$getnetent_r_proto" in
13541         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13542         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13543         esac
13544         case "$getnetent_r_proto" in
13545         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13546         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13547         esac
13548         case "$getnetent_r_proto" in
13549         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13550         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13551         esac
13552         case "$getnetent_r_proto" in
13553         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13554         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13555         esac
13556         case "$getnetent_r_proto" in
13557         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13558         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13559         esac
13560         case "$getnetent_r_proto" in
13561         ''|0)   d_getnetent_r=undef
13562                 getnetent_r_proto=0
13563                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13564         * )     case "$getnetent_r_proto" in
13565                 REENTRANT_PROTO*) ;;
13566                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13567                 esac
13568                 echo "Prototype: $try" ;;
13569         esac
13570         ;;
13571         *)      case "$usethreads" in
13572                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13573                 esac
13574                 d_getnetent_r=undef
13575                 getnetent_r_proto=0
13576                 ;;
13577         esac
13578         ;;
13579 *)      getnetent_r_proto=0
13580         ;;
13581 esac
13582
13583 : see if prototypes for various getnetxxx netdb.h functions are available
13584 echo " "
13585 set d_getnetprotos getnetent $i_netdb netdb.h
13586 eval $hasproto
13587
13588 : see if getpagesize exists
13589 set getpagesize d_getpagsz
13590 eval $inlibc
13591
13592
13593 : see if getprotobyname exists
13594 set getprotobyname d_getpbyname
13595 eval $inlibc
13596
13597 : see if getprotobynumber exists
13598 set getprotobynumber d_getpbynumber
13599 eval $inlibc
13600
13601 : see if getprotoent exists
13602 set getprotoent d_getpent
13603 eval $inlibc
13604
13605 : see if getpgid exists
13606 set getpgid d_getpgid
13607 eval $inlibc
13608
13609 : see if getpgrp2 exists
13610 set getpgrp2 d_getpgrp2
13611 eval $inlibc
13612
13613 : see if getppid exists
13614 set getppid d_getppid
13615 eval $inlibc
13616
13617 : see if getpriority exists
13618 set getpriority d_getprior
13619 eval $inlibc
13620
13621 : see if getprotobyname_r exists
13622 set getprotobyname_r d_getprotobyname_r
13623 eval $inlibc
13624 case "$d_getprotobyname_r" in
13625 "$define")
13626         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13627         case "$d_getprotobyname_r_proto:$usethreads" in
13628         ":define")      d_getprotobyname_r_proto=define
13629                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13630                 eval $hasproto ;;
13631         *)      ;;
13632         esac
13633         case "$d_getprotobyname_r_proto" in
13634         define)
13635         case "$getprotobyname_r_proto" in
13636         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13637         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13638         esac
13639         case "$getprotobyname_r_proto" in
13640         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13641         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13642         esac
13643         case "$getprotobyname_r_proto" in
13644         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13645         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13646         esac
13647         case "$getprotobyname_r_proto" in
13648         ''|0)   d_getprotobyname_r=undef
13649                 getprotobyname_r_proto=0
13650                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13651         * )     case "$getprotobyname_r_proto" in
13652                 REENTRANT_PROTO*) ;;
13653                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13654                 esac
13655                 echo "Prototype: $try" ;;
13656         esac
13657         ;;
13658         *)      case "$usethreads" in
13659                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13660                 esac
13661                 d_getprotobyname_r=undef
13662                 getprotobyname_r_proto=0
13663                 ;;
13664         esac
13665         ;;
13666 *)      getprotobyname_r_proto=0
13667         ;;
13668 esac
13669
13670 : see if getprotobynumber_r exists
13671 set getprotobynumber_r d_getprotobynumber_r
13672 eval $inlibc
13673 case "$d_getprotobynumber_r" in
13674 "$define")
13675         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13676         case "$d_getprotobynumber_r_proto:$usethreads" in
13677         ":define")      d_getprotobynumber_r_proto=define
13678                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13679                 eval $hasproto ;;
13680         *)      ;;
13681         esac
13682         case "$d_getprotobynumber_r_proto" in
13683         define)
13684         case "$getprotobynumber_r_proto" in
13685         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13686         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13687         esac
13688         case "$getprotobynumber_r_proto" in
13689         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13690         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13691         esac
13692         case "$getprotobynumber_r_proto" in
13693         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13694         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13695         esac
13696         case "$getprotobynumber_r_proto" in
13697         ''|0)   d_getprotobynumber_r=undef
13698                 getprotobynumber_r_proto=0
13699                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13700         * )     case "$getprotobynumber_r_proto" in
13701                 REENTRANT_PROTO*) ;;
13702                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13703                 esac
13704                 echo "Prototype: $try" ;;
13705         esac
13706         ;;
13707         *)      case "$usethreads" in
13708                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13709                 esac
13710                 d_getprotobynumber_r=undef
13711                 getprotobynumber_r_proto=0
13712                 ;;
13713         esac
13714         ;;
13715 *)      getprotobynumber_r_proto=0
13716         ;;
13717 esac
13718
13719 : see if getprotoent_r exists
13720 set getprotoent_r d_getprotoent_r
13721 eval $inlibc
13722 case "$d_getprotoent_r" in
13723 "$define")
13724         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13725         case "$d_getprotoent_r_proto:$usethreads" in
13726         ":define")      d_getprotoent_r_proto=define
13727                 set d_getprotoent_r_proto getprotoent_r $hdrs
13728                 eval $hasproto ;;
13729         *)      ;;
13730         esac
13731         case "$d_getprotoent_r_proto" in
13732         define)
13733         case "$getprotoent_r_proto" in
13734         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13735         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13736         esac
13737         case "$getprotoent_r_proto" in
13738         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13739         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13740         esac
13741         case "$getprotoent_r_proto" in
13742         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13743         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13744         esac
13745         case "$getprotoent_r_proto" in
13746         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13747         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13748         esac
13749         case "$getprotoent_r_proto" in
13750         ''|0)   d_getprotoent_r=undef
13751                 getprotoent_r_proto=0
13752                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13753         * )     case "$getprotoent_r_proto" in
13754                 REENTRANT_PROTO*) ;;
13755                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13756                 esac
13757                 echo "Prototype: $try" ;;
13758         esac
13759         ;;
13760         *)      case "$usethreads" in
13761                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13762                 esac
13763                 d_getprotoent_r=undef
13764                 getprotoent_r_proto=0
13765                 ;;
13766         esac
13767         ;;
13768 *)      getprotoent_r_proto=0
13769         ;;
13770 esac
13771
13772 : see if prototypes for various getprotoxxx netdb.h functions are available
13773 echo " "
13774 set d_getprotoprotos getprotoent $i_netdb netdb.h
13775 eval $hasproto
13776
13777 : see if getprpwnam exists
13778 set getprpwnam d_getprpwnam
13779 eval $inlibc
13780
13781 : see if getpwent exists
13782 set getpwent d_getpwent
13783 eval $inlibc
13784
13785 : see if getpwent_r exists
13786 set getpwent_r d_getpwent_r
13787 eval $inlibc
13788 case "$d_getpwent_r" in
13789 "$define")
13790         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13791         case "$d_getpwent_r_proto:$usethreads" in
13792         ":define")      d_getpwent_r_proto=define
13793                 set d_getpwent_r_proto getpwent_r $hdrs
13794                 eval $hasproto ;;
13795         *)      ;;
13796         esac
13797         case "$d_getpwent_r_proto" in
13798         define)
13799         case "$getpwent_r_proto" in
13800         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13801         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13802         esac
13803         case "$getpwent_r_proto" in
13804         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13805         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13806         esac
13807         case "$getpwent_r_proto" in
13808         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13809         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13810         esac
13811         case "$getpwent_r_proto" in
13812         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13813         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13814         esac
13815         case "$getpwent_r_proto" in
13816         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13817         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13818         esac
13819         case "$getpwent_r_proto" in
13820         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13821         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13822         esac
13823         case "$getpwent_r_proto" in
13824         ''|0)   d_getpwent_r=undef
13825                 getpwent_r_proto=0
13826                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13827         * )     case "$getpwent_r_proto" in
13828                 REENTRANT_PROTO*) ;;
13829                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13830                 esac
13831                 echo "Prototype: $try" ;;
13832         esac
13833         ;;
13834         *)      case "$usethreads" in
13835                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13836                 esac
13837                 d_getpwent_r=undef
13838                 getpwent_r_proto=0
13839                 ;;
13840         esac
13841         ;;
13842 *)      getpwent_r_proto=0
13843         ;;
13844 esac
13845
13846 : see if getpwnam_r exists
13847 set getpwnam_r d_getpwnam_r
13848 eval $inlibc
13849 case "$d_getpwnam_r" in
13850 "$define")
13851         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13852         case "$d_getpwnam_r_proto:$usethreads" in
13853         ":define")      d_getpwnam_r_proto=define
13854                 set d_getpwnam_r_proto getpwnam_r $hdrs
13855                 eval $hasproto ;;
13856         *)      ;;
13857         esac
13858         case "$d_getpwnam_r_proto" in
13859         define)
13860         case "$getpwnam_r_proto" in
13861         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13862         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13863         esac
13864         case "$getpwnam_r_proto" in
13865         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13866         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13867         esac
13868         case "$getpwnam_r_proto" in
13869         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13870         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13871         esac
13872         case "$getpwnam_r_proto" in
13873         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13874         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13875         esac
13876         case "$getpwnam_r_proto" in
13877         ''|0)   d_getpwnam_r=undef
13878                 getpwnam_r_proto=0
13879                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13880         * )     case "$getpwnam_r_proto" in
13881                 REENTRANT_PROTO*) ;;
13882                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13883                 esac
13884                 echo "Prototype: $try" ;;
13885         esac
13886         ;;
13887         *)      case "$usethreads" in
13888                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13889                 esac
13890                 d_getpwnam_r=undef
13891                 getpwnam_r_proto=0
13892                 ;;
13893         esac
13894         ;;
13895 *)      getpwnam_r_proto=0
13896         ;;
13897 esac
13898
13899 : see if getpwuid_r exists
13900 set getpwuid_r d_getpwuid_r
13901 eval $inlibc
13902 case "$d_getpwuid_r" in
13903 "$define")
13904         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13905         case "$d_getpwuid_r_proto:$usethreads" in
13906         ":define")      d_getpwuid_r_proto=define
13907                 set d_getpwuid_r_proto getpwuid_r $hdrs
13908                 eval $hasproto ;;
13909         *)      ;;
13910         esac
13911         case "$d_getpwuid_r_proto" in
13912         define)
13913         case "$getpwuid_r_proto" in
13914         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13915         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13916         esac
13917         case "$getpwuid_r_proto" in
13918         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13919         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13920         esac
13921         case "$getpwuid_r_proto" in
13922         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13923         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13924         esac
13925         case "$getpwuid_r_proto" in
13926         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13927         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13928         esac
13929         case "$getpwuid_r_proto" in
13930         ''|0)   d_getpwuid_r=undef
13931                 getpwuid_r_proto=0
13932                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13933         * )     case "$getpwuid_r_proto" in
13934                 REENTRANT_PROTO*) ;;
13935                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13936                 esac
13937                 echo "Prototype: $try" ;;
13938         esac
13939         ;;
13940         *)      case "$usethreads" in
13941                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13942                 esac
13943                 d_getpwuid_r=undef
13944                 getpwuid_r_proto=0
13945                 ;;
13946         esac
13947         ;;
13948 *)      getpwuid_r_proto=0
13949         ;;
13950 esac
13951
13952
13953 : see if getservbyname exists
13954 set getservbyname d_getsbyname
13955 eval $inlibc
13956
13957 : see if getservbyport exists
13958 set getservbyport d_getsbyport
13959 eval $inlibc
13960
13961 : see if getservent exists
13962 set getservent d_getsent
13963 eval $inlibc
13964
13965 : see if getservbyname_r exists
13966 set getservbyname_r d_getservbyname_r
13967 eval $inlibc
13968 case "$d_getservbyname_r" in
13969 "$define")
13970         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13971         case "$d_getservbyname_r_proto:$usethreads" in
13972         ":define")      d_getservbyname_r_proto=define
13973                 set d_getservbyname_r_proto getservbyname_r $hdrs
13974                 eval $hasproto ;;
13975         *)      ;;
13976         esac
13977         case "$d_getservbyname_r_proto" in
13978         define)
13979         case "$getservbyname_r_proto" in
13980         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13981         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13982         esac
13983         case "$getservbyname_r_proto" in
13984         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13985         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13986         esac
13987         case "$getservbyname_r_proto" in
13988         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13989         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13990         esac
13991         case "$getservbyname_r_proto" in
13992         ''|0)   d_getservbyname_r=undef
13993                 getservbyname_r_proto=0
13994                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13995         * )     case "$getservbyname_r_proto" in
13996                 REENTRANT_PROTO*) ;;
13997                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13998                 esac
13999                 echo "Prototype: $try" ;;
14000         esac
14001         ;;
14002         *)      case "$usethreads" in
14003                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14004                 esac
14005                 d_getservbyname_r=undef
14006                 getservbyname_r_proto=0
14007                 ;;
14008         esac
14009         ;;
14010 *)      getservbyname_r_proto=0
14011         ;;
14012 esac
14013
14014 : see if getservbyport_r exists
14015 set getservbyport_r d_getservbyport_r
14016 eval $inlibc
14017 case "$d_getservbyport_r" in
14018 "$define")
14019         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14020         case "$d_getservbyport_r_proto:$usethreads" in
14021         ":define")      d_getservbyport_r_proto=define
14022                 set d_getservbyport_r_proto getservbyport_r $hdrs
14023                 eval $hasproto ;;
14024         *)      ;;
14025         esac
14026         case "$d_getservbyport_r_proto" in
14027         define)
14028         case "$getservbyport_r_proto" in
14029         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14030         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14031         esac
14032         case "$getservbyport_r_proto" in
14033         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14034         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14035         esac
14036         case "$getservbyport_r_proto" in
14037         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14038         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14039         esac
14040         case "$getservbyport_r_proto" in
14041         ''|0)   d_getservbyport_r=undef
14042                 getservbyport_r_proto=0
14043                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14044         * )     case "$getservbyport_r_proto" in
14045                 REENTRANT_PROTO*) ;;
14046                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14047                 esac
14048                 echo "Prototype: $try" ;;
14049         esac
14050         ;;
14051         *)      case "$usethreads" in
14052                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14053                 esac
14054                 d_getservbyport_r=undef
14055                 getservbyport_r_proto=0
14056                 ;;
14057         esac
14058         ;;
14059 *)      getservbyport_r_proto=0
14060         ;;
14061 esac
14062
14063 : see if getservent_r exists
14064 set getservent_r d_getservent_r
14065 eval $inlibc
14066 case "$d_getservent_r" in
14067 "$define")
14068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14069         case "$d_getservent_r_proto:$usethreads" in
14070         ":define")      d_getservent_r_proto=define
14071                 set d_getservent_r_proto getservent_r $hdrs
14072                 eval $hasproto ;;
14073         *)      ;;
14074         esac
14075         case "$d_getservent_r_proto" in
14076         define)
14077         case "$getservent_r_proto" in
14078         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14079         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14080         esac
14081         case "$getservent_r_proto" in
14082         ''|0) try='int getservent_r(struct servent*, char*, int);'
14083         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14084         esac
14085         case "$getservent_r_proto" in
14086         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14087         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14088         esac
14089         case "$getservent_r_proto" in
14090         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14091         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14092         esac
14093         case "$getservent_r_proto" in
14094         ''|0)   d_getservent_r=undef
14095                 getservent_r_proto=0
14096                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14097         * )     case "$getservent_r_proto" in
14098                 REENTRANT_PROTO*) ;;
14099                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14100                 esac
14101                 echo "Prototype: $try" ;;
14102         esac
14103         ;;
14104         *)      case "$usethreads" in
14105                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14106                 esac
14107                 d_getservent_r=undef
14108                 getservent_r_proto=0
14109                 ;;
14110         esac
14111         ;;
14112 *)      getservent_r_proto=0
14113         ;;
14114 esac
14115
14116 : see if prototypes for various getservxxx netdb.h functions are available
14117 echo " "
14118 set d_getservprotos getservent $i_netdb netdb.h
14119 eval $hasproto
14120
14121 : see if getspnam exists
14122 set getspnam d_getspnam
14123 eval $inlibc
14124
14125 : see if this is a shadow.h system
14126 set shadow.h i_shadow
14127 eval $inhdr
14128
14129 : see if getspnam_r exists
14130 set getspnam_r d_getspnam_r
14131 eval $inlibc
14132 case "$d_getspnam_r" in
14133 "$define")
14134         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14135         case "$d_getspnam_r_proto:$usethreads" in
14136         ":define")      d_getspnam_r_proto=define
14137                 set d_getspnam_r_proto getspnam_r $hdrs
14138                 eval $hasproto ;;
14139         *)      ;;
14140         esac
14141         case "$d_getspnam_r_proto" in
14142         define)
14143         case "$getspnam_r_proto" in
14144         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14145         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14146         esac
14147         case "$getspnam_r_proto" in
14148         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14149         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14150         esac
14151         case "$getspnam_r_proto" in
14152         ''|0)   d_getspnam_r=undef
14153                 getspnam_r_proto=0
14154                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14155         * )     case "$getspnam_r_proto" in
14156                 REENTRANT_PROTO*) ;;
14157                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14158                 esac
14159                 echo "Prototype: $try" ;;
14160         esac
14161         ;;
14162         *)      case "$usethreads" in
14163                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14164                 esac
14165                 d_getspnam_r=undef
14166                 getspnam_r_proto=0
14167                 ;;
14168         esac
14169         ;;
14170 *)      getspnam_r_proto=0
14171         ;;
14172 esac
14173
14174 : see if gettimeofday or ftime exists
14175 set gettimeofday d_gettimeod
14176 eval $inlibc
14177 case "$d_gettimeod" in
14178 "$undef")
14179         set ftime d_ftime 
14180         eval $inlibc
14181         ;;
14182 *)
14183         val="$undef"; set d_ftime; eval $setvar
14184         ;;
14185 esac
14186 case "$d_gettimeod$d_ftime" in
14187 "$undef$undef")
14188         echo " "
14189         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14190         ;;
14191 esac
14192
14193 : see if gmtime_r exists
14194 set gmtime_r d_gmtime_r
14195 eval $inlibc
14196 case "$d_gmtime_r" in
14197 "$define")
14198         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14199         case "$d_gmtime_r_proto:$usethreads" in
14200         ":define")      d_gmtime_r_proto=define
14201                 set d_gmtime_r_proto gmtime_r $hdrs
14202                 eval $hasproto ;;
14203         *)      ;;
14204         esac
14205         case "$d_gmtime_r_proto" in
14206         define)
14207         case "$gmtime_r_proto" in
14208         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14209         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14210         esac
14211         case "$gmtime_r_proto" in
14212         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14213         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14214         esac
14215         case "$gmtime_r_proto" in
14216         ''|0)   d_gmtime_r=undef
14217                 gmtime_r_proto=0
14218                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14219         * )     case "$gmtime_r_proto" in
14220                 REENTRANT_PROTO*) ;;
14221                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14222                 esac
14223                 echo "Prototype: $try" ;;
14224         esac
14225         ;;
14226         *)      case "$usethreads" in
14227                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14228                 esac
14229                 d_gmtime_r=undef
14230                 gmtime_r_proto=0
14231                 ;;
14232         esac
14233         ;;
14234 *)      gmtime_r_proto=0
14235         ;;
14236 esac
14237
14238 : see if hasmntopt exists
14239 set hasmntopt d_hasmntopt
14240 eval $inlibc
14241
14242 : see if this is a netinet/in.h or sys/in.h system
14243 set netinet/in.h i_niin sys/in.h i_sysin
14244 eval $inhdr
14245
14246 : see if arpa/inet.h has to be included
14247 set arpa/inet.h i_arpainet
14248 eval $inhdr
14249
14250 : see if htonl --and friends-- exists
14251 val=''
14252 set htonl val
14253 eval $inlibc
14254
14255 : Maybe they are macros.
14256 case "$val" in
14257 $undef)
14258         $cat >htonl.c <<EOM
14259 #include <stdio.h>
14260 #include <sys/types.h>
14261 #$i_niin I_NETINET_IN
14262 #$i_sysin I_SYS_IN
14263 #$i_arpainet I_ARPA_INET
14264 #ifdef I_NETINET_IN
14265 #include <netinet/in.h>
14266 #endif
14267 #ifdef I_SYS_IN
14268 #include <sys/in.h>
14269 #endif
14270 #ifdef I_ARPA_INET
14271 #include <arpa/inet.h>
14272 #endif
14273 #ifdef htonl
14274 printf("Defined as a macro.");
14275 #endif
14276 EOM
14277         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14278         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14279                 val="$define"
14280                 echo "But it seems to be defined as a macro." >&4
14281         fi
14282         $rm -f htonl.?
14283         ;;
14284 esac
14285 set d_htonl
14286 eval $setvar
14287
14288 : see if ilogbl exists
14289 set ilogbl d_ilogbl
14290 eval $inlibc
14291
14292 : index or strchr
14293 echo " "
14294 if set index val -f; eval $csym; $val; then
14295         if set strchr val -f d_strchr; eval $csym; $val; then
14296                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14297                         val="$define"
14298                         vali="$undef"
14299                         echo "strchr() found." >&4
14300                 else
14301                         val="$undef"
14302                         vali="$define"
14303                         echo "index() found." >&4
14304                 fi
14305         else
14306                 val="$undef"
14307                 vali="$define"
14308                 echo "index() found." >&4
14309         fi
14310 else
14311         if set strchr val -f d_strchr; eval $csym; $val; then
14312                 val="$define"
14313                 vali="$undef"
14314                 echo "strchr() found." >&4
14315         else
14316                 echo "No index() or strchr() found!" >&4
14317                 val="$undef"
14318                 vali="$undef"
14319         fi
14320 fi
14321 set d_strchr; eval $setvar
14322 val="$vali"
14323 set d_index; eval $setvar
14324
14325 : check whether inet_aton exists
14326 set inet_aton d_inetaton
14327 eval $inlibc
14328
14329 : Look for isascii
14330 echo " "
14331 $cat >isascii.c <<EOCP
14332 #include <stdio.h>
14333 #include <ctype.h>
14334 #$i_stdlib I_STDLIB
14335 #ifdef I_STDLIB
14336 #include <stdlib.h>
14337 #endif
14338 int main() {
14339         int c = 'A';
14340         if (isascii(c))
14341                 exit(0);
14342         else
14343                 exit(1);
14344 }
14345 EOCP
14346 set isascii
14347 if eval $compile; then
14348         echo "isascii() found." >&4
14349         val="$define"
14350 else
14351         echo "isascii() NOT found." >&4
14352         val="$undef"
14353 fi
14354 set d_isascii
14355 eval $setvar
14356 $rm -f isascii*
14357
14358 : see if isfinite exists
14359 set isfinite d_isfinite
14360 eval $inlibc
14361
14362 : see if isinf exists
14363 set isinf d_isinf
14364 eval $inlibc
14365
14366 : see if isnan exists
14367 set isnan d_isnan
14368 eval $inlibc
14369
14370 : see if isnanl exists
14371 set isnanl d_isnanl
14372 eval $inlibc
14373
14374 : see if killpg exists
14375 set killpg d_killpg
14376 eval $inlibc
14377
14378 : see if lchown exists
14379 echo " "
14380 $cat > try.c <<'EOCP'
14381 /* System header to define __stub macros and hopefully few prototypes,
14382     which can conflict with char lchown(); below.  */
14383 #include <assert.h>
14384 /* Override any gcc2 internal prototype to avoid an error.  */
14385 /* We use char because int might match the return type of a gcc2
14386    builtin and then its argument prototype would still apply.  */
14387 char lchown();
14388 int main() {
14389     /*  The GNU C library defines this for functions which it implements
14390         to always fail with ENOSYS.  Some functions are actually named
14391         something starting with __ and the normal name is an alias.  */
14392 #if defined (__stub_lchown) || defined (__stub___lchown)
14393 choke me
14394 #else
14395 lchown();
14396 #endif
14397 ; return 0; }
14398 EOCP
14399 set try
14400 if eval $compile; then
14401     $echo "lchown() found." >&4
14402     val="$define"
14403 else
14404     $echo "lchown() NOT found." >&4
14405     val="$undef"
14406 fi
14407 set d_lchown
14408 eval $setvar
14409
14410 : See if number of significant digits in a double precision number is known
14411 echo " "
14412 $cat >ldbl_dig.c <<EOM
14413 #$i_limits I_LIMITS
14414 #$i_float I_FLOAT
14415 #ifdef I_LIMITS
14416 #include <limits.h>
14417 #endif
14418 #ifdef I_FLOAT
14419 #include <float.h>
14420 #endif
14421 #ifdef LDBL_DIG
14422 printf("Contains LDBL_DIG");
14423 #endif
14424 EOM
14425 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14426 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14427         echo "LDBL_DIG found." >&4
14428         val="$define"
14429 else
14430         echo "LDBL_DIG NOT found." >&4
14431         val="$undef"
14432 fi
14433 $rm -f ldbl_dig.?
14434 set d_ldbl_dig
14435 eval $setvar
14436
14437 : see if this is a math.h system
14438 set math.h i_math
14439 eval $inhdr
14440
14441 d_libm_lib_version="$undef"
14442 case $i_math in
14443     $define)
14444         : check to see if math.h defines _LIB_VERSION
14445         echo " "
14446         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14447         $cat >try.c <<EOCP
14448 #include <unistd.h>
14449 #include <math.h>
14450 int main (int argc, char *argv[])
14451 {
14452     printf ("%d\n", _LIB_VERSION);
14453     return (0);
14454     } /* main */
14455 EOCP
14456         set try
14457         if eval $compile; then
14458             foo=`$run ./try`
14459             echo "Yes, it does ($foo)" >&4
14460             d_libm_lib_version="$define"
14461         else
14462             echo "No, it does not (probably harmless)\n" >&4
14463             fi
14464         $rm -f try.* try core core.try.*
14465         ;;
14466
14467     esac
14468
14469 : see if link exists
14470 set link d_link
14471 eval $inlibc
14472
14473 : see if localtime_r exists
14474 set localtime_r d_localtime_r
14475 eval $inlibc
14476 case "$d_localtime_r" in
14477 "$define")
14478         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14479         case "$d_localtime_r_proto:$usethreads" in
14480         ":define")      d_localtime_r_proto=define
14481                 set d_localtime_r_proto localtime_r $hdrs
14482                 eval $hasproto ;;
14483         *)      ;;
14484         esac
14485         case "$d_localtime_r_proto" in
14486         define)
14487         case "$localtime_r_proto" in
14488         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14489         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14490         esac
14491         case "$localtime_r_proto" in
14492         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14493         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14494         esac
14495         case "$localtime_r_proto" in
14496         ''|0)   d_localtime_r=undef
14497                 localtime_r_proto=0
14498                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14499         * )     case "$localtime_r_proto" in
14500                 REENTRANT_PROTO*) ;;
14501                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14502                 esac
14503                 echo "Prototype: $try" ;;
14504         esac
14505         ;;
14506         *)      case "$usethreads" in
14507                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14508                 esac
14509                 d_localtime_r=undef
14510                 localtime_r_proto=0
14511                 ;;
14512         esac
14513         ;;
14514 *)      localtime_r_proto=0
14515         ;;
14516 esac
14517
14518 : see if localtime_r calls tzset
14519 case "$localtime_r_proto" in
14520 REENTRANT_PROTO*)
14521         $cat >try.c <<EOCP
14522 /*  Does our libc's localtime_r call tzset ?
14523  *  return 0 if so, 1 otherwise.
14524  */
14525 #include <sys/types.h>
14526 #include <unistd.h>
14527 #include <time.h>
14528 #include <string.h>
14529 #include <malloc.h>
14530 int main()
14531 {
14532     time_t t = time(0L);
14533     char w_tz[]="TZ" "=GMT+5",
14534          e_tz[]="TZ" "=GMT-5",
14535         *tz_e = (char*)malloc(16),
14536         *tz_w = (char*)malloc(16);
14537     struct tm tm_e, tm_w;
14538     memset(&tm_e,'\0',sizeof(struct tm));
14539     memset(&tm_w,'\0',sizeof(struct tm));
14540     strcpy(tz_e,e_tz);
14541     strcpy(tz_w,w_tz);
14542
14543     putenv(tz_e);
14544     localtime_r(&t, &tm_e);
14545
14546     putenv(tz_w);
14547     localtime_r(&t, &tm_w);
14548
14549     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14550         return 1;
14551     return 0;
14552 }
14553 EOCP
14554         set try
14555         if eval $compile; then
14556             if ./try; then
14557                 d_localtime_r_needs_tzset=undef;
14558             else
14559                 d_localtime_r_needs_tzset=define;
14560             fi;
14561         else
14562             d_localtime_r_needs_tzset=undef;
14563         fi;
14564      ;;
14565   *)
14566      d_localtime_r_needs_tzset=undef;
14567      ;;
14568 esac
14569 $rm -f try try.* core
14570
14571 : see if localeconv exists
14572 set localeconv d_locconv
14573 eval $inlibc
14574
14575 : see if lockf exists
14576 set lockf d_lockf
14577 eval $inlibc
14578
14579 : see if prototype for lseek is available
14580 echo " "
14581 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14582 eval $hasproto
14583
14584 : see if lstat exists
14585 set lstat d_lstat
14586 eval $inlibc
14587
14588 : see if madvise exists
14589 set madvise d_madvise
14590 eval $inlibc
14591
14592 : see if malloc_size exists
14593 set malloc_size d_malloc_size
14594 eval $inlibc
14595
14596 : see if malloc_size_good exists
14597 set malloc_good_size d_malloc_good_size
14598 eval $inlibc
14599
14600 : see if mblen exists
14601 set mblen d_mblen
14602 eval $inlibc
14603
14604 : see if mbstowcs exists
14605 set mbstowcs d_mbstowcs
14606 eval $inlibc
14607
14608 : see if mbtowc exists
14609 set mbtowc d_mbtowc
14610 eval $inlibc
14611
14612 : see if memchr exists
14613 set memchr d_memchr
14614 eval $inlibc
14615
14616 : see if memcmp exists
14617 set memcmp d_memcmp
14618 eval $inlibc
14619
14620 : see if memcpy exists
14621 set memcpy d_memcpy
14622 eval $inlibc
14623
14624 : see if memmove exists
14625 set memmove d_memmove
14626 eval $inlibc
14627
14628 : see if memset exists
14629 set memset d_memset
14630 eval $inlibc
14631
14632 : see if mkdir exists
14633 set mkdir d_mkdir
14634 eval $inlibc
14635
14636 : see if mkdtemp exists
14637 set mkdtemp d_mkdtemp
14638 eval $inlibc
14639
14640 : see if mkfifo exists
14641 set mkfifo d_mkfifo
14642 eval $inlibc
14643
14644 : see if mkstemp exists
14645 set mkstemp d_mkstemp
14646 eval $inlibc
14647
14648 : see if mkstemps exists
14649 set mkstemps d_mkstemps
14650 eval $inlibc
14651
14652 : see if mktime exists
14653 set mktime d_mktime
14654 eval $inlibc
14655
14656 : see if this is a sys/mman.h system
14657 set sys/mman.h i_sysmman
14658 eval $inhdr
14659
14660 : see if mmap exists
14661 set mmap d_mmap
14662 eval $inlibc
14663 : see what shmat returns
14664 : default to something harmless
14665 mmaptype='void *'
14666 case "$i_sysmman$d_mmap" in
14667 "$define$define")
14668         $cat >mmap.c <<'END'
14669 #include <sys/mman.h>
14670 void *mmap();
14671 END
14672         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14673                 mmaptype='void *'
14674         else
14675                 mmaptype='caddr_t'
14676         fi
14677         echo "and it returns ($mmaptype)." >&4
14678         ;;
14679 esac
14680
14681
14682
14683 : see if sqrtl exists
14684 set sqrtl d_sqrtl
14685 eval $inlibc
14686
14687 : see if scalbnl exists
14688 set scalbnl d_scalbnl
14689 eval $inlibc
14690
14691 : see if modfl exists
14692 set modfl d_modfl
14693 eval $inlibc
14694
14695 : see if prototype for modfl is available
14696 echo " "
14697 set d_modflproto modfl $i_math math.h
14698 eval $hasproto
14699
14700 d_modfl_pow32_bug="$undef"
14701
14702 case "$d_longdbl$d_modfl" in
14703 $define$define)
14704         $cat <<EOM
14705 Checking to see whether your modfl() is okay for large values...
14706 EOM
14707 $cat >try.c <<EOCP
14708 #include <math.h> 
14709 #include <stdio.h>
14710 EOCP
14711 if $test "X$d_modflproto" != "X$define"; then
14712         $cat >>try.c <<EOCP
14713 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14714 long double modfl (long double, long double *);
14715 EOCP
14716 fi
14717 $cat >>try.c <<EOCP
14718 int main() {
14719     long double nv = 4294967303.15;
14720     long double v, w;
14721     v = modfl(nv, &w);         
14722 #ifdef __GLIBC__
14723     printf("glibc");
14724 #endif
14725     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14726     return 0;
14727 }
14728 EOCP
14729         case "$osname:$gccversion" in
14730         aix:)   saveccflags="$ccflags"
14731                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14732         esac
14733         set try
14734         if eval $compile; then
14735                 foo=`$run ./try`
14736                 case "$foo" in
14737                 *" 4294967303.150000 1.150000 4294967302.000000")
14738                         echo >&4 "Your modfl() is broken for large values."
14739                         d_modfl_pow32_bug="$define"
14740                         case "$foo" in
14741                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14742                         ;;
14743                         esac
14744                         ;;
14745                 *" 4294967303.150000 0.150000 4294967303.000000")
14746                         echo >&4 "Your modfl() seems okay for large values."
14747                         ;;
14748                 *)      echo >&4 "I don't understand your modfl() at all."
14749                         d_modfl="$undef"
14750                         ;;
14751                 esac
14752                 $rm -f try.* try core core.try.*
14753         else
14754                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14755                 d_modfl="$undef"
14756         fi
14757         case "$osname:$gccversion" in
14758         aix:)   ccflags="$saveccflags" ;; # restore
14759         esac
14760         ;;
14761 esac
14762
14763 if $test "$uselongdouble" = "$define"; then
14764     message=""
14765     if $test "$d_sqrtl" != "$define"; then
14766         message="$message sqrtl"
14767     fi
14768     if $test "$d_modfl" != "$define"; then
14769         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14770             echo "You have both aintl and copysignl, so I can emulate modfl."
14771         else
14772             message="$message modfl"
14773         fi
14774     fi
14775     if $test "$d_frexpl" != "$define"; then
14776         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14777             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14778         else
14779             message="$message frexpl"
14780         fi
14781     fi
14782
14783     if $test "$message" != ""; then
14784         $cat <<EOM >&4
14785
14786 *** You requested the use of long doubles but you do not seem to have
14787 *** the following mathematical functions needed for long double support:
14788 ***    $message
14789 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14790 *** Cannot continue, aborting.
14791
14792 EOM
14793
14794         exit 1
14795     fi
14796 fi
14797
14798 : see if mprotect exists
14799 set mprotect d_mprotect
14800 eval $inlibc
14801
14802 : see if msgctl exists
14803 set msgctl d_msgctl
14804 eval $inlibc
14805
14806 : see if msgget exists
14807 set msgget d_msgget
14808 eval $inlibc
14809
14810 : see if msgsnd exists
14811 set msgsnd d_msgsnd
14812 eval $inlibc
14813
14814 : see if msgrcv exists
14815 set msgrcv d_msgrcv
14816 eval $inlibc
14817
14818 : see how much of the 'msg*(2)' library is present.
14819 h_msg=true
14820 echo " "
14821 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14822 *"$undef"*) h_msg=false;;
14823 esac
14824 case "$osname" in
14825 freebsd)
14826     case "`ipcs 2>&1`" in
14827     "SVID messages"*"not configured"*)
14828         echo "Your $osname does not have the msg*(2) configured." >&4
14829         h_msg=false
14830         val="$undef"
14831         set msgctl d_msgctl
14832         eval $setvar
14833         set msgget d_msgget
14834         eval $setvar
14835         set msgsnd d_msgsnd
14836         eval $setvar
14837         set msgrcv d_msgrcv
14838         eval $setvar
14839         ;;
14840     esac
14841     ;;
14842 esac
14843 : we could also check for sys/ipc.h ...
14844 if $h_msg && $test `./findhdr sys/msg.h`; then
14845         echo "You have the full msg*(2) library." >&4
14846         val="$define"
14847 else
14848         echo "You don't have the full msg*(2) library." >&4
14849         val="$undef"
14850 fi
14851 set d_msg
14852 eval $setvar
14853
14854
14855 echo " "
14856 echo "Checking to see if your system supports struct msghdr..." >&4
14857 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14858 eval $hasstruct
14859 case "$d_msghdr_s" in
14860 "$define")      echo "Yes, it does."   ;;
14861 *)              echo "No, it doesn't." ;;
14862 esac
14863
14864
14865 : see if msync exists
14866 set msync d_msync
14867 eval $inlibc
14868
14869 : see if munmap exists
14870 set munmap d_munmap
14871 eval $inlibc
14872
14873 : see if nice exists
14874 set nice d_nice
14875 eval $inlibc
14876
14877 : see if this is a langinfo.h system
14878 set langinfo.h i_langinfo
14879 eval $inhdr
14880
14881 : see if nl_langinfo exists
14882 set nl_langinfo d_nl_langinfo
14883 eval $inlibc
14884
14885 : check for length of character
14886 echo " "
14887 case "$charsize" in
14888 '')
14889         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14890         $cat >try.c <<EOCP
14891 #include <stdio.h>
14892 #$i_stdlib I_STDLIB
14893 #ifdef I_STDLIB
14894 #include <stdlib.h>
14895 #endif
14896 int main()
14897 {
14898     printf("%d\n", (int)sizeof(char));
14899     exit(0);
14900 }
14901 EOCP
14902         set try
14903         if eval $compile_ok; then
14904                 dflt=`$run ./try`
14905         else
14906                 dflt='1'
14907                 echo "(I can't seem to compile the test program.  Guessing...)"
14908         fi
14909         ;;
14910 *)
14911         dflt="$charsize"
14912         ;;
14913 esac
14914 rp="What is the size of a character (in bytes)?"
14915 . ./myread
14916 charsize="$ans"
14917 $rm -f try.c try
14918
14919 : check for volatile keyword
14920 echo " "
14921 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14922 $cat >try.c <<'EOCP'
14923 int main()
14924 {
14925         typedef struct _goo_struct goo_struct;
14926         goo_struct * volatile goo = ((goo_struct *)0);
14927         struct _goo_struct {
14928                 long long_int;
14929                 int reg_int;
14930                 char char_var;
14931         };
14932         typedef unsigned short foo_t;
14933         char *volatile foo;
14934         volatile int bar;
14935         volatile foo_t blech;
14936         foo = foo;
14937 }
14938 EOCP
14939 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14940         val="$define"
14941         echo "Yup, it does."
14942 else
14943         val="$undef"
14944         echo "Nope, it doesn't."
14945 fi
14946 set d_volatile
14947 eval $setvar
14948 $rm -f try.*
14949
14950
14951 echo " "
14952 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14953
14954 case "$use64bitint:$d_quad:$quadtype" in
14955 define:define:?*)
14956         ivtype="$quadtype"
14957         uvtype="$uquadtype"
14958         ivsize=8
14959         uvsize=8
14960         ;;
14961 *)      ivtype="long"
14962         uvtype="unsigned long"
14963         ivsize=$longsize
14964         uvsize=$longsize
14965         ;;
14966 esac
14967
14968 case "$uselongdouble:$d_longdbl" in
14969 define:define)
14970         nvtype="long double"
14971         nvsize=$longdblsize
14972         ;;
14973 *)      nvtype=double
14974         nvsize=$doublesize
14975         ;;
14976 esac
14977
14978 $echo "(IV will be "$ivtype", $ivsize bytes)"
14979 $echo "(UV will be "$uvtype", $uvsize bytes)"
14980 $echo "(NV will be "$nvtype", $nvsize bytes)"
14981
14982 $cat >try.c <<EOCP
14983 #$i_inttypes I_INTTYPES
14984 #ifdef I_INTTYPES
14985 #include <inttypes.h>
14986 #endif
14987 #include <stdio.h>
14988 int main() {
14989 #ifdef INT8
14990    int8_t i =  INT8_MAX;
14991   uint8_t u = UINT8_MAX;
14992   printf("int8_t\n");
14993 #endif
14994 #ifdef INT16
14995    int16_t i =  INT16_MAX;
14996   uint16_t i = UINT16_MAX;
14997   printf("int16_t\n");
14998 #endif
14999 #ifdef INT32
15000    int32_t i =  INT32_MAX;
15001   uint32_t u = UINT32_MAX;
15002   printf("int32_t\n");
15003 #endif
15004 }
15005 EOCP
15006
15007 case "$i8type" in
15008 '')     case "$charsize" in
15009         1)      i8type=char
15010                 u8type="unsigned char"
15011                 i8size=$charsize
15012                 u8size=$charsize
15013                 ;;
15014         esac
15015         ;;
15016 esac
15017 case "$i8type" in
15018 '')     set try -DINT8
15019         if eval $compile; then
15020                 case "`$run ./try`" in
15021                 int8_t) i8type=int8_t
15022                         u8type=uint8_t
15023                         i8size=1
15024                         u8size=1
15025                         ;;
15026                 esac
15027         fi
15028         ;;
15029 esac
15030 case "$i8type" in
15031 '')     if $test $charsize -ge 1; then
15032                 i8type=char
15033                 u8type="unsigned char"
15034                 i8size=$charsize
15035                 u8size=$charsize
15036         fi
15037         ;;
15038 esac
15039
15040 case "$i16type" in
15041 '')     case "$shortsize" in
15042         2)      i16type=short
15043                 u16type="unsigned short"
15044                 i16size=$shortsize
15045                 u16size=$shortsize
15046                 ;;
15047         esac
15048         ;;
15049 esac
15050 case "$i16type" in
15051 '')     set try -DINT16
15052         if eval $compile; then
15053                 case "`$run ./try`" in
15054                 int16_t)
15055                         i16type=int16_t
15056                         u16type=uint16_t
15057                         i16size=2
15058                         u16size=2
15059                         ;;
15060                 esac
15061         fi
15062         ;;
15063 esac
15064 case "$i16type" in
15065 '')     if $test $shortsize -ge 2; then
15066                 i16type=short
15067                 u16type="unsigned short"
15068                 i16size=$shortsize
15069                 u16size=$shortsize
15070         fi
15071         ;;
15072 esac
15073
15074 case "$i32type" in
15075 '')     case "$longsize" in
15076         4)      i32type=long
15077                 u32type="unsigned long"
15078                 i32size=$longsize
15079                 u32size=$longsize
15080                 ;;
15081         *)      case "$intsize" in
15082                 4)      i32type=int
15083                         u32type="unsigned int"
15084                         i32size=$intsize
15085                         u32size=$intsize
15086                         ;;
15087                 esac
15088                 ;;
15089         esac
15090         ;;
15091 esac
15092 case "$i32type" in
15093 '')     set try -DINT32
15094         if eval $compile; then
15095                 case "`$run ./try`" in
15096                 int32_t)
15097                         i32type=int32_t
15098                         u32type=uint32_t
15099                         i32size=4
15100                         u32size=4
15101                         ;;
15102                 esac
15103         fi
15104         ;;
15105 esac
15106 case "$i32type" in
15107 '')     if $test $intsize -ge 4; then
15108                 i32type=int
15109                 u32type="unsigned int"
15110                 i32size=$intsize
15111                 u32size=$intsize
15112         fi
15113         ;;
15114 esac
15115
15116 case "$i64type" in
15117 '')     case "$d_quad:$quadtype" in
15118         define:?*)
15119                 i64type="$quadtype"
15120                 u64type="$uquadtype"
15121                 i64size=8
15122                 u64size=8
15123                 ;;
15124         esac
15125         ;;
15126 esac
15127
15128 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15129 : volatile so that the compiler has to store it out to memory.
15130 if test X"$d_volatile" = X"$define"; then
15131         volatile=volatile
15132 fi
15133 $cat <<EOP >try.c
15134 #include <stdio.h>
15135 #$i_stdlib I_STDLIB
15136 #ifdef I_STDLIB
15137 #include <stdlib.h>
15138 #endif
15139 #include <sys/types.h>
15140 #include <signal.h>
15141 #ifdef SIGFPE
15142 $volatile int bletched = 0;
15143 $signal_t blech(int s) { bletched = 1; }
15144 #endif
15145 int main() {
15146     $uvtype u = 0;
15147     $nvtype d;
15148     int     n = 8 * $uvsize;
15149     int     i;
15150 #ifdef SIGFPE
15151     signal(SIGFPE, blech);
15152 #endif
15153
15154     for (i = 0; i < n; i++) {
15155       u = u << 1 | ($uvtype)1;
15156       d = ($nvtype)u;
15157       if (($uvtype)d != u)
15158         break;
15159       if (d <= 0)
15160         break;
15161       d = ($nvtype)(u - 1);
15162       if (($uvtype)d != (u - 1))
15163         break;
15164 #ifdef SIGFPE
15165       if (bletched) {
15166         break;
15167 #endif
15168       } 
15169     }
15170     printf("%d\n", ((i == n) ? -n : i));
15171     exit(0);
15172 }
15173 EOP
15174 set try
15175
15176 d_nv_preserves_uv="$undef"
15177 if eval $compile; then
15178         nv_preserves_uv_bits="`$run ./try`"
15179 fi
15180 case "$nv_preserves_uv_bits" in
15181 \-[1-9]*)       
15182         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15183         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15184         d_nv_preserves_uv="$define"
15185         ;;
15186 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15187         d_nv_preserves_uv="$undef" ;;
15188 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15189         nv_preserves_uv_bits="$undef" ;;
15190 esac
15191
15192 $rm -f try.* try
15193
15194 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15195 : volatile so that the compiler has to store it out to memory.
15196 if test X"$d_volatile" = X"$define"; then
15197         volatile=volatile
15198 fi
15199 $cat <<EOP >try.c
15200 #include <stdio.h>
15201 #$i_stdlib I_STDLIB
15202 #ifdef I_STDLIB
15203 #include <stdlib.h>
15204 #endif
15205 #$i_string I_STRING
15206 #ifdef I_STRING
15207 #  include <string.h>
15208 #else
15209 #  include <strings.h>
15210 #endif
15211 #include <sys/types.h>
15212 #include <signal.h>
15213 #ifdef SIGFPE
15214 $volatile int bletched = 0;
15215 $signal_t blech(int s) { bletched = 1; }
15216 #endif
15217
15218 int checkit($nvtype d, char *where) {
15219     unsigned char *p = (char *)&d;
15220     unsigned char *end = p + sizeof(d);
15221     int fail = 0;
15222
15223     while (p < end)
15224         fail += *p++;
15225
15226     if (!fail)
15227         return 0;
15228
15229     p = (char *)&d;
15230     printf("No - %s: 0x", where);
15231     while (p < end)
15232         printf ("%02X", *p++);
15233     printf("\n");
15234     return 1;
15235 }
15236
15237 int main(int argc, char **argv) {
15238     $nvtype d = 0.0;
15239     int fail = 0;
15240     fail += checkit(d, "0.0");
15241
15242     /* The compiler shouldn't be assuming that bletched is 0  */
15243     d = bletched;
15244
15245     fail += checkit(d, "bleched");
15246
15247 #ifdef SIGFPE
15248     signal(SIGFPE, blech);
15249 #endif
15250
15251     /* Paranoia - the compiler should have no way of knowing that ANSI says
15252        that argv[argc] will always be NULL.  Actually, if it did assume this it
15253        would be buggy, as this is C and main() can be called from elsewhere in
15254        the program.  */
15255     d = argv[argc] ? 1 : 0;
15256
15257     if (d) {
15258         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15259     }
15260
15261     fail += checkit(d, "ternary");
15262
15263     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15264
15265     if (d != 0.0) {
15266         printf("No - memset doesn't give 0.0\n");
15267         /* This might just blow up:  */
15268         printf("(gives %g)\n", d);
15269         return 1;
15270     }
15271     
15272 #ifdef SIGFPE
15273     if (bletched) {
15274         printf("No - something bleched\n");
15275         return 1;
15276     }
15277 #endif
15278     if (fail) {
15279       printf("No - %d fail(s)\n", fail);
15280       return 1;
15281     }
15282     printf("Yes\n");
15283     return 0;
15284 }
15285 EOP
15286 set try
15287
15288 d_nv_zero_is_allbits_zero="$undef"
15289 if eval $compile; then
15290     xxx="`$run ./try`"
15291     case "$?" in
15292         0)
15293             case "$xxx" in
15294                 Yes)  cat >&4 <<EOM
15295 0.0 is represented as all bits zero in memory
15296 EOM
15297                     d_nv_zero_is_allbits_zero="$define"
15298                     ;;
15299                 *)  cat >&4 <<EOM
15300 0.0 is not represented as all bits zero in memory
15301 EOM
15302                     d_nv_zero_is_allbits_zero="$undef"
15303                     ;;
15304             esac
15305             ;;
15306         *)  cat >&4 <<EOM
15307 0.0 is not represented as all bits zero in memory
15308 EOM
15309             d_nv_zero_is_allbits_zero="$undef"
15310             ;;
15311     esac
15312 fi
15313
15314 $rm -f try.* try
15315
15316
15317 : check for off64_t
15318 echo " "
15319 echo "Checking to see if you have off64_t..." >&4
15320 $cat >try.c <<EOCP
15321 #include <sys/types.h>
15322 #include <unistd.h>
15323 int main() { off64_t x = 7; }
15324 EOCP
15325 set try
15326 if eval $compile; then
15327         val="$define"
15328         echo "You have off64_t."
15329 else
15330         val="$undef"
15331         echo "You do not have off64_t."
15332         case "$lseeksize" in
15333         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15334         esac
15335 fi
15336 $rm -f try.* try
15337 set d_off64_t
15338 eval $setvar
15339
15340 : how to create joinable pthreads
15341 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15342         echo " "
15343         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15344         $cat >try.c <<'EOCP'
15345 #include <pthread.h>
15346 int main() {
15347     int detachstate = JOINABLE;
15348 }
15349 EOCP
15350         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15351         if eval $compile; then
15352                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15353                 val="$undef" # Yes, undef.
15354                 set d_old_pthread_create_joinable
15355                 eval $setvar
15356                 val=""
15357                 set old_pthread_create_joinable
15358                 eval $setvar
15359         else
15360                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15361                 if eval $compile; then
15362                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15363                         val="$define"
15364                         set d_old_pthread_create_joinable
15365                         eval $setvar
15366                         val=PTHREAD_CREATE_UNDETACHED
15367                         set old_pthread_create_joinable
15368                         eval $setvar
15369                 else            
15370                         set try -DJOINABLE=__UNDETACHED
15371                         if eval $compile; then
15372                                 echo "You seem to use __UNDETACHED." >&4
15373                                 val="$define"
15374                                 set d_old_pthread_create_joinable
15375                                 eval $setvar
15376                                 val=__UNDETACHED
15377                                 set old_pthread_create_joinable
15378                                 eval $setvar
15379                         else
15380                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15381                                 val="$define"
15382                                 set d_old_pthread_create_joinable
15383                                 eval $setvar
15384                                 val=0
15385                                 set old_pthread_create_joinable
15386                                 eval $setvar
15387                         fi
15388                 fi
15389         fi
15390         $rm -f try try.*
15391 else
15392     d_old_pthread_create_joinable="$undef"
15393     old_pthread_create_joinable=""
15394 fi
15395
15396 : see if pause exists
15397 set pause d_pause
15398 eval $inlibc
15399
15400 : see if pipe exists
15401 set pipe d_pipe
15402 eval $inlibc
15403
15404 : see if poll exists
15405 set poll d_poll
15406 eval $inlibc
15407
15408 : see if readlink exists
15409 set readlink d_readlink
15410 eval $inlibc
15411
15412 echo " "
15413 procselfexe=''
15414 val="$undef"
15415 case "$d_readlink" in
15416 "$define")
15417         if $issymlink /proc/self/exe ; then
15418                 $ls -l /proc/self/exe > reflect
15419                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15420                         echo "You have Linux-like /proc/self/exe."
15421                         procselfexe='"/proc/self/exe"'
15422                         val="$define"
15423                 fi
15424         fi
15425         if $issymlink /proc/curproc/file ; then
15426                 $ls -l /proc/curproc/file > reflect
15427                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15428                         echo "You have BSD-like /proc/curproc/file."
15429                         procselfexe='"/proc/curproc/file"'
15430                         val="$define"
15431                 fi
15432         fi
15433         ;;
15434 esac
15435 $rm -f reflect
15436 set d_procselfexe
15437 eval $setvar
15438
15439 : see whether the pthread_atfork exists
15440 $cat >try.c <<EOP
15441 #include <pthread.h>
15442 #include <stdio.h>
15443 int main() {
15444 #ifdef  PTHREAD_ATFORK
15445         pthread_atfork(NULL,NULL,NULL);
15446 #endif
15447 }
15448 EOP
15449
15450 : see if pthread_atfork exists
15451 set try -DPTHREAD_ATFORK
15452 if eval $compile; then
15453     val="$define"
15454 else
15455     val="$undef"
15456 fi
15457 case "$usethreads" in
15458 $define)
15459         case "$val" in
15460         $define) echo 'pthread_atfork found.' >&4        ;;
15461         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15462         esac
15463 esac
15464 set d_pthread_atfork
15465 eval $setvar
15466
15467 : see if pthread_attr_setscope exists
15468 set pthread_attr_setscope d_pthread_attr_setscope
15469 eval $inlibc
15470
15471
15472 : see whether the various POSIXish _yields exist
15473 $cat >try.c <<EOP
15474 #include <pthread.h>
15475 #include <stdio.h>
15476 int main() {
15477 #ifdef SCHED_YIELD
15478         sched_yield();
15479 #else
15480 #ifdef PTHREAD_YIELD
15481         pthread_yield();
15482 #else
15483 #ifdef PTHREAD_YIELD_NULL
15484         pthread_yield(NULL);
15485 #endif
15486 #endif
15487 #endif
15488 }
15489 EOP
15490 : see if sched_yield exists
15491 set try -DSCHED_YIELD
15492 if eval $compile; then
15493     val="$define"
15494     sched_yield='sched_yield()'
15495 else
15496     val="$undef"
15497 fi
15498 case "$usethreads" in
15499 $define)
15500         case "$val" in
15501         $define) echo 'sched_yield() found.' >&4        ;;
15502         *)       echo 'sched_yield() NOT found.' >&4    ;;
15503         esac
15504 esac
15505 set d_sched_yield
15506 eval $setvar
15507
15508 : see if pthread_yield exists
15509 set try -DPTHREAD_YIELD
15510 if eval $compile; then
15511     val="$define"
15512     case "$sched_yield" in
15513     '') sched_yield='pthread_yield()' ;;
15514     esac
15515 else
15516     set try -DPTHREAD_YIELD_NULL
15517     if eval $compile; then
15518         val="$define"
15519         case "$sched_yield" in
15520         '') sched_yield='pthread_yield(NULL)' ;;
15521         esac
15522     else
15523         val="$undef"
15524     fi
15525 fi
15526 case "$usethreads" in
15527 $define)
15528         case "$val" in
15529         $define) echo 'pthread_yield() found.' >&4      ;;
15530         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15531         esac
15532         ;;
15533 esac
15534 set d_pthread_yield
15535 eval $setvar
15536
15537 case "$sched_yield" in
15538 '') sched_yield=undef ;;
15539 esac
15540
15541 $rm -f try try.*
15542
15543 : see if random_r exists
15544 set random_r d_random_r
15545 eval $inlibc
15546 case "$d_random_r" in
15547 "$define")
15548         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15549         case "$d_random_r_proto:$usethreads" in
15550         ":define")      d_random_r_proto=define
15551                 set d_random_r_proto random_r $hdrs
15552                 eval $hasproto ;;
15553         *)      ;;
15554         esac
15555         case "$d_random_r_proto" in
15556         define)
15557         case "$random_r_proto" in
15558         ''|0) try='int random_r(int*, struct random_data*);'
15559         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15560         esac
15561         case "$random_r_proto" in
15562         ''|0) try='int random_r(long*, struct random_data*);'
15563         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15564         esac
15565         case "$random_r_proto" in
15566         ''|0) try='int random_r(struct random_data*, int32_t*);'
15567         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15568         esac
15569         case "$random_r_proto" in
15570         ''|0)   d_random_r=undef
15571                 random_r_proto=0
15572                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15573         * )     case "$random_r_proto" in
15574                 REENTRANT_PROTO*) ;;
15575                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15576                 esac
15577                 echo "Prototype: $try" ;;
15578         esac
15579         ;;
15580         *)      case "$usethreads" in
15581                 define) echo "random_r has no prototype, not using it." >&4 ;;
15582                 esac
15583                 d_random_r=undef
15584                 random_r_proto=0
15585                 ;;
15586         esac
15587         ;;
15588 *)      random_r_proto=0
15589         ;;
15590 esac
15591
15592 : see if readdir and friends exist
15593 set readdir d_readdir
15594 eval $inlibc
15595 set seekdir d_seekdir
15596 eval $inlibc
15597 set telldir d_telldir
15598 eval $inlibc
15599 set rewinddir d_rewinddir
15600 eval $inlibc
15601
15602 : see if readdir64_r exists
15603 set readdir64_r d_readdir64_r
15604 eval $inlibc
15605 case "$d_readdir64_r" in
15606 "$define")
15607         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15608         case "$d_readdir64_r_proto:$usethreads" in
15609         ":define")      d_readdir64_r_proto=define
15610                 set d_readdir64_r_proto readdir64_r $hdrs
15611                 eval $hasproto ;;
15612         *)      ;;
15613         esac
15614         case "$d_readdir64_r_proto" in
15615         define)
15616         case "$readdir64_r_proto" in
15617         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15618         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15619         esac
15620         case "$readdir64_r_proto" in
15621         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15622         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15623         esac
15624         case "$readdir64_r_proto" in
15625         ''|0)   d_readdir64_r=undef
15626                 readdir64_r_proto=0
15627                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15628         * )     case "$readdir64_r_proto" in
15629                 REENTRANT_PROTO*) ;;
15630                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15631                 esac
15632                 echo "Prototype: $try" ;;
15633         esac
15634         ;;
15635         *)      case "$usethreads" in
15636                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15637                 esac
15638                 d_readdir64_r=undef
15639                 readdir64_r_proto=0
15640                 ;;
15641         esac
15642         ;;
15643 *)      readdir64_r_proto=0
15644         ;;
15645 esac
15646
15647 : see if readdir_r exists
15648 set readdir_r d_readdir_r
15649 eval $inlibc
15650 case "$d_readdir_r" in
15651 "$define")
15652         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15653         case "$d_readdir_r_proto:$usethreads" in
15654         ":define")      d_readdir_r_proto=define
15655                 set d_readdir_r_proto readdir_r $hdrs
15656                 eval $hasproto ;;
15657         *)      ;;
15658         esac
15659         case "$d_readdir_r_proto" in
15660         define)
15661         case "$readdir_r_proto" in
15662         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15663         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15664         esac
15665         case "$readdir_r_proto" in
15666         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15667         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15668         esac
15669         case "$readdir_r_proto" in
15670         ''|0)   d_readdir_r=undef
15671                 readdir_r_proto=0
15672                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15673         * )     case "$readdir_r_proto" in
15674                 REENTRANT_PROTO*) ;;
15675                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15676                 esac
15677                 echo "Prototype: $try" ;;
15678         esac
15679         ;;
15680         *)      case "$usethreads" in
15681                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15682                 esac
15683                 d_readdir_r=undef
15684                 readdir_r_proto=0
15685                 ;;
15686         esac
15687         ;;
15688 *)      readdir_r_proto=0
15689         ;;
15690 esac
15691
15692 : see if readv exists
15693 set readv d_readv
15694 eval $inlibc
15695
15696 : see if recvmsg exists
15697 set recvmsg d_recvmsg
15698 eval $inlibc
15699
15700 : see if rename exists
15701 set rename d_rename
15702 eval $inlibc
15703
15704 : see if rmdir exists
15705 set rmdir d_rmdir
15706 eval $inlibc
15707
15708 : see if memory.h is available.
15709 val=''
15710 set memory.h val
15711 eval $inhdr
15712
15713 : See if it conflicts with string.h
15714 case "$val" in
15715 $define)
15716         case "$strings" in
15717         '') ;;
15718         *)
15719                 $cppstdin $cppflags $cppminus < $strings > mem.h
15720                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15721                         echo " "
15722                         echo "We won't be including <memory.h>."
15723                         val="$undef"
15724                 fi
15725                 $rm -f mem.h
15726                 ;;
15727         esac
15728 esac
15729 set i_memory
15730 eval $setvar
15731
15732 : can bcopy handle overlapping blocks?
15733 echo " "
15734 val="$undef"
15735 case "$d_memmove" in
15736 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15737 *)      case "$d_bcopy" in
15738         "$define")
15739                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15740                 $cat >try.c <<EOCP
15741 #$i_memory I_MEMORY
15742 #$i_stdlib I_STDLIB
15743 #$i_string I_STRING
15744 #$i_unistd I_UNISTD
15745 EOCP
15746         $cat >>try.c <<'EOCP'
15747 #include <stdio.h>
15748 #ifdef I_MEMORY
15749 #  include <memory.h>
15750 #endif
15751 #ifdef I_STDLIB
15752 #  include <stdlib.h>
15753 #endif
15754 #ifdef I_STRING
15755 #  include <string.h>
15756 #else
15757 #  include <strings.h>
15758 #endif
15759 #ifdef I_UNISTD
15760 #  include <unistd.h>  /* Needed for NetBSD */
15761 #endif
15762 int main()
15763 {
15764 char buf[128], abc[128];
15765 char *b;
15766 int len;
15767 int off;
15768 int align;
15769
15770 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15771    try to store the string in read-only memory. */
15772 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15773
15774 for (align = 7; align >= 0; align--) {
15775         for (len = 36; len; len--) {
15776                 b = buf+align;
15777                 bcopy(abc, b, len);
15778                 for (off = 1; off <= len; off++) {
15779                         bcopy(b, b+off, len);
15780                         bcopy(b+off, b, len);
15781                         if (bcmp(b, abc, len))
15782                                 exit(1);
15783                 }
15784         }
15785 }
15786 exit(0);
15787 }
15788 EOCP
15789                 set try
15790                 if eval $compile_ok; then
15791                         if ./try 2>/dev/null; then
15792                                 echo "Yes, it can."
15793                                 val="$define"
15794                         else
15795                                 echo "It can't, sorry."
15796                         fi
15797                 else
15798                         echo "(I can't compile the test program, so we'll assume not...)"
15799                 fi
15800                 ;;
15801         esac
15802         $rm -f try.* try core
15803         ;;
15804 esac
15805 set d_safebcpy
15806 eval $setvar
15807
15808 : can memcpy handle overlapping blocks?
15809 echo " "
15810 val="$undef"
15811 case "$d_memmove" in
15812 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15813 *)      case "$d_memcpy" in
15814         "$define")
15815                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15816                 $cat >try.c <<EOCP
15817 #$i_memory I_MEMORY
15818 #$i_stdlib I_STDLIB
15819 #$i_string I_STRING
15820 #$i_unistd I_UNISTD
15821 EOCP
15822         $cat >>try.c <<'EOCP'
15823 #include <stdio.h>
15824 #ifdef I_MEMORY
15825 #  include <memory.h>
15826 #endif
15827 #ifdef I_STDLIB
15828 #  include <stdlib.h>
15829 #endif
15830 #ifdef I_STRING
15831 #  include <string.h>
15832 #else
15833 #  include <strings.h>
15834 #endif
15835 #ifdef I_UNISTD
15836 #  include <unistd.h>  /* Needed for NetBSD */
15837 #endif
15838 int main()
15839 {
15840 char buf[128], abc[128];
15841 char *b;
15842 int len;
15843 int off;
15844 int align;
15845
15846 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15847    try to store the string in read-only memory. */
15848 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15849
15850 for (align = 7; align >= 0; align--) {
15851         for (len = 36; len; len--) {
15852                 b = buf+align;
15853                 memcpy(b, abc, len);
15854                 for (off = 1; off <= len; off++) {
15855                         memcpy(b+off, b, len);
15856                         memcpy(b, b+off, len);
15857                         if (memcmp(b, abc, len))
15858                                 exit(1);
15859                 }
15860         }
15861 }
15862 exit(0);
15863 }
15864 EOCP
15865                 set try
15866                 if eval $compile_ok; then
15867                         if ./try 2>/dev/null; then
15868                                 echo "Yes, it can."
15869                                 val="$define"
15870                         else
15871                                 echo "It can't, sorry."
15872                         fi
15873                 else
15874                         echo "(I can't compile the test program, so we'll assume not...)"
15875                 fi
15876                 ;;
15877         esac
15878         $rm -f try.* try core
15879         ;;
15880 esac
15881 set d_safemcpy
15882 eval $setvar
15883
15884 : can memcmp be trusted to compare relative magnitude?
15885 val="$undef"
15886 case "$d_memcmp" in
15887 "$define")
15888         echo " "
15889         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15890         $cat >try.c <<EOCP
15891 #$i_memory I_MEMORY
15892 #$i_stdlib I_STDLIB
15893 #$i_string I_STRING
15894 #$i_unistd I_UNISTD
15895 EOCP
15896         $cat >>try.c <<'EOCP'
15897 #include <stdio.h>
15898 #ifdef I_MEMORY
15899 #  include <memory.h>
15900 #endif
15901 #ifdef I_STDLIB
15902 #  include <stdlib.h>
15903 #endif
15904 #ifdef I_STRING
15905 #  include <string.h>
15906 #else
15907 #  include <strings.h>
15908 #endif
15909 #ifdef I_UNISTD
15910 #  include <unistd.h>  /* Needed for NetBSD */
15911 #endif
15912 int main()
15913 {
15914 char a = -1;
15915 char b = 0;
15916 if ((a < b) && memcmp(&a, &b, 1) < 0)
15917         exit(1);
15918 exit(0);
15919 }
15920 EOCP
15921         set try
15922         if eval $compile_ok; then
15923                 if $run ./try 2>/dev/null; then
15924                         echo "Yes, it can."
15925                         val="$define"
15926                 else
15927                         echo "No, it can't (it uses signed chars)."
15928                 fi
15929         else
15930                 echo "(I can't compile the test program, so we'll assume not...)"
15931         fi
15932         ;;
15933 esac
15934 $rm -f try.* try core
15935 set d_sanemcmp
15936 eval $setvar
15937
15938 : see if prototype for sbrk is available
15939 echo " "
15940 set d_sbrkproto sbrk $i_unistd unistd.h
15941 eval $hasproto
15942
15943 : see if select exists
15944 set select d_select
15945 eval $inlibc
15946
15947 : see if semctl exists
15948 set semctl d_semctl
15949 eval $inlibc
15950
15951 : see if semget exists
15952 set semget d_semget
15953 eval $inlibc
15954
15955 : see if semop exists
15956 set semop d_semop
15957 eval $inlibc
15958
15959 : see how much of the 'sem*(2)' library is present.
15960 h_sem=true
15961 echo " "
15962 case "$d_semctl$d_semget$d_semop" in
15963 *"$undef"*) h_sem=false;;
15964 esac
15965 case "$osname" in
15966 freebsd)
15967     case "`ipcs 2>&1`" in
15968     "SVID messages"*"not configured"*)
15969         echo "Your $osname does not have the sem*(2) configured." >&4
15970         h_sem=false
15971         val="$undef"
15972         set semctl d_semctl
15973         eval $setvar
15974         set semget d_semget
15975         eval $setvar
15976         set semop d_semop
15977         eval $setvar
15978         ;;
15979     esac
15980     ;;
15981 esac
15982 : we could also check for sys/ipc.h ...
15983 if $h_sem && $test `./findhdr sys/sem.h`; then
15984         echo "You have the full sem*(2) library." >&4
15985         val="$define"
15986 else
15987         echo "You don't have the full sem*(2) library." >&4
15988         val="$undef"
15989 fi
15990 set d_sem
15991 eval $setvar
15992
15993 : see whether sys/sem.h defines union semun
15994 echo " "
15995 $cat > try.c <<'END'
15996 #include <sys/types.h>
15997 #include <sys/ipc.h>
15998 #include <sys/sem.h>
15999 int main () { union semun semun; semun.buf = 0; }
16000 END
16001 set try
16002 if eval $compile; then
16003     echo "You have union semun in <sys/sem.h>." >&4
16004     val="$define"
16005 else
16006     echo "You do not have union semun in <sys/sem.h>." >&4
16007     val="$undef"
16008 fi
16009 $rm -f try try.c
16010 set d_union_semun
16011 eval $setvar
16012
16013 : see how to do semctl IPC_STAT
16014 case "$d_sem" in
16015 $define)
16016     echo " "
16017     $cat > try.h <<END
16018 #ifndef S_IRUSR
16019 #   ifdef S_IREAD
16020 #       define S_IRUSR S_IREAD
16021 #       define S_IWUSR S_IWRITE
16022 #       define S_IXUSR S_IEXEC
16023 #   else
16024 #       define S_IRUSR 0400
16025 #       define S_IWUSR 0200
16026 #       define S_IXUSR 0100
16027 #   endif
16028 #   define S_IRGRP (S_IRUSR>>3)
16029 #   define S_IWGRP (S_IWUSR>>3)
16030 #   define S_IXGRP (S_IXUSR>>3)
16031 #   define S_IROTH (S_IRUSR>>6)
16032 #   define S_IWOTH (S_IWUSR>>6)
16033 #   define S_IXOTH (S_IXUSR>>6)
16034 #endif
16035 #ifndef S_IRWXU
16036 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16037 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16038 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16039 #endif
16040 END
16041     : see whether semctl IPC_STAT can use union semun
16042     case "$d_semctl_semun" in
16043     '')
16044       val="$undef"
16045       $cat > try.c <<END
16046 #include <sys/types.h>
16047 #include <sys/ipc.h>
16048 #include <sys/sem.h>
16049 #include <sys/stat.h>
16050 #include <stdio.h>
16051 #include <errno.h>
16052 #include "try.h"
16053 #ifndef errno
16054 extern int errno;
16055 #endif
16056 #$d_union_semun HAS_UNION_SEMUN
16057 int main() {
16058     union semun
16059 #ifndef HAS_UNION_SEMUN
16060     {
16061         int val;
16062         struct semid_ds *buf;
16063         unsigned short *array;
16064     }
16065 #endif
16066     arg;
16067     int sem, st;
16068
16069 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16070     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16071     if (sem > -1) {
16072         struct semid_ds argbuf;
16073         arg.buf = &argbuf;
16074 #       ifdef IPC_STAT
16075         st = semctl(sem, 0, IPC_STAT, arg);
16076         if (st == 0)
16077             printf("semun\n");
16078         else
16079 #       endif /* IPC_STAT */
16080             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16081 #       ifdef IPC_RMID
16082         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16083 #       endif /* IPC_RMID */
16084             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16085     } else
16086 #endif /* IPC_PRIVATE && ... */
16087         printf("semget failed: errno = %d\n", errno);
16088   return 0;
16089 }
16090 END
16091       set try
16092       if eval $compile; then
16093           xxx=`$run ./try`
16094           case "$xxx" in
16095           semun) val="$define" ;;
16096           esac
16097       fi
16098       $rm -f try try.c
16099       set d_semctl_semun
16100       eval $setvar
16101       ;;
16102     esac
16103     case "$d_semctl_semun" in
16104     $define)
16105         echo "You can use union semun for semctl IPC_STAT." >&4
16106         also='also'
16107         ;;
16108     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16109         also=''
16110         ;;
16111     esac
16112
16113     : see whether semctl IPC_STAT can use struct semid_ds pointer
16114     case "$d_semctl_semid_ds" in
16115     '')
16116       val="$undef"
16117       $cat > try.c <<'END'
16118 #include <sys/types.h>
16119 #include <sys/ipc.h>
16120 #include <sys/sem.h>
16121 #include <sys/stat.h>
16122 #include "try.h"
16123 #include <stdio.h>
16124 #include <errno.h>
16125 #ifndef errno
16126 extern int errno;
16127 #endif
16128 int main() {
16129     struct semid_ds arg;
16130     int sem, st;
16131
16132 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16133     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16134     if (sem > -1) {
16135 #       ifdef IPC_STAT
16136         st = semctl(sem, 0, IPC_STAT, &arg);
16137         if (st == 0)
16138             printf("semid_ds\n");
16139         else
16140 #       endif /* IPC_STAT */
16141             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16142 #       ifdef IPC_RMID
16143         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16144 #       endif /* IPC_RMID */
16145             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16146     } else
16147 #endif /* IPC_PRIVATE && ... */
16148         printf("semget failed: errno = %d\n", errno);
16149
16150     return 0;
16151 }
16152 END
16153       set try
16154       if eval $compile; then
16155           xxx=`$run ./try`
16156           case "$xxx" in
16157           semid_ds) val="$define" ;;
16158           esac
16159       fi
16160       $rm -f try try.c
16161       set d_semctl_semid_ds
16162       eval $setvar
16163       ;;
16164     esac
16165     case "$d_semctl_semid_ds" in
16166     $define)
16167         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16168         ;;
16169     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16170         ;;
16171     esac
16172     $rm -f try.h
16173     ;;
16174 *)  val="$undef"
16175
16176     # We do not have the full sem*(2) library, so assume we can not
16177     # use either.
16178
16179     set d_semctl_semun
16180     eval $setvar
16181
16182     set d_semctl_semid_ds
16183     eval $setvar
16184     ;;
16185 esac
16186
16187 : see if sendmsg exists
16188 set sendmsg d_sendmsg
16189 eval $inlibc
16190
16191 : see if setegid exists
16192 set setegid d_setegid
16193 eval $inlibc
16194
16195 : see if seteuid exists
16196 set seteuid d_seteuid
16197 eval $inlibc
16198
16199 : see if setgrent exists
16200 set setgrent d_setgrent
16201 eval $inlibc
16202
16203 : see if setgrent_r exists
16204 set setgrent_r d_setgrent_r
16205 eval $inlibc
16206 case "$d_setgrent_r" in
16207 "$define")
16208         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16209         case "$d_setgrent_r_proto:$usethreads" in
16210         ":define")      d_setgrent_r_proto=define
16211                 set d_setgrent_r_proto setgrent_r $hdrs
16212                 eval $hasproto ;;
16213         *)      ;;
16214         esac
16215         case "$d_setgrent_r_proto" in
16216         define)
16217         case "$setgrent_r_proto" in
16218         ''|0) try='int setgrent_r(FILE**);'
16219         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16220         esac
16221         case "$setgrent_r_proto" in
16222         ''|0) try='void setgrent_r(FILE**);'
16223         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16224         esac
16225         case "$setgrent_r_proto" in
16226         ''|0)   d_setgrent_r=undef
16227                 setgrent_r_proto=0
16228                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16229         * )     case "$setgrent_r_proto" in
16230                 REENTRANT_PROTO*) ;;
16231                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16232                 esac
16233                 echo "Prototype: $try" ;;
16234         esac
16235         ;;
16236         *)      case "$usethreads" in
16237                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16238                 esac
16239                 d_setgrent_r=undef
16240                 setgrent_r_proto=0
16241                 ;;
16242         esac
16243         ;;
16244 *)      setgrent_r_proto=0
16245         ;;
16246 esac
16247
16248 : see if sethostent exists
16249 set sethostent d_sethent
16250 eval $inlibc
16251
16252 : see if sethostent_r exists
16253 set sethostent_r d_sethostent_r
16254 eval $inlibc
16255 case "$d_sethostent_r" in
16256 "$define")
16257         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16258         case "$d_sethostent_r_proto:$usethreads" in
16259         ":define")      d_sethostent_r_proto=define
16260                 set d_sethostent_r_proto sethostent_r $hdrs
16261                 eval $hasproto ;;
16262         *)      ;;
16263         esac
16264         case "$d_sethostent_r_proto" in
16265         define)
16266         case "$sethostent_r_proto" in
16267         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16268         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16269         esac
16270         case "$sethostent_r_proto" in
16271         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16272         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16273         esac
16274         case "$sethostent_r_proto" in
16275         ''|0)   d_sethostent_r=undef
16276                 sethostent_r_proto=0
16277                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16278         * )     case "$sethostent_r_proto" in
16279                 REENTRANT_PROTO*) ;;
16280                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16281                 esac
16282                 echo "Prototype: $try" ;;
16283         esac
16284         ;;
16285         *)      case "$usethreads" in
16286                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16287                 esac
16288                 d_sethostent_r=undef
16289                 sethostent_r_proto=0
16290                 ;;
16291         esac
16292         ;;
16293 *)      sethostent_r_proto=0
16294         ;;
16295 esac
16296
16297 : see if setitimer exists
16298 set setitimer d_setitimer
16299 eval $inlibc
16300
16301 : see if setlinebuf exists
16302 set setlinebuf d_setlinebuf
16303 eval $inlibc
16304
16305 : see if setlocale exists
16306 set setlocale d_setlocale
16307 eval $inlibc
16308
16309 : see if locale.h is available
16310 set locale.h i_locale
16311 eval $inhdr
16312
16313 : see if setlocale_r exists
16314 set setlocale_r d_setlocale_r
16315 eval $inlibc
16316 case "$d_setlocale_r" in
16317 "$define")
16318         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16319         case "$d_setlocale_r_proto:$usethreads" in
16320         ":define")      d_setlocale_r_proto=define
16321                 set d_setlocale_r_proto setlocale_r $hdrs
16322                 eval $hasproto ;;
16323         *)      ;;
16324         esac
16325         case "$d_setlocale_r_proto" in
16326         define)
16327         case "$setlocale_r_proto" in
16328         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16329         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16330         esac
16331         case "$setlocale_r_proto" in
16332         ''|0)   d_setlocale_r=undef
16333                 setlocale_r_proto=0
16334                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16335         * )     case "$setlocale_r_proto" in
16336                 REENTRANT_PROTO*) ;;
16337                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16338                 esac
16339                 echo "Prototype: $try" ;;
16340         esac
16341         ;;
16342         *)      case "$usethreads" in
16343                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16344                 esac
16345                 d_setlocale_r=undef
16346                 setlocale_r_proto=0
16347                 ;;
16348         esac
16349         ;;
16350 *)      setlocale_r_proto=0
16351         ;;
16352 esac
16353
16354 : see if setnetent exists
16355 set setnetent d_setnent
16356 eval $inlibc
16357
16358 : see if setnetent_r exists
16359 set setnetent_r d_setnetent_r
16360 eval $inlibc
16361 case "$d_setnetent_r" in
16362 "$define")
16363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16364         case "$d_setnetent_r_proto:$usethreads" in
16365         ":define")      d_setnetent_r_proto=define
16366                 set d_setnetent_r_proto setnetent_r $hdrs
16367                 eval $hasproto ;;
16368         *)      ;;
16369         esac
16370         case "$d_setnetent_r_proto" in
16371         define)
16372         case "$setnetent_r_proto" in
16373         ''|0) try='int setnetent_r(int, struct netent_data*);'
16374         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16375         esac
16376         case "$setnetent_r_proto" in
16377         ''|0) try='void setnetent_r(int, struct netent_data*);'
16378         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16379         esac
16380         case "$setnetent_r_proto" in
16381         ''|0)   d_setnetent_r=undef
16382                 setnetent_r_proto=0
16383                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16384         * )     case "$setnetent_r_proto" in
16385                 REENTRANT_PROTO*) ;;
16386                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16387                 esac
16388                 echo "Prototype: $try" ;;
16389         esac
16390         ;;
16391         *)      case "$usethreads" in
16392                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16393                 esac
16394                 d_setnetent_r=undef
16395                 setnetent_r_proto=0
16396                 ;;
16397         esac
16398         ;;
16399 *)      setnetent_r_proto=0
16400         ;;
16401 esac
16402
16403 : see if setprotoent exists
16404 set setprotoent d_setpent
16405 eval $inlibc
16406
16407 : see if setpgid exists
16408 set setpgid d_setpgid
16409 eval $inlibc
16410
16411 : see if setpgrp2 exists
16412 set setpgrp2 d_setpgrp2
16413 eval $inlibc
16414
16415 : see if setpriority exists
16416 set setpriority d_setprior
16417 eval $inlibc
16418
16419 : see if setproctitle exists
16420 set setproctitle d_setproctitle
16421 eval $inlibc
16422
16423 : see if setprotoent_r exists
16424 set setprotoent_r d_setprotoent_r
16425 eval $inlibc
16426 case "$d_setprotoent_r" in
16427 "$define")
16428         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16429         case "$d_setprotoent_r_proto:$usethreads" in
16430         ":define")      d_setprotoent_r_proto=define
16431                 set d_setprotoent_r_proto setprotoent_r $hdrs
16432                 eval $hasproto ;;
16433         *)      ;;
16434         esac
16435         case "$d_setprotoent_r_proto" in
16436         define)
16437         case "$setprotoent_r_proto" in
16438         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16439         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16440         esac
16441         case "$setprotoent_r_proto" in
16442         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16443         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16444         esac
16445         case "$setprotoent_r_proto" in
16446         ''|0)   d_setprotoent_r=undef
16447                 setprotoent_r_proto=0
16448                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16449         * )     case "$setprotoent_r_proto" in
16450                 REENTRANT_PROTO*) ;;
16451                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16452                 esac
16453                 echo "Prototype: $try" ;;
16454         esac
16455         ;;
16456         *)      case "$usethreads" in
16457                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16458                 esac
16459                 d_setprotoent_r=undef
16460                 setprotoent_r_proto=0
16461                 ;;
16462         esac
16463         ;;
16464 *)      setprotoent_r_proto=0
16465         ;;
16466 esac
16467
16468 : see if setpwent exists
16469 set setpwent d_setpwent
16470 eval $inlibc
16471
16472 : see if setpwent_r exists
16473 set setpwent_r d_setpwent_r
16474 eval $inlibc
16475 case "$d_setpwent_r" in
16476 "$define")
16477         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16478         case "$d_setpwent_r_proto:$usethreads" in
16479         ":define")      d_setpwent_r_proto=define
16480                 set d_setpwent_r_proto setpwent_r $hdrs
16481                 eval $hasproto ;;
16482         *)      ;;
16483         esac
16484         case "$d_setpwent_r_proto" in
16485         define)
16486         case "$setpwent_r_proto" in
16487         ''|0) try='int setpwent_r(FILE**);'
16488         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16489         esac
16490         case "$setpwent_r_proto" in
16491         ''|0) try='void setpwent_r(FILE**);'
16492         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16493         esac
16494         case "$setpwent_r_proto" in
16495         ''|0)   d_setpwent_r=undef
16496                 setpwent_r_proto=0
16497                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16498         * )     case "$setpwent_r_proto" in
16499                 REENTRANT_PROTO*) ;;
16500                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16501                 esac
16502                 echo "Prototype: $try" ;;
16503         esac
16504         ;;
16505         *)      case "$usethreads" in
16506                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16507                 esac
16508                 d_setpwent_r=undef
16509                 setpwent_r_proto=0
16510                 ;;
16511         esac
16512         ;;
16513 *)      setpwent_r_proto=0
16514         ;;
16515 esac
16516
16517 : see if setregid exists
16518 set setregid d_setregid
16519 eval $inlibc
16520 set setresgid d_setresgid
16521 eval $inlibc
16522
16523 : see if setreuid exists
16524 set setreuid d_setreuid
16525 eval $inlibc
16526 set setresuid d_setresuid
16527 eval $inlibc
16528
16529 : see if setrgid exists
16530 set setrgid d_setrgid
16531 eval $inlibc
16532
16533 : see if setruid exists
16534 set setruid d_setruid
16535 eval $inlibc
16536
16537 : see if setservent exists
16538 set setservent d_setsent
16539 eval $inlibc
16540
16541 : see if setservent_r exists
16542 set setservent_r d_setservent_r
16543 eval $inlibc
16544 case "$d_setservent_r" in
16545 "$define")
16546         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16547         case "$d_setservent_r_proto:$usethreads" in
16548         ":define")      d_setservent_r_proto=define
16549                 set d_setservent_r_proto setservent_r $hdrs
16550                 eval $hasproto ;;
16551         *)      ;;
16552         esac
16553         case "$d_setservent_r_proto" in
16554         define)
16555         case "$setservent_r_proto" in
16556         ''|0) try='int setservent_r(int, struct servent_data*);'
16557         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16558         esac
16559         case "$setservent_r_proto" in
16560         ''|0) try='void setservent_r(int, struct servent_data*);'
16561         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16562         esac
16563         case "$setservent_r_proto" in
16564         ''|0)   d_setservent_r=undef
16565                 setservent_r_proto=0
16566                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16567         * )     case "$setservent_r_proto" in
16568                 REENTRANT_PROTO*) ;;
16569                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16570                 esac
16571                 echo "Prototype: $try" ;;
16572         esac
16573         ;;
16574         *)      case "$usethreads" in
16575                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16576                 esac
16577                 d_setservent_r=undef
16578                 setservent_r_proto=0
16579                 ;;
16580         esac
16581         ;;
16582 *)      setservent_r_proto=0
16583         ;;
16584 esac
16585
16586 : see if setsid exists
16587 set setsid d_setsid
16588 eval $inlibc
16589
16590 : see if setvbuf exists
16591 set setvbuf d_setvbuf
16592 eval $inlibc
16593
16594 : see if sfio.h is available
16595 set sfio.h i_sfio
16596 eval $inhdr
16597
16598
16599 : see if sfio library is available
16600 case "$i_sfio" in
16601 $define)
16602         val=''
16603         set sfreserve val
16604         eval $inlibc
16605         ;;
16606 *)
16607         val="$undef"
16608         ;;
16609 esac
16610 : Ok, but do we want to use it.
16611 case "$val" in
16612 $define)
16613         case "$usesfio" in
16614         true|$define|[yY]*) dflt='y';;
16615         *) dflt='n';;
16616         esac
16617         echo "$package can use the sfio library, but it is experimental."
16618         case "$useperlio" in
16619         "$undef")
16620             echo "For sfio also the PerlIO abstraction layer is needed."
16621             echo "Earlier you said you wouldn't want that."
16622             ;;
16623         esac
16624         rp="You seem to have sfio available, do you want to try using it?"
16625         . ./myread
16626         case "$ans" in
16627         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16628                 useperlio="$define"
16629                 val="$define"
16630                 ;;
16631         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16632                 val="$undef"
16633                 ;;
16634         esac
16635         ;;
16636 *)      case "$usesfio" in
16637         true|$define|[yY]*)
16638                 echo "Sorry, cannot find sfio on this machine." >&4
16639                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16640                 val="$undef"
16641                 ;;
16642         esac
16643         ;;
16644 esac
16645 set d_sfio
16646 eval $setvar
16647 case "$d_sfio" in
16648 $define) usesfio='true';;
16649 *) usesfio='false';;
16650 esac
16651 case "$d_sfio" in
16652 $define) ;;
16653 *)      : Remove sfio from list of libraries to use
16654         case "$libs" in
16655         *-lsfio*)
16656                 echo "Removing unneeded -lsfio from library list" >&4
16657                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16658                 shift
16659                 libs="$*"
16660                 echo "libs = $libs" >&4
16661                 ;;
16662         esac
16663 ;;
16664 esac
16665
16666
16667 : see if shmctl exists
16668 set shmctl d_shmctl
16669 eval $inlibc
16670
16671 : see if shmget exists
16672 set shmget d_shmget
16673 eval $inlibc
16674
16675 : see if shmat exists
16676 set shmat d_shmat
16677 eval $inlibc
16678 : see what shmat returns
16679 case "$d_shmat" in
16680 "$define")
16681         $cat >shmat.c <<'END'
16682 #include <sys/shm.h>
16683 void *shmat();
16684 END
16685         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16686                 shmattype='void *'
16687         else
16688                 shmattype='char *'
16689         fi
16690         echo "and it returns ($shmattype)." >&4
16691         : see if a prototype for shmat is available
16692         xxx=`./findhdr sys/shm.h`
16693         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16694         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16695                 val="$define"
16696         else
16697                 val="$undef"
16698         fi
16699         $rm -f shmat.[co]
16700         ;;
16701 *)
16702         val="$undef"
16703         ;;
16704 esac
16705 set d_shmatprototype
16706 eval $setvar
16707
16708 : see if shmdt exists
16709 set shmdt d_shmdt
16710 eval $inlibc
16711
16712 : see how much of the 'shm*(2)' library is present.
16713 h_shm=true
16714 echo " "
16715 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16716 *"$undef"*) h_shm=false;;
16717 esac
16718 case "$osname" in
16719 freebsd)
16720     case "`ipcs 2>&1`" in
16721     "SVID shared memory"*"not configured"*)
16722         echo "Your $osname does not have the shm*(2) configured." >&4
16723         h_shm=false
16724         val="$undef"
16725         set shmctl d_shmctl
16726         evat $setvar
16727         set shmget d_shmget
16728         evat $setvar
16729         set shmat d_shmat
16730         evat $setvar
16731         set shmdt d_shmdt
16732         evat $setvar
16733         ;;
16734     esac
16735     ;;
16736 esac
16737 : we could also check for sys/ipc.h ...
16738 if $h_shm && $test `./findhdr sys/shm.h`; then
16739         echo "You have the full shm*(2) library." >&4
16740         val="$define"
16741 else
16742         echo "You don't have the full shm*(2) library." >&4
16743         val="$undef"
16744 fi
16745 set d_shm
16746 eval $setvar
16747
16748 echo " "
16749 : see if we have sigaction
16750 if set sigaction val -f d_sigaction; eval $csym; $val; then
16751         echo 'sigaction() found.' >&4
16752         $cat > try.c <<EOP
16753 #include <stdio.h>
16754 #include <sys/types.h>
16755 #include <signal.h>
16756 #$i_stdlib I_STDLIB
16757 #ifdef I_STDLIB
16758 #include <stdlib.h>
16759 #endif
16760 int main()
16761 {
16762     struct sigaction act, oact;
16763     act.sa_flags = 0;
16764     oact.sa_handler = 0;
16765     /* so that act and oact are used */
16766     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16767 }
16768 EOP
16769         set try
16770         if eval $compile_ok; then
16771                 val="$define"
16772         else
16773                 echo "But you don't seem to have a useable struct sigaction." >&4
16774                 val="$undef"
16775         fi
16776 else
16777         echo 'sigaction NOT found.' >&4
16778         val="$undef"
16779 fi
16780 set d_sigaction; eval $setvar
16781 $rm -f try try$_o try.c
16782
16783 : see if sigprocmask exists
16784 set sigprocmask d_sigprocmask
16785 eval $inlibc
16786
16787 : see if sigsetjmp exists
16788 echo " "
16789 case "$d_sigsetjmp" in
16790 '')
16791         $cat >try.c <<EOP
16792 #include <setjmp.h>
16793 #$i_stdlib I_STDLIB
16794 #ifdef I_STDLIB
16795 #include <stdlib.h>
16796 #endif
16797 sigjmp_buf env;
16798 int set = 1;
16799 int main()
16800 {
16801         if (sigsetjmp(env,1))
16802                 exit(set);
16803         set = 0;
16804         siglongjmp(env, 1);
16805         exit(1);
16806 }
16807 EOP
16808         set try
16809         if eval $compile; then
16810                 if $run ./try >/dev/null 2>&1; then
16811                         echo "POSIX sigsetjmp found." >&4
16812                         val="$define"
16813                 else
16814                         $cat >&4 <<EOM
16815 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16816 I'll ignore them.
16817 EOM
16818                         val="$undef"
16819                 fi
16820         else
16821                 echo "sigsetjmp not found." >&4
16822                 val="$undef"
16823         fi
16824         ;;
16825 *) val="$d_sigsetjmp"
16826         case "$d_sigsetjmp" in
16827         $define) echo "POSIX sigsetjmp found." >&4;;
16828         $undef) echo "sigsetjmp not found." >&4;;
16829         esac
16830         ;;
16831 esac
16832 set d_sigsetjmp
16833 eval $setvar
16834 $rm -f try.c try
16835
16836 : see if snprintf exists
16837 set snprintf d_snprintf
16838 eval $inlibc
16839
16840 : see if vsnprintf exists
16841 set vsnprintf d_vsnprintf
16842 eval $inlibc
16843
16844 case "$d_snprintf-$d_vsnprintf" in
16845 "$define-$define")
16846     $cat <<EOM
16847 Checking whether your snprintf() and vsnprintf() work okay...
16848 EOM
16849     $cat >try.c <<'EOCP'
16850 /* v?snprintf testing logic courtesy of Russ Allbery.
16851  * According to C99:
16852  * - if the buffer is too short it still must be \0-terminated
16853  * - if the buffer is too short the potentially required length
16854  *   must be returned and not -1
16855  * - if the buffer is NULL the potentially required length
16856  *   must be returned and not -1 or core dump
16857  */
16858 #include <stdio.h>
16859 #include <stdarg.h>
16860
16861 char buf[2];
16862
16863 int test (char *format, ...)
16864 {
16865     va_list args;
16866     int count;
16867
16868     va_start (args, format);
16869     count = vsnprintf (buf, sizeof buf, format, args);
16870     va_end (args);
16871     return count;
16872 }
16873
16874 int main ()
16875 {
16876     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16877              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16878 }
16879 EOCP
16880     set try
16881     if eval $compile; then
16882         `$run ./try`
16883         case "$?" in
16884         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16885         *) cat <<EOM >&4
16886 Your snprintf() and snprintf() don't seem to be working okay.
16887 EOM
16888            d_snprintf="$undef"
16889            d_vsnprintf="$undef"
16890            ;;
16891         esac
16892     else
16893         echo "(I can't seem to compile the test program--assuming they don't)"
16894         d_snprintf="$undef"
16895         d_vsnprintf="$undef"
16896     fi
16897     $rm -f try.* try core core.try.*
16898     ;;
16899 esac
16900
16901 : see if sockatmark exists
16902 set sockatmark d_sockatmark
16903 eval $inlibc
16904
16905 : see if prototype for sockatmark is available
16906 echo " "
16907 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16908 eval $hasproto
16909
16910 : see if socks5_init exists
16911 set socks5_init d_socks5_init
16912 eval $inlibc
16913
16914 : see if sprintf returns the length of the string in the buffer as per ANSI
16915 $echo "Checking whether sprintf returns the length of the string..." >&4
16916 $cat <<EOP >try.c
16917 #include <stdio.h>
16918 #$i_stdlib I_STDLIB
16919 #ifdef I_STDLIB
16920 #include <stdlib.h>
16921 #endif
16922 #$i_string I_STRING
16923 #ifdef I_STRING
16924 #  include <string.h>
16925 #else
16926 #  include <strings.h>
16927 #endif
16928 #$i_math I_MATH
16929 #ifdef I_MATH
16930 #include <math.h>
16931 #endif
16932
16933 char buffer[256];
16934
16935 int check (size_t expect, int test) {
16936   size_t got = strlen(buffer);
16937   if (expect == got)
16938     return 0;
16939
16940   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16941        test, buffer);
16942   exit (test);
16943 }
16944
16945 int main(int argc, char **argv) {
16946   int test = 0;
16947
16948   check(sprintf(buffer, ""), ++test);
16949   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16950   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16951
16952   return 0;
16953 }
16954 EOP
16955 set try
16956
16957 d_sprintf_returns_strlen="$undef"
16958 if eval $compile; then
16959     xxx="`$run ./try`"
16960     case "$?" in
16961         0) cat >&4 <<EOM
16962 sprintf returns the length of the string (as ANSI says it should)
16963 EOM
16964         d_sprintf_returns_strlen="$define"
16965         ;;
16966         *) cat >&4 <<EOM
16967 sprintf does not return the length of the string (how old is this system?)
16968 EOM
16969         d_sprintf_returns_strlen="$undef"
16970         ;;
16971     esac
16972 fi
16973
16974 $rm -f try.* try
16975
16976 : see if srand48_r exists
16977 set srand48_r d_srand48_r
16978 eval $inlibc
16979 case "$d_srand48_r" in
16980 "$define")
16981         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16982         case "$d_srand48_r_proto:$usethreads" in
16983         ":define")      d_srand48_r_proto=define
16984                 set d_srand48_r_proto srand48_r $hdrs
16985                 eval $hasproto ;;
16986         *)      ;;
16987         esac
16988         case "$d_srand48_r_proto" in
16989         define)
16990         case "$srand48_r_proto" in
16991         ''|0) try='int srand48_r(long, struct drand48_data*);'
16992         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16993         esac
16994         case "$srand48_r_proto" in
16995         ''|0)   d_srand48_r=undef
16996                 srand48_r_proto=0
16997                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16998         * )     case "$srand48_r_proto" in
16999                 REENTRANT_PROTO*) ;;
17000                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17001                 esac
17002                 echo "Prototype: $try" ;;
17003         esac
17004         ;;
17005         *)      case "$usethreads" in
17006                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17007                 esac
17008                 d_srand48_r=undef
17009                 srand48_r_proto=0
17010                 ;;
17011         esac
17012         ;;
17013 *)      srand48_r_proto=0
17014         ;;
17015 esac
17016
17017 : see if srandom_r exists
17018 set srandom_r d_srandom_r
17019 eval $inlibc
17020 case "$d_srandom_r" in
17021 "$define")
17022         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17023         case "$d_srandom_r_proto:$usethreads" in
17024         ":define")      d_srandom_r_proto=define
17025                 set d_srandom_r_proto srandom_r $hdrs
17026                 eval $hasproto ;;
17027         *)      ;;
17028         esac
17029         case "$d_srandom_r_proto" in
17030         define)
17031         case "$srandom_r_proto" in
17032         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17033         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17034         esac
17035         case "$srandom_r_proto" in
17036         ''|0)   d_srandom_r=undef
17037                 srandom_r_proto=0
17038                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17039         * )     case "$srandom_r_proto" in
17040                 REENTRANT_PROTO*) ;;
17041                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17042                 esac
17043                 echo "Prototype: $try" ;;
17044         esac
17045         ;;
17046         *)      case "$usethreads" in
17047                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17048                 esac
17049                 d_srandom_r=undef
17050                 srandom_r_proto=0
17051                 ;;
17052         esac
17053         ;;
17054 *)      srandom_r_proto=0
17055         ;;
17056 esac
17057
17058 : see if prototype for setresgid is available
17059 echo " "
17060 set d_sresgproto setresgid $i_unistd unistd.h
17061 eval $hasproto
17062
17063 : see if prototype for setresuid is available
17064 echo " "
17065 set d_sresuproto setresuid $i_unistd unistd.h
17066 eval $hasproto
17067
17068 : see if sys/stat.h is available
17069 set sys/stat.h i_sysstat
17070 eval $inhdr
17071
17072
17073 : see if stat knows about block sizes
17074 echo " "
17075 echo "Checking to see if your struct stat has st_blocks field..." >&4
17076 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17077 eval $hasfield
17078
17079
17080 : see if this is a sys/vfs.h system
17081 set sys/vfs.h i_sysvfs
17082 eval $inhdr
17083
17084
17085 : see if this is a sys/statfs.h system
17086 set sys/statfs.h i_sysstatfs
17087 eval $inhdr
17088
17089
17090 echo " "
17091 echo "Checking to see if your system supports struct statfs..." >&4
17092 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
17093 eval $hasstruct
17094 case "$d_statfs_s" in
17095 "$define")      echo "Yes, it does."   ;;
17096 *)              echo "No, it doesn't." ;;
17097 esac
17098
17099
17100
17101 : see if struct statfs knows about f_flags
17102 case "$d_statfs_s" in
17103 define) 
17104         echo " "
17105         echo "Checking to see if your struct statfs has f_flags field..." >&4
17106         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
17107         eval $hasfield
17108         ;;
17109 *)      val="$undef"
17110         set d_statfs_f_flags
17111         eval $setvar
17112         ;;
17113 esac
17114 case "$d_statfs_f_flags" in
17115 "$define")      echo "Yes, it does."   ;;
17116 *)              echo "No, it doesn't." ;;
17117 esac
17118
17119 $cat >&4 <<EOM
17120 Checking how to access stdio streams by file descriptor number...
17121 EOM
17122 case "$stdio_stream_array" in
17123 '')     $cat >try.c <<EOCP
17124 #include <stdio.h>
17125 int main() {
17126   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17127     printf("yes\n");
17128 }
17129 EOCP
17130         for s in _iob __iob __sF
17131         do
17132                 set try -DSTDIO_STREAM_ARRAY=$s
17133                 if eval $compile; then
17134                         case "`$run ./try`" in
17135                         yes)    stdio_stream_array=$s; break ;;
17136                         esac
17137                 fi
17138         done
17139         $rm -f try.* try$exe_ext
17140 esac
17141 case "$stdio_stream_array" in
17142 '')     $cat >&4 <<EOM
17143 I can't figure out how to access stdio streams by file descriptor number.
17144 EOM
17145         d_stdio_stream_array="$undef"
17146         ;;
17147 *)      $cat >&4 <<EOM
17148 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17149 EOM
17150         d_stdio_stream_array="$define"
17151         ;;
17152 esac
17153
17154 : see if strcoll exists
17155 set strcoll d_strcoll
17156 eval $inlibc
17157
17158 : check for structure copying
17159 echo " "
17160 echo "Checking to see if your C compiler can copy structs..." >&4
17161 $cat >try.c <<'EOCP'
17162 int main()
17163 {
17164         struct blurfl {
17165                 int dyick;
17166         } foo, bar;
17167
17168         foo = bar;
17169 }
17170 EOCP
17171 if $cc -c try.c >/dev/null 2>&1 ; then
17172         val="$define"
17173         echo "Yup, it can."
17174 else
17175         val="$undef"
17176         echo "Nope, it can't."
17177 fi
17178 set d_strctcpy
17179 eval $setvar
17180 $rm -f try.*
17181
17182 : see if strerror and/or sys_errlist[] exist
17183 echo " "
17184 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17185     if set strerror val -f d_strerror; eval $csym; $val; then
17186                 echo 'strerror() found.' >&4
17187                 d_strerror="$define"
17188                 d_strerrm='strerror(e)'
17189                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17190                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17191                         d_syserrlst="$define"
17192                 else
17193                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17194                         d_syserrlst="$undef"
17195                 fi
17196     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17197                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17198                 echo 'strerror() found in string header.' >&4
17199                 d_strerror="$define"
17200                 d_strerrm='strerror(e)'
17201                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17202                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17203                                 d_syserrlst="$define"
17204                 else
17205                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17206                         d_syserrlst="$undef"
17207                 fi
17208     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17209                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17210                 d_strerror="$undef"
17211                 d_syserrlst="$define"
17212                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17213     else
17214                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17215                 d_strerror="$undef"
17216                 d_syserrlst="$undef"
17217                 d_strerrm='"unknown"'
17218     fi
17219 fi
17220
17221 : see if strerror_r exists
17222 set strerror_r d_strerror_r
17223 eval $inlibc
17224 case "$d_strerror_r" in
17225 "$define")
17226         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17227         case "$d_strerror_r_proto:$usethreads" in
17228         ":define")      d_strerror_r_proto=define
17229                 set d_strerror_r_proto strerror_r $hdrs
17230                 eval $hasproto ;;
17231         *)      ;;
17232         esac
17233         case "$d_strerror_r_proto" in
17234         define)
17235         case "$strerror_r_proto" in
17236         ''|0) try='int strerror_r(int, char*, size_t);'
17237         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17238         esac
17239         case "$strerror_r_proto" in
17240         ''|0) try='int strerror_r(int, char*, int);'
17241         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17242         esac
17243         case "$strerror_r_proto" in
17244         ''|0) try='char* strerror_r(int, char*, size_t);'
17245         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17246         esac
17247         case "$strerror_r_proto" in
17248         ''|0)   d_strerror_r=undef
17249                 strerror_r_proto=0
17250                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17251         * )     case "$strerror_r_proto" in
17252                 REENTRANT_PROTO*) ;;
17253                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17254                 esac
17255                 echo "Prototype: $try" ;;
17256         esac
17257         ;;
17258         *)      case "$usethreads" in
17259                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17260                 esac
17261                 d_strerror_r=undef
17262                 strerror_r_proto=0
17263                 ;;
17264         esac
17265         ;;
17266 *)      strerror_r_proto=0
17267         ;;
17268 esac
17269
17270 : see if strftime exists
17271 set strftime d_strftime
17272 eval $inlibc
17273
17274 : see if strlcat exists
17275 set strlcat d_strlcat
17276 eval $inlibc
17277
17278 : see if strlcpy exists
17279 set strlcpy d_strlcpy
17280 eval $inlibc
17281
17282 : see if strtod exists
17283 set strtod d_strtod
17284 eval $inlibc
17285
17286 : see if strtol exists
17287 set strtol d_strtol
17288 eval $inlibc
17289
17290 : see if strtold exists
17291 set strtold d_strtold
17292 eval $inlibc
17293
17294 : see if strtoll exists
17295 set strtoll d_strtoll
17296 eval $inlibc
17297
17298 case "$d_longlong-$d_strtoll" in
17299 "$define-$define")
17300         $cat <<EOM
17301 Checking whether your strtoll() works okay...
17302 EOM
17303         $cat >try.c <<'EOCP'
17304 #include <errno.h>
17305 #ifdef __hpux
17306 #define strtoll __strtoll
17307 #endif
17308 #ifdef __EMX__
17309 #define strtoll _strtoll
17310 #endif
17311 #include <stdio.h>
17312 extern long long int strtoll(char *s, char **, int); 
17313 static int bad = 0;
17314 int check(char *s, long long ell, int een) {
17315         long long gll;
17316         errno = 0;
17317         gll = strtoll(s, 0, 10);
17318         if (!((gll == ell) && (errno == een)))
17319                 bad++;
17320 }
17321 int main() {
17322         check(" 1",                                      1LL, 0);
17323         check(" 0",                                      0LL, 0);
17324         check("-1",                                     -1LL, 0);
17325         check("-9223372036854775808", -9223372036854775808LL, 0);
17326         check("-9223372036854775808", -9223372036854775808LL, 0);
17327         check(" 9223372036854775807",  9223372036854775807LL, 0);
17328         check("-9223372036854775808", -9223372036854775808LL, 0);
17329         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17330         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17331         if (!bad)
17332                 printf("ok\n");
17333 }
17334 EOCP
17335         set try
17336         if eval $compile; then
17337                 yyy=`$run ./try`
17338                 case "$yyy" in
17339                 ok) echo "Your strtoll() seems to be working okay." ;;
17340                 *) cat <<EOM >&4
17341 Your strtoll() doesn't seem to be working okay.
17342 EOM
17343                    d_strtoll="$undef"
17344                    ;;
17345                 esac
17346         else
17347                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17348                 d_strtoll="$undef"
17349         fi
17350         ;;
17351 esac
17352
17353 : see if strtoq exists
17354 set strtoq d_strtoq
17355 eval $inlibc
17356
17357 : see if strtoul exists
17358 set strtoul d_strtoul
17359 eval $inlibc
17360
17361 case "$d_strtoul" in
17362 "$define")
17363         $cat <<EOM
17364 Checking whether your strtoul() works okay...
17365 EOM
17366         $cat >try.c <<'EOCP'
17367 #include <errno.h>
17368 #include <stdio.h>
17369 extern unsigned long int strtoul(char *s, char **, int); 
17370 static int bad = 0;
17371 void check(char *s, unsigned long eul, int een) {
17372         unsigned long gul;
17373         errno = 0;
17374         gul = strtoul(s, 0, 10);
17375         if (!((gul == eul) && (errno == een)))
17376                 bad++;
17377 }
17378 int main() {
17379         check(" 1", 1L, 0);
17380         check(" 0", 0L, 0);
17381 EOCP
17382         case "$longsize" in
17383         8)
17384             $cat >>try.c <<'EOCP'
17385         check("18446744073709551615", 18446744073709551615UL, 0);
17386         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17387 #if 0 /* strtoul() for /^-/ strings is undefined. */
17388         check("-1", 18446744073709551615UL, 0);
17389         check("-18446744073709551614", 2, 0);
17390         check("-18446744073709551615", 1, 0);
17391         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17392         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17393 #endif
17394 EOCP
17395                 ;;
17396         4)
17397                     $cat >>try.c <<'EOCP'
17398         check("4294967295", 4294967295UL, 0);
17399         check("4294967296", 4294967295UL, ERANGE);
17400 #if 0 /* strtoul() for /^-/ strings is undefined. */
17401         check("-1", 4294967295UL, 0);
17402         check("-4294967294", 2, 0);
17403         check("-4294967295", 1, 0);
17404         check("-4294967296", 4294967295UL, ERANGE);
17405         check("-4294967297", 4294967295UL, ERANGE);
17406 #endif
17407 EOCP
17408                 ;;
17409         *)
17410 : Should we write these tests to be more portable by sprintf-ing
17411 : ~0 and then manipulating that char string as input for strtol?
17412                 ;;
17413         esac
17414         $cat >>try.c <<'EOCP'
17415         if (!bad)
17416                 printf("ok\n");
17417         return 0;
17418 }
17419 EOCP
17420         set try
17421         if eval $compile; then
17422                 case "`$run ./try`" in
17423                 ok) echo "Your strtoul() seems to be working okay." ;;
17424                 *) cat <<EOM >&4
17425 Your strtoul() doesn't seem to be working okay.
17426 EOM
17427                    d_strtoul="$undef"
17428                    ;;
17429                 esac
17430         fi
17431         ;;
17432 esac
17433
17434 : see if strtoull exists
17435 set strtoull d_strtoull
17436 eval $inlibc
17437
17438 case "$d_longlong-$d_strtoull" in
17439 "$define-$define")
17440         $cat <<EOM
17441 Checking whether your strtoull() works okay...
17442 EOM
17443         $cat >try.c <<'EOCP'
17444 #include <errno.h>
17445 #ifdef __hpux
17446 #define strtoull __strtoull
17447 #endif
17448 #include <stdio.h>
17449 extern unsigned long long int strtoull(char *s, char **, int); 
17450 static int bad = 0;
17451 int check(char *s, long long eull, int een) {
17452         long long gull;
17453         errno = 0;
17454         gull = strtoull(s, 0, 10);
17455         if (!((gull == eull) && (errno == een)))
17456                 bad++;
17457 }
17458 int main() {
17459         check(" 1",                                        1LL, 0);
17460         check(" 0",                                        0LL, 0);
17461         check("18446744073709551615",  18446744073709551615ULL, 0);
17462         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17463 #if 0 /* strtoull() for /^-/ strings is undefined. */
17464         check("-1",                    18446744073709551615ULL, 0);
17465         check("-18446744073709551614",                     2LL, 0);
17466         check("-18446744073709551615",                     1LL, 0);
17467         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17468         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17469 #endif
17470         if (!bad)
17471                 printf("ok\n");
17472 }
17473 EOCP
17474         set try
17475         if eval $compile; then
17476                 case "`$run ./try`" in
17477                 ok) echo "Your strtoull() seems to be working okay." ;;
17478                 *) cat <<EOM >&4
17479 Your strtoull() doesn't seem to be working okay.
17480 EOM
17481                    d_strtoull="$undef"
17482                    ;;
17483                 esac
17484         fi
17485         ;;
17486 esac
17487
17488 : see if strtouq exists
17489 set strtouq d_strtouq
17490 eval $inlibc
17491
17492 case "$d_strtouq" in
17493 "$define")
17494         $cat <<EOM
17495 Checking whether your strtouq() works okay...
17496 EOM
17497         $cat >try.c <<'EOCP'
17498 #include <errno.h>
17499 #include <stdio.h>
17500 extern unsigned long long int strtouq(char *s, char **, int); 
17501 static int bad = 0;
17502 void check(char *s, unsigned long long eull, int een) {
17503         unsigned long long gull;
17504         errno = 0;
17505         gull = strtouq(s, 0, 10);
17506         if (!((gull == eull) && (errno == een)))
17507                 bad++;
17508 }
17509 int main() {
17510         check(" 1",                                        1LL, 0);
17511         check(" 0",                                        0LL, 0);
17512         check("18446744073709551615",  18446744073709551615ULL, 0);
17513         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17514 #if 0 /* strtouq() for /^-/ strings is undefined. */
17515         check("-1",                    18446744073709551615ULL, 0);
17516         check("-18446744073709551614",                     2LL, 0);
17517         check("-18446744073709551615",                     1LL, 0);
17518         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17519         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17520 #endif
17521         if (!bad)
17522                 printf("ok\n");
17523         return 0;
17524 }
17525 EOCP
17526         set try
17527         if eval $compile; then
17528                 case "`$run ./try`" in
17529                 ok) echo "Your strtouq() seems to be working okay." ;;
17530                 *) cat <<EOM >&4
17531 Your strtouq() doesn't seem to be working okay.
17532 EOM
17533                    d_strtouq="$undef"
17534                    ;;
17535                 esac
17536         fi
17537         ;;
17538 esac
17539
17540 : see if strxfrm exists
17541 set strxfrm d_strxfrm
17542 eval $inlibc
17543
17544 : see if symlink exists
17545 set symlink d_symlink
17546 eval $inlibc
17547
17548 : see if syscall exists
17549 set syscall d_syscall
17550 eval $inlibc
17551
17552 : see if prototype for syscall is available
17553 echo " "
17554 set d_syscallproto syscall $i_unistd unistd.h
17555 eval $hasproto
17556
17557 : see if sysconf exists
17558 set sysconf d_sysconf
17559 eval $inlibc
17560
17561 : see if system exists
17562 set system d_system
17563 eval $inlibc
17564
17565 : see if tcgetpgrp exists
17566 set tcgetpgrp d_tcgetpgrp
17567 eval $inlibc
17568
17569 : see if tcsetpgrp exists
17570 set tcsetpgrp d_tcsetpgrp
17571 eval $inlibc
17572
17573 : see if prototype for telldir is available
17574 echo " "
17575 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17576 eval $hasproto
17577
17578 : see if time exists
17579 echo " "
17580 if test "X$d_time" = X -o X"$timetype" = X; then
17581     if set time val -f d_time; eval $csym; $val; then
17582                 echo 'time() found.' >&4
17583                 val="$define"
17584                 rp="What is the type returned by time() on this system?"
17585                 set time_t timetype long stdio.h sys/types.h
17586                 eval $typedef_ask
17587     else
17588                 echo 'time() not found, hope that will do.' >&4
17589                 val="$undef"
17590                 timetype='int';
17591     fi
17592     set d_time
17593     eval $setvar
17594 fi
17595
17596 : see if this is a sys/times.h system
17597 set sys/times.h i_systimes
17598 eval $inhdr
17599
17600 : see if times exists
17601 echo " "
17602 if set times val -f d_times; eval $csym; $val; then
17603         echo 'times() found.' >&4
17604         d_times="$define"
17605         inc=''
17606         case "$i_systimes" in
17607         "$define") inc='sys/times.h';;
17608         esac
17609         rp="What is the type returned by times() on this system?"
17610         set clock_t clocktype long stdio.h sys/types.h $inc
17611         eval $typedef_ask
17612 else
17613         echo 'times() NOT found, hope that will do.' >&4
17614         d_times="$undef"
17615         clocktype='int'
17616 fi
17617
17618 : see if tmpnam_r exists
17619 set tmpnam_r d_tmpnam_r
17620 eval $inlibc
17621 case "$d_tmpnam_r" in
17622 "$define")
17623         hdrs="$i_systypes sys/types.h define stdio.h "
17624         case "$d_tmpnam_r_proto:$usethreads" in
17625         ":define")      d_tmpnam_r_proto=define
17626                 set d_tmpnam_r_proto tmpnam_r $hdrs
17627                 eval $hasproto ;;
17628         *)      ;;
17629         esac
17630         case "$d_tmpnam_r_proto" in
17631         define)
17632         case "$tmpnam_r_proto" in
17633         ''|0) try='char* tmpnam_r(char*);'
17634         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17635         esac
17636         case "$tmpnam_r_proto" in
17637         ''|0)   d_tmpnam_r=undef
17638                 tmpnam_r_proto=0
17639                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17640         * )     case "$tmpnam_r_proto" in
17641                 REENTRANT_PROTO*) ;;
17642                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17643                 esac
17644                 echo "Prototype: $try" ;;
17645         esac
17646         ;;
17647         *)      case "$usethreads" in
17648                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17649                 esac
17650                 d_tmpnam_r=undef
17651                 tmpnam_r_proto=0
17652                 ;;
17653         esac
17654         ;;
17655 *)      tmpnam_r_proto=0
17656         ;;
17657 esac
17658
17659 : see if truncate exists
17660 set truncate d_truncate
17661 eval $inlibc
17662
17663 : see if ttyname_r exists
17664 set ttyname_r d_ttyname_r
17665 eval $inlibc
17666 case "$d_ttyname_r" in
17667 "$define")
17668         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17669         case "$d_ttyname_r_proto:$usethreads" in
17670         ":define")      d_ttyname_r_proto=define
17671                 set d_ttyname_r_proto ttyname_r $hdrs
17672                 eval $hasproto ;;
17673         *)      ;;
17674         esac
17675         case "$d_ttyname_r_proto" in
17676         define)
17677         case "$ttyname_r_proto" in
17678         ''|0) try='int ttyname_r(int, char*, size_t);'
17679         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17680         esac
17681         case "$ttyname_r_proto" in
17682         ''|0) try='int ttyname_r(int, char*, int);'
17683         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17684         esac
17685         case "$ttyname_r_proto" in
17686         ''|0) try='char* ttyname_r(int, char*, int);'
17687         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17688         esac
17689         case "$ttyname_r_proto" in
17690         ''|0)   d_ttyname_r=undef
17691                 ttyname_r_proto=0
17692                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17693         * )     case "$ttyname_r_proto" in
17694                 REENTRANT_PROTO*) ;;
17695                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17696                 esac
17697                 echo "Prototype: $try" ;;
17698         esac
17699         ;;
17700         *)      case "$usethreads" in
17701                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17702                 esac
17703                 d_ttyname_r=undef
17704                 ttyname_r_proto=0
17705                 ;;
17706         esac
17707         ;;
17708 *)      ttyname_r_proto=0
17709         ;;
17710 esac
17711
17712 : see if tzname[] exists
17713 echo " "
17714 if set tzname val -a d_tzname; eval $csym; $val; then
17715         val="$define"
17716         echo 'tzname[] found.' >&4
17717 else
17718         val="$undef"
17719         echo 'tzname[] NOT found.' >&4
17720 fi
17721 set d_tzname
17722 eval $setvar
17723
17724 case "$osname" in
17725 next|rhapsody|darwin) multiarch="$define" ;;
17726 esac
17727 case "$multiarch" in
17728 ''|[nN]*) multiarch="$undef" ;;
17729 esac
17730
17731 : check for ordering of bytes in a UV
17732 echo " "
17733 case "$usecrosscompile$multiarch" in
17734 *$define*)
17735         $cat <<EOM
17736 You seem to be either cross-compiling or doing a multiarchitecture build,
17737 skipping the byteorder check.
17738
17739 EOM
17740         byteorder='ffff'
17741         ;;
17742 *)
17743         case "$byteorder" in
17744         '')
17745                 $cat <<'EOM'
17746 In the following, larger digits indicate more significance.  A big-endian
17747 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17748 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17749 machines may have weird orders like 3412.  A Cray will report 87654321,
17750 an Alpha will report 12345678. If the test program works the default is
17751 probably right.
17752 I'm now running the test program...
17753 EOM
17754                 $cat >try.c <<EOCP
17755 #include <stdio.h>
17756 #$i_stdlib I_STDLIB
17757 #ifdef I_STDLIB
17758 #include <stdlib.h>
17759 #endif
17760 #include <sys/types.h>
17761 typedef $uvtype UV;
17762 int main()
17763 {
17764         int i;
17765         union {
17766                 UV l;
17767                 char c[$uvsize];
17768         } u;
17769
17770         if ($uvsize > 4)
17771                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17772         else
17773                 u.l = (UV)0x04030201;
17774         for (i = 0; i < $uvsize; i++)
17775                 printf("%c", u.c[i]+'0');
17776         printf("\n");
17777         exit(0);
17778 }
17779 EOCP
17780                 xxx_prompt=y
17781                 set try
17782                 if eval $compile && ./try > /dev/null; then
17783                         dflt=`$run ./try`
17784                         case "$dflt" in
17785                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17786                                 echo "(The test program ran ok.)"
17787                                 echo "byteorder=$dflt"
17788                                 xxx_prompt=n
17789                         ;;
17790                         ????|????????) echo "(The test program ran ok.)" ;;
17791                         *) echo "(The test program didn't run right for some reason.)" ;;
17792                         esac
17793                 else
17794                         dflt='4321'
17795                         cat <<'EOM'
17796 (I can't seem to compile the test program.  Guessing big-endian...)
17797 EOM
17798                 fi
17799                 case "$xxx_prompt" in
17800                 y)
17801                         rp="What is the order of bytes in $uvtype?"
17802                         . ./myread
17803                         byteorder="$ans"
17804                         ;;
17805                 *)      byteorder=$dflt
17806                         ;;
17807                 esac
17808                 ;;
17809         esac
17810         $rm -f try.c try
17811         ;;
17812 esac
17813
17814
17815 $cat <<EOM
17816
17817 Checking to see whether you can access character data unalignedly...
17818 EOM
17819 case "$d_u32align" in
17820 '')   $cat >try.c <<EOCP
17821 #include <stdio.h>
17822 #$i_stdlib I_STDLIB
17823 #ifdef I_STDLIB
17824 #include <stdlib.h>
17825 #endif
17826 #define U32 $u32type
17827 #define BYTEORDER 0x$byteorder
17828 #define U8 $u8type
17829 #include <signal.h>
17830 #ifdef SIGBUS
17831 $signal_t bletch(int s) { exit(4); }
17832 #endif
17833 int main() {
17834 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17835     U8 buf[8];
17836     U32 *up;
17837     int i;
17838
17839     if (sizeof(U32) != 4) {
17840         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17841         exit(1);
17842     }
17843
17844     fflush(stdout);
17845
17846 #ifdef SIGBUS
17847     signal(SIGBUS, bletch);
17848 #endif
17849
17850     buf[0] = 0;
17851     buf[1] = 0;
17852     buf[2] = 0;
17853     buf[3] = 1;
17854     buf[4] = 0;
17855     buf[5] = 0;
17856     buf[6] = 0;
17857     buf[7] = 1;
17858
17859     for (i = 0; i < 4; i++) {
17860         up = (U32*)(buf + i);
17861         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17862                (*up == 1 << (8*(3-i)))  /* little-endian */
17863               )
17864            )
17865         {
17866             printf("read failed (%x)\n", *up);
17867             exit(2);
17868         }
17869     }
17870
17871     /* write test */
17872     for (i = 0; i < 4; i++) {
17873         up = (U32*)(buf + i);
17874         *up = 0xBeef;
17875         if (*up != 0xBeef) {
17876             printf("write failed (%x)\n", *up);
17877             exit(3);
17878         }
17879     }
17880
17881     exit(0);
17882 #else
17883     printf("1\n");
17884     exit(1);
17885 #endif
17886     return 0;
17887 }
17888 EOCP
17889 set try
17890 if eval $compile_ok; then
17891         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17892         $run ./try 2>&1 >/dev/null
17893         case "$?" in
17894         0)      cat >&4 <<EOM
17895 You can access character data pretty unalignedly.
17896 EOM
17897                 d_u32align="$undef"
17898                 ;;
17899         *)      cat >&4 <<EOM
17900 It seems that you must access character data in an aligned manner.
17901 EOM
17902                 d_u32align="$define"
17903                 ;;
17904         esac
17905 else
17906         rp='Can you access character data at unaligned addresses?'
17907         dflt='n'
17908         . ./myread
17909         case "$ans" in
17910         [yY]*)  d_u32align="$undef"  ;;
17911         *)      d_u32align="$define" ;;
17912         esac
17913 fi
17914 $rm -f core core.try.* try.core
17915 ;;
17916 esac
17917
17918 : see if ualarm exists
17919 set ualarm d_ualarm
17920 eval $inlibc
17921
17922 : see if umask exists
17923 set umask d_umask
17924 eval $inlibc
17925
17926 : see if unordered exists
17927 set unordered d_unordered
17928 eval $inlibc
17929
17930 : see if unsetenv exists
17931 set unsetenv d_unsetenv
17932 eval $inlibc
17933
17934 : see if usleep exists
17935 set usleep d_usleep
17936 eval $inlibc
17937
17938 : see if prototype for usleep is available
17939 echo " "
17940 set d_usleepproto usleep $i_unistd unistd.h
17941 eval $hasproto
17942
17943 : see if ustat exists
17944 set ustat d_ustat
17945 eval $inlibc
17946
17947 : backward compatibility for d_hvfork
17948 if test X$d_hvfork != X; then
17949         d_vfork="$d_hvfork"
17950         d_hvfork=''
17951 fi
17952 : see if there is a vfork
17953 val=''
17954 set vfork val
17955 eval $inlibc
17956
17957 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17958 : perl on Solaris 2.x, and probably elsewhere.
17959 case "$val" in
17960 $define)
17961         echo " "
17962         case "$usevfork" in
17963         false) dflt='n';;
17964         *) dflt='y';;
17965         esac
17966         cat <<'EOM'
17967  
17968 Perl can only use a vfork() that doesn't suffer from strict
17969 restrictions on calling functions or modifying global data in
17970 the child.  For example, glibc-2.1 contains such a vfork()
17971 that is unsuitable.  If your system provides a proper fork()
17972 call, chances are that you do NOT want perl to use vfork().
17973
17974 EOM
17975         rp="Do you still want to use vfork()?"
17976         . ./myread
17977         case "$ans" in
17978         y|Y) ;;
17979         *)
17980                 echo "Ok, we won't use vfork()."
17981                 val="$undef"
17982                 ;;
17983         esac
17984         ;;
17985 esac
17986 set d_vfork
17987 eval $setvar
17988 case "$d_vfork" in
17989 $define) usevfork='true';;
17990 *) usevfork='false';;
17991 esac
17992
17993 : see if closedir exists
17994 set closedir d_closedir
17995 eval $inlibc
17996
17997 case "$d_closedir" in
17998 "$define")
17999         echo " "
18000         echo "Checking whether closedir() returns a status..." >&4
18001         cat > try.c <<EOM
18002 #$i_dirent I_DIRENT             /**/
18003 #$i_sysdir I_SYS_DIR            /**/
18004 #$i_sysndir I_SYS_NDIR          /**/
18005 #$i_systypes I_SYS_TYPES        /**/
18006
18007 #if defined(I_SYS_TYPES)
18008 #include <sys/types.h>
18009 #endif
18010 #if defined(I_DIRENT)
18011 #include <dirent.h>
18012 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18013 #include <sys/dir.h>
18014 #endif
18015 #else
18016 #ifdef I_SYS_NDIR
18017 #include <sys/ndir.h>
18018 #else
18019 #ifdef I_SYS_DIR
18020 #ifdef hp9000s500
18021 #include <ndir.h>       /* may be wrong in the future */
18022 #else
18023 #include <sys/dir.h>
18024 #endif
18025 #endif
18026 #endif
18027 #endif 
18028 int main() { return closedir(opendir(".")); }
18029 EOM
18030         set try
18031         if eval $compile_ok; then
18032                 if $run ./try > /dev/null 2>&1 ; then
18033                         echo "Yes, it does."
18034                         val="$undef"
18035                 else
18036                         echo "No, it doesn't."
18037                         val="$define"
18038                 fi
18039         else
18040                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18041                 val="$define"
18042         fi
18043         ;;
18044 *)
18045         val="$undef";
18046         ;;
18047 esac
18048 set d_void_closedir
18049 eval $setvar
18050 $rm -f try try.*
18051 : see if there is a wait4
18052 set wait4 d_wait4
18053 eval $inlibc
18054
18055 : see if waitpid exists
18056 set waitpid d_waitpid
18057 eval $inlibc
18058
18059 : see if wcstombs exists
18060 set wcstombs d_wcstombs
18061 eval $inlibc
18062
18063 : see if wctomb exists
18064 set wctomb d_wctomb
18065 eval $inlibc
18066
18067 : see if writev exists
18068 set writev d_writev
18069 eval $inlibc
18070
18071 : preserve RCS keywords in files with variable substitution, grrr
18072 Date='$Date'
18073 Id='$Id'
18074 Log='$Log'
18075 RCSfile='$RCSfile'
18076 Revision='$Revision'
18077
18078 : check for alignment requirements
18079 echo " "
18080 case "$usecrosscompile$multiarch" in
18081 *$define*)
18082         $cat <<EOM
18083 You seem to be either cross-compiling or doing a multiarchitecture build,
18084 skipping the memory alignment check.
18085
18086 EOM
18087         case "$alignbytes" in
18088         '') alignbytes=8 ;;
18089         esac
18090         ;;
18091 *)
18092         case "$alignbytes" in
18093         '') echo "Checking alignment constraints..." >&4
18094                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18095                         $cat >try.c <<'EOCP'
18096 typedef long double NV;
18097 EOCP
18098                 else
18099                         $cat >try.c <<'EOCP'
18100 typedef double NV;
18101 EOCP
18102                 fi
18103                 $cat >>try.c <<'EOCP'
18104 #include <stdio.h>
18105 struct foobar {
18106         char foo;
18107         NV bar;
18108 } try_algn;
18109 int main()
18110 {
18111     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18112     return(0);
18113 }
18114 EOCP
18115                 set try
18116                 if eval $compile_ok; then
18117                         dflt=`$run ./try`
18118                 else
18119                         dflt='8'
18120                         echo "(I can't seem to compile the test program...)"
18121                 fi
18122                 ;;
18123         *) dflt="$alignbytes"
18124                 ;;
18125         esac
18126         rp="Doubles must be aligned on a how-many-byte boundary?"
18127         . ./myread
18128         alignbytes="$ans"
18129         $rm -f try.c try
18130         ;;
18131 esac
18132
18133
18134 : set the base revision
18135 baserev=5.0
18136
18137 : how do we concatenate cpp tokens here?
18138 echo " "
18139 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18140 $cat >cpp_stuff.c <<'EOCP'
18141 #define RCAT(a,b)a/**/b
18142 #define ACAT(a,b)a ## b
18143 RCAT(Rei,ser)
18144 ACAT(Cir,cus)
18145 EOCP
18146 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18147 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18148         echo "Oh!  Smells like ANSI's been here." >&4
18149         echo "We can catify or stringify, separately or together!"
18150         cpp_stuff=42
18151 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18152         echo "Ah, yes!  The good old days!" >&4
18153         echo "However, in the good old days we don't know how to stringify and"
18154         echo "catify at the same time."
18155         cpp_stuff=1
18156 else
18157         $cat >&4 <<EOM
18158 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18159 You're going to have to edit the values of CAT[2-5] in config.h...
18160 EOM
18161         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18162 fi
18163 $rm -f cpp_stuff.*
18164
18165 : see if this is a db.h system
18166 set db.h i_db
18167 eval $inhdr
18168
18169 case "$i_db" in
18170 $define)
18171         : Check db version.
18172         echo " "
18173         echo "Checking Berkeley DB version ..." >&4
18174         $cat >try.c <<EOCP
18175 #$d_const HASCONST
18176 #ifndef HASCONST
18177 #define const
18178 #endif
18179 #include <sys/types.h>
18180 #include <stdio.h>
18181 #$i_stdlib I_STDLIB
18182 #ifdef I_STDLIB
18183 #include <stdlib.h>
18184 #endif
18185 #include <db.h>
18186 int main(int argc, char *argv[])
18187 {
18188 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18189     int Major, Minor, Patch ;
18190     unsigned long Version ;
18191     (void)db_version(&Major, &Minor, &Patch) ;
18192     if (argc == 2) {
18193         printf("%d %d %d %d %d %d\n",
18194                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18195                Major, Minor, Patch);
18196         exit(0);
18197     }
18198     printf("You have Berkeley DB Version 2 or greater.\n");
18199
18200     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18201                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18202     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18203                 Major, Minor, Patch) ;
18204
18205     /* check that db.h & libdb are compatible */
18206     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18207         printf("db.h and libdb are incompatible.\n") ;
18208         exit(3);        
18209     }
18210
18211     printf("db.h and libdb are compatible.\n") ;
18212
18213     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18214                 + DB_VERSION_PATCH ;
18215
18216     /* needs to be >= 2.3.4 */
18217     if (Version < 2003004) {
18218     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18219         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18220         exit(2);        
18221     }
18222
18223     exit(0);
18224 #else
18225 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18226     if (argc == 2) {
18227         printf("1 0 0\n");
18228         exit(0);
18229     }
18230     printf("You have Berkeley DB Version 1.\n");
18231     exit(0);    /* DB version < 2: the coast is clear. */
18232 #else
18233     exit(1);    /* <db.h> not Berkeley DB? */
18234 #endif
18235 #endif
18236 }
18237 EOCP
18238         set try
18239         if eval $compile_ok && $run ./try; then
18240                 echo 'Looks OK.' >&4
18241                 set `$run ./try 1`
18242                 db_version_major=$1
18243                 db_version_minor=$2
18244                 db_version_patch=$3
18245         else
18246                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18247                 i_db=$undef
18248                 case " $libs " in
18249                 *"-ldb "*)
18250                         : Remove db from list of libraries to use
18251                         echo "Removing unusable -ldb from library list" >&4
18252                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18253                         shift
18254                         libs="$*"
18255                         echo "libs = $libs" >&4
18256                         ;;
18257                 esac
18258         fi
18259         $rm -f try.*
18260         ;;
18261 esac
18262
18263 case "$i_db" in
18264 define)
18265         : Check the return type needed for hash 
18266         echo " "
18267         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18268         $cat >try.c <<EOCP
18269 #$d_const HASCONST
18270 #ifndef HASCONST
18271 #define const
18272 #endif
18273 #include <sys/types.h>
18274 #include <db.h>
18275
18276 #ifndef DB_VERSION_MAJOR
18277 u_int32_t hash_cb (ptr, size)
18278 const void *ptr;
18279 size_t size;
18280 {
18281 }
18282 HASHINFO info;
18283 int main()
18284 {
18285         info.hash = hash_cb;
18286 }
18287 #endif
18288 EOCP
18289         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18290                 if $contains warning try.out >>/dev/null 2>&1 ; then
18291                         db_hashtype='int'
18292                 else
18293                         db_hashtype='u_int32_t'
18294                 fi
18295         else
18296                 : XXX Maybe we should just give up here.
18297                 db_hashtype=u_int32_t
18298                 $cat try.out >&4
18299                 echo "Help:  I can't seem to compile the db test program." >&4
18300                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18301         fi
18302         $rm -f try.*
18303         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18304         ;;
18305 *)      db_hashtype=u_int32_t
18306         ;;
18307 esac
18308 case "$i_db" in
18309 define)
18310         : Check the return type needed for prefix 
18311         echo " "
18312         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18313         cat >try.c <<EOCP
18314 #$d_const HASCONST
18315 #ifndef HASCONST
18316 #define const
18317 #endif
18318 #include <sys/types.h>
18319 #include <db.h>
18320
18321 #ifndef DB_VERSION_MAJOR
18322 size_t prefix_cb (key1, key2)
18323 const DBT *key1;
18324 const DBT *key2;
18325 {
18326 }
18327 BTREEINFO info;
18328 int main()
18329 {
18330         info.prefix = prefix_cb;
18331 }
18332 #endif
18333 EOCP
18334         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18335                 if $contains warning try.out >>/dev/null 2>&1 ; then
18336                         db_prefixtype='int'
18337                 else
18338                         db_prefixtype='size_t'
18339                 fi
18340         else
18341                 db_prefixtype='size_t'
18342                 : XXX Maybe we should just give up here.
18343                 $cat try.out >&4
18344                 echo "Help:  I can't seem to compile the db test program." >&4
18345                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18346         fi
18347         $rm -f try.*
18348         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18349         ;;
18350 *)      db_prefixtype='size_t'
18351         ;;
18352 esac
18353
18354
18355 : How can we generate normalized random numbers ?
18356 echo " "
18357 echo "Looking for a random number function..." >&4
18358 case "$randfunc" in
18359 '')
18360         if set drand48 val -f; eval $csym; $val; then
18361                 dflt="drand48"
18362                 echo "Good, found drand48()." >&4
18363         elif set random val -f; eval $csym; $val; then
18364                 dflt="random"
18365                 echo "OK, found random()." >&4
18366         else
18367                 dflt="rand"
18368                 echo "Yick, looks like I have to use rand()." >&4
18369         fi
18370         echo " "
18371         ;;
18372 *)
18373         dflt="$randfunc"
18374         ;;
18375 esac
18376 cont=true
18377
18378 case "$ccflags" in
18379 *-Dmy_rand=*|*-Dmy_srand=*)
18380         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18381         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18382         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18383         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18384         ;;
18385 esac
18386
18387 while $test "$cont"; do
18388         rp="Use which function to generate random numbers?"
18389         . ./myread
18390         if $test "$ans" = "$dflt"; then
18391                 : null
18392         else
18393                 randbits=''
18394         fi
18395         randfunc="$ans"
18396         if set $ans val -f; eval $csym; $val; then
18397                 cont=''
18398         else
18399                 dflt=y
18400                 rp="I cannot find function $ans. Use that name anyway?"
18401                 . ./myread
18402                 dflt=rand
18403                 case "$ans" in
18404                         [yY]*) cont='';;
18405                 esac
18406         fi
18407         case "$cont" in
18408         '')
18409                 case "$randfunc" in
18410                 drand48)
18411                         drand01="drand48()"
18412                         seedfunc="srand48"
18413                         randbits=48
18414                         randseedtype=long
18415                         ;;
18416                 rand|random)
18417                         case "$randbits" in
18418                         '')
18419 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18420                                 $cat >try.c <<EOCP
18421 #$i_unistd I_UNISTD
18422 #$i_stdlib I_STDLIB
18423 #include <stdio.h>
18424 #ifdef I_UNISTD
18425 #  include <unistd.h>
18426 #endif
18427 #ifdef I_STDLIB
18428 #  include <stdlib.h>
18429 #endif
18430 int main()
18431 {
18432         register int i;
18433         register unsigned long tmp;
18434         register unsigned long max = 0L;
18435
18436         for (i = 1000; i; i--) {
18437                 tmp = (unsigned long) $randfunc();
18438                 if (tmp > max) max = tmp;
18439         }
18440         for (i = 0; max; i++)
18441                 max /= 2;
18442         printf("%d\n",i);
18443 }
18444 EOCP
18445                                 set try
18446                                 if eval $compile_ok; then
18447                                         dflt=`try`
18448                                 else
18449                                         dflt='?'
18450                                         echo "(I can't seem to compile the test program...)"
18451                                 fi
18452                                 ;;
18453                         *)
18454                                 dflt="$randbits"
18455                                 ;;
18456                         esac
18457                         rp="How many bits does your $randfunc() function produce?"
18458                         . ./myread
18459                         randbits="$ans"
18460                         $rm -f try.c try
18461                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18462                         seedfunc="s$randfunc"
18463                         randseedtype=unsigned
18464                         ;;
18465                 *)
18466                         dflt="31"
18467                         rp="How many bits does your $randfunc() function produce?"
18468                         . ./myread
18469                         randbits="$ans"
18470                         seedfunc="s$randfunc"
18471                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18472                         if set $seedfunc val -f; eval $csym; $val; then
18473                                 echo "(Using $seedfunc() to seed random generator)"
18474                         else
18475                                 echo "(Warning: no $seedfunc() to seed random generator)"
18476                                 seedfunc=rand
18477                         fi
18478                         randseedtype=unsigned
18479                         ;;
18480                 esac
18481                 ;;
18482         esac
18483 done
18484
18485 echo " "
18486 echo "Determining whether or not we are on an EBCDIC system..." >&4
18487 $cat >try.c <<'EOM'
18488 int main()
18489 {
18490   if ('M'==0xd4) return 0;
18491   return 1;
18492 }
18493 EOM
18494
18495 val=$undef
18496 set try
18497 if eval $compile_ok; then
18498         if $run ./try; then
18499                 echo "You seem to speak EBCDIC." >&4
18500                 val="$define"
18501         else
18502                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18503         fi
18504 else
18505         echo "I'm unable to compile the test program." >&4
18506         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18507 fi
18508 $rm -f try try.*
18509 set ebcdic
18510 eval $setvar
18511
18512 echo " "
18513 $cat >&4 <<EOM
18514 Checking how to flush all pending stdio output...
18515 EOM
18516 # I only know how to find the first 32 possibly open files on SunOS.
18517 # See also hints/sunos_4_1.sh and util.c  --AD
18518 case "$osname" in
18519 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18520 esac
18521 $cat >>try.c <<EOCP
18522 #include <stdio.h>
18523 #$i_stdlib I_STDLIB
18524 #ifdef I_STDLIB
18525 #include <stdlib.h>
18526 #endif
18527 #$i_unistd I_UNISTD
18528 #ifdef I_UNISTD
18529 # include <unistd.h>
18530 #endif
18531 #$d_sysconf HAS_SYSCONF
18532 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18533 #ifdef HAS_STDIO_STREAM_ARRAY
18534 # define STDIO_STREAM_ARRAY $stdio_stream_array
18535 #endif
18536 int main() {
18537   FILE* p;
18538   unlink("try.out");
18539   p = fopen("try.out", "w");
18540 #ifdef TRY_FPUTC
18541   fputc('x', p);
18542 #else
18543 # ifdef TRY_FPRINTF
18544   fprintf(p, "x");
18545 # endif
18546 #endif
18547 #ifdef TRY_FFLUSH_NULL
18548   fflush(NULL);
18549 #endif
18550 #ifdef TRY_FFLUSH_ALL
18551   {
18552     long open_max = -1;
18553 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18554     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18555 # else
18556 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18557     open_max = sysconf(_SC_OPEN_MAX);
18558 #  else
18559 #   ifdef FOPEN_MAX
18560     open_max = FOPEN_MAX;
18561 #   else
18562 #    ifdef OPEN_MAX
18563     open_max = OPEN_MAX;
18564 #    else
18565 #     ifdef _NFILE
18566     open_max = _NFILE;
18567 #     endif
18568 #    endif
18569 #   endif
18570 #  endif
18571 # endif 
18572 # ifdef HAS_STDIO_STREAM_ARRAY
18573     if (open_max > 0) {
18574       long i;
18575       for (i = 0; i < open_max; i++)
18576             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18577                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18578                 STDIO_STREAM_ARRAY[i]._flag)
18579                 fflush(&STDIO_STREAM_ARRAY[i]);
18580     }   
18581   }
18582 # endif
18583 #endif
18584   _exit(42);
18585 }
18586 EOCP
18587 : first we have to find out how _not_ to flush
18588 $to try.c
18589 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18590     output=''
18591     set try -DTRY_FPUTC
18592     if eval $compile; then
18593             $run ./try 2>/dev/null
18594             code="$?"
18595             $from try.out
18596             if $test ! -s try.out -a "X$code" = X42; then
18597                 output=-DTRY_FPUTC
18598             fi
18599     fi
18600     case "$output" in
18601     '')
18602             set try -DTRY_FPRINTF
18603             if eval $compile; then
18604                     $run ./try 2>/dev/null
18605                     code="$?"
18606                     $from try.out
18607                     if $test ! -s try.out -a "X$code" = X42; then
18608                         output=-DTRY_FPRINTF
18609                     fi
18610             fi
18611         ;;
18612     esac
18613 fi
18614 : check for fflush NULL behaviour
18615 case "$fflushNULL" in
18616 '')     set try -DTRY_FFLUSH_NULL $output
18617         if eval $compile; then
18618                 $run ./try 2>/dev/null
18619                 code="$?"
18620                 $from try.out
18621                 if $test -s try.out -a "X$code" = X42; then
18622                         fflushNULL="`$cat try.out`"
18623                 else
18624                         if $test "X$code" != X42; then
18625                                 $cat >&4 <<EOM
18626 (If this test failed, don't worry, we'll try another method shortly.)
18627 EOM
18628                         fi
18629                 fi
18630         fi
18631         $rm -f core try.core core.try.*
18632         case "$fflushNULL" in
18633         x)      $cat >&4 <<EOM
18634 Your fflush(NULL) works okay for output streams.
18635 Let's see if it clobbers input pipes...
18636 EOM
18637 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18638 # bug that improperly flushes the input end of pipes.  So we avoid the
18639 # autoflush on fork/system/exec support for now. :-(
18640 $cat >tryp.c <<EOCP
18641 #include <stdio.h>
18642 int
18643 main(int argc, char **argv)
18644 {
18645     char buf[1024];
18646     int i;
18647     char *bp = buf;
18648     while (1) {
18649         while ((i = getc(stdin)) != -1
18650                && (*bp++ = i) != '\n'
18651                && bp < &buf[1024])
18652         /* DO NOTHING */ ;
18653         *bp = '\0';
18654         fprintf(stdout, "%s", buf);
18655         fflush(NULL);
18656         if (i == -1)
18657             return 0;
18658         bp = buf;
18659     }
18660 }
18661 EOCP
18662                 fflushNULL="$define"
18663                 set tryp
18664                 if eval $compile; then
18665                     $rm -f tryp.out
18666                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18667                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18668                        $cat >&4 <<EOM
18669 fflush(NULL) seems to behave okay with input streams.
18670 EOM
18671                         fflushNULL="$define"
18672                     else
18673                         $cat >&4 <<EOM
18674 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18675 EOM
18676                         fflushNULL="$undef"
18677                     fi
18678                 fi
18679                 $rm -f core tryp.c tryp.core core.tryp.*
18680                 ;;
18681         '')     $cat >&4 <<EOM
18682 Your fflush(NULL) isn't working (contrary to ANSI C).
18683 EOM
18684                 fflushNULL="$undef"
18685                 ;;
18686         *)      $cat >&4 <<EOM
18687 Cannot figure out whether your fflush(NULL) works or not.
18688 I'm assuming it doesn't (contrary to ANSI C).
18689 EOM
18690                 fflushNULL="$undef"
18691                 ;;
18692         esac
18693         ;;
18694 $define|true|[yY]*)
18695         fflushNULL="$define"
18696         ;;
18697 *)
18698         fflushNULL="$undef"
18699         ;;
18700 esac
18701 : check explicit looping only if NULL did not work, and if the pipe
18702 : bug does not show up on an explicit flush too
18703 case "$fflushNULL" in
18704 "$undef")
18705         $cat >tryp.c <<EOCP
18706 #include <stdio.h>
18707 int
18708 main(int argc, char **argv)
18709 {
18710     char buf[1024];
18711     int i;
18712     char *bp = buf;
18713     while (1) {
18714         while ((i = getc(stdin)) != -1
18715                && (*bp++ = i) != '\n'
18716                && bp < &buf[1024])
18717         /* DO NOTHING */ ;
18718         *bp = '\0';
18719         fprintf(stdout, "%s", buf);
18720         fflush(stdin);
18721         if (i == -1)
18722             return 0;
18723         bp = buf;
18724     }
18725 }
18726 EOCP
18727         set tryp
18728         if eval $compile; then
18729             $rm -f tryp.out
18730             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18731             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18732                $cat >&4 <<EOM
18733 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18734 EOM
18735                 : now check for fflushall behaviour
18736                 case "$fflushall" in
18737                 '')     set try -DTRY_FFLUSH_ALL $output
18738                         if eval $compile; then
18739                                 $cat >&4 <<EOM
18740 (Now testing the other method--but note that this also may fail.)
18741 EOM
18742                                 $run ./try 2>/dev/null
18743                                 code=$?
18744                                 $from try.out
18745                                 if $test -s try.out -a "X$code" = X42; then
18746                                         fflushall="`$cat try.out`"
18747                                 fi
18748                         fi
18749                         $rm -f core try.core core.try.*
18750                         case "$fflushall" in
18751                         x)      $cat >&4 <<EOM
18752 Whew. Flushing explicitly all the stdio streams works.
18753 EOM
18754                                 fflushall="$define"
18755                                 ;;
18756                         '')     $cat >&4 <<EOM
18757 Sigh. Flushing explicitly all the stdio streams doesn't work.
18758 EOM
18759                                 fflushall="$undef"
18760                                 ;;
18761                         *)      $cat >&4 <<EOM
18762 Cannot figure out whether flushing stdio streams explicitly works or not.
18763 I'm assuming it doesn't.
18764 EOM
18765                                 fflushall="$undef"
18766                                 ;;
18767                         esac
18768                         ;;
18769                 "$define"|true|[yY]*)
18770                         fflushall="$define"
18771                         ;;
18772                 *)
18773                         fflushall="$undef"
18774                         ;;
18775                 esac
18776             else
18777                 $cat >&4 <<EOM
18778 All is futile.  Even fflush(stdin) clobbers input pipes!
18779 EOM
18780                 fflushall="$undef"
18781             fi
18782         else
18783             fflushall="$undef"
18784         fi
18785         $rm -f core tryp.c tryp.core core.tryp.*
18786         ;;
18787 *)      fflushall="$undef"
18788         ;;
18789 esac
18790
18791 case "$fflushNULL$fflushall" in
18792 undefundef)
18793         $cat <<EOM
18794 OK, I give up.  I cannot figure out how to flush pending stdio output.
18795 We won't be flushing handles at all before fork/exec/popen.
18796 EOM
18797         ;;
18798 esac
18799 $rm -f try.* try$exe_ext
18800
18801 : Store the full pathname to the ar program for use in the C program
18802 : Respect a hint or command line value for full_ar.
18803 case "$full_ar" in
18804 '') full_ar=$ar ;;
18805 esac
18806
18807 : Store the full pathname to the sed program for use in the C program
18808 full_sed=$sed
18809
18810 : see what type gids are declared as in the kernel
18811 echo " "
18812 echo "Looking for the type for group ids returned by getgid()."
18813 set gid_t gidtype xxx stdio.h sys/types.h
18814 eval $typedef
18815 case "$gidtype" in
18816 xxx)
18817         xxx=`./findhdr sys/user.h`
18818         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18819         case $1 in
18820         unsigned) dflt="$1 $2" ;;
18821         *) dflt="$1" ;;
18822         esac
18823         ;;
18824 *) dflt="$gidtype";;
18825 esac
18826 case "$gidtype" in
18827 gid_t) echo "gid_t found." ;;
18828 *)      rp="What is the type for group ids returned by getgid()?"
18829         . ./myread
18830         gidtype="$ans"
18831         ;;
18832 esac
18833
18834 echo " "
18835 case "$gidtype" in
18836 *_t) zzz="$gidtype"     ;;
18837 *)   zzz="gid"          ;;
18838 esac
18839 echo "Checking the size of $zzz..." >&4 
18840 cat > try.c <<EOCP
18841 #include <sys/types.h>
18842 #include <stdio.h>
18843 #$i_stdlib I_STDLIB
18844 #ifdef I_STDLIB
18845 #include <stdlib.h>
18846 #endif
18847 int main() {
18848     printf("%d\n", (int)sizeof($gidtype));
18849     exit(0);
18850 }
18851 EOCP
18852 set try
18853 if eval $compile_ok; then
18854         yyy=`$run ./try`
18855         case "$yyy" in
18856         '')     gidsize=4
18857                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18858                 ;;
18859         *)      gidsize=$yyy
18860                 echo "Your $zzz is $gidsize bytes long."
18861                 ;;
18862         esac
18863 else
18864         gidsize=4
18865         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18866 fi
18867
18868
18869 echo " "
18870 case "$gidtype" in
18871 *_t) zzz="$gidtype"     ;;
18872 *)   zzz="gid"          ;;
18873 esac
18874 echo "Checking the sign of $zzz..." >&4 
18875 cat > try.c <<EOCP
18876 #include <sys/types.h>
18877 #include <stdio.h>
18878 int main() {
18879         $gidtype foo = -1;
18880         if (foo < 0)
18881                 printf("-1\n");
18882         else
18883                 printf("1\n");
18884 }
18885 EOCP
18886 set try
18887 if eval $compile; then
18888         yyy=`$run ./try`
18889         case "$yyy" in
18890         '')     gidsign=1
18891                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18892                 ;;
18893         *)      gidsign=$yyy
18894                 case "$gidsign" in
18895                  1) echo "Your $zzz is unsigned." ;;
18896                 -1) echo "Your $zzz is signed."   ;;
18897                 esac
18898                 ;;
18899         esac
18900 else
18901         gidsign=1
18902         echo "(I can't compile the test program--guessing unsigned.)" >&4
18903 fi
18904
18905
18906 echo " "
18907
18908 if $test X"$quadtype" != X; then
18909
18910 echo "Checking how to print 64-bit integers..." >&4
18911
18912 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18913         $cat >try.c <<'EOCP'
18914 #include <sys/types.h>
18915 #include <stdio.h>
18916 int main() {
18917   int q = 12345678901;
18918   printf("%ld\n", q);
18919 }
18920 EOCP
18921         set try
18922         if eval $compile; then
18923                 yyy=`$run ./try`
18924                 case "$yyy" in
18925                 12345678901)
18926                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18927                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18928                         echo "We will use %d."
18929                         ;;
18930                 esac
18931         fi
18932 fi
18933
18934 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18935         $cat >try.c <<'EOCP'
18936 #include <sys/types.h>
18937 #include <stdio.h>
18938 int main() {
18939   long q = 12345678901;
18940   printf("%ld\n", q);
18941 }
18942 EOCP
18943         set try
18944         if eval $compile; then
18945                 yyy=`$run ./try`
18946                 case "$yyy" in
18947                 12345678901)
18948                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18949                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18950                         echo "We will use %ld."
18951                         ;;
18952                 esac
18953         fi
18954 fi
18955
18956 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18957         $cat >try.c <<'EOCP'
18958 #include <sys/types.h>
18959 #include <inttypes.h>
18960 #include <stdio.h>
18961 int main() {
18962   int64_t q = 12345678901;
18963   printf("%" PRId64 "\n", q);
18964 }
18965 EOCP
18966         set try
18967         if eval $compile; then
18968                 yyy=`$run ./try`
18969                 case "$yyy" in
18970                 12345678901)
18971                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18972                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18973                         echo "We will use the C9X style."
18974                         ;;
18975                 esac
18976         fi
18977 fi
18978
18979 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18980         $cat >try.c <<EOCP
18981 #include <sys/types.h>
18982 #include <stdio.h>
18983 int main() {
18984   $quadtype q = 12345678901;
18985   printf("%Ld\n", q);
18986 }
18987 EOCP
18988         set try
18989         if eval $compile; then
18990                 yyy=`$run ./try`
18991                 case "$yyy" in
18992                 12345678901)
18993                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18994                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18995                         echo "We will use %Ld."
18996                         ;;
18997                 esac
18998         fi
18999 fi
19000
19001 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19002         $cat >try.c <<'EOCP'
19003 #include <sys/types.h>
19004 #include <stdio.h>
19005 int main() {
19006   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19007   printf("%lld\n", q);
19008 }
19009 EOCP
19010         set try
19011         if eval $compile; then
19012                 yyy=`$run ./try`
19013                 case "$yyy" in
19014                 12345678901)
19015                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19016                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19017                         echo "We will use the %lld style."
19018                         ;;
19019                 esac
19020         fi
19021 fi
19022
19023 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19024         $cat >try.c <<EOCP
19025 #include <sys/types.h>
19026 #include <stdio.h>
19027 int main() {
19028   $quadtype q = 12345678901;
19029   printf("%qd\n", q);
19030 }
19031 EOCP
19032         set try
19033         if eval $compile; then
19034                 yyy=`$run ./try`
19035                 case "$yyy" in
19036                 12345678901)
19037                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19038                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19039                         echo "We will use %qd."
19040                         ;;
19041                 esac
19042         fi
19043 fi
19044
19045 if $test X"$sPRId64" = X; then
19046         echo "Cannot figure out how to print 64-bit integers." >&4
19047 fi
19048
19049 $rm -f try try.*
19050
19051 fi
19052
19053 case "$sPRId64" in
19054 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19055         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19056         ;;
19057 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19058         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19059         ;;
19060 esac
19061
19062
19063 echo " "
19064 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19065
19066 if $test X"$ivsize" = X8; then
19067         ivdformat="$sPRId64"
19068         uvuformat="$sPRIu64"
19069         uvoformat="$sPRIo64"
19070         uvxformat="$sPRIx64"
19071         uvXUformat="$sPRIXU64"
19072 else
19073         if $test X"$ivsize" = X"$longsize"; then
19074                 ivdformat='"ld"'
19075                 uvuformat='"lu"'
19076                 uvoformat='"lo"'
19077                 uvxformat='"lx"'
19078                 uvXUformat='"lX"'
19079         else
19080                 if $test X"$ivsize" = X"$intsize"; then
19081                         ivdformat='"d"'
19082                         uvuformat='"u"'
19083                         uvoformat='"o"'
19084                         uvxformat='"x"'
19085                         uvXUformat='"X"'
19086                 else
19087                         : far out
19088                         if $test X"$ivsize" = X"$shortsize"; then
19089                                 ivdformat='"hd"'
19090                                 uvuformat='"hu"'
19091                                 uvoformat='"ho"'
19092                                 uvxformat='"hx"'
19093                                 uvXUformat='"hX"'
19094                         fi
19095                 fi
19096         fi
19097 fi
19098
19099 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19100         nveformat="$sPRIeldbl"
19101         nvfformat="$sPRIfldbl"
19102         nvgformat="$sPRIgldbl"
19103         nvEUformat="$sPRIEUldbl"
19104         nvFUformat="$sPRIFUldbl"
19105         nvGUformat="$sPRIGUldbl"
19106 else
19107         nveformat='"e"'
19108         nvfformat='"f"'
19109         nvgformat='"g"'
19110         nvEUformat='"E"'
19111         nvFUformat='"F"'
19112         nvGUformat='"G"'
19113 fi
19114
19115 case "$ivdformat" in
19116 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19117     exit 1
19118     ;;
19119 esac
19120
19121
19122 echo " "
19123 $echo "Checking the format string to be used for gids..." >&4
19124
19125 case "$gidsign" in
19126 -1)     if $test X"$gidsize" = X"$ivsize"; then
19127                 gidformat="$ivdformat"
19128         else
19129                 if $test X"$gidsize" = X"$longsize"; then
19130                         gidformat='"ld"'
19131                 else
19132                         if $test X"$gidsize" = X"$intsize"; then
19133                                 gidformat='"d"'
19134                         else
19135                                 if $test X"$gidsize" = X"$shortsize"; then
19136                                         gidformat='"hd"'
19137                                 fi
19138                         fi
19139                 fi
19140         fi
19141         ;;
19142 *)      if $test X"$gidsize" = X"$uvsize"; then
19143                 gidformat="$uvuformat"
19144         else
19145                 if $test X"$gidsize" = X"$longsize"; then
19146                         gidformat='"lu"'
19147                 else
19148                         if $test X"$gidsize" = X"$intsize"; then
19149                                 gidformat='"u"'
19150                         else
19151                                 if $test X"$gidsize" = X"$shortsize"; then
19152                                         gidformat='"hu"'
19153                                 fi
19154                         fi
19155                 fi
19156         fi
19157         ;;
19158 esac
19159
19160 : see if getgroups exists
19161 set getgroups d_getgrps
19162 eval $inlibc
19163
19164 : see if setgroups exists
19165 set setgroups d_setgrps
19166 eval $inlibc
19167
19168
19169 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19170 echo " "
19171 case "$d_getgrps$d_setgrps" in
19172 *define*)
19173         case "$groupstype" in
19174         '') dflt="$gidtype" ;;
19175         *)  dflt="$groupstype" ;;
19176         esac
19177         $cat <<EOM
19178 What type of pointer is the second argument to getgroups() and setgroups()?
19179 Usually this is the same as group ids, $gidtype, but not always.
19180
19181 EOM
19182         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19183         . ./myread
19184         groupstype="$ans"
19185         ;;
19186 *)  groupstype="$gidtype";;
19187 esac
19188
19189
19190 if $test $patchlevel -lt 9; then
19191 : MAD is not available in 5.8.x or earlier.
19192     ans=n;
19193 else
19194     case "$mad" in
19195     $define|true|[yY]*) dflt='y' ;;
19196     *)                  dflt='n' ;;
19197     esac
19198     cat <<EOM
19199
19200 Would you like to build with Misc Attribute Decoration? This is development
19201 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19202 overhead on the interpreter.
19203
19204 If this doesn't make any sense to you, just accept the default '$dflt'.
19205 EOM
19206     rp='Build Perl with MAD?'
19207     . ./myread
19208 fi
19209 case "$ans" in
19210 y|Y)    val="$define"
19211         madlyh='madly.h madly.act madly.tab'
19212         madlysrc='madly.c'
19213         madlyobj="madly$_o" ;;
19214 *)      val="$undef"
19215         madlyh=''
19216         madlysrc=''
19217         madlyobj='' ;;
19218 esac
19219 set mad
19220 eval $setvar
19221
19222 echo " "
19223 echo "Checking if your $make program sets \$(MAKE)..." >&4
19224 case "$make_set_make" in
19225 '')
19226         $sed 's/^X //' > testmake.mak << 'EOF'
19227 Xall:
19228 X       @echo 'maketemp="$(MAKE)"'
19229 EOF
19230         case "`$make -f testmake.mak 2>/dev/null`" in
19231         *maketemp=*) make_set_make='#' ;;
19232         *)      make_set_make="MAKE=$make" ;;
19233         esac
19234         $rm -f testmake.mak
19235         ;;
19236 esac
19237 case "$make_set_make" in
19238 '#') echo "Yup, it does.";;
19239 *) echo "Nope, it doesn't.";;
19240 esac
19241
19242 : see what type is used for mode_t
19243 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19244 set mode_t modetype int stdio.h sys/types.h
19245 eval $typedef_ask
19246
19247 : see if we need va_copy
19248 echo " "
19249 case "$i_stdarg" in
19250 "$define")
19251         $cat >try.c <<EOCP
19252 #include <stdarg.h>
19253 #include <stdio.h>
19254 #$i_stdlib I_STDLIB
19255 #ifdef I_STDLIB
19256 #include <stdlib.h>
19257 #endif
19258 #include <signal.h>
19259
19260 int
19261 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19262 {
19263   return vfprintf(f, fmt, *valp);
19264 }
19265  
19266 int    
19267 myvfprintf(FILE *f, const  char *fmt, va_list val)
19268 {
19269   return ivfprintf(f, fmt, &val);
19270 }
19271       
19272 int
19273 myprintf(char *fmt, ...) 
19274 {
19275   va_list val;
19276   va_start(val, fmt);
19277   return myvfprintf(stdout, fmt, val); 
19278 }         
19279
19280 int
19281 main(int ac, char **av)
19282 {
19283   signal(SIGSEGV, exit);
19284
19285   myprintf("%s%cs all right, then\n", "that", '\'');                            
19286   exit(0);      
19287 }
19288 EOCP
19289         set try
19290         if eval $compile && $run ./try 2>&1 >/dev/null; then
19291                 case "`$run ./try`" in
19292                 "that's all right, then")
19293                         okay=yes
19294                         ;;
19295                 esac
19296         fi
19297         case "$okay" in
19298         yes)    echo "It seems that you don't need va_copy()." >&4
19299                 need_va_copy="$undef"
19300                 ;;
19301         *)      echo "It seems that va_copy() or similar will be needed." >&4
19302                 need_va_copy="$define"
19303                 ;;
19304         esac
19305         $rm -f try.* core core.* *.core *.core.*
19306         ;;
19307 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19308         ;;
19309 esac
19310
19311 : see what type is used for size_t
19312 rp="What is the type used for the length parameter for string functions?"
19313 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19314 eval $typedef_ask
19315
19316 : check for type of arguments to gethostbyaddr. 
19317 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19318         case "$d_gethbyaddr" in
19319         $define)
19320                 $cat <<EOM
19321
19322 Checking to see what type of arguments are accepted by gethostbyaddr().
19323 EOM
19324                 hdrs="$define sys/types.h
19325                         $d_socket sys/socket.h 
19326                         $i_niin netinet/in.h 
19327                         $i_netdb netdb.h
19328                         $i_unistd unistd.h"
19329                 : The first arg can 'char *' or 'void *'
19330                 : The second arg is some of integral type
19331                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19332                         for yyy in size_t long int; do
19333                                 case "$netdb_host_type" in
19334                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19335                                         if ./protochk "$try" $hdrs; then
19336                                                 echo "Your system accepts $xxx for the first arg."
19337                                                 echo "...and $yyy for the second arg."
19338                                                 netdb_host_type="$xxx"
19339                                                 netdb_hlen_type="$yyy"
19340                                         fi
19341                                         ;;
19342                                 esac
19343                         done
19344                 done
19345                 : In case none of those worked, prompt the user.
19346                 case "$netdb_host_type" in
19347                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19348                         dflt='char *'
19349                         . ./myread
19350                         netdb_host_type=$ans
19351                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19352                         dflt="$sizetype"
19353                         . ./myread
19354                         netdb_hlen_type=$ans
19355                         ;;
19356                 esac
19357                 ;;
19358         *)      : no gethostbyaddr, so pick harmless defaults
19359                 netdb_host_type='char *'
19360                 netdb_hlen_type="$sizetype"
19361                 ;;
19362         esac
19363         # Remove the "const" if needed. -- but then we'll have a 
19364         # prototype clash!
19365         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19366 fi
19367
19368 : check for type of argument to gethostbyname. 
19369 if test "X$netdb_name_type" = X ; then
19370         case "$d_gethbyname" in
19371         $define)
19372                 $cat <<EOM
19373
19374 Checking to see what type of argument is accepted by gethostbyname().
19375 EOM
19376                 hdrs="$define sys/types.h
19377                         $d_socket sys/socket.h 
19378                         $i_niin netinet/in.h 
19379                         $i_netdb netdb.h
19380                         $i_unistd unistd.h"
19381                 for xxx in "const char *" "char *"; do
19382                         case "$netdb_name_type" in
19383                         '')     try="extern struct hostent *gethostbyname($xxx);"
19384                                 if ./protochk "$try" $hdrs; then
19385                                         echo "Your system accepts $xxx."
19386                                         netdb_name_type="$xxx"
19387                                 fi
19388                                 ;;
19389                         esac
19390                 done
19391                 : In case none of those worked, prompt the user.
19392                 case "$netdb_name_type" in
19393                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19394                         dflt='char *'
19395                         . ./myread
19396                         netdb_name_type=$ans
19397                         ;;
19398                 esac
19399                 ;;
19400         *)      : no gethostbyname, so pick harmless default
19401                 netdb_name_type='char *'
19402                 ;;
19403         esac
19404 fi
19405
19406 : check for type of 1st argument to getnetbyaddr. 
19407 if test "X$netdb_net_type" = X ; then
19408         case "$d_getnbyaddr" in
19409         $define)
19410                 $cat <<EOM
19411
19412 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19413 EOM
19414                 hdrs="$define sys/types.h
19415                         $d_socket sys/socket.h 
19416                         $i_niin netinet/in.h 
19417                         $i_netdb netdb.h
19418                         $i_unistd unistd.h"
19419                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19420                         case "$netdb_net_type" in
19421                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19422                                 if ./protochk "$try" $hdrs; then
19423                                         echo "Your system accepts $xxx."
19424                                         netdb_net_type="$xxx"
19425                                 fi
19426                                 ;;
19427                         esac
19428                 done
19429                 : In case none of those worked, prompt the user.
19430                 case "$netdb_net_type" in
19431                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19432                         dflt='long'
19433                         . ./myread
19434                         netdb_net_type=$ans
19435                         ;;
19436                 esac
19437                 ;;
19438         *)      : no getnetbyaddr, so pick harmless default
19439                 netdb_net_type='long'
19440                 ;;
19441         esac
19442 fi
19443 : locate the preferred pager for this system
19444 fn=f/
19445 case "$pager" in
19446 '')
19447         dflt=''
19448         case "$pg" in
19449         /*) dflt=$pg;;
19450         [a-zA-Z]:/*) dflt=$pg;;
19451         esac
19452         case "$more" in
19453         /*) dflt=$more;;
19454         [a-zA-Z]:/*) dflt=$more;;
19455         esac
19456         case "$less" in
19457         /*) dflt=$less;;
19458         [a-zA-Z]:/*) dflt=$less;;
19459         esac
19460         case "$dflt" in
19461         '') dflt=/usr/ucb/more;;
19462         esac
19463         ;;
19464 *)      dflt="$pager"
19465         : Instruct ./getfile to trust the hinted or previous pager value,
19466         : even if it does not begin with a slash.  For example, on os2,
19467         : pager might be cmd /c more.  See comments in UU/getfile.
19468         fn="f/($pager)"
19469         ;;
19470 esac
19471 echo " "
19472 rp='What pager is used on your system?'
19473 . ./getfile
19474 pager="$ans"
19475
19476 : see what type pids are declared as in the kernel
19477 rp="What is the type of process ids on this system?"
19478 set pid_t pidtype int stdio.h sys/types.h
19479 eval $typedef_ask
19480
19481 : see if ar generates random libraries by itself
19482 echo " "
19483 echo "Checking how to generate random libraries on your machine..." >&4
19484 echo 'int bar1() { return bar2(); }' > bar1.c
19485 echo 'int bar2() { return 2; }' > bar2.c
19486 $cat > foo.c <<EOP
19487 #$i_stdlib I_STDLIB
19488 #ifdef I_STDLIB
19489 #include <stdlib.h>
19490 #endif
19491 int main() { printf("%d\n", bar1()); exit(0); }
19492 EOP
19493 $cc $ccflags -c bar1.c >/dev/null 2>&1
19494 $cc $ccflags -c bar2.c >/dev/null 2>&1
19495 $cc $ccflags -c foo.c >/dev/null 2>&1
19496 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19497 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19498         $run ./foobar >/dev/null 2>&1; then
19499         echo "$ar appears to generate random libraries itself."
19500         orderlib=false
19501         if [ "X$ranlib" = "X" ]; then
19502             ranlib=":"
19503         fi
19504 elif $ar s bar$_a >/dev/null 2>&1 &&
19505         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19506         $run ./foobar >/dev/null 2>&1; then
19507                 echo "a table of contents needs to be added with '$ar s'."
19508                 orderlib=false
19509                 ranlib="$ar s"
19510 elif $ar ts bar$_a >/dev/null 2>&1 &&
19511         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19512         $run ./foobar >/dev/null 2>&1; then
19513                 echo "a table of contents needs to be added with '$ar ts'."
19514                 orderlib=false
19515                 ranlib="$ar ts"
19516 else
19517         case "$ranlib" in
19518         :) ranlib='';;
19519         '')
19520                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19521                 $test -f $ranlib || ranlib=''
19522                 ;;
19523         esac
19524         if $test -n "$ranlib"; then
19525                 echo "your system has '$ranlib'; we'll use that."
19526                 orderlib=false
19527         else
19528                 echo "your system doesn't seem to support random libraries"
19529                 echo "so we'll use lorder and tsort to order the libraries."
19530                 orderlib=true
19531                 ranlib=":"
19532         fi
19533 fi
19534 $rm -f foo* bar*
19535
19536 : check for type of arguments to select. 
19537 case "$selecttype" in
19538 '') case "$d_select" in
19539         $define)
19540                 echo " "
19541                 $cat <<EOM
19542 Checking to see what type of arguments are accepted by select().
19543 EOM
19544                 hdrs="$define sys/types.h
19545                         $i_systime sys/time.h 
19546                         $i_sysselct sys/select.h
19547                         $d_socket sys/socket.h"
19548                 : The first arg can be int, unsigned, or size_t
19549                 : The last arg may or may not be 'const'
19550                 val=''
19551                 : void pointer has been seen but using that
19552                 : breaks the selectminbits test
19553                 for xxx in 'fd_set *' 'int *'; do
19554                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19555                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19556                                         case "$val" in
19557                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19558                                                 if ./protochk "$try" $hdrs; then
19559                                                         echo "Your system accepts $xxx."
19560                                                         val="$xxx"
19561                                                 fi
19562                                                 ;;
19563                                         esac
19564                                 done
19565                         done
19566                 done
19567                 case "$val" in
19568                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19569                         case "$d_fd_set" in
19570                                 $define) dflt="fd_set *" ;;
19571                                 *)              dflt="int *" ;;
19572                         esac
19573                         . ./myread
19574                         val=$ans
19575                         ;;
19576                 esac
19577                 selecttype="$val"
19578                 ;;
19579         *)      : no select, so pick a harmless default
19580                 selecttype='int *'
19581                 ;;
19582         esac
19583         ;;
19584 esac
19585
19586 : check for the select 'width'
19587 case "$selectminbits" in
19588 '') safebits=`expr $ptrsize \* 8`
19589     case "$d_select" in
19590         $define)
19591                 $cat <<EOM
19592
19593 Checking to see on how many bits at a time your select() operates...
19594 EOM
19595                 $cat >try.c <<EOCP
19596 #include <sys/types.h>
19597 #$i_time I_TIME
19598 #$i_systime I_SYS_TIME
19599 #$i_systimek I_SYS_TIME_KERNEL
19600 #ifdef I_TIME
19601 #   include <time.h>
19602 #endif
19603 #ifdef I_SYS_TIME
19604 #   ifdef I_SYS_TIME_KERNEL
19605 #       define KERNEL
19606 #   endif
19607 #   include <sys/time.h>
19608 #   ifdef I_SYS_TIME_KERNEL
19609 #       undef KERNEL
19610 #   endif
19611 #endif
19612 #$i_sysselct I_SYS_SELECT
19613 #ifdef I_SYS_SELECT
19614 #include <sys/select.h>
19615 #endif
19616 #$d_socket HAS_SOCKET
19617 #ifdef HAS_SOCKET
19618 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19619 #endif
19620 #include <stdio.h>
19621 #$i_stdlib I_STDLIB
19622 #ifdef I_STDLIB
19623 #include <stdlib.h>
19624 #endif
19625 $selecttype b;
19626 #define S sizeof(*(b))
19627 #define MINBITS 64
19628 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19629 #define NBITS  (NBYTES * 8)
19630 int main() {
19631     char *s = (char *)malloc(NBYTES);
19632     struct timeval t;
19633     int i;
19634     FILE* fp;
19635     int fd;
19636
19637     if (!s)
19638         exit(1);
19639     fclose(stdin);
19640     fp = fopen("try.c", "r");
19641     if (fp == 0)
19642       exit(2);
19643     fd = fileno(fp);
19644     if (fd < 0)
19645       exit(3);
19646     b = ($selecttype)s;
19647     for (i = 0; i < NBITS; i++)
19648         FD_SET(i, b);
19649     t.tv_sec  = 0;
19650     t.tv_usec = 0;
19651     select(fd + 1, b, 0, 0, &t);
19652     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19653     free(s);
19654     printf("%d\n", i + 1);
19655     return 0;
19656 }
19657 EOCP
19658                 set try
19659                 if eval $compile_ok; then
19660                         selectminbits=`$run ./try`
19661                         case "$selectminbits" in
19662                         '')     cat >&4 <<EOM
19663 Cannot figure out on how many bits at a time your select() operates.
19664 I'll play safe and guess it is $safebits bits.
19665 EOM
19666                                 selectminbits=$safebits
19667                                 bits="$safebits bits"
19668                                 ;;
19669                         1)      bits="1 bit" ;;
19670                         *)      bits="$selectminbits bits" ;;
19671                         esac
19672                         echo "Your select() operates on $bits at a time." >&4
19673                 else
19674                         rp='What is the minimum number of bits your select() operates on?'
19675                         case "$byteorder" in
19676                         12345678)       dflt=64 ;;
19677                         1234)           dflt=32 ;;
19678                         *)              dflt=1  ;;
19679                         esac
19680                         . ./myread
19681                         val=$ans
19682                         selectminbits="$val"
19683                 fi
19684                 $rm -f try.* try
19685                 ;;
19686         *)      : no select, so pick a harmless default
19687                 selectminbits=$safebits
19688                 ;;
19689         esac
19690         ;;
19691 esac
19692
19693 : Trace out the files included by signal.h, then look for SIGxxx names.
19694 : Remove SIGARRAYSIZE used by HPUX.
19695 : Remove SIGSTKSIZE used by Linux.
19696 : Remove SIGSTKSZ used by Posix.
19697 : Remove SIGTYP void lines used by OS2.
19698 : Some cpps, like os390, dont give the file name anywhere
19699 if [ "X$fieldn" = X ]; then
19700         : Just make some guesses.  We check them later.
19701         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19702 else
19703         xxx=`echo '#include <signal.h>' |
19704         $cppstdin $cppminus $cppflags 2>/dev/null |
19705         $grep '^[       ]*#.*include' | 
19706         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19707 fi
19708 : Check this list of files to be sure we have parsed the cpp output ok.
19709 : This will also avoid potentially non-existent files, such 
19710 : as ../foo/bar.h
19711 xxxfiles=''
19712 for xx in $xxx /dev/null ; do
19713         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19714 done
19715 : If we have found no files, at least try signal.h
19716 case "$xxxfiles" in
19717 '')     xxxfiles=`./findhdr signal.h` ;;
19718 esac
19719 xxx=`awk '
19720 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19721         print substr($2, 4, 20)
19722 }
19723 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19724         print substr($3, 4, 20)
19725 }' $xxxfiles`
19726 : Append some common names just in case the awk scan failed.
19727 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19728 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19729 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19730 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19731 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19732
19733 : generate a few handy files for later
19734 $cat > signal.c <<EOCP
19735 #include <sys/types.h>
19736 #include <signal.h>
19737 #$i_stdlib I_STDLIB
19738 #ifdef I_STDLIB
19739 #include <stdlib.h>
19740 #endif
19741 #include <stdio.h>
19742 int main() {
19743
19744 /* Strange style to avoid deeply-nested #if/#else/#endif */
19745 #ifndef NSIG
19746 #  ifdef _NSIG
19747 #    define NSIG (_NSIG)
19748 #  endif
19749 #endif
19750
19751 #ifndef NSIG
19752 #  ifdef SIGMAX
19753 #    define NSIG (SIGMAX+1)
19754 #  endif
19755 #endif
19756
19757 #ifndef NSIG
19758 #  ifdef SIG_MAX
19759 #    define NSIG (SIG_MAX+1)
19760 #  endif
19761 #endif
19762
19763 #ifndef NSIG
19764 #  ifdef _SIG_MAX
19765 #    define NSIG (_SIG_MAX+1)
19766 #  endif
19767 #endif
19768
19769 #ifndef NSIG
19770 #  ifdef MAXSIG
19771 #    define NSIG (MAXSIG+1)
19772 #  endif
19773 #endif
19774
19775 #ifndef NSIG
19776 #  ifdef MAX_SIG
19777 #    define NSIG (MAX_SIG+1)
19778 #  endif
19779 #endif
19780
19781 #ifndef NSIG
19782 #  ifdef SIGARRAYSIZE
19783 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19784 #  endif
19785 #endif
19786
19787 #ifndef NSIG
19788 #  ifdef _sys_nsig
19789 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19790 #  endif
19791 #endif
19792
19793 /* Default to some arbitrary number that's big enough to get most
19794    of the common signals.
19795 */
19796 #ifndef NSIG
19797 #    define NSIG 50
19798 #endif
19799
19800 printf("NSIG %d\n", NSIG);
19801
19802 #ifndef JUST_NSIG
19803
19804 EOCP
19805
19806 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19807 {
19808         printf "#ifdef SIG"; printf $1; printf "\n"
19809         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19810         printf $1; printf ");\n"
19811         printf "#endif\n"
19812 }
19813 END {
19814         printf "#endif /* JUST_NSIG */\n";
19815         printf "exit(0);\n}\n";
19816 }
19817 ' >>signal.c
19818 $cat >signal.awk <<'EOP'
19819 BEGIN { ndups = 0 }
19820 $1 ~ /^NSIG$/ { nsig = $2 }
19821 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19822     if ($2 > maxsig) { maxsig = $2 }
19823     if (sig_name[$2]) {
19824         dup_name[ndups] = $1
19825         dup_num[ndups] = $2
19826         ndups++ 
19827     }
19828     else {
19829         sig_name[$2] = $1
19830         sig_num[$2] = $2
19831     }
19832 }
19833 END { 
19834     if (nsig == 0) {
19835         nsig = maxsig + 1
19836     }
19837     printf("NSIG %d\n", nsig);
19838     for (n = 1; n < nsig; n++) {
19839         if (sig_name[n]) {
19840             printf("%s %d\n", sig_name[n], sig_num[n])
19841         }
19842         else {
19843             printf("NUM%d %d\n", n, n) 
19844         }
19845     }
19846     for (n = 0; n < ndups; n++) {
19847         printf("%s %d\n", dup_name[n], dup_num[n])
19848     }
19849 }
19850 EOP
19851 $cat >signal_cmd <<EOS
19852 $startsh
19853 if $test -s signal.lst; then
19854     echo "Using your existing signal.lst file"
19855         exit 0
19856 fi
19857 xxx="$xxx"
19858 EOS
19859 $cat >>signal_cmd <<'EOS'
19860
19861 set signal
19862 if eval $compile_ok; then
19863         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19864 else
19865         echo "(I can't seem be able to compile the whole test program)" >&4
19866         echo "(I'll try it in little pieces.)" >&4
19867         set signal -DJUST_NSIG
19868         if eval $compile_ok; then
19869                 $run ./signal$_exe > signal.nsg
19870                 $cat signal.nsg
19871         else
19872                 echo "I can't seem to figure out how many signals you have." >&4
19873                 echo "Guessing 50." >&4
19874                 echo 'NSIG 50' > signal.nsg
19875         fi
19876         : Now look at all the signal names, one at a time.
19877         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19878                 $cat > signal.c <<EOCP
19879 #include <sys/types.h>
19880 #include <signal.h>
19881 #include <stdio.h>
19882 int main() {
19883 printf("$xx %d\n", SIG${xx});
19884 return 0;
19885 }
19886 EOCP
19887                 set signal
19888                 if eval $compile; then
19889                         echo "SIG${xx} found."
19890                         $run ./signal$_exe  >> signal.ls1
19891                 else
19892                         echo "SIG${xx} NOT found."
19893                 fi
19894         done
19895         if $test -s signal.ls1; then
19896                 $cat signal.nsg signal.ls1 |
19897                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19898         fi
19899
19900 fi
19901 if $test -s signal.lst; then
19902         :
19903 else
19904         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19905         echo 'kill -l' >signal
19906         set X `csh -f <signal`
19907         $rm -f signal
19908         shift
19909         case $# in
19910         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19911         esac
19912         echo $@ | $tr ' ' $trnl | \
19913             $awk '{ printf "%s %d\n", $1, ++s; }
19914                   END { printf "NSIG %d\n", ++s }' >signal.lst
19915 fi
19916 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19917 EOS
19918 chmod a+x signal_cmd
19919 $eunicefix signal_cmd
19920
19921 : generate list of signal names
19922 echo " "
19923 case "$sig_name_init" in
19924 '') doinit=yes ;;
19925 *)  case "$sig_num_init" in
19926     ''|*,*) doinit=yes ;;
19927     esac ;;
19928 esac
19929 case "$doinit" in
19930 yes)
19931         echo "Generating a list of signal names and numbers..." >&4
19932         . ./signal_cmd
19933         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19934         sig_name=`$awk 'BEGIN { printf "ZERO " }
19935                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19936         sig_num=`$awk  'BEGIN { printf "0 " }
19937                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19938         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19939                              !/^NSIG/   { printf "\"%s\", ", $1 }
19940                              END        { printf "0\n" }' signal.lst`
19941         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19942                              !/^NSIG/   { printf "%d, ", $2}
19943                              END        { printf "0\n"}' signal.lst`
19944         ;;
19945 esac
19946 echo "The following $sig_count signals are available:"
19947 echo " "
19948 echo $sig_name | $awk \
19949 'BEGIN { linelen = 0 }
19950 {
19951         for (i = 1; i <= NF; i++) {
19952                 name = "SIG" $i " "
19953                 linelen = linelen + length(name)
19954                 if (linelen > 70) {
19955                         printf "\n"
19956                         linelen = length(name)
19957                 }
19958                 printf "%s", name
19959         }
19960         printf "\n"
19961 }'
19962 sig_size=`echo $sig_name | awk '{print NF}'`
19963 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19964
19965 echo " "
19966 case "$sizetype" in
19967 *_t) zzz="$sizetype"    ;;
19968 *)   zzz="filesize"     ;;
19969 esac
19970 echo "Checking the size of $zzz..." >&4 
19971 cat > try.c <<EOCP
19972 #include <sys/types.h>
19973 #include <stdio.h>
19974 #$i_stdlib I_STDLIB
19975 #ifdef I_STDLIB
19976 #include <stdlib.h>
19977 #endif
19978 int main() {
19979     printf("%d\n", (int)sizeof($sizetype));
19980     exit(0);
19981 }
19982 EOCP
19983 set try
19984 if eval $compile_ok; then
19985         yyy=`$run ./try`
19986         case "$yyy" in
19987         '')     sizesize=4
19988                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19989                 ;;
19990         *)      sizesize=$yyy
19991                 echo "Your $zzz size is $sizesize bytes."
19992                 ;;
19993         esac
19994 else
19995         sizesize=4
19996         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19997 fi
19998
19999
20000 : check for socklen_t
20001 echo " "
20002 echo "Checking to see if you have socklen_t..." >&4
20003 $cat >try.c <<EOCP
20004 #include <sys/types.h>
20005 #$d_socket HAS_SOCKET
20006 #ifdef HAS_SOCKET
20007 #include <sys/socket.h>
20008 #endif
20009 int main() { socklen_t x = 16; }
20010 EOCP
20011 set try
20012 if eval $compile; then
20013         val="$define"
20014         echo "You have socklen_t."
20015 else
20016         val="$undef"
20017         echo "You do not have socklen_t."
20018         case "$sizetype" in
20019         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20020         esac
20021 fi
20022 $rm -f try try.*
20023 set d_socklen_t
20024 eval $setvar
20025
20026 : see if this is a socks.h system
20027 set socks.h i_socks
20028 eval $inhdr
20029
20030 : check for type of the size argument to socket calls
20031 case "$d_socket" in
20032 "$define")
20033         $cat <<EOM
20034
20035 Checking to see what type is the last argument of accept().
20036 EOM
20037         yyy=''
20038         case "$d_socklen_t" in
20039         "$define") yyy="$yyy socklen_t"
20040         esac
20041         yyy="$yyy $sizetype int long unsigned"
20042         for xxx in $yyy; do
20043                 case "$socksizetype" in
20044                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20045                         case "$usesocks" in
20046                         "$define")
20047                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20048                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20049                                         socksizetype="$xxx"
20050                                 fi
20051                                 ;;
20052                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20053                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20054                                         socksizetype="$xxx"
20055                                 fi
20056                                 ;;
20057                         esac
20058                         ;;
20059                 esac
20060         done
20061 : In case none of those worked, prompt the user.
20062         case "$socksizetype" in
20063         '')     rp='What is the type for socket address structure sizes?'
20064                 dflt='int'
20065                 . ./myread
20066                 socksizetype=$ans
20067                 ;;
20068         esac
20069         ;;
20070 *)      : no sockets, so pick relatively harmless default
20071         socksizetype='int'
20072         ;;
20073 esac
20074
20075 : see what type is used for signed size_t
20076 set ssize_t ssizetype int stdio.h sys/types.h
20077 eval $typedef
20078 dflt="$ssizetype"
20079 $cat > try.c <<EOM
20080 #include <stdio.h>
20081 #$i_stdlib I_STDLIB
20082 #ifdef I_STDLIB
20083 #include <stdlib.h>
20084 #endif
20085 #include <sys/types.h>
20086 #define Size_t $sizetype
20087 #define SSize_t $dflt
20088 int main()
20089 {
20090         if (sizeof(Size_t) == sizeof(SSize_t))
20091                 printf("$dflt\n");
20092         else if (sizeof(Size_t) == sizeof(int))
20093                 printf("int\n");
20094         else 
20095                 printf("long\n");
20096         exit(0);
20097 }
20098 EOM
20099 echo " "
20100 set try
20101 if eval $compile_ok && $run ./try > /dev/null; then
20102         ssizetype=`$run ./try`
20103         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20104 else
20105         $cat >&4 <<EOM
20106 Help! I can't compile and run the ssize_t test program: please enlighten me!
20107 (This is probably a misconfiguration in your system or libraries, and
20108 you really ought to fix it.  Still, I'll try anyway.)
20109
20110 I need a type that is the same size as $sizetype, but is guaranteed to
20111 be signed.  Common values are ssize_t, int and long.
20112
20113 EOM
20114         rp="What signed type is the same size as $sizetype?"
20115         . ./myread
20116         ssizetype="$ans"
20117 fi
20118 $rm -f try try.*
20119
20120 : see what type of char stdio uses.
20121 echo " "
20122 echo '#include <stdio.h>' > stdio.c
20123 $cppstdin $cppminus < stdio.c > stdioh
20124 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20125         echo "Your stdio uses unsigned chars." >&4
20126         stdchar="unsigned char"
20127 else
20128         echo "Your stdio uses signed chars." >&4
20129         stdchar="char"
20130 fi
20131 $rm -f stdio.* stdioh
20132
20133 : see what type uids are declared as in the kernel
20134 echo " "
20135 echo "Looking for the type for user ids returned by getuid()."
20136 set uid_t uidtype xxx stdio.h sys/types.h
20137 eval $typedef
20138 case "$uidtype" in
20139 xxx)
20140         xxx=`./findhdr sys/user.h`
20141         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20142         case $1 in
20143         unsigned) dflt="$1 $2" ;;
20144         *) dflt="$1" ;;
20145         esac
20146         ;;
20147 *) dflt="$uidtype";;
20148 esac
20149 case "$uidtype" in
20150 uid_t)  echo "uid_t found." ;;
20151 *)      rp="What is the type for user ids returned by getuid()?"
20152         . ./myread
20153         uidtype="$ans"
20154         ;;
20155 esac
20156
20157 echo " "
20158 case "$uidtype" in
20159 *_t) zzz="$uidtype"     ;;
20160 *)   zzz="uid"          ;;
20161 esac
20162 echo "Checking the size of $zzz..." >&4 
20163 cat > try.c <<EOCP
20164 #include <sys/types.h>
20165 #include <stdio.h>
20166 #$i_stdlib I_STDLIB
20167 #ifdef I_STDLIB
20168 #include <stdlib.h>
20169 #endif
20170 int main() {
20171     printf("%d\n", (int)sizeof($uidtype));
20172     exit(0);
20173 }
20174 EOCP
20175 set try
20176 if eval $compile_ok; then
20177         yyy=`$run ./try`
20178         case "$yyy" in
20179         '')     uidsize=4
20180                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20181                 ;;
20182         *)      uidsize=$yyy
20183                 echo "Your $zzz is $uidsize bytes long."
20184                 ;;
20185         esac
20186 else
20187         uidsize=4
20188         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20189 fi
20190
20191 echo " "
20192 case "$uidtype" in
20193 *_t) zzz="$uidtype"     ;;
20194 *)   zzz="uid"          ;;
20195 esac
20196 echo "Checking the sign of $zzz..." >&4
20197 cat > try.c <<EOCP
20198 #include <sys/types.h>
20199 #include <stdio.h>
20200 int main() {
20201         $uidtype foo = -1;
20202         if (foo < 0)
20203                 printf("-1\n");
20204         else
20205                 printf("1\n");
20206 }
20207 EOCP
20208 set try
20209 if eval $compile; then
20210         yyy=`$run ./try`
20211         case "$yyy" in
20212         '')     uidsign=1
20213                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20214                 ;;
20215         *)      uidsign=$yyy
20216                 case "$uidsign" in
20217                  1) echo "Your $zzz is unsigned." ;;
20218                 -1) echo "Your $zzz is signed."   ;;
20219                 esac
20220                 ;;
20221         esac
20222 else
20223         uidsign=1
20224         echo "(I can't compile the test program--guessing unsigned.)" >&4
20225 fi
20226
20227
20228
20229 echo " "
20230 $echo "Checking the format string to be used for uids..." >&4
20231
20232 case "$uidsign" in
20233 -1)     if $test X"$uidsize" = X"$ivsize"; then
20234                 uidformat="$ivdformat"
20235         else
20236                 if $test X"$uidsize" = X"$longsize"; then
20237                         uidformat='"ld"'
20238                 else
20239                         if $test X"$uidsize" = X"$intsize"; then
20240                                 uidformat='"d"'
20241                         else
20242                                 if $test X"$uidsize" = X"$shortsize"; then
20243                                         uidformat='"hd"'
20244                                 fi
20245                         fi
20246                 fi
20247         fi
20248         ;;
20249 *)      if $test X"$uidsize" = X"$uvsize"; then
20250                 uidformat="$uvuformat"
20251         else
20252                 if $test X"$uidsize" = X"$longsize"; then
20253                         uidformat='"lu"'
20254                 else
20255                         if $test X"$uidsize" = X"$intsize"; then
20256                                 uidformat='"u"'
20257                         else
20258                                 if $test X"$uidsize" = X"$shortsize"; then
20259                                         uidformat='"hu"'
20260                                 fi
20261                         fi
20262                 fi
20263         fi
20264         ;;
20265 esac
20266
20267
20268 case "$usesitecustomize" in
20269     $define|true|[Yy]*)
20270         usesitecustomize="$define"
20271         ;;
20272     *)
20273         usesitecustomize="$undef"
20274         ;;
20275     esac
20276
20277 : determine compiler compiler
20278 case "$yacc" in
20279 '')
20280         dflt=yacc;;
20281 *)
20282         dflt="$yacc";;
20283 esac
20284 echo " "
20285 comp='yacc'
20286 if $test -f "$byacc$_exe"; then
20287         dflt="$byacc"
20288         comp="byacc or $comp"
20289 fi
20290 if $test -f "$bison$_exe"; then
20291         comp="$comp or bison -y"
20292 fi
20293 rp="Which compiler compiler ($comp) shall I use?"
20294 . ./myread
20295 yacc="$ans"
20296 case "$yacc" in
20297 *bis*)
20298         case "$yacc" in
20299         *-y*) ;;
20300         *)
20301                 yacc="$yacc -y"
20302                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20303                 ;;
20304         esac
20305         ;;
20306 esac
20307
20308 : see if this is a fp.h system
20309 set fp.h i_fp
20310 eval $inhdr
20311
20312 : see if this is a fp_class.h system
20313 set fp_class.h i_fp_class
20314 eval $inhdr
20315
20316 : see if gdbm.h is available
20317 set gdbm.h t_gdbm
20318 eval $inhdr
20319 case "$t_gdbm" in
20320 $define)
20321         : see if gdbm_open exists
20322         set gdbm_open d_gdbm_open
20323         eval $inlibc
20324         case "$d_gdbm_open" in
20325         $undef)
20326                 t_gdbm="$undef"
20327                 echo "We won't be including <gdbm.h>"
20328                 ;;
20329         esac
20330         ;;
20331 esac
20332 val="$t_gdbm"
20333 set i_gdbm
20334 eval $setvar
20335
20336 : see if this is a ieeefp.h system
20337 case "$i_ieeefp" in
20338 '' ) set ieeefp.h i_ieeefp
20339      eval $inhdr
20340      ;;
20341 esac
20342
20343 : see if this is a libutil.h system
20344 set libutil.h i_libutil
20345 eval $inhdr
20346
20347 : see if mach cthreads are available
20348 if test "X$usethreads" = "X$define"; then
20349         set mach/cthreads.h i_machcthr
20350         eval $inhdr
20351 else
20352         i_machcthr="$undef"
20353 fi
20354
20355
20356
20357 : see if this is a mntent.h system
20358 set mntent.h i_mntent
20359 eval $inhdr
20360
20361 : see if ndbm.h is available
20362 set ndbm.h t_ndbm
20363 eval $inhdr
20364
20365 case "$t_ndbm" in
20366 $undef)
20367     # Some Linux distributions such as RedHat 7.1 put the
20368     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20369     if $test -f /usr/include/gdbm/ndbm.h; then
20370         echo '<gdbm/ndbm.h> found.'
20371         ccflags="$ccflags -I/usr/include/gdbm"
20372         cppflags="$cppflags -I/usr/include/gdbm"
20373         t_ndbm=$define
20374     fi
20375     ;;
20376 esac
20377
20378 case "$t_ndbm" in
20379 $define)
20380         : see if dbm_open exists
20381         set dbm_open d_dbm_open
20382         eval $inlibc
20383         case "$d_dbm_open" in
20384         $undef)
20385                 t_ndbm="$undef"
20386                 echo "We won't be including <ndbm.h>"
20387                 ;;
20388         esac
20389         ;;
20390 esac
20391 val="$t_ndbm"
20392 set i_ndbm
20393 eval $setvar
20394
20395 : see if net/errno.h is available
20396 val=''
20397 set net/errno.h val
20398 eval $inhdr
20399
20400 : Unfortunately, it causes problems on some systems.  Arrgh.
20401 case "$val" in
20402 $define)
20403         cat > try.c <<'EOM'
20404 #include <stdio.h>
20405 #include <errno.h>
20406 #include <net/errno.h>
20407 int func()
20408 {
20409         return ENOTSOCK;
20410 }
20411 EOM
20412         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20413                 echo "We'll be including <net/errno.h>." >&4
20414         else
20415                 echo "We won't be including <net/errno.h>." >&4
20416                 val="$undef"
20417         fi
20418         $rm -f try.* try
20419         ;;
20420 esac
20421 set i_neterrno
20422 eval $setvar
20423
20424 : see if netinet/tcp.h is available
20425 set netinet/tcp.h i_netinettcp
20426 eval $inhdr
20427
20428 : see if this is a poll.h system
20429 set poll.h i_poll
20430 eval $inhdr
20431
20432 : see if this is a prot.h system
20433 set prot.h i_prot
20434 eval $inhdr
20435
20436 echo " "
20437 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20438 $cat <<'EOSH' > Cppsym.know
20439 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20440 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20441 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20442 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20443 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20444 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20445 bull c cadmus clipper CMU COFF COMPILER_VERSION
20446 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20447 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20448 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20449 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20450 GLIBC GLIBC_MINOR
20451 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20452 H3050R H3050RX hbullx20 hcx host_mips
20453 hp200 hp300 hp700 HP700 hp800 hp9000
20454 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20455 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20456 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20457 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20458 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20459 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20460 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20461 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20462 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20463 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20464 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20465 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20466 MATH_HAS_NO_SIDE_EFFECTS
20467 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20468 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20469 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20470 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20471 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20472 NetBSD news1500 news1700 news1800 news1900 news3700
20473 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20474 ns32016 ns32332 ns32k nsc32000
20475 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20476 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20477 pc532 pdp11 PGC PIC plexus PORTAR posix
20478 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20479 POSIX_C_SOURCE POSIX_SOURCE POWER
20480 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20481 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20482 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20483 sony sony_news sonyrisc sparc sparclite spectrum
20484 stardent stdc STDC_EXT stratos sun sun3 sun386
20485 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20486 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20487 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20488 sysV68 sysV88 Tek4132 Tek4300 titan
20489 TM3200 TM5400 TM5600
20490 tower tower32 tower32_200 tower32_600 tower32_700
20491 tower32_800 tower32_850 tss
20492 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20493 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20494 unix UNIX95 UNIX99 unixpc unos
20495 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20496 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20497 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20498 USGr4 USGr4_2
20499 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20500 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20501 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20502 z8000
20503 EOSH
20504 # Maybe put other stuff here too.
20505 cat <<EOSH >>Cppsym.know
20506 $osname
20507 EOSH
20508 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20509 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20510 $cat Cppsym.know > Cppsym.c
20511 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20512 $rm -f Cppsym.a Cppsym.b Cppsym.c
20513 cat <<EOSH > Cppsym
20514 $startsh
20515 if $test \$# -gt 0; then
20516     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20517     if $test -s Cppsym.got; then
20518         $rm -f Cppsym.got
20519         exit 0
20520     fi
20521     $rm -f Cppsym.got
20522     exit 1
20523 else
20524     $tr " " "$trnl" | ./Cppsym.try
20525     exit 0
20526 fi
20527 EOSH
20528 chmod +x Cppsym
20529 $eunicefix Cppsym
20530 cat <<EOSH > Cppsym.try
20531 $startsh
20532 cat <<'EOCP' > try.c
20533 #include <stdio.h>
20534 #if cpp_stuff == 1
20535 #define STRINGIFY(a)    "a"
20536 #endif
20537 #if cpp_stuff == 42
20538 #define StGiFy(a)  #a
20539 #define STRINGIFY(a)    StGiFy(a)
20540 #endif
20541 #if $cpp_stuff != 1 && $cpp_stuff != 42
20542 #   include "Bletch: How does this C preprocessor stringify macros?"
20543 #endif
20544 int main() {
20545 EOCP
20546 $awk \\
20547 EOSH
20548 cat <<'EOSH' >> Cppsym.try
20549 'length($1) > 0 {
20550     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20551     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20552     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20553     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20554 }'       >> try.c
20555 echo 'return 0;}' >> try.c
20556 EOSH
20557 cat <<EOSH >> Cppsym.try
20558 ccflags="$ccflags"
20559 case "$osname-$gccversion" in
20560 irix-) ccflags="\$ccflags -woff 1178" ;;
20561 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20562 esac
20563 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20564 EOSH
20565 chmod +x Cppsym.try
20566 $eunicefix Cppsym.try
20567 ./Cppsym < Cppsym.know > Cppsym.true
20568 : Add in any linux cpp "predefined macros":
20569 case "$osname::$gccversion" in
20570   *linux*::*.*)
20571     tHdrH=_tmpHdr
20572     rm -f $tHdrH'.h' $tHdrH
20573     touch $tHdrH'.h'
20574     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20575        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20576        if [ -s $tHdrH'_cppsym.real' ]; then
20577           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20578        fi
20579     fi
20580     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20581   ;;
20582 esac
20583 : now check the C compiler for additional symbols
20584 postprocess_cc_v=''
20585 case "$osname" in
20586 aix) postprocess_cc_v="|$tr , ' '" ;;
20587 esac
20588 $cat >ccsym <<EOS
20589 $startsh
20590 $cat >tmp.c <<EOF
20591 extern int foo;
20592 EOF
20593 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20594 do
20595         case "\$i" in
20596         -D*) echo "\$i" | $sed 's/^-D//';;
20597         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20598         esac
20599 done
20600 $rm -f try.c
20601 EOS
20602 postprocess_cc_v=''
20603 chmod +x ccsym
20604 $eunicefix ccsym
20605 ./ccsym > ccsym1.raw
20606 if $test -s ccsym1.raw; then
20607        $sort ccsym1.raw | $uniq >ccsym.raw
20608 else
20609        mv ccsym1.raw ccsym.raw
20610 fi
20611
20612 $awk '/\=/ { print $0; next }
20613         { print $0"=1" }' ccsym.raw >ccsym.list
20614 $comm -13 Cppsym.true ccsym.list >ccsym.own
20615 $comm -12 Cppsym.true ccsym.list >ccsym.com
20616 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20617 also=''
20618 if $test -z ccsym.raw; then
20619         echo "Your C compiler doesn't seem to define any symbols!" >&4
20620         echo " "
20621         echo "However, your C preprocessor defines the following symbols:"
20622         $cat Cppsym.true
20623         ccsymbols=''
20624         cppsymbols=`$cat Cppsym.true`
20625         cppsymbols=`echo $cppsymbols`
20626         cppccsymbols="$cppsymbols"
20627 else
20628         if $test -s ccsym.com; then
20629                 echo "Your C compiler and pre-processor define these symbols:"
20630                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20631                 also='also '
20632                 symbols='ones'
20633                 cppccsymbols=`$cat ccsym.com`
20634                 cppccsymbols=`echo $cppccsymbols`
20635                 $test "$silent" || sleep 1
20636         fi
20637         if $test -s ccsym.cpp; then
20638                 $test "$also" && echo " "
20639                 echo "Your C pre-processor ${also}defines the following symbols:"
20640                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20641                 also='further '
20642                 cppsymbols=`$cat ccsym.cpp`
20643                 cppsymbols=`echo $cppsymbols`
20644                 $test "$silent" || sleep 1
20645         fi
20646         if $test -s ccsym.own; then
20647                 $test "$also" && echo " "
20648                 echo "Your C compiler ${also}defines the following cpp symbols:"
20649                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20650                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20651                 ccsymbols=`$cat ccsym.own`
20652                 ccsymbols=`echo $ccsymbols`
20653                 $test "$silent" || sleep 1
20654         fi
20655 fi
20656
20657 : see if this is a termio system
20658 val="$undef"
20659 val2="$undef"
20660 val3="$undef"
20661 if $test `./findhdr termios.h`; then
20662         set tcsetattr i_termios
20663         eval $inlibc
20664         val3="$i_termios"
20665 fi
20666 echo " "
20667 case "$val3" in
20668 "$define") echo "You have POSIX termios.h... good!" >&4;;
20669 *) if ./Cppsym pyr; then
20670                 case "`/bin/universe`" in
20671                 ucb) if $test `./findhdr sgtty.h`; then
20672                                 val2="$define"
20673                                 echo "<sgtty.h> found." >&4
20674                         else
20675                                 echo "System is pyramid with BSD universe."
20676                                 echo "<sgtty.h> not found--you could have problems." >&4
20677                         fi;;
20678                 *) if $test `./findhdr termio.h`; then
20679                                 val="$define"
20680                                 echo "<termio.h> found." >&4
20681                         else
20682                                 echo "System is pyramid with USG universe."
20683                                 echo "<termio.h> not found--you could have problems." >&4
20684                         fi;;
20685                 esac
20686         elif ./usg; then
20687                 if $test `./findhdr termio.h`; then
20688                         echo "<termio.h> found." >&4
20689                         val="$define"
20690                 elif $test `./findhdr sgtty.h`; then
20691                         echo "<sgtty.h> found." >&4
20692                         val2="$define"
20693                 else
20694 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20695                 fi
20696         else
20697                 if $test `./findhdr sgtty.h`; then
20698                         echo "<sgtty.h> found." >&4
20699                         val2="$define"
20700                 elif $test `./findhdr termio.h`; then
20701                         echo "<termio.h> found." >&4
20702                         val="$define"
20703                 else
20704 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20705                 fi
20706         fi;;
20707 esac
20708 set i_termio; eval $setvar
20709 val=$val2; set i_sgtty; eval $setvar
20710 val=$val3; set i_termios; eval $setvar
20711
20712 : see if stddef is available
20713 set stddef.h i_stddef
20714 eval $inhdr
20715
20716 : see if this is a sunmath.h system
20717 set sunmath.h i_sunmath
20718 eval $inhdr
20719
20720 : see if sys/access.h is available
20721 set sys/access.h i_sysaccess
20722 eval $inhdr
20723
20724 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20725 set sys/filio.h i_sysfilio
20726 eval $inhdr
20727 echo " "
20728 if $test `./findhdr sys/ioctl.h`; then
20729         val="$define"
20730         echo '<sys/ioctl.h> found.' >&4
20731 else
20732         val="$undef"
20733         if $test $i_sysfilio = "$define"; then
20734             echo '<sys/ioctl.h> NOT found.' >&4
20735         else
20736                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20737                 $test $i_termio = "$define" && xxx="termio.h"
20738                 $test $i_termios = "$define" && xxx="termios.h"
20739 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20740         fi
20741 fi
20742 set i_sysioctl
20743 eval $setvar
20744
20745 : see if socket ioctl defs are in sys/sockio.h
20746 echo " "
20747 xxx=`./findhdr sys/sockio.h`
20748 if $test "$xxx"; then
20749         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20750                 val="$define"
20751                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20752         else
20753                 val="$undef"
20754                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20755         fi
20756 else
20757         val="$undef"
20758         $cat <<EOM
20759 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20760 EOM
20761 fi
20762 set i_syssockio
20763 eval $setvar
20764
20765
20766 : see if this is a syslog.h system
20767 set syslog.h i_syslog
20768 eval $inhdr
20769
20770
20771 : see if this is a sys/mode.h system
20772 set sys/mode.h i_sysmode
20773 eval $inhdr
20774
20775 : see if sys/resource.h has to be included
20776 set sys/resource.h i_sysresrc
20777 eval $inhdr
20778
20779 : see if sys/security.h is available
20780 set sys/security.h i_syssecrt
20781 eval $inhdr
20782
20783 : see if this is a sys/statvfs.h system
20784 set sys/statvfs.h i_sysstatvfs
20785 eval $inhdr
20786
20787 : see if this is a sys/un.h system
20788 set sys/un.h i_sysun
20789 eval $inhdr
20790
20791
20792 : see if this is a sys/utsname.h system
20793 set sys/utsname.h i_sysutsname
20794 eval $inhdr
20795
20796 : see if this is a syswait system
20797 set sys/wait.h i_syswait
20798 eval $inhdr
20799
20800 : see if this is a ustat.h system
20801 set ustat.h i_ustat
20802 eval $inhdr
20803
20804 : see if this is an utime system
20805 set utime.h i_utime
20806 eval $inhdr
20807
20808 : see if this is a values.h system
20809 set values.h i_values
20810 eval $inhdr
20811
20812 : see if this is a vfork system
20813 case "$d_vfork" in
20814 "$define")
20815         set vfork.h i_vfork
20816         eval $inhdr
20817         ;;
20818 *)
20819         i_vfork="$undef"
20820         ;;
20821 esac
20822
20823 echo " "
20824 echo "Looking for extensions..." >&4
20825 : If we are using the old config.sh, known_extensions may contain
20826 : old or inaccurate or duplicate values.
20827 known_extensions=''
20828 nonxs_extensions=''
20829 : We do not use find because it might not be available.
20830 : We do not just use MANIFEST because the user may have dropped
20831 : some additional extensions into the source tree and expect them
20832 : to be built.
20833
20834 : Function to recursively find available extensions, ignoring DynaLoader
20835 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20836 find_extensions='
20837     for xxx in *; do
20838        case "$xxx" in
20839            DynaLoader|dynaload) ;;
20840            *)
20841            if $test -f $xxx/$xxx.xs; then
20842                known_extensions="$known_extensions $1$xxx";
20843            elif $test -f $xxx/Makefile.PL; then
20844                nonxs_extensions="$nonxs_extensions $1$xxx";
20845            else
20846                if $test -d $xxx -a $# -lt 10; then
20847                    set $1$xxx/ $*;
20848                    cd "$xxx";
20849                    eval $find_extensions;
20850                    cd ..;
20851                    shift;
20852                fi;
20853            fi
20854            ;;
20855        esac;
20856     done'
20857 tdir=`pwd`
20858 cd "$rsrc/ext"
20859 set X
20860 shift
20861 eval $find_extensions
20862 # Special case:  Add in threads/shared since it is not picked up by the
20863 # recursive find above (and adding in general recursive finding breaks
20864 # SDBM_File/sdbm).  A.D.  10/25/2001.
20865 known_extensions="$known_extensions threads/shared"
20866 set X $nonxs_extensions
20867 shift
20868 nonxs_extensions="$*"
20869 set X $known_extensions
20870 shift
20871 known_extensions="$*"
20872 cd "$tdir"
20873
20874 : Now see which are supported on this system.
20875 avail_ext=''
20876 for xxx in $known_extensions ; do
20877         case "$xxx" in
20878         DB_File|db_file)
20879                 case "$i_db" in
20880                 $define) avail_ext="$avail_ext $xxx" ;;
20881                 esac
20882                 ;;
20883         GDBM_File|gdbm_fil)
20884                 case "$i_gdbm" in 
20885                 $define) avail_ext="$avail_ext $xxx" ;;
20886                 esac
20887                 ;;
20888         I18N/Langinfo|i18n_lan)
20889                 case "$i_langinfo$d_nl_langinfo" in 
20890                 $define$define) avail_ext="$avail_ext $xxx" ;;
20891                 esac
20892                 ;;
20893         NDBM_File|ndbm_fil)
20894                 case "$i_ndbm" in
20895                 $define)
20896                     case "$osname-$use64bitint" in
20897                     hpux-define)
20898                         case "$libs" in
20899                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20900                         esac
20901                         ;;
20902                     *) avail_ext="$avail_ext $xxx" ;;
20903                     esac
20904                     ;;
20905                 esac
20906                 ;;
20907         ODBM_File|odbm_fil) 
20908                 case "${i_dbm}${i_rpcsvcdbm}" in
20909                 *"${define}"*)
20910                     case "$osname-$use64bitint" in
20911                     hpux-define)
20912                         case "$libs" in
20913                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20914                         esac
20915                         ;;
20916                     *) avail_ext="$avail_ext $xxx" ;;
20917                     esac
20918                     ;;
20919                 esac
20920                 ;;
20921         POSIX|posix)
20922                 case "$useposix" in
20923                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20924                 esac
20925                 ;;
20926         Opcode|opcode)
20927                 case "$useopcode" in
20928                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20929                 esac
20930                 ;;
20931         Socket|socket)
20932                 case "$d_socket" in 
20933                 true|$define|y)
20934                     case "$osname" in
20935                     beos) ;; # not unless BONE
20936                     *) avail_ext="$avail_ext $xxx" ;;
20937                     esac
20938                     ;;
20939                 esac
20940                 ;;
20941         Sys/Syslog|sys/syslog)
20942                 : XXX syslog requires socket
20943                 case "$d_socket" in 
20944                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20945                 esac
20946                 ;;
20947         Thread|thread)
20948                 case "$usethreads" in
20949                 true|$define|y)
20950                         case "$useithreads" in
20951                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20952                         esac
20953                 esac
20954                 ;;
20955         XS/APItest|xs/apitest)
20956                 # This is just for testing.  Skip it unless we have dynamic loading.
20957
20958                 case "$usedl" in
20959                 $define) avail_ext="$avail_ext $xxx" ;;
20960                 esac
20961                 ;;
20962         XS/Typemap|xs/typemap)
20963                 # This is just for testing.  Skip it unless we have dynamic loading.
20964                 case "$usedl" in
20965                 $define) avail_ext="$avail_ext $xxx" ;;
20966                 esac
20967                 ;;
20968         threads|threads/shared)
20969                 # threads and threads::shared are special cases.
20970                 # To stop people from asking "Perl 5.8.0 was supposed
20971                 # to have this new fancy threads implementation but my
20972                 # perl doesn't have it" and from people trying to
20973                 # (re)install the threads module using CPAN.pm and
20974                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20975                 # the threads.pm and threads/shared.pm will always be
20976                 # there, croaking informatively ("you need to rebuild
20977                 # all of Perl with threads, sorry") when threads haven't
20978                 # been compiled in.
20979                 # --jhi
20980                 avail_ext="$avail_ext $xxx"
20981                 ;;
20982         IPC/SysV|ipc/sysv)
20983                 : XXX Do we need a useipcsysv variable here
20984                 case "${d_msg}${d_sem}${d_shm}" in 
20985                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20986                 esac
20987                 ;;
20988         *)      avail_ext="$avail_ext $xxx"
20989                 ;;
20990         esac
20991 done
20992
20993 set X $avail_ext
20994 shift
20995 avail_ext="$*"
20996
20997 case "$onlyextensions" in
20998 '') ;;
20999 *)  keepextensions=''
21000     echo "You have requested that only certains extensions be included..." >&4
21001     for i in $onlyextensions; do
21002         case " $avail_ext " in
21003         *" $i "*)
21004             echo "Keeping extension $i."
21005             keepextensions="$keepextensions $i"
21006             ;;
21007         *) echo "Ignoring extension $i." ;;
21008         esac
21009     done
21010     avail_ext="$keepextensions"
21011     ;;
21012 esac
21013
21014 case "$noextensions" in
21015 '') ;;
21016 *)  keepextensions=''
21017     echo "You have requested that certain extensions be ignored..." >&4
21018     for i in $avail_ext; do
21019         case " $noextensions " in
21020         *" $i "*) echo "Ignoring extension $i." ;;
21021         *) echo "Keeping extension $i.";
21022            keepextensions="$keepextensions $i"
21023            ;;
21024         esac
21025     done
21026     avail_ext="$keepextensions"
21027     ;;
21028 esac
21029
21030 : Now see which nonxs extensions are supported on this system.
21031 : For now assume all are.
21032 nonxs_ext=''
21033 for xxx in $nonxs_extensions ; do
21034         case "$xxx" in
21035         *)      nonxs_ext="$nonxs_ext $xxx"
21036                 ;;
21037         esac
21038 done
21039
21040 set X $nonxs_ext
21041 shift
21042 nonxs_ext="$*"
21043
21044 case $usedl in
21045 $define)
21046         $cat <<EOM
21047 A number of extensions are supplied with $package.  You may choose to
21048 compile these extensions for dynamic loading (the default), compile
21049 them into the $package executable (static loading), or not include
21050 them at all.  Answer "none" to include no extensions.
21051 Note that DynaLoader is always built and need not be mentioned here.
21052
21053 EOM
21054         case "$dynamic_ext" in
21055         '')
21056                 : Exclude those listed in static_ext
21057                 dflt=''
21058                 for xxx in $avail_ext; do
21059                         case " $static_ext " in
21060                         *" $xxx "*) ;;
21061                         *) dflt="$dflt $xxx" ;;
21062                         esac
21063                 done
21064                 set X $dflt
21065                 shift
21066                 dflt="$*"
21067                 ;;
21068         *)      dflt="$dynamic_ext"
21069                 # Perhaps we are reusing an old out-of-date config.sh.
21070                 case "$hint" in
21071                 previous)
21072                         if test X"$dynamic_ext" != X"$avail_ext"; then
21073                                 $cat <<EOM
21074 NOTICE:  Your previous config.sh list may be incorrect. 
21075 The extensions now available to you are 
21076         ${avail_ext}
21077 but the default list from your previous config.sh is
21078         ${dynamic_ext} 
21079
21080 EOM
21081                         fi
21082                         ;;
21083                 esac
21084                 ;;
21085         esac
21086         case "$dflt" in
21087         '')     dflt=none;;
21088         esac
21089         rp="What extensions do you wish to load dynamically?"
21090         . ./myread
21091         case "$ans" in
21092         none) dynamic_ext=' ' ;;
21093         *) dynamic_ext="$ans" ;;
21094         esac
21095
21096         case "$static_ext" in
21097         '')
21098                 : Exclude those already listed in dynamic linking
21099                 dflt=''
21100                 for xxx in $avail_ext; do
21101                         case " $dynamic_ext " in
21102                         *" $xxx "*) ;;
21103                         *) dflt="$dflt $xxx" ;;
21104                         esac
21105                 done
21106                 set X $dflt
21107                 shift
21108                 dflt="$*"
21109                 ;;
21110         *)  dflt="$static_ext" 
21111                 ;;
21112         esac
21113
21114         case "$dflt" in
21115         '')     dflt=none;;
21116         esac
21117         rp="What extensions do you wish to load statically?"
21118         . ./myread
21119         case "$ans" in
21120         none) static_ext=' ' ;;
21121         *) static_ext="$ans" ;;
21122         esac
21123         ;;
21124 *)
21125         $cat <<EOM
21126 A number of extensions are supplied with $package.  Answer "none" 
21127 to include no extensions. 
21128 Note that DynaLoader is always built and need not be mentioned here.
21129
21130 EOM
21131         case "$static_ext" in
21132         '') dflt="$avail_ext" ;;
21133         *)      dflt="$static_ext"
21134                 # Perhaps we are reusing an old out-of-date config.sh.
21135                 case "$hint" in
21136                 previous)
21137                         if test X"$static_ext" != X"$avail_ext"; then
21138                                 $cat <<EOM
21139 NOTICE:  Your previous config.sh list may be incorrect. 
21140 The extensions now available to you are 
21141         ${avail_ext}
21142 but the default list from your previous config.sh is
21143         ${static_ext} 
21144
21145 EOM
21146                         fi
21147                         ;;
21148                 esac
21149                 ;;
21150         esac
21151         : Exclude those that are not xs extensions
21152         case "$dflt" in
21153         '')     dflt=none;;
21154         esac
21155         rp="What extensions do you wish to include?"
21156         . ./myread
21157         case "$ans" in
21158         none) static_ext=' ' ;;
21159         *) static_ext="$ans" ;;
21160         esac
21161         ;;
21162 esac
21163 #        
21164 # Encode is a special case.  If we are building Encode as a static
21165 # extension, we need to explicitly list its subextensions as well.
21166 # For other nested extensions, this is handled automatically by
21167 # the appropriate Makefile.PL.
21168 case " $static_ext " in
21169         *" Encode "*) # Add the subextensions of Encode
21170         cd "$rsrc/ext"
21171         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21172                 static_ext="$static_ext Encode/$xxx"
21173         done
21174         cd "$tdir"
21175         ;;
21176 esac
21177
21178 set X $dynamic_ext $static_ext $nonxs_ext
21179 shift
21180 extensions="$*"
21181
21182 # Sanity check:  We require an extension suitable for use with
21183 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21184 # should show up as failures in the test suite, but it's helpful to
21185 # catch them now.) The 'extensions' list is normally sorted
21186 # alphabetically, so we need to accept either
21187 #    DB_File ... Fcntl ... IO  ....
21188 # or something like
21189 #    Fcntl ... NDBM_File ... IO  ....
21190 case " $extensions"  in
21191 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21192 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21193 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21194 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21195    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21196    ;;
21197 esac
21198
21199 : Remove libraries needed only for extensions
21200 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21201 : The exception is SunOS 4.x, which needs them.
21202 case "${osname}X${osvers}" in
21203 sunos*X4*)
21204     perllibs="$libs"
21205     ;;
21206 *) case "$usedl" in
21207     $define|true|[yY]*)
21208             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21209             shift
21210             perllibs="$*"
21211             ;;
21212     *)  perllibs="$libs"
21213             ;;
21214     esac
21215     ;;
21216 esac
21217
21218 : Remove build directory name from cppstdin so it can be used from
21219 : either the present location or the final installed location.
21220 echo " "
21221 : Get out of the UU directory to get correct path name.
21222 cd ..
21223 case "$cppstdin" in
21224 `pwd`/cppstdin)
21225         echo "Stripping down cppstdin path name"
21226         cppstdin=cppstdin
21227         ;;
21228 esac
21229 cd UU
21230
21231 : end of configuration questions
21232 echo " "
21233 echo "End of configuration questions."
21234 echo " "
21235
21236 : back to where it started
21237 if test -d ../UU; then
21238         cd ..
21239 fi
21240
21241 : configuration may be patched via a 'config.arch' file
21242 if $test -f config.arch; then
21243         echo "I see a config.arch file, loading it."
21244         . ./config.arch
21245 fi
21246
21247 : configuration may be patched via a 'config.over' file
21248 if $test -f config.over; then
21249         echo " "
21250         dflt=y
21251         rp='I see a config.over file.  Do you wish to load it?'
21252         . UU/myread
21253         case "$ans" in
21254         n*) echo "OK, I'll ignore it.";;
21255         *)      . ./config.over
21256                 echo "Configuration override changes have been loaded."
21257                 ;;
21258         esac
21259 fi
21260
21261 : in case they want portability, strip down executable paths
21262 case "$d_portable" in
21263 "$define")
21264         echo " "
21265         echo "Stripping down executable paths..." >&4
21266         for file in $loclist $trylist; do
21267                 eval temp=\$$file
21268                 eval $file=`basename $temp`
21269         done
21270         ;;
21271 esac
21272
21273 : create config.sh file
21274 echo " "
21275 echo "Creating config.sh..." >&4
21276 $spitshell <<EOT >config.sh
21277 $startsh
21278 #
21279 # This file was produced by running the Configure script. It holds all the
21280 # definitions figured out by Configure. Should you modify one of these values,
21281 # do not forget to propagate your changes by running "Configure -der". You may
21282 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21283 #
21284
21285 # Package name      : $package
21286 # Source directory  : $src
21287 # Configuration time: $cf_time
21288 # Configured by     : $cf_by
21289 # Target system     : $myuname
21290
21291 Author='$Author'
21292 Date='$Date'
21293 Header='$Header'
21294 Id='$Id'
21295 Locker='$Locker'
21296 Log='$Log'
21297 Mcc='$Mcc'
21298 RCSfile='$RCSfile'
21299 Revision='$Revision'
21300 Source='$Source'
21301 State='$State'
21302 _a='$_a'
21303 _exe='$_exe'
21304 _o='$_o'
21305 afs='$afs'
21306 afsroot='$afsroot'
21307 alignbytes='$alignbytes'
21308 ansi2knr='$ansi2knr'
21309 aphostname='$aphostname'
21310 api_revision='$api_revision'
21311 api_subversion='$api_subversion'
21312 api_version='$api_version'
21313 api_versionstring='$api_versionstring'
21314 ar='$ar'
21315 archlib='$archlib'
21316 archlibexp='$archlibexp'
21317 archname64='$archname64'
21318 archname='$archname'
21319 archobjs='$archobjs'
21320 asctime_r_proto='$asctime_r_proto'
21321 awk='$awk'
21322 baserev='$baserev'
21323 bash='$bash'
21324 bin='$bin'
21325 binexp='$binexp'
21326 bison='$bison'
21327 byacc='$byacc'
21328 byteorder='$byteorder'
21329 c='$c'
21330 castflags='$castflags'
21331 cat='$cat'
21332 cc='$cc'
21333 cccdlflags='$cccdlflags'
21334 ccdlflags='$ccdlflags'
21335 ccflags='$ccflags'
21336 ccflags_uselargefiles='$ccflags_uselargefiles'
21337 ccname='$ccname'
21338 ccsymbols='$ccsymbols'
21339 ccversion='$ccversion'
21340 cf_by='$cf_by'
21341 cf_email='$cf_email'
21342 cf_time='$cf_time'
21343 charsize='$charsize'
21344 chgrp='$chgrp'
21345 chmod='$chmod'
21346 chown='$chown'
21347 clocktype='$clocktype'
21348 comm='$comm'
21349 compress='$compress'
21350 contains='$contains'
21351 cp='$cp'
21352 cpio='$cpio'
21353 cpp='$cpp'
21354 cpp_stuff='$cpp_stuff'
21355 cppccsymbols='$cppccsymbols'
21356 cppflags='$cppflags'
21357 cpplast='$cpplast'
21358 cppminus='$cppminus'
21359 cpprun='$cpprun'
21360 cppstdin='$cppstdin'
21361 cppsymbols='$cppsymbols'
21362 crypt_r_proto='$crypt_r_proto'
21363 cryptlib='$cryptlib'
21364 csh='$csh'
21365 ctermid_r_proto='$ctermid_r_proto'
21366 ctime_r_proto='$ctime_r_proto'
21367 d_Gconvert='$d_Gconvert'
21368 d_PRIEUldbl='$d_PRIEUldbl'
21369 d_PRIFUldbl='$d_PRIFUldbl'
21370 d_PRIGUldbl='$d_PRIGUldbl'
21371 d_PRIXU64='$d_PRIXU64'
21372 d_PRId64='$d_PRId64'
21373 d_PRIeldbl='$d_PRIeldbl'
21374 d_PRIfldbl='$d_PRIfldbl'
21375 d_PRIgldbl='$d_PRIgldbl'
21376 d_PRIi64='$d_PRIi64'
21377 d_PRIo64='$d_PRIo64'
21378 d_PRIu64='$d_PRIu64'
21379 d_PRIx64='$d_PRIx64'
21380 d_SCNfldbl='$d_SCNfldbl'
21381 d__fwalk='$d__fwalk'
21382 d_access='$d_access'
21383 d_accessx='$d_accessx'
21384 d_aintl='$d_aintl'
21385 d_alarm='$d_alarm'
21386 d_archlib='$d_archlib'
21387 d_asctime_r='$d_asctime_r'
21388 d_atolf='$d_atolf'
21389 d_atoll='$d_atoll'
21390 d_attribute_format='$d_attribute_format'
21391 d_attribute_malloc='$d_attribute_malloc'
21392 d_attribute_nonnull='$d_attribute_nonnull'
21393 d_attribute_noreturn='$d_attribute_noreturn'
21394 d_attribute_pure='$d_attribute_pure'
21395 d_attribute_unused='$d_attribute_unused'
21396 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21397 d_bcmp='$d_bcmp'
21398 d_bcopy='$d_bcopy'
21399 d_bsd='$d_bsd'
21400 d_bsdgetpgrp='$d_bsdgetpgrp'
21401 d_bsdsetpgrp='$d_bsdsetpgrp'
21402 d_builtin_choose_expr='$d_builtin_choose_expr'
21403 d_builtin_expect='$d_builtin_expect'
21404 d_bzero='$d_bzero'
21405 d_c99_variadic_macros='$d_c99_variadic_macros'
21406 d_casti32='$d_casti32'
21407 d_castneg='$d_castneg'
21408 d_charvspr='$d_charvspr'
21409 d_chown='$d_chown'
21410 d_chroot='$d_chroot'
21411 d_chsize='$d_chsize'
21412 d_class='$d_class'
21413 d_clearenv='$d_clearenv'
21414 d_closedir='$d_closedir'
21415 d_cmsghdr_s='$d_cmsghdr_s'
21416 d_const='$d_const'
21417 d_copysignl='$d_copysignl'
21418 d_cplusplus='$d_cplusplus'
21419 d_crypt='$d_crypt'
21420 d_crypt_r='$d_crypt_r'
21421 d_csh='$d_csh'
21422 d_ctermid='$d_ctermid'
21423 d_ctermid_r='$d_ctermid_r'
21424 d_ctime_r='$d_ctime_r'
21425 d_cuserid='$d_cuserid'
21426 d_dbl_dig='$d_dbl_dig'
21427 d_dbminitproto='$d_dbminitproto'
21428 d_difftime='$d_difftime'
21429 d_dirfd='$d_dirfd'
21430 d_dirnamlen='$d_dirnamlen'
21431 d_dlerror='$d_dlerror'
21432 d_dlopen='$d_dlopen'
21433 d_dlsymun='$d_dlsymun'
21434 d_dosuid='$d_dosuid'
21435 d_drand48_r='$d_drand48_r'
21436 d_drand48proto='$d_drand48proto'
21437 d_dup2='$d_dup2'
21438 d_eaccess='$d_eaccess'
21439 d_endgrent='$d_endgrent'
21440 d_endgrent_r='$d_endgrent_r'
21441 d_endhent='$d_endhent'
21442 d_endhostent_r='$d_endhostent_r'
21443 d_endnent='$d_endnent'
21444 d_endnetent_r='$d_endnetent_r'
21445 d_endpent='$d_endpent'
21446 d_endprotoent_r='$d_endprotoent_r'
21447 d_endpwent='$d_endpwent'
21448 d_endpwent_r='$d_endpwent_r'
21449 d_endsent='$d_endsent'
21450 d_endservent_r='$d_endservent_r'
21451 d_eofnblk='$d_eofnblk'
21452 d_eunice='$d_eunice'
21453 d_faststdio='$d_faststdio'
21454 d_fchdir='$d_fchdir'
21455 d_fchmod='$d_fchmod'
21456 d_fchown='$d_fchown'
21457 d_fcntl='$d_fcntl'
21458 d_fcntl_can_lock='$d_fcntl_can_lock'
21459 d_fd_macros='$d_fd_macros'
21460 d_fd_set='$d_fd_set'
21461 d_fds_bits='$d_fds_bits'
21462 d_fgetpos='$d_fgetpos'
21463 d_finite='$d_finite'
21464 d_finitel='$d_finitel'
21465 d_flexfnam='$d_flexfnam'
21466 d_flock='$d_flock'
21467 d_flockproto='$d_flockproto'
21468 d_fork='$d_fork'
21469 d_fp_class='$d_fp_class'
21470 d_fpathconf='$d_fpathconf'
21471 d_fpclass='$d_fpclass'
21472 d_fpclassify='$d_fpclassify'
21473 d_fpclassl='$d_fpclassl'
21474 d_fpos64_t='$d_fpos64_t'
21475 d_frexpl='$d_frexpl'
21476 d_fs_data_s='$d_fs_data_s'
21477 d_fseeko='$d_fseeko'
21478 d_fsetpos='$d_fsetpos'
21479 d_fstatfs='$d_fstatfs'
21480 d_fstatvfs='$d_fstatvfs'
21481 d_fsync='$d_fsync'
21482 d_ftello='$d_ftello'
21483 d_ftime='$d_ftime'
21484 d_futimes='$d_futimes'
21485 d_getcwd='$d_getcwd'
21486 d_getespwnam='$d_getespwnam'
21487 d_getfsstat='$d_getfsstat'
21488 d_getgrent='$d_getgrent'
21489 d_getgrent_r='$d_getgrent_r'
21490 d_getgrgid_r='$d_getgrgid_r'
21491 d_getgrnam_r='$d_getgrnam_r'
21492 d_getgrps='$d_getgrps'
21493 d_gethbyaddr='$d_gethbyaddr'
21494 d_gethbyname='$d_gethbyname'
21495 d_gethent='$d_gethent'
21496 d_gethname='$d_gethname'
21497 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21498 d_gethostbyname_r='$d_gethostbyname_r'
21499 d_gethostent_r='$d_gethostent_r'
21500 d_gethostprotos='$d_gethostprotos'
21501 d_getitimer='$d_getitimer'
21502 d_getlogin='$d_getlogin'
21503 d_getlogin_r='$d_getlogin_r'
21504 d_getmnt='$d_getmnt'
21505 d_getmntent='$d_getmntent'
21506 d_getnbyaddr='$d_getnbyaddr'
21507 d_getnbyname='$d_getnbyname'
21508 d_getnent='$d_getnent'
21509 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21510 d_getnetbyname_r='$d_getnetbyname_r'
21511 d_getnetent_r='$d_getnetent_r'
21512 d_getnetprotos='$d_getnetprotos'
21513 d_getpagsz='$d_getpagsz'
21514 d_getpbyname='$d_getpbyname'
21515 d_getpbynumber='$d_getpbynumber'
21516 d_getpent='$d_getpent'
21517 d_getpgid='$d_getpgid'
21518 d_getpgrp2='$d_getpgrp2'
21519 d_getpgrp='$d_getpgrp'
21520 d_getppid='$d_getppid'
21521 d_getprior='$d_getprior'
21522 d_getprotobyname_r='$d_getprotobyname_r'
21523 d_getprotobynumber_r='$d_getprotobynumber_r'
21524 d_getprotoent_r='$d_getprotoent_r'
21525 d_getprotoprotos='$d_getprotoprotos'
21526 d_getprpwnam='$d_getprpwnam'
21527 d_getpwent='$d_getpwent'
21528 d_getpwent_r='$d_getpwent_r'
21529 d_getpwnam_r='$d_getpwnam_r'
21530 d_getpwuid_r='$d_getpwuid_r'
21531 d_getsbyname='$d_getsbyname'
21532 d_getsbyport='$d_getsbyport'
21533 d_getsent='$d_getsent'
21534 d_getservbyname_r='$d_getservbyname_r'
21535 d_getservbyport_r='$d_getservbyport_r'
21536 d_getservent_r='$d_getservent_r'
21537 d_getservprotos='$d_getservprotos'
21538 d_getspnam='$d_getspnam'
21539 d_getspnam_r='$d_getspnam_r'
21540 d_gettimeod='$d_gettimeod'
21541 d_gmtime_r='$d_gmtime_r'
21542 d_gnulibc='$d_gnulibc'
21543 d_grpasswd='$d_grpasswd'
21544 d_hasmntopt='$d_hasmntopt'
21545 d_htonl='$d_htonl'
21546 d_ilogbl='$d_ilogbl'
21547 d_inc_version_list='$d_inc_version_list'
21548 d_index='$d_index'
21549 d_inetaton='$d_inetaton'
21550 d_int64_t='$d_int64_t'
21551 d_isascii='$d_isascii'
21552 d_isfinite='$d_isfinite'
21553 d_isinf='$d_isinf'
21554 d_isnan='$d_isnan'
21555 d_isnanl='$d_isnanl'
21556 d_killpg='$d_killpg'
21557 d_lchown='$d_lchown'
21558 d_ldbl_dig='$d_ldbl_dig'
21559 d_libm_lib_version='$d_libm_lib_version'
21560 d_link='$d_link'
21561 d_localtime_r='$d_localtime_r'
21562 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21563 d_locconv='$d_locconv'
21564 d_lockf='$d_lockf'
21565 d_longdbl='$d_longdbl'
21566 d_longlong='$d_longlong'
21567 d_lseekproto='$d_lseekproto'
21568 d_lstat='$d_lstat'
21569 d_madvise='$d_madvise'
21570 d_malloc_good_size='$d_malloc_good_size'
21571 d_malloc_size='$d_malloc_size'
21572 d_mblen='$d_mblen'
21573 d_mbstowcs='$d_mbstowcs'
21574 d_mbtowc='$d_mbtowc'
21575 d_memchr='$d_memchr'
21576 d_memcmp='$d_memcmp'
21577 d_memcpy='$d_memcpy'
21578 d_memmove='$d_memmove'
21579 d_memset='$d_memset'
21580 d_mkdir='$d_mkdir'
21581 d_mkdtemp='$d_mkdtemp'
21582 d_mkfifo='$d_mkfifo'
21583 d_mkstemp='$d_mkstemp'
21584 d_mkstemps='$d_mkstemps'
21585 d_mktime='$d_mktime'
21586 d_mmap='$d_mmap'
21587 d_modfl='$d_modfl'
21588 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21589 d_modflproto='$d_modflproto'
21590 d_mprotect='$d_mprotect'
21591 d_msg='$d_msg'
21592 d_msg_ctrunc='$d_msg_ctrunc'
21593 d_msg_dontroute='$d_msg_dontroute'
21594 d_msg_oob='$d_msg_oob'
21595 d_msg_peek='$d_msg_peek'
21596 d_msg_proxy='$d_msg_proxy'
21597 d_msgctl='$d_msgctl'
21598 d_msgget='$d_msgget'
21599 d_msghdr_s='$d_msghdr_s'
21600 d_msgrcv='$d_msgrcv'
21601 d_msgsnd='$d_msgsnd'
21602 d_msync='$d_msync'
21603 d_munmap='$d_munmap'
21604 d_mymalloc='$d_mymalloc'
21605 d_nice='$d_nice'
21606 d_nl_langinfo='$d_nl_langinfo'
21607 d_nv_preserves_uv='$d_nv_preserves_uv'
21608 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21609 d_off64_t='$d_off64_t'
21610 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21611 d_oldpthreads='$d_oldpthreads'
21612 d_oldsock='$d_oldsock'
21613 d_open3='$d_open3'
21614 d_pathconf='$d_pathconf'
21615 d_pause='$d_pause'
21616 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21617 d_phostname='$d_phostname'
21618 d_pipe='$d_pipe'
21619 d_poll='$d_poll'
21620 d_portable='$d_portable'
21621 d_procselfexe='$d_procselfexe'
21622 d_pthread_atfork='$d_pthread_atfork'
21623 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21624 d_pthread_yield='$d_pthread_yield'
21625 d_pwage='$d_pwage'
21626 d_pwchange='$d_pwchange'
21627 d_pwclass='$d_pwclass'
21628 d_pwcomment='$d_pwcomment'
21629 d_pwexpire='$d_pwexpire'
21630 d_pwgecos='$d_pwgecos'
21631 d_pwpasswd='$d_pwpasswd'
21632 d_pwquota='$d_pwquota'
21633 d_qgcvt='$d_qgcvt'
21634 d_quad='$d_quad'
21635 d_random_r='$d_random_r'
21636 d_readdir64_r='$d_readdir64_r'
21637 d_readdir='$d_readdir'
21638 d_readdir_r='$d_readdir_r'
21639 d_readlink='$d_readlink'
21640 d_readv='$d_readv'
21641 d_recvmsg='$d_recvmsg'
21642 d_rename='$d_rename'
21643 d_rewinddir='$d_rewinddir'
21644 d_rmdir='$d_rmdir'
21645 d_safebcpy='$d_safebcpy'
21646 d_safemcpy='$d_safemcpy'
21647 d_sanemcmp='$d_sanemcmp'
21648 d_sbrkproto='$d_sbrkproto'
21649 d_scalbnl='$d_scalbnl'
21650 d_sched_yield='$d_sched_yield'
21651 d_scm_rights='$d_scm_rights'
21652 d_seekdir='$d_seekdir'
21653 d_select='$d_select'
21654 d_sem='$d_sem'
21655 d_semctl='$d_semctl'
21656 d_semctl_semid_ds='$d_semctl_semid_ds'
21657 d_semctl_semun='$d_semctl_semun'
21658 d_semget='$d_semget'
21659 d_semop='$d_semop'
21660 d_sendmsg='$d_sendmsg'
21661 d_setegid='$d_setegid'
21662 d_seteuid='$d_seteuid'
21663 d_setgrent='$d_setgrent'
21664 d_setgrent_r='$d_setgrent_r'
21665 d_setgrps='$d_setgrps'
21666 d_sethent='$d_sethent'
21667 d_sethostent_r='$d_sethostent_r'
21668 d_setitimer='$d_setitimer'
21669 d_setlinebuf='$d_setlinebuf'
21670 d_setlocale='$d_setlocale'
21671 d_setlocale_r='$d_setlocale_r'
21672 d_setnent='$d_setnent'
21673 d_setnetent_r='$d_setnetent_r'
21674 d_setpent='$d_setpent'
21675 d_setpgid='$d_setpgid'
21676 d_setpgrp2='$d_setpgrp2'
21677 d_setpgrp='$d_setpgrp'
21678 d_setprior='$d_setprior'
21679 d_setproctitle='$d_setproctitle'
21680 d_setprotoent_r='$d_setprotoent_r'
21681 d_setpwent='$d_setpwent'
21682 d_setpwent_r='$d_setpwent_r'
21683 d_setregid='$d_setregid'
21684 d_setresgid='$d_setresgid'
21685 d_setresuid='$d_setresuid'
21686 d_setreuid='$d_setreuid'
21687 d_setrgid='$d_setrgid'
21688 d_setruid='$d_setruid'
21689 d_setsent='$d_setsent'
21690 d_setservent_r='$d_setservent_r'
21691 d_setsid='$d_setsid'
21692 d_setvbuf='$d_setvbuf'
21693 d_sfio='$d_sfio'
21694 d_shm='$d_shm'
21695 d_shmat='$d_shmat'
21696 d_shmatprototype='$d_shmatprototype'
21697 d_shmctl='$d_shmctl'
21698 d_shmdt='$d_shmdt'
21699 d_shmget='$d_shmget'
21700 d_sigaction='$d_sigaction'
21701 d_sigprocmask='$d_sigprocmask'
21702 d_sigsetjmp='$d_sigsetjmp'
21703 d_sitearch='$d_sitearch'
21704 d_snprintf='$d_snprintf'
21705 d_sockatmark='$d_sockatmark'
21706 d_sockatmarkproto='$d_sockatmarkproto'
21707 d_socket='$d_socket'
21708 d_socklen_t='$d_socklen_t'
21709 d_sockpair='$d_sockpair'
21710 d_socks5_init='$d_socks5_init'
21711 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21712 d_sqrtl='$d_sqrtl'
21713 d_srand48_r='$d_srand48_r'
21714 d_srandom_r='$d_srandom_r'
21715 d_sresgproto='$d_sresgproto'
21716 d_sresuproto='$d_sresuproto'
21717 d_statblks='$d_statblks'
21718 d_statfs_f_flags='$d_statfs_f_flags'
21719 d_statfs_s='$d_statfs_s'
21720 d_statvfs='$d_statvfs'
21721 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21722 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21723 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21724 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21725 d_stdio_stream_array='$d_stdio_stream_array'
21726 d_stdiobase='$d_stdiobase'
21727 d_stdstdio='$d_stdstdio'
21728 d_strchr='$d_strchr'
21729 d_strcoll='$d_strcoll'
21730 d_strctcpy='$d_strctcpy'
21731 d_strerrm='$d_strerrm'
21732 d_strerror='$d_strerror'
21733 d_strerror_r='$d_strerror_r'
21734 d_strftime='$d_strftime'
21735 d_strlcat='$d_strlcat'
21736 d_strlcpy='$d_strlcpy'
21737 d_strtod='$d_strtod'
21738 d_strtol='$d_strtol'
21739 d_strtold='$d_strtold'
21740 d_strtoll='$d_strtoll'
21741 d_strtoq='$d_strtoq'
21742 d_strtoul='$d_strtoul'
21743 d_strtoull='$d_strtoull'
21744 d_strtouq='$d_strtouq'
21745 d_strxfrm='$d_strxfrm'
21746 d_suidsafe='$d_suidsafe'
21747 d_symlink='$d_symlink'
21748 d_syscall='$d_syscall'
21749 d_syscallproto='$d_syscallproto'
21750 d_sysconf='$d_sysconf'
21751 d_sysernlst='$d_sysernlst'
21752 d_syserrlst='$d_syserrlst'
21753 d_system='$d_system'
21754 d_tcgetpgrp='$d_tcgetpgrp'
21755 d_tcsetpgrp='$d_tcsetpgrp'
21756 d_telldir='$d_telldir'
21757 d_telldirproto='$d_telldirproto'
21758 d_time='$d_time'
21759 d_times='$d_times'
21760 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21761 d_tm_tm_zone='$d_tm_tm_zone'
21762 d_tmpnam_r='$d_tmpnam_r'
21763 d_truncate='$d_truncate'
21764 d_ttyname_r='$d_ttyname_r'
21765 d_tzname='$d_tzname'
21766 d_u32align='$d_u32align'
21767 d_ualarm='$d_ualarm'
21768 d_umask='$d_umask'
21769 d_uname='$d_uname'
21770 d_union_semun='$d_union_semun'
21771 d_unordered='$d_unordered'
21772 d_unsetenv='$d_unsetenv'
21773 d_usleep='$d_usleep'
21774 d_usleepproto='$d_usleepproto'
21775 d_ustat='$d_ustat'
21776 d_vendorarch='$d_vendorarch'
21777 d_vendorbin='$d_vendorbin'
21778 d_vendorlib='$d_vendorlib'
21779 d_vendorscript='$d_vendorscript'
21780 d_vfork='$d_vfork'
21781 d_void_closedir='$d_void_closedir'
21782 d_voidsig='$d_voidsig'
21783 d_voidtty='$d_voidtty'
21784 d_volatile='$d_volatile'
21785 d_vprintf='$d_vprintf'
21786 d_vsnprintf='$d_vsnprintf'
21787 d_wait4='$d_wait4'
21788 d_waitpid='$d_waitpid'
21789 d_wcstombs='$d_wcstombs'
21790 d_wctomb='$d_wctomb'
21791 d_writev='$d_writev'
21792 d_xenix='$d_xenix'
21793 date='$date'
21794 db_hashtype='$db_hashtype'
21795 db_prefixtype='$db_prefixtype'
21796 db_version_major='$db_version_major'
21797 db_version_minor='$db_version_minor'
21798 db_version_patch='$db_version_patch'
21799 defvoidused='$defvoidused'
21800 direntrytype='$direntrytype'
21801 dlext='$dlext'
21802 dlsrc='$dlsrc'
21803 doublesize='$doublesize'
21804 drand01='$drand01'
21805 drand48_r_proto='$drand48_r_proto'
21806 dynamic_ext='$dynamic_ext'
21807 eagain='$eagain'
21808 ebcdic='$ebcdic'
21809 echo='$echo'
21810 egrep='$egrep'
21811 emacs='$emacs'
21812 endgrent_r_proto='$endgrent_r_proto'
21813 endhostent_r_proto='$endhostent_r_proto'
21814 endnetent_r_proto='$endnetent_r_proto'
21815 endprotoent_r_proto='$endprotoent_r_proto'
21816 endpwent_r_proto='$endpwent_r_proto'
21817 endservent_r_proto='$endservent_r_proto'
21818 eunicefix='$eunicefix'
21819 exe_ext='$exe_ext'
21820 expr='$expr'
21821 extensions='$extensions'
21822 extras='$extras'
21823 fflushNULL='$fflushNULL'
21824 fflushall='$fflushall'
21825 find='$find'
21826 firstmakefile='$firstmakefile'
21827 flex='$flex'
21828 fpossize='$fpossize'
21829 fpostype='$fpostype'
21830 freetype='$freetype'
21831 from='$from'
21832 full_ar='$full_ar'
21833 full_csh='$full_csh'
21834 full_sed='$full_sed'
21835 gccansipedantic='$gccansipedantic'
21836 gccosandvers='$gccosandvers'
21837 gccversion='$gccversion'
21838 getgrent_r_proto='$getgrent_r_proto'
21839 getgrgid_r_proto='$getgrgid_r_proto'
21840 getgrnam_r_proto='$getgrnam_r_proto'
21841 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21842 gethostbyname_r_proto='$gethostbyname_r_proto'
21843 gethostent_r_proto='$gethostent_r_proto'
21844 getlogin_r_proto='$getlogin_r_proto'
21845 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21846 getnetbyname_r_proto='$getnetbyname_r_proto'
21847 getnetent_r_proto='$getnetent_r_proto'
21848 getprotobyname_r_proto='$getprotobyname_r_proto'
21849 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21850 getprotoent_r_proto='$getprotoent_r_proto'
21851 getpwent_r_proto='$getpwent_r_proto'
21852 getpwnam_r_proto='$getpwnam_r_proto'
21853 getpwuid_r_proto='$getpwuid_r_proto'
21854 getservbyname_r_proto='$getservbyname_r_proto'
21855 getservbyport_r_proto='$getservbyport_r_proto'
21856 getservent_r_proto='$getservent_r_proto'
21857 getspnam_r_proto='$getspnam_r_proto'
21858 gidformat='$gidformat'
21859 gidsign='$gidsign'
21860 gidsize='$gidsize'
21861 gidtype='$gidtype'
21862 glibpth='$glibpth'
21863 gmake='$gmake'
21864 gmtime_r_proto='$gmtime_r_proto'
21865 gnulibc_version='$gnulibc_version'
21866 grep='$grep'
21867 groupcat='$groupcat'
21868 groupstype='$groupstype'
21869 gzip='$gzip'
21870 h_fcntl='$h_fcntl'
21871 h_sysfile='$h_sysfile'
21872 hint='$hint'
21873 hostcat='$hostcat'
21874 html1dir='$html1dir'
21875 html1direxp='$html1direxp'
21876 html3dir='$html3dir'
21877 html3direxp='$html3direxp'
21878 i16size='$i16size'
21879 i16type='$i16type'
21880 i32size='$i32size'
21881 i32type='$i32type'
21882 i64size='$i64size'
21883 i64type='$i64type'
21884 i8size='$i8size'
21885 i8type='$i8type'
21886 i_arpainet='$i_arpainet'
21887 i_bsdioctl='$i_bsdioctl'
21888 i_crypt='$i_crypt'
21889 i_db='$i_db'
21890 i_dbm='$i_dbm'
21891 i_dirent='$i_dirent'
21892 i_dld='$i_dld'
21893 i_dlfcn='$i_dlfcn'
21894 i_fcntl='$i_fcntl'
21895 i_float='$i_float'
21896 i_fp='$i_fp'
21897 i_fp_class='$i_fp_class'
21898 i_gdbm='$i_gdbm'
21899 i_grp='$i_grp'
21900 i_ieeefp='$i_ieeefp'
21901 i_inttypes='$i_inttypes'
21902 i_langinfo='$i_langinfo'
21903 i_libutil='$i_libutil'
21904 i_limits='$i_limits'
21905 i_locale='$i_locale'
21906 i_machcthr='$i_machcthr'
21907 i_malloc='$i_malloc'
21908 i_math='$i_math'
21909 i_memory='$i_memory'
21910 i_mntent='$i_mntent'
21911 i_ndbm='$i_ndbm'
21912 i_netdb='$i_netdb'
21913 i_neterrno='$i_neterrno'
21914 i_netinettcp='$i_netinettcp'
21915 i_niin='$i_niin'
21916 i_poll='$i_poll'
21917 i_prot='$i_prot'
21918 i_pthread='$i_pthread'
21919 i_pwd='$i_pwd'
21920 i_rpcsvcdbm='$i_rpcsvcdbm'
21921 i_sfio='$i_sfio'
21922 i_sgtty='$i_sgtty'
21923 i_shadow='$i_shadow'
21924 i_socks='$i_socks'
21925 i_stdarg='$i_stdarg'
21926 i_stddef='$i_stddef'
21927 i_stdlib='$i_stdlib'
21928 i_string='$i_string'
21929 i_sunmath='$i_sunmath'
21930 i_sysaccess='$i_sysaccess'
21931 i_sysdir='$i_sysdir'
21932 i_sysfile='$i_sysfile'
21933 i_sysfilio='$i_sysfilio'
21934 i_sysin='$i_sysin'
21935 i_sysioctl='$i_sysioctl'
21936 i_syslog='$i_syslog'
21937 i_sysmman='$i_sysmman'
21938 i_sysmode='$i_sysmode'
21939 i_sysmount='$i_sysmount'
21940 i_sysndir='$i_sysndir'
21941 i_sysparam='$i_sysparam'
21942 i_sysresrc='$i_sysresrc'
21943 i_syssecrt='$i_syssecrt'
21944 i_sysselct='$i_sysselct'
21945 i_syssockio='$i_syssockio'
21946 i_sysstat='$i_sysstat'
21947 i_sysstatfs='$i_sysstatfs'
21948 i_sysstatvfs='$i_sysstatvfs'
21949 i_systime='$i_systime'
21950 i_systimek='$i_systimek'
21951 i_systimes='$i_systimes'
21952 i_systypes='$i_systypes'
21953 i_sysuio='$i_sysuio'
21954 i_sysun='$i_sysun'
21955 i_sysutsname='$i_sysutsname'
21956 i_sysvfs='$i_sysvfs'
21957 i_syswait='$i_syswait'
21958 i_termio='$i_termio'
21959 i_termios='$i_termios'
21960 i_time='$i_time'
21961 i_unistd='$i_unistd'
21962 i_ustat='$i_ustat'
21963 i_utime='$i_utime'
21964 i_values='$i_values'
21965 i_varargs='$i_varargs'
21966 i_varhdr='$i_varhdr'
21967 i_vfork='$i_vfork'
21968 ignore_versioned_solibs='$ignore_versioned_solibs'
21969 inc_version_list='$inc_version_list'
21970 inc_version_list_init='$inc_version_list_init'
21971 incpath='$incpath'
21972 inews='$inews'
21973 initialinstalllocation='$initialinstalllocation'
21974 installarchlib='$installarchlib'
21975 installbin='$installbin'
21976 installhtml1dir='$installhtml1dir'
21977 installhtml3dir='$installhtml3dir'
21978 installman1dir='$installman1dir'
21979 installman3dir='$installman3dir'
21980 installprefix='$installprefix'
21981 installprefixexp='$installprefixexp'
21982 installprivlib='$installprivlib'
21983 installscript='$installscript'
21984 installsitearch='$installsitearch'
21985 installsitebin='$installsitebin'
21986 installsitehtml1dir='$installsitehtml1dir'
21987 installsitehtml3dir='$installsitehtml3dir'
21988 installsitelib='$installsitelib'
21989 installsiteman1dir='$installsiteman1dir'
21990 installsiteman3dir='$installsiteman3dir'
21991 installsitescript='$installsitescript'
21992 installstyle='$installstyle'
21993 installusrbinperl='$installusrbinperl'
21994 installvendorarch='$installvendorarch'
21995 installvendorbin='$installvendorbin'
21996 installvendorhtml1dir='$installvendorhtml1dir'
21997 installvendorhtml3dir='$installvendorhtml3dir'
21998 installvendorlib='$installvendorlib'
21999 installvendorman1dir='$installvendorman1dir'
22000 installvendorman3dir='$installvendorman3dir'
22001 installvendorscript='$installvendorscript'
22002 intsize='$intsize'
22003 issymlink='$issymlink'
22004 ivdformat='$ivdformat'
22005 ivsize='$ivsize'
22006 ivtype='$ivtype'
22007 known_extensions='$known_extensions'
22008 ksh='$ksh'
22009 ld='$ld'
22010 lddlflags='$lddlflags'
22011 ldflags='$ldflags'
22012 ldflags_uselargefiles='$ldflags_uselargefiles'
22013 ldlibpthname='$ldlibpthname'
22014 less='$less'
22015 lib_ext='$lib_ext'
22016 libc='$libc'
22017 libperl='$libperl'
22018 libpth='$libpth'
22019 libs='$libs'
22020 libsdirs='$libsdirs'
22021 libsfiles='$libsfiles'
22022 libsfound='$libsfound'
22023 libspath='$libspath'
22024 libswanted='$libswanted'
22025 libswanted_uselargefiles='$libswanted_uselargefiles'
22026 line='$line'
22027 lint='$lint'
22028 lkflags='$lkflags'
22029 ln='$ln'
22030 lns='$lns'
22031 localtime_r_proto='$localtime_r_proto'
22032 locincpth='$locincpth'
22033 loclibpth='$loclibpth'
22034 longdblsize='$longdblsize'
22035 longlongsize='$longlongsize'
22036 longsize='$longsize'
22037 lp='$lp'
22038 lpr='$lpr'
22039 ls='$ls'
22040 lseeksize='$lseeksize'
22041 lseektype='$lseektype'
22042 mad='$mad'
22043 madlyh='$madlyh'
22044 madlyobj='$madlyobj'
22045 madlysrc='$madlysrc'
22046 mail='$mail'
22047 mailx='$mailx'
22048 make='$make'
22049 make_set_make='$make_set_make'
22050 mallocobj='$mallocobj'
22051 mallocsrc='$mallocsrc'
22052 malloctype='$malloctype'
22053 man1dir='$man1dir'
22054 man1direxp='$man1direxp'
22055 man1ext='$man1ext'
22056 man3dir='$man3dir'
22057 man3direxp='$man3direxp'
22058 man3ext='$man3ext'
22059 mips_type='$mips_type'
22060 mistrustnm='$mistrustnm'
22061 mkdir='$mkdir'
22062 mmaptype='$mmaptype'
22063 modetype='$modetype'
22064 more='$more'
22065 multiarch='$multiarch'
22066 mv='$mv'
22067 myarchname='$myarchname'
22068 mydomain='$mydomain'
22069 myhostname='$myhostname'
22070 myuname='$myuname'
22071 n='$n'
22072 need_va_copy='$need_va_copy'
22073 netdb_hlen_type='$netdb_hlen_type'
22074 netdb_host_type='$netdb_host_type'
22075 netdb_name_type='$netdb_name_type'
22076 netdb_net_type='$netdb_net_type'
22077 nm='$nm'
22078 nm_opt='$nm_opt'
22079 nm_so_opt='$nm_so_opt'
22080 nonxs_ext='$nonxs_ext'
22081 nroff='$nroff'
22082 nvEUformat='$nvEUformat'
22083 nvFUformat='$nvFUformat'
22084 nvGUformat='$nvGUformat'
22085 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22086 nveformat='$nveformat'
22087 nvfformat='$nvfformat'
22088 nvgformat='$nvgformat'
22089 nvsize='$nvsize'
22090 nvtype='$nvtype'
22091 o_nonblock='$o_nonblock'
22092 obj_ext='$obj_ext'
22093 old_pthread_create_joinable='$old_pthread_create_joinable'
22094 optimize='$optimize'
22095 orderlib='$orderlib'
22096 osname='$osname'
22097 osvers='$osvers'
22098 otherlibdirs='$otherlibdirs'
22099 package='$package'
22100 pager='$pager'
22101 passcat='$passcat'
22102 patchlevel='$patchlevel'
22103 path_sep='$path_sep'
22104 perl5='$perl5'
22105 perl='$perl'
22106 perl_patchlevel='$perl_patchlevel'
22107 perladmin='$perladmin'
22108 perllibs='$perllibs'
22109 perlpath='$perlpath'
22110 pg='$pg'
22111 phostname='$phostname'
22112 pidtype='$pidtype'
22113 plibpth='$plibpth'
22114 pmake='$pmake'
22115 pr='$pr'
22116 prefix='$prefix'
22117 prefixexp='$prefixexp'
22118 privlib='$privlib'
22119 privlibexp='$privlibexp'
22120 procselfexe='$procselfexe'
22121 prototype='$prototype'
22122 ptrsize='$ptrsize'
22123 quadkind='$quadkind'
22124 quadtype='$quadtype'
22125 randbits='$randbits'
22126 randfunc='$randfunc'
22127 random_r_proto='$random_r_proto'
22128 randseedtype='$randseedtype'
22129 ranlib='$ranlib'
22130 rd_nodata='$rd_nodata'
22131 readdir64_r_proto='$readdir64_r_proto'
22132 readdir_r_proto='$readdir_r_proto'
22133 revision='$revision'
22134 rm='$rm'
22135 rmail='$rmail'
22136 run='$run'
22137 runnm='$runnm'
22138 sPRIEUldbl='$sPRIEUldbl'
22139 sPRIFUldbl='$sPRIFUldbl'
22140 sPRIGUldbl='$sPRIGUldbl'
22141 sPRIXU64='$sPRIXU64'
22142 sPRId64='$sPRId64'
22143 sPRIeldbl='$sPRIeldbl'
22144 sPRIfldbl='$sPRIfldbl'
22145 sPRIgldbl='$sPRIgldbl'
22146 sPRIi64='$sPRIi64'
22147 sPRIo64='$sPRIo64'
22148 sPRIu64='$sPRIu64'
22149 sPRIx64='$sPRIx64'
22150 sSCNfldbl='$sSCNfldbl'
22151 sched_yield='$sched_yield'
22152 scriptdir='$scriptdir'
22153 scriptdirexp='$scriptdirexp'
22154 sed='$sed'
22155 seedfunc='$seedfunc'
22156 selectminbits='$selectminbits'
22157 selecttype='$selecttype'
22158 sendmail='$sendmail'
22159 setgrent_r_proto='$setgrent_r_proto'
22160 sethostent_r_proto='$sethostent_r_proto'
22161 setlocale_r_proto='$setlocale_r_proto'
22162 setnetent_r_proto='$setnetent_r_proto'
22163 setprotoent_r_proto='$setprotoent_r_proto'
22164 setpwent_r_proto='$setpwent_r_proto'
22165 setservent_r_proto='$setservent_r_proto'
22166 sh='$sh'
22167 shar='$shar'
22168 sharpbang='$sharpbang'
22169 shmattype='$shmattype'
22170 shortsize='$shortsize'
22171 shrpenv='$shrpenv'
22172 shsharp='$shsharp'
22173 sig_count='$sig_count'
22174 sig_name='$sig_name'
22175 sig_name_init='$sig_name_init'
22176 sig_num='$sig_num'
22177 sig_num_init='$sig_num_init'
22178 sig_size='$sig_size'
22179 signal_t='$signal_t'
22180 sitearch='$sitearch'
22181 sitearchexp='$sitearchexp'
22182 sitebin='$sitebin'
22183 sitebinexp='$sitebinexp'
22184 sitehtml1dir='$sitehtml1dir'
22185 sitehtml1direxp='$sitehtml1direxp'
22186 sitehtml3dir='$sitehtml3dir'
22187 sitehtml3direxp='$sitehtml3direxp'
22188 sitelib='$sitelib'
22189 sitelib_stem='$sitelib_stem'
22190 sitelibexp='$sitelibexp'
22191 siteman1dir='$siteman1dir'
22192 siteman1direxp='$siteman1direxp'
22193 siteman3dir='$siteman3dir'
22194 siteman3direxp='$siteman3direxp'
22195 siteprefix='$siteprefix'
22196 siteprefixexp='$siteprefixexp'
22197 sitescript='$sitescript'
22198 sitescriptexp='$sitescriptexp'
22199 sizesize='$sizesize'
22200 sizetype='$sizetype'
22201 sleep='$sleep'
22202 smail='$smail'
22203 so='$so'
22204 sockethdr='$sockethdr'
22205 socketlib='$socketlib'
22206 socksizetype='$socksizetype'
22207 sort='$sort'
22208 spackage='$spackage'
22209 spitshell='$spitshell'
22210 srand48_r_proto='$srand48_r_proto'
22211 srandom_r_proto='$srandom_r_proto'
22212 src='$src'
22213 ssizetype='$ssizetype'
22214 startperl='$startperl'
22215 startsh='$startsh'
22216 static_ext='$static_ext'
22217 stdchar='$stdchar'
22218 stdio_base='$stdio_base'
22219 stdio_bufsiz='$stdio_bufsiz'
22220 stdio_cnt='$stdio_cnt'
22221 stdio_filbuf='$stdio_filbuf'
22222 stdio_ptr='$stdio_ptr'
22223 stdio_stream_array='$stdio_stream_array'
22224 strerror_r_proto='$strerror_r_proto'
22225 strings='$strings'
22226 submit='$submit'
22227 subversion='$subversion'
22228 sysman='$sysman'
22229 tail='$tail'
22230 tar='$tar'
22231 targetarch='$targetarch'
22232 tbl='$tbl'
22233 tee='$tee'
22234 test='$test'
22235 timeincl='$timeincl'
22236 timetype='$timetype'
22237 tmpnam_r_proto='$tmpnam_r_proto'
22238 to='$to'
22239 touch='$touch'
22240 tr='$tr'
22241 trnl='$trnl'
22242 troff='$troff'
22243 ttyname_r_proto='$ttyname_r_proto'
22244 u16size='$u16size'
22245 u16type='$u16type'
22246 u32size='$u32size'
22247 u32type='$u32type'
22248 u64size='$u64size'
22249 u64type='$u64type'
22250 u8size='$u8size'
22251 u8type='$u8type'
22252 uidformat='$uidformat'
22253 uidsign='$uidsign'
22254 uidsize='$uidsize'
22255 uidtype='$uidtype'
22256 uname='$uname'
22257 uniq='$uniq'
22258 uquadtype='$uquadtype'
22259 use5005threads='$use5005threads'
22260 use64bitall='$use64bitall'
22261 use64bitint='$use64bitint'
22262 usecrosscompile='$usecrosscompile'
22263 usedl='$usedl'
22264 usefaststdio='$usefaststdio'
22265 useithreads='$useithreads'
22266 uselargefiles='$uselargefiles'
22267 uselongdouble='$uselongdouble'
22268 usemallocwrap='$usemallocwrap'
22269 usemorebits='$usemorebits'
22270 usemultiplicity='$usemultiplicity'
22271 usemymalloc='$usemymalloc'
22272 usenm='$usenm'
22273 useopcode='$useopcode'
22274 useperlio='$useperlio'
22275 useposix='$useposix'
22276 usereentrant='$usereentrant'
22277 userelocatableinc='$userelocatableinc'
22278 usesfio='$usesfio'
22279 useshrplib='$useshrplib'
22280 usesitecustomize='$usesitecustomize'
22281 usesocks='$usesocks'
22282 usethreads='$usethreads'
22283 usevendorprefix='$usevendorprefix'
22284 usevfork='$usevfork'
22285 usrinc='$usrinc'
22286 uuname='$uuname'
22287 uvXUformat='$uvXUformat'
22288 uvoformat='$uvoformat'
22289 uvsize='$uvsize'
22290 uvtype='$uvtype'
22291 uvuformat='$uvuformat'
22292 uvxformat='$uvxformat'
22293 vendorarch='$vendorarch'
22294 vendorarchexp='$vendorarchexp'
22295 vendorbin='$vendorbin'
22296 vendorbinexp='$vendorbinexp'
22297 vendorhtml1dir='$vendorhtml1dir'
22298 vendorhtml1direxp='$vendorhtml1direxp'
22299 vendorhtml3dir='$vendorhtml3dir'
22300 vendorhtml3direxp='$vendorhtml3direxp'
22301 vendorlib='$vendorlib'
22302 vendorlib_stem='$vendorlib_stem'
22303 vendorlibexp='$vendorlibexp'
22304 vendorman1dir='$vendorman1dir'
22305 vendorman1direxp='$vendorman1direxp'
22306 vendorman3dir='$vendorman3dir'
22307 vendorman3direxp='$vendorman3direxp'
22308 vendorprefix='$vendorprefix'
22309 vendorprefixexp='$vendorprefixexp'
22310 vendorscript='$vendorscript'
22311 vendorscriptexp='$vendorscriptexp'
22312 version='$version'
22313 version_patchlevel_string='$version_patchlevel_string'
22314 versiononly='$versiononly'
22315 vi='$vi'
22316 voidflags='$voidflags'
22317 xlibpth='$xlibpth'
22318 yacc='$yacc'
22319 yaccflags='$yaccflags'
22320 zcat='$zcat'
22321 zip='$zip'
22322 EOT
22323
22324 : Add in command line options if available
22325 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22326
22327 : add special variables
22328 $test -f $src/patchlevel.h && \
22329 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22330 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22331 echo "PERL_CONFIG_SH=true" >>config.sh
22332
22333 : propagate old symbols
22334 if $test -f UU/config.sh; then
22335         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22336         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22337         $sort | $uniq -u >UU/oldsyms
22338         set X `cat UU/oldsyms`
22339         shift
22340         case $# in
22341         0) ;;
22342         *)
22343                 cat <<EOM
22344 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22345 EOM
22346                 echo "# Variables propagated from previous config.sh file." >>config.sh
22347                 for sym in `cat UU/oldsyms`; do
22348                         echo "    Propagating $hint variable "'$'"$sym..."
22349                         eval 'tmp="$'"${sym}"'"'
22350                         echo "$tmp" | \
22351                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22352                 done
22353                 ;;
22354         esac
22355 fi
22356
22357 : Finish up by extracting the .SH files
22358 case "$alldone" in
22359 exit)
22360         $rm -rf UU
22361         echo "Extraction done."
22362         exit 0
22363         ;;
22364 cont)
22365         ;;
22366 '')
22367         dflt=''
22368         nostick=true
22369         $cat <<EOM
22370
22371 If you'd like to make any changes to the config.sh file before I begin
22372 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22373
22374 EOM
22375         rp="Press return or use a shell escape to edit config.sh:"
22376         . UU/myread
22377         nostick=''
22378         case "$ans" in
22379         '') ;;
22380         *) : in case they cannot read
22381                 sh 1>&4 -c "$ans";;
22382         esac
22383         ;;
22384 esac
22385
22386 : if this fails, just run all the .SH files by hand
22387 . ./config.sh
22388
22389 echo " "
22390 exec 1>&4
22391 pwd=`pwd`
22392 . ./UU/extract
22393 cd "$pwd"
22394
22395 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22396         dflt=y
22397         case "$silent" in
22398         true) ;;
22399         *)
22400                 $cat <<EOM
22401
22402 Now you need to generate make dependencies by running "$make depend".
22403 You might prefer to run it in background: "$make depend > makedepend.out &"
22404 It can take a while, so you might not want to run it right now.
22405
22406 EOM
22407                 ;;
22408         esac
22409         rp="Run $make depend now?"
22410         . UU/myread
22411         case "$ans" in
22412         y*)
22413                 $make depend && echo "Now you must run '$make'."
22414                 ;;
22415         *)
22416                 echo "You must run '$make depend' then '$make'."
22417                 ;;
22418         esac
22419 elif test -f [Mm]akefile; then
22420         echo " "
22421         echo "Now you must run a $make."
22422 else
22423         echo "Configure done."
22424 fi
22425
22426 if $test -f Policy.sh; then
22427     $cat <<EOM
22428
22429 If you compile $package on a different machine or from a different object
22430 directory, copy the Policy.sh file from this object directory to the
22431 new one before you run Configure -- this will help you with most of
22432 the policy defaults.
22433
22434 EOM
22435 fi
22436 if $test -f config.msg; then
22437     echo "Hmm.  I also noted the following information while running:"
22438     echo " "
22439     $cat config.msg >&4
22440     $rm -f config.msg
22441 fi
22442 $rm -f kit*isdone ark*isdone
22443 $rm -rf UU
22444
22445 : End of Configure
22446