Upgrade to CPAN-1.88_53.
[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 Wed Sep 13 08:48:56 CEST 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_c99_variadic_macros=''
363 d_casti32=''
364 castflags=''
365 d_castneg=''
366 d_chown=''
367 d_chroot=''
368 d_chsize=''
369 d_class=''
370 d_clearenv=''
371 d_closedir=''
372 d_void_closedir=''
373 d_cmsghdr_s=''
374 d_const=''
375 d_copysignl=''
376 d_cplusplus=''
377 cryptlib=''
378 d_crypt=''
379 crypt_r_proto=''
380 d_crypt_r=''
381 d_csh=''
382 full_csh=''
383 ctermid_r_proto=''
384 d_ctermid_r=''
385 ctime_r_proto=''
386 d_ctime_r=''
387 d_cuserid=''
388 d_dbl_dig=''
389 d_dbminitproto=''
390 d_difftime=''
391 d_dirfd=''
392 d_dlerror=''
393 d_dlopen=''
394 d_dlsymun=''
395 d_dosuid=''
396 d_suidsafe=''
397 d_drand48_r=''
398 drand48_r_proto=''
399 d_drand48proto=''
400 d_dup2=''
401 d_eaccess=''
402 d_endgrent=''
403 d_endgrent_r=''
404 endgrent_r_proto=''
405 d_endhent=''
406 d_endhostent_r=''
407 endhostent_r_proto=''
408 d_endnent=''
409 d_endnetent_r=''
410 endnetent_r_proto=''
411 d_endpent=''
412 d_endprotoent_r=''
413 endprotoent_r_proto=''
414 d_endpwent=''
415 d_endpwent_r=''
416 endpwent_r_proto=''
417 d_endsent=''
418 d_endservent_r=''
419 endservent_r_proto=''
420 d_faststdio=''
421 d_fchdir=''
422 d_fchmod=''
423 d_fchown=''
424 d_fcntl=''
425 d_fcntl_can_lock=''
426 d_fd_macros=''
427 d_fd_set=''
428 d_fds_bits=''
429 d_fgetpos=''
430 d_finite=''
431 d_finitel=''
432 d_flexfnam=''
433 d_flock=''
434 d_flockproto=''
435 d_fork=''
436 d_fp_class=''
437 d_fpclass=''
438 d_fpclassify=''
439 d_fpclassl=''
440 d_fpos64_t=''
441 d_frexpl=''
442 d_fs_data_s=''
443 d_fseeko=''
444 d_fsetpos=''
445 d_fstatfs=''
446 d_fsync=''
447 d_ftello=''
448 d_ftime=''
449 d_gettimeod=''
450 d_futimes=''
451 d_Gconvert=''
452 d_getcwd=''
453 d_getespwnam=''
454 d_getfsstat=''
455 d_getgrent=''
456 d_getgrent_r=''
457 getgrent_r_proto=''
458 d_getgrgid_r=''
459 getgrgid_r_proto=''
460 d_getgrnam_r=''
461 getgrnam_r_proto=''
462 d_getgrps=''
463 d_gethbyaddr=''
464 d_gethbyname=''
465 d_gethent=''
466 aphostname=''
467 d_gethname=''
468 d_phostname=''
469 d_uname=''
470 d_gethostbyaddr_r=''
471 gethostbyaddr_r_proto=''
472 d_gethostbyname_r=''
473 gethostbyname_r_proto=''
474 d_gethostent_r=''
475 gethostent_r_proto=''
476 d_gethostprotos=''
477 d_getitimer=''
478 d_getlogin=''
479 d_getlogin_r=''
480 getlogin_r_proto=''
481 d_getmnt=''
482 d_getmntent=''
483 d_getnbyaddr=''
484 d_getnbyname=''
485 d_getnent=''
486 d_getnetbyaddr_r=''
487 getnetbyaddr_r_proto=''
488 d_getnetbyname_r=''
489 getnetbyname_r_proto=''
490 d_getnetent_r=''
491 getnetent_r_proto=''
492 d_getnetprotos=''
493 d_getpagsz=''
494 d_getpent=''
495 d_getpgid=''
496 d_getpgrp2=''
497 d_bsdgetpgrp=''
498 d_getpgrp=''
499 d_getppid=''
500 d_getprior=''
501 d_getpbyname=''
502 d_getpbynumber=''
503 d_getprotobyname_r=''
504 getprotobyname_r_proto=''
505 d_getprotobynumber_r=''
506 getprotobynumber_r_proto=''
507 d_getprotoent_r=''
508 getprotoent_r_proto=''
509 d_getprotoprotos=''
510 d_getprpwnam=''
511 d_getpwent=''
512 d_getpwent_r=''
513 getpwent_r_proto=''
514 d_getpwnam_r=''
515 getpwnam_r_proto=''
516 d_getpwuid_r=''
517 getpwuid_r_proto=''
518 d_getsent=''
519 d_getservbyname_r=''
520 getservbyname_r_proto=''
521 d_getservbyport_r=''
522 getservbyport_r_proto=''
523 d_getservent_r=''
524 getservent_r_proto=''
525 d_getservprotos=''
526 d_getspnam=''
527 d_getspnam_r=''
528 getspnam_r_proto=''
529 d_getsbyname=''
530 d_getsbyport=''
531 d_gmtime_r=''
532 gmtime_r_proto=''
533 d_gnulibc=''
534 gnulibc_version=''
535 d_hasmntopt=''
536 d_htonl=''
537 d_ilogbl=''
538 d_inetaton=''
539 d_int64_t=''
540 d_isascii=''
541 d_isfinite=''
542 d_isinf=''
543 d_isnan=''
544 d_isnanl=''
545 d_killpg=''
546 d_lchown=''
547 d_ldbl_dig=''
548 d_libm_lib_version=''
549 d_link=''
550 d_localtime_r=''
551 localtime_r_proto=''
552 d_locconv=''
553 d_lockf=''
554 d_longdbl=''
555 longdblsize=''
556 d_longlong=''
557 longlongsize=''
558 d_lseekproto=''
559 d_lstat=''
560 d_madvise=''
561 d_malloc_good_size=''
562 d_malloc_size=''
563 d_mblen=''
564 d_mbstowcs=''
565 d_mbtowc=''
566 d_memchr=''
567 d_memcmp=''
568 d_memcpy=''
569 d_memmove=''
570 d_memset=''
571 d_mkdir=''
572 d_mkdtemp=''
573 d_mkfifo=''
574 d_mkstemp=''
575 d_mkstemps=''
576 d_mktime=''
577 d_mmap=''
578 mmaptype=''
579 d_modfl=''
580 d_modfl_pow32_bug=''
581 d_modflproto=''
582 d_mprotect=''
583 d_msg=''
584 d_msgctl=''
585 d_msgget=''
586 d_msghdr_s=''
587 d_msgrcv=''
588 d_msgsnd=''
589 d_msync=''
590 d_munmap=''
591 d_nice=''
592 d_nl_langinfo=''
593 d_off64_t=''
594 d_open3=''
595 d_fpathconf=''
596 d_pathconf=''
597 d_pause=''
598 d_pipe=''
599 d_poll=''
600 d_portable=''
601 d_procselfexe=''
602 procselfexe=''
603 d_old_pthread_create_joinable=''
604 old_pthread_create_joinable=''
605 d_pthread_atfork=''
606 d_pthread_attr_setscope=''
607 d_pthread_yield=''
608 d_sched_yield=''
609 sched_yield=''
610 d_qgcvt=''
611 d_random_r=''
612 random_r_proto=''
613 d_readdir64_r=''
614 readdir64_r_proto=''
615 d_readdir=''
616 d_rewinddir=''
617 d_seekdir=''
618 d_telldir=''
619 d_readdir_r=''
620 readdir_r_proto=''
621 d_readlink=''
622 d_readv=''
623 d_recvmsg=''
624 d_rename=''
625 d_rmdir=''
626 d_safebcpy=''
627 d_safemcpy=''
628 d_sanemcmp=''
629 d_sbrkproto=''
630 d_scalbnl=''
631 d_select=''
632 d_sem=''
633 d_semctl=''
634 d_semget=''
635 d_semop=''
636 d_sendmsg=''
637 d_setegid=''
638 d_seteuid=''
639 d_setgrent=''
640 d_setgrent_r=''
641 setgrent_r_proto=''
642 d_setgrps=''
643 d_sethent=''
644 d_sethostent_r=''
645 sethostent_r_proto=''
646 d_setitimer=''
647 d_setlinebuf=''
648 d_setlocale=''
649 d_setlocale_r=''
650 setlocale_r_proto=''
651 d_setnent=''
652 d_setnetent_r=''
653 setnetent_r_proto=''
654 d_setpent=''
655 d_setpgid=''
656 d_setpgrp2=''
657 d_bsdsetpgrp=''
658 d_setpgrp=''
659 d_setprior=''
660 d_setproctitle=''
661 d_setprotoent_r=''
662 setprotoent_r_proto=''
663 d_setpwent=''
664 d_setpwent_r=''
665 setpwent_r_proto=''
666 d_setregid=''
667 d_setresgid=''
668 d_setresuid=''
669 d_setreuid=''
670 d_setrgid=''
671 d_setruid=''
672 d_setsent=''
673 d_setservent_r=''
674 setservent_r_proto=''
675 d_setsid=''
676 d_setvbuf=''
677 d_sfio=''
678 usesfio=''
679 d_shm=''
680 d_shmat=''
681 d_shmatprototype=''
682 shmattype=''
683 d_shmctl=''
684 d_shmdt=''
685 d_shmget=''
686 d_sigaction=''
687 d_sigprocmask=''
688 d_sigsetjmp=''
689 usesitecustomize=''
690 d_snprintf=''
691 d_vsnprintf=''
692 d_sockatmark=''
693 d_sockatmarkproto=''
694 d_msg_ctrunc=''
695 d_msg_dontroute=''
696 d_msg_oob=''
697 d_msg_peek=''
698 d_msg_proxy=''
699 d_oldsock=''
700 d_scm_rights=''
701 d_socket=''
702 d_sockpair=''
703 sockethdr=''
704 socketlib=''
705 d_socklen_t=''
706 d_socks5_init=''
707 d_sprintf_returns_strlen=''
708 d_sqrtl=''
709 d_srand48_r=''
710 srand48_r_proto=''
711 d_srandom_r=''
712 srandom_r_proto=''
713 d_sresgproto=''
714 d_sresuproto=''
715 d_statblks=''
716 d_statfs_f_flags=''
717 d_statfs_s=''
718 d_fstatvfs=''
719 d_statvfs=''
720 d_stdio_cnt_lval=''
721 d_stdio_ptr_lval=''
722 d_stdio_ptr_lval_nochange_cnt=''
723 d_stdio_ptr_lval_sets_cnt=''
724 d_stdiobase=''
725 d_stdstdio=''
726 stdio_base=''
727 stdio_bufsiz=''
728 stdio_cnt=''
729 stdio_filbuf=''
730 stdio_ptr=''
731 d_index=''
732 d_strchr=''
733 d_strcoll=''
734 d_strctcpy=''
735 d_strerrm=''
736 d_strerror=''
737 d_sysernlst=''
738 d_syserrlst=''
739 d_strerror_r=''
740 strerror_r_proto=''
741 d_strftime=''
742 d_strlcat=''
743 d_strlcpy=''
744 d_strtod=''
745 d_strtol=''
746 d_strtold=''
747 d_strtoll=''
748 d_strtoq=''
749 d_strtoul=''
750 d_strtoull=''
751 d_strtouq=''
752 d_strxfrm=''
753 d_symlink=''
754 d_syscall=''
755 d_syscallproto=''
756 d_sysconf=''
757 d_system=''
758 d_tcgetpgrp=''
759 d_tcsetpgrp=''
760 d_telldirproto=''
761 d_time=''
762 timetype=''
763 clocktype=''
764 d_times=''
765 d_tmpnam_r=''
766 tmpnam_r_proto=''
767 d_truncate=''
768 d_ttyname_r=''
769 ttyname_r_proto=''
770 d_tzname=''
771 d_u32align=''
772 d_ualarm=''
773 d_umask=''
774 d_semctl_semid_ds=''
775 d_semctl_semun=''
776 d_union_semun=''
777 d_unordered=''
778 d_unsetenv=''
779 d_usleep=''
780 d_usleepproto=''
781 d_ustat=''
782 d_vfork=''
783 usevfork=''
784 d_voidsig=''
785 signal_t=''
786 d_volatile=''
787 d_charvspr=''
788 d_vprintf=''
789 d_wait4=''
790 d_waitpid=''
791 d_wcstombs=''
792 d_wctomb=''
793 d_writev=''
794 dlext=''
795 cccdlflags=''
796 ccdlflags=''
797 dlsrc=''
798 ld=''
799 lddlflags=''
800 usedl=''
801 doublesize=''
802 ebcdic=''
803 fflushNULL=''
804 fflushall=''
805 fpossize=''
806 fpostype=''
807 gccansipedantic=''
808 gccosandvers=''
809 gccversion=''
810 gidformat=''
811 gidsign=''
812 gidsize=''
813 gidtype=''
814 groupstype=''
815 h_fcntl=''
816 h_sysfile=''
817 html1dir=''
818 html1direxp=''
819 installhtml1dir=''
820 html3dir=''
821 html3direxp=''
822 installhtml3dir=''
823 i_arpainet=''
824 i_crypt=''
825 db_hashtype=''
826 db_prefixtype=''
827 db_version_major=''
828 db_version_minor=''
829 db_version_patch=''
830 i_db=''
831 i_dbm=''
832 i_rpcsvcdbm=''
833 d_dirnamlen=''
834 direntrytype=''
835 i_dirent=''
836 i_dld=''
837 i_dlfcn=''
838 i_fcntl=''
839 i_float=''
840 i_fp=''
841 i_fp_class=''
842 i_gdbm=''
843 d_grpasswd=''
844 i_grp=''
845 i_ieeefp=''
846 i_inttypes=''
847 i_langinfo=''
848 i_libutil=''
849 i_limits=''
850 i_locale=''
851 i_machcthr=''
852 i_malloc=''
853 i_math=''
854 i_memory=''
855 i_mntent=''
856 i_ndbm=''
857 i_netdb=''
858 i_neterrno=''
859 i_netinettcp=''
860 i_niin=''
861 i_sysin=''
862 i_poll=''
863 i_prot=''
864 i_pthread=''
865 d_pwage=''
866 d_pwchange=''
867 d_pwclass=''
868 d_pwcomment=''
869 d_pwexpire=''
870 d_pwgecos=''
871 d_pwpasswd=''
872 d_pwquota=''
873 i_pwd=''
874 i_sfio=''
875 i_shadow=''
876 i_socks=''
877 i_stddef=''
878 i_stdlib=''
879 i_string=''
880 strings=''
881 i_sunmath=''
882 i_sysaccess=''
883 i_sysdir=''
884 i_sysfile=''
885 d_voidtty=''
886 i_bsdioctl=''
887 i_sysfilio=''
888 i_sysioctl=''
889 i_syssockio=''
890 i_syslog=''
891 i_sysmman=''
892 i_sysmode=''
893 i_sysmount=''
894 i_sysndir=''
895 i_sysparam=''
896 i_sysresrc=''
897 i_syssecrt=''
898 i_sysselct=''
899 i_sysstat=''
900 i_sysstatfs=''
901 i_sysstatvfs=''
902 i_systimes=''
903 i_systypes=''
904 i_sysuio=''
905 i_sysun=''
906 i_sysutsname=''
907 i_sysvfs=''
908 i_syswait=''
909 i_sgtty=''
910 i_termio=''
911 i_termios=''
912 d_tm_tm_gmtoff=''
913 d_tm_tm_zone=''
914 i_systime=''
915 i_systimek=''
916 i_time=''
917 timeincl=''
918 i_unistd=''
919 i_ustat=''
920 i_utime=''
921 i_values=''
922 i_stdarg=''
923 i_varargs=''
924 i_varhdr=''
925 i_vfork=''
926 d_inc_version_list=''
927 inc_version_list=''
928 inc_version_list_init=''
929 installprefix=''
930 installprefixexp=''
931 installstyle=''
932 installusrbinperl=''
933 intsize=''
934 longsize=''
935 shortsize=''
936 issymlink=''
937 libc=''
938 ldlibpthname=''
939 libperl=''
940 shrpenv=''
941 useshrplib=''
942 glibpth=''
943 libpth=''
944 loclibpth=''
945 plibpth=''
946 xlibpth=''
947 ignore_versioned_solibs=''
948 libs=''
949 libsdirs=''
950 libsfiles=''
951 libsfound=''
952 libspath=''
953 lns=''
954 d_PRIEUldbl=''
955 d_PRIFUldbl=''
956 d_PRIGUldbl=''
957 d_PRIeldbl=''
958 d_PRIfldbl=''
959 d_PRIgldbl=''
960 d_SCNfldbl=''
961 sPRIEUldbl=''
962 sPRIFUldbl=''
963 sPRIGUldbl=''
964 sPRIeldbl=''
965 sPRIfldbl=''
966 sPRIgldbl=''
967 sSCNfldbl=''
968 lseeksize=''
969 lseektype=''
970 mad=''
971 madlyh=''
972 madlyobj=''
973 madlysrc=''
974 make_set_make=''
975 d_mymalloc=''
976 freetype=''
977 mallocobj=''
978 mallocsrc=''
979 malloctype=''
980 usemallocwrap=''
981 usemymalloc=''
982 installman1dir=''
983 man1dir=''
984 man1direxp=''
985 man1ext=''
986 installman3dir=''
987 man3dir=''
988 man3direxp=''
989 man3ext=''
990 modetype=''
991 multiarch=''
992 mydomain=''
993 myhostname=''
994 phostname=''
995 c=''
996 n=''
997 d_eofnblk=''
998 eagain=''
999 o_nonblock=''
1000 rd_nodata=''
1001 need_va_copy=''
1002 netdb_hlen_type=''
1003 netdb_host_type=''
1004 netdb_name_type=''
1005 netdb_net_type=''
1006 groupcat=''
1007 hostcat=''
1008 passcat=''
1009 orderlib=''
1010 ranlib=''
1011 d_perl_otherlibdirs=''
1012 otherlibdirs=''
1013 package=''
1014 spackage=''
1015 pager=''
1016 api_revision=''
1017 api_subversion=''
1018 api_version=''
1019 api_versionstring=''
1020 patchlevel=''
1021 perl_patchlevel=''
1022 revision=''
1023 subversion=''
1024 version=''
1025 version_patchlevel_string=''
1026 perl5=''
1027 perladmin=''
1028 perlpath=''
1029 d_nv_preserves_uv=''
1030 d_nv_zero_is_allbits_zero=''
1031 i16size=''
1032 i16type=''
1033 i32size=''
1034 i32type=''
1035 i64size=''
1036 i64type=''
1037 i8size=''
1038 i8type=''
1039 ivsize=''
1040 ivtype=''
1041 nv_preserves_uv_bits=''
1042 nvsize=''
1043 nvtype=''
1044 u16size=''
1045 u16type=''
1046 u32size=''
1047 u32type=''
1048 u64size=''
1049 u64type=''
1050 u8size=''
1051 u8type=''
1052 uvsize=''
1053 uvtype=''
1054 ivdformat=''
1055 nvEUformat=''
1056 nvFUformat=''
1057 nvGUformat=''
1058 nveformat=''
1059 nvfformat=''
1060 nvgformat=''
1061 uvXUformat=''
1062 uvoformat=''
1063 uvuformat=''
1064 uvxformat=''
1065 pidtype=''
1066 prefix=''
1067 prefixexp=''
1068 installprivlib=''
1069 privlib=''
1070 privlibexp=''
1071 prototype=''
1072 ptrsize=''
1073 d_PRIXU64=''
1074 d_PRId64=''
1075 d_PRIi64=''
1076 d_PRIo64=''
1077 d_PRIu64=''
1078 d_PRIx64=''
1079 sPRIXU64=''
1080 sPRId64=''
1081 sPRIi64=''
1082 sPRIo64=''
1083 sPRIu64=''
1084 sPRIx64=''
1085 d_quad=''
1086 quadkind=''
1087 quadtype=''
1088 uquadtype=''
1089 drand01=''
1090 randbits=''
1091 randfunc=''
1092 randseedtype=''
1093 seedfunc=''
1094 installscript=''
1095 scriptdir=''
1096 scriptdirexp=''
1097 selectminbits=''
1098 selecttype=''
1099 sh=''
1100 sig_count=''
1101 sig_name=''
1102 sig_name_init=''
1103 sig_num=''
1104 sig_num_init=''
1105 sig_size=''
1106 d_sitearch=''
1107 installsitearch=''
1108 sitearch=''
1109 sitearchexp=''
1110 installsitebin=''
1111 sitebin=''
1112 sitebinexp=''
1113 installsitehtml1dir=''
1114 sitehtml1dir=''
1115 sitehtml1direxp=''
1116 installsitehtml3dir=''
1117 sitehtml3dir=''
1118 sitehtml3direxp=''
1119 installsitelib=''
1120 sitelib=''
1121 sitelib_stem=''
1122 sitelibexp=''
1123 installsiteman1dir=''
1124 siteman1dir=''
1125 siteman1direxp=''
1126 installsiteman3dir=''
1127 siteman3dir=''
1128 siteman3direxp=''
1129 siteprefix=''
1130 siteprefixexp=''
1131 installsitescript=''
1132 sitescript=''
1133 sitescriptexp=''
1134 sizesize=''
1135 sizetype=''
1136 so=''
1137 socksizetype=''
1138 sharpbang=''
1139 shsharp=''
1140 spitshell=''
1141 src=''
1142 ssizetype=''
1143 startperl=''
1144 startsh=''
1145 stdchar=''
1146 d_stdio_stream_array=''
1147 stdio_stream_array=''
1148 sysman=''
1149 trnl=''
1150 uidformat=''
1151 uidsign=''
1152 uidsize=''
1153 uidtype=''
1154 archname64=''
1155 use64bitall=''
1156 use64bitint=''
1157 usefaststdio=''
1158 ccflags_uselargefiles=''
1159 ldflags_uselargefiles=''
1160 libswanted_uselargefiles=''
1161 uselargefiles=''
1162 uselongdouble=''
1163 usemorebits=''
1164 usemultiplicity=''
1165 nm_opt=''
1166 nm_so_opt=''
1167 runnm=''
1168 usenm=''
1169 useperlio=''
1170 usesocks=''
1171 d_oldpthreads=''
1172 use5005threads=''
1173 useithreads=''
1174 usereentrant=''
1175 usethreads=''
1176 incpath=''
1177 mips_type=''
1178 usrinc=''
1179 d_vendorarch=''
1180 installvendorarch=''
1181 vendorarch=''
1182 vendorarchexp=''
1183 d_vendorbin=''
1184 installvendorbin=''
1185 vendorbin=''
1186 vendorbinexp=''
1187 installvendorhtml1dir=''
1188 vendorhtml1dir=''
1189 vendorhtml1direxp=''
1190 installvendorhtml3dir=''
1191 vendorhtml3dir=''
1192 vendorhtml3direxp=''
1193 d_vendorlib=''
1194 installvendorlib=''
1195 vendorlib=''
1196 vendorlib_stem=''
1197 vendorlibexp=''
1198 installvendorman1dir=''
1199 vendorman1dir=''
1200 vendorman1direxp=''
1201 installvendorman3dir=''
1202 vendorman3dir=''
1203 vendorman3direxp=''
1204 usevendorprefix=''
1205 vendorprefix=''
1206 vendorprefixexp=''
1207 d_vendorscript=''
1208 installvendorscript=''
1209 vendorscript=''
1210 vendorscriptexp=''
1211 versiononly=''
1212 defvoidused=''
1213 voidflags=''
1214 yacc=''
1215 yaccflags=''
1216 CONFIG=''
1217
1218 define='define'
1219 undef='undef'
1220 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1221 rmlist=''
1222
1223 : We must find out about Eunice early
1224 eunicefix=':'
1225 if test -f /etc/unixtovms; then
1226         eunicefix=/etc/unixtovms
1227 fi
1228 if test -f /etc/unixtovms.exe; then
1229         eunicefix=/etc/unixtovms.exe
1230 fi
1231
1232 : Set executable suffix now -- needed before hints available
1233 if test -f "/libs/version.library"; then
1234 : Amiga OS
1235     _exe=""
1236 elif test -f "/system/gnu_library/bin/ar.pm"; then
1237 : Stratus VOS
1238     _exe=".pm"
1239 elif test -n "$DJGPP"; then
1240 : DOS DJGPP
1241     _exe=".exe"
1242 elif test -d c:/. -o -n "$is_os2" ; then
1243 : OS/2 or cygwin
1244     _exe=".exe"
1245 fi
1246
1247 i_whoami=''
1248 ccname=''
1249 ccversion=''
1250 perllibs=''
1251 : set useposix=false in your hint file to disable the POSIX extension.
1252 useposix=true
1253 : set useopcode=false in your hint file to disable the Opcode extension.
1254 useopcode=true
1255 : Trailing extension.  Override this in a hint file, if needed.
1256 : Extra object files, if any, needed on this platform.
1257 archobjs=''
1258 archname=''
1259 : Possible local include directories to search.
1260 : Set locincpth to "" in a hint file to defeat local include searches.
1261 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1262 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1263 :
1264 : no include file wanted by default
1265 inclwanted=''
1266
1267 : Enable -DEBUGGING and -DDEBUGGING from the command line
1268 EBUGGING=''
1269 DEBUGGING=old
1270
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284
1285 : Private path used by Configure to find libraries.  Its value
1286 : is prepended to libpth. This variable takes care of special
1287 : machines, like the mips.  Usually, it should be empty.
1288 plibpth=''
1289
1290 : default library list
1291 libswanted=''
1292 : some systems want to use only the non-versioned libso:s
1293 ignore_versioned_solibs=''
1294 siteman1dir=''
1295 siteman3dir=''
1296 sitescript=''
1297 archname64=''
1298 ccflags_uselargefiles=''
1299 ldflags_uselargefiles=''
1300 libswanted_uselargefiles=''
1301 : set usemultiplicity on the Configure command line to enable multiplicity.
1302 : set usesocks on the Configure command line to enable socks.
1303 : set usethreads on the Configure command line to enable threads.
1304 usereentrant='undef'
1305 : full support for void wanted by default
1306 defvoidused=15
1307
1308 : List of libraries we want.
1309 : If anyone needs extra -lxxx, put those in a hint file.
1310 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1311 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1312 : We probably want to search /usr/shlib before most other libraries.
1313 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1314 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1315 glibpth="/usr/shlib $glibpth"
1316 : Do not use vfork unless overridden by a hint file.
1317 usevfork=false
1318
1319 : Find the basic shell for Bourne shell scripts
1320 case "$sh" in
1321 '')
1322         case "$SYSTYPE" in
1323         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1324         *) xxx='/bin/sh';;
1325         esac
1326         if test -f "$xxx"; then
1327                 sh="$xxx"
1328         else
1329                 : Build up a list and do a single loop so we can 'break' out.
1330                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1331                 for xxx in sh bash ksh pdksh ash; do
1332                         for p in $pth; do
1333                                 try="$try ${p}/${xxx}"
1334                         done
1335                 done
1336                 for xxx in $try; do
1337                         if test -f "$xxx"; then
1338                                 sh="$xxx";
1339                                 break
1340                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1341                                 sh="$xxx";
1342                                 break
1343                         elif test -f "$xxx.exe"; then
1344                                 sh="$xxx";
1345                                 break
1346                         fi
1347                 done
1348         fi
1349         ;;
1350 esac
1351
1352 case "$sh" in
1353 '')     cat >&2 <<EOM
1354 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1355
1356 Usually it's in /bin/sh.  How did you even get this far?
1357 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1358 we'll try to straighten this all out.
1359 EOM
1360         exit 1
1361         ;;
1362 esac
1363
1364 : see if sh knows # comments
1365 if `$sh -c '#' >/dev/null 2>&1`; then
1366         shsharp=true
1367         spitshell=cat
1368         xcat=/bin/cat
1369         test -f $xcat$_exe || xcat=/usr/bin/cat
1370         if test ! -f $xcat$_exe; then
1371                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1372                         if test -f $p/cat$_exe; then
1373                                 xcat=$p/cat
1374                                 break
1375                         fi
1376                 done
1377                 if test ! -f $xcat$_exe; then
1378                         echo "Can't find cat anywhere!"
1379                         exit 1
1380                 fi
1381         fi
1382         echo "#!$xcat" >sharp
1383         $eunicefix sharp
1384         chmod +x sharp
1385         ./sharp > today
1386         if test -s today; then
1387                 sharpbang='#!'
1388         else
1389                 echo "#! $xcat" > sharp
1390                 $eunicefix sharp
1391                 chmod +x sharp
1392                 ./sharp > today
1393                 if test -s today; then
1394                         sharpbang='#! '
1395                 else
1396                         sharpbang=': use '
1397                 fi
1398         fi
1399 else
1400         echo " "
1401         echo "Your $sh doesn't grok # comments--I will strip them later on."
1402         shsharp=false
1403         cd ..
1404         echo "exec grep -v '^[  ]*#'" >spitshell
1405         chmod +x spitshell
1406         $eunicefix spitshell
1407         spitshell=`pwd`/spitshell
1408         cd UU
1409         echo "I presume that if # doesn't work, #! won't work either!"
1410         sharpbang=': use '
1411 fi
1412 rm -f sharp today
1413
1414 : figure out how to guarantee sh startup
1415 case "$startsh" in
1416 '') startsh=${sharpbang}${sh} ;;
1417 *)
1418 esac
1419 cat >sharp <<EOSS
1420 $startsh
1421 set abc
1422 test "$?abc" != 1
1423 EOSS
1424
1425 chmod +x sharp
1426 $eunicefix sharp
1427 if ./sharp; then
1428         : echo "Yup, it does."
1429 else
1430         echo "Hmm... '$startsh' does not guarantee sh startup..."
1431         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1432 fi
1433 rm -f sharp
1434
1435
1436 : Save command line options in file UU/cmdline.opt for later use in
1437 : generating config.sh.
1438 cat > cmdline.opt <<EOSH
1439 # Configure command line arguments.
1440 config_arg0='$0'
1441 config_args='$*'
1442 config_argc=$#
1443 EOSH
1444 argn=1
1445 args_exp=''
1446 args_sep=''
1447 for arg in "$@"; do
1448         cat >>cmdline.opt <<EOSH
1449 config_arg$argn='$arg'
1450 EOSH
1451         # Extreme backslashitis: replace each ' by '"'"'
1452         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1453 $arg
1454 EOC
1455         arg_exp=`cat cmdl.opt`
1456         args_exp="$args_exp$args_sep'$arg_exp'"
1457         argn=`expr $argn + 1`
1458         args_sep=' '
1459 done
1460 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1461 # used by ./hints/os2.sh
1462 rm -f cmdl.opt
1463
1464 : produce awk script to parse command line options
1465 cat >options.awk <<'EOF'
1466 BEGIN {
1467         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1468
1469         len = length(optstr);
1470         for (i = 1; i <= len; i++) {
1471                 c = substr(optstr, i, 1);
1472                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1473                 if (a == ":") {
1474                         arg[c] = 1;
1475                         i++;
1476                 }
1477                 opt[c] = 1;
1478         }
1479 }
1480 {
1481         expect = 0;
1482         str = $0;
1483         if (substr(str, 1, 1) != "-") {
1484                 printf("'%s'\n", str);
1485                 next;
1486         }
1487         len = length($0);
1488         for (i = 2; i <= len; i++) {
1489                 c = substr(str, i, 1);
1490                 if (!opt[c]) {
1491                         printf("-%s\n", substr(str, i));
1492                         next;
1493                 }
1494                 printf("-%s\n", c);
1495                 if (arg[c]) {
1496                         if (i < len)
1497                                 printf("'%s'\n", substr(str, i + 1));
1498                         else
1499                                 expect = 1;
1500                         next;
1501                 }
1502         }
1503 }
1504 END {
1505         if (expect)
1506                 print "?";
1507 }
1508 EOF
1509
1510 : process the command line options
1511 set X `for arg in "$@"; do echo "X$arg"; done |
1512         sed -e s/X// | awk -f options.awk`
1513 eval "set $*"
1514 shift
1515 rm -f options.awk
1516
1517 : set up default values
1518 fastread=''
1519 reuseval=false
1520 config_sh=''
1521 alldone=''
1522 error=''
1523 silent=''
1524 extractsh=''
1525 override=''
1526 knowitall=''
1527 rm -f optdef.sh posthint.sh
1528 cat >optdef.sh <<EOS
1529 $startsh
1530 EOS
1531
1532
1533 : option parsing
1534 while test $# -gt 0; do
1535         case "$1" in
1536         -d) shift; fastread=yes;;
1537         -e) shift; alldone=cont;;
1538         -f)
1539                 shift
1540                 cd ..
1541                 if test -r "$1"; then
1542                         config_sh="$1"
1543                 else
1544                         echo "$me: cannot read config file $1." >&2
1545                         error=true
1546                 fi
1547                 cd UU
1548                 shift;;
1549         -h) shift; error=true;;
1550         -r) shift; reuseval=true;;
1551         -s) shift; silent=true; realsilent=true;;
1552         -E) shift; alldone=exit;;
1553         -K) shift; knowitall=true;;
1554         -O) shift; override=true;;
1555         -S) shift; silent=true; extractsh=true;;
1556         -D)
1557                 shift
1558                 case "$1" in
1559                 *=)
1560                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1561                         echo "$me: ignoring -D $1" >&2
1562                         ;;
1563                 *=*) echo "$1" | \
1564                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1565                 *) echo "$1='define'" >> optdef.sh;;
1566                 esac
1567                 shift
1568                 ;;
1569         -U)
1570                 shift
1571                 case "$1" in
1572                 *=) echo "$1" >> optdef.sh;;
1573                 *=*)
1574                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1575                         echo "$me: ignoring -U $1" >&2
1576                         ;;
1577                 *) echo "$1='undef'" >> optdef.sh;;
1578                 esac
1579                 shift
1580                 ;;
1581         -A)
1582             shift
1583             xxx=''
1584             yyy="$1"
1585             zzz=''
1586             uuu=undef
1587             case "$yyy" in
1588             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1589                  case "$zzz" in
1590                  *:*) zzz='' ;;
1591                  *)   xxx=append
1592                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1593                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1594                  esac
1595                  ;;
1596             esac
1597             case "$xxx" in
1598             '')  case "$yyy" in
1599                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1600                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1601                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1602                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1603                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1604                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1605                  esac
1606                  ;;       
1607             esac
1608             case "$xxx" in
1609             append)
1610                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1611             clear)
1612                 echo "$yyy=''"                  >> posthint.sh ;;
1613             define)
1614                 case "$zzz" in
1615                 '') zzz=define ;;
1616                 esac
1617                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1618             eval)
1619                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1620             prepend)
1621                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1622             undef)
1623                 case "$zzz" in
1624                 '') zzz="$uuu" ;;
1625                 esac
1626                 echo "$yyy=$zzz"                >> posthint.sh ;;
1627             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1628             esac
1629             shift
1630             ;;
1631         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1632             exit 0;;
1633         --) break;;
1634         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1635         *) break;;
1636         esac
1637 done
1638
1639 case "$error" in
1640 true)
1641         cat >&2 <<EOM
1642 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1643                  [-U symbol] [-U symbol=] [-A command:symbol...]
1644   -d : use defaults for all answers.
1645   -e : go on without questioning past the production of config.sh.
1646   -f : specify an alternate default configuration file.
1647   -h : print this help message and exit (with an error status).
1648   -r : reuse C symbols value if possible (skips costly nm extraction).
1649   -s : silent mode, only echoes questions and essential information.
1650   -D : define symbol to have some value:
1651          -D symbol         symbol gets the value 'define'
1652          -D symbol=value   symbol gets the value 'value'
1653   -E : stop at the end of questions, after having produced config.sh.
1654   -K : do not use unless you know what you are doing.
1655   -O : let -D and -U override definitions from loaded configuration file.
1656   -S : perform variable substitutions on all .SH files (can mix with -f)
1657   -U : undefine symbol:
1658          -U symbol    symbol gets the value 'undef'
1659          -U symbol=   symbol gets completely empty
1660   -A : manipulate symbol after the platform specific hints have been applied:
1661          -A symbol=value                append " "value to symbol
1662          -A append:symbol=value         append value to symbol
1663          -A define:symbol=value         define symbol to have value
1664          -A clear:symbol                define symbol to be ''
1665          -A define:symbol               define symbol to be 'define'
1666          -A eval:symbol=value           define symbol to be eval of value
1667          -A prepend:symbol=value        prepend value to symbol
1668          -A undef:symbol                define symbol to be 'undef'
1669          -A undef:symbol=               define symbol to be ''
1670   -V : print version number and exit (with a zero status).
1671 EOM
1672         exit 1
1673         ;;
1674 esac
1675
1676 : Sanity checks
1677 case "$fastread$alldone" in
1678 yescont|yesexit) ;;
1679 *)
1680         case "$extractsh" in
1681         true) ;;
1682         *)
1683                 if test ! -t 0; then
1684                         echo "Say 'sh Configure', not 'sh <Configure'"
1685                         exit 1
1686                 fi
1687                 ;;
1688         esac
1689         ;;
1690 esac
1691
1692 exec 4>&1
1693 case "$silent" in
1694 true) exec 1>/dev/null;;
1695 esac
1696
1697 : run the defines and the undefines, if any, but leave the file out there...
1698 touch optdef.sh
1699 . ./optdef.sh
1700 : create the posthint manipulation script and leave the file out there...
1701 touch posthint.sh
1702
1703 : set package name
1704 package=perl5
1705 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1706 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1707 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1708 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1709 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1710 esac
1711
1712 : Some greps do not return status, grrr.
1713 echo "grimblepritz" >grimble
1714 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1715         contains=contains
1716 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1717         contains=grep
1718 else
1719         contains=contains
1720 fi
1721 rm -f grimble
1722 : the following should work in any shell
1723 case "$contains" in
1724 contains*)
1725         echo " "
1726         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1727         cat >contains <<'EOSS'
1728 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1729 EOSS
1730 chmod +x contains
1731 esac
1732
1733 : Find the path to the source tree
1734 case "$src" in
1735 '') case "$0" in
1736     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1737          case "$src" in
1738          /*)    ;;
1739          .)     ;;
1740          *)     src=`cd ../$src && pwd` ;;
1741          esac
1742          ;;
1743     *)   src='.';;
1744     esac;;
1745 esac
1746 case "$src" in
1747 '')     src=/
1748         rsrc=/
1749         ;;
1750 /*) rsrc="$src";;
1751 *) rsrc="../$src";;
1752 esac
1753 if test -f $rsrc/Configure && \
1754         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1755 then
1756    : found it, so we are ok.
1757 else
1758         rsrc=''
1759         for src in . .. ../.. ../../.. ../../../..; do
1760                 if test -f ../$src/Configure && \
1761                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1762                 then
1763                         rsrc=../$src
1764                         break
1765                 fi
1766         done
1767 fi
1768 case "$rsrc" in
1769 '')
1770         cat <<EOM >&4
1771
1772 Sorry, I can't seem to locate the source dir for $package.  Please start
1773 Configure with an explicit path -- i.e. /some/path/Configure.
1774
1775 EOM
1776         exit 1
1777         ;;
1778 ../.)   rsrc='..';;
1779 *)
1780         echo " "
1781         echo "Sources for $package found in \"$src\"." >&4
1782         ;;
1783 esac
1784
1785 : script used to extract .SH files with variable substitutions
1786 cat >extract <<'EOS'
1787 PERL_CONFIG_SH=true
1788 echo "Doing variable substitutions on .SH files..."
1789 if test -f MANIFEST; then
1790         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1791 else
1792         echo "(Looking for .SH files under the source directory.)"
1793         set x `(cd "$src"; find . -name "*.SH" -print)`
1794 fi
1795 shift
1796 case $# in
1797 0) set x `(cd "$src"; echo *.SH)`; shift;;
1798 esac
1799 if test ! -f "$src/$1"; then
1800         shift
1801 fi
1802 mkdir_p='
1803 name=$1;
1804 create="";
1805 while test $name; do
1806         if test ! -d "$name"; then
1807                 create="$name $create";
1808                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1809                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1810         else
1811                 name="";
1812         fi;
1813 done;
1814 for file in $create; do
1815         mkdir $file;
1816 done
1817 '
1818 for file in $*; do
1819         case "$src" in
1820         ".")
1821                 case "$file" in
1822                 */*)
1823                         dir=`expr X$file : 'X\(.*\)/'`
1824                         file=`expr X$file : 'X.*/\(.*\)'`
1825                         (cd "$dir" && . ./$file)
1826                         ;;
1827                 *)
1828                         . ./$file
1829                         ;;
1830                 esac
1831                 ;;
1832         *)
1833                 case "$file" in
1834                 */*)
1835                         dir=`expr X$file : 'X\(.*\)/'`
1836                         file=`expr X$file : 'X.*/\(.*\)'`
1837                         (set x $dir; shift; eval $mkdir_p)
1838                         sh <"$src/$dir/$file"
1839                         ;;
1840                 *)
1841                         sh <"$src/$file"
1842                         ;;
1843                 esac
1844                 ;;
1845         esac
1846 done
1847 if test -f "$src/config_h.SH"; then
1848         if test ! -f config.h; then
1849         : oops, they left it out of MANIFEST, probably, so do it anyway.
1850         . "$src/config_h.SH"
1851         fi
1852 fi
1853 EOS
1854
1855 : extract files and exit if asked to do so
1856 case "$extractsh" in
1857 true)
1858         case "$realsilent" in
1859         true) ;;
1860         *) exec 1>&4;;
1861         esac
1862         case "$config_sh" in
1863         '') config_sh='config.sh';;
1864         esac
1865         echo " "
1866         echo "Fetching answers from $config_sh..."
1867         cd ..
1868         . $config_sh
1869         test "$override" && . ./optdef.sh
1870         echo " "
1871         . UU/extract
1872         rm -rf UU
1873         echo "Extraction done."
1874         exit 0
1875         ;;
1876 esac
1877
1878 : Eunice requires " " instead of "", can you believe it
1879 echo " "
1880 : Here we go...
1881 echo "Beginning of configuration questions for $package."
1882
1883 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1884
1885 : first determine how to suppress newline on echo command
1886 echo " "
1887 echo "Checking echo to see how to suppress newlines..."
1888 (echo "hi there\c" ; echo " ") >.echotmp
1889 if $contains c .echotmp >/dev/null 2>&1 ; then
1890         echo "...using -n."
1891         n='-n'
1892         c=''
1893 else
1894         cat <<'EOM'
1895 ...using \c
1896 EOM
1897         n=''
1898         c='\c'
1899 fi
1900 echo $n "The star should be here-->$c"
1901 echo '*'
1902 rm -f .echotmp
1903
1904 : Now test for existence of everything in MANIFEST
1905 echo " "
1906 if test -f "$rsrc/MANIFEST"; then
1907         echo "First let's make sure your kit is complete.  Checking..." >&4
1908         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1909         rm -f missing
1910         tmppwd=`pwd`
1911         for filelist in x??; do
1912                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1913         done
1914         if test -s missing; then
1915                 cat missing >&4
1916                 cat >&4 <<'EOM'
1917
1918 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1919
1920 You have the option of continuing the configuration process, despite the
1921 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1922 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1923 and contact the author (perlbug@perl.org).
1924
1925 EOM
1926                 echo $n "Continue? [n] $c" >&4
1927                 read ans
1928                 case "$ans" in
1929                 y*)
1930                         echo "Continuing..." >&4
1931                         rm -f missing
1932                         ;;
1933                 *)
1934                         echo "ABORTING..." >&4
1935                         kill $$
1936                         ;;
1937                 esac
1938         else
1939                 echo "Looks good..."
1940         fi
1941 else
1942         echo "There is no MANIFEST file.  I hope your kit is complete !"
1943 fi
1944 rm -f missing x??
1945
1946 echo " "
1947 : Find the appropriate value for a newline for tr
1948 if test -n "$DJGPP"; then
1949        trnl='\012'
1950 fi
1951 if test X"$trnl" = X; then
1952         case "`echo foo|tr '\n' x 2>/dev/null`" in
1953         foox) trnl='\n' ;;
1954         esac
1955 fi
1956 if test X"$trnl" = X; then
1957         case "`echo foo|tr '\012' x 2>/dev/null`" in
1958         foox) trnl='\012' ;;
1959         esac
1960 fi
1961 if test X"$trnl" = X; then
1962        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1963        fooxy) trnl='\n\r' ;;
1964        esac
1965 fi
1966 if test X"$trnl" = X; then
1967         cat <<EOM >&2
1968
1969 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1970
1971 EOM
1972         exit 1
1973 fi
1974
1975 : compute the number of columns on the terminal for proper question formatting
1976 case "$COLUMNS" in
1977 '') COLUMNS='80';;
1978 esac
1979
1980 : set up the echo used in my read
1981 myecho="case \"\$xxxm\" in
1982 '') echo $n \"\$rp $c\" >&4;;
1983 *) case \"\$rp\" in
1984         '') echo $n \"[\$xxxm] $c\";;
1985         *)
1986                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1987                         echo \"\$rp\" >&4
1988                         echo $n \"[\$xxxm] $c\" >&4
1989                 else
1990                         echo $n \"\$rp [\$xxxm] $c\" >&4
1991                 fi
1992                 ;;
1993         esac;;
1994 esac"
1995
1996 : now set up to do reads with possible shell escape and default assignment
1997 cat <<EOSC >myread
1998 $startsh
1999 xxxm=\$dflt
2000 $myecho
2001 ans='!'
2002 case "\$fastread" in
2003 yes) case "\$dflt" in
2004         '') ;;
2005         *) ans='';
2006                 case "\$silent-\$rp" in
2007                 true-) ;;
2008                 *) echo " " >&4;;
2009                 esac;;
2010         esac;;
2011 *) case "\$silent" in
2012         true) case "\$rp" in
2013                 '') ans='';;
2014                 esac;;
2015         esac;;
2016 esac
2017 while expr "X\$ans" : "X!" >/dev/null; do
2018         read answ
2019         set x \$xxxm
2020         shift
2021         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2022         case  "\$answ" in
2023         "!")
2024                 sh 1>&4
2025                 echo " "
2026                 $myecho
2027                 ;;
2028         !*)
2029                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2030                 shift
2031                 sh 1>&4 -c "\$*"
2032                 echo " "
2033                 $myecho
2034                 ;;
2035         "\$ans")
2036                 case "\$ans" in
2037                 \\&*)
2038                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2039                         shift
2040                         case "\$1" in
2041                         -d)
2042                                 fastread=yes
2043                                 echo "(OK, I'll run with -d after this question.)" >&4
2044                                 ;;
2045                         -*)
2046                                 echo "*** Sorry, \$1 not supported yet." >&4
2047                                 ;;
2048                         esac
2049                         $myecho
2050                         ans=!
2051                         ;;
2052                 esac;;
2053         *)
2054                 case "\$aok" in
2055                 y)
2056                         echo "*** Substitution done -- please confirm."
2057                         xxxm="\$ans"
2058                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2059                         xxxm="\$ans"
2060                         ans=!
2061                         ;;
2062                 *)
2063                         echo "*** Error -- try again."
2064                         ans=!
2065                         ;;
2066                 esac
2067                 $myecho
2068                 ;;
2069         esac
2070         case "\$ans\$xxxm\$nostick" in
2071         '')
2072                 ans=!
2073                 $myecho
2074                 ;;
2075         esac
2076 done
2077 case "\$ans" in
2078 '') ans="\$xxxm";;
2079 esac
2080 EOSC
2081
2082 : create .config dir to save info across Configure sessions
2083 test -d ../.config || mkdir ../.config
2084 cat >../.config/README <<EOF
2085 This directory created by Configure to save information that should
2086 persist across sessions for $package.
2087
2088 You may safely delete it if you wish.
2089 EOF
2090
2091 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2092 case "$usedevel" in
2093 $define|true|[yY]*) ;;
2094 *) case "$xversion" in
2095    *[13579])
2096         cat >&4 <<EOH
2097 *** WHOA THERE!!! ***
2098
2099     This is an UNSTABLE DEVELOPMENT release.
2100     The version of this $package distribution is $xversion, that is, odd,
2101     (as opposed to even) and that signifies a development release.
2102     If you want a maintenance release, you want an even-numbered version.
2103
2104     Do ***NOT*** install this into production use.
2105     Data corruption and crashes are possible.
2106
2107     It is most seriously suggested that you do not continue any further
2108     unless you want to help in developing and debugging Perl.
2109
2110     If you *still* want to build perl, you can answer 'y' now,
2111     or pass -Dusedevel to Configure.
2112
2113 EOH
2114         rp='Do you really want to continue?'
2115         dflt='n'
2116         . ./myread
2117         case "$ans" in
2118         [yY]) echo >&4 "Okay, continuing."
2119               usedevel="$define" ;;
2120         *) echo >&4 "Okay, bye."
2121            exit 1
2122            ;;
2123         esac
2124         ;;
2125     esac
2126     ;;
2127 esac
2128 case "$usedevel" in
2129 $define|true|[yY]*)
2130         case "$versiononly" in
2131         '') versiononly="$define" ;;
2132         esac
2133         case "$installusrbinperl" in
2134         '') installusrbinperl="$undef" ;;
2135         esac
2136         ;;
2137 esac
2138
2139 : general instructions
2140 needman=true
2141 firsttime=true
2142 user=`(logname) 2>/dev/null`
2143 case "$user" in
2144 '') user=`whoami 2>&1`;;
2145 esac
2146 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2147         firsttime=false
2148         echo " "
2149         rp='Would you like to see the instructions?'
2150         dflt=n
2151         . ./myread
2152         case "$ans" in
2153         [yY]*) ;;
2154         *) needman=false;;
2155         esac
2156 fi
2157 if $needman; then
2158         cat <<EOH
2159
2160 This installation shell script will examine your system and ask you questions
2161 to determine how the perl5 package should be installed. If you get
2162 stuck on a question, you may use a ! shell escape to start a subshell or
2163 execute a command.  Many of the questions will have default answers in square
2164 brackets; typing carriage return will give you the default.
2165
2166 On some of the questions which ask for file or directory names you are allowed
2167 to use the ~name construct to specify the login directory belonging to "name",
2168 even if you don't have a shell which knows about that.  Questions where this is
2169 allowed will be marked "(~name ok)".
2170
2171 EOH
2172         rp=''
2173         dflt='Type carriage return to continue'
2174         . ./myread
2175         cat <<'EOH'
2176
2177 The prompter used in this script allows you to use shell variables and
2178 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2179 in the default answer, as if the default line was a set of arguments given to a
2180 script shell.  This means you may also use $* to repeat the whole default line,
2181 so you do not have to re-type everything to add something to the default.
2182
2183 Everytime there is a substitution, you will have to confirm.  If there is an
2184 error (e.g. an unmatched backtick), the default answer will remain unchanged
2185 and you will be prompted again.
2186
2187 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2188 the questions and use the computed defaults (or the previous answers if there
2189 was already a config.sh file). Type 'Configure -h' for a list of options.
2190 You may also start interactively and then answer '& -d' at any prompt to turn
2191 on the non-interactive behaviour for the remainder of the execution.
2192
2193 EOH
2194         . ./myread
2195         cat <<EOH
2196
2197 Much effort has been expended to ensure that this shell script will run on any
2198 Unix system.  If despite that it blows up on yours, your best bet is to edit
2199 Configure and run it again.  If you can't run Configure for some reason,
2200 you'll have to generate a config.sh file by hand.  Whatever problems you
2201 have, let me (perlbug@perl.org) know how I blew it.
2202
2203 This installation script affects things in two ways:
2204
2205 1) it may do direct variable substitutions on some of the files included
2206    in this kit.
2207 2) it builds a config.h file for inclusion in C programs.  You may edit
2208    any of these files as the need arises after running this script.
2209
2210 If you make a mistake on a question, there is no easy way to back up to it
2211 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2212 files.  Configure will offer to let you do this before it runs the SH files.
2213
2214 EOH
2215         dflt='Type carriage return to continue'
2216         . ./myread
2217         case "$firsttime" in
2218         true) echo $user >>../.config/instruct;;
2219         esac
2220 fi
2221
2222 : find out where common programs are
2223 echo " "
2224 echo "Locating common programs..." >&4
2225 cat <<EOSC >loc
2226 $startsh
2227 case \$# in
2228 0) exit 1;;
2229 esac
2230 thing=\$1
2231 shift
2232 dflt=\$1
2233 shift
2234 for dir in \$*; do
2235         case "\$thing" in
2236         .)
2237         if test -d \$dir/\$thing; then
2238                 echo \$dir
2239                 exit 0
2240         fi
2241         ;;
2242         *)
2243         for thisthing in \$dir/\$thing; do
2244                 : just loop through to pick last item
2245         done
2246         if test -f \$thisthing; then
2247                 echo \$thisthing
2248                 exit 0
2249         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2250                 echo \$thisthing
2251                 exit 0
2252         elif test -f \$dir/\$thing.exe; then
2253                 if test -n "$DJGPP"; then
2254                         echo \$dir/\$thing.exe
2255                 elif test "$eunicefix" != ":"; then
2256                         : on Eunice apparently
2257                         echo \$dir/\$thing
2258                         exit 0
2259                 fi
2260                 exit 0
2261         fi
2262         ;;
2263         esac
2264 done
2265 echo \$dflt
2266 exit 1
2267 EOSC
2268 chmod +x loc
2269 $eunicefix loc
2270 loclist="
2271 awk
2272 cat
2273 chmod
2274 comm
2275 cp
2276 echo
2277 expr
2278 grep
2279 ls
2280 mkdir
2281 rm
2282 sed
2283 sort
2284 touch
2285 tr
2286 uniq
2287 "
2288 trylist="
2289 Mcc
2290 ar
2291 bison
2292 byacc
2293 cpp
2294 csh
2295 date
2296 egrep
2297 gmake
2298 gzip
2299 less
2300 ln
2301 make
2302 more
2303 nm
2304 nroff
2305 pg
2306 test
2307 uname
2308 zip
2309 "
2310 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2311 pth="$pth /lib /usr/lib"
2312 for file in $loclist; do
2313         eval xxx=\$$file
2314         case "$xxx" in
2315         /*|?:[\\/]*)
2316                 if test -f "$xxx"; then
2317                         : ok
2318                 else
2319                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2320                         xxx=`./loc $file $file $pth`
2321                 fi
2322                 ;;
2323         '') xxx=`./loc $file $file $pth`;;
2324         *) xxx=`./loc $xxx $xxx $pth`;;
2325         esac
2326         eval $file=$xxx$_exe
2327         eval _$file=$xxx
2328         case "$xxx" in
2329         /*)
2330                 echo $file is in $xxx.
2331                 ;;
2332         ?:[\\/]*)
2333                 echo $file is in $xxx.
2334                 ;;
2335         *)
2336                 echo "I don't know where '$file' is, and my life depends on it." >&4
2337                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2338                 exit 1
2339                 ;;
2340         esac
2341 done
2342 echo " "
2343 echo "Don't worry if any of the following aren't found..."
2344 say=offhand
2345 for file in $trylist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't see $file out there, $say."
2370                 say=either
2371                 ;;
2372         esac
2373 done
2374 case "$egrep" in
2375 egrep)
2376         echo "Substituting grep for egrep."
2377         egrep=$grep
2378         _egrep=$grep
2379         ;;
2380 esac
2381 case "$ln" in
2382 ln)
2383         echo "Substituting cp for ln."
2384         ln=$cp
2385         _ln=$cp
2386         ;;
2387 esac
2388 case "$make" in
2389 make)   
2390         case "$gmake" in
2391         gmake)
2392         echo "I can't find make or gmake, and my life depends on it." >&4
2393         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2394         exit 1
2395         ;;
2396         esac
2397         ;;
2398 esac    
2399 case "$gmake" in
2400 gmake)  ;;
2401 *)      # We can't have osname yet.
2402         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2403                 # Assume that gmake, if found, is definitely GNU make
2404                 # and prefer it over the system make.
2405                 echo "Substituting gmake for make."
2406                 make=$gmake
2407                 _make=$gmake
2408         fi
2409         ;;
2410 esac
2411 case "$test" in
2412 test)
2413         echo "Hopefully test is built into your sh."
2414         ;;
2415 *)
2416         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2417                 echo "Using the test built into your sh."
2418                 test=test
2419                 _test=test
2420         fi
2421         ;;
2422 esac
2423 case "$echo" in
2424 echo)
2425         echo "Hopefully echo is built into your sh."
2426         ;;
2427 '') ;;
2428 *)
2429         echo " "
2430 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2431         $echo $n "hi there$c" >foo1
2432         echo $n "hi there$c" >foo2
2433         if cmp foo1 foo2 >/dev/null 2>&1; then
2434                 echo "They are compatible.  In fact, they may be identical."
2435         else
2436                 case "$n" in
2437                 '-n') n='' c='\c';;
2438                 *) n='-n' c='';;
2439                 esac
2440                 cat <<FOO
2441 They are not compatible!  You are probably running ksh on a non-USG system.
2442 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2443 have echo built in and we may have to run some Bourne shell scripts.  That
2444 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2445
2446 FOO
2447                 $echo $n "The star should be here-->$c"
2448                 $echo "*"
2449         fi
2450         $rm -f foo1 foo2
2451         ;;
2452 esac
2453
2454 cat <<EOS >trygcc
2455 $startsh
2456 EOS
2457 cat <<'EOSC' >>trygcc
2458 case "$cc" in
2459 '') ;;
2460 *)  $rm -f try try.*
2461     $cat >try.c <<EOM
2462 int main(int argc, char *argv[]) {
2463   return 0;
2464 }
2465 EOM
2466     if $cc -o try $ccflags $ldflags try.c; then
2467        :
2468     else
2469         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2470         despair=yes
2471         trygcc=yes
2472         case "$cc" in
2473         *gcc*) trygcc=no ;;
2474         esac
2475         case "`$cc -v -c try.c 2>&1`" in
2476         *gcc*) trygcc=no ;;
2477         esac
2478         if $test X"$trygcc" = Xyes; then
2479             if gcc -o try -c try.c; then
2480                 echo " "
2481                 echo "You seem to have a working gcc, though." >&4
2482                 rp="Would you like to use it?"
2483                 dflt=y
2484                 if $test -f myread; then
2485                     . ./myread
2486                 else
2487                     if $test -f UU/myread; then
2488                         . ./UU/myread
2489                     else
2490                         echo "Cannot find myread, sorry.  Aborting." >&2
2491                         exit 1
2492                     fi
2493                 fi  
2494                 case "$ans" in
2495                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2496                        if $test -f usethreads.cbu; then
2497                            $cat >&4 <<EOM 
2498
2499 *** However, any setting of the C compiler flags (e.g. for thread support)
2500 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2501 *** (together with e.g. -Dusethreads).
2502
2503 EOM
2504                        fi;;
2505                 esac
2506             fi
2507         fi
2508     fi
2509     $rm -f try try.*
2510     ;;
2511 esac
2512 EOSC
2513
2514 cat <<EOS >checkcc
2515 $startsh
2516 EOS
2517 cat <<'EOSC' >>checkcc
2518 case "$cc" in        
2519 '') ;;
2520 *)  $rm -f try try.*              
2521     $cat >try.c <<EOM
2522 int main(int argc, char *argv[]) {
2523   return 0;
2524 }
2525 EOM
2526     if $cc -o try $ccflags $ldflags try.c; then
2527        :
2528     else
2529         if $test X"$despair" = Xyes; then
2530            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2531         fi
2532         $cat >&4 <<EOM         
2533 You need to find a working C compiler.
2534 Either (purchase and) install the C compiler supplied by your OS vendor,
2535 or for a free C compiler try http://gcc.gnu.org/
2536 I cannot continue any further, aborting.
2537 EOM
2538         exit 1
2539     fi
2540     $rm -f try try.*
2541     ;;
2542 esac
2543 EOSC
2544
2545 : determine whether symbolic links are supported
2546 echo " "
2547 $touch blurfl
2548 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2549         echo "Symbolic links are supported." >&4
2550         lns="$ln -s"
2551 else
2552         echo "Symbolic links are NOT supported." >&4
2553         lns="$ln"
2554 fi
2555 $rm -f blurfl sym
2556
2557 : determine whether symbolic links are supported
2558 echo " "
2559 case "$lns" in
2560 *"ln"*" -s")
2561         echo "Checking how to test for symbolic links..." >&4
2562         $lns blurfl sym
2563         if $test "X$issymlink" = X; then
2564                 case "$newsh" in
2565                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2567                 esac
2568                 if test $? = 0; then
2569                         issymlink="test -h"
2570                 else
2571                         echo "Your builtin 'test -h' may be broken." >&4
2572                         case "$test" in
2573                         /*)     ;;
2574                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2575                                 for p in $pth
2576                                 do
2577                                         if test -f "$p/$test"; then
2578                                                 test="$p/$test"
2579                                                 break
2580                                         fi
2581                                 done
2582                                 ;;
2583                         esac
2584                         case "$test" in
2585                         /*)
2586                                 echo "Trying external '$test -h'." >&4
2587                                 issymlink="$test -h"
2588                                 if $test ! -h sym >/dev/null 2>&1; then
2589                                         echo "External '$test -h' is broken, too." >&4
2590                                         issymlink=''
2591                                 fi
2592                                 ;;
2593                         *)      issymlink='' ;;
2594                         esac
2595                 fi              
2596         fi
2597         if $test "X$issymlink" = X; then
2598                 if $test -L sym 2>/dev/null; then
2599                         issymlink="$test -L"
2600                         echo "The builtin '$test -L' worked." >&4
2601                 fi
2602         fi
2603         if $test "X$issymlink" != X; then
2604                 echo "You can test for symbolic links with '$issymlink'." >&4
2605         else
2606                 echo "I do not know how you can test for symbolic links." >&4
2607         fi
2608         $rm -f blurfl sym
2609         ;;
2610 *)      echo "No symbolic links, so not testing for their testing..." >&4
2611         ;;
2612 esac
2613 echo " "
2614
2615
2616 case "$mksymlinks" in
2617 $define|true|[yY]*)
2618         case "$src" in
2619         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2620                 exit 1
2621                 ;;
2622         *)      case "$lns:$issymlink" in
2623                 *"ln"*" -s:"*"test -"?)
2624                         echo "Creating the symbolic links..." >&4
2625                         echo "(First creating the subdirectories...)" >&4
2626                         cd ..
2627                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2628                                 read directory
2629                                 test -z "$directory" && break
2630                                 mkdir -p $directory
2631                         done
2632                         # Sanity check 1.
2633                         if test ! -d t/base; then
2634                                 echo "Failed to create the subdirectories.  Aborting." >&4
2635                                 exit 1
2636                         fi
2637                         echo "(Then creating the symlinks...)" >&4
2638                         awk '{print $1}' $src/MANIFEST | while true; do
2639                                 read filename
2640                                 test -z "$filename" && break
2641                                 if test -f $filename; then
2642                                         if $issymlink $filename; then
2643                                                 rm -f $filename
2644                                         fi
2645                                 fi
2646                                 if test -f $filename; then
2647                                         echo "$filename already exists, not symlinking."
2648                                 else
2649                                         ln -s $src/$filename $filename
2650                                 fi
2651                         done
2652                         # Sanity check 2.
2653                         if test ! -f t/base/lex.t; then
2654                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2655                                 exit 1
2656                         fi
2657                         cd UU
2658                         ;;
2659                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2660                         ;;
2661                 esac
2662                 ;;
2663         esac
2664         ;;
2665 esac
2666
2667
2668 case "$usecrosscompile" in
2669 $define|true|[yY]*)
2670         $echo "Cross-compiling..."
2671         croak=''
2672         case "$cc" in
2673         *-*-gcc) # A cross-compiling gcc, probably.
2674             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2675             ar=$targetarch-ar
2676             # leave out ld, choosing it is more complex
2677             nm=$targetarch-nm
2678             ranlib=$targetarch-ranlib
2679             $echo 'extern int foo;' > try.c
2680             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2681             shift
2682             if $test $# -gt 0; then
2683                 incpth="$incpth $*"
2684                 incpth="`$echo $incpth|$sed 's/^ //'`"
2685                 echo "Guessing incpth '$incpth'." >&4
2686                 for i in $*; do
2687                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2688                     if $test -d $j; then
2689                         libpth="$libpth $j"
2690                     fi
2691                 done   
2692                 libpth="`$echo $libpth|$sed 's/^ //'`"
2693                 echo "Guessing libpth '$libpth'." >&4
2694             fi
2695             $rm -f try.c
2696             ;;
2697         esac
2698         case "$targetarch" in
2699         '') echo "Targetarch not defined." >&4; croak=y ;;
2700         *)  echo "Using targetarch $targetarch." >&4 ;;
2701         esac
2702         case "$incpth" in
2703         '') echo "Incpth not defined." >&4; croak=y ;;
2704         *)  echo "Using incpth '$incpth'." >&4 ;;
2705         esac
2706         case "$libpth" in
2707         '') echo "Libpth not defined." >&4; croak=y ;;
2708         *)  echo "Using libpth '$libpth'." >&4 ;;
2709         esac
2710         case "$usrinc" in
2711         '') for i in $incpth; do
2712                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2713                     usrinc=$i
2714                     echo "Guessing usrinc $usrinc." >&4
2715                     break
2716                 fi
2717             done
2718             case "$usrinc" in
2719             '') echo "Usrinc not defined." >&4; croak=y ;;
2720             esac
2721             ;;
2722         *)  echo "Using usrinc $usrinc." >&4 ;;
2723         esac
2724         case "$targethost" in
2725         '') echo "Targethost not defined." >&4; croak=y ;;
2726         *)  echo "Using targethost $targethost." >&4
2727         esac
2728         locincpth=' '
2729         loclibpth=' '
2730         case "$croak" in
2731         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2732         esac
2733         case "$src" in
2734         /*) run=$src/Cross/run
2735             targetmkdir=$src/Cross/mkdir
2736             to=$src/Cross/to
2737             from=$src/Cross/from
2738             ;;
2739         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2740             run=$pwd/Cross/run
2741             targetmkdir=$pwd/Cross/mkdir
2742             to=$pwd/Cross/to
2743             from=$pwd/Cross/from
2744             ;;
2745         esac
2746         case "$targetrun" in
2747         '') targetrun=ssh ;;
2748         esac
2749         case "$targetto" in
2750         '') targetto=scp ;;
2751         esac
2752         case "$targetfrom" in
2753         '') targetfrom=scp ;;
2754         esac
2755         run=$run-$targetrun
2756         to=$to-$targetto
2757         from=$from-$targetfrom
2758         case "$targetdir" in
2759         '')  targetdir=/tmp
2760              echo "Guessing targetdir $targetdir." >&4
2761              ;;
2762         esac
2763         case "$targetuser" in
2764         '')  targetuser=root
2765              echo "Guessing targetuser $targetuser." >&4
2766              ;;
2767         esac
2768         case "$targetfrom" in
2769         scp)    q=-q ;;
2770         *)      q='' ;;
2771         esac
2772         case "$targetrun" in
2773         ssh|rsh)
2774             cat >$run <<EOF
2775 #!/bin/sh
2776 case "\$1" in
2777 -cwd)
2778   shift
2779   cwd=\$1
2780   shift
2781   ;;
2782 esac
2783 case "\$cwd" in
2784 '') cwd=$targetdir ;;
2785 esac
2786 exe=\$1
2787 shift
2788 if $test ! -f \$exe.xok; then
2789   $to \$exe
2790   $touch \$exe.xok
2791 fi
2792 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2793 EOF
2794             ;;
2795         *)  echo "Unknown targetrun '$targetrun'" >&4
2796             exit 1
2797             ;;
2798         esac
2799         case "$targetmkdir" in
2800         */Cross/mkdir)
2801             cat >$targetmkdir <<EOF
2802 #!/bin/sh
2803 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2804 EOF
2805             $chmod a+rx $targetmkdir
2806             ;;
2807         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2808             exit 1
2809             ;;
2810         esac
2811         case "$targetto" in
2812         scp|rcp)
2813             cat >$to <<EOF
2814 #!/bin/sh
2815 for f in \$@
2816 do
2817   case "\$f" in
2818   /*)
2819     $targetmkdir \`dirname \$f\`
2820     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2821     ;;
2822   *)
2823     $targetmkdir $targetdir/\`dirname \$f\`
2824     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2825     ;;
2826   esac
2827 done
2828 exit 0
2829 EOF
2830             ;;
2831         cp) cat >$to <<EOF
2832 #!/bin/sh
2833 for f in \$@
2834 do
2835   case "\$f" in
2836   /*)
2837     $mkdir -p $targetdir/\`dirname \$f\`
2838     $cp \$f $targetdir/\$f || exit 1
2839     ;;
2840   *)
2841     $targetmkdir $targetdir/\`dirname \$f\`
2842     $cp \$f $targetdir/\$f || exit 1
2843     ;;
2844   esac
2845 done
2846 exit 0
2847 EOF
2848             ;;
2849         *)  echo "Unknown targetto '$targetto'" >&4
2850             exit 1
2851             ;;
2852         esac
2853         case "$targetfrom" in
2854         scp|rcp)
2855           cat >$from <<EOF
2856 #!/bin/sh
2857 for f in \$@
2858 do
2859   $rm -f \$f
2860   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2861 done
2862 exit 0
2863 EOF
2864             ;;
2865         cp) cat >$from <<EOF
2866 #!/bin/sh
2867 for f in \$@
2868 do
2869   $rm -f \$f
2870   cp $targetdir/\$f . || exit 1
2871 done
2872 exit 0
2873 EOF
2874             ;;
2875         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2876             exit 1
2877             ;;
2878         esac
2879         if $test ! -f $run; then
2880             echo "Target 'run' script '$run' not found." >&4
2881         else
2882             $chmod a+rx $run
2883         fi
2884         if $test ! -f $to; then
2885             echo "Target 'to' script '$to' not found." >&4
2886         else
2887             $chmod a+rx $to
2888         fi
2889         if $test ! -f $from; then
2890             echo "Target 'from' script '$from' not found." >&4
2891         else
2892             $chmod a+rx $from
2893         fi
2894         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2895             exit 1
2896         fi
2897         cat >&4 <<EOF
2898 Using '$run' for remote execution,
2899 and '$from' and '$to'
2900 for remote file transfer.
2901 EOF
2902         ;;
2903 *)      run=''
2904         to=:
2905         from=:
2906         usecrosscompile='undef'
2907         targetarch=''
2908         ;;
2909 esac
2910
2911 : see whether [:lower:] and [:upper:] are supported character classes
2912 echo " "
2913 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2914 ABYZ)
2915         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2916         up='[:upper:]'
2917         low='[:lower:]'
2918         ;;
2919 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2920         # (0xd9 and 0xe2), therefore that is a nice testing point.
2921         if test "X$up" = X -o "X$low" = X; then
2922             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2923             rs) up='[A-Z]'
2924                 low='[a-z]'
2925                 ;;
2926             esac
2927         fi
2928         if test "X$up" = X -o "X$low" = X; then
2929             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2930             rs) up='A-Z'
2931                 low='a-z'
2932                 ;;
2933             esac
2934         fi
2935         if test "X$up" = X -o "X$low" = X; then
2936             case "`echo RS | od -x 2>/dev/null`" in
2937             *D9E2*|*d9e2*)
2938                 echo "Hey, this might be EBCDIC." >&4
2939                 if test "X$up" = X -o "X$low" = X; then
2940                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2941                     rs) up='[A-IJ-RS-Z]'
2942                         low='[a-ij-rs-z]'
2943                         ;;
2944                     esac
2945                 fi
2946                 if test "X$up" = X -o "X$low" = X; then
2947                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2948                     rs) up='A-IJ-RS-Z'
2949                         low='a-ij-rs-z'
2950                         ;;
2951                     esac
2952                 fi
2953                 ;;
2954             esac
2955         fi
2956 esac
2957 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2958 rs)
2959     echo "Using $up and $low to convert case." >&4
2960     ;;
2961 *)
2962     echo "I don't know how to translate letters from upper to lower case." >&4
2963     echo "Your tr is not acting any way I know of." >&4
2964     exit 1
2965     ;;
2966 esac
2967 : set up the translation script tr, must be called with ./tr of course
2968 cat >tr <<EOSC
2969 $startsh
2970 case "\$1\$2" in
2971 '[A-Z][a-z]') exec $tr '$up' '$low';;
2972 '[a-z][A-Z]') exec $tr '$low' '$up';;
2973 esac
2974 exec $tr "\$@"
2975 EOSC
2976 chmod +x tr
2977 $eunicefix tr
2978
2979 : Try to determine whether config.sh was made on this system
2980 case "$config_sh" in
2981 '')
2982 myuname=`$uname -a 2>/dev/null`
2983 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2984 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2985 # because the A-Z/a-z are not consecutive.
2986 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2987         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2988 newmyuname="$myuname"
2989 dflt=n
2990 case "$knowitall" in
2991 '')
2992         if test -f ../config.sh; then
2993                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2994                         eval "`grep myuname= ../config.sh`"
2995                 fi
2996                 if test "X$myuname" = "X$newmyuname"; then
2997                         dflt=y
2998                 fi
2999         fi
3000         ;;
3001 *) dflt=y;;
3002 esac
3003
3004 : Get old answers from old config file if Configure was run on the
3005 : same system, otherwise use the hints.
3006 hint=default
3007 cd ..
3008 if test -f config.sh; then
3009         echo " "
3010         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3011         . UU/myread
3012         case "$ans" in
3013         n*|N*) echo "OK, I'll ignore it."
3014                 mv config.sh config.sh.old
3015                 myuname="$newmyuname"
3016                 ;;
3017         *)  echo "Fetching default answers from your old config.sh file..." >&4
3018                 tmp_n="$n"
3019                 tmp_c="$c"
3020                 tmp_sh="$sh"
3021                 . ./config.sh
3022                 cp config.sh UU
3023                 n="$tmp_n"
3024                 c="$tmp_c"
3025                 : Older versions did not always set $sh.  Catch re-use of such
3026                 : an old config.sh.
3027                 case "$sh" in
3028                 '') sh="$tmp_sh" ;;
3029                 esac
3030                 hint=previous
3031                 ;;
3032         esac
3033 fi
3034 . ./UU/checkcc
3035 if test ! -f config.sh; then
3036         $cat <<EOM
3037
3038 First time through, eh?  I have some defaults handy for some systems
3039 that need some extra help getting the Configure answers right:
3040
3041 EOM
3042         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3043         dflt=''
3044         : Half the following guesses are probably wrong... If you have better
3045         : tests or hints, please send them to perlbug@perl.org
3046         : The metaconfig authors would also appreciate a copy...
3047         $test -f /irix && osname=irix
3048         $test -f /xenix && osname=sco_xenix
3049         $test -f /dynix && osname=dynix
3050         $test -f /dnix && osname=dnix
3051         $test -f /lynx.os && osname=lynxos
3052         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3053         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3055         $test -f /bin/mips && /bin/mips && osname=mips
3056         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3057                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3058         $test -d /usr/apollo/bin && osname=apollo
3059         $test -f /etc/saf/_sactab && osname=svr4
3060         $test -d /usr/include/minix && osname=minix
3061         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3062         if $test -d /MachTen -o -d /MachTen_Folder; then
3063                 osname=machten
3064                 if $test -x /sbin/version; then
3065                         osvers=`/sbin/version | $awk '{print $2}' |
3066                         $sed -e 's/[A-Za-z]$//'`
3067                 elif $test -x /usr/etc/version; then
3068                         osvers=`/usr/etc/version | $awk '{print $2}' |
3069                         $sed -e 's/[A-Za-z]$//'`
3070                 else
3071                         osvers="$2.$3"
3072                 fi
3073         fi
3074
3075         $test -f /sys/posix.dll &&
3076                 $test -f /usr/bin/what &&
3077                 set X `/usr/bin/what /sys/posix.dll` &&
3078                 $test "$3" = UWIN &&
3079                 osname=uwin &&
3080                 osvers="$5"
3081
3082         if $test -f $uname; then
3083                 set X $myuname
3084                 shift
3085
3086                 case "$5" in
3087                 fps*) osname=fps ;;
3088                 mips*)
3089                         case "$4" in
3090                         umips) osname=umips ;;
3091                         *) osname=mips ;;
3092                         esac;;
3093                 [23]100) osname=mips ;;
3094                 next*) osname=next ;;
3095                 i386*)
3096                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3097                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3098                                 osname='sco'
3099                                 osvers=$tmp
3100                         elif $test -f /etc/kconfig; then
3101                                 osname=isc
3102                                 if test "$lns" = "$ln -s"; then
3103                                         osvers=4
3104                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3105                                         osvers=3
3106                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3107                                         osvers=2
3108                                 fi
3109                         fi
3110                         tmp=''
3111                         ;;
3112                 pc*)
3113                         if test -n "$DJGPP"; then
3114                                 osname=dos
3115                                 osvers=djgpp
3116                         fi
3117                         ;;
3118                 esac
3119
3120                 case "$1" in
3121                 aix) osname=aix
3122                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3123                         case "$tmp" in
3124                         # oslevel can fail with:
3125                         # oslevel: Unable to acquire lock.
3126                         *not\ found) osvers="$4"."$3" ;;
3127                         '<3240'|'<>3240') osvers=3.2.0 ;;
3128                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3129                         '=3250'|'>3250') osvers=3.2.5 ;;
3130                         *) osvers=$tmp;;
3131                         esac
3132                         ;;
3133                 bsd386) osname=bsd386
3134                         osvers=`$uname -r`
3135                         ;;
3136                 cygwin*) osname=cygwin
3137                         osvers="$3"
3138                         ;;
3139                 *dc.osx) osname=dcosx
3140                         osvers="$3"
3141                         ;;
3142                 dnix) osname=dnix
3143                         osvers="$3"
3144                         ;;
3145                 domainos) osname=apollo
3146                         osvers="$3"
3147                         ;;
3148                 dgux)   osname=dgux
3149                         osvers="$3"
3150                         ;;
3151                 dragonfly) osname=dragonfly
3152                         osvers="$3"
3153                         ;;
3154                 dynixptx*) osname=dynixptx
3155                         osvers=`echo "$4"|sed 's/^v//'`
3156                         ;;
3157                 freebsd) osname=freebsd
3158                         osvers="$3" ;;
3159                 genix)  osname=genix ;;
3160                 gnu)    osname=gnu
3161                         osvers="$3" ;;
3162                 hp*)    osname=hpux
3163                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3164                         ;;
3165                 irix*)  osname=irix
3166                         case "$3" in
3167                         4*) osvers=4 ;;
3168                         5*) osvers=5 ;;
3169                         *)      osvers="$3" ;;
3170                         esac
3171                         ;;
3172                 linux)  osname=linux
3173                         case "$3" in
3174                         *)      osvers="$3" ;;
3175                         esac
3176                         ;;
3177                 MiNT)   osname=mint
3178                         ;;
3179                 netbsd*) osname=netbsd
3180                         osvers="$3"
3181                         ;;
3182                 news-os) osvers="$3"
3183                         case "$3" in
3184                         4*) osname=newsos4 ;;
3185                         *) osname=newsos ;;
3186                         esac
3187                         ;;
3188                 next*) osname=next ;;
3189                 nonstop-ux) osname=nonstopux ;;
3190                 openbsd) osname=openbsd
3191                         osvers="$3"
3192                         ;;
3193                 os2)    osname=os2
3194                         osvers="$4"
3195                         ;;
3196                 POSIX-BC | posix-bc ) osname=posix-bc
3197                         osvers="$3"
3198                         ;;
3199                 powerux | power_ux | powermax_os | powermaxos | \
3200                 powerunix | power_unix) osname=powerux
3201                         osvers="$3"
3202                         ;;
3203                 qnx) osname=qnx
3204                         osvers="$4"
3205                         ;;
3206                 solaris) osname=solaris
3207                         case "$3" in
3208                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3209                         *)      osvers="$3" ;;
3210                         esac
3211                         ;;
3212                 sunos) osname=sunos
3213                         case "$3" in
3214                         5*) osname=solaris
3215                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3216                         *)      osvers="$3" ;;
3217                         esac
3218                         ;;
3219                 titanos) osname=titanos
3220                         case "$3" in
3221                         1*) osvers=1 ;;
3222                         2*) osvers=2 ;;
3223                         3*) osvers=3 ;;
3224                         4*) osvers=4 ;;
3225                         *)      osvers="$3" ;;
3226                         esac
3227                         ;;
3228                 ultrix) osname=ultrix
3229                         osvers="$3"
3230                         ;;
3231                 osf1|mls+)      case "$5" in
3232                                 alpha)
3233                                         osname=dec_osf
3234                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3235                                         case "$osvers" in
3236                                         [1-9].[0-9]*) ;;
3237                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3238                                         esac
3239                                         ;;
3240                         hp*)    osname=hp_osf1  ;;
3241                         mips)   osname=mips_osf1 ;;
3242                         esac
3243                         ;;
3244                 # UnixWare 7.1.2 is known as Open UNIX 8
3245                 openunix|unixware) osname=svr5
3246                         osvers="$4"
3247                         ;;
3248                 uts)    osname=uts
3249                         osvers="$3"
3250                         ;;
3251                 vos) osvers="$3"
3252                         ;;
3253                 $2) case "$osname" in
3254                         *isc*) ;;
3255                         *freebsd*) ;;
3256                         svr*)
3257                                 : svr4.x or possibly later
3258                                 case "svr$3" in
3259                                 ${osname}*)
3260                                         osname=svr$3
3261                                         osvers=$4
3262                                         ;;
3263                                 esac
3264                                 case "$osname" in
3265                                 svr4.0)
3266                                         : Check for ESIX
3267                                         if test -f /stand/boot ; then
3268                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3269                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3270                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3271                                                         if test -n "$isesix"; then
3272                                                                 osname=esix4
3273                                                         fi
3274                                                 fi
3275                                         fi
3276                                         ;;
3277                                 esac
3278                                 ;;
3279                         *)      if test -f /etc/systemid; then
3280                                         osname=sco
3281                                         set `echo $3 | $sed 's/\./ /g'` $4
3282                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3283                                                 osvers=$1.$2.$3
3284                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3285                                                 osvers=$1.$2
3286                                         elif $test -f $src/hints/sco_$1.sh; then
3287                                                 osvers=$1
3288                                         fi
3289                                 else
3290                                         case "$osname" in
3291                                         '') : Still unknown.  Probably a generic Sys V.
3292                                                 osname="sysv"
3293                                                 osvers="$3"
3294                                                 ;;
3295                                         esac
3296                                 fi
3297                                 ;;
3298                         esac
3299                         ;;
3300                 *)      case "$osname" in
3301                         '') : Still unknown.  Probably a generic BSD.
3302                                 osname="$1"
3303                                 osvers="$3"
3304                                 ;;
3305                         esac
3306                         ;;
3307                 esac
3308         else
3309                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3310                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3311                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3312                                 osname=news_os
3313                         fi
3314                         $rm -f UU/kernel.what
3315                 elif test -d c:/. -o -n "$is_os2" ; then
3316                         set X $myuname
3317                         osname=os2
3318                         osvers="$5"
3319                 fi
3320         fi
3321
3322         case "$targetarch" in
3323         '') ;;
3324         *)  hostarch=$osname
3325             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3326             osvers=''
3327             ;;
3328         esac
3329
3330         : Now look for a hint file osname_osvers, unless one has been
3331         : specified already.
3332         case "$hintfile" in
3333         ''|' ')
3334                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3335                 : Also try without trailing minor version numbers.
3336                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3337                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3339                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3340                 case "$file" in
3341                 '') dflt=none ;;
3342                 *)  case "$osvers" in
3343                         '') dflt=$file
3344                                 ;;
3345                         *)  if $test -f $src/hints/$file.sh ; then
3346                                         dflt=$file
3347                                 elif $test -f $src/hints/$xfile.sh ; then
3348                                         dflt=$xfile
3349                                 elif $test -f $src/hints/$xxfile.sh ; then
3350                                         dflt=$xxfile
3351                                 elif $test -f $src/hints/$xxxfile.sh ; then
3352                                         dflt=$xxxfile
3353                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3354                                         dflt=$xxxxfile
3355                                 elif $test -f "$src/hints/${osname}.sh" ; then
3356                                         dflt="${osname}"
3357                                 else
3358                                         dflt=none
3359                                 fi
3360                                 ;;
3361                         esac
3362                         ;;
3363                 esac
3364                 if $test -f Policy.sh ; then
3365                         case "$dflt" in
3366                         *Policy*) ;;
3367                         none) dflt="Policy" ;;
3368                         *) dflt="Policy $dflt" ;;
3369                         esac
3370                 fi
3371                 ;;
3372         *)
3373                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3374                 ;;
3375         esac
3376
3377         if $test -f Policy.sh ; then
3378                 $cat <<EOM
3379
3380 There's also a Policy hint file available, which should make the
3381 site-specific (policy) questions easier to answer.
3382 EOM
3383
3384         fi
3385
3386         $cat <<EOM
3387
3388 You may give one or more space-separated answers, or "none" if appropriate.
3389 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3390 previous run of Configure, you may specify it as well as or instead of
3391 OS-specific hints.  If hints are provided for your OS, you should use them:
3392 although Perl can probably be built without hints on many platforms, using
3393 hints often improve performance and may enable features that Configure can't
3394 set up on its own. If there are no hints that match your OS, specify "none";
3395 DO NOT give a wrong version or a wrong OS.
3396
3397 EOM
3398
3399         rp="Which of these apply, if any?"
3400         . UU/myread
3401         tans=$ans
3402         for file in $tans; do
3403                 if $test X$file = XPolicy -a -f Policy.sh; then
3404                         . Policy.sh
3405                         $cat Policy.sh >> UU/config.sh
3406                 elif $test -f $src/hints/$file.sh; then
3407                         . $src/hints/$file.sh
3408                         $cat $src/hints/$file.sh >> UU/config.sh
3409                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3410                         : nothing
3411                 else
3412                         : Give one chance to correct a possible typo.
3413                         echo "$file.sh does not exist"
3414                         dflt=$file
3415                         rp="hint to use instead?"
3416                         . UU/myread
3417                         for file in $ans; do
3418                                 if $test -f "$src/hints/$file.sh"; then
3419                                         . $src/hints/$file.sh
3420                                         $cat $src/hints/$file.sh >> UU/config.sh
3421                                 elif $test X$ans = X -o X$ans = Xnone ; then
3422                                         : nothing
3423                                 else
3424                                         echo "$file.sh does not exist -- ignored."
3425                                 fi
3426                         done
3427                 fi
3428         done
3429
3430         hint=recommended
3431         : Remember our hint file for later.
3432         if $test -f "$src/hints/$file.sh" ; then
3433                 hintfile="$file"
3434         else
3435                 hintfile=''
3436         fi
3437 fi
3438 cd UU
3439 ;;
3440 *)
3441         echo " "
3442         echo "Fetching default answers from $config_sh..." >&4
3443         tmp_n="$n"
3444         tmp_c="$c"
3445         cd ..
3446         cp $config_sh config.sh 2>/dev/null
3447         chmod +w config.sh
3448         . ./config.sh
3449         cd UU
3450         cp ../config.sh .
3451         n="$tmp_n"
3452         c="$tmp_c"
3453         hint=previous
3454         ;;
3455 esac
3456 test "$override" && . ./optdef.sh
3457
3458 : Restore computed paths
3459 for file in $loclist $trylist; do
3460         eval $file="\$_$file"
3461 done
3462
3463 cat << EOM
3464
3465 Configure uses the operating system name and version to set some defaults.
3466 The default value is probably right if the name rings a bell. Otherwise,
3467 since spelling matters for me, either accept the default or answer "none"
3468 to leave it blank.
3469
3470 EOM
3471 case "$osname" in
3472         ''|' ')
3473                 case "$hintfile" in
3474                 ''|' '|none) dflt=none ;;
3475                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3476                 esac
3477                 ;;
3478         *) dflt="$osname" ;;
3479 esac
3480 rp="Operating system name?"
3481 . ./myread
3482 case "$ans" in
3483 none)  osname='' ;;
3484 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3485 esac
3486 echo " "
3487 case "$osvers" in
3488         ''|' ')
3489                 case "$hintfile" in
3490                 ''|' '|none) dflt=none ;;
3491                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3492                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3493                         case "$dflt" in
3494                         ''|' ') dflt=none ;;
3495                         esac
3496                         ;;
3497                 esac
3498                 ;;
3499         *) dflt="$osvers" ;;
3500 esac
3501 rp="Operating system version?"
3502 . ./myread
3503 case "$ans" in
3504 none)  osvers='' ;;
3505 *) osvers="$ans" ;;
3506 esac
3507
3508
3509 . ./posthint.sh
3510
3511 : who configured the system
3512 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3513 case "$cf_by" in
3514 "")
3515         cf_by=`(logname) 2>/dev/null`
3516         case "$cf_by" in
3517         "")
3518                 cf_by=`(whoami) 2>/dev/null`
3519                 case "$cf_by" in
3520                 "") cf_by=unknown ;;
3521                 esac ;;
3522         esac ;;
3523 esac
3524
3525 : decide how portable to be.  Allow command line overrides.
3526 case "$d_portable" in
3527 "$undef") ;;
3528 *)      d_portable="$define" ;;
3529 esac
3530
3531 : set up shell script to do ~ expansion
3532 cat >filexp <<EOSS
3533 $startsh
3534 : expand filename
3535 case "\$1" in
3536  ~/*|~)
3537         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3538         ;;
3539  ~*)
3540         if $test -f /bin/csh; then
3541                 /bin/csh -f -c "glob \$1"
3542                 failed=\$?
3543                 echo ""
3544                 exit \$failed
3545         else
3546                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3547                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3548                 if $test ! -d "\$dir"; then
3549                         me=\`basename \$0\`
3550                         echo "\$me: can't locate home directory for: \$name" >&2
3551                         exit 1
3552                 fi
3553                 case "\$1" in
3554                 */*)
3555                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3556                         ;;
3557                 *)
3558                         echo \$dir
3559                         ;;
3560                 esac
3561         fi
3562         ;;
3563 *)
3564         echo \$1
3565         ;;
3566 esac
3567 EOSS
3568 chmod +x filexp
3569 $eunicefix filexp
3570
3571 : now set up to get a file name
3572 cat <<EOS >getfile
3573 $startsh
3574 EOS
3575 cat <<'EOSC' >>getfile
3576 tilde=''
3577 fullpath=''
3578 already=''
3579 skip=''
3580 none_ok=''
3581 exp_file=''
3582 nopath_ok=''
3583 orig_rp="$rp"
3584 orig_dflt="$dflt"
3585 case "$gfpth" in
3586 '') gfpth='.' ;;
3587 esac
3588
3589 case "$fn" in
3590 *\(*)
3591         : getfile will accept an answer from the comma-separated list
3592         : enclosed in parentheses even if it does not meet other criteria.
3593         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3594         fn=`echo $fn | sed 's/(.*)//'`
3595         ;;
3596 esac
3597
3598 case "$fn" in
3599 *:*)
3600         loc_file=`expr $fn : '.*:\(.*\)'`
3601         fn=`expr $fn : '\(.*\):.*'`
3602         ;;
3603 esac
3604
3605 case "$fn" in
3606 *~*) tilde=true;;
3607 esac
3608 case "$fn" in
3609 */*) fullpath=true;;
3610 esac
3611 case "$fn" in
3612 *+*) skip=true;;
3613 esac
3614 case "$fn" in
3615 *n*) none_ok=true;;
3616 esac
3617 case "$fn" in
3618 *e*) exp_file=true;;
3619 esac
3620 case "$fn" in
3621 *p*) nopath_ok=true;;
3622 esac
3623
3624 case "$fn" in
3625 *f*) type='File';;
3626 *d*) type='Directory';;
3627 *l*) type='Locate';;
3628 esac
3629
3630 what="$type"
3631 case "$what" in
3632 Locate) what='File';;
3633 esac
3634
3635 case "$exp_file" in
3636 '')
3637         case "$d_portable" in
3638         "$define") ;;
3639         *) exp_file=true;;
3640         esac
3641         ;;
3642 esac
3643
3644 cd ..
3645 while test "$type"; do
3646         redo=''
3647         rp="$orig_rp"
3648         dflt="$orig_dflt"
3649         case "$tilde" in
3650         true) rp="$rp (~name ok)";;
3651         esac
3652         . UU/myread
3653         if test -f UU/getfile.ok && \
3654                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3655         then
3656                 value="$ans"
3657                 ansexp="$ans"
3658                 break
3659         fi
3660         case "$ans" in
3661         none)
3662                 value=''
3663                 ansexp=''
3664                 case "$none_ok" in
3665                 true) type='';;
3666                 esac
3667                 ;;
3668         *)
3669                 case "$tilde" in
3670                 '') value="$ans"
3671                         ansexp="$ans";;
3672                 *)
3673                         value=`UU/filexp $ans`
3674                         case $? in
3675                         0)
3676                                 if test "$ans" != "$value"; then
3677                                         echo "(That expands to $value on this system.)"
3678                                 fi
3679                                 ;;
3680                         *) value="$ans";;
3681                         esac
3682                         ansexp="$value"
3683                         case "$exp_file" in
3684                         '') value="$ans";;
3685                         esac
3686                         ;;
3687                 esac
3688                 case "$fullpath" in
3689                 true)
3690                         case "$ansexp" in
3691                         /*) value="$ansexp" ;;
3692                         [a-zA-Z]:/*) value="$ansexp" ;;
3693                         *)
3694                                 redo=true
3695                                 case "$already" in
3696                                 true)
3697                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3698                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3699                                         ;;
3700                                 *)
3701                                 echo "Please give a full path name, starting with slash." >&4
3702                                         case "$tilde" in
3703                                         true)
3704                                 echo "Note that using ~name is ok provided it expands well." >&4
3705                                                 already=true
3706                                                 ;;
3707                                         esac
3708                                 esac
3709                                 ;;
3710                         esac
3711                         ;;
3712                 esac
3713                 case "$redo" in
3714                 '')
3715                         case "$type" in
3716                         File)
3717                                 for fp in $gfpth; do
3718                                         if test "X$fp" = X.; then
3719                                             pf="$ansexp"
3720                                         else    
3721                                             pf="$fp/$ansexp"
3722                                         fi
3723                                         if test -f "$pf"; then
3724                                                 type=''
3725                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3726                                         then
3727                                                 echo "($value is not a plain file, but that's ok.)"
3728                                                 type=''
3729                                         fi
3730                                         if test X"$type" = X; then
3731                                             value="$pf"
3732                                             break
3733                                         fi
3734                                 done
3735                                 ;;
3736                         Directory)
3737                                 for fp in $gfpth; do
3738                                         if test "X$fp" = X.; then
3739                                             dir="$ans"
3740                                             direxp="$ansexp"
3741                                         else    
3742                                             dir="$fp/$ansexp"
3743                                             direxp="$fp/$ansexp"
3744                                         fi
3745                                         if test -d "$direxp"; then
3746                                                 type=''
3747                                                 value="$dir"
3748                                                 break
3749                                         fi
3750                                 done
3751                                 ;;
3752                         Locate)
3753                                 if test -d "$ansexp"; then
3754                                         echo "(Looking for $loc_file in directory $value.)"
3755                                         value="$value/$loc_file"
3756                                         ansexp="$ansexp/$loc_file"
3757                                 fi
3758                                 if test -f "$ansexp"; then
3759                                         type=''
3760                                 fi
3761                                 case "$nopath_ok" in
3762                                 true)   case "$value" in
3763                                         */*) ;;
3764                                         *)      echo "Assuming $value will be in people's path."
3765                                                 type=''
3766                                                 ;;
3767                                         esac
3768                                         ;;
3769                                 esac
3770                                 ;;
3771                         esac
3772
3773                         case "$skip" in
3774                         true) type='';
3775                         esac
3776
3777                         case "$type" in
3778                         '') ;;
3779                         *)
3780                                 if test "$fastread" = yes; then
3781                                         dflt=y
3782                                 else
3783                                         dflt=n
3784                                 fi
3785                                 rp="$what $value doesn't exist.  Use that name anyway?"
3786                                 . UU/myread
3787                                 dflt=''
3788                                 case "$ans" in
3789                                 y*) type='';;
3790                                 *) echo " ";;
3791                                 esac
3792                                 ;;
3793                         esac
3794                         ;;
3795                 esac
3796                 ;;
3797         esac
3798 done
3799 cd UU
3800 ans="$value"
3801 rp="$orig_rp"
3802 dflt="$orig_dflt"
3803 rm -f getfile.ok
3804 test "X$gfpthkeep" != Xy && gfpth=""
3805 EOSC
3806
3807 : determine root of directory hierarchy where package will be installed.
3808 case "$prefix" in
3809 '')
3810         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3811         ;;
3812 *?/)
3813         dflt=`echo "$prefix" | sed 's/.$//'`
3814         ;;
3815 *)
3816         dflt="$prefix"
3817         ;;
3818 esac
3819 $cat <<EOM
3820
3821 By default, $package will be installed in $dflt/bin, manual pages
3822 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3823 installation directories. Typically this is something like /usr/local.
3824 If you wish to have binaries under /usr/bin but other parts of the
3825 installation under /usr/local, that's ok: you will be prompted
3826 separately for each of the installation directories, the prefix being
3827 only used to set the defaults.
3828
3829 EOM
3830 fn=d~
3831 rp='Installation prefix to use?'
3832 . ./getfile
3833 oldprefix=''
3834 case "$prefix" in
3835 '') ;;
3836 *)
3837         case "$ans" in
3838         "$prefix") ;;
3839         *) oldprefix="$prefix";;
3840         esac
3841         ;;
3842 esac
3843 prefix="$ans"
3844 prefixexp="$ansexp"
3845
3846 case "$afsroot" in
3847 '')     afsroot=/afs ;;
3848 *)      afsroot=$afsroot ;;
3849 esac
3850
3851 : is AFS running?
3852 echo " "
3853 case "$afs" in
3854 $define|true)   afs=true ;;
3855 $undef|false)   afs=false ;;
3856 *)      if test -d $afsroot; then
3857                 afs=true
3858         else
3859                 afs=false
3860         fi
3861         ;;
3862 esac
3863 if $afs; then
3864         echo "AFS may be running... I'll be extra cautious then..." >&4
3865 else
3866         echo "AFS does not seem to be running..." >&4
3867 fi
3868
3869 : determine installation prefix for where package is to be installed.
3870 if $afs; then 
3871 $cat <<EOM
3872
3873 Since you are running AFS, I need to distinguish the directory in which
3874 files will reside from the directory in which they are installed (and from
3875 which they are presumably copied to the former directory by occult means).
3876
3877 EOM
3878         case "$installprefix" in
3879         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3880         *) dflt="$installprefix";;
3881         esac
3882 else
3883 $cat <<EOM
3884
3885 In some special cases, particularly when building $package for distribution,
3886 it is convenient to distinguish the directory in which files should be
3887 installed from the directory ($prefix) in which they will
3888 eventually reside.  For most users, these two directories are the same.
3889
3890 EOM
3891         case "$installprefix" in
3892         '') dflt=$prefix ;;
3893         *) dflt=$installprefix;;
3894         esac
3895 fi
3896 fn=d~
3897 rp='What installation prefix should I use for installing files?'
3898 . ./getfile
3899 installprefix="$ans"
3900 installprefixexp="$ansexp"
3901
3902 : Perform the prefixexp/installprefixexp correction if necessary
3903 cat <<EOS >installprefix
3904 $startsh
3905 EOS
3906 cat <<'EOSC' >>installprefix
3907 : Change installation prefix, if necessary.
3908 if $test X"$prefix" != X"$installprefix"; then
3909     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3910 else
3911     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3912 fi
3913 EOSC
3914 chmod +x installprefix
3915 $eunicefix installprefix
3916
3917 : Set variables such as privlib and privlibexp from the output of ./getfile
3918 : performing the prefixexp/installprefixexp correction if necessary.
3919 cat <<EOS >setprefixvar
3920 $startsh
3921 EOS
3922 cat <<'EOSC' >>setprefixvar
3923 eval "${prefixvar}=\"\$ans\""
3924 eval "${prefixvar}exp=\"\$ansexp\""
3925 . ./installprefix
3926 EOSC
3927 chmod +x setprefixvar
3928 $eunicefix setprefixvar
3929
3930 : set up the script used to warn in case of inconsistency
3931 cat <<EOS >whoa
3932 $startsh
3933 EOS
3934 cat <<'EOSC' >>whoa
3935 dflt=y
3936 echo " "
3937 echo "*** WHOA THERE!!! ***" >&4
3938 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3939 rp="    Keep the $hint value?"
3940 . ./myread
3941 case "$ans" in
3942 y) td=$was; tu=$was;;
3943 esac
3944 EOSC
3945
3946 : function used to set $1 to $val
3947 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3948 case "$val$was" in
3949 $define$undef) . ./whoa; eval "$var=\$td";;
3950 $undef$define) . ./whoa; eval "$var=\$tu";;
3951 *) eval "$var=$val";;
3952 esac'
3953
3954 case "$usesocks" in
3955 $define|true|[yY]*)     dflt='y';;
3956 *) dflt='n';;
3957 esac
3958 cat <<EOM
3959
3960 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3961 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3962 to use the PerlIO abstraction layer, this will be implicitly selected.
3963
3964 If this doesn't make any sense to you, just accept the default '$dflt'.
3965 EOM
3966 rp='Build Perl for SOCKS?'
3967 . ./myread
3968 case "$ans" in
3969 y|Y)    val="$define" ;;     
3970 *)      val="$undef" ;;
3971 esac
3972 set usesocks
3973 eval $setvar
3974
3975 case "$usesocks" in
3976 $define|true|[yY]*) useperlio="$define";;
3977 esac
3978
3979 case "$useperlio" in
3980 $define|true|[yY]*|'')  dflt='y';;
3981 *) dflt='n';;
3982 esac
3983 cat <<EOM
3984
3985 Previous version of $package used the standard IO mechanisms as
3986 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3987 alternate IO mechanisms via the PerlIO abstraction layer, but the
3988 stdio mechanism is still available if needed.  The abstraction layer
3989 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3990 Using PerlIO with sfio may cause problems with some extension modules.
3991
3992 If this doesn't make any sense to you, just accept the default '$dflt'.
3993 EOM
3994 rp='Use the PerlIO abstraction layer?'
3995 . ./myread
3996 case "$ans" in
3997 y|Y) 
3998         val="$define"
3999         ;;
4000 *)      
4001         echo "Ok, doing things the stdio way."
4002         val="$undef"
4003         ;;
4004 esac
4005 set useperlio
4006 eval $setvar 
4007
4008 case "$usesocks" in
4009 $define|true|[yY]*)
4010         case "$useperlio" in
4011         $define|true|[yY]*) ;;
4012         *)      cat >&4 <<EOM
4013
4014 You are using the SOCKS proxy protocol library which means that you
4015 should also use the PerlIO layer.  You may be headed for trouble.
4016
4017 EOM
4018                 ;;
4019         esac
4020         ;;
4021 esac
4022
4023         
4024 case "$usethreads" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *)     # Catch case where user specified ithreads or 5005threads but
4027        # forgot -Dusethreads (A.D. 4/2002)
4028        case "$useithreads$use5005threads" in
4029        *$define*)      
4030                 case "$useperlio" in
4031                 "$define")      dflt='y' ;;
4032                 *)              dflt='n' ;;
4033                 esac
4034                 ;;
4035        *)       dflt='n';;
4036        esac
4037        ;;
4038 esac
4039 cat <<EOM
4040
4041 Perl can be built to take advantage of threads on some systems.
4042 To do so, Configure can be run with -Dusethreads.
4043
4044 Note that Perl built with threading support runs slightly slower
4045 and uses more memory than plain Perl. The current implementation
4046 is believed to be stable, but it is fairly new, and so should be
4047 treated with caution.
4048
4049 If this doesn't make any sense to you, just accept the default '$dflt'.
4050 EOM
4051 rp='Build a threading Perl?'
4052 . ./myread
4053 case "$ans" in
4054 y|Y)    val="$define" ;;
4055 *)      val="$undef" ;;
4056 esac
4057 set usethreads
4058 eval $setvar
4059
4060 case "$usethreads" in
4061 $define)
4062         $cat <<EOM
4063
4064 Since release 5.6, Perl has had two different threading implementations,
4065 the newer interpreter-based version (ithreads) with one interpreter per
4066 thread, and the older 5.005 version (5005threads).
4067 The 5005threads version is effectively unmaintained and will probably be
4068 removed in Perl 5.10, so there should be no need to build a Perl using it
4069 unless needed for backwards compatibility with some existing 5.005threads
4070 code.
4071
4072 EOM
4073         : Default to ithreads unless overridden on command line or with
4074         : old config.sh
4075         dflt='y'
4076         case "$use5005threads" in
4077                 $define|true|[yY]*) dflt='n';;
4078         esac
4079         case "$useithreads" in
4080                 $undef|false|[nN]*) dflt='n';;
4081         esac
4082         rp='Use the newer interpreter-based ithreads?'
4083         . ./myread
4084         case "$ans" in
4085         y|Y)    val="$define" ;;
4086         *)      val="$undef" ;;
4087         esac
4088         set useithreads
4089         eval $setvar
4090         : Now set use5005threads to the opposite value.
4091         case "$useithreads" in
4092         $define) val="$undef" ;;
4093         *) val="$define" ;;
4094         esac
4095         set use5005threads
4096         eval $setvar
4097         ;;
4098 *)
4099         useithreads="$undef"
4100         use5005threads="$undef"
4101         ;;
4102 esac
4103
4104 case "$useithreads$use5005threads" in
4105 "$define$define")
4106         $cat >&4 <<EOM
4107
4108 You cannot have both the ithreads and the 5.005 threads enabled
4109 at the same time.  Disabling the 5.005 threads since they are
4110 much less stable than the ithreads.
4111
4112 EOM
4113         use5005threads="$undef"
4114         ;;
4115 esac
4116
4117 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4118         cat >&4 <<EOF
4119 ***
4120 *** To build with ithreads you must also use the PerlIO layer.
4121 *** Cannot continue, aborting.
4122 ***
4123 EOF
4124         exit 1
4125 fi
4126
4127 case "$d_oldpthreads" in
4128 '')     : Configure tests would be welcome here.  For now, assume undef.
4129         val="$undef" ;;
4130 *)      val="$d_oldpthreads" ;;
4131 esac
4132 set d_oldpthreads
4133 eval $setvar
4134
4135
4136 : Look for a hint-file generated 'call-back-unit'.  If the
4137 : user has specified that a threading perl is to be built,
4138 : we may need to set or change some other defaults.
4139 if $test -f usethreads.cbu; then
4140     echo "Your platform has some specific hints regarding threaded builds, using them..."
4141     . ./usethreads.cbu
4142 else
4143     case "$usethreads" in
4144         "$define"|true|[yY]*)
4145                 $cat <<EOM
4146 (Your platform does not have any specific hints for threaded builds.
4147  Assuming POSIX threads, then.)
4148 EOM
4149         ;;
4150     esac
4151 fi
4152
4153 cat <<EOM
4154
4155 Perl can be built so that multiple Perl interpreters can coexist
4156 within the same Perl executable.
4157 EOM
4158
4159 case "$useithreads" in
4160 $define)
4161         cat <<EOM
4162 This multiple interpreter support is required for interpreter-based threads.
4163 EOM
4164         val="$define"
4165         ;;
4166 *)      case "$usemultiplicity" in
4167         $define|true|[yY]*)     dflt='y';;
4168         *) dflt='n';;
4169         esac
4170         echo " "
4171         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4172         rp='Build Perl for multiplicity?'
4173         . ./myread
4174         case "$ans" in
4175         y|Y)    val="$define" ;;
4176         *)      val="$undef" ;;
4177         esac
4178         ;;
4179 esac
4180 set usemultiplicity
4181 eval $setvar
4182
4183
4184 case "$usemorebits" in
4185 "$define"|true|[yY]*)
4186         use64bitint="$define"
4187         uselongdouble="$define"
4188         usemorebits="$define"
4189         ;;
4190 *)      usemorebits="$undef"
4191         ;;
4192 esac
4193
4194 : make some quick guesses about what we are up against
4195 echo " "
4196 $echo $n "Hmm...  $c"
4197 echo exit 1 >bsd
4198 echo exit 1 >usg
4199 echo exit 1 >v7
4200 echo exit 1 >osf1
4201 echo exit 1 >eunice
4202 echo exit 1 >xenix
4203 echo exit 1 >venix
4204 echo exit 1 >os2
4205 d_bsd="$undef"
4206 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4207 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4208 then
4209         echo "Looks kind of like an OSF/1 system, but we'll see..."
4210         echo exit 0 >osf1
4211 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4212         xxx=`./loc addbib blurfl $pth`
4213         if $test -f $xxx; then
4214         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4215                 echo exit 0 >bsd
4216                 echo exit 0 >usg
4217         else
4218                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4219                         echo "Looks kind of like an extended USG system, but we'll see..."
4220                 else
4221                         echo "Looks kind of like a USG system, but we'll see..."
4222                 fi
4223                 echo exit 0 >usg
4224         fi
4225 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4226         echo "Looks kind of like a BSD system, but we'll see..."
4227         d_bsd="$define"
4228         echo exit 0 >bsd
4229 else
4230         echo "Looks kind of like a Version 7 system, but we'll see..."
4231         echo exit 0 >v7
4232 fi
4233 case "$eunicefix" in
4234 *unixtovms*)
4235         $cat <<'EOI'
4236 There is, however, a strange, musty smell in the air that reminds me of
4237 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4238 EOI
4239         echo exit 0 >eunice
4240         d_eunice="$define"
4241 : it so happens the Eunice I know will not run shell scripts in Unix format
4242         ;;
4243 *)
4244         echo " "
4245         echo "Congratulations.  You aren't running Eunice."
4246         d_eunice="$undef"
4247         ;;
4248 esac
4249 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4250 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4251 : semicolon as a patch separator
4252 case "$p_" in
4253 :) ;;
4254 *)
4255         $cat <<'EOI'
4256 I have the feeling something is not exactly right, however...don't tell me...
4257 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4258 (Or you may be running DOS with DJGPP.)
4259 EOI
4260         echo exit 0 >os2
4261         ;;
4262 esac
4263 if test -f /xenix; then
4264         echo "Actually, this looks more like a XENIX system..."
4265         echo exit 0 >xenix
4266         d_xenix="$define"
4267 else
4268         echo " "
4269         echo "It's not Xenix..."
4270         d_xenix="$undef"
4271 fi
4272 chmod +x xenix
4273 $eunicefix xenix
4274 if test -f /venix; then
4275         echo "Actually, this looks more like a VENIX system..."
4276         echo exit 0 >venix
4277 else
4278         echo " "
4279         if ./xenix; then
4280                 : null
4281         else
4282                 echo "Nor is it Venix..."
4283         fi
4284 fi
4285 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4286 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4287 $rm -f foo
4288
4289 case "$cc" in
4290 '') dflt=cc;;
4291 *) dflt="$cc";;
4292 esac
4293 rp="Use which C compiler?"
4294 . ./myread
4295 cc="$ans"
4296
4297 : See if they have not cc but they do have gcc
4298 . ./trygcc
4299 : Look for a hint-file generated 'call-back-unit'.  Now that the
4300 : user has specified the compiler, we may need to set or change some
4301 : other defaults.
4302 if $test -f cc.cbu; then
4303     . ./cc.cbu
4304 fi
4305 . ./checkcc
4306
4307 echo " "
4308 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4309 $cat >try.c <<EOM
4310 #include <stdio.h>
4311 int main() {
4312 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4313 #ifdef __VERSION__
4314         printf("%s\n", __VERSION__);
4315 #else
4316         printf("%s\n", "1");
4317 #endif
4318 #endif
4319         return(0);
4320 }
4321 EOM
4322 if $cc -o try $ccflags $ldflags try.c; then
4323         gccversion=`$run ./try`
4324         case "$gccversion" in
4325         '') echo "You are not using GNU cc." ;;
4326         *)  echo "You are using GNU cc $gccversion."
4327             ccname=gcc
4328             ;;
4329         esac
4330 else
4331         echo " "
4332         echo "*** WHOA THERE!!! ***" >&4
4333         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4334         case "$knowitall" in
4335         '')
4336         echo "    You'd better start hunting for one and let me know about it." >&4
4337                 exit 1
4338                 ;;
4339         esac
4340 fi
4341 $rm -f try try.*
4342 case "$gccversion" in
4343 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4344 esac
4345 case "$gccversion" in
4346 '') gccosandvers='' ;;
4347 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4348    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4349    gccshortvers=''
4350    case "$gccosandvers" in
4351    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4352    $osname$osvers) ;; # looking good
4353    $osname*) cat <<EOM >&4
4354
4355 *** WHOA THERE!!! ***
4356
4357     Your gcc has not been compiled for the exact release of
4358     your operating system ($gccosandvers versus $osname$osvers).
4359
4360     In general it is a good idea to keep gcc synchronized with
4361     the operating system because otherwise serious problems
4362     may ensue when trying to compile software, like Perl.
4363
4364     I'm trying to be optimistic here, though, and will continue.
4365     If later during the configuration and build icky compilation
4366     problems appear (headerfile conflicts being the most common
4367     manifestation), I suggest reinstalling the gcc to match
4368     your operating system release.
4369
4370 EOM
4371       ;;
4372    *) gccosandvers='' ;; # failed to parse, better be silent
4373    esac
4374    ;;
4375 esac
4376 case "$ccname" in
4377 '') ccname="$cc" ;;
4378 esac
4379
4380 # gcc 3.* complain about adding -Idirectories that they already know about,
4381 # so we will take those off from locincpth.
4382 case "$gccversion" in
4383 3*)
4384     echo "main(){}">try.c
4385     for incdir in $locincpth; do
4386        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4387              grep '^c[cp]p*[01]: warning: changing search order '`
4388        if test "X$warn" != X; then
4389            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4390        fi
4391     done
4392     $rm -f try try.*
4393 esac
4394
4395 : What should the include directory be ?
4396 echo " "
4397 $echo $n "Hmm...  $c"
4398 dflt='/usr/include'
4399 incpath=''
4400 mips_type=''
4401 if $test -f /bin/mips && /bin/mips; then
4402         echo "Looks like a MIPS system..."
4403         $cat >usr.c <<'EOCP'
4404 #ifdef SYSTYPE_BSD43
4405 /bsd43
4406 #endif
4407 EOCP
4408         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4409                 dflt='/bsd43/usr/include'
4410                 incpath='/bsd43'
4411                 mips_type='BSD 4.3'
4412         else
4413                 mips_type='System V'
4414         fi
4415         $rm -f usr.c usr.out
4416         echo "and you're compiling with the $mips_type compiler and libraries."
4417         xxx_prompt=y
4418         echo "exit 0" >mips
4419 else
4420         echo "Doesn't look like a MIPS system."
4421         xxx_prompt=n
4422         echo "exit 1" >mips
4423 fi
4424 chmod +x mips
4425 $eunicefix mips
4426 case "$usrinc" in
4427 '') ;;
4428 *) dflt="$usrinc";;
4429 esac
4430 case "$xxx_prompt" in
4431 y)      fn=d/
4432         echo " "
4433         rp='Where are the include files you want to use?'
4434         . ./getfile
4435         usrinc="$ans"
4436         ;;
4437 *)      usrinc="$dflt"
4438         ;;
4439 esac
4440
4441 : see how we invoke the C preprocessor
4442 echo " "
4443 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4444 cat <<'EOT' >testcpp.c
4445 #define ABC abc
4446 #define XYZ xyz
4447 ABC.XYZ
4448 EOT
4449 cd ..
4450 if test ! -f cppstdin; then
4451         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4452                 # AIX cc -E doesn't show the absolute headerfile
4453                 # locations but we'll cheat by using the -M flag.
4454                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4455         else
4456                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4457         fi
4458 else
4459         echo "Keeping your $hint cppstdin wrapper."
4460 fi
4461 chmod 755 cppstdin
4462 wrapper=`pwd`/cppstdin
4463 ok='false'
4464 cd UU
4465
4466 if $test "X$cppstdin" != "X" && \
4467         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4468         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4469 then
4470         echo "You used to use $cppstdin $cppminus so we'll use that again."
4471         case "$cpprun" in
4472         '') echo "But let's see if we can live without a wrapper..." ;;
4473         *)
4474                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4475                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4476                 then
4477                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4478                         ok='true'
4479                 else
4480                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4481                 fi
4482                 ;;
4483         esac
4484 else
4485         case "$cppstdin" in
4486         '') ;;
4487         *)
4488                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4489                 ;;
4490         esac
4491 fi
4492
4493 if $ok; then
4494         : nothing
4495 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4496         $cc -E <testcpp.c >testcpp.out 2>&1; \
4497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4498         echo "Yup, it does."
4499         x_cpp="$cc -E"
4500         x_minus='';
4501 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4502         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4504         echo "Yup, it does."
4505         x_cpp="$cc -E"
4506         x_minus='-';
4507 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4508         $cc -P <testcpp.c >testcpp.out 2>&1; \
4509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4510         echo "Yipee, that works!"
4511         x_cpp="$cc -P"
4512         x_minus='';
4513 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4514         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4516         echo "At long last!"
4517         x_cpp="$cc -P"
4518         x_minus='-';
4519 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4520         $cpp <testcpp.c >testcpp.out 2>&1; \
4521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4522         echo "It works!"
4523         x_cpp="$cpp"
4524         x_minus='';
4525 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4526         $cpp - <testcpp.c >testcpp.out 2>&1; \
4527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4528         echo "Hooray, it works!  I was beginning to wonder."
4529         x_cpp="$cpp"
4530         x_minus='-';
4531 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4532         $wrapper <testcpp.c >testcpp.out 2>&1; \
4533         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4534         x_cpp="$wrapper"
4535         x_minus=''
4536         echo "Eureka!"
4537 else
4538         dflt=''
4539         rp="No dice.  I can't find a C preprocessor.  Name one:"
4540         . ./myread
4541         x_cpp="$ans"
4542         x_minus=''
4543         $x_cpp <testcpp.c >testcpp.out 2>&1
4544         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4545                 echo "OK, that will do." >&4
4546         else
4547 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4548                 exit 1
4549         fi
4550 fi
4551
4552 case "$ok" in
4553 false)
4554         cppstdin="$x_cpp"
4555         cppminus="$x_minus"
4556         cpprun="$x_cpp"
4557         cpplast="$x_minus"
4558         set X $x_cpp
4559         shift
4560         case "$1" in
4561         "$cpp")
4562                 echo "Perhaps can we force $cc -E using a wrapper..."
4563                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4564                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4565                 then
4566                         echo "Yup, we can."
4567                         cppstdin="$wrapper"
4568                         cppminus='';
4569                 else
4570                         echo "Nope, we'll have to live without it..."
4571                 fi
4572                 ;;
4573         esac
4574         case "$cpprun" in
4575         "$wrapper")
4576                 cpprun=''
4577                 cpplast=''
4578                 ;;
4579         esac
4580         ;;
4581 esac
4582
4583 case "$cppstdin" in
4584 "$wrapper"|'cppstdin') ;;
4585 *) $rm -f $wrapper;;
4586 esac
4587 $rm -f testcpp.c testcpp.out
4588
4589 : Set private lib path
4590 case "$plibpth" in
4591 '') if ./mips; then
4592                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4593         fi;;
4594 esac
4595 case "$libpth" in
4596 ' ') dlist='';;
4597 '') dlist="$loclibpth $plibpth $glibpth";;
4598 *) dlist="$libpth";;
4599 esac
4600
4601 : Now check and see which directories actually exist, avoiding duplicates
4602 libpth=''
4603 for xxx in $dlist
4604 do
4605     if $test -d $xxx; then
4606                 case " $libpth " in
4607                 *" $xxx "*) ;;
4608                 *) libpth="$libpth $xxx";;
4609                 esac
4610     fi
4611 done
4612 $cat <<'EOM'
4613
4614 Some systems have incompatible or broken versions of libraries.  Among
4615 the directories listed in the question below, please remove any you
4616 know not to be holding relevant libraries, and add any that are needed.
4617 Say "none" for none.
4618
4619 EOM
4620 case "$libpth" in
4621 '') dflt='none';;
4622 *)
4623         set X $libpth
4624         shift
4625         dflt=${1+"$@"}
4626         ;;
4627 esac
4628 rp="Directories to use for library searches?"
4629 . ./myread
4630 case "$ans" in
4631 none) libpth=' ';;
4632 *) libpth="$ans";;
4633 esac
4634
4635 : compute shared library extension
4636 case "$so" in
4637 '')
4638         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4639                 dflt='sl'
4640         else
4641                 dflt='so'
4642         fi
4643         ;;
4644 *) dflt="$so";;
4645 esac
4646 $cat <<EOM
4647
4648 On some systems, shared libraries may be available.  Answer 'none' if
4649 you want to suppress searching of shared libraries for the remainder
4650 of this configuration.
4651
4652 EOM
4653 rp='What is the file extension used for shared libraries?'
4654 . ./myread
4655 so="$ans"
4656
4657 : Define several unixisms.
4658 : Hints files or command line option can be used to override them.
4659 : The convoluted testing is in case hints files set either the old
4660 : or the new name.
4661 case "$_exe" in
4662 '')     case "$exe_ext" in
4663         '')     ;;
4664         *)      _exe="$exe_ext" ;;
4665         esac
4666         ;;
4667 esac
4668 case "$_a" in
4669 '')     case "$lib_ext" in
4670     '') _a='.a';;
4671         *)      _a="$lib_ext" ;;
4672         esac
4673         ;;
4674 esac
4675 case "$_o" in
4676 '') case "$obj_ext" in
4677         '')     _o='.o';;
4678         *)      _o="$obj_ext";;
4679         esac
4680         ;;
4681 esac
4682 case "$p_" in
4683 '') case "$path_sep" in
4684         '')     p_=':';;
4685         *)      p_="$path_sep";;
4686         esac
4687         ;;
4688 esac
4689 exe_ext=$_exe
4690 lib_ext=$_a
4691 obj_ext=$_o
4692 path_sep=$p_
4693
4694 : Which makefile gets called first.  This is used by make depend.
4695 case "$firstmakefile" in
4696 '') firstmakefile='makefile';;
4697 esac
4698
4699 case "$ccflags" in
4700 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4701 esac
4702
4703 case "$uselongdouble" in
4704 $define|true|[yY]*)     dflt='y';;
4705 *) dflt='n';;
4706 esac
4707 cat <<EOM
4708
4709 Perl can be built to take advantage of long doubles which
4710 (if available) may give more accuracy and range for floating point numbers.
4711
4712 If this doesn't make any sense to you, just accept the default '$dflt'.
4713 EOM
4714 rp='Try to use long doubles if available?'
4715 . ./myread
4716 case "$ans" in
4717 y|Y)    val="$define"   ;;
4718 *)      val="$undef"    ;;
4719 esac
4720 set uselongdouble
4721 eval $setvar
4722
4723 case "$uselongdouble" in
4724 true|[yY]*) uselongdouble="$define" ;;
4725 esac
4726
4727 : Look for a hint-file generated 'call-back-unit'.  If the
4728 : user has specified that long doubles should be used,
4729 : we may need to set or change some other defaults.
4730 if $test -f uselongdouble.cbu; then
4731     echo "Your platform has some specific hints regarding long doubles, using them..."
4732     . ./uselongdouble.cbu
4733 else
4734     case "$uselongdouble" in
4735         $define)
4736                 $cat <<EOM
4737 (Your platform does not have any specific hints for long doubles.)
4738 EOM
4739         ;;
4740     esac
4741 fi
4742
4743 : Looking for optional libraries
4744 echo " "
4745 echo "Checking for optional libraries..." >&4
4746 case "$libs" in
4747 ' '|'') dflt='';;
4748 *) dflt="$libs";;
4749 esac
4750 case "$libswanted" in
4751 '') libswanted='c_s';;
4752 esac
4753 case "$usesocks" in
4754 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4755 esac
4756 libsfound=''
4757 libsfiles=''
4758 libsdirs=''
4759 libspath=''
4760 for thisdir in $libpth $xlibpth; do
4761   test -d $thisdir && libspath="$libspath $thisdir"
4762 done
4763 for thislib in $libswanted; do
4764         for thisdir in $libspath; do
4765             xxx=''
4766             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4767                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4768                 $test -f "$xxx" && eval $libscheck
4769                 $test -f "$xxx" && libstyle=shared
4770             fi
4771             if test ! -f "$xxx"; then
4772                 xxx=$thisdir/lib$thislib.$so
4773                 $test -f "$xxx" && eval $libscheck
4774                 $test -f "$xxx" && libstyle=shared
4775             fi  
4776             if test ! -f "$xxx"; then
4777                 xxx=$thisdir/lib$thislib$_a
4778                 $test -f "$xxx" && eval $libscheck
4779                 $test -f "$xxx" && libstyle=static
4780             fi
4781             if test ! -f "$xxx"; then
4782                 xxx=$thisdir/$thislib$_a
4783                 $test -f "$xxx" && eval $libscheck
4784                 $test -f "$xxx" && libstyle=static
4785             fi
4786             if test ! -f "$xxx"; then
4787                 xxx=$thisdir/lib${thislib}_s$_a
4788                 $test -f "$xxx" && eval $libscheck
4789                 $test -f "$xxx" && libstyle=static
4790                 $test -f "$xxx" && thislib=${thislib}_s
4791             fi
4792             if test ! -f "$xxx"; then
4793                 xxx=$thisdir/Slib$thislib$_a
4794                 $test -f "$xxx" && eval $libscheck
4795                 $test -f "$xxx" && libstyle=static
4796             fi
4797             if $test -f "$xxx"; then
4798                 case "$libstyle" in
4799                 shared) echo "Found -l$thislib (shared)." ;;
4800                 static) echo "Found -l$thislib." ;;
4801                 *)      echo "Found -l$thislib ($libstyle)." ;;
4802                 esac
4803                 case " $dflt " in
4804                 *"-l$thislib "*);;
4805                 *) dflt="$dflt -l$thislib"
4806                    libsfound="$libsfound $xxx"
4807                    yyy=`basename $xxx`
4808                    libsfiles="$libsfiles $yyy"
4809                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4810                    case " $libsdirs " in
4811                    *" $yyy "*) ;;
4812                    *) libsdirs="$libsdirs $yyy" ;;
4813                    esac
4814                    ;;
4815                 esac
4816                 break
4817             fi  
4818         done
4819         if $test ! -f "$xxx"; then
4820             echo "No -l$thislib."
4821         fi
4822 done
4823 set X $dflt
4824 shift
4825 dflt="$*"
4826 case "$libs" in
4827 '') dflt="$dflt";;
4828 *) dflt="$libs";;
4829 esac
4830 case "$dflt" in
4831 ' '|'') dflt='none';;
4832 esac
4833
4834 $cat <<EOM
4835
4836 In order to compile $package on your machine, a number of libraries
4837 are usually needed.  Include any other special libraries here as well.
4838 Say "none" for none.  The default list is almost always right.
4839 EOM
4840
4841 echo " "
4842 rp="What libraries to use?"
4843 . ./myread
4844 case "$ans" in
4845 none) libs=' ';;
4846 *) libs="$ans";;
4847 esac
4848
4849 : determine optimization, if desired, or use for debug flag also
4850 case "$optimize" in
4851 ' '|$undef) dflt='none';;
4852 '') dflt='-O';;
4853 *) dflt="$optimize";;
4854 esac
4855 $cat <<EOH
4856
4857 By default, $package compiles with the -O flag to use the optimizer.
4858 Alternately, you might want to use the symbolic debugger, which uses
4859 the -g flag (on traditional Unix systems).  Either flag can be
4860 specified here.  To use neither flag, specify the word "none".
4861
4862 EOH
4863 rp="What optimizer/debugger flag should be used?"
4864 . ./myread
4865 optimize="$ans"
4866 case "$optimize" in
4867 'none') optimize=" ";;
4868 esac
4869
4870 : Check what DEBUGGING is required from the command line
4871 : -DEBUGGING      or -DDEBUGGING or
4872 : -DEBUGGING=both                       = -g + -DDEBUGGING
4873 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4874 : -DEBUGGING=none or -UDEBUGGING        =
4875 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4876 case "$EBUGGING" in
4877 '')     ;;
4878 *)      DEBUGGING=$EBUGGING ;;
4879 esac
4880
4881 case "$DEBUGGING" in
4882 -g|$define)
4883     case "$optimize" in
4884         *-g*) ;;
4885         *)    optimize="$optimize -g" ;;
4886     esac ;;
4887 none|$undef)
4888     case "$optimize" in
4889         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4890                 shift
4891                 optimize="$*"
4892                 ;;
4893     esac ;;
4894 esac
4895
4896 dflt=''
4897 case "$DEBUGGING" in
4898 both|$define) dflt='-DDEBUGGING'
4899 esac
4900
4901 : We will not override a previous value, but we might want to
4902 : augment a hint file
4903 case "$hint" in
4904 default|recommended)
4905         case "$gccversion" in
4906         1*) dflt="$dflt -fpcc-struct-return" ;;
4907         esac
4908         case "$optimize:$DEBUGGING" in
4909         *-g*:old) dflt="$dflt -DDEBUGGING";;
4910         esac
4911         case "$gccversion" in
4912         2*) if test -d /etc/conf/kconfig.d &&
4913                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4914                 then
4915                         # Interactive Systems (ISC) POSIX mode.
4916                         dflt="$dflt -posix"
4917                 fi
4918                 ;;
4919         esac
4920         case "$gccversion" in
4921         1*) ;;
4922         2.[0-8]*) ;;
4923         ?*)     echo " "
4924                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4925                 echo 'int main(void) { return 0; }' > gcctest.c
4926                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4927                         echo "Yes, it does." 2>&1
4928                         case "$ccflags" in
4929                         *strict-aliasing*)
4930                                 echo "Leaving current flags $ccflags alone." 2>&1
4931                                 ;;
4932                         *) dflt="$dflt -fno-strict-aliasing" ;;
4933                         esac
4934                 else
4935                         echo "Nope, it doesn't, but that's ok." 2>&1
4936                 fi
4937                 ;;
4938         esac
4939         # For gcc, adding -pipe speeds up compilations for some, but apparently
4940         # some assemblers can't read from stdin.  (It also slows down compilations
4941         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4942         case "$gccversion" in
4943         ?*)     echo " "
4944                 echo "Checking if your compiler accepts -pipe" 2>&1
4945                 echo 'int main(void) { return 0; }' > gcctest.c
4946                 if $cc -pipe -o gcctest gcctest.c; then
4947                         echo "Yes, it does." 2>&1
4948                         case "$ccflags" in
4949                         *-pipe*)
4950                                 echo "Leaving current flags $ccflags alone." 2>&1
4951                                 ;;
4952                         *) dflt="$dflt -pipe" ;;
4953                         esac
4954                 else
4955                         echo "Nope, it doesn't, but that's ok." 2>&1
4956                 fi
4957                 ;;
4958         esac
4959         ;;
4960 esac
4961
4962 case "$mips_type" in
4963 *BSD*|'') inclwanted="$locincpth $usrinc";;
4964 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4965 esac
4966 for thisincl in $inclwanted; do
4967         if $test -d $thisincl; then
4968                 if $test x$thisincl != x$usrinc; then
4969                         case "$dflt" in
4970                         *" -I$thisincl "*);;
4971                         *) dflt="$dflt -I$thisincl ";;
4972                         esac
4973                 fi
4974         fi
4975 done
4976
4977 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4978         xxx=true;
4979 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4980         xxx=true;
4981 else
4982         xxx=false;
4983 fi;
4984 if $xxx; then
4985         case "$dflt" in
4986         *$2*);;
4987         *) dflt="$dflt -D$2";;
4988         esac;
4989 fi'
4990
4991 set signal.h LANGUAGE_C; eval $inctest
4992
4993 case "$usesocks" in
4994 $define)
4995         ccflags="$ccflags -DSOCKS"
4996         ;;
4997 esac
4998
4999 case "$hint" in
5000 default|recommended) dflt="$ccflags $dflt" ;;
5001 *) dflt="$ccflags";;
5002 esac
5003
5004 case "$dflt" in
5005 ''|' ') dflt=none;;
5006 esac
5007
5008 $cat <<EOH
5009
5010 Your C compiler may want other flags.  For this question you should include
5011 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5012 but you should NOT include libraries or ld flags like -lwhatever.  If you
5013 want $package to honor its debug switch, you should include -DDEBUGGING here.
5014 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5015
5016 To use no flags, specify the word "none".
5017
5018 EOH
5019 set X $dflt
5020 shift
5021 dflt=${1+"$@"}
5022 rp="Any additional cc flags?"
5023 . ./myread
5024 case "$ans" in
5025 none) ccflags='';;
5026 *) ccflags="$ans";;
5027 esac
5028
5029 : the following weeds options from ccflags that are of no interest to cpp
5030 case "$cppflags" in
5031 '') cppflags="$ccflags" ;;
5032 *)  cppflags="$cppflags $ccflags" ;;
5033 esac
5034 case "$gccversion" in
5035 1*) cppflags="$cppflags -D__GNUC__"
5036 esac
5037 case "$mips_type" in
5038 '');;
5039 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5040 esac
5041 case "$cppflags" in
5042 '');;
5043 *)
5044         echo " "
5045         echo "Let me guess what the preprocessor flags are..." >&4
5046         set X $cppflags
5047         shift
5048         cppflags=''
5049         $cat >cpp.c <<'EOM'
5050 #define BLURFL foo
5051
5052 BLURFL xx LFRULB
5053 EOM
5054         previous=''
5055         for flag in $*
5056         do
5057                 case "$flag" in
5058                 -*) ftry="$flag";;
5059                 *) ftry="$previous $flag";;
5060                 esac
5061                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5062                         >cpp1.out 2>/dev/null && \
5063                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5064                         >cpp2.out 2>/dev/null && \
5065                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5066                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5067                 then
5068                         cppflags="$cppflags $ftry"
5069                         previous=''
5070                 else
5071                         previous="$flag"
5072                 fi
5073         done
5074         set X $cppflags
5075         shift
5076         cppflags=${1+"$@"}
5077         case "$cppflags" in
5078         *-*)  echo "They appear to be: $cppflags";;
5079         esac
5080         $rm -f cpp.c cpp?.out
5081         ;;
5082 esac
5083
5084 : flags used in final linking phase
5085 case "$ldflags" in
5086 '') if ./venix; then
5087                 dflt='-i -z'
5088         else
5089                 dflt=''
5090         fi
5091         case "$ccflags" in
5092         *-posix*) dflt="$dflt -posix" ;;
5093         esac
5094         ;;
5095 *) dflt="$ldflags";;
5096 esac
5097
5098 : Try to guess additional flags to pick up local libraries.
5099 for thislibdir in $libpth; do
5100         case " $loclibpth " in
5101         *" $thislibdir "*)
5102                 case "$dflt " in
5103                 *"-L$thislibdir "*) ;;
5104                 *)  dflt="$dflt -L$thislibdir" ;;
5105                 esac
5106                 ;;
5107         esac
5108 done
5109
5110 case "$dflt" in
5111 '') dflt='none' ;;
5112 esac
5113
5114 $cat <<EOH
5115
5116 Your C linker may need flags.  For this question you should
5117 include -L/whatever and any other flags used by the C linker, but you
5118 should NOT include libraries like -lwhatever.
5119
5120 Make sure you include the appropriate -L/path flags if your C linker
5121 does not normally search all of the directories you specified above,
5122 namely
5123         $libpth
5124 To use no flags, specify the word "none".
5125
5126 EOH
5127
5128 rp="Any additional ld flags (NOT including libraries)?"
5129 . ./myread
5130 case "$ans" in
5131 none) ldflags='';;
5132 *) ldflags="$ans";;
5133 esac
5134 rmlist="$rmlist pdp11"
5135
5136 : coherency check
5137 echo " "
5138 echo "Checking your choice of C compiler and flags for coherency..." >&4
5139 $cat > try.c <<'EOF'
5140 #include <stdio.h>
5141 int main() { printf("Ok\n"); return(0); }
5142 EOF
5143 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5144 shift
5145 $cat >try.msg <<'EOM'
5146 I've tried to compile and run the following simple program:
5147
5148 EOM
5149 $cat try.c >> try.msg
5150
5151 $cat >> try.msg <<EOM
5152
5153 I used the command:
5154
5155         $*
5156         $run ./try
5157
5158 and I got the following output:
5159
5160 EOM
5161 dflt=y
5162 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5163         if $sh -c "$run ./try" >>try.msg 2>&1; then
5164                 xxx=`$run ./try`
5165                 case "$xxx" in
5166                 "Ok") dflt=n ;;
5167                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5168                         case " $libs " in
5169                         *" -lsfio "*)
5170                                 cat >> try.msg <<'EOQS'
5171 If $libs contains -lsfio, and sfio is mis-configured, then it
5172 sometimes (apparently) runs and exits with a 0 status, but with no
5173 output!  It may have to do with sfio's use of _exit vs. exit.
5174
5175 EOQS
5176                                 rp="You have a big problem.  Shall I abort Configure"
5177                                 dflt=y
5178                                 ;;
5179                         esac
5180                         ;;
5181                 esac
5182         else
5183                 echo "The program compiled OK, but exited with status $?." >>try.msg
5184                 rp="You have a problem.  Shall I abort Configure"
5185                 dflt=y
5186         fi
5187 else
5188         echo "I can't compile the test program." >>try.msg
5189         rp="You have a BIG problem.  Shall I abort Configure"
5190         dflt=y
5191 fi
5192 case "$dflt" in
5193 y)
5194         $cat try.msg >&4
5195         case "$knowitall" in
5196         '')
5197                 echo "(The supplied flags or libraries might be incorrect.)"
5198                 ;;
5199         *) dflt=n;;
5200         esac
5201         echo " "
5202         . ./myread
5203         case "$ans" in
5204         n*|N*) ;;
5205         *)      echo "Ok.  Stopping Configure." >&4
5206                 exit 1
5207                 ;;
5208         esac
5209         ;;
5210 n) echo "OK, that should do.";;
5211 esac
5212 $rm -f try try.* core
5213
5214 : define a shorthand compile call
5215 compile='
5216 mc_file=$1;
5217 shift;
5218 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5219 : define a shorthand compile call for compilations that should be ok.
5220 compile_ok='
5221 mc_file=$1;
5222 shift;
5223 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5224
5225 : determine filename position in cpp output
5226 echo " "
5227 echo "Computing filename position in cpp output for #include directives..." >&4
5228 case "$osname" in
5229 vos) testaccess=-e ;;
5230 *)   testaccess=-r ;;
5231 esac
5232 echo '#include <stdio.h>' > foo.c
5233 $cat >fieldn <<EOF
5234 $startsh
5235 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5236 $grep '^[       ]*#.*stdio\.h' | \
5237 while read cline; do
5238         pos=1
5239         set \$cline
5240         while $test \$# -gt 0; do
5241                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5242                         echo "\$pos"
5243                         exit 0
5244                 fi
5245                 shift
5246                 pos=\`expr \$pos + 1\`
5247         done
5248 done
5249 EOF
5250 chmod +x fieldn
5251 fieldn=`./fieldn`
5252 $rm -f foo.c fieldn
5253 case $fieldn in
5254 '') pos='???';;
5255 1) pos=first;;
5256 2) pos=second;;
5257 3) pos=third;;
5258 *) pos="${fieldn}th";;
5259 esac
5260 echo "Your cpp writes the filename in the $pos field of the line."
5261
5262 case "$osname" in
5263 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5264 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5265 *)   cppfilter='' ;;
5266 esac
5267 : locate header file
5268 $cat >findhdr <<EOF
5269 $startsh
5270 wanted=\$1
5271 name=''
5272 for usrincdir in $usrinc
5273 do
5274         if test -f \$usrincdir/\$wanted; then
5275                 echo "\$usrincdir/\$wanted"
5276                 exit 0
5277         fi
5278 done
5279 awkprg='{ print \$$fieldn }'
5280 echo "#include <\$wanted>" > foo\$\$.c
5281 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5282 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5283 while read cline; do
5284         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5285         case "\$name" in
5286         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5287         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5288         *) exit 2;;
5289         esac;
5290 done;
5291 #
5292 # status = 0: grep returned 0 lines, case statement not executed
5293 # status = 1: headerfile found
5294 # status = 2: while loop executed, no headerfile found
5295 #
5296 status=\$?
5297 $rm -f foo\$\$.c;
5298 if test \$status -eq 1; then
5299         exit 0;
5300 fi
5301 exit 1
5302 EOF
5303 chmod +x findhdr
5304
5305 : define an alternate in-header-list? function
5306 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5307 cont=true; xxf="echo \"<\$1> found.\" >&4";
5308 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5309 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5310 esac;
5311 case $# in 4) instead=instead;; *) instead="at last";; esac;
5312 while $test "$cont"; do
5313         xxx=`./findhdr $1`
5314         var=$2; eval "was=\$$2";
5315         if $test "$xxx" && $test -r "$xxx";
5316         then eval $xxf;
5317         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5318                 cont="";
5319         else eval $xxnf;
5320         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5321         set $yyy; shift; shift; yyy=$@;
5322         case $# in 0) cont="";;
5323         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5324                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5325         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5326                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5327         esac;
5328 done;
5329 while $test "$yyy";
5330 do set $yyy; var=$2; eval "was=\$$2";
5331         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5332         set $yyy; shift; shift; yyy=$@;
5333 done'
5334
5335 : see if stdlib is available
5336 set stdlib.h i_stdlib
5337 eval $inhdr
5338
5339 : check for lengths of integral types
5340 echo " "
5341 case "$intsize" in
5342 '')
5343         echo "Checking to see how big your integers are..." >&4
5344         $cat >try.c <<EOCP
5345 #include <stdio.h>
5346 #$i_stdlib I_STDLIB
5347 #ifdef I_STDLIB
5348 #include <stdlib.h>
5349 #endif
5350 int main()
5351 {
5352         printf("intsize=%d;\n", (int)sizeof(int));
5353         printf("longsize=%d;\n", (int)sizeof(long));
5354         printf("shortsize=%d;\n", (int)sizeof(short));
5355         exit(0);
5356 }
5357 EOCP
5358         set try
5359         if eval $compile_ok && $run ./try > /dev/null; then
5360                 eval `$run ./try`
5361                 echo "Your integers are $intsize bytes long."
5362                 echo "Your long integers are $longsize bytes long."
5363                 echo "Your short integers are $shortsize bytes long."
5364         else
5365                 $cat >&4 <<EOM
5366 !
5367 Help! I can't compile and run the intsize test program: please enlighten me!
5368 (This is probably a misconfiguration in your system or libraries, and
5369 you really ought to fix it.  Still, I'll try anyway.)
5370 !
5371 EOM
5372                 dflt=4
5373                 rp="What is the size of an integer (in bytes)?"
5374                 . ./myread
5375                 intsize="$ans"
5376                 dflt=$intsize
5377                 rp="What is the size of a long integer (in bytes)?"
5378                 . ./myread
5379                 longsize="$ans"
5380                 dflt=2
5381                 rp="What is the size of a short integer (in bytes)?"
5382                 . ./myread
5383                 shortsize="$ans"
5384         fi
5385         ;;
5386 esac
5387 $rm -f try try.*
5388
5389 : check for long long
5390 echo " "
5391 echo "Checking to see if you have long long..." >&4
5392 echo 'int main() { long long x = 7; return 0; }' > try.c
5393 set try
5394 if eval $compile; then
5395         val="$define"
5396         echo "You have long long."
5397 else
5398         val="$undef"
5399         echo "You do not have long long."
5400 fi
5401 $rm try.*
5402 set d_longlong
5403 eval $setvar
5404
5405 : check for length of long long
5406 case "${d_longlong}${longlongsize}" in
5407 $define)
5408         echo " "
5409         echo "Checking to see how big your long longs are..." >&4
5410         $cat >try.c <<'EOCP'
5411 #include <stdio.h>
5412 int main()
5413 {
5414     printf("%d\n", (int)sizeof(long long));
5415     return(0);
5416 }
5417 EOCP
5418         set try
5419         if eval $compile_ok; then
5420                 longlongsize=`$run ./try`
5421                 echo "Your long longs are $longlongsize bytes long."
5422         else
5423                 dflt='8'
5424                 echo " "
5425                 echo "(I can't seem to compile the test program.  Guessing...)"
5426                 rp="What is the size of a long long (in bytes)?"
5427                 . ./myread
5428                 longlongsize="$ans"
5429         fi
5430         if $test "X$longsize" = "X$longlongsize"; then
5431                 echo "(That isn't any different from an ordinary long.)"
5432         fi      
5433         ;;
5434 esac
5435 $rm -f try.* try
5436
5437 : see if inttypes.h is available
5438 : we want a real compile instead of Inhdr because some systems
5439 : have an inttypes.h which includes non-existent headers
5440 echo " "
5441 $cat >try.c <<EOCP
5442 #include <inttypes.h>
5443 int main() {
5444         static int32_t foo32 = 0x12345678;
5445 }
5446 EOCP
5447 set try
5448 if eval $compile; then
5449         echo "<inttypes.h> found." >&4
5450         val="$define"
5451 else
5452         echo "<inttypes.h> NOT found." >&4
5453         val="$undef"
5454 fi
5455 $rm -f try.c try
5456 set i_inttypes
5457 eval $setvar
5458
5459 : check for int64_t
5460 echo " "
5461 echo "Checking to see if you have int64_t..." >&4
5462 $cat >try.c <<EOCP
5463 #include <sys/types.h>
5464 #$i_inttypes I_INTTYPES
5465 #ifdef I_INTTYPES
5466 #include <inttypes.h>
5467 #endif
5468 int main() { int64_t x = 7; }
5469 EOCP
5470 set try
5471 if eval $compile; then
5472         val="$define"
5473         echo "You have int64_t."
5474 else
5475         val="$undef"
5476         echo "You do not have int64_t."
5477 fi
5478 $rm -f try try.*
5479 set d_int64_t
5480 eval $setvar
5481
5482
5483 echo " "
5484 echo "Checking which 64-bit integer type we could use..." >&4
5485
5486 case "$intsize" in
5487 8) val=int
5488    set quadtype
5489    eval $setvar
5490    val='"unsigned int"'
5491    set uquadtype
5492    eval $setvar
5493    quadkind=1
5494    ;;
5495 *) case "$longsize" in
5496    8) val=long
5497       set quadtype
5498       eval $setvar
5499       val='"unsigned long"'
5500       set uquadtype
5501       eval $setvar
5502       quadkind=2
5503       ;;
5504    *) case "$d_longlong:$longlongsize" in
5505       define:8)
5506         val='"long long"'
5507         set quadtype
5508         eval $setvar
5509         val='"unsigned long long"'
5510         set uquadtype
5511         eval $setvar
5512         quadkind=3
5513         ;;
5514       *) case "$d_int64_t" in
5515          define)
5516            val=int64_t
5517            set quadtype
5518            eval $setvar
5519            val=uint64_t
5520            set uquadtype
5521            eval $setvar
5522            quadkind=4
5523            ;;
5524          esac
5525          ;;
5526       esac
5527       ;;
5528    esac
5529    ;;
5530 esac
5531
5532 case "$quadtype" in
5533 '')     echo "Alas, no 64-bit integer types in sight." >&4
5534         d_quad="$undef"
5535         ;;
5536 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5537         d_quad="$define"
5538         ;;
5539 esac
5540
5541
5542 case "$uselonglong" in
5543 "$define"|true|[yY]*)
5544         cat <<EOM >&4
5545
5546 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5547 EOM
5548         use64bitint="$define"
5549         ;;
5550 esac                          
5551 case "$use64bits" in
5552 "$define"|true|[yY]*)
5553         cat <<EOM >&4
5554
5555 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5556 EOM
5557         use64bitint="$define"
5558         ;;
5559 esac                          
5560 case "$use64bitints" in
5561 "$define"|true|[yY]*)
5562         cat <<EOM >&4
5563
5564 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5565 EOM
5566         use64bitint="$define"
5567         ;;
5568 esac                          
5569 case "$use64bitsint" in
5570 "$define"|true|[yY]*)
5571         cat <<EOM >&4
5572
5573 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5574 EOM
5575         use64bitint="$define"
5576         ;;
5577 esac                          
5578 case "$uselonglongs" in
5579 "$define"|true|[yY]*)
5580         cat <<EOM >&4
5581
5582 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5583 EOM
5584         use64bitint="$define"
5585         ;;
5586 esac                          
5587 case "$use64bitsall" in
5588 "$define"|true|[yY]*)
5589         cat <<EOM >&4
5590
5591 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5592 EOM
5593         use64bitall="$define"
5594         ;;
5595 esac                          
5596
5597 case "$ccflags" in
5598 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5599 esac
5600 case "$use64bitall" in
5601 "$define"|true|[yY]*) use64bitint="$define" ;;
5602 esac
5603
5604 case "$longsize" in
5605 8) cat <<EOM
5606
5607 You have natively 64-bit long integers.
5608 EOM
5609    val="$define"
5610    ;;
5611 *) case "$use64bitint" in
5612    "$define"|true|[yY]*) dflt='y';;
5613    *) dflt='n';;
5614    esac
5615    case "$d_quad" in
5616    "$define") ;;
5617    *) dflt='n' ;;
5618    esac
5619    cat <<EOM
5620
5621 Perl can be built to take advantage of 64-bit integer types
5622 on some systems.  To do so, Configure can be run with -Duse64bitint.
5623 Choosing this option will most probably introduce binary incompatibilities.
5624
5625 If this doesn't make any sense to you, just accept the default '$dflt'.
5626 (The default has been chosen based on your configuration.)
5627 EOM
5628    rp='Try to use 64-bit integers, if available?'
5629    . ./myread
5630    case "$ans" in
5631    [yY]*) val="$define" ;;
5632    *)     val="$undef"  ;;
5633    esac
5634    ;;
5635 esac
5636 set use64bitint
5637 eval $setvar
5638
5639 case "$use64bitall" in
5640 "$define"|true|[yY]*) dflt='y' ;;
5641 *) case "$longsize" in
5642    8) dflt='y' ;;
5643    *) dflt='n' ;;
5644    esac
5645    ;;
5646 esac    
5647 cat <<EOM
5648
5649 You may also choose to try maximal 64-bitness.  It means using as much
5650 64-bitness as possible on the platform.  This in turn means even more
5651 binary incompatibilities.  On the other hand, your platform may not
5652 have any more 64-bitness available than what you already have chosen.
5653
5654 If this doesn't make any sense to you, just accept the default '$dflt'.
5655 (The default has been chosen based on your configuration.)
5656 EOM
5657 rp='Try to use maximal 64-bit support, if available?'
5658 . ./myread
5659 case "$ans" in
5660 [yY]*) val="$define" ;;
5661 *)     val="$undef"  ;;
5662 esac
5663 set use64bitall
5664 eval $setvar
5665 case "$use64bitall" in
5666 "$define")
5667         case "$use64bitint" in
5668         "$undef")
5669                 cat <<EOM
5670
5671 Since you have chosen a maximally 64-bit build, I'm also turning on
5672 the use of 64-bit integers.
5673 EOM
5674                 use64bitint="$define" ;;
5675         esac
5676         ;;
5677 esac
5678
5679 : Look for a hint-file generated 'call-back-unit'.  If the
5680 : user has specified that a 64-bit perl is to be built,
5681 : we may need to set or change some other defaults.
5682 if $test -f use64bitint.cbu; then
5683         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5684         . ./use64bitint.cbu
5685 fi
5686 case "$use64bitint" in
5687 "$define"|true|[yY]*)
5688         case "$longsize" in
5689         4) case "$archname64" in
5690            '') archname64=64int ;;
5691            esac
5692            ;;
5693         esac
5694         ;;
5695 esac
5696
5697 : Look for a hint-file generated 'call-back-unit'.  If the
5698 : user has specified that a maximally 64-bit perl is to be built,
5699 : we may need to set or change some other defaults.
5700 if $test -f use64bitall.cbu; then
5701         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5702         . ./use64bitall.cbu
5703 fi
5704 case "$use64bitall" in
5705 "$define"|true|[yY]*)
5706         case "$longsize" in
5707         4) case "$archname64" in
5708            ''|64int) archname64=64all ;;
5709            esac
5710            ;;
5711         esac
5712         ;;
5713 esac
5714
5715 case "$d_quad:$use64bitint" in
5716 $undef:$define)
5717         cat >&4 <<EOF
5718
5719 *** You have chosen to use 64-bit integers,
5720 *** but none can be found.
5721 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5722 *** Cannot continue, aborting.
5723
5724 EOF
5725         exit 1
5726         ;;
5727 esac
5728
5729 : check for length of double
5730 echo " "
5731 case "$doublesize" in
5732 '')
5733         echo "Checking to see how big your double precision numbers are..." >&4
5734         $cat >try.c <<EOCP
5735 #include <stdio.h>
5736 #$i_stdlib I_STDLIB
5737 #ifdef I_STDLIB
5738 #include <stdlib.h>
5739 #endif
5740 int main()
5741 {
5742     printf("%d\n", (int)sizeof(double));
5743     exit(0);
5744 }
5745 EOCP
5746         set try
5747         if eval $compile_ok; then
5748                 doublesize=`$run ./try`
5749                 echo "Your double is $doublesize bytes long."
5750         else
5751                 dflt='8'
5752                 echo "(I can't seem to compile the test program.  Guessing...)"
5753                 rp="What is the size of a double precision number (in bytes)?"
5754                 . ./myread
5755                 doublesize="$ans"
5756         fi
5757         ;;
5758 esac
5759 $rm -f try.c try
5760
5761 : check for long doubles
5762 echo " "
5763 echo "Checking to see if you have long double..." >&4
5764 echo 'int main() { long double x = 7.0; }' > try.c
5765 set try
5766 if eval $compile; then
5767         val="$define"
5768         echo "You have long double."
5769 else
5770         val="$undef"
5771         echo "You do not have long double."
5772 fi
5773 $rm try.*
5774 set d_longdbl
5775 eval $setvar
5776
5777 : check for length of long double
5778 case "${d_longdbl}${longdblsize}" in
5779 $define)
5780         echo " "
5781         echo "Checking to see how big your long doubles are..." >&4
5782         $cat >try.c <<'EOCP'
5783 #include <stdio.h>
5784 int main()
5785 {
5786         printf("%d\n", sizeof(long double));
5787 }
5788 EOCP
5789         set try
5790         set try
5791         if eval $compile; then
5792                 longdblsize=`$run ./try`
5793                 echo "Your long doubles are $longdblsize bytes long."
5794         else
5795                 dflt='8'
5796                 echo " "
5797                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5798                 rp="What is the size of a long double (in bytes)?"
5799                 . ./myread
5800                 longdblsize="$ans"
5801         fi
5802         if $test "X$doublesize" = "X$longdblsize"; then
5803                 echo "That isn't any different from an ordinary double."
5804                 echo "I'll keep your setting anyway, but you may see some"
5805                 echo "harmless compilation warnings."
5806         fi      
5807         ;;
5808 esac
5809 $rm -f try.* try
5810
5811 : determine the architecture name
5812 echo " "
5813 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5814         tarch=`arch`"-$osname"
5815 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5816         if uname -m > tmparch 2>&1 ; then
5817                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5818                         -e 's/$/'"-$osname/" tmparch`
5819         else
5820                 tarch="$osname"
5821         fi
5822         $rm -f tmparch
5823 else
5824         tarch="$osname"
5825 fi
5826 case "$myarchname" in
5827 ''|"$tarch") ;;
5828 *)
5829         echo "(Your architecture name used to be $myarchname.)"
5830         archname=''
5831         ;;
5832 esac
5833 case "$targetarch" in
5834 '') ;;
5835 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5836 esac
5837 myarchname="$tarch"
5838 case "$archname" in
5839 '') dflt="$tarch";;
5840 *) dflt="$archname";;
5841 esac
5842 rp='What is your architecture name'
5843 . ./myread
5844 archname="$ans"
5845 case "$usethreads" in
5846 $define)
5847         echo "Threads selected." >&4
5848         case "$archname" in
5849         *-thread*) echo "...and architecture name already has -thread." >&4
5850                 ;;
5851         *)      archname="$archname-thread"
5852                 echo "...setting architecture name to $archname." >&4
5853                 ;;
5854         esac
5855         ;;
5856 esac
5857 case "$usemultiplicity" in
5858 $define)
5859         echo "Multiplicity selected." >&4
5860         case "$archname" in
5861         *-multi*) echo "...and architecture name already has -multi." >&4
5862                 ;;
5863         *)      archname="$archname-multi"
5864                 echo "...setting architecture name to $archname." >&4
5865                 ;;
5866         esac
5867         ;;
5868 esac
5869 case "$use64bitint$use64bitall" in
5870 *"$define"*)
5871         case "$archname64" in
5872         '')
5873                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5874                 ;;
5875         *)
5876                 case "$use64bitint" in
5877                 "$define") echo "64 bit integers selected." >&4 ;;
5878                 esac
5879                 case "$use64bitall" in
5880                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5881                 esac
5882                 case "$archname" in
5883                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5884                         ;;
5885                 *)      archname="$archname-$archname64"
5886                         echo "...setting architecture name to $archname." >&4
5887                         ;;
5888                 esac
5889                 ;;
5890         esac
5891 esac
5892 case "$uselongdouble" in
5893 $define)
5894         echo "Long doubles selected." >&4
5895         case "$longdblsize" in
5896         $doublesize)
5897                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5898                 ;;
5899         *)
5900                 case "$archname" in
5901                 *-ld*) echo "...and architecture name already has -ld." >&4
5902                         ;;
5903                 *)      archname="$archname-ld"
5904                         echo "...setting architecture name to $archname." >&4
5905                         ;;
5906                 esac
5907                 ;;
5908         esac
5909         ;;
5910 esac
5911 case "$useperlio" in
5912 $define)
5913         echo "Perlio selected." >&4
5914         ;;
5915 *)
5916         echo "Perlio not selected, using stdio." >&4
5917         case "$archname" in
5918         *-stdio*) echo "...and architecture name already has -stdio." >&4
5919                 ;;
5920         *)      archname="$archname-stdio"
5921                 echo "...setting architecture name to $archname." >&4
5922                 ;;
5923         esac
5924         ;;
5925 esac
5926 if $test -f archname.cbu; then
5927         echo "Your platform has some specific hints for architecture name, using them..."
5928         . ./archname.cbu
5929 fi
5930
5931 : set the prefixit variable, to compute a suitable default value
5932 prefixit='case "$3" in
5933 ""|none)
5934         case "$oldprefix" in
5935         "") eval "$1=\"\$$2\"";;
5936         *)
5937                 case "$3" in
5938                 "") eval "$1=";;
5939                 none)
5940                         eval "tp=\"\$$2\"";
5941                         case "$tp" in
5942                         ""|" ") eval "$1=\"\$$2\"";;
5943                         *) eval "$1=";;
5944                         esac;;
5945                 esac;;
5946         esac;;
5947 *)
5948         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5949         case "$tp" in
5950         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5951         /*-$oldprefix/*|\~*-$oldprefix/*)
5952                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5953         *) eval "$1=\"\$$2\"";;
5954         esac;;
5955 esac'
5956
5957 : get the patchlevel
5958 echo " "
5959 echo "Getting the current patchlevel..." >&4
5960 if $test -r $rsrc/patchlevel.h;then
5961         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5962         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5963         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5964         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5965         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5966         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5967         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5968 else
5969         revision=0
5970         patchlevel=0
5971         subversion=0
5972         api_revision=0
5973         api_version=0
5974         api_subversion=0
5975         perl_patchlevel=0
5976         $echo "(You do not have patchlevel.h.  Eek.)"
5977 fi
5978 if $test -r $rsrc/.patch ; then
5979         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5980                 perl_patchlevel=`cat $rsrc/.patch`
5981         fi
5982 fi
5983 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5984 version_patchlevel_string="version $patchlevel subversion $subversion"
5985 case "$perl_patchlevel" in
5986 0|'') ;;
5987 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5988 esac
5989
5990 $echo "(You have $package $version_patchlevel_string.)"
5991
5992 case "$osname" in
5993 dos|vms)
5994         : XXX Should be a Configure test for double-dots in filenames.
5995         version=`echo $revision $patchlevel $subversion | \
5996                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5997         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5998                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5999         ;;
6000 *)
6001         version=`echo $revision $patchlevel $subversion | \
6002                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6003         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6004                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6005         ;;
6006 esac
6007 : Special case the 5.005_xx maintenance series, which used 5.005
6008 : without any subversion label as a subdirectory in $sitelib
6009 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6010         api_versionstring='5.005'
6011 fi
6012
6013 : determine installation style
6014 : For now, try to deduce it from prefix unless it is already set.
6015 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6016 case "$installstyle" in
6017 '')     case "$prefix" in
6018                 *perl*) dflt='lib';;
6019                 *) dflt='lib/perl5' ;;
6020         esac
6021         ;;
6022 *)      dflt="$installstyle" ;;
6023 esac
6024 : Probably not worth prompting for this since we prompt for all
6025 : the directories individually, and the prompt would be too long and
6026 : confusing anyway.
6027 installstyle=$dflt
6028
6029 : determine where public executables go
6030 echo " "
6031 set dflt bin bin
6032 eval $prefixit
6033 fn=d~
6034 rp='Pathname where the public executables will reside?'
6035 . ./getfile
6036 if $test "X$ansexp" != "X$binexp"; then
6037         installbin=''
6038 fi
6039 prefixvar=bin
6040 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6041 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6042 :     this via initialinstalllocation
6043 . ./setprefixvar
6044
6045 case "$userelocatableinc" in
6046 $define|true|[yY]*)     dflt='y' ;;
6047 *)                      dflt='n' ;;
6048 esac
6049 cat <<EOM
6050
6051 Would you like to build Perl so that the installation is relocatable, so that
6052 library paths in @INC are determined relative to the path of the perl binary?
6053 This is not advised for system Perl installs, or if you need to run setid
6054 scripts or scripts under taint mode.
6055
6056 If this doesn't make any sense to you, just accept the default '$dflt'.
6057 EOM
6058 rp='Use relocatable @INC?'
6059 . ./myread
6060 case "$ans" in
6061 y|Y)    val="$define" ;;
6062 *)      val="$undef"  ;;
6063 esac
6064 set userelocatableinc
6065 eval $setvar
6066
6067 initialinstalllocation="$binexp"
6068 : Default prefix is now "up one level from where the binaries are"
6069 case "$userelocatableinc" in
6070 $define|true|[yY]*)
6071     bin=".../"
6072     binexp=".../"
6073     prefix=".../.."
6074     prefixexp=".../.."
6075     installprefixexp=".../.."
6076     ;;
6077 esac
6078
6079 : determine where private library files go
6080 : Usual default is /usr/local/lib/perl5/$version.
6081 : Also allow things like /opt/perl/lib/$version, since
6082 : /opt/perl/lib/perl5... would be redundant.
6083 : The default "style" setting is made in installstyle.U
6084 case "$installstyle" in
6085 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6086 *)       set dflt privlib lib/$version ;;
6087 esac
6088 eval $prefixit
6089 $cat <<EOM
6090
6091 There are some auxiliary files for $package that need to be put into a
6092 private library directory that is accessible by everyone.
6093
6094 EOM
6095 fn=$binexp
6096 fn=d~+
6097 rp='Pathname where the private library files will reside?'
6098 . ./getfile
6099 prefixvar=privlib
6100 . ./setprefixvar
6101
6102 : set the prefixup variable, to restore leading tilda escape
6103 prefixup='case "$prefixexp" in
6104 "$prefix") ;;
6105 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6106 esac'
6107
6108 : determine where public architecture dependent libraries go
6109 set archlib archlib
6110 eval $prefixit
6111 : privlib default is /usr/local/lib/$package/$version
6112 : archlib default is /usr/local/lib/$package/$version/$archname
6113 : privlib may have an optional trailing /share.
6114 tdflt=`echo $privlib | $sed 's,/share$,,'`
6115 tdflt=$tdflt/$archname
6116 case "$archlib" in
6117 '')     dflt=$tdflt
6118         ;;
6119 *)      dflt="$archlib"
6120     ;;
6121 esac
6122 $cat <<EOM
6123
6124 $spackage contains architecture-dependent library files.  If you are
6125 sharing libraries in a heterogeneous environment, you might store
6126 these files in a separate location.  Otherwise, you can just include
6127 them with the rest of the public library files.
6128
6129 EOM
6130 fn=$binexp
6131 fn=d+~
6132 rp='Where do you want to put the public architecture-dependent libraries?'
6133 . ./getfile
6134 prefixvar=archlib
6135 . ./setprefixvar
6136 if $test X"$archlib" = X"$privlib"; then
6137         d_archlib="$undef"
6138 else
6139         d_archlib="$define"
6140 fi
6141
6142 : see if setuid scripts can be secure
6143 $cat <<EOM
6144
6145 Some kernels have a bug that prevents setuid #! scripts from being
6146 secure.  Some sites have disabled setuid #! scripts because of this.
6147
6148 First let's decide if your kernel supports secure setuid #! scripts.
6149 (If setuid #! scripts would be secure but have been disabled anyway,
6150 don't say that they are secure if asked.)
6151
6152 EOM
6153
6154 val="$undef"
6155 if $test -d /dev/fd; then
6156         echo "#!$ls" >reflect
6157         chmod +x,u+s reflect
6158         ./reflect >flect 2>&1
6159         if $contains "/dev/fd" flect >/dev/null; then
6160                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6161                 val="$define"
6162         else
6163                 $cat <<EOM
6164 If you are not sure if they are secure, I can check but I'll need a
6165 username and password different from the one you are using right now.
6166 If you don't have such a username or don't want me to test, simply
6167 enter 'none'.
6168
6169 EOM
6170                 rp='Other username to test security of setuid scripts with?'
6171                 dflt='none'
6172                 . ./myread
6173                 case "$ans" in
6174                 n|none)
6175                         case "$d_suidsafe" in
6176                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6177                                 dflt=n;;
6178                         "$undef")
6179                                 echo "Well, the $hint value is *not* secure." >&4
6180                                 dflt=n;;
6181                         *)      echo "Well, the $hint value *is* secure." >&4
6182                                 dflt=y;;
6183                         esac
6184                         ;;
6185                 *)
6186                         $rm -f reflect flect
6187                         echo "#!$ls" >reflect
6188                         chmod +x,u+s reflect
6189                         echo >flect
6190                         chmod a+w flect
6191                         echo '"su" will (probably) prompt you for '"$ans's password."
6192                         su $ans -c './reflect >flect'
6193                         if $contains "/dev/fd" flect >/dev/null; then
6194                                 echo "Okay, it looks like setuid scripts are secure." >&4
6195                                 dflt=y
6196                         else
6197                                 echo "I don't think setuid scripts are secure." >&4
6198                                 dflt=n
6199                         fi
6200                         ;;
6201                 esac
6202                 rp='Does your kernel have *secure* setuid scripts?'
6203                 . ./myread
6204                 case "$ans" in
6205                 [yY]*)  val="$define";;
6206                 *)      val="$undef";;
6207                 esac
6208         fi
6209 else
6210         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6211         echo "(That's for file descriptors, not floppy disks.)"
6212         val="$undef"
6213 fi
6214 set d_suidsafe
6215 eval $setvar
6216
6217 $rm -f reflect flect
6218
6219 : now see if they want to do setuid emulation
6220 echo " "
6221 val="$undef"
6222 case "$d_suidsafe" in
6223 "$define")
6224         val="$undef"
6225         echo "No need to emulate SUID scripts since they are secure here." >&4
6226         ;;
6227 *)
6228         $cat <<EOM
6229 Some systems have disabled setuid scripts, especially systems where
6230 setuid scripts cannot be secure.  On systems where setuid scripts have
6231 been disabled, the setuid/setgid bits on scripts are currently
6232 useless.  It is possible for $package to detect those bits and emulate
6233 setuid/setgid in a secure fashion.  This emulation will only work if
6234 setuid scripts have been disabled in your kernel.
6235
6236 EOM
6237         case "$d_dosuid" in
6238         "$define") dflt=y ;;
6239         *) dflt=n ;;
6240         esac
6241         rp="Do you want to do setuid/setgid emulation?"
6242         . ./myread
6243         case "$ans" in
6244         [yY]*)  val="$define";;
6245         *)      val="$undef";;
6246         esac
6247         ;;
6248 esac
6249 set d_dosuid
6250 eval $setvar
6251
6252 : Find perl5.005 or later.
6253 echo "Looking for a previously installed perl5.005 or later... "
6254 case "$perl5" in
6255 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6256                 : Check if this perl is recent and can load a simple module
6257                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6258                         perl5=$tdir/perl
6259                         break;
6260                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6261                         perl5=$tdir/perl5
6262                         break;
6263                 fi
6264         done
6265         ;;
6266 *)      perl5="$perl5"
6267         ;;
6268 esac
6269 case "$perl5" in
6270 '')     echo "None found.  That's ok.";;
6271 *)      echo "Using $perl5." ;;
6272 esac
6273
6274 $cat <<EOM
6275
6276 After $package is installed, you may wish to install various
6277 add-on modules and utilities.  Typically, these add-ons will
6278 be installed under $prefix with the rest
6279 of this package.  However, you may wish to install such add-ons
6280 elsewhere under a different prefix.
6281
6282 If you do not wish to put everything under a single prefix, that's
6283 ok.  You will be prompted for the individual locations; this siteprefix
6284 is only used to suggest the defaults.
6285
6286 The default should be fine for most people.
6287
6288 EOM
6289 fn=d~+
6290 rp='Installation prefix to use for add-on modules and utilities?'
6291 : XXX Here might be another good place for an installstyle setting.
6292 case "$siteprefix" in
6293 '') dflt=$prefix ;;
6294 *)  dflt=$siteprefix ;;
6295 esac
6296 . ./getfile
6297 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6298 oldsiteprefix=''
6299 case "$siteprefix" in
6300 '') ;;
6301 *)      case "$ans" in
6302         "$prefix") ;;
6303         *) oldsiteprefix="$prefix";;
6304         esac
6305         ;;
6306 esac
6307 siteprefix="$ans"
6308 siteprefixexp="$ansexp"
6309
6310 : determine where site specific libraries go.
6311 : Usual default is /usr/local/lib/perl5/site_perl/$version
6312 : The default "style" setting is made in installstyle.U
6313 : XXX No longer works with Prefixit stuff.
6314 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6315 case "$sitelib" in
6316 '') case "$installstyle" in
6317         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6318         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6319         esac
6320         ;;
6321 *)      dflt="$sitelib"
6322         ;;
6323 esac
6324 $cat <<EOM
6325
6326 The installation process will create a directory for
6327 site-specific extensions and modules.  Most users find it convenient
6328 to place all site-specific files in this directory rather than in the
6329 main distribution directory.
6330
6331 EOM
6332 fn=d~+
6333 rp='Pathname for the site-specific library files?'
6334 . ./getfile
6335 prefixvar=sitelib
6336 . ./setprefixvar
6337 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6338
6339 : Determine list of previous versions to include in @INC
6340 $cat > getverlist <<EOPL
6341 #!$perl5 -w
6342 use File::Basename;
6343 \$api_versionstring = "$api_versionstring";
6344 \$version = "$version";
6345 \$stem = "$sitelib_stem";
6346 \$archname = "$archname";
6347 EOPL
6348         $cat >> getverlist <<'EOPL'
6349 # Can't have leading @ because metaconfig interprets it as a command!
6350 ;@inc_version_list=();
6351 # XXX Redo to do opendir/readdir?
6352 if (-d $stem) {
6353     chdir($stem);
6354     ;@candidates = glob("5.*");
6355 }
6356 else {
6357     ;@candidates = ();
6358 }
6359
6360 # XXX ToDo:  These comparisons must be reworked when two-digit
6361 # subversions come along, so that 5.7.10 compares as greater than
6362 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6363 # widespread that we can use the built-in version vectors rather
6364 # than reinventing them here.  For 5.6.0, however, we must
6365 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6366 foreach $d (@candidates) {
6367     if ($d lt $version) {
6368         if ($d ge $api_versionstring) {
6369             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6370         }
6371         elsif ($d ge "5.005") {
6372             unshift(@inc_version_list, grep { -d } $d);
6373         }
6374     }
6375     else {
6376         # Skip newer version.  I.e. don't look in
6377         # 5.7.0 if we're installing 5.6.1.
6378     }
6379 }
6380
6381 if (@inc_version_list) {
6382     print join(' ', @inc_version_list);
6383 }
6384 else {
6385     # Blank space to preserve value for next Configure run.
6386     print " ";
6387 }
6388 EOPL
6389 chmod +x getverlist
6390 case "$inc_version_list" in
6391 '')     if test -x "$perl5$exe_ext"; then
6392                 dflt=`$perl5 getverlist`
6393         else
6394                 dflt='none'
6395         fi
6396         ;;
6397 $undef) dflt='none' ;;
6398 *)  eval dflt=\"$inc_version_list\" ;;
6399 esac
6400 case "$dflt" in
6401 ''|' ') dflt=none ;;
6402 esac
6403 case "$dflt" in
6404 5.005) dflt=none ;;
6405 esac
6406 $cat <<EOM
6407
6408 In order to ease the process of upgrading, this version of perl
6409 can be configured to use modules built and installed with earlier
6410 versions of perl that were installed under $prefix.  Specify here
6411 the list of earlier versions that this version of perl should check.
6412 If Configure detected no earlier versions of perl installed under
6413 $prefix, then the list will be empty.  Answer 'none' to tell perl
6414 to not search earlier versions.
6415
6416 The default should almost always be sensible, so if you're not sure,
6417 just accept the default.
6418 EOM
6419
6420 rp='List of earlier versions to include in @INC?'
6421 . ./myread
6422 case "$ans" in
6423 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6424 *) inc_version_list="$ans" ;;
6425 esac
6426 case "$inc_version_list" in
6427 ''|' ')
6428         inc_version_list_init='0'
6429         d_inc_version_list="$undef"
6430         ;;
6431 *)      inc_version_list_init=`echo $inc_version_list |
6432                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6433         d_inc_version_list="$define"
6434         ;;
6435 esac
6436 $rm -f getverlist
6437
6438 : see if this is a malloc.h system
6439 : we want a real compile instead of Inhdr because some systems have a
6440 : malloc.h that just gives a compile error saying to use stdlib.h instead
6441 echo " "
6442 $cat >try.c <<EOCP
6443 #include <stdlib.h>
6444 #include <malloc.h>
6445 int main () { return 0; }
6446 EOCP
6447 set try
6448 if eval $compile; then
6449     echo "<malloc.h> found." >&4
6450     val="$define"
6451 else
6452     echo "<malloc.h> NOT found." >&4
6453     val="$undef"
6454 fi
6455 $rm -f try.c try
6456 set i_malloc
6457 eval $setvar
6458
6459 : check for void type
6460 echo " "
6461 echo "Checking to see how well your C compiler groks the void type..." >&4
6462 case "$voidflags" in
6463 '')
6464         $cat >try.c <<EOCP
6465 #$i_stdlib I_STDLIB
6466 #ifdef I_STDLIB
6467 #include <stdlib.h>
6468 #endif
6469 #if TRY & 1
6470 void sub() {
6471 #else
6472 sub() {
6473 #endif
6474         extern void moo();      /* function returning void */
6475         void (*goo)();          /* ptr to func returning void */
6476 #if TRY & 8
6477         void *hue;              /* generic ptr */
6478 #endif
6479 #if TRY & 2
6480         void (*foo[10])();
6481 #endif
6482
6483 #if TRY & 4
6484         if(goo == moo) {
6485                 exit(0);
6486         }
6487 #endif
6488         exit(0);
6489 }
6490 int main() { sub(); }
6491 EOCP
6492         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6493                 voidflags=$defvoidused
6494         echo "Good.  It appears to support void to the level $package wants.">&4
6495                 if $contains warning .out >/dev/null 2>&1; then
6496                         echo "However, you might get some warnings that look like this:"
6497                         $cat .out
6498                 fi
6499         else
6500 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6501                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6502                         echo "It supports 1..."
6503                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6504                                 echo "It also supports 2..."
6505                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6506                                         voidflags=7
6507                                         echo "And it supports 4 but not 8 definitely."
6508                                 else
6509                                         echo "It doesn't support 4..."
6510                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6511                                                 voidflags=11
6512                                                 echo "But it supports 8."
6513                                         else
6514                                                 voidflags=3
6515                                                 echo "Neither does it support 8."
6516                                         fi
6517                                 fi
6518                         else
6519                                 echo "It does not support 2..."
6520                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6521                                         voidflags=13
6522                                         echo "But it supports 4 and 8."
6523                                 else
6524                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6525                                                 voidflags=5
6526                                                 echo "And it supports 4 but has not heard about 8."
6527                                         else
6528                                                 echo "However it supports 8 but not 4."
6529                                         fi
6530                                 fi
6531                         fi
6532                 else
6533                         echo "There is no support at all for void."
6534                         voidflags=0
6535                 fi
6536         fi
6537 esac
6538 case "$voidflags" in
6539 "$defvoidused") ;;
6540 *)      $cat >&4 <<'EOM'
6541   Support flag bits are:
6542     1: basic void declarations.
6543     2: arrays of pointers to functions returning void.
6544     4: operations between pointers to and addresses of void functions.
6545     8: generic void pointers.
6546 EOM
6547         dflt="$voidflags";
6548         rp="Your void support flags add up to what?"
6549         . ./myread
6550         voidflags="$ans"
6551         ;;
6552 esac
6553 $rm -f try.* .out
6554
6555 : check for length of pointer
6556 echo " "
6557 case "$ptrsize" in
6558 '')
6559         echo "Checking to see how big your pointers are..." >&4
6560         if test "$voidflags" -gt 7; then
6561                 echo '#define VOID_PTR char *' > try.c
6562         else
6563                 echo '#define VOID_PTR void *' > try.c
6564         fi
6565         $cat >>try.c <<EOCP
6566 #include <stdio.h>
6567 #$i_stdlib I_STDLIB
6568 #ifdef I_STDLIB
6569 #include <stdlib.h>
6570 #endif
6571 int main()
6572 {
6573     printf("%d\n", (int)sizeof(VOID_PTR));
6574     exit(0);
6575 }
6576 EOCP
6577         set try
6578         if eval $compile_ok; then
6579                 ptrsize=`$run ./try`
6580                 echo "Your pointers are $ptrsize bytes long."
6581         else
6582                 dflt='4'
6583                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6584                 rp="What is the size of a pointer (in bytes)?"
6585                 . ./myread
6586                 ptrsize="$ans"
6587         fi
6588         ;;
6589 esac
6590 $rm -f try.c try
6591 case "$use64bitall" in
6592 "$define"|true|[yY]*)
6593         case "$ptrsize" in
6594         4)      cat <<EOM >&4
6595
6596 *** You have chosen a maximally 64-bit build,
6597 *** but your pointers are only 4 bytes wide.
6598 *** Please rerun Configure without -Duse64bitall.
6599 EOM
6600                 case "$d_quad" in
6601                 define)
6602                         cat <<EOM >&4
6603 *** Since you have quads, you could possibly try with -Duse64bitint.
6604 EOM
6605                         ;;
6606                 esac
6607                 cat <<EOM >&4
6608 *** Cannot continue, aborting.
6609
6610 EOM
6611
6612                 exit 1
6613                 ;;
6614         esac
6615         ;;
6616 esac
6617
6618
6619 : determine whether to use malloc wrapping
6620 echo " "
6621 case "$usemallocwrap" in
6622 [yY]*|true|$define)     dflt='y' ;;
6623 [nN]*|false|$undef)     dflt='n' ;;
6624 *)      case "$usedevel" in
6625         [yY]*|true|$define)     dflt='y' ;;
6626         *) dflt='n' ;;
6627         esac
6628         ;;
6629 esac
6630 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6631 . ./myread
6632 usemallocwrap="$ans"
6633 case "$ans" in
6634 y*|true)
6635         usemallocwrap="$define" ;;
6636 *)
6637         usemallocwrap="$undef" ;;
6638 esac
6639
6640 : determine which malloc to compile in
6641 echo " "
6642 case "$usemymalloc" in
6643 [yY]*|true|$define)     dflt='y' ;;
6644 [nN]*|false|$undef)     dflt='n' ;;
6645 *)      case "$ptrsize" in
6646         4) dflt='y' ;;
6647         *) dflt='n' ;;
6648         esac
6649         ;;
6650 esac
6651 rp="Do you wish to attempt to use the malloc that comes with $package?"
6652 . ./myread
6653 usemymalloc="$ans"
6654 case "$ans" in
6655 y*|true)
6656         usemymalloc='y'
6657         mallocsrc='malloc.c'
6658         mallocobj="malloc$_o"
6659         d_mymalloc="$define"
6660         case "$libs" in
6661         *-lmalloc*)
6662                 : Remove malloc from list of libraries to use
6663                 echo "Removing unneeded -lmalloc from library list" >&4
6664                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6665                 shift
6666                 libs="$*"
6667                 echo "libs = $libs" >&4
6668                 ;;
6669         esac
6670         ;;
6671 *)
6672         usemymalloc='n'
6673         mallocsrc=''
6674         mallocobj=''
6675         d_mymalloc="$undef"
6676         ;;
6677 esac
6678
6679 : compute the return types of malloc and free
6680 echo " "
6681 $cat >malloc.c <<END
6682 #$i_malloc I_MALLOC
6683 #$i_stdlib I_STDLIB
6684 #include <stdio.h>
6685 #include <sys/types.h>
6686 #ifdef I_MALLOC
6687 #include <malloc.h>
6688 #endif
6689 #ifdef I_STDLIB
6690 #include <stdlib.h>
6691 #endif
6692 #ifdef TRY_MALLOC
6693 void *malloc();
6694 #endif
6695 #ifdef TRY_FREE
6696 void free();
6697 #endif
6698 END
6699 case "$malloctype" in
6700 '')
6701         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6702                 malloctype='void *'
6703         else
6704                 malloctype='char *'
6705         fi
6706         ;;
6707 esac
6708 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6709
6710 case "$freetype" in
6711 '')
6712         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6713                 freetype='void'
6714         else
6715                 freetype='int'
6716         fi
6717         ;;
6718 esac
6719 echo "Your system uses $freetype free(), it would seem." >&4
6720 $rm -f malloc.[co]
6721 : determine where site specific architecture-dependent libraries go.
6722 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6723 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6724 : sitelib may have an optional trailing /share.
6725 case "$sitearch" in
6726 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6727         dflt="$dflt/$archname"
6728         ;;
6729 *)      dflt="$sitearch"
6730         ;;
6731 esac
6732 set sitearch sitearch none
6733 eval $prefixit
6734 $cat <<EOM
6735
6736 The installation process will also create a directory for
6737 architecture-dependent site-specific extensions and modules.
6738
6739 EOM
6740 fn=d~+
6741 rp='Pathname for the site-specific architecture-dependent library files?'
6742 . ./getfile
6743 prefixvar=sitearch
6744 . ./setprefixvar
6745 if $test X"$sitearch" = X"$sitelib"; then
6746         d_sitearch="$undef"
6747 else
6748         d_sitearch="$define"
6749 fi
6750
6751 $cat <<EOM
6752
6753 The installation process will also create a directory for
6754 vendor-supplied add-ons.  Vendors who supply perl with their system
6755 may find it convenient to place all vendor-supplied files in this
6756 directory rather than in the main distribution directory.  This will
6757 ease upgrades between binary-compatible maintenance versions of perl.
6758
6759 Of course you may also use these directories in whatever way you see
6760 fit.  For example, you might use them to access modules shared over a
6761 company-wide network.
6762
6763 The default answer should be fine for most people.
6764 This causes further questions about vendor add-ons to be skipped
6765 and no vendor-specific directories will be configured for perl.
6766
6767 EOM
6768 rp='Do you want to configure vendor-specific add-on directories?'
6769 case "$usevendorprefix" in
6770 define|true|[yY]*) dflt=y ;;
6771 *)      : User may have set vendorprefix directly on Configure command line.
6772         case "$vendorprefix" in
6773         ''|' ') dflt=n ;;
6774         *)      dflt=y ;;
6775         esac
6776         ;;
6777 esac
6778 . ./myread
6779 case "$ans" in
6780 [yY]*)  fn=d~+
6781         rp='Installation prefix to use for vendor-supplied add-ons?'
6782         case "$vendorprefix" in
6783         '') dflt='' ;;
6784         *)  dflt=$vendorprefix ;;
6785         esac
6786         . ./getfile
6787         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6788         oldvendorprefix=''
6789         case "$vendorprefix" in
6790         '') ;;
6791         *)      case "$ans" in
6792                 "$prefix") ;;
6793                 *) oldvendorprefix="$prefix";;
6794                 esac
6795                 ;;
6796         esac
6797         usevendorprefix="$define"
6798         vendorprefix="$ans"
6799         vendorprefixexp="$ansexp"
6800         ;;
6801 *)      usevendorprefix="$undef"
6802         vendorprefix=''
6803         vendorprefixexp=''
6804         ;;
6805 esac
6806
6807 case "$vendorprefix" in
6808 '')     d_vendorlib="$undef"
6809         vendorlib=''
6810         vendorlibexp=''
6811         ;;
6812 *)      d_vendorlib="$define"
6813         : determine where vendor-supplied modules go.
6814         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6815         case "$vendorlib" in
6816         '')
6817                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6818                 case "$installstyle" in
6819                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6820                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6821                 esac
6822                 ;;
6823         *)      dflt="$vendorlib"
6824                 ;;
6825         esac
6826         fn=d~+
6827         rp='Pathname for the vendor-supplied library files?'
6828         . ./getfile
6829         vendorlib="$ans"
6830         vendorlibexp="$ansexp"
6831         ;;
6832 esac
6833 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6834 prefixvar=vendorlib
6835 . ./installprefix
6836
6837 case "$vendorprefix" in
6838 '')     d_vendorarch="$undef"
6839         vendorarch=''
6840         vendorarchexp=''
6841         ;;
6842 *)      d_vendorarch="$define"
6843         : determine where vendor-supplied architecture-dependent libraries go.
6844         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6845         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6846         : vendorlib may have an optional trailing /share.
6847         case "$vendorarch" in
6848         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6849                 dflt="$dflt/$archname"
6850                 ;;
6851         *)      dflt="$vendorarch" ;;
6852         esac
6853         fn=d~+
6854         rp='Pathname for vendor-supplied architecture-dependent files?'
6855         . ./getfile
6856         vendorarch="$ans"
6857         vendorarchexp="$ansexp"
6858         ;;
6859 esac
6860 prefixvar=vendorarch
6861 . ./installprefix
6862
6863 : Final catch-all directories to search
6864 $cat <<EOM
6865
6866 Lastly, you can have perl look in other directories for extensions and
6867 modules in addition to those already specified.
6868 These directories will be searched after 
6869         $sitearch 
6870         $sitelib 
6871 EOM
6872 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6873 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6874 echo ' '
6875 case "$otherlibdirs" in
6876 ''|' ') dflt='none' ;;
6877 *)      dflt="$otherlibdirs" ;;
6878 esac
6879 $cat <<EOM
6880 Enter a colon-separated set of extra paths to include in perl's @INC
6881 search path, or enter 'none' for no extra paths.
6882
6883 EOM
6884
6885 rp='Colon-separated list of additional directories for perl to search?'
6886 . ./myread
6887 case "$ans" in
6888 ' '|''|none)    otherlibdirs=' ' ;;     
6889 *)      otherlibdirs="$ans" ;;
6890 esac
6891 case "$otherlibdirs" in
6892 ' ') val=$undef ;;
6893 *)      val=$define ;;
6894 esac
6895 set d_perl_otherlibdirs
6896 eval $setvar
6897
6898 : Cruising for prototypes
6899 echo " "
6900 echo "Checking out function prototypes..." >&4
6901 $cat >prototype.c <<EOCP
6902 #$i_stdlib I_STDLIB
6903 #ifdef I_STDLIB
6904 #include <stdlib.h>
6905 #endif
6906 int main(int argc, char *argv[]) {
6907         exit(0);}
6908 EOCP
6909 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6910         echo "Your C compiler appears to support function prototypes."
6911         val="$define"
6912 else
6913         echo "Your C compiler doesn't seem to understand function prototypes."
6914         val="$undef"
6915 fi
6916 set prototype
6917 eval $setvar
6918 $rm -f prototype*
6919
6920 case "$prototype" in
6921 "$define") ;;
6922 *)      ansi2knr='ansi2knr'
6923         echo " "
6924         cat <<EOM >&4
6925
6926 $me:  FATAL ERROR:
6927 This version of $package can only be compiled by a compiler that 
6928 understands function prototypes.  Unfortunately, your C compiler 
6929         $cc $ccflags
6930 doesn't seem to understand them.  Sorry about that.
6931
6932 If GNU cc is available for your system, perhaps you could try that instead.  
6933
6934 Eventually, we hope to support building Perl with pre-ANSI compilers.
6935 If you would like to help in that effort, please contact <perlbug@perl.org>.
6936
6937 Aborting Configure now.
6938 EOM
6939         exit 2
6940         ;;
6941 esac
6942
6943 echo " "
6944 case "$extras" in
6945 '') dflt='n';;
6946 *) dflt='y';;
6947 esac
6948 cat <<EOM
6949 Perl can be built with extra modules or bundles of modules which
6950 will be fetched from the CPAN and installed alongside Perl.
6951
6952 Notice that you will need access to the CPAN; either via the Internet,
6953 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6954 be asked later to configure the CPAN.pm module which will in turn do
6955 the installation of the rest of the extra modules or bundles.)
6956
6957 Notice also that if the modules require any external software such as
6958 libraries and headers (the libz library and the zlib.h header for the
6959 Compress::Zlib module, for example) you MUST have any such software
6960 already installed, this configuration process will NOT install such
6961 things for you.
6962
6963 If this doesn't make any sense to you, just accept the default '$dflt'.
6964 EOM
6965 rp='Install any extra modules (y or n)?'
6966 . ./myread
6967 case "$ans" in
6968 y|Y)
6969         cat <<EOM
6970
6971 Please list any extra modules or bundles to be installed from CPAN,
6972 with spaces between the names.  The names can be in any format the
6973 'install' command of CPAN.pm will understand.  (Answer 'none',
6974 without the quotes, to install no extra modules or bundles.)
6975 EOM
6976         rp='Extras?'
6977         dflt="$extras"
6978         . ./myread
6979         extras="$ans"
6980 esac
6981 case "$extras" in
6982 ''|'none')
6983         val=''
6984         $rm -f ../extras.lst
6985         ;;
6986 *)      echo "(Saving the list of extras for later...)"
6987         echo "$extras" > ../extras.lst
6988         val="'$extras'"
6989         ;;
6990 esac
6991 set extras
6992 eval $setvar
6993 echo " "
6994
6995 : determine where html pages for programs go
6996 set html1dir html1dir none
6997 eval $prefixit
6998 $cat <<EOM
6999
7000 If you wish to install html files for programs in $spackage, indicate
7001 the appropriate directory here.  To skip installing html files,
7002 answer "none".
7003 EOM
7004 case "$html1dir" in
7005 ''|none|$undef|' ') dflt=none ;;
7006 *) dflt=$html1dir ;;
7007 esac
7008 fn=dn+~
7009 rp="Directory for the main $spackage html pages?"
7010 . ./getfile
7011 prefixvar=html1dir
7012 . ./setprefixvar
7013 : Use ' ' for none so value is preserved next time through Configure
7014 $test X"$html1dir" = "X" && html1dir=' '
7015
7016 : determine where html pages for libraries and modules go
7017 set html3dir html3dir none
7018 eval $prefixit
7019 $cat <<EOM
7020
7021 If you wish to install html files for modules associated with $spackage,
7022 indicate the appropriate directory here.  To skip installing html files,
7023 answer "none".
7024 EOM
7025 : There is no obvious default.  If they have specified html1dir, then
7026 : try to key off that, possibly changing .../html1 into .../html3.
7027 case "$html3dir" in
7028 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7029 *) dflt=$html3dir ;;
7030 esac
7031 fn=dn+~
7032 rp="Directory for the $spackage module html pages?"
7033 . ./getfile
7034 prefixvar=html3dir
7035 . ./setprefixvar
7036 : Use ' ' for none so value is preserved next time through Configure
7037 $test X"$html3dir" = "X" && html3dir=' '
7038
7039 : determine whether to install perl also as /usr/bin/perl
7040
7041 echo " "
7042 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7043         $cat <<EOM
7044 Many scripts expect perl to be installed as /usr/bin/perl.
7045
7046 If you want to, I can install the perl you are about to compile
7047 as /usr/bin/perl (in addition to $bin/perl).
7048 EOM
7049         if test -f /usr/bin/perl; then
7050             $cat <<EOM
7051
7052 However, please note that because you already have a /usr/bin/perl,
7053 overwriting that with a new Perl would very probably cause problems.
7054 Therefore I'm assuming you don't want to do that (unless you insist).
7055
7056 EOM
7057             case "$installusrbinperl" in
7058             "$define"|[yY]*)    dflt='y';;
7059             *)                  dflt='n';;
7060             esac
7061         else
7062             $cat <<EOM
7063
7064 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7065
7066 EOM
7067             case "$installusrbinperl" in
7068             "$undef"|[nN]*)     dflt='n';;
7069             *)                  dflt='y';;
7070             esac
7071         fi
7072         rp="Do you want to install perl as /usr/bin/perl?"
7073         . ./myread
7074         case "$ans" in
7075         [yY]*)  val="$define";;
7076         *)      val="$undef" ;;
7077         esac
7078 else
7079         val="$undef"
7080 fi
7081 set installusrbinperl
7082 eval $setvar
7083
7084 echo " "
7085 echo "Checking for GNU C Library..." >&4
7086 cat >try.c <<'EOCP'
7087 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7088    alone are insufficient to distinguish different versions, such as
7089    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7090    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7091 */
7092 #include <stdio.h>
7093 int main(void)
7094 {
7095 #ifdef __GLIBC__
7096 #   ifdef __GLIBC_MINOR__
7097 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7098 #           include <gnu/libc-version.h>
7099             printf("%s\n",  gnu_get_libc_version());
7100 #       else
7101             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7102 #       endif
7103 #   else
7104         printf("%d\n",  __GLIBC__);
7105 #   endif
7106     return 0;
7107 #else
7108     return 1;
7109 #endif
7110 }
7111 EOCP
7112 set try
7113 if eval $compile_ok && $run ./try > glibc.ver; then
7114         val="$define"
7115         gnulibc_version=`$cat glibc.ver`
7116         echo "You are using the GNU C Library version $gnulibc_version"
7117 else
7118         val="$undef"
7119         gnulibc_version=''
7120         echo "You are not using the GNU C Library"
7121 fi
7122 $rm -f try try.* glibc.ver
7123 set d_gnulibc
7124 eval $setvar
7125
7126 : see if nm is to be used to determine whether a symbol is defined or not
7127 case "$usenm" in
7128 '')
7129         dflt=''
7130         case "$d_gnulibc" in
7131         "$define")
7132                 echo " "
7133                 echo "nm probably won't work on the GNU C Library." >&4
7134                 dflt=n
7135                 ;;
7136         esac
7137         case "$dflt" in
7138         '') 
7139                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7140                         echo " "
7141                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7142                         echo "'nm' won't be sufficient on this sytem." >&4
7143                         dflt=n
7144                 fi
7145                 ;;
7146         esac
7147         case "$dflt" in
7148         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7149                 if $test $dflt -gt 20; then
7150                         dflt=y
7151                 else
7152                         dflt=n
7153                 fi
7154                 ;;
7155         esac
7156         ;;
7157 *)
7158         case "$usenm" in
7159         true|$define) dflt=y;;
7160         *) dflt=n;;
7161         esac
7162         ;;
7163 esac
7164 $cat <<EOM
7165
7166 I can use $nm to extract the symbols from your C libraries. This
7167 is a time consuming task which may generate huge output on the disk (up
7168 to 3 megabytes) but that should make the symbols extraction faster. The
7169 alternative is to skip the 'nm' extraction part and to compile a small
7170 test program instead to determine whether each symbol is present. If
7171 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7172 this may be the best solution.
7173
7174 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7175
7176 EOM
7177 rp="Shall I use $nm to extract C symbols from the libraries?"
7178 . ./myread
7179 case "$ans" in
7180 [Nn]*) usenm=false;;
7181 *) usenm=true;;
7182 esac
7183
7184 runnm=$usenm
7185 case "$reuseval" in
7186 true) runnm=false;;
7187 esac
7188
7189 : nm options which may be necessary
7190 case "$nm_opt" in
7191 '') if $test -f /mach_boot; then
7192                 nm_opt=''       # Mach
7193         elif $test -d /usr/ccs/lib; then
7194                 nm_opt='-p'     # Solaris (and SunOS?)
7195         elif $test -f /dgux; then
7196                 nm_opt='-p'     # DG-UX
7197         elif $test -f /lib64/rld; then
7198                 nm_opt='-p'     # 64-bit Irix
7199         else
7200                 nm_opt=''
7201         fi;;
7202 esac
7203
7204 : nm options which may be necessary for shared libraries but illegal
7205 : for archive libraries.  Thank you, Linux.
7206 case "$nm_so_opt" in
7207 '')     case "$myuname" in
7208         *linux*|gnu*)
7209                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7210                         nm_so_opt='--dynamic'
7211                 fi
7212                 ;;
7213         esac
7214         ;;
7215 esac
7216
7217 case "$runnm" in
7218 true)
7219 : get list of predefined functions in a handy place
7220 echo " "
7221 case "$libc" in
7222 '') libc=unknown
7223         case "$libs" in
7224         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7225         esac
7226         ;;
7227 esac
7228 case "$libs" in
7229 '') ;;
7230 *)  for thislib in $libs; do
7231         case "$thislib" in
7232         -lc|-lc_s)
7233                 : Handle C library specially below.
7234                 ;;
7235         -l*)
7236                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7237                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7238                         :
7239                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7240                         :
7241                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7242                         :
7243                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7244                         :
7245                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7246                         :
7247                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7248                         :
7249                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7250                         :
7251                 else
7252                         try=''
7253                 fi
7254                 libnames="$libnames $try"
7255                 ;;
7256         *) libnames="$libnames $thislib" ;;
7257         esac
7258         done
7259         ;;
7260 esac
7261 xxx=normal
7262 case "$libc" in
7263 unknown)
7264         set /lib/libc.$so
7265         for xxx in $libpth; do
7266                 $test -r $1 || set $xxx/libc.$so
7267                 : The messy sed command sorts on library version numbers.
7268                 $test -r $1 || \
7269                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7270                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7271                                 h
7272                                 s/[0-9][0-9]*/0000&/g
7273                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7274                                 G
7275                                 s/\n/ /' | \
7276                          $sort | $sed -e 's/^.* //'`
7277                 eval set \$$#
7278         done
7279         $test -r $1 || set /usr/ccs/lib/libc.$so
7280         $test -r $1 || set /lib/libsys_s$_a
7281         ;;
7282 *)
7283         set blurfl
7284         ;;
7285 esac
7286 if $test -r "$1"; then
7287         echo "Your (shared) C library seems to be in $1."
7288         libc="$1"
7289 elif $test -r /lib/libc && $test -r /lib/clib; then
7290         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7291         xxx=apollo
7292         libc='/lib/clib /lib/libc'
7293         if $test -r /lib/syslib; then
7294                 echo "(Your math library is in /lib/syslib.)"
7295                 libc="$libc /lib/syslib"
7296         fi
7297 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7298         echo "Your C library seems to be in $libc, as you said before."
7299 elif $test -r $incpath/usr/lib/libc$_a; then
7300         libc=$incpath/usr/lib/libc$_a;
7301         echo "Your C library seems to be in $libc.  That's fine."
7302 elif $test -r /lib/libc$_a; then
7303         libc=/lib/libc$_a;
7304         echo "Your C library seems to be in $libc.  You're normal."
7305 else
7306         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7307                 :
7308         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7309                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7310         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7311                 :
7312         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7313                 :
7314         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7315                 :
7316         else
7317                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7318         fi
7319         if $test -r "$tans"; then
7320                 echo "Your C library seems to be in $tans, of all places."
7321                 libc=$tans
7322         else
7323                 libc='blurfl'
7324         fi
7325 fi
7326 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7327         dflt="$libc"
7328         cat <<EOM
7329
7330 If the guess above is wrong (which it might be if you're using a strange
7331 compiler, or your machine supports multiple models), you can override it here.
7332
7333 EOM
7334 else
7335         dflt=''
7336         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7337         cat >&4 <<EOM
7338 I can't seem to find your C library.  I've looked in the following places:
7339
7340 EOM
7341         $sed 's/^/      /' libpath
7342         cat <<EOM
7343
7344 None of these seems to contain your C library. I need to get its name...
7345
7346 EOM
7347 fi
7348 fn=f
7349 rp='Where is your C library?'
7350 . ./getfile
7351 libc="$ans"
7352
7353 echo " "
7354 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7355 set X `cat libnames`
7356 shift
7357 xxx=files
7358 case $# in 1) xxx=file; esac
7359 echo "Extracting names from the following $xxx for later perusal:" >&4
7360 echo " "
7361 $sed 's/^/      /' libnames >&4
7362 echo " "
7363 $echo $n "This may take a while...$c" >&4
7364
7365 for file in $*; do
7366         case $file in
7367         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7368         *) $nm $nm_opt $file 2>/dev/null;;
7369         esac
7370 done >libc.tmp
7371
7372 $echo $n ".$c"
7373 $grep fprintf libc.tmp > libc.ptf
7374 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7375 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7376 xxx='[ADTSIW]'
7377 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7378         eval $xscan;\
7379         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7380                 eval $xrun
7381 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7382         eval $xscan;\
7383         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7384                 eval $xrun
7385 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7386         eval $xscan;\
7387         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7388                 eval $xrun
7389 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7390         eval $xscan;\
7391         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7392                 eval $xrun
7393 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7394         eval $xscan;\
7395         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7396                 eval $xrun
7397 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7398         eval $xscan;\
7399         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7400                 eval $xrun
7401 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7402                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7403         eval $xscan;\
7404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405                 eval $xrun
7406 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7407         eval $xscan;\
7408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7409                 eval $xrun
7410 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7411         eval $xscan;\
7412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7413                 eval $xrun
7414 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7415         eval $xscan;\
7416         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7417                 eval $xrun
7418 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7419         eval $xscan;\
7420         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7421                 eval $xrun
7422 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7423         eval $xscan;\
7424         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7425                 eval $xrun
7426 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7427         eval $xscan;\
7428         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7429                 eval $xrun
7430 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7431         eval $xscan;\
7432         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7433                 eval $xrun
7434 else
7435         $nm -p $* 2>/dev/null >libc.tmp
7436         $grep fprintf libc.tmp > libc.ptf
7437         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7438                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7439         then
7440                 nm_opt='-p'
7441                 eval $xrun
7442         else
7443                 echo " "
7444                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7445                 com=''
7446                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7447                         for thisname in $libnames $libc; do
7448                                 $ar t $thisname >>libc.tmp
7449                         done
7450                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7451                         echo "Ok." >&4
7452                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7453                         # Repeat libc to extract forwarders to DLL entries too
7454                         for thisname in $libnames $libc; do
7455                                 $ar tv $thisname >>libc.tmp
7456                                 # Revision 50 of EMX has bug in $ar.
7457                                 # it will not extract forwarders to DLL entries
7458                                 # Use emximp which will extract exactly them.
7459                                 emximp -o tmp.imp $thisname \
7460                                     2>/dev/null && \
7461                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7462                                     < tmp.imp >>libc.tmp
7463                                 $rm tmp.imp
7464                         done
7465                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7466                         echo "Ok." >&4
7467                 else
7468                         echo "$ar didn't seem to work right." >&4
7469                         echo "Maybe this is a Cray...trying bld instead..." >&4
7470                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7471                         then
7472                                 for thisname in $libnames; do
7473                                         bld t $libnames | \
7474                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7475                                         $ar t $thisname >>libc.tmp
7476                                 done
7477                                 echo "Ok." >&4
7478                         else
7479                                 echo "That didn't work either.  Giving up." >&4
7480                                 exit 1
7481                         fi
7482                 fi
7483         fi
7484 fi
7485 nm_extract="$com"
7486 case "$PASE" in
7487 define)
7488     echo " "
7489     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7490     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7491     ;;
7492 *)  if $test -f /lib/syscalls.exp; then
7493         echo " "
7494         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7495         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7496     fi
7497     ;;
7498 esac
7499 ;;
7500 esac
7501 $rm -f libnames libpath
7502
7503 : see if dld is available
7504 set dld.h i_dld
7505 eval $inhdr
7506
7507 : is a C symbol defined?
7508 csym='tlook=$1;
7509 case "$3" in
7510 -v) tf=libc.tmp; tdc="";;
7511 -a) tf=libc.tmp; tdc="[]";;
7512 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7513 esac;
7514 tx=yes;
7515 case "$reuseval-$4" in
7516 true-) ;;
7517 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7518 esac;
7519 case "$tx" in
7520 yes)
7521         tval=false;
7522         if $test "$runnm" = true; then
7523                 if $contains $tlook $tf >/dev/null 2>&1; then
7524                         tval=true;
7525                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7526                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7527                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7528                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7529                         $rm -f try$_exe try.c core core.* try.core;
7530                 fi;
7531         else
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 $libs >/dev/null 2>&1 && tval=true;
7534                 $rm -f try$_exe try.c;
7535         fi;
7536         ;;
7537 *)
7538         case "$tval" in
7539         $define) tval=true;;
7540         *) tval=false;;
7541         esac;
7542         ;;
7543 esac;
7544 eval "$2=$tval"'
7545
7546 : define an is-in-libc? function
7547 inlibc='echo " "; td=$define; tu=$undef;
7548 sym=$1; var=$2; eval "was=\$$2";
7549 tx=yes;
7550 case "$reuseval$was" in
7551 true) ;;
7552 true*) tx=no;;
7553 esac;
7554 case "$tx" in
7555 yes)
7556         set $sym tres -f;
7557         eval $csym;
7558         case "$tres" in
7559         true)
7560                 echo "$sym() found." >&4;
7561                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7562         *)
7563                 echo "$sym() NOT found." >&4;
7564                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7565         esac;;
7566 *)
7567         case "$was" in
7568         $define) echo "$sym() found." >&4;;
7569         *) echo "$sym() NOT found." >&4;;
7570         esac;;
7571 esac'
7572
7573
7574 echo " "
7575 echo "Checking for C++..." >&4
7576 cat >try.c <<'EOCP'
7577 #include <stdio.h>
7578 int main(void)
7579 {
7580 #ifdef __cplusplus
7581     printf("define\n");
7582 #else
7583     printf("undef\n");
7584 #endif
7585     return 0;
7586 }
7587 EOCP
7588 set try
7589 if eval $compile_ok && $run ./try >cplusplus$$; then
7590         val=`$cat cplusplus$$`
7591         echo "You are using a C++ compiler."
7592 else
7593         val="$undef"
7594         echo "You are not using a C++ compiler."
7595 fi
7596 $rm -f try try.* cplusplus$$
7597 set d_cplusplus
7598 eval $setvar
7599
7600 : see if dlopen exists
7601 xxx_runnm="$runnm"
7602 xxx_ccflags="$ccflags"
7603 runnm=false
7604 : with g++ one needs -shared to get is-in-libc to work for dlopen
7605 case "$gccversion" in
7606 '')     ;;
7607 *)      case "$d_cplusplus" in
7608         "$define") ccflags="$ccflags -shared" ;;
7609         esac
7610         ;;
7611 esac
7612 set dlopen d_dlopen
7613 eval $inlibc
7614 runnm="$xxx_runnm"
7615 ccflags="$xxx_ccflags"
7616
7617 : see if this is a unistd.h system
7618 set unistd.h i_unistd
7619 eval $inhdr
7620
7621 : determine which dynamic loading, if any, to compile in
7622 echo " "
7623 dldir="ext/DynaLoader"
7624 case "$usedl" in
7625 $define|y|true)
7626         dflt='y'
7627         usedl="$define"
7628         ;;
7629 $undef|n|false)
7630         dflt='n'
7631         usedl="$undef"
7632         ;;
7633 *) 
7634         dflt='n'
7635         case "$d_dlopen" in
7636             $define) dflt='y' ;;
7637         esac
7638         case "$i_dld" in
7639             $define) dflt='y' ;;
7640         esac
7641         : Does a dl_xxx.xs file exist for this operating system
7642         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7643         ;;
7644 esac
7645 rp="Do you wish to use dynamic loading?"
7646 . ./myread
7647 usedl="$ans"
7648 case "$ans" in
7649 y*) usedl="$define"
7650         case "$dlsrc" in
7651         '')
7652                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7653                         dflt="$dldir/dl_${osname}.xs"
7654                 elif $test "$d_dlopen" = "$define" ; then
7655                         dflt="$dldir/dl_dlopen.xs"
7656                 elif $test "$i_dld" = "$define" ; then
7657                         dflt="$dldir/dl_dld.xs"
7658                 else
7659                         dflt=''
7660                 fi
7661                 ;;
7662         *)      dflt="$dldir/$dlsrc"
7663                 ;;
7664         esac
7665     echo "The following dynamic loading files are available:"
7666         : Can not go over to $dldir because getfile has path hard-coded in.
7667         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7668         rp="Source file to use for dynamic loading"
7669         fn="fne"
7670         gfpth="$src"
7671         . ./getfile
7672         usedl="$define"
7673         : emulate basename
7674         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7675
7676         $cat << EOM
7677
7678 Some systems may require passing special flags to $cc -c to
7679 compile modules that will be used to create a shared library.
7680 To use no flags, say "none".
7681
7682 EOM
7683     case "$cccdlflags" in
7684     '') case "$gccversion" in
7685                 '') case "$osname" in
7686                         hpux)   dflt='+z' ;;
7687                         next)   dflt='none' ;;
7688                         irix*)  dflt='-KPIC' ;;
7689                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7690                         sunos)  dflt='-pic' ;;
7691                         *)      dflt='none' ;;
7692                     esac
7693                         ;;
7694                 *)  case "$osname" in
7695                         darwin) dflt='none' ;;
7696                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7697                         *)      dflt='-fpic' ;;
7698                     esac ;;
7699             esac ;;
7700         ' ') dflt='none' ;;
7701     *)  dflt="$cccdlflags" ;;
7702     esac
7703     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7704     . ./myread
7705     case "$ans" in
7706     none) cccdlflags=' ' ;;
7707     *) cccdlflags="$ans" ;;
7708     esac
7709
7710     cat << EOM
7711
7712 Some systems use ld to create libraries that can be dynamically loaded,
7713 while other systems (such as those using ELF) use $cc.
7714
7715 EOM
7716         case "$ld" in
7717         '')     $cat >try.c <<EOM
7718 /* Test for whether ELF binaries are produced */
7719 #include <fcntl.h>
7720 #$i_stdlib I_STDLIB
7721 #ifdef I_STDLIB
7722 #include <stdlib.h>
7723 #endif
7724 #$i_unistd I_UNISTD
7725 #ifdef I_UNISTD
7726 #include <unistd.h>
7727 #endif
7728 int main() {
7729         char b[4];
7730         int i = open("a.out",O_RDONLY);
7731         if(i == -1) 
7732                 exit(1); /* fail */
7733         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7734                 exit(0); /* succeed (yes, it's ELF) */
7735         else
7736                 exit(1); /* fail */
7737 }
7738 EOM
7739                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7740                         cat <<EOM
7741 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7742 EOM
7743                         dflt="$cc"
7744                 else
7745                         echo "I'll use ld to build dynamic libraries."
7746                         dflt='ld'
7747                 fi
7748                 rm -f try.c a.out
7749                 ;;
7750         *)      dflt="$ld"
7751                 ;;
7752         esac
7753
7754     rp="What command should be used to create dynamic libraries?"
7755     . ./myread
7756         ld="$ans"
7757
7758     cat << EOM
7759
7760 Some systems may require passing special flags to $ld to create a
7761 library that can be dynamically loaded.  If your ld flags include
7762 -L/other/path options to locate libraries outside your loader's normal
7763 search path, you may need to specify those -L options here as well.  To
7764 use no flags, say "none".
7765
7766 EOM
7767     case "$lddlflags" in
7768     '') case "$osname" in
7769                         beos) dflt='-nostart' ;;
7770                         hpux) dflt='-b';
7771                               case "$gccversion" in
7772                               '') dflt="$dflt +vnocompatwarnings" ;;
7773                               esac
7774                               ;;        
7775                         linux|irix*|gnu*)       dflt='-shared' ;;
7776                         next)  dflt='none' ;;
7777                         solaris) dflt='-G' ;;
7778                         sunos) dflt='-assert nodefinitions' ;;
7779                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7780                 *)     dflt='none' ;;
7781                         esac
7782                         ;;
7783     *) dflt="$lddlflags" ;;
7784     esac
7785
7786         : Try to guess additional flags to pick up local libraries.
7787         : Be careful not to append to a plain 'none'
7788         case "$dflt" in
7789         none) dflt='' ;;
7790         esac
7791         for thisflag in $ldflags; do
7792                 case "$thisflag" in
7793                 -L*|-R*|-Wl,-R*)
7794                         case " $dflt " in
7795                         *" $thisflag "*) ;;
7796                         *) dflt="$dflt $thisflag" ;;
7797                         esac
7798                         ;;
7799                 esac
7800         done
7801
7802         case "$dflt" in
7803         ''|' ') dflt='none' ;;
7804         esac
7805
7806     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7807     . ./myread
7808     case "$ans" in
7809     none) lddlflags=' ' ;;
7810     *) lddlflags="$ans" ;;
7811     esac
7812
7813         cat <<EOM
7814
7815 Some systems may require passing special flags to $cc to indicate that
7816 the resulting executable will use dynamic linking.  To use no flags,
7817 say "none".
7818
7819 EOM
7820     case "$ccdlflags" in
7821     '') case "$osname" in
7822             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7823             next|sunos) dflt='none' ;;
7824             *)          dflt='none' ;;
7825             esac ;;
7826     ' ')  dflt='none' ;;
7827     *)  dflt="$ccdlflags" ;;
7828     esac
7829     rp="Any special flags to pass to $cc to use dynamic linking?"
7830     . ./myread
7831     case "$ans" in
7832     none) ccdlflags=' ' ;;
7833     *) ccdlflags="$ans" ;;
7834     esac
7835     ;;
7836 *)  usedl="$undef"
7837         ld='ld'
7838     dlsrc='dl_none.xs'
7839     lddlflags=''
7840     ccdlflags=''
7841     ;;
7842 esac
7843
7844 also=''
7845 case "$usedl" in
7846 $undef)
7847         # No dynamic loading being used, so don't bother even to prompt.
7848         useshrplib='false'
7849         ;;
7850 *)      case "$useshrplib" in
7851         '')     case "$osname" in
7852                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7853                         dflt=y
7854                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7855                         ;;
7856                 next*)
7857                         case "$osvers" in
7858                         4*)     dflt=y
7859                                 also='Building a shared libperl is needed for MAB support.'
7860                                 ;;
7861                         *)      dflt=n
7862                                 ;;
7863                         esac
7864                         ;;
7865                 *)      dflt=n
7866                         ;;
7867                 esac
7868                 ;;
7869         $define|true|[Yy]*)
7870                 dflt=y
7871                 ;;
7872         *)      dflt=n
7873                 ;;
7874         esac
7875         $cat << EOM
7876
7877 The perl executable is normally obtained by linking perlmain.c with
7878 libperl${_a}, any static extensions (usually just DynaLoader), and
7879 any other libraries needed on this system (such as -lm, etc.).  Since
7880 your system supports dynamic loading, it is probably possible to build
7881 a shared libperl.$so.  If you will have more than one executable linked
7882 to libperl.$so, this will significantly reduce the size of each
7883 executable, but it may have a noticeable effect on performance.  The
7884 default is probably sensible for your system.
7885 $also
7886
7887 EOM
7888         rp="Build a shared libperl.$so (y/n)"
7889         . ./myread
7890         case "$ans" in
7891         true|$define|[Yy]*)
7892                 useshrplib='true'  ;;
7893         *)      useshrplib='false' ;;
7894         esac
7895         ;;
7896 esac
7897
7898 case "$useshrplib" in
7899 true)
7900         case "$libperl" in
7901         '')
7902                 # Figure out a good name for libperl.so.  Since it gets stored in
7903                 # a version-specific architecture-dependent library, the version
7904                 # number isn't really that important, except for making cc/ld happy.
7905                 #
7906                 # A name such as libperl.so.3.1
7907                 majmin="libperl.$so.$patchlevel.$subversion"
7908                 # A name such as libperl.so.301
7909                 majonly=`echo $patchlevel $subversion |
7910                         $awk '{printf "%d%02d", $1, $2}'`
7911                 majonly=libperl.$so.$majonly
7912                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7913                 # rely on figuring it out from the naming of libc.
7914                 case "${osname}${osvers}" in
7915                 next4*)
7916                         dflt=libperl.5.$so
7917                         # XXX How handle the --version stuff for MAB?
7918                         ;;
7919                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7920                         dflt=libperl.$so
7921                         ;;
7922                 cygwin*) # ld links against an importlib
7923                         dflt=libperl$lib_ext
7924                         ;;
7925                 *)      # Try to guess based on whether libc has major.minor.
7926                         case "$libc" in
7927                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7928                         *libc.$so.[0-9]*) dflt=$majonly ;;
7929                         *)      dflt=libperl.$so ;;
7930                         esac
7931                         ;;
7932                 esac
7933                 ;;
7934         *)      dflt=$libperl
7935                 ;;
7936         esac
7937         cat << EOM
7938
7939 I need to select a good name for the shared libperl.  If your system uses
7940 library names with major and minor numbers, then you might want something
7941 like $majmin.  Alternatively, if your system uses a single version
7942 number for shared libraries, then you might want to use $majonly.
7943 Or, your system might be quite happy with a simple libperl.$so.
7944
7945 Since the shared libperl will get installed into a version-specific
7946 architecture-dependent directory, the version number of the shared perl
7947 library probably isn't important, so the default should be o.k.
7948
7949 EOM
7950         rp='What name do you want to give to the shared libperl?'
7951         . ./myread
7952         libperl=$ans
7953         echo "Ok, I'll use $libperl"
7954         ;;
7955 *)
7956         libperl="libperl${_a}"
7957         ;;
7958 esac
7959
7960 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7961 case "$shrpdir" in
7962 '') ;;
7963 *)      $cat >&4 <<EOM
7964 WARNING:  Use of the shrpdir variable for the installation location of
7965 the shared $libperl is not supported.  It was never documented and
7966 will not work in this version.  Let me (perlbug@perl.org)
7967 know of any problems this may cause.
7968
7969 EOM
7970         case "$shrpdir" in
7971         "$archlibexp/CORE")
7972                 $cat >&4 <<EOM
7973 But your current setting of $shrpdir is
7974 the default anyway, so it's harmless.
7975 EOM
7976                 ;;
7977         *)
7978                 $cat >&4 <<EOM
7979 Further, your current attempted setting of $shrpdir
7980 conflicts with the value of $archlibexp/CORE
7981 that installperl will use.
7982 EOM
7983                 ;;
7984         esac
7985         ;;
7986 esac
7987
7988 # How will the perl executable find the installed shared $libperl?
7989 # Add $xxx to ccdlflags.
7990 # If we can't figure out a command-line option, use $shrpenv to
7991 # set env LD_RUN_PATH.  The main perl makefile uses this.
7992 shrpdir=$archlibexp/CORE
7993 xxx=''
7994 tmp_shrpenv=''
7995 if "$useshrplib"; then
7996     case "$osname" in 
7997         aix)
7998                 # We'll set it in Makefile.SH...
7999                 ;;
8000         solaris)
8001                 xxx="-R $shrpdir"
8002                 ;;
8003         freebsd|netbsd|openbsd|interix|dragonfly)
8004                 xxx="-Wl,-R$shrpdir"
8005                 ;;
8006         bsdos|linux|irix*|dec_osf|gnu*)
8007                 xxx="-Wl,-rpath,$shrpdir"
8008                 ;;
8009         next)
8010                 # next doesn't like the default...
8011                 ;;
8012         beos)
8013                 # beos doesn't like the default, either.
8014                 ;;
8015         hpux*)
8016                 # hpux doesn't like the default, either.
8017                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8018                 ;;
8019         *)
8020                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8021                 ;;
8022         esac
8023         case "$xxx" in
8024         '') ;;
8025         *)      
8026                 # Only add $xxx if it isn't already in ccdlflags.
8027                 case " $ccdlflags " in
8028                 *" $xxx "*)     ;;
8029                 *)      ccdlflags="$ccdlflags $xxx"
8030                         cat <<EOM >&4
8031
8032 Adding $xxx to the flags
8033 passed to $ld so that the perl executable will find the 
8034 installed shared $libperl.
8035
8036 EOM
8037                         ;;
8038                 esac
8039                 ;;
8040         esac
8041 fi
8042 # Fix ccdlflags in AIX for building external extensions.
8043 # (For building Perl itself bare -bE:perl.exp is needed,
8044 #  Makefile.SH takes care of this.)
8045 case "$osname" in
8046 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8047 esac
8048 # Respect a hint or command-line value.
8049 case "$shrpenv" in
8050 '') shrpenv="$tmp_shrpenv" ;;
8051 esac
8052 case "$ldlibpthname" in
8053 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8054 none)   ldlibpthname='' ;;
8055 esac
8056
8057 : determine where manual pages are on this system
8058 echo " "
8059 case "$sysman" in
8060 '') 
8061         syspath='/usr/share/man/man1 /usr/man/man1'
8062         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8063         syspath="$syspath /usr/man/u_man/man1"
8064         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8065         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8066         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8067         sysman=`./loc . /usr/man/man1 $syspath`
8068         ;;
8069 esac
8070 if $test -d "$sysman"; then
8071         echo "System manual is in $sysman." >&4
8072 else
8073         echo "Could not find manual pages in source form." >&4
8074 fi
8075
8076 : determine where manual pages go
8077 set man1dir man1dir none
8078 eval $prefixit
8079 $cat <<EOM
8080
8081 $spackage has manual pages available in source form.
8082 EOM
8083 case "$nroff" in
8084 nroff)
8085         echo "However, you don't have nroff, so they're probably useless to you."
8086         case "$man1dir" in
8087         '') man1dir="none";;
8088         esac;;
8089 esac
8090 echo "If you don't want the manual sources installed, answer 'none'."
8091 case "$man1dir" in
8092 ' ') dflt=none
8093         ;;
8094 '')
8095         lookpath="$prefixexp/share/man/man1"
8096         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8097         lookpath="$lookpath $prefixexp/man/p_man/man1"
8098         lookpath="$lookpath $prefixexp/man/u_man/man1"
8099         lookpath="$lookpath $prefixexp/man/man.1"
8100         case "$sysman" in
8101         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8102         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8103         esac
8104         set dflt
8105         eval $prefixup
8106         ;;
8107 *)  dflt="$man1dir"
8108         ;;
8109 esac
8110 echo " "
8111 fn=dn+~
8112 rp="Where do the main $spackage manual pages (source) go?"
8113 . ./getfile
8114 if $test "X$man1direxp" != "X$ansexp"; then
8115         installman1dir=''
8116 fi
8117 prefixvar=man1dir
8118 . ./setprefixvar
8119
8120 case "$man1dir" in
8121 '')     man1dir=' '
8122         installman1dir='';;
8123 esac
8124
8125 : What suffix to use on installed man pages
8126
8127 case "$man1dir" in
8128 ' ')
8129         man1ext='0'
8130         ;;
8131 *)
8132         rp="What suffix should be used for the main $spackage man pages?"
8133         case "$man1ext" in
8134         '')     case "$man1dir" in
8135                 *1)  dflt=1 ;;
8136                 *1p) dflt=1p ;;
8137                 *1pm) dflt=1pm ;;
8138                 *l) dflt=l;;
8139                 *n) dflt=n;;
8140                 *o) dflt=o;;
8141                 *p) dflt=p;;
8142                 *C) dflt=C;;
8143                 *L) dflt=L;;
8144                 *L1) dflt=L1;;
8145                 *) dflt=1;;
8146                 esac
8147                 ;;
8148         *)      dflt="$man1ext";;
8149         esac
8150         . ./myread
8151         man1ext="$ans"
8152         ;;
8153 esac
8154
8155 : see if we can have long filenames
8156 echo " "
8157 first=123456789abcdef
8158 $rm -f $first
8159 if (echo hi >$first) 2>/dev/null; then
8160         if $test -f 123456789abcde; then
8161                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8162                 val="$undef"
8163         else
8164                 echo 'You can have filenames longer than 14 characters.'>&4
8165                 val="$define"
8166         fi
8167 else
8168         $cat <<'EOM'
8169 You can't have filenames longer than 14 chars.
8170 You can't even think about them!
8171 EOM
8172         val="$undef"
8173 fi 
8174 set d_flexfnam
8175 eval $setvar
8176 $rm -rf 123456789abcde*
8177
8178 : determine where library module manual pages go
8179 set man3dir man3dir none
8180 eval $prefixit
8181 $cat <<EOM
8182
8183 $spackage has manual pages for many of the library modules.
8184 EOM
8185
8186 case "$nroff" in
8187 nroff)
8188         $cat <<'EOM'
8189 However, you don't have nroff, so they're probably useless to you.
8190 EOM
8191         case "$man3dir" in
8192         '') man3dir="none";;
8193         esac;;
8194 esac
8195
8196 case "$d_flexfnam" in
8197 undef)
8198         $cat <<'EOM'
8199 However, your system can't handle the long file names like File::Basename.3.
8200 EOM
8201         case "$man3dir" in
8202         '') man3dir="none";;
8203         esac;;
8204 esac
8205
8206 echo "If you don't want the manual sources installed, answer 'none'."
8207 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8208 case "$man3dir" in
8209 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8210         if $test -d "$privlib/man/man3"; then
8211                 cat <<EOM >&4
8212
8213 WARNING:  Previous versions of perl installed man3 pages into
8214 $privlib/man/man3.  This version will suggest a
8215 new default of $dflt.
8216 EOM
8217                 tdflt=$dflt
8218                 dflt='n'
8219                 rp='Do you wish to preserve the old behavior?(y/n)'
8220                 . ./myread
8221                 case "$ans" in
8222                 y*) dflt="$privlib/man/man3" ;;
8223                 *)  dflt=$tdflt ;;
8224                 esac
8225     fi
8226         ;;
8227 *)      dflt="$man3dir" ;;
8228 esac
8229 case "$dflt" in
8230 ' ') dflt=none ;;
8231 esac
8232 echo " "
8233 fn=dn+~
8234 rp="Where do the $package library man pages (source) go?"
8235 . ./getfile
8236 prefixvar=man3dir
8237 . ./setprefixvar
8238
8239 case "$man3dir" in
8240 '')     man3dir=' '
8241         installman3dir='';;
8242 esac
8243
8244 : What suffix to use on installed man pages
8245 case "$man3dir" in
8246 ' ')
8247         man3ext='0'
8248         ;;
8249 *)
8250         rp="What suffix should be used for the $package library man pages?"
8251         case "$man3ext" in
8252         '')     case "$man3dir" in
8253                 *3)  dflt=3 ;;
8254                 *3p) dflt=3p ;;
8255                 *3pm) dflt=3pm ;;
8256                 *l) dflt=l;;
8257                 *n) dflt=n;;
8258                 *o) dflt=o;;
8259                 *p) dflt=p;;
8260                 *C) dflt=C;;
8261                 *L) dflt=L;;
8262                 *L3) dflt=L3;;
8263                 *) dflt=3;;
8264                 esac
8265                 ;;
8266         *)      dflt="$man3ext";;
8267         esac
8268         . ./myread
8269         man3ext="$ans"
8270         ;;
8271 esac
8272
8273 : see if we have to deal with yellow pages, now NIS.
8274 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8275         if $test -f /usr/etc/nibindd; then
8276                 echo " "
8277                 echo "I'm fairly confident you're on a NeXT."
8278                 echo " "
8279                 rp='Do you get the hosts file via NetInfo?'
8280                 dflt=y
8281                 case "$hostcat" in
8282                 nidump*) ;;
8283                 '') ;;
8284                 *) dflt=n;;
8285                 esac
8286                 . ./myread
8287                 case "$ans" in
8288                 y*) hostcat='nidump hosts .';;
8289                 *)      case "$hostcat" in
8290                         nidump*) hostcat='';;
8291                         esac
8292                         ;;
8293                 esac
8294         fi
8295         case "$hostcat" in
8296         nidump*) ;;
8297         *)
8298                 case "$hostcat" in
8299                 *ypcat*) dflt=y;;
8300                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8301                                 dflt=y
8302                         else
8303                                 dflt=n
8304                         fi;;
8305                 *) dflt=n;;
8306                 esac
8307                 echo " "
8308                 rp='Are you getting the hosts file via yellow pages?'
8309                 . ./myread
8310                 case "$ans" in
8311                 y*) hostcat='ypcat hosts';;
8312                 *) hostcat='cat /etc/hosts';;
8313                 esac
8314                 ;;
8315         esac
8316 fi
8317 case "$hostcat" in
8318 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8319 esac
8320 case "$groupcat" in
8321 '') test -f /etc/group && groupcat='cat /etc/group';;
8322 esac
8323 case "$passcat" in
8324 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8325 esac
8326
8327 : now get the host name
8328 echo " "
8329 echo "Figuring out host name..." >&4
8330 case "$myhostname" in
8331 '') cont=true
8332         echo 'Maybe "hostname" will work...'
8333         if tans=`sh -c hostname 2>&1` ; then
8334                 myhostname=$tans
8335                 phostname=hostname
8336                 cont=''
8337         fi
8338         ;;
8339 *) cont='';;
8340 esac
8341 if $test "$cont"; then
8342         if ./xenix; then
8343                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8344                 if tans=`cat /etc/systemid 2>&1` ; then
8345                         myhostname=$tans
8346                         phostname='cat /etc/systemid'
8347                         echo "Whadyaknow.  Xenix always was a bit strange..."
8348                         cont=''
8349                 fi
8350         elif $test -r /etc/systemid; then
8351                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8352         fi
8353 fi
8354 if $test "$cont"; then
8355         echo 'No, maybe "uuname -l" will work...'
8356         if tans=`sh -c 'uuname -l' 2>&1` ; then
8357                 myhostname=$tans
8358                 phostname='uuname -l'
8359         else
8360                 echo 'Strange.  Maybe "uname -n" will work...'
8361                 if tans=`sh -c 'uname -n' 2>&1` ; then
8362                         myhostname=$tans
8363                         phostname='uname -n'
8364                 else
8365                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8366                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8367                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8368                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8369                         else
8370                                 case "$myhostname" in
8371                                 '') echo "Does this machine have an identity crisis or something?"
8372                                         phostname='';;
8373                                 *)
8374                                         echo "Well, you said $myhostname before..."
8375                                         phostname='echo $myhostname';;
8376                                 esac
8377                         fi
8378                 fi
8379         fi
8380 fi
8381 case "$myhostname" in
8382 '') myhostname=noname ;;
8383 esac
8384 : you do not want to know about this
8385 set $myhostname
8386 myhostname=$1
8387
8388 : verify guess
8389 if $test "$myhostname" ; then
8390         dflt=y
8391         rp='Your host name appears to be "'$myhostname'".'" Right?"
8392         . ./myread
8393         case "$ans" in
8394         y*) ;;
8395         *) myhostname='';;
8396         esac
8397 fi
8398
8399 : bad guess or no guess
8400 while $test "X$myhostname" = X ; do
8401         dflt=''
8402         rp="Please type the (one word) name of your host:"
8403         . ./myread
8404         myhostname="$ans"
8405 done
8406
8407 : translate upper to lower if necessary
8408 case "$myhostname" in
8409 *[A-Z]*)
8410         echo "(Normalizing case in your host name)"
8411         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8412         ;;
8413 esac
8414
8415 case "$myhostname" in
8416 *.*)
8417         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8418         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8419         echo "(Trimming domain name from host name--host name is now $myhostname)"
8420         ;;
8421 *) case "$mydomain" in
8422         '')
8423                 {
8424                         test "X$hostcat" = "Xypcat hosts" &&
8425                         ypmatch "$myhostname" hosts 2>/dev/null |\
8426                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8427                         $test -s hosts
8428                 } || {
8429                         test "X$hostcat" != "X" &&
8430                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8431                                         /[       ]$myhostname[  . ]/p" > hosts
8432                 }
8433                 tmp_re="[       . ]"
8434                 if $test -f hosts; then
8435                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8436                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8437                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8438                                 hosts | $sort | $uniq | \
8439                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8440                         case `$echo X$dflt` in
8441                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8442                                 dflt=.
8443                                 ;;
8444                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8445                                 ;;
8446                         esac
8447                 else
8448                         echo "(I cannot locate a hosts database anywhere)"
8449                         dflt=.
8450                 fi
8451                 case "$dflt" in
8452                 .)
8453                         tans=`./loc resolv.conf X /etc /usr/etc`
8454                         if $test -f "$tans"; then
8455                                 echo "(Attempting domain name extraction from $tans)"
8456                                 dflt=.`$sed -n -e 's/   / /g' \
8457                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8458                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8459                                 case "$dflt" in
8460                                 .) dflt=.`$sed -n -e 's/        / /g' \
8461                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8462                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8463                                         ;;
8464                                 esac
8465                         fi
8466                         ;;
8467                 esac
8468                 case "$dflt" in
8469                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8470                         dflt=.`sh -c domainname 2>/dev/null`
8471                         case "$dflt" in
8472                         '') dflt='.';;
8473                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8474                         esac
8475                         ;;
8476                 esac
8477                 case "$dflt$osname" in
8478                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8479                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8480                         ;;
8481                 esac
8482                 case "$dflt" in
8483                 .) echo "(Lost all hope -- silly guess then)"
8484                         dflt='.nonet'
8485                         ;;
8486                 esac
8487                 $rm -f hosts
8488                 ;;
8489         *) dflt="$mydomain";;
8490         esac;;
8491 esac
8492 echo " "
8493 rp="What is your domain name?"
8494 . ./myread
8495 tans="$ans"
8496 case "$ans" in
8497 '') ;;
8498 .*) ;;
8499 *) tans=".$tans";;
8500 esac
8501 mydomain="$tans"
8502
8503 : translate upper to lower if necessary
8504 case "$mydomain" in
8505 *[A-Z]*)
8506         echo "(Normalizing case in your domain name)"
8507         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8508         ;;
8509 esac
8510
8511 : a little sanity check here
8512 case "$phostname" in
8513 '') ;;
8514 *)
8515         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8516         $myhostname$mydomain|$myhostname) ;;
8517         *)
8518                 case "$phostname" in
8519                 sed*)
8520                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8521                         ;;
8522                 *)
8523                         echo "(That doesn't agree with your $phostname command, by the way.)"
8524                         ;;
8525                 esac
8526         ;;
8527         esac
8528         ;;
8529 esac
8530
8531 $cat <<EOM
8532
8533 I need to get your e-mail address in Internet format if possible, i.e.
8534 something like user@host.domain. Please answer accurately since I have
8535 no easy means to double check it. The default value provided below
8536 is most probably close to reality but may not be valid from outside
8537 your organization...
8538
8539 EOM
8540 cont=x
8541 while test "$cont"; do
8542         case "$cf_email" in
8543         '') dflt="$cf_by@$myhostname$mydomain";;
8544         *) dflt="$cf_email";;
8545         esac
8546         rp='What is your e-mail address?'
8547         . ./myread
8548         cf_email="$ans"
8549         case "$cf_email" in
8550         *@*.*) cont='' ;;
8551         *)
8552                 rp='Address does not look like an Internet one.  Use it anyway?'
8553                 case "$fastread" in
8554                 yes) dflt=y ;;
8555                 *) dflt=n ;;
8556                 esac
8557                 . ./myread
8558                 case "$ans" in
8559                 y*) cont='' ;;
8560                 *) echo " " ;;
8561                 esac
8562                 ;;
8563         esac
8564 done
8565
8566 $cat <<EOM
8567
8568 If you or somebody else will be maintaining perl at your site, please
8569 fill in the correct e-mail address here so that they may be contacted
8570 if necessary. Currently, the "perlbug" program included with perl
8571 will send mail to this address in addition to perlbug@perl.org. You may
8572 enter "none" for no administrator.
8573
8574 EOM
8575 case "$perladmin" in
8576 '') dflt="$cf_email";;
8577 *) dflt="$perladmin";;
8578 esac
8579 rp='Perl administrator e-mail address'
8580 . ./myread
8581 perladmin="$ans"
8582
8583 : determine whether to only install version-specific parts.
8584 echo " "
8585 $cat <<EOM
8586 Do you want to install only the version-specific parts of the perl
8587 distribution?  Usually you do *not* want to do this.
8588 EOM
8589 case "$versiononly" in
8590 "$define"|[Yy]*|true) dflt='y' ;;
8591 *) dflt='n';
8592 esac
8593 rp="Do you want to install only the version-specific parts of perl?"
8594 . ./myread
8595 case "$ans" in
8596 [yY]*)  val="$define";;
8597 *)      val="$undef" ;;
8598 esac
8599 set versiononly
8600 eval $setvar
8601
8602 case "$versiononly" in
8603 "$define") inc_version_list=''
8604            inc_version_list_init=0
8605            ;;
8606 esac
8607
8608 : figure out how to guarantee perl startup
8609 : XXX Note that this currently takes advantage of the bug that binexp ignores
8610 :     the Configure -Dinstallprefix setting, which in turn means that under
8611 :     relocatable @INC, initialinstalllocation is what binexp started as.
8612 case "$startperl" in
8613 '')
8614         case "$sharpbang" in
8615         *!)
8616                 $cat <<EOH
8617
8618 I can use the #! construct to start perl on your system. This will
8619 make startup of perl scripts faster, but may cause problems if you
8620 want to share those scripts and perl is not in a standard place
8621 ($initialinstalllocation/perl) on all your platforms. The alternative
8622 is to force a shell by starting the script with a single ':' character.
8623
8624 EOH
8625                 case "$versiononly" in
8626                 "$define")      dflt="$initialinstalllocation/perl$version";;
8627                 *)              dflt="$initialinstalllocation/perl";;
8628                 esac
8629                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8630                 . ./myread
8631                 case "$ans" in
8632                 none)   startperl=": # use perl";;
8633                 *)      startperl="#!$ans"
8634                         if $test 30 -lt `echo "$ans" | wc -c`; then
8635                                 $cat >&4 <<EOM
8636
8637 WARNING:  Some systems limit the #! command to 32 characters.
8638 If you experience difficulty running Perl scripts with #!, try
8639 installing Perl in a directory with a shorter pathname.
8640
8641 EOM
8642                         fi ;;
8643                 esac
8644                 ;;
8645         *) startperl=": # use perl"
8646                 ;;
8647         esac
8648         ;;
8649 esac
8650 echo "I'll use $startperl to start perl scripts."
8651
8652 : figure best path for perl in scripts
8653 case "$perlpath" in
8654 '')
8655         case "$versiononly" in
8656         "$define")      perlpath="$initialinstalllocation/perl$version";;
8657         *)              perlpath="$initialinstalllocation/perl";;
8658         esac
8659         case "$startperl" in
8660         *!*) ;;
8661         *)
8662                 $cat <<EOH
8663
8664 I will use the "eval 'exec'" idiom to start Perl on your system.
8665 I can use the full path of your Perl binary for this purpose, but
8666 doing so may cause problems if you want to share those scripts and
8667 Perl is not always in a standard place ($initialinstalllocation/perl).
8668
8669 EOH
8670                 dflt="$initialinstalllocation/perl"
8671                 rp="What path shall I use in \"eval 'exec'\"?"
8672                 . ./myread
8673                 perlpath="$ans"
8674                 ;;
8675         esac
8676         ;;
8677 esac
8678 case "$startperl" in
8679 *!*)    ;;
8680 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8681 esac
8682
8683 : determine where public executable scripts go
8684 set scriptdir scriptdir
8685 eval $prefixit
8686 case "$scriptdir" in
8687 '')
8688         dflt="$bin"
8689         : guess some guesses
8690         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8691         $test -d /usr/share/bin     && dflt=/usr/share/bin
8692         $test -d /usr/local/script  && dflt=/usr/local/script
8693         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8694         $test -d $prefixexp/script  && dflt=$prefixexp/script
8695         set dflt
8696         eval $prefixup
8697         ;;
8698 *)  dflt="$scriptdir"
8699         ;;
8700 esac
8701 $cat <<EOM
8702
8703 Some installations have a separate directory just for executable scripts so
8704 that they can mount it across multiple architectures but keep the scripts in
8705 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8706 Or you might just lump your scripts in with all your other executables.
8707
8708 EOM
8709 fn=d~
8710 rp='Where do you keep publicly executable scripts?'
8711 . ./getfile
8712 if $test "X$ansexp" != "X$scriptdirexp"; then
8713         installscript=''
8714 fi
8715 installscriptdir=''
8716 prefixvar=scriptdir
8717 . ./setprefixvar
8718 : A little fix up for an irregularly named variable.
8719 installscript="$installscriptdir"
8720
8721 : determine where add-on public executables go
8722 case "$sitebin" in
8723 '')     dflt=$siteprefix/bin ;;
8724 *)      dflt=$sitebin ;;
8725 esac
8726 fn=d~
8727 rp='Pathname where the add-on public executables should be installed?'
8728 . ./getfile
8729 prefixvar=sitebin
8730 . ./setprefixvar
8731
8732 : determine where add-on html pages go
8733 : There is no standard location, so try to copy the previously-selected
8734 : directory structure for the core html pages.
8735 case "$sitehtml1dir" in
8736 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8737 *)     dflt=$sitehtml1dir ;;
8738 esac
8739 case "$dflt" in
8740 ''|' ') dflt=none ;;
8741 esac
8742 fn=dn+~
8743 rp='Pathname where the site-specific html pages should be installed?'
8744 . ./getfile
8745 prefixvar=sitehtml1dir
8746 . ./setprefixvar
8747
8748 : determine where add-on library html pages go
8749 : There is no standard location, so try to copy the previously-selected
8750 : directory structure for the core html pages.
8751 case "$sitehtml3dir" in
8752 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8753 *)     dflt=$sitehtml3dir ;;
8754 esac
8755 case "$dflt" in
8756 ''|' ') dflt=none ;;
8757 esac
8758 fn=dn+~
8759 rp='Pathname where the site-specific library html pages should be installed?'
8760 . ./getfile
8761 prefixvar=sitehtml3dir
8762 . ./setprefixvar
8763
8764 : determine where add-on manual pages go
8765 case "$siteman1dir" in
8766 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8767 *)      dflt=$siteman1dir ;;
8768 esac
8769 case "$dflt" in
8770 ''|' ') dflt=none ;;
8771 esac
8772 fn=dn+~
8773 rp='Pathname where the site-specific manual pages should be installed?'
8774 . ./getfile
8775 prefixvar=siteman1dir
8776 . ./setprefixvar
8777
8778 : determine where add-on library man pages go
8779 case "$siteman3dir" in
8780 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8781 *)      dflt=$siteman3dir ;;
8782 esac
8783 case "$dflt" in
8784 ''|' ') dflt=none ;;
8785 esac
8786 fn=dn+~
8787 rp='Pathname where the site-specific library manual pages should be installed?'
8788 . ./getfile
8789 prefixvar=siteman3dir
8790 . ./setprefixvar
8791
8792 : determine where add-on public executable scripts go
8793 case "$sitescript" in
8794 '')     dflt=$siteprefix/script
8795         $test -d $dflt || dflt=$sitebin ;;
8796 *)  dflt="$sitescript" ;;
8797 esac
8798 fn=d~+
8799 rp='Pathname where add-on public executable scripts should be installed?'
8800 . ./getfile
8801 prefixvar=sitescript
8802 . ./setprefixvar
8803
8804 case "$usefaststdio" in
8805 $define|true|[yY]*|'')
8806         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8807         case "$xversion" in
8808         [68])   dflt='y' ;;
8809         *)      dflt='n' ;;
8810         esac
8811         ;;
8812 *) dflt='n';;
8813 esac
8814 cat <<EOM
8815
8816 Perl can be built to use 'fast stdio', which means using the stdio
8817 library but also directly manipulating the stdio buffers to enable
8818 faster I/O.  Using stdio is better for backward compatibility (especially
8819 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8820 interface has been preferred instead of stdio.
8821
8822 If this doesn't make any sense to you, just accept the default '$dflt'.
8823 EOM
8824 rp='Use the "fast stdio" if available?'
8825 . ./myread
8826 case "$ans" in
8827 y|Y)    val="$define" ;;     
8828 *)      val="$undef" ;;
8829 esac
8830 set usefaststdio
8831 eval $setvar
8832
8833
8834 : define an is-a-typedef? function
8835 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8836 case "$inclist" in
8837 "") inclist="sys/types.h";;
8838 esac;
8839 eval "varval=\$$var";
8840 case "$varval" in
8841 "")
8842         $rm -f temp.c;
8843         for inc in $inclist; do
8844                 echo "#include <$inc>" >>temp.c;
8845         done;
8846         echo "#ifdef $type" >> temp.c;
8847         echo "printf(\"We have $type\");" >> temp.c;
8848         echo "#endif" >> temp.c;
8849         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8850         if $contains $type temp.E >/dev/null 2>&1; then
8851                 eval "$var=\$type";
8852         else
8853                 eval "$var=\$def";
8854         fi;
8855         $rm -f temp.?;;
8856 *) eval "$var=\$varval";;
8857 esac'
8858
8859 : define an is-a-typedef? function that prompts if the type is not available.
8860 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8861 case "$inclist" in
8862 "") inclist="sys/types.h";;
8863 esac;
8864 eval "varval=\$$var";
8865 case "$varval" in
8866 "")
8867         $rm -f temp.c;
8868         for inc in $inclist; do
8869                 echo "#include <$inc>" >>temp.c;
8870         done;
8871         echo "#ifdef $type" >> temp.c;
8872         echo "printf(\"We have $type\");" >> temp.c;
8873         echo "#endif" >> temp.c;
8874         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8875         echo " " ;
8876         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8877         if $contains $type temp.E >/dev/null 2>&1; then
8878                 echo "$type found." >&4;
8879                 eval "$var=\$type";
8880         else
8881                 echo "$type NOT found." >&4;
8882                 dflt="$def";
8883                 . ./myread ;
8884                 eval "$var=\$ans";
8885         fi;
8886         $rm -f temp.?;;
8887 *) eval "$var=\$varval";;
8888 esac'
8889
8890 : see what type lseek is declared as in the kernel
8891 rp="What is the type used for lseek's offset on this system?"
8892 set off_t lseektype long stdio.h sys/types.h
8893 eval $typedef_ask
8894
8895 echo " "
8896 echo "Checking to see how big your file offsets are..." >&4
8897 $cat >try.c <<EOCP
8898 #include <sys/types.h>
8899 #include <stdio.h>
8900 int main()
8901 {
8902     printf("%d\n", (int)sizeof($lseektype));
8903     return(0); 
8904 }
8905 EOCP
8906 set try
8907 if eval $compile_ok; then
8908         lseeksize=`$run ./try`
8909         echo "Your file offsets are $lseeksize bytes long."
8910 else
8911         dflt=$longsize
8912         echo " "
8913         echo "(I can't seem to compile the test program.  Guessing...)"
8914         rp="What is the size of your file offsets (in bytes)?"
8915         . ./myread
8916         lseeksize="$ans"
8917 fi
8918 $rm -f try.c try
8919
8920 : see what type file positions are declared as in the library
8921 rp="What is the type for file position used by fsetpos()?"
8922 set fpos_t fpostype long stdio.h sys/types.h
8923 eval $typedef_ask
8924
8925 echo " "
8926 case "$fpostype" in
8927 *_t) zzz="$fpostype"    ;;
8928 *)   zzz="fpos_t"       ;;
8929 esac
8930 echo "Checking the size of $zzz..." >&4 
8931 cat > try.c <<EOCP
8932 #include <sys/types.h>
8933 #include <stdio.h>
8934 #$i_stdlib I_STDLIB
8935 #ifdef I_STDLIB
8936 #include <stdlib.h>
8937 #endif
8938 int main() {
8939     printf("%d\n", (int)sizeof($fpostype));
8940     exit(0);
8941 }
8942 EOCP
8943 set try
8944 if eval $compile_ok; then
8945         yyy=`$run ./try`
8946         case "$yyy" in
8947         '')     fpossize=4
8948                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8949                 ;;
8950         *)      fpossize=$yyy
8951                 echo "Your $zzz is $fpossize bytes long."
8952                 ;;
8953         esac
8954 else
8955         dflt="$longsize"
8956         echo " " >&4
8957         echo "(I can't compile the test program.  Guessing...)" >&4
8958         rp="What is the size of your file positions (in bytes)?"
8959         . ./myread
8960         fpossize="$ans"
8961 fi
8962
8963 # Backward compatibility (uselfs is deprecated).
8964 case "$uselfs" in
8965 "$define"|true|[yY]*)
8966         cat <<EOM >&4
8967
8968 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8969 EOM
8970         uselargefiles="$define"
8971         ;;
8972 esac                          
8973
8974 case "$lseeksize:$fpossize" in
8975 8:8) cat <<EOM
8976
8977 You can have files larger than 2 gigabytes.
8978 EOM
8979    val="$define" ;;
8980 *)    case "$uselargefiles" in
8981    "$undef"|false|[nN]*) dflt='n' ;;
8982    *)   dflt='y' ;;
8983    esac
8984    cat <<EOM
8985
8986 Perl can be built to understand large files (files larger than 2 gigabytes)
8987 on some systems.  To do so, Configure can be run with -Duselargefiles.
8988
8989 If this doesn't make any sense to you, just accept the default '$dflt'.
8990 EOM
8991    rp='Try to understand large files, if available?'
8992    . ./myread
8993    case "$ans" in
8994    y|Y)         val="$define" ;;
8995    *)           val="$undef"  ;;
8996    esac
8997    ;;
8998 esac
8999 set uselargefiles
9000 eval $setvar
9001 : Look for a hint-file generated 'call-back-unit'.  If the
9002 : user has specified that a large files perl is to be built,
9003 : we may need to set or change some other defaults.
9004 if $test -f uselargefiles.cbu; then
9005         echo "Your platform has some specific hints regarding large file builds, using them..."
9006         . ./uselargefiles.cbu
9007 fi
9008 case "$uselargefiles" in
9009 "$define")
9010         if $test -f uselargefiles.cbu; then
9011                 echo " "
9012                 echo "Rechecking to see how big your file offsets are..." >&4
9013                 $cat >try.c <<EOCP
9014 #include <sys/types.h>
9015 #include <stdio.h>
9016 int main()
9017 {
9018     printf("%d\n", (int)sizeof($lseektype));
9019     return(0); 
9020 }
9021 EOCP
9022                 set try
9023                 if eval $compile_ok; then
9024                         lseeksize=`$run ./try`
9025                         $echo "Your file offsets are now $lseeksize bytes long."
9026                 else
9027                         dflt="$lseeksize"
9028                         echo " "
9029                         echo "(I can't seem to compile the test program.  Guessing...)"
9030                         rp="What is the size of your file offsets (in bytes)?"
9031                         . ./myread
9032                         lseeksize="$ans"
9033                 fi
9034                 case "$fpostype" in
9035                 *_t) zzz="$fpostype"    ;;
9036                 *)   zzz="fpos_t"       ;;
9037                 esac
9038                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9039                 $cat > try.c <<EOCP
9040 #include <sys/types.h>
9041 #include <stdio.h>
9042 #$i_stdlib I_STDLIB
9043 #ifdef I_STDLIB
9044 #include <stdlib.h>
9045 #endif
9046 int main() {
9047     printf("%d\n", (int)sizeof($fpostype));
9048     return(0);
9049 }
9050 EOCP
9051                 set try
9052                 if eval $compile_ok; then
9053                         yyy=`$run ./try`
9054                         dflt="$lseeksize"
9055                         case "$yyy" in
9056                         '')     echo " "
9057                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9058                                 ;;
9059                         *)      fpossize=$yyy
9060                                 echo " $fpossize bytes." >&4
9061                                 ;;
9062                         esac
9063                 else
9064                         dflt="$fpossize"
9065                         echo " "
9066                         echo "(I can't compile the test program.  Guessing...)" >&4
9067                         rp="What is the size of your file positions (in bytes)?"
9068                         . ./myread
9069                         fpossize="$ans"
9070                 fi
9071                 $rm -f try.c try
9072         fi
9073         ;;
9074 esac
9075
9076 case "$vendorprefix" in
9077 '')     d_vendorbin="$undef"
9078         vendorbin=''
9079         vendorbinexp=''
9080         ;;
9081 *)      d_vendorbin="$define"
9082         : determine where vendor-supplied executables go.
9083         case "$vendorbin" in
9084         '') dflt=$vendorprefix/bin ;;
9085         *)      dflt="$vendorbin" ;;
9086         esac
9087         fn=d~+
9088         rp='Pathname for the vendor-supplied executables directory?'
9089         . ./getfile
9090         vendorbin="$ans"
9091         vendorbinexp="$ansexp"
9092         ;;
9093 esac
9094 prefixvar=vendorbin
9095 . ./installprefix
9096
9097 case "$vendorprefix" in
9098 '')     vendorhtml1dir=''
9099         vendorhtml1direxp=''
9100         ;;
9101 *)      : determine where vendor-supplied html pages go.
9102         : There is no standard location, so try to copy the previously-selected
9103         : directory structure for the core html pages.
9104         : XXX Better default suggestions would be welcome.
9105         case "$vendorhtml1dir" in
9106         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9107         *)      dflt=$vendorhtml1dir ;;
9108         esac
9109         case "$dflt" in
9110         ''|' ') dflt=none ;;
9111         esac
9112         fn=dn+~
9113         rp='Pathname for the vendor-supplied html pages?'
9114         . ./getfile
9115         vendorhtml1dir="$ans"
9116         vendorhtml1direxp="$ansexp"
9117         ;;
9118 esac
9119 : Use ' ' for none so value is preserved next time through Configure
9120 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9121 prefixvar=vendorhtml1dir
9122 . ./installprefix
9123
9124 case "$vendorprefix" in
9125 '')     vendorhtml3dir=''
9126         vendorhtml3direxp=''
9127         ;;
9128 *)      : determine where vendor-supplied module html pages go.
9129         : There is no standard location, so try to copy the previously-selected
9130         : directory structure for the core html pages.
9131         : XXX Better default suggestions would be welcome.
9132         case "$vendorhtml3dir" in
9133         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9134         *)      dflt=$vendorhtml3dir ;;
9135         esac
9136         case "$dflt" in
9137         ''|' ') dflt=none ;;
9138         esac
9139         fn=dn+~
9140         rp='Pathname for the vendor-supplied html pages?'
9141         . ./getfile
9142         vendorhtml3dir="$ans"
9143         vendorhtml3direxp="$ansexp"
9144         ;;
9145 esac
9146 : Use ' ' for none so value is preserved next time through Configure
9147 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9148 prefixvar=vendorhtml3dir
9149 . ./installprefix
9150
9151 case "$vendorprefix" in
9152 '')     vendorman1dir=''
9153         vendorman1direxp=''
9154         ;;
9155 *)      : determine where vendor-supplied manual pages go.
9156         case "$vendorman1dir" in
9157         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9158         *)      dflt=$vendorman1dir ;;
9159         esac
9160         case "$dflt" in
9161         ''|' ') dflt=none ;;
9162         esac
9163         fn=nd~+
9164         rp='Pathname for the vendor-supplied manual section 1 pages?'
9165         . ./getfile
9166         vendorman1dir="$ans"
9167         vendorman1direxp="$ansexp"
9168         ;;
9169 esac
9170 : Use ' ' for none so value is preserved next time through Configure
9171 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9172 prefixvar=vendorman1dir
9173 . ./installprefix
9174
9175 case "$vendorprefix" in
9176 '')     vendorman3dir=''
9177         vendorman3direxp=''
9178         ;;
9179 *)      : determine where vendor-supplied module manual pages go.
9180         case "$vendorman3dir" in
9181         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9182         *)      dflt=$vendorman3dir ;;
9183         esac
9184         case "$dflt" in
9185         ''|' ') dflt=none ;;
9186         esac
9187         fn=nd~+
9188         rp='Pathname for the vendor-supplied manual section 3 pages?'
9189         . ./getfile
9190         vendorman3dir="$ans"
9191         vendorman3direxp="$ansexp"
9192         ;;
9193 esac
9194 : Use ' ' for none so value is preserved next time through Configure
9195 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9196 prefixvar=vendorman3dir
9197 . ./installprefix
9198
9199 case "$vendorprefix" in
9200 '')     d_vendorscript="$undef"
9201         vendorscript=''
9202         vendorscriptexp=''
9203         ;;
9204 *)      d_vendorscript="$define"
9205         : determine where vendor-supplied scripts go.
9206         case "$vendorscript" in
9207         '')     dflt=$vendorprefix/script
9208                 $test -d $dflt || dflt=$vendorbin ;;
9209         *)  dflt="$vendorscript" ;;
9210         esac
9211         $cat <<EOM
9212
9213 The installation process will create a directory for
9214 vendor-supplied scripts.
9215
9216 EOM
9217         fn=d~+
9218         rp='Pathname for the vendor-supplied scripts directory?'
9219         . ./getfile
9220         vendorscript="$ans"
9221         vendorscriptexp="$ansexp"
9222         ;;
9223 esac
9224 prefixvar=vendorscript
9225 . ./installprefix
9226
9227 : see if qgcvt exists
9228 set qgcvt d_qgcvt
9229 eval $inlibc
9230
9231 echo " "
9232
9233 if $test X"$d_longdbl" = X"$define"; then
9234
9235 echo "Checking how to print long doubles..." >&4
9236
9237 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9238         $cat >try.c <<'EOCP'
9239 #include <sys/types.h>
9240 #include <stdio.h>
9241 int main() {
9242   double d = 123.456;
9243   printf("%.3f\n", d);
9244 }
9245 EOCP
9246         set try
9247         if eval $compile; then
9248                 yyy=`$run ./try`
9249                 case "$yyy" in
9250                 123.456)
9251                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9252                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9253                         echo "We will use %f."
9254                         ;;
9255                 esac
9256         fi
9257 fi
9258
9259 if $test X"$sPRIfldbl" = X; then
9260         $cat >try.c <<'EOCP'
9261 #include <sys/types.h>
9262 #include <stdio.h>
9263 int main() {
9264   long double d = 123.456;
9265   printf("%.3Lf\n", d);
9266 }
9267 EOCP
9268         set try
9269         if eval $compile; then
9270                 yyy=`$run ./try`
9271                 case "$yyy" in
9272                 123.456)
9273                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9274                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9275                         echo "We will use %Lf."
9276                         ;;
9277                 esac
9278         fi
9279 fi
9280
9281 if $test X"$sPRIfldbl" = X; then
9282         $cat >try.c <<'EOCP'
9283 #include <sys/types.h>
9284 #include <stdio.h>
9285 int main() {
9286   long double d = 123.456;
9287   printf("%.3llf\n", d);
9288 }
9289 EOCP
9290         set try
9291         if eval $compile; then
9292                 yyy=`$run ./try`
9293                 case "$yyy" in
9294                 123.456)
9295                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9296                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9297                         echo "We will use %llf."
9298                         ;;
9299                 esac
9300         fi
9301 fi
9302
9303 if $test X"$sPRIfldbl" = X; then
9304         $cat >try.c <<'EOCP'
9305 #include <sys/types.h>
9306 #include <stdio.h>
9307 int main() {
9308   long double d = 123.456;
9309   printf("%.3lf\n", d);
9310 }
9311 EOCP
9312         set try
9313         if eval $compile; then
9314                 yyy=`$run ./try`
9315                 case "$yyy" in
9316                 123.456)
9317                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9318                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9319                         echo "We will use %lf."
9320                         ;;
9321                 esac
9322         fi
9323 fi
9324
9325 if $test X"$sPRIfldbl" = X; then
9326         echo "Cannot figure out how to print long doubles." >&4
9327 else
9328         sSCNfldbl=$sPRIfldbl    # expect consistency
9329 fi
9330
9331 $rm -f try try.*
9332
9333 fi # d_longdbl
9334
9335 case "$sPRIfldbl" in
9336 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9337         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9338         d_SCNfldbl="$undef";
9339         ;;
9340 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9341         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9342         d_SCNfldbl="$define";
9343         ;;
9344 esac
9345
9346 : Check how to convert floats to strings.
9347
9348 if test "X$d_Gconvert" = X; then
9349
9350 echo " "
9351 echo "Checking for an efficient way to convert floats to strings."
9352 echo " " > try.c
9353 case "$uselongdouble" in
9354 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9355 esac
9356 case "$d_longdbl" in
9357 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9358 esac
9359 case "$d_PRIgldbl" in
9360 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9361 esac
9362 $cat >>try.c <<EOP
9363 #ifdef TRY_gconvert
9364 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9365 char *myname = "gconvert";
9366 #endif
9367 #ifdef TRY_gcvt
9368 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9369 char *myname = "gcvt";
9370 #endif
9371 #ifdef TRY_qgcvt
9372 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9373 char *myname = "qgcvt";
9374 #define DOUBLETYPE long double
9375 #endif
9376 #ifdef TRY_sprintf
9377 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9378 #ifdef HAS_PRIgldbl
9379 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9380 #else
9381 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9382 #endif
9383 #else
9384 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9385 #endif
9386 char *myname = "sprintf";
9387 #endif
9388
9389 #ifndef DOUBLETYPE
9390 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9391 #define DOUBLETYPE long double
9392 #else
9393 #define DOUBLETYPE double
9394 #endif
9395 #endif
9396
9397 #include <stdio.h>
9398
9399 #define I_STDLIB $i_stdlib
9400 #ifdef I_STDLIB
9401 #include <stdlib.h>
9402 #endif
9403
9404 int
9405 checkit(expect, got)
9406 char *expect;
9407 char *got;
9408 {
9409     if (strcmp(expect, got)) {
9410                 printf("%s oddity:  Expected %s, got %s\n",
9411                         myname, expect, got);
9412                 exit(1);
9413         }
9414 }
9415
9416 int main()
9417
9418         char buf[64]; 
9419         buf[63] = '\0';
9420
9421         /* This must be 1st test on (which?) platform */
9422         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9423         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9424         checkit("0.1", buf);
9425
9426         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9427         checkit("0.01", buf);
9428
9429         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9430         checkit("0.001", buf);
9431
9432         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9433         checkit("0.0001", buf);
9434
9435         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9436         if (strlen(buf) > 5)
9437             checkit("9e-005", buf); /* for Microsoft ?? */
9438         else
9439             checkit("9e-05", buf);
9440
9441         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9442         checkit("1", buf);
9443
9444         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9445         checkit("1.1", buf);
9446
9447         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9448         checkit("1.01", buf);
9449
9450         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9451         checkit("1.001", buf);
9452
9453         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9454         checkit("1.0001", buf);
9455
9456         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9457         checkit("1.00001", buf);
9458
9459         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9460         checkit("1.000001", buf);
9461
9462         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9463         checkit("0", buf);
9464
9465         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9466         checkit("-1", buf);
9467
9468         /* Some Linux gcvt's give 1.e+5 here. */
9469         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9470         checkit("100000", buf);
9471         
9472         /* Some Linux gcvt's give -1.e+5 here. */
9473         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9474         checkit("-100000", buf);
9475
9476         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9477         checkit("123.456", buf);
9478
9479         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9480         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9481         /* 34 should be enough to scare even long double
9482          * places into using the e notation. */
9483         if (strlen(buf) > 5)
9484             checkit("1e+034", buf); /* for Microsoft */
9485         else
9486             checkit("1e+34", buf);
9487
9488         /* For Perl, if you add additional tests here, also add them to
9489          * t/base/num.t for benefit of platforms not using Configure or
9490          * overriding d_Gconvert */
9491
9492         exit(0);
9493 }
9494 EOP
9495 : first add preferred functions to our list
9496 xxx_list=""
9497 for xxx_convert in $gconvert_preference; do
9498     case $xxx_convert in
9499     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9500     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9501     esac 
9502 done
9503 : then add any others
9504 for xxx_convert in gconvert gcvt sprintf; do
9505     case "$xxx_list" in
9506     *$xxx_convert*) ;;
9507     *) xxx_list="$xxx_list $xxx_convert" ;;
9508     esac 
9509 done
9510
9511 case "$d_longdbl$uselongdouble" in
9512 "$define$define")
9513     : again, add prefered functions to our list first
9514     xxx_ld_list=""
9515     for xxx_convert in $gconvert_ld_preference; do
9516         case $xxx_convert in
9517         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9518         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9519         esac
9520     done
9521     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9522     for xxx_convert in qgcvt sprintf $xxx_list; do
9523         case "$xxx_ld_list" in
9524         $xxx_convert*|*" $xxx_convert"*) ;;
9525         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9526         esac
9527     done
9528     : if sprintf cannot do long doubles, move it to the end
9529     if test "$d_PRIgldbl" != "$define"; then
9530         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9531     fi
9532     : if no qgcvt, remove it
9533     if test "$d_qgcvt" != "$define"; then
9534         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9535     fi
9536     : use the ld_list
9537     xxx_list="$xxx_ld_list"
9538     ;;
9539 esac
9540
9541 for xxx_convert in $xxx_list; do
9542         echo "Trying $xxx_convert..."
9543         $rm -f try try$_o
9544         set try -DTRY_$xxx_convert
9545         if eval $compile; then
9546                 echo "$xxx_convert() found." >&4
9547                 if $run ./try; then
9548                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9549                         break;
9550                 else
9551                         echo "...But $xxx_convert didn't work as I expected."
9552                         xxx_convert=''
9553                 fi
9554         else
9555                 echo "$xxx_convert NOT found." >&4
9556         fi
9557 done
9558
9559 if test X$xxx_convert = X; then
9560     echo "*** WHOA THERE!!! ***" >&4
9561     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9562     xxx_convert=sprintf
9563 fi
9564
9565 case "$xxx_convert" in
9566 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9567 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9568 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9569 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9570    "$define$define$define")
9571       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9572    "$define$define$undef")
9573       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9574    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9575    esac
9576    ;;  
9577 esac
9578
9579 fi
9580
9581 : see if _fwalk exists
9582 set fwalk d__fwalk
9583 eval $inlibc
9584
9585 : Initialize h_fcntl
9586 h_fcntl=false
9587
9588 : Initialize h_sysfile
9589 h_sysfile=false
9590
9591 : access call always available on UNIX
9592 set access d_access
9593 eval $inlibc
9594
9595 : locate the flags for 'access()'
9596 case "$d_access" in
9597 "$define")
9598         echo " "
9599         $cat >access.c <<EOCP
9600 #include <sys/types.h>
9601 #ifdef I_FCNTL
9602 #include <fcntl.h>
9603 #endif
9604 #ifdef I_SYS_FILE
9605 #include <sys/file.h>
9606 #endif
9607 #ifdef I_UNISTD
9608 #include <unistd.h>
9609 #endif
9610 #$i_stdlib I_STDLIB
9611 #ifdef I_STDLIB
9612 #include <stdlib.h>
9613 #endif
9614 int main() {
9615         exit(R_OK);
9616 }
9617 EOCP
9618         : check sys/file.h first, no particular reason here
9619         if $test `./findhdr sys/file.h` && \
9620                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9621                 h_sysfile=true;
9622                 echo "<sys/file.h> defines the *_OK access constants." >&4
9623         elif $test `./findhdr fcntl.h` && \
9624                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9625                 h_fcntl=true;
9626                 echo "<fcntl.h> defines the *_OK access constants." >&4
9627         elif $test `./findhdr unistd.h` && \
9628                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9629                 echo "<unistd.h> defines the *_OK access constants." >&4
9630         else
9631                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9632         fi
9633         ;;
9634 esac
9635 $rm -f access*
9636
9637 : see if accessx exists
9638 set accessx d_accessx
9639 eval $inlibc
9640
9641 : see if aintl exists
9642 set aintl d_aintl
9643 eval $inlibc
9644
9645 : see if alarm exists
9646 set alarm d_alarm
9647 eval $inlibc
9648
9649 : see if POSIX threads are available
9650 set pthread.h i_pthread
9651 eval $inhdr
9652
9653 : define a fucntion to check prototypes
9654 $cat > protochk <<EOSH
9655 $startsh
9656 cc="$cc"
9657 optimize="$optimize"
9658 ccflags="$ccflags"
9659 prototype="$prototype"
9660 define="$define"
9661 rm=$rm
9662 usethreads=$usethreads
9663 i_pthread=$i_pthread
9664 pthread_h_first=$pthread_h_first
9665 EOSH
9666
9667 $cat >> protochk <<'EOSH'
9668
9669 $rm -f try.c
9670 foo="$1"
9671 shift
9672 while test $# -ge 2; do
9673         case "$1" in
9674                 $define) echo "#include <$2>" >> try.c ;;
9675                 literal) echo "$2" >> try.c ;;
9676         esac
9677     # Extra magic for the benefit of systems that need pthread.h
9678     # to be included early to correctly detect threadsafe functions.
9679     # Such functions must guarantee themselves, though, that the usethreads
9680     # and i_pthread have been defined, before calling protochk.
9681     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9682         echo "#include <pthread.h>" >> try.c
9683         pthread_h_done=yes
9684     fi
9685     shift 2
9686 done
9687 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9688 cat >> try.c <<'EOCP'
9689 #ifdef CAN_PROTOTYPE
9690 #define _(args) args
9691 #else
9692 #define _(args) ()
9693 #endif
9694 EOCP
9695 echo "$foo" >> try.c
9696 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9697 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9698 status=$?
9699 $rm -f try.[co]
9700 exit $status
9701 EOSH
9702 chmod +x protochk
9703 $eunicefix protochk
9704
9705 hasproto='varname=$1; func=$2; shift; shift;
9706 while $test $# -ge 2; do
9707         case "$1" in
9708         $define) echo "#include <$2>";;
9709         esac ;
9710     shift 2;
9711 done > try.c;
9712 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9713 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9714         echo "$func() prototype found.";
9715         val="$define";
9716 else
9717         echo "$func() prototype NOT found.";
9718         val="$undef";
9719 fi;
9720 set $varname;
9721 eval $setvar;
9722 $rm -f try.c tryout.c'
9723
9724 : see if sys/types.h has to be included
9725 set sys/types.h i_systypes
9726 eval $inhdr
9727
9728 : see if sys/select.h has to be included
9729 set sys/select.h i_sysselct
9730 eval $inhdr
9731
9732 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9733 while $test $# -ge 2; do
9734         case "$1" in
9735         $define) echo "#include <$2>";;
9736         esac ;
9737     shift 2;
9738 done > try.c;
9739 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9740 set try;
9741 if eval $compile; then
9742         val="$define";
9743 else
9744         val="$undef";
9745 fi;
9746 set $varname;
9747 eval $setvar;
9748 $rm -f try.c try.o'
9749
9750 : see if we should include time.h, sys/time.h, or both
9751 echo " "
9752 if test "X$timeincl" = X; then
9753         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9754         $echo $n "I'm now running the test program...$c"
9755         $cat >try.c <<EOCP
9756 #include <sys/types.h>
9757 #ifdef I_TIME
9758 #include <time.h>
9759 #endif
9760 #ifdef I_SYSTIME
9761 #ifdef SYSTIMEKERNEL
9762 #define KERNEL
9763 #endif
9764 #include <sys/time.h>
9765 #endif
9766 #ifdef I_SYSSELECT
9767 #include <sys/select.h>
9768 #endif
9769 #$i_stdlib I_STDLIB
9770 #ifdef I_STDLIB
9771 #include <stdlib.h>
9772 #endif
9773 int main()
9774 {
9775         struct tm foo;
9776 #ifdef S_TIMEVAL
9777         struct timeval bar;
9778 #endif
9779 #ifdef S_TIMEZONE
9780         struct timezone tzp;
9781 #endif
9782         if (foo.tm_sec == foo.tm_sec)
9783                 exit(0);
9784 #ifdef S_TIMEVAL
9785         if (bar.tv_sec == bar.tv_sec)
9786                 exit(0);
9787 #endif
9788         exit(1);
9789 }
9790 EOCP
9791         flags=''
9792         for s_timezone in '-DS_TIMEZONE' ''; do
9793         sysselect=''
9794         for s_timeval in '-DS_TIMEVAL' ''; do
9795         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9796         for i_time in '' '-DI_TIME'; do
9797         for i_systime in '-DI_SYSTIME' ''; do
9798                 case "$flags" in
9799                 '') $echo $n ".$c"
9800                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9801                         if eval $compile; then
9802                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9803                                 shift
9804                                 flags="$*"
9805                                 echo " "
9806                                 $echo $n "Succeeded with $flags$c"
9807                         fi
9808                         ;;
9809                 esac
9810         done
9811         done
9812         done
9813         done
9814         done
9815         timeincl=''
9816         echo " "
9817         case "$flags" in
9818         *SYSTIMEKERNEL*) i_systimek="$define"
9819                 timeincl=`./findhdr sys/time.h`
9820                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9821         *) i_systimek="$undef";;
9822         esac
9823         case "$flags" in
9824         *I_TIME*) i_time="$define"
9825                 timeincl=`./findhdr time.h`" $timeincl"
9826                 echo "We'll include <time.h>." >&4;;
9827         *) i_time="$undef";;
9828         esac
9829         case "$flags" in
9830         *I_SYSTIME*) i_systime="$define"
9831                 timeincl=`./findhdr sys/time.h`" $timeincl"
9832                 echo "We'll include <sys/time.h>." >&4;;
9833         *) i_systime="$undef";;
9834         esac
9835         $rm -f try.c try
9836 fi
9837 : see if struct tm knows about tm_zone
9838 case "$i_systime$i_time" in
9839 *$define*) 
9840         echo " "
9841         echo "Checking to see if your struct tm has tm_zone field..." >&4
9842         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9843         eval $hasfield
9844         ;;
9845 *)      val="$undef"
9846         set d_tm_tm_zone
9847         eval $setvar
9848         ;;
9849 esac
9850 case "$d_tm_tm_zone" in
9851 "$define")      echo "Yes, it does."   ;;
9852 *)              echo "No, it doesn't." ;;
9853 esac
9854 : see if struct tm knows about tm_gmtoff
9855 case "$i_systime$i_time" in
9856 *$define*) 
9857         echo " "
9858         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9859         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9860         eval $hasfield
9861         ;;
9862 *)      val="$undef"
9863         set d_tm_tm_gmtoff
9864         eval $setvar
9865         ;;
9866 esac
9867 case "$d_tm_tm_gmtoff" in
9868 "$define")      echo "Yes, it does."   ;;
9869 *)              echo "No, it doesn't." ;;
9870 esac
9871
9872 : see if asctime_r exists
9873 set asctime_r d_asctime_r
9874 eval $inlibc
9875 case "$d_asctime_r" in
9876 "$define")
9877         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9878         case "$d_asctime_r_proto:$usethreads" in
9879         ":define")      d_asctime_r_proto=define
9880                 set d_asctime_r_proto asctime_r $hdrs
9881                 eval $hasproto ;;
9882         *)      ;;
9883         esac
9884         case "$d_asctime_r_proto" in
9885         define)
9886         case "$asctime_r_proto" in
9887         ''|0) try='char* asctime_r(const struct tm*, char*);'
9888         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9889         esac
9890         case "$asctime_r_proto" in
9891         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9892         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9893         esac
9894         case "$asctime_r_proto" in
9895         ''|0) try='int asctime_r(const struct tm*, char*);'
9896         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9897         esac
9898         case "$asctime_r_proto" in
9899         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9900         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9901         esac
9902         case "$asctime_r_proto" in
9903         ''|0)   d_asctime_r=undef
9904                 asctime_r_proto=0
9905                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9906         * )     case "$asctime_r_proto" in
9907                 REENTRANT_PROTO*) ;;
9908                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9909                 esac
9910                 echo "Prototype: $try" ;;
9911         esac
9912         ;;
9913         *)      case "$usethreads" in
9914                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9915                 esac
9916                 d_asctime_r=undef
9917                 asctime_r_proto=0
9918                 ;;
9919         esac
9920         ;;
9921 *)      asctime_r_proto=0
9922         ;;
9923 esac
9924
9925 : see if atolf exists
9926 set atolf d_atolf
9927 eval $inlibc
9928
9929 : see if atoll exists
9930 set atoll d_atoll
9931 eval $inlibc
9932
9933 : Look for GCC-style attribute format
9934 case "$d_attribute_format" in
9935 '')
9936 echo " "
9937 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9938 $cat >attrib.c <<'EOCP'
9939 #include <stdio.h>
9940 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9941 EOCP
9942 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9943         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9944                 echo "Your C compiler doesn't support __attribute__((format))."
9945                 val="$undef"
9946         else
9947                 echo "Your C compiler supports __attribute__((format))."
9948                 val="$define"
9949         fi
9950 else
9951         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9952         val="$undef"
9953 fi
9954 ;;
9955 *) val="$d_attribute_format" ;;
9956 esac
9957 set d_attribute_format
9958 eval $setvar
9959 $rm -f attrib*
9960
9961 : Look for GCC-style attribute malloc
9962 case "$d_attribute_malloc" in
9963 '')
9964 echo " "
9965 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9966 $cat >attrib.c <<'EOCP'
9967 #include <stdio.h>
9968 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9969 EOCP
9970 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9971         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9972                 echo "Your C compiler doesn't support __attribute__((malloc))."
9973                 val="$undef"
9974         else
9975                 echo "Your C compiler supports __attribute__((malloc))."
9976                 val="$define"
9977         fi
9978 else
9979         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9980         val="$undef"
9981 fi
9982 ;;
9983 *) val="$d_attribute_malloc" ;;
9984 esac
9985 set d_attribute_malloc
9986 eval $setvar
9987 $rm -f attrib*
9988
9989 : Look for GCC-style attribute nonnull
9990 case "$d_attribute_nonnull" in
9991 '')
9992 echo " "
9993 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9994 $cat >attrib.c <<'EOCP'
9995 #include <stdio.h>
9996 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9997 EOCP
9998 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9999         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10000                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10001                 val="$undef"
10002         else
10003                 echo "Your C compiler supports __attribute__((nonnull))."
10004                 val="$define"
10005         fi
10006 else
10007         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10008         val="$undef"
10009 fi
10010 ;;
10011 *) val="$d_attribute_nonnull" ;;
10012 esac
10013 set d_attribute_nonnull
10014 eval $setvar
10015 $rm -f attrib*
10016
10017 : Look for GCC-style attribute noreturn
10018 case "$d_attribute_noreturn" in
10019 '')
10020 echo " "
10021 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10022 $cat >attrib.c <<'EOCP'
10023 #include <stdio.h>
10024 void fall_over_dead( void ) __attribute__((noreturn));
10025 EOCP
10026 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10027         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10028                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10029                 val="$undef"
10030         else
10031                 echo "Your C compiler supports __attribute__((noreturn))."
10032                 val="$define"
10033         fi
10034 else
10035         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10036         val="$undef"
10037 fi
10038 ;;
10039 *) val="$d_attribute_noreturn" ;;
10040 esac
10041 set d_attribute_noreturn
10042 eval $setvar
10043 $rm -f attrib*
10044
10045 : Look for GCC-style attribute pure
10046 case "$d_attribute_pure" in
10047 '')
10048 echo " "
10049 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10050 $cat >attrib.c <<'EOCP'
10051 #include <stdio.h>
10052 int square( int n ) __attribute__((pure));
10053 EOCP
10054 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10055         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10056                 echo "Your C compiler doesn't support __attribute__((pure))."
10057                 val="$undef"
10058         else
10059                 echo "Your C compiler supports __attribute__((pure))."
10060                 val="$define"
10061         fi
10062 else
10063         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10064         val="$undef"
10065 fi
10066 ;;
10067 *) val="$d_attribute_pure" ;;
10068 esac
10069 set d_attribute_pure
10070 eval $setvar
10071 $rm -f attrib*
10072
10073 : Look for GCC-style attribute unused
10074 case "$d_attribute_unused" in
10075 '')
10076 echo " "
10077 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10078 $cat >attrib.c <<'EOCP'
10079 #include <stdio.h>
10080 int do_something( int dummy __attribute__((unused)), int n );
10081 EOCP
10082 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10083         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10084                 echo "Your C compiler doesn't support __attribute__((unused))."
10085                 val="$undef"
10086         else
10087                 echo "Your C compiler supports __attribute__((unused))."
10088                 val="$define"
10089         fi
10090 else
10091         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10092         val="$undef"
10093 fi
10094 ;;
10095 *) val="$d_attribute_unused" ;;
10096 esac
10097 set d_attribute_unused
10098 eval $setvar
10099 $rm -f attrib*
10100
10101 : Look for GCC-style attribute warn_unused_result
10102 case "$d_attribute_warn_unused_result" in
10103 '')
10104 echo " "
10105 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10106 $cat >attrib.c <<'EOCP'
10107 #include <stdio.h>
10108 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10109 EOCP
10110 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10111         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10112                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10113                 val="$undef"
10114         else
10115                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10116                 val="$define"
10117         fi
10118 else
10119         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10120         val="$undef"
10121 fi
10122 ;;
10123 *) val="$d_attribute_warn_unused_result" ;;
10124 esac
10125 set d_attribute_warn_unused_result
10126 eval $setvar
10127 $rm -f attrib*
10128
10129 : see if bcmp exists
10130 set bcmp d_bcmp
10131 eval $inlibc
10132
10133 : see if bcopy exists
10134 set bcopy d_bcopy
10135 eval $inlibc
10136
10137 : see if getpgrp exists
10138 set getpgrp d_getpgrp
10139 eval $inlibc
10140
10141 case "$d_getpgrp" in
10142 "$define")
10143         echo " "
10144         echo "Checking to see which flavor of getpgrp is in use..."
10145         $cat >try.c <<EOP
10146 #$i_unistd I_UNISTD
10147 #include <sys/types.h>
10148 #ifdef I_UNISTD
10149 #  include <unistd.h>
10150 #endif
10151 #$i_stdlib I_STDLIB
10152 #ifdef I_STDLIB
10153 #include <stdlib.h>
10154 #endif
10155 int main()
10156 {
10157         if (getuid() == 0) {
10158                 printf("(I see you are running Configure as super-user...)\n");
10159                 setuid(1);
10160         }
10161 #ifdef TRY_BSD_PGRP
10162         if (getpgrp(1) == 0)
10163                 exit(0);
10164 #else
10165         if (getpgrp() > 0)
10166                 exit(0);
10167 #endif
10168         exit(1);
10169 }
10170 EOP
10171         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10172                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10173                 val="$define"
10174         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10175                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10176                 val="$undef"
10177         else
10178                 echo "I can't seem to compile and run the test program."
10179                 if ./usg; then
10180                         xxx="a USG one, i.e. you use getpgrp()."
10181                 else
10182                         # SVR4 systems can appear rather BSD-ish.
10183                         case "$i_unistd" in
10184                         $undef)
10185                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10186                                 val="$define"
10187                                 ;;
10188                         $define)
10189                                 xxx="probably a USG one, i.e. you use getpgrp()."
10190                                 val="$undef"
10191                                 ;;
10192                         esac
10193                 fi
10194                 echo "Assuming your getpgrp is $xxx" >&4
10195         fi
10196         ;;
10197 *) val="$undef";;
10198 esac
10199 set d_bsdgetpgrp
10200 eval $setvar
10201 $rm -f try try.*
10202
10203 : see if setpgrp exists
10204 set setpgrp d_setpgrp
10205 eval $inlibc
10206
10207 case "$d_setpgrp" in
10208 "$define")
10209         echo " "
10210         echo "Checking to see which flavor of setpgrp is in use..."
10211         $cat >try.c <<EOP
10212 #$i_unistd I_UNISTD
10213 #include <sys/types.h>
10214 #ifdef I_UNISTD
10215 #  include <unistd.h>
10216 #endif
10217 #$i_stdlib I_STDLIB
10218 #ifdef I_STDLIB
10219 #include <stdlib.h>
10220 #endif
10221 int main()
10222 {
10223         if (getuid() == 0) {
10224                 printf("(I see you are running Configure as super-user...)\n");
10225                 setuid(1);
10226         }
10227 #ifdef TRY_BSD_PGRP
10228         if (-1 == setpgrp(1, 1))
10229                 exit(0);
10230 #else
10231         if (setpgrp() != -1)
10232                 exit(0);
10233 #endif
10234         exit(1);
10235 }
10236 EOP
10237         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10238                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10239                 val="$define"
10240         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10241                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10242                 val="$undef"
10243         else
10244                 echo "(I can't seem to compile and run the test program.)"
10245                 if ./usg; then
10246                         xxx="a USG one, i.e. you use setpgrp()."
10247                 else
10248                         # SVR4 systems can appear rather BSD-ish.
10249                         case "$i_unistd" in
10250                         $undef)
10251                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10252                                 val="$define"
10253                                 ;;
10254                         $define)
10255                                 xxx="probably a USG one, i.e. you use setpgrp()."
10256                                 val="$undef"
10257                                 ;;
10258                         esac
10259                 fi
10260                 echo "Assuming your setpgrp is $xxx" >&4
10261         fi
10262         ;;
10263 *) val="$undef";;
10264 esac
10265 set d_bsdsetpgrp
10266 eval $setvar
10267 $rm -f try try.*
10268 : Look for GCC-style __builtin_choose_expr
10269 case "$d_builtin_choose_expr" in
10270 '')
10271     echo " "
10272     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10273     $cat >try.c <<'EOCP'
10274 #include <assert.h>
10275 #include <stdlib.h>
10276 #include <stdio.h>
10277
10278 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10279
10280 int main(void) {
10281     assert( SYRINX(1) == 2112 );
10282     assert( SYRINX(1) != 5150 );
10283     assert( SYRINX(0) == 5150 );
10284     assert( SYRINX(0) != 2112 );
10285     puts( "All good!" );
10286     exit(0);
10287 }
10288
10289 EOCP
10290     set try
10291     if eval $compile; then
10292         echo "Your C compiler supports __builtin_choose_expr."
10293         val="$define"
10294     else
10295         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10296         val="$undef"
10297     fi
10298 ;;
10299 *) val="$d_builtin_choose_expr" ;;
10300 esac
10301
10302 set d_builtin_choose_expr
10303 eval $setvar
10304 $rm -f try.* try core core.try.*
10305
10306 : Look for GCC-style __builtin_expect
10307 case "$d_builtin_expect" in
10308 '')
10309     echo " "
10310     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10311     $cat >builtin.c <<'EOCP'
10312 int main(void) {
10313     int n = 50;
10314     if ( __builtin_expect(n, 0) ) n = 1;
10315 }
10316 EOCP
10317     set try
10318     if eval $compile; then
10319         echo "Your C compiler supports __builtin_choose_expr."
10320         val="$define"
10321     else
10322         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10323         val="$undef"
10324     fi
10325     ;;
10326 *) val="$d_builtin_expect" ;;
10327 esac
10328
10329 set d_builtin_expect
10330 eval $setvar
10331 $rm -f try.* try core core.try.*
10332
10333 : see if bzero exists
10334 set bzero d_bzero
10335 eval $inlibc
10336
10337 : see if stdarg is available
10338 echo " "
10339 if $test `./findhdr stdarg.h`; then
10340         echo "<stdarg.h> found." >&4
10341         valstd="$define"
10342 else
10343         echo "<stdarg.h> NOT found." >&4
10344         valstd="$undef"
10345 fi
10346
10347 : see if varags is available
10348 echo " "
10349 if $test `./findhdr varargs.h`; then
10350         echo "<varargs.h> found." >&4
10351 else
10352         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10353 fi
10354
10355 : set up the varargs testing programs
10356 $cat > varargs.c <<EOP
10357 #ifdef I_STDARG
10358 #include <stdarg.h>
10359 #endif
10360 #ifdef I_VARARGS
10361 #include <varargs.h>
10362 #endif
10363
10364 #ifdef I_STDARG
10365 int f(char *p, ...)
10366 #else
10367 int f(va_alist)
10368 va_dcl
10369 #endif
10370 {
10371         va_list ap;
10372 #ifndef I_STDARG
10373         char *p;
10374 #endif
10375 #ifdef I_STDARG
10376         va_start(ap,p);
10377 #else
10378         va_start(ap);
10379         p = va_arg(ap, char *);
10380 #endif
10381         va_end(ap);
10382         return 0;
10383 }
10384 EOP
10385 $cat > varargs <<EOP
10386 $startsh
10387 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10388         echo "true"
10389 else
10390         echo "false"
10391 fi
10392 $rm -f varargs$_o
10393 EOP
10394 chmod +x varargs
10395
10396 : now check which varargs header should be included
10397 echo " "
10398 i_varhdr=''
10399 case "$valstd" in
10400 "$define")
10401         if `./varargs I_STDARG`; then
10402                 val='stdarg.h'
10403         elif `./varargs I_VARARGS`; then
10404                 val='varargs.h'
10405         fi
10406         ;;
10407 *)
10408         if `./varargs I_VARARGS`; then
10409                 val='varargs.h'
10410         fi
10411         ;;
10412 esac
10413 case "$val" in
10414 '')
10415 echo "I could not find the definition for va_dcl... You have problems..." >&4
10416         val="$undef"; set i_stdarg; eval $setvar
10417         val="$undef"; set i_varargs; eval $setvar
10418         ;;
10419 *) 
10420         set i_varhdr
10421         eval $setvar
10422         case "$i_varhdr" in
10423         stdarg.h)
10424                 val="$define"; set i_stdarg; eval $setvar
10425                 val="$undef"; set i_varargs; eval $setvar
10426                 ;;
10427         varargs.h)
10428                 val="$undef"; set i_stdarg; eval $setvar
10429                 val="$define"; set i_varargs; eval $setvar
10430                 ;;
10431         esac
10432         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10433 esac
10434 $rm -f varargs*
10435
10436 : see if the Compiler supports C99 variadic macros
10437 case "$i_stdarg$i_stdlib" in
10438     "$define$define")
10439     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10440     $cat >try.c <<EOCP
10441 #include <stdio.h>
10442 #include <stdarg.h>
10443
10444 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10445
10446 int main() {
10447   char buf[20];
10448   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10449   puts(buf);
10450   return 0;
10451 }
10452 EOCP
10453     set try
10454     if eval $compile && $run ./try 2>&1 >/dev/null; then
10455         case "`$run ./try`" in
10456             "123 456 789")
10457             echo "You have C99 variadic macros." >&4
10458             d_c99_variadic_macros="$define"
10459             ;;
10460             *)
10461             echo "You don't have functional C99 variadic macros." >&4
10462             d_c99_variadic_macros="$undef"
10463             ;;
10464         esac
10465     else
10466         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10467         d_c99_variadic_macros="$undef"
10468     fi
10469     $rm -f try.* try core core.try.*
10470     ;;
10471     *)
10472     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10473     d_c99_variadic_macros="$undef"
10474     ;;
10475 esac
10476
10477 : see if signal is declared as pointer to function returning int or void
10478 echo " "
10479 xxx=`./findhdr signal.h`
10480 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10481 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10482         echo "You have int (*signal())() instead of void." >&4
10483         val="$undef"
10484 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10485         echo "You have void (*signal())()." >&4
10486         val="$define"
10487 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10488         echo "You have int (*signal())() instead of void." >&4
10489         val="$undef"
10490 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10491         echo "You have void (*signal())()." >&4
10492         val="$define"
10493 else
10494         case "$d_voidsig" in
10495         '')
10496         echo "I can't determine whether signal handler returns void or int..." >&4
10497                 dflt=void
10498                 rp="What type does your signal handler return?"
10499                 . ./myread
10500                 case "$ans" in
10501                 v*) val="$define";;
10502                 *) val="$undef";;
10503                 esac;;
10504         "$define")
10505                 echo "As you already told me, signal handler returns void." >&4
10506                 val="$define"
10507                 ;;
10508         *)      echo "As you already told me, signal handler returns int." >&4
10509                 val="$undef"
10510                 ;;
10511         esac
10512 fi
10513 set d_voidsig
10514 eval $setvar
10515 case "$d_voidsig" in
10516 "$define") signal_t="void";;
10517 *) signal_t="int";;
10518 esac
10519 $rm -f $$.tmp
10520
10521 : check for ability to cast large floats to 32-bit ints.
10522 echo " "
10523 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10524 if $test "$intsize" -ge 4; then
10525         xxx=int
10526 else
10527         xxx=long
10528 fi
10529 $cat >try.c <<EOCP
10530 #include <stdio.h>
10531 #$i_stdlib I_STDLIB
10532 #ifdef I_STDLIB
10533 #include <stdlib.h>
10534 #endif
10535 #include <sys/types.h>
10536 #include <signal.h>
10537 $signal_t blech(int s) { exit(3); }
10538 int main()
10539 {
10540         $xxx i32;
10541         double f, g;
10542         int result = 0;
10543         char str[16];
10544         signal(SIGFPE, blech);
10545
10546         /* Don't let compiler optimize the test away.  Store the number 
10547            in a writable string for gcc to pass to sscanf under HP/UX.
10548         */
10549         sprintf(str, "2147483647");
10550         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10551         g = 10 * f;
10552         i32  = ($xxx) g;
10553
10554         /* x86 processors will probably give 0x8000 0000, which is a
10555            sign change.  We don't want that.  We want to mimic SPARC
10556            behavior here, which is to preserve the sign and give
10557            back 0x7fff ffff.
10558         */
10559         if (i32 != ($xxx) f)
10560                 result |= 1;
10561         exit(result);
10562 }
10563 EOCP
10564 set try
10565 if eval $compile_ok; then
10566         $run ./try
10567         yyy=$?
10568 else
10569         echo "(I can't seem to compile the test program--assuming it can't)"
10570         yyy=1
10571 fi
10572 case "$yyy" in
10573 0)      val="$define"
10574         echo "Yup, it can."
10575         ;;
10576 *)      val="$undef"
10577         echo "Nope, it can't."
10578         ;;
10579 esac
10580 set d_casti32
10581 eval $setvar
10582 $rm -f try try.*
10583
10584 : check for ability to cast negative floats to unsigned
10585 echo " "
10586 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10587 $cat >try.c <<EOCP
10588 #include <stdio.h>
10589 #$i_stdlib I_STDLIB
10590 #ifdef I_STDLIB
10591 #include <stdlib.h>
10592 #endif
10593 #include <sys/types.h>
10594 #include <signal.h>
10595 $signal_t blech(int s) { exit(7); }
10596 $signal_t blech_in_list(int s) { exit(4); }
10597 unsigned long dummy_long(unsigned long p) { return p; }
10598 unsigned int dummy_int(unsigned int p) { return p; }
10599 unsigned short dummy_short(unsigned short p) { return p; }
10600 int main()
10601 {
10602         double f;
10603         unsigned long along;
10604         unsigned int aint;
10605         unsigned short ashort;
10606         int result = 0;
10607         char str[16];
10608         
10609         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10610            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10611            optimized the whole file away
10612         */
10613         /* Store the number in a writable string for gcc to pass to 
10614            sscanf under HP/UX.
10615         */
10616         sprintf(str, "-123");
10617         sscanf(str, "%lf", &f);  /* f = -123.; */
10618
10619         signal(SIGFPE, blech);
10620         along = (unsigned long)f;
10621         aint = (unsigned int)f;
10622         ashort = (unsigned short)f;
10623         if (along != (unsigned long)-123)
10624                 result |= 1;
10625         if (aint != (unsigned int)-123)
10626                 result |= 1;
10627         if (ashort != (unsigned short)-123)
10628                 result |= 1;
10629         sprintf(str, "1073741824.");
10630         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10631         f = f + f;
10632         along = 0;
10633         along = (unsigned long)f;
10634         if (along != 0x80000000)
10635                 result |= 2;
10636         f -= 1.;
10637         along = 0;
10638         along = (unsigned long)f;
10639         if (along != 0x7fffffff)
10640                 result |= 1;
10641         f += 2.;
10642         along = 0;
10643         along = (unsigned long)f;
10644         if (along != 0x80000001)
10645                 result |= 2;
10646         if (result)
10647                 exit(result);
10648         signal(SIGFPE, blech_in_list);
10649         sprintf(str, "123.");
10650         sscanf(str, "%lf", &f);  /* f = 123.; */
10651         along = dummy_long((unsigned long)f);
10652         aint = dummy_int((unsigned int)f);
10653         ashort = dummy_short((unsigned short)f);
10654         if (along != (unsigned long)123)
10655                 result |= 4;
10656         if (aint != (unsigned int)123)
10657                 result |= 4;
10658         if (ashort != (unsigned short)123)
10659                 result |= 4;
10660         exit(result);
10661
10662 }
10663 EOCP
10664 set try
10665 if eval $compile_ok; then
10666         $run ./try
10667         castflags=$?
10668 else
10669         echo "(I can't seem to compile the test program--assuming it can't)"
10670         castflags=7
10671 fi
10672 case "$castflags" in
10673 0)      val="$define"
10674         echo "Yup, it can."
10675         ;;
10676 *)      val="$undef"
10677         echo "Nope, it can't."
10678         ;;
10679 esac
10680 set d_castneg
10681 eval $setvar
10682 $rm -f try.*
10683
10684 : see if vprintf exists
10685 echo " "
10686 if set vprintf val -f d_vprintf; eval $csym; $val; then
10687         echo 'vprintf() found.' >&4
10688         val="$define"
10689         $cat >try.c <<EOF
10690 #include <varargs.h>
10691 #$i_stdlib I_STDLIB
10692 #ifdef I_STDLIB
10693 #include <stdlib.h>
10694 #endif
10695
10696 int main() { xxx("foo"); }
10697
10698 xxx(va_alist)
10699 va_dcl
10700 {
10701         va_list args;
10702         char buf[10];
10703
10704         va_start(args);
10705         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10706 }
10707 EOF
10708         set try
10709         if eval $compile && $run ./try; then
10710                 echo "Your vsprintf() returns (int)." >&4
10711                 val2="$undef"
10712         else
10713                 echo "Your vsprintf() returns (char*)." >&4
10714                 val2="$define"
10715         fi
10716 else
10717         echo 'vprintf() NOT found.' >&4
10718                 val="$undef"
10719                 val2="$undef"
10720 fi
10721 $rm -f try try.*
10722 set d_vprintf
10723 eval $setvar
10724 val=$val2
10725 set d_charvspr
10726 eval $setvar
10727
10728 : see if chown exists
10729 set chown d_chown
10730 eval $inlibc
10731
10732 : see if chroot exists
10733 set chroot d_chroot
10734 eval $inlibc
10735
10736 : see if chsize exists
10737 set chsize d_chsize
10738 eval $inlibc
10739
10740 : see if class exists
10741 set class d_class
10742 eval $inlibc
10743
10744 : see if clearenv exists
10745 set clearenv d_clearenv
10746 eval $inlibc
10747
10748 hasstruct='varname=$1; struct=$2; shift; shift;
10749 while $test $# -ge 2; do
10750         case "$1" in
10751         $define) echo "#include <$2>";;
10752         esac ;
10753     shift 2;
10754 done > try.c;
10755 echo "int main () { struct $struct foo; }" >> try.c;
10756 set try;
10757 if eval $compile; then
10758         val="$define";
10759 else
10760         val="$undef";
10761 fi;
10762 set $varname;
10763 eval $setvar;
10764 $rm -f try.c try.o'
10765
10766 socketlib=''
10767 sockethdr=''
10768 : see whether socket exists
10769 echo " "
10770 $echo $n "Hmm... $c" >&4
10771 if set socket val -f d_socket; eval $csym; $val; then
10772         echo "Looks like you have Berkeley networking support." >&4
10773         d_socket="$define"
10774         if set setsockopt val -f; eval $csym; $val; then
10775                 d_oldsock="$undef"
10776         else
10777                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10778                 d_oldsock="$define"
10779         fi
10780 else
10781         if $contains socklib libc.list >/dev/null 2>&1; then
10782                 echo "Looks like you have Berkeley networking support." >&4
10783                 d_socket="$define"
10784                 : we will have to assume that it supports the 4.2 BSD interface
10785                 d_oldsock="$undef"
10786         else
10787                 echo "You don't have Berkeley networking in libc$_a..." >&4
10788                 if test "X$d_socket" = "X$define"; then
10789                    echo "...but you seem to believe that you have sockets." >&4
10790                 else
10791                         for net in net socket
10792                         do
10793                                 if test -f /usr/lib/lib$net$_a; then
10794                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10795                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10796                                         if $contains socket libc.list >/dev/null 2>&1; then
10797                                                 d_socket="$define"
10798                                                 socketlib="-l$net"
10799                                                 case "$net" in
10800                                                 net)
10801                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10802                                                         sockethdr="-I/usr/netinclude"
10803                                                         ;;
10804                                                 esac
10805                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10806                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10807                                                         d_oldsock="$undef"
10808                                                 else
10809                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10810                                                         d_oldsock="$define"
10811                                                 fi
10812                                                 break
10813                                         fi
10814                                 fi
10815                         done
10816                         if test "X$d_socket" != "X$define"; then
10817                            echo "or anywhere else I see." >&4
10818                            d_socket="$undef"
10819                            d_oldsock="$undef"
10820                         fi
10821                 fi
10822         fi
10823 fi
10824
10825 : see if socketpair exists
10826 set socketpair d_sockpair
10827 eval $inlibc
10828
10829
10830 echo " "
10831 echo "Checking the availability of certain socket constants..." >&4
10832 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10833         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10834         $cat >try.c <<EOF
10835 #include <sys/types.h>
10836 #include <sys/socket.h>
10837 int main() {
10838     int i = $ENUM;
10839 }
10840 EOF
10841         val="$undef"
10842         set try; if eval $compile; then
10843                 val="$define"
10844         fi
10845         set d_${enum}; eval $setvar
10846         $rm -f try.c try
10847 done
10848
10849 : see if this is a sys/uio.h system
10850 set sys/uio.h i_sysuio
10851 eval $inhdr
10852
10853
10854 echo " "
10855 echo "Checking to see if your system supports struct cmsghdr..." >&4
10856 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10857 eval $hasstruct
10858 case "$d_cmsghdr_s" in
10859 "$define")      echo "Yes, it does."   ;;
10860 *)              echo "No, it doesn't." ;;
10861 esac
10862
10863
10864 : check for const keyword
10865 echo " "
10866 echo 'Checking to see if your C compiler knows about "const"...' >&4
10867 $cat >const.c <<'EOCP'
10868 typedef struct spug { int drokk; } spug;
10869 int main()
10870 {
10871         const char *foo;
10872         const spug y = { 0 };
10873 }
10874 EOCP
10875 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10876         val="$define"
10877         echo "Yup, it does."
10878 else
10879         val="$undef"
10880         echo "Nope, it doesn't."
10881 fi
10882 set d_const
10883 eval $setvar
10884
10885 : see if copysignl exists
10886 set copysignl d_copysignl
10887 eval $inlibc
10888
10889 : see if crypt exists
10890 echo " "
10891 set crypt d_crypt
10892 eval $inlibc
10893 case "$d_crypt" in
10894 $define) cryptlib='' ;;
10895 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10896                 echo 'crypt() found.' >&4
10897                 val="$define"
10898                 cryptlib=''
10899         else
10900                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10901                 if $test -z "$cryptlib"; then
10902                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10903                 else
10904                         cryptlib=-lcrypt
10905                 fi
10906                 if $test -z "$cryptlib"; then
10907                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10908                 else
10909                         cryptlib=-lcrypt
10910                 fi
10911                 if $test -z "$cryptlib"; then
10912                         cryptlib=`./loc libcrypt$_a "" $libpth`
10913                 else
10914                         cryptlib=-lcrypt
10915                 fi
10916                 if $test -z "$cryptlib"; then
10917                         echo 'crypt() NOT found.' >&4
10918                         val="$undef"
10919                 else
10920                         val="$define"
10921                 fi
10922         fi
10923         set d_crypt
10924         eval $setvar
10925         ;;
10926 esac
10927
10928 : see if this is a crypt.h system
10929 set crypt.h i_crypt
10930 eval $inhdr
10931
10932 : see if crypt_r exists
10933 set crypt_r d_crypt_r
10934 eval $inlibc
10935 case "$d_crypt_r" in
10936 "$define")
10937         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10938         case "$d_crypt_r_proto:$usethreads" in
10939         ":define")      d_crypt_r_proto=define
10940                 set d_crypt_r_proto crypt_r $hdrs
10941                 eval $hasproto ;;
10942         *)      ;;
10943         esac
10944         case "$d_crypt_r_proto" in
10945         define)
10946         case "$crypt_r_proto" in
10947         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10948         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10949         esac
10950         case "$crypt_r_proto" in
10951         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10952         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10953         esac
10954         case "$crypt_r_proto" in
10955         ''|0)   d_crypt_r=undef
10956                 crypt_r_proto=0
10957                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10958         * )     case "$crypt_r_proto" in
10959                 REENTRANT_PROTO*) ;;
10960                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10961                 esac
10962                 echo "Prototype: $try" ;;
10963         esac
10964         ;;
10965         *)      case "$usethreads" in
10966                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10967                 esac
10968                 d_crypt_r=undef
10969                 crypt_r_proto=0
10970                 ;;
10971         esac
10972         ;;
10973 *)      crypt_r_proto=0
10974         ;;
10975 esac
10976
10977 : get csh whereabouts
10978 case "$csh" in
10979 'csh') val="$undef" ;;
10980 *) val="$define" ;;
10981 esac
10982 set d_csh
10983 eval $setvar
10984 : Respect a hint or command line value for full_csh.
10985 case "$full_csh" in
10986 '') full_csh=$csh ;;
10987 esac
10988
10989 : see if ctermid_r exists
10990 set ctermid_r d_ctermid_r
10991 eval $inlibc
10992 case "$d_ctermid_r" in
10993 "$define")
10994         hdrs="$i_systypes sys/types.h define stdio.h "
10995         case "$d_ctermid_r_proto:$usethreads" in
10996         ":define")      d_ctermid_r_proto=define
10997                 set d_ctermid_r_proto ctermid_r $hdrs
10998                 eval $hasproto ;;
10999         *)      ;;
11000         esac
11001         case "$d_ctermid_r_proto" in
11002         define)
11003         case "$ctermid_r_proto" in
11004         ''|0) try='char* ctermid_r(char*);'
11005         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11006         esac
11007         case "$ctermid_r_proto" in
11008         ''|0)   d_ctermid_r=undef
11009                 ctermid_r_proto=0
11010                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11011         * )     case "$ctermid_r_proto" in
11012                 REENTRANT_PROTO*) ;;
11013                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11014                 esac
11015                 echo "Prototype: $try" ;;
11016         esac
11017         ;;
11018         *)      case "$usethreads" in
11019                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11020                 esac
11021                 d_ctermid_r=undef
11022                 ctermid_r_proto=0
11023                 ;;
11024         esac
11025         ;;
11026 *)      ctermid_r_proto=0
11027         ;;
11028 esac
11029
11030 : see if ctime_r exists
11031 set ctime_r d_ctime_r
11032 eval $inlibc
11033 case "$d_ctime_r" in
11034 "$define")
11035         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11036         case "$d_ctime_r_proto:$usethreads" in
11037         ":define")      d_ctime_r_proto=define
11038                 set d_ctime_r_proto ctime_r $hdrs
11039                 eval $hasproto ;;
11040         *)      ;;
11041         esac
11042         case "$d_ctime_r_proto" in
11043         define)
11044         case "$ctime_r_proto" in
11045         ''|0) try='char* ctime_r(const time_t*, char*);'
11046         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11047         esac
11048         case "$ctime_r_proto" in
11049         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11050         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11051         esac
11052         case "$ctime_r_proto" in
11053         ''|0) try='int ctime_r(const time_t*, char*);'
11054         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11055         esac
11056         case "$ctime_r_proto" in
11057         ''|0) try='int ctime_r(const time_t*, char*, int);'
11058         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11059         esac
11060         case "$ctime_r_proto" in
11061         ''|0)   d_ctime_r=undef
11062                 ctime_r_proto=0
11063                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11064         * )     case "$ctime_r_proto" in
11065                 REENTRANT_PROTO*) ;;
11066                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11067                 esac
11068                 echo "Prototype: $try" ;;
11069         esac
11070         ;;
11071         *)      case "$usethreads" in
11072                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11073                 esac
11074                 d_ctime_r=undef
11075                 ctime_r_proto=0
11076                 ;;
11077         esac
11078         ;;
11079 *)      ctime_r_proto=0
11080         ;;
11081 esac
11082
11083 : see if cuserid exists
11084 set cuserid d_cuserid
11085 eval $inlibc
11086
11087 : see if this is a limits.h system
11088 set limits.h i_limits
11089 eval $inhdr
11090
11091 : see if this is a float.h system
11092 set float.h i_float
11093 eval $inhdr
11094
11095 : See if number of significant digits in a double precision number is known
11096 echo " "
11097 $cat >dbl_dig.c <<EOM
11098 #$i_limits I_LIMITS
11099 #$i_float I_FLOAT
11100 #ifdef I_LIMITS
11101 #include <limits.h>
11102 #endif
11103 #ifdef I_FLOAT
11104 #include <float.h>
11105 #endif
11106 #ifdef DBL_DIG
11107 printf("Contains DBL_DIG");
11108 #endif
11109 EOM
11110 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11111 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11112         echo "DBL_DIG found." >&4
11113         val="$define"
11114 else
11115         echo "DBL_DIG NOT found." >&4
11116         val="$undef"
11117 fi
11118 $rm -f dbl_dig.?
11119 set d_dbl_dig
11120 eval $setvar
11121
11122 : see if dbm.h is available
11123 : see if dbmclose exists
11124 set dbmclose d_dbmclose
11125 eval $inlibc
11126
11127 case "$d_dbmclose" in
11128 $define)
11129         set dbm.h i_dbm
11130         eval $inhdr
11131         case "$i_dbm" in
11132         $define)
11133                 val="$undef"
11134                 set i_rpcsvcdbm
11135                 eval $setvar
11136                 ;;
11137         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11138                 eval $inhdr
11139                 ;;
11140         esac
11141         ;;
11142 *)      echo "We won't be including <dbm.h>"
11143         val="$undef"
11144         set i_dbm
11145         eval $setvar
11146         val="$undef"
11147         set i_rpcsvcdbm
11148         eval $setvar
11149         ;;
11150 esac
11151
11152 : see if prototype for dbminit is available
11153 echo " "
11154 set d_dbminitproto dbminit $i_dbm dbm.h
11155 eval $hasproto
11156
11157 : see if difftime exists
11158 set difftime d_difftime
11159 eval $inlibc
11160
11161 : see if this is a dirent system
11162 echo " "
11163 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11164         val="$define"
11165         echo "<dirent.h> found." >&4
11166 else
11167         val="$undef"
11168         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11169                 echo "<sys/dir.h> found." >&4
11170                 echo " "
11171         else
11172                 xinc=`./findhdr sys/ndir.h`
11173         fi
11174         echo "<dirent.h> NOT found." >&4
11175 fi
11176 set i_dirent
11177 eval $setvar
11178
11179 : Look for type of directory structure.
11180 echo " "
11181 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11182
11183 case "$direntrytype" in
11184 ''|' ')
11185         case "$i_dirent" in
11186         $define) guess1='struct dirent' ;;
11187         *) guess1='struct direct'  ;;
11188         esac
11189         ;;
11190 *)      guess1="$direntrytype"
11191         ;;
11192 esac
11193
11194 case "$guess1" in
11195 'struct dirent') guess2='struct direct' ;;
11196 *) guess2='struct dirent' ;;
11197 esac
11198                 
11199 if $contains "$guess1" try.c >/dev/null 2>&1; then
11200         direntrytype="$guess1"
11201         echo "Your directory entries are $direntrytype." >&4
11202 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11203         direntrytype="$guess2"
11204         echo "Your directory entries seem to be $direntrytype." >&4
11205 else
11206         echo "I don't recognize your system's directory entries." >&4
11207         rp="What type is used for directory entries on this system?"
11208         dflt="$guess1"
11209         . ./myread
11210         direntrytype="$ans"
11211 fi
11212 $rm -f try.c
11213
11214
11215 : see if the directory entry stores field length
11216 echo " "
11217 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11218 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11219         echo "Good, your directory entry keeps length information in d_namlen." >&4
11220         val="$define"
11221 else
11222         echo "Your directory entry does not know about the d_namlen field." >&4
11223         val="$undef"
11224 fi
11225 set d_dirnamlen
11226 eval $setvar
11227 $rm -f try.c
11228
11229 : see if this is an sysdir system
11230 set sys/dir.h i_sysdir
11231 eval $inhdr
11232
11233 : see if this is an sysndir system
11234 set sys/ndir.h i_sysndir
11235 eval $inhdr
11236
11237 : Look for dirfd
11238 echo " "
11239 $cat >dirfd.c <<EOM
11240 #include <stdio.h>
11241 #$i_stdlib I_STDLIB
11242 #ifdef I_STDLIB
11243 #include <stdlib.h>
11244 #endif
11245 #$i_dirent I_DIRENT             /**/
11246 #$i_sysdir I_SYS_DIR            /**/
11247 #$i_sysndir I_SYS_NDIR          /**/
11248 #$i_systypes I_SYS_TYPES        /**/
11249 #if defined(I_SYS_TYPES)
11250 #include <sys/types.h>
11251 #endif
11252 #if defined(I_DIRENT)
11253 #include <dirent.h>
11254 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11255 #include <sys/dir.h>
11256 #endif
11257 #else
11258 #ifdef I_SYS_NDIR
11259 #include <sys/ndir.h>
11260 #else
11261 #ifdef I_SYS_DIR
11262 #ifdef hp9000s500
11263 #include <ndir.h>       /* may be wrong in the future */
11264 #else
11265 #include <sys/dir.h>
11266 #endif
11267 #endif
11268 #endif
11269 #endif 
11270 int main() {
11271         DIR *dirp = opendir(".");
11272         if (dirfd(dirp) >= 0)
11273                 exit(0);
11274         else
11275                 exit(1);
11276 }
11277 EOM
11278 val=$undef
11279 set dirfd
11280 if eval $compile; then
11281         val="$define"
11282 fi
11283 case "$val" in
11284 $define)        echo "dirfd() found." >&4       ;;
11285 *)              echo "dirfd() NOT found." >&4   ;;
11286 esac
11287 set d_dirfd
11288 eval $setvar
11289 $rm -f dirfd*
11290
11291 : see if dlerror exists
11292 xxx_runnm="$runnm"
11293 runnm=false
11294 set dlerror d_dlerror
11295 eval $inlibc
11296 runnm="$xxx_runnm"
11297
11298 : see if dlfcn is available
11299 set dlfcn.h i_dlfcn
11300 eval $inhdr
11301
11302 case "$usedl" in
11303 $define|y|true)
11304         $cat << EOM
11305
11306 On a few systems, the dynamically loaded modules that perl generates and uses
11307 will need a different extension than shared libs. The default will probably
11308 be appropriate.
11309
11310 EOM
11311         case "$dlext" in
11312         '')     dflt="$so" ;;
11313         *)      dflt="$dlext" ;;
11314         esac
11315         rp='What is the extension of dynamically loaded modules'
11316         . ./myread
11317         dlext="$ans"
11318         ;;
11319 *)
11320         dlext="none"
11321         ;;
11322 esac
11323
11324 : Check if dlsym need a leading underscore
11325 echo " "
11326 val="$undef"
11327
11328 case "$dlsrc" in
11329 dl_dlopen.xs)
11330         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11331         $cat >dyna.c <<'EOM'
11332 fred () { }
11333 EOM
11334
11335 $cat >fred.c<<EOM
11336
11337 #include <stdio.h>
11338 #$i_stdlib I_STDLIB
11339 #ifdef I_STDLIB
11340 #include <stdlib.h>
11341 #endif
11342 #$i_dlfcn I_DLFCN
11343 #ifdef I_DLFCN
11344 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11345 #else
11346 #include <sys/types.h>
11347 #include <nlist.h>
11348 #include <link.h>
11349 #endif
11350
11351 extern int fred() ;
11352
11353 int main()
11354 {
11355     void * handle ;
11356     void * symbol ;
11357 #ifndef RTLD_LAZY
11358     int mode = 1 ;
11359 #else
11360     int mode = RTLD_LAZY ;
11361 #endif
11362     handle = dlopen("./dyna.$dlext", mode) ;
11363     if (handle == NULL) {
11364         printf ("1\n") ;
11365         fflush (stdout) ;
11366         exit(0);
11367     }
11368     symbol = dlsym(handle, "fred") ;
11369     if (symbol == NULL) {
11370         /* try putting a leading underscore */
11371         symbol = dlsym(handle, "_fred") ;
11372         if (symbol == NULL) {
11373             printf ("2\n") ;
11374             fflush (stdout) ;
11375             exit(0);
11376         }
11377         printf ("3\n") ;
11378     }
11379     else
11380         printf ("4\n") ;
11381     fflush (stdout) ;
11382     exit(0);
11383 }
11384 EOM
11385         : Call the object file tmp-dyna.o in case dlext=o.
11386         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11387                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11388                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11389                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11390                 xxx=`$run ./fred`
11391                 case $xxx in
11392                 1)      echo "Test program failed using dlopen." >&4
11393                         echo "Perhaps you should not use dynamic loading." >&4;;
11394                 2)      echo "Test program failed using dlsym." >&4
11395                         echo "Perhaps you should not use dynamic loading." >&4;;
11396                 3)      echo "dlsym needs a leading underscore" >&4
11397                         val="$define" ;;
11398                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11399                 esac
11400         else
11401                 echo "I can't compile and run the test program." >&4
11402                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11403         fi
11404         ;;
11405 esac
11406                 
11407 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11408
11409 set d_dlsymun
11410 eval $setvar
11411
11412 : see if drand48_r exists
11413 set drand48_r d_drand48_r
11414 eval $inlibc
11415 case "$d_drand48_r" in
11416 "$define")
11417         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11418         case "$d_drand48_r_proto:$usethreads" in
11419         ":define")      d_drand48_r_proto=define
11420                 set d_drand48_r_proto drand48_r $hdrs
11421                 eval $hasproto ;;
11422         *)      ;;
11423         esac
11424         case "$d_drand48_r_proto" in
11425         define)
11426         case "$drand48_r_proto" in
11427         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11428         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11429         esac
11430         case "$drand48_r_proto" in
11431         ''|0)   d_drand48_r=undef
11432                 drand48_r_proto=0
11433                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11434         * )     case "$drand48_r_proto" in
11435                 REENTRANT_PROTO*) ;;
11436                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11437                 esac
11438                 echo "Prototype: $try" ;;
11439         esac
11440         ;;
11441         *)      case "$usethreads" in
11442                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11443                 esac
11444                 d_drand48_r=undef
11445                 drand48_r_proto=0
11446                 ;;
11447         esac
11448         ;;
11449 *)      drand48_r_proto=0
11450         ;;
11451 esac
11452
11453 : see if prototype for drand48 is available
11454 echo " "
11455 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11456 eval $hasproto
11457
11458 : see if dup2 exists
11459 set dup2 d_dup2
11460 eval $inlibc
11461
11462 : see if eaccess exists
11463 set eaccess d_eaccess
11464 eval $inlibc
11465
11466 : see if endgrent exists
11467 set endgrent d_endgrent
11468 eval $inlibc
11469
11470 : see if this is an grp system
11471 set grp.h i_grp
11472 eval $inhdr
11473
11474 case "$i_grp" in
11475 $define)
11476         xxx=`./findhdr grp.h`
11477         $cppstdin $cppflags $cppminus < $xxx >$$.h
11478
11479         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11480                 val="$define"
11481         else
11482                 val="$undef"
11483         fi
11484         set d_grpasswd
11485         eval $setvar
11486
11487         $rm -f $$.h
11488         ;;
11489 *)
11490         val="$undef";
11491         set d_grpasswd; eval $setvar
11492         ;;
11493 esac
11494
11495 : see if endgrent_r exists
11496 set endgrent_r d_endgrent_r
11497 eval $inlibc
11498 case "$d_endgrent_r" in
11499 "$define")
11500         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11501         case "$d_endgrent_r_proto:$usethreads" in
11502         ":define")      d_endgrent_r_proto=define
11503                 set d_endgrent_r_proto endgrent_r $hdrs
11504                 eval $hasproto ;;
11505         *)      ;;
11506         esac
11507         case "$d_endgrent_r_proto" in
11508         define)
11509         case "$endgrent_r_proto" in
11510         ''|0) try='int endgrent_r(FILE**);'
11511         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11512         esac
11513         case "$endgrent_r_proto" in
11514         ''|0) try='void endgrent_r(FILE**);'
11515         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11516         esac
11517         case "$endgrent_r_proto" in
11518         ''|0)   d_endgrent_r=undef
11519                 endgrent_r_proto=0
11520                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11521         * )     case "$endgrent_r_proto" in
11522                 REENTRANT_PROTO*) ;;
11523                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11524                 esac
11525                 echo "Prototype: $try" ;;
11526         esac
11527         ;;
11528         *)      case "$usethreads" in
11529                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11530                 esac
11531                 d_endgrent_r=undef
11532                 endgrent_r_proto=0
11533                 ;;
11534         esac
11535         ;;
11536 *)      endgrent_r_proto=0
11537         ;;
11538 esac
11539
11540 : see if endhostent exists
11541 set endhostent d_endhent
11542 eval $inlibc
11543
11544 : see if this is a netdb.h system
11545 set netdb.h i_netdb
11546 eval $inhdr
11547
11548 : see if endhostent_r exists
11549 set endhostent_r d_endhostent_r
11550 eval $inlibc
11551 case "$d_endhostent_r" in
11552 "$define")
11553         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11554         case "$d_endhostent_r_proto:$usethreads" in
11555         ":define")      d_endhostent_r_proto=define
11556                 set d_endhostent_r_proto endhostent_r $hdrs
11557                 eval $hasproto ;;
11558         *)      ;;
11559         esac
11560         case "$d_endhostent_r_proto" in
11561         define)
11562         case "$endhostent_r_proto" in
11563         ''|0) try='int endhostent_r(struct hostent_data*);'
11564         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11565         esac
11566         case "$endhostent_r_proto" in
11567         ''|0) try='void endhostent_r(struct hostent_data*);'
11568         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11569         esac
11570         case "$endhostent_r_proto" in
11571         ''|0)   d_endhostent_r=undef
11572                 endhostent_r_proto=0
11573                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11574         * )     case "$endhostent_r_proto" in
11575                 REENTRANT_PROTO*) ;;
11576                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11577                 esac
11578                 echo "Prototype: $try" ;;
11579         esac
11580         ;;
11581         *)      case "$usethreads" in
11582                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11583                 esac
11584                 d_endhostent_r=undef
11585                 endhostent_r_proto=0
11586                 ;;
11587         esac
11588         ;;
11589 *)      endhostent_r_proto=0
11590         ;;
11591 esac
11592
11593 : see if endnetent exists
11594 set endnetent d_endnent
11595 eval $inlibc
11596
11597 : see if endnetent_r exists
11598 set endnetent_r d_endnetent_r
11599 eval $inlibc
11600 case "$d_endnetent_r" in
11601 "$define")
11602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11603         case "$d_endnetent_r_proto:$usethreads" in
11604         ":define")      d_endnetent_r_proto=define
11605                 set d_endnetent_r_proto endnetent_r $hdrs
11606                 eval $hasproto ;;
11607         *)      ;;
11608         esac
11609         case "$d_endnetent_r_proto" in
11610         define)
11611         case "$endnetent_r_proto" in
11612         ''|0) try='int endnetent_r(struct netent_data*);'
11613         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11614         esac
11615         case "$endnetent_r_proto" in
11616         ''|0) try='void endnetent_r(struct netent_data*);'
11617         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11618         esac
11619         case "$endnetent_r_proto" in
11620         ''|0)   d_endnetent_r=undef
11621                 endnetent_r_proto=0
11622                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11623         * )     case "$endnetent_r_proto" in
11624                 REENTRANT_PROTO*) ;;
11625                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11626                 esac
11627                 echo "Prototype: $try" ;;
11628         esac
11629         ;;
11630         *)      case "$usethreads" in
11631                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11632                 esac
11633                 d_endnetent_r=undef
11634                 endnetent_r_proto=0
11635                 ;;
11636         esac
11637         ;;
11638 *)      endnetent_r_proto=0
11639         ;;
11640 esac
11641
11642 : see if endprotoent exists
11643 set endprotoent d_endpent
11644 eval $inlibc
11645
11646 : see if endprotoent_r exists
11647 set endprotoent_r d_endprotoent_r
11648 eval $inlibc
11649 case "$d_endprotoent_r" in
11650 "$define")
11651         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11652         case "$d_endprotoent_r_proto:$usethreads" in
11653         ":define")      d_endprotoent_r_proto=define
11654                 set d_endprotoent_r_proto endprotoent_r $hdrs
11655                 eval $hasproto ;;
11656         *)      ;;
11657         esac
11658         case "$d_endprotoent_r_proto" in
11659         define)
11660         case "$endprotoent_r_proto" in
11661         ''|0) try='int endprotoent_r(struct protoent_data*);'
11662         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11663         esac
11664         case "$endprotoent_r_proto" in
11665         ''|0) try='void endprotoent_r(struct protoent_data*);'
11666         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11667         esac
11668         case "$endprotoent_r_proto" in
11669         ''|0)   d_endprotoent_r=undef
11670                 endprotoent_r_proto=0
11671                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11672         * )     case "$endprotoent_r_proto" in
11673                 REENTRANT_PROTO*) ;;
11674                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11675                 esac
11676                 echo "Prototype: $try" ;;
11677         esac
11678         ;;
11679         *)      case "$usethreads" in
11680                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11681                 esac
11682                 d_endprotoent_r=undef
11683                 endprotoent_r_proto=0
11684                 ;;
11685         esac
11686         ;;
11687 *)      endprotoent_r_proto=0
11688         ;;
11689 esac
11690
11691 : see if endpwent exists
11692 set endpwent d_endpwent
11693 eval $inlibc
11694
11695 : see if this is a pwd.h system
11696 set pwd.h i_pwd
11697 eval $inhdr
11698
11699 case "$i_pwd" in
11700 $define)
11701         xxx=`./findhdr pwd.h`
11702         $cppstdin $cppflags $cppminus < $xxx >$$.h
11703
11704         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11705                 val="$define"
11706         else
11707                 val="$undef"
11708         fi
11709         set d_pwquota
11710         eval $setvar
11711
11712         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11713                 val="$define"
11714         else
11715                 val="$undef"
11716         fi
11717         set d_pwage
11718         eval $setvar
11719
11720         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11721                 val="$define"
11722         else
11723                 val="$undef"
11724         fi
11725         set d_pwchange
11726         eval $setvar
11727
11728         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11729                 val="$define"
11730         else
11731                 val="$undef"
11732         fi
11733         set d_pwclass
11734         eval $setvar
11735
11736         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11737                 val="$define"
11738         else
11739                 val="$undef"
11740         fi
11741         set d_pwexpire
11742         eval $setvar
11743
11744         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11745                 val="$define"
11746         else
11747                 val="$undef"
11748         fi
11749         set d_pwcomment
11750         eval $setvar
11751
11752         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11753                 val="$define"
11754         else
11755                 val="$undef"
11756         fi
11757         set d_pwgecos
11758         eval $setvar
11759
11760         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11761                 val="$define"
11762         else
11763                 val="$undef"
11764         fi
11765         set d_pwpasswd
11766         eval $setvar
11767
11768         $rm -f $$.h
11769         ;;
11770 *)
11771         val="$undef"; 
11772         set d_pwquota; eval $setvar
11773         set d_pwage; eval $setvar
11774         set d_pwchange; eval $setvar
11775         set d_pwclass; eval $setvar
11776         set d_pwexpire; eval $setvar
11777         set d_pwcomment; eval $setvar
11778         set d_pwgecos; eval $setvar
11779         set d_pwpasswd; eval $setvar
11780         ;;
11781 esac
11782
11783 : see if endpwent_r exists
11784 set endpwent_r d_endpwent_r
11785 eval $inlibc
11786 case "$d_endpwent_r" in
11787 "$define")
11788         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11789         case "$d_endpwent_r_proto:$usethreads" in
11790         ":define")      d_endpwent_r_proto=define
11791                 set d_endpwent_r_proto endpwent_r $hdrs
11792                 eval $hasproto ;;
11793         *)      ;;
11794         esac
11795         case "$d_endpwent_r_proto" in
11796         define)
11797         case "$endpwent_r_proto" in
11798         ''|0) try='int endpwent_r(FILE**);'
11799         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11800         esac
11801         case "$endpwent_r_proto" in
11802         ''|0) try='void endpwent_r(FILE**);'
11803         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11804         esac
11805         case "$endpwent_r_proto" in
11806         ''|0)   d_endpwent_r=undef
11807                 endpwent_r_proto=0
11808                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11809         * )     case "$endpwent_r_proto" in
11810                 REENTRANT_PROTO*) ;;
11811                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11812                 esac
11813                 echo "Prototype: $try" ;;
11814         esac
11815         ;;
11816         *)      case "$usethreads" in
11817                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11818                 esac
11819                 d_endpwent_r=undef
11820                 endpwent_r_proto=0
11821                 ;;
11822         esac
11823         ;;
11824 *)      endpwent_r_proto=0
11825         ;;
11826 esac
11827
11828 : see if endservent exists
11829 set endservent d_endsent
11830 eval $inlibc
11831
11832 : see if endservent_r exists
11833 set endservent_r d_endservent_r
11834 eval $inlibc
11835 case "$d_endservent_r" in
11836 "$define")
11837         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11838         case "$d_endservent_r_proto:$usethreads" in
11839         ":define")      d_endservent_r_proto=define
11840                 set d_endservent_r_proto endservent_r $hdrs
11841                 eval $hasproto ;;
11842         *)      ;;
11843         esac
11844         case "$d_endservent_r_proto" in
11845         define)
11846         case "$endservent_r_proto" in
11847         ''|0) try='int endservent_r(struct servent_data*);'
11848         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11849         esac
11850         case "$endservent_r_proto" in
11851         ''|0) try='void endservent_r(struct servent_data*);'
11852         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11853         esac
11854         case "$endservent_r_proto" in
11855         ''|0)   d_endservent_r=undef
11856                 endservent_r_proto=0
11857                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11858         * )     case "$endservent_r_proto" in
11859                 REENTRANT_PROTO*) ;;
11860                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11861                 esac
11862                 echo "Prototype: $try" ;;
11863         esac
11864         ;;
11865         *)      case "$usethreads" in
11866                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11867                 esac
11868                 d_endservent_r=undef
11869                 endservent_r_proto=0
11870                 ;;
11871         esac
11872         ;;
11873 *)      endservent_r_proto=0
11874         ;;
11875 esac
11876
11877 : Locate the flags for 'open()'
11878 echo " "
11879 $cat >try.c <<EOCP
11880 #include <sys/types.h>
11881 #ifdef I_FCNTL
11882 #include <fcntl.h>
11883 #endif
11884 #ifdef I_SYS_FILE
11885 #include <sys/file.h>
11886 #endif
11887 #$i_stdlib I_STDLIB
11888 #ifdef I_STDLIB
11889 #include <stdlib.h>
11890 #endif
11891 int main() {
11892         if(O_RDONLY);
11893 #ifdef O_TRUNC
11894         exit(0);
11895 #else
11896         exit(1);
11897 #endif
11898 }
11899 EOCP
11900 : check sys/file.h first to get FREAD on Sun
11901 if $test `./findhdr sys/file.h` && \
11902                 set try -DI_SYS_FILE && eval $compile; then
11903         h_sysfile=true;
11904         echo "<sys/file.h> defines the O_* constants..." >&4
11905         if $run ./try; then
11906                 echo "and you have the 3 argument form of open()." >&4
11907                 val="$define"
11908         else
11909                 echo "but not the 3 argument form of open().  Oh, well." >&4
11910                 val="$undef"
11911         fi
11912 elif $test `./findhdr fcntl.h` && \
11913                 set try -DI_FCNTL && eval $compile; then
11914         h_fcntl=true;
11915         echo "<fcntl.h> defines the O_* constants..." >&4
11916         if $run ./try; then
11917                 echo "and you have the 3 argument form of open()." >&4
11918                 val="$define"
11919         else
11920                 echo "but not the 3 argument form of open().  Oh, well." >&4
11921                 val="$undef"
11922         fi
11923 else
11924         val="$undef"
11925         echo "I can't find the O_* constant definitions!  You got problems." >&4
11926 fi
11927 set d_open3
11928 eval $setvar
11929 $rm -f try try.*
11930
11931 : see which of string.h or strings.h is needed
11932 echo " "
11933 strings=`./findhdr string.h`
11934 if $test "$strings" && $test -r "$strings"; then
11935         echo "Using <string.h> instead of <strings.h>." >&4
11936         val="$define"
11937 else
11938         val="$undef"
11939         strings=`./findhdr strings.h`
11940         if $test "$strings" && $test -r "$strings"; then
11941                 echo "Using <strings.h> instead of <string.h>." >&4
11942         else
11943                 echo "No string header found -- You'll surely have problems." >&4
11944         fi
11945 fi
11946 set i_string
11947 eval $setvar
11948 case "$i_string" in
11949 "$undef") strings=`./findhdr strings.h`;;
11950 *)        strings=`./findhdr string.h`;;
11951 esac
11952
11953 : see if this is a sys/file.h system
11954 val=''
11955 set sys/file.h val
11956 eval $inhdr
11957
11958 : do we need to include sys/file.h ?
11959 case "$val" in
11960 "$define")
11961         echo " "
11962         if $h_sysfile; then
11963                 val="$define"
11964                 echo "We'll be including <sys/file.h>." >&4
11965         else
11966                 val="$undef"
11967                 echo "We won't be including <sys/file.h>." >&4
11968         fi
11969         ;;
11970 *)
11971         h_sysfile=false
11972         ;;
11973 esac
11974 set i_sysfile
11975 eval $setvar
11976
11977 : see if fcntl.h is there
11978 val=''
11979 set fcntl.h val
11980 eval $inhdr
11981
11982 : see if we can include fcntl.h
11983 case "$val" in
11984 "$define")
11985         echo " "
11986         if $h_fcntl; then
11987                 val="$define"
11988                 echo "We'll be including <fcntl.h>." >&4
11989         else
11990                 val="$undef"
11991                 if $h_sysfile; then
11992         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11993                 else
11994                         echo "We won't be including <fcntl.h>." >&4
11995                 fi
11996         fi
11997         ;;
11998 *)
11999         h_fcntl=false
12000         val="$undef"
12001         ;;
12002 esac
12003 set i_fcntl
12004 eval $setvar
12005
12006 : check for non-blocking I/O stuff
12007 case "$h_sysfile" in
12008 true) echo "#include <sys/file.h>" > head.c;;
12009 *)
12010        case "$h_fcntl" in
12011        true) echo "#include <fcntl.h>" > head.c;;
12012        *) echo "#include <sys/fcntl.h>" > head.c;;
12013        esac
12014        ;;
12015 esac
12016 echo " "
12017 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12018 case "$o_nonblock" in
12019 '')
12020         $cat head.c > try.c
12021         $cat >>try.c <<EOCP
12022 #include <stdio.h>
12023 #$i_stdlib I_STDLIB
12024 #ifdef I_STDLIB
12025 #include <stdlib.h>
12026 #endif
12027 #$i_fcntl I_FCNTL
12028 #ifdef I_FCNTL
12029 #include <fcntl.h>
12030 #endif
12031 int main() {
12032 #ifdef O_NONBLOCK
12033         printf("O_NONBLOCK\n");
12034         exit(0);
12035 #endif
12036 #ifdef O_NDELAY
12037         printf("O_NDELAY\n");
12038         exit(0);
12039 #endif
12040 #ifdef FNDELAY
12041         printf("FNDELAY\n");
12042         exit(0);
12043 #endif
12044         exit(0);
12045 }
12046 EOCP
12047         set try
12048         if eval $compile_ok; then
12049                 o_nonblock=`$run ./try`
12050                 case "$o_nonblock" in
12051                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12052                 *) echo "Seems like we can use $o_nonblock.";;
12053                 esac
12054         else
12055                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12056         fi
12057         ;;
12058 *) echo "Using $hint value $o_nonblock.";;
12059 esac
12060 $rm -f try try.* .out core
12061
12062 echo " "
12063 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12064 case "$eagain" in
12065 '')
12066         $cat head.c > try.c
12067         $cat >>try.c <<EOCP
12068 #include <errno.h>
12069 #include <sys/types.h>
12070 #include <signal.h>
12071 #include <stdio.h> 
12072 #$i_stdlib I_STDLIB
12073 #ifdef I_STDLIB
12074 #include <stdlib.h>
12075 #endif
12076 #$i_fcntl I_FCNTL
12077 #ifdef I_FCNTL
12078 #include <fcntl.h>
12079 #endif
12080 #define MY_O_NONBLOCK $o_nonblock
12081 #ifndef errno  /* XXX need better Configure test */
12082 extern int errno;
12083 #endif
12084 #$i_unistd I_UNISTD
12085 #ifdef I_UNISTD
12086 #include <unistd.h>
12087 #endif
12088 #$i_string I_STRING
12089 #ifdef I_STRING
12090 #include <string.h>
12091 #else
12092 #include <strings.h>
12093 #endif
12094 $signal_t blech(int x) { exit(3); }
12095 EOCP
12096         $cat >> try.c <<'EOCP'
12097 int main()
12098 {
12099         int pd[2];
12100         int pu[2];
12101         char buf[1];
12102         char string[100];
12103
12104         pipe(pd);       /* Down: child -> parent */
12105         pipe(pu);       /* Up: parent -> child */
12106         if (0 != fork()) {
12107                 int ret;
12108                 close(pd[1]);   /* Parent reads from pd[0] */
12109                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12110 #ifdef F_SETFL
12111                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12112                         exit(1);
12113 #else
12114                 exit(4);
12115 #endif
12116                 signal(SIGALRM, blech);
12117                 alarm(5);
12118                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12119                         exit(2);
12120                 sprintf(string, "%d\n", ret);
12121                 write(2, string, strlen(string));
12122                 alarm(0);
12123 #ifdef EAGAIN
12124                 if (errno == EAGAIN) {
12125                         printf("EAGAIN\n");
12126                         goto ok;
12127                 }
12128 #endif
12129 #ifdef EWOULDBLOCK
12130                 if (errno == EWOULDBLOCK)
12131                         printf("EWOULDBLOCK\n");
12132 #endif
12133         ok:
12134                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12135                 sleep(2);                               /* Give it time to close our pipe */
12136                 alarm(5);
12137                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12138                 alarm(0);
12139                 sprintf(string, "%d\n", ret);
12140                 write(4, string, strlen(string));
12141                 exit(0);
12142         }
12143
12144         close(pd[0]);                   /* We write to pd[1] */
12145         close(pu[1]);                   /* We read from pu[0] */
12146         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12147         close(pd[1]);                   /* Pipe pd is now fully closed! */
12148         exit(0);                                /* Bye bye, thank you for playing! */
12149 }
12150 EOCP
12151         set try
12152         if eval $compile_ok; then
12153                 echo "$startsh" >mtry
12154                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12155                 chmod +x mtry
12156                 ./mtry >/dev/null 2>&1
12157                 case $? in
12158                 0) eagain=`$cat try.out`;;
12159                 1) echo "Could not perform non-blocking setting!";;
12160                 2) echo "I did a successful read() for something that was not there!";;
12161                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12162                 4) echo "Could not find F_SETFL!";;
12163                 *) echo "Something terribly wrong happened during testing.";;
12164                 esac
12165                 rd_nodata=`$cat try.ret`
12166                 echo "A read() system call with no data present returns $rd_nodata."
12167                 case "$rd_nodata" in
12168                 0|-1) ;;
12169                 *)
12170                         echo "(That's peculiar, fixing that to be -1.)"
12171                         rd_nodata=-1
12172                         ;;
12173                 esac
12174                 case "$eagain" in
12175                 '')
12176                         echo "Forcing errno EAGAIN on read() with no data available."
12177                         eagain=EAGAIN
12178                         ;;
12179                 *)
12180                         echo "Your read() sets errno to $eagain when no data is available."
12181                         ;;
12182                 esac
12183                 status=`$cat try.err`
12184                 case "$status" in
12185                 0) echo "And it correctly returns 0 to signal EOF.";;
12186                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12187                 *) echo "However, your read() returns '$status' on EOF??";;
12188                 esac
12189                 val="$define"
12190                 if test "$status" = "$rd_nodata"; then
12191                         echo "WARNING: you can't distinguish between EOF and no data!"
12192                         val="$undef"
12193                 fi
12194         else
12195                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12196                 eagain=EAGAIN
12197         fi
12198         set d_eofnblk
12199         eval $setvar
12200         ;;
12201 *)
12202         echo "Using $hint value $eagain."
12203         echo "Your read() returns $rd_nodata when no data is present."
12204         case "$d_eofnblk" in
12205         "$define") echo "And you can see EOF because read() returns 0.";;
12206         "$undef") echo "But you can't see EOF status from read() returned value.";;
12207         *)
12208                 echo "(Assuming you can't see EOF status from read anyway.)"
12209                 d_eofnblk=$undef
12210                 ;;
12211         esac
12212         ;;
12213 esac
12214 $rm -f try try.* .out core head.c mtry
12215
12216 : see if _ptr and _cnt from stdio act std
12217 echo " "
12218
12219 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12220         echo "(Looks like you have stdio.h from BSD.)"
12221         case "$stdio_ptr" in
12222         '') stdio_ptr='((fp)->_p)'
12223                 ptr_lval=$define
12224                 ;;
12225         *)      ptr_lval=$d_stdio_ptr_lval;;
12226         esac
12227         case "$stdio_cnt" in
12228         '') stdio_cnt='((fp)->_r)'
12229                 cnt_lval=$define
12230                 ;;
12231         *)      cnt_lval=$d_stdio_cnt_lval;;
12232         esac
12233         case "$stdio_base" in
12234         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12235         esac
12236         case "$stdio_bufsiz" in
12237         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12238         esac
12239 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12240         echo "(Looks like you have stdio.h from Linux.)"
12241         case "$stdio_ptr" in
12242         '') stdio_ptr='((fp)->_IO_read_ptr)'
12243                 ptr_lval=$define
12244                 ;;
12245         *)      ptr_lval=$d_stdio_ptr_lval;;
12246         esac
12247         case "$stdio_cnt" in
12248         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12249                 cnt_lval=$undef
12250                 ;;
12251         *)      cnt_lval=$d_stdio_cnt_lval;;
12252         esac
12253         case "$stdio_base" in
12254         '') stdio_base='((fp)->_IO_read_base)';;
12255         esac
12256         case "$stdio_bufsiz" in
12257         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12258         esac
12259 else
12260         case "$stdio_ptr" in
12261         '') stdio_ptr='((fp)->_ptr)'
12262                 ptr_lval=$define
12263                 ;;
12264         *)      ptr_lval=$d_stdio_ptr_lval;;
12265         esac
12266         case "$stdio_cnt" in
12267         '') stdio_cnt='((fp)->_cnt)'
12268                 cnt_lval=$define
12269                 ;;
12270         *)      cnt_lval=$d_stdio_cnt_lval;;
12271         esac
12272         case "$stdio_base" in
12273         '') stdio_base='((fp)->_base)';;
12274         esac
12275         case "$stdio_bufsiz" in
12276         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12277         esac
12278 fi
12279
12280 : test whether _ptr and _cnt really work
12281 echo "Checking how std your stdio is..." >&4
12282 $cat >try.c <<EOP
12283 #include <stdio.h>
12284 #$i_stdlib I_STDLIB
12285 #ifdef I_STDLIB
12286 #include <stdlib.h>
12287 #endif
12288 #define FILE_ptr(fp)    $stdio_ptr
12289 #define FILE_cnt(fp)    $stdio_cnt
12290 int main() {
12291         FILE *fp = fopen("try.c", "r");
12292         char c = getc(fp);
12293         if (
12294                 18 <= FILE_cnt(fp) &&
12295                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12296         )
12297                 exit(0);
12298         exit(1);
12299 }
12300 EOP
12301 val="$undef"
12302 set try
12303 if eval $compile && $to try.c; then
12304         if $run ./try; then
12305                 echo "Your stdio acts pretty std."
12306                 val="$define"
12307         else
12308                 echo "Your stdio isn't very std."
12309         fi
12310 else
12311         echo "Your stdio doesn't appear very std."
12312 fi
12313 $rm -f try.c try
12314
12315 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12316 # direct buffer manipulation no longer works.  The Configure tests
12317 # should be changed to correctly detect this, but until then,
12318 # the following check should at least let perl compile and run.
12319 # (This quick fix should be updated before 5.8.1.)
12320 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12321 # A. Dougherty, June 3, 2002.
12322 case "$d_gnulibc" in
12323 $define)
12324         case "$gnulibc_version" in
12325         2.[01]*)  ;;
12326         2.2) ;;
12327         2.2.[0-9]) ;;
12328         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12329                 val="$undef"
12330                 ;;
12331         esac
12332         ;;
12333 esac
12334 set d_stdstdio
12335 eval $setvar
12336
12337 : Can _ptr be used as an lvalue?
12338 case "$d_stdstdio$ptr_lval" in
12339 $define$define) val=$define ;;
12340 *) val=$undef ;;
12341 esac
12342 set d_stdio_ptr_lval
12343 eval $setvar
12344
12345 : Can _cnt be used as an lvalue?
12346 case "$d_stdstdio$cnt_lval" in
12347 $define$define) val=$define ;;
12348 *) val=$undef ;;
12349 esac
12350 set d_stdio_cnt_lval
12351 eval $setvar
12352
12353
12354 : test whether setting _ptr sets _cnt as a side effect
12355 d_stdio_ptr_lval_sets_cnt="$undef"
12356 d_stdio_ptr_lval_nochange_cnt="$undef"
12357 case "$d_stdio_ptr_lval$d_stdstdio" in
12358 $define$define)
12359         echo "Checking to see what happens if we set the stdio ptr..." >&4
12360 $cat >try.c <<EOP
12361 #include <stdio.h>
12362 /* Can we scream? */
12363 /* Eat dust sed :-) */
12364 /* In the buffer space, no one can hear you scream. */
12365 #$i_stdlib I_STDLIB
12366 #ifdef I_STDLIB
12367 #include <stdlib.h>
12368 #endif
12369 #define FILE_ptr(fp)    $stdio_ptr
12370 #define FILE_cnt(fp)    $stdio_cnt
12371 #include <sys/types.h>
12372 int main() {
12373         FILE *fp = fopen("try.c", "r");
12374         int c;
12375         char *ptr;
12376         size_t cnt;
12377         if (!fp) {
12378             puts("Fail even to read");
12379             exit(1);
12380         }
12381         c = getc(fp); /* Read away the first # */
12382         if (c == EOF) {
12383             puts("Fail even to read");
12384             exit(1);
12385         }
12386         if (!(
12387                 18 <= FILE_cnt(fp) &&
12388                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12389         )) {
12390                 puts("Fail even to read");
12391                 exit (1);
12392         }
12393         ptr = (char*) FILE_ptr(fp);
12394         cnt = (size_t)FILE_cnt(fp);
12395
12396         FILE_ptr(fp) += 42;
12397
12398         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12399                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12400                 exit (1);
12401         }
12402         if (FILE_cnt(fp) <= 20) {
12403                 printf ("Fail (<20 chars to test)");
12404                 exit (1);
12405         }
12406         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12407                 puts("Fail compare");
12408                 exit (1);
12409         }
12410         if (cnt == FILE_cnt(fp)) {
12411                 puts("Pass_unchanged");
12412                 exit (0);
12413         }       
12414         if (FILE_cnt(fp) == (cnt - 42)) {
12415                 puts("Pass_changed");
12416                 exit (0);
12417         }
12418         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12419         return 1;
12420
12421 }
12422 EOP
12423         set try
12424         if eval $compile && $to try.c; then
12425                 case `$run ./try` in
12426                 Pass_changed)
12427                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12428                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12429                 Pass_unchanged)
12430                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12431                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12432                 Fail*)
12433                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12434                 *)
12435                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12436         esac
12437         else
12438                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12439         fi
12440         $rm -f try.c try
12441         ;;
12442 esac
12443
12444 : see if _base is also standard
12445 val="$undef"
12446 case "$d_stdstdio" in
12447 $define)
12448         $cat >try.c <<EOP
12449 #include <stdio.h>
12450 #$i_stdlib I_STDLIB
12451 #ifdef I_STDLIB
12452 #include <stdlib.h>
12453 #endif
12454 #define FILE_base(fp)   $stdio_base
12455 #define FILE_bufsiz(fp) $stdio_bufsiz
12456 int main() {
12457         FILE *fp = fopen("try.c", "r");
12458         char c = getc(fp);
12459         if (
12460                 19 <= FILE_bufsiz(fp) &&
12461                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12462         )
12463                 exit(0);
12464         exit(1);
12465 }
12466 EOP
12467         set try
12468         if eval $compile && $to try.c; then
12469                 if $run ./try; then
12470                         echo "And its _base field acts std."
12471                         val="$define"
12472                 else
12473                         echo "But its _base field isn't std."
12474                 fi
12475         else
12476                 echo "However, it seems to be lacking the _base field."
12477         fi
12478         $rm -f try.c try
12479         ;;
12480 esac
12481 set d_stdiobase
12482 eval $setvar
12483
12484 : see if fast_stdio exists
12485 val="$undef"
12486 case "$d_stdstdio:$d_stdio_ptr_lval" in
12487 "$define:$define")
12488         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12489         *$define*)
12490                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12491                 val="$define"
12492                 ;;
12493         esac
12494         ;;
12495 esac
12496 set d_faststdio
12497 eval $setvar
12498
12499
12500
12501 : see if fchdir exists
12502 set fchdir d_fchdir
12503 eval $inlibc
12504
12505 : see if fchmod exists
12506 set fchmod d_fchmod
12507 eval $inlibc
12508
12509 : see if fchown exists
12510 set fchown d_fchown
12511 eval $inlibc
12512
12513 : see if this is an fcntl system
12514 set fcntl d_fcntl
12515 eval $inlibc
12516
12517 echo " "
12518 : See if fcntl-based locking works.
12519 $cat >try.c <<EOCP
12520 #$i_stdlib I_STDLIB
12521 #ifdef I_STDLIB
12522 #include <stdlib.h>
12523 #endif
12524 #include <unistd.h>
12525 #include <fcntl.h>
12526 #include <signal.h>
12527 $signal_t blech(int x) { exit(3); }
12528 int main() {
12529 #if defined(F_SETLK) && defined(F_SETLKW)
12530      struct flock flock;
12531      int retval, fd;
12532      fd = open("try.c", O_RDONLY);
12533      flock.l_type = F_RDLCK;
12534      flock.l_whence = SEEK_SET;
12535      flock.l_start = flock.l_len = 0;
12536      signal(SIGALRM, blech);
12537      alarm(10);
12538      retval = fcntl(fd, F_SETLK, &flock);
12539      close(fd);
12540      (retval < 0 ? exit(2) : exit(0));
12541 #else
12542      exit(2);
12543 #endif
12544 }
12545 EOCP
12546 echo "Checking if fcntl-based file locking works... "
12547 case "$d_fcntl" in
12548 "$define")
12549         set try
12550         if eval $compile_ok; then
12551                 if $run ./try; then
12552                         echo "Yes, it seems to work."
12553                         val="$define"
12554                 else
12555                         echo "Nope, it didn't work."
12556                         val="$undef"
12557                         case "$?" in
12558                         3) $cat >&4 <<EOM
12559 ***
12560 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12561 *** This is (almost) impossible.
12562 *** If your NFS lock daemons are not feeling well, something like
12563 *** this may happen, please investigate.  Cannot continue, aborting.
12564 ***
12565 EOM
12566                                 exit 1
12567                                 ;;
12568                         esac
12569                 fi
12570         else
12571                 echo "I'm unable to compile the test program, so I'll assume not."
12572                 val="$undef"
12573         fi
12574         ;;
12575 *) val="$undef";
12576         echo "Nope, since you don't even have fcntl()."
12577         ;;
12578 esac
12579 set d_fcntl_can_lock
12580 eval $setvar
12581 $rm -f try*
12582
12583
12584 : check for fd_set items
12585 $cat <<EOM
12586
12587 Checking to see how well your C compiler handles fd_set and friends ...
12588 EOM
12589 $cat >try.c <<EOCP
12590 #$i_stdlib I_STDLIB
12591 #ifdef I_STDLIB
12592 #include <stdlib.h>
12593 #endif
12594 #$i_systime I_SYS_TIME
12595 #$i_sysselct I_SYS_SELECT
12596 #$d_socket HAS_SOCKET
12597 #include <sys/types.h>
12598 #ifdef HAS_SOCKET
12599 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12600 #endif
12601 #ifdef I_SYS_TIME
12602 #include <sys/time.h>
12603 #endif
12604 #ifdef I_SYS_SELECT
12605 #include <sys/select.h>
12606 #endif
12607 int main() {
12608         fd_set fds;
12609
12610 #ifdef TRYBITS
12611         if(fds.fds_bits);
12612 #endif
12613
12614 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12615         exit(0);
12616 #else
12617         exit(1);
12618 #endif
12619 }
12620 EOCP
12621 set try -DTRYBITS
12622 if eval $compile; then
12623         d_fds_bits="$define"
12624         d_fd_set="$define"
12625         echo "Well, your system knows about the normal fd_set typedef..." >&4
12626         if $run ./try; then
12627                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12628                 d_fd_macros="$define"
12629         else
12630                 $cat >&4 <<'EOM'
12631 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12632 EOM
12633                 d_fd_macros="$undef"
12634         fi
12635 else
12636         $cat <<'EOM'
12637 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12638 EOM
12639         set try
12640         if eval $compile; then
12641                 d_fds_bits="$undef"
12642                 d_fd_set="$define"
12643                 echo "Well, your system has some sort of fd_set available..." >&4
12644                 if $run ./try; then
12645                         echo "and you have the normal fd_set macros." >&4
12646                         d_fd_macros="$define"
12647                 else
12648                         $cat <<'EOM'
12649 but not the normal fd_set macros!  Gross!  More work for me...
12650 EOM
12651                         d_fd_macros="$undef"
12652                 fi
12653         else
12654         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12655                 d_fd_set="$undef"
12656                 d_fds_bits="$undef"
12657                 d_fd_macros="$undef"
12658         fi
12659 fi
12660 $rm -f try try.*
12661
12662 : see if fgetpos exists
12663 set fgetpos d_fgetpos
12664 eval $inlibc
12665
12666 : see if finite exists
12667 set finite d_finite
12668 eval $inlibc
12669
12670 : see if finitel exists
12671 set finitel d_finitel
12672 eval $inlibc
12673
12674 : see if flock exists
12675 set flock d_flock
12676 eval $inlibc
12677
12678 : see if prototype for flock is available
12679 echo " "
12680 set d_flockproto flock $i_sysfile sys/file.h
12681 eval $hasproto
12682
12683 : see if fork exists
12684 set fork d_fork
12685 eval $inlibc
12686
12687 : see if fp_class exists
12688 set fp_class d_fp_class
12689 eval $inlibc
12690
12691 : see if pathconf exists
12692 set pathconf d_pathconf
12693 eval $inlibc
12694
12695 : see if fpathconf exists
12696 set fpathconf d_fpathconf
12697 eval $inlibc
12698
12699 : see if fpclass exists
12700 set fpclass d_fpclass
12701 eval $inlibc
12702
12703 : see if fpclassify exists
12704 set fpclassify d_fpclassify
12705 eval $inlibc
12706
12707 : see if fpclassl exists
12708 set fpclassl d_fpclassl
12709 eval $inlibc
12710
12711
12712 : check for fpos64_t
12713 echo " "
12714 echo "Checking to see if you have fpos64_t..." >&4
12715 $cat >try.c <<EOCP
12716 #include <stdio.h>
12717 int main() { fpos64_t x = 7; }
12718 EOCP
12719 set try
12720 if eval $compile; then
12721         val="$define"
12722         echo "You have fpos64_t."
12723 else
12724         val="$undef"
12725         echo "You do not have fpos64_t."
12726         case "$fpossize" in
12727         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12728         esac
12729 fi
12730 $rm -f try.* try
12731 set d_fpos64_t
12732 eval $setvar
12733
12734 : see if frexpl exists
12735 set frexpl d_frexpl
12736 eval $inlibc
12737
12738 : see if this is a sys/param system
12739 set sys/param.h i_sysparam
12740 eval $inhdr
12741
12742 : see if this is a sys/mount.h system
12743 set sys/mount.h i_sysmount
12744 eval $inhdr
12745
12746
12747 echo " "
12748 echo "Checking to see if your system supports struct fs_data..." >&4
12749 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12750 eval $hasstruct
12751 case "$d_fs_data_s" in
12752 "$define")      echo "Yes, it does."   ;;
12753 *)              echo "No, it doesn't." ;;
12754 esac
12755
12756 : see if fseeko exists
12757 set fseeko d_fseeko
12758 eval $inlibc
12759 case "$longsize" in
12760 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12761 esac
12762
12763 : see if fsetpos exists
12764 set fsetpos d_fsetpos
12765 eval $inlibc
12766
12767
12768 : see if fstatfs exists
12769 set fstatfs d_fstatfs
12770 eval $inlibc
12771
12772
12773 : see if statvfs exists
12774 set statvfs d_statvfs
12775 eval $inlibc
12776
12777 : see if fstatvfs exists
12778 set fstatvfs d_fstatvfs
12779 eval $inlibc
12780
12781
12782 : see if fsync exists
12783 set fsync d_fsync
12784 eval $inlibc
12785
12786 : see if ftello exists
12787 set ftello d_ftello
12788 eval $inlibc
12789 case "$longsize" in
12790 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12791 esac
12792
12793 d_futimes="$undef"
12794 : check for a working futimes
12795 echo " "
12796 echo "Checking for a working futimes()" >&4
12797 $cat >try.c <<EOCP
12798 #include <stdio.h>
12799 #include <sys/time.h>
12800 #include <errno.h>
12801 #include <fcntl.h>
12802
12803 int main ()
12804 {
12805     int fd, rv;
12806     fd = open ("try.c", O_RDWR);
12807     if (-1 == fd) exit (1);
12808     rv = futimes (fd, NULL);
12809     exit (rv == -1 ? errno : 0);
12810 }
12811 EOCP
12812 set try
12813 if eval $compile; then
12814     `$run ./try`
12815     rc=$?
12816     case "$rc" in
12817         0)  echo "Yes, it does" >&4
12818             d_futimes="$define"
12819             ;;
12820         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12821             ;;
12822     esac
12823 else
12824     echo "No, it does not (probably harmless)\n" >&4
12825 fi
12826 $rm -f try.* try core core.try.*
12827
12828 : see if getcwd exists
12829 set getcwd d_getcwd
12830 eval $inlibc
12831
12832 : see if getespwnam exists
12833 set getespwnam d_getespwnam
12834 eval $inlibc
12835
12836
12837 : see if getfsstat exists
12838 set getfsstat d_getfsstat
12839 eval $inlibc
12840
12841 : see if getgrent exists
12842 set getgrent d_getgrent
12843 eval $inlibc
12844
12845 : see if getgrent_r exists
12846 set getgrent_r d_getgrent_r
12847 eval $inlibc
12848 case "$d_getgrent_r" in
12849 "$define")
12850         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12851         case "$d_getgrent_r_proto:$usethreads" in
12852         ":define")      d_getgrent_r_proto=define
12853                 set d_getgrent_r_proto getgrent_r $hdrs
12854                 eval $hasproto ;;
12855         *)      ;;
12856         esac
12857         case "$d_getgrent_r_proto" in
12858         define)
12859         case "$getgrent_r_proto" in
12860         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12861         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12862         esac
12863         case "$getgrent_r_proto" in
12864         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12865         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12866         esac
12867         case "$getgrent_r_proto" in
12868         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12869         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12870         esac
12871         case "$getgrent_r_proto" in
12872         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12873         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12874         esac
12875         case "$getgrent_r_proto" in
12876         ''|0) try='int getgrent_r(struct group*, char*, int);'
12877         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12878         esac
12879         case "$getgrent_r_proto" in
12880         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12881         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12882         esac
12883         case "$getgrent_r_proto" in
12884         ''|0)   d_getgrent_r=undef
12885                 getgrent_r_proto=0
12886                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12887         * )     case "$getgrent_r_proto" in
12888                 REENTRANT_PROTO*) ;;
12889                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12890                 esac
12891                 echo "Prototype: $try" ;;
12892         esac
12893         ;;
12894         *)      case "$usethreads" in
12895                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12896                 esac
12897                 d_getgrent_r=undef
12898                 getgrent_r_proto=0
12899                 ;;
12900         esac
12901         ;;
12902 *)      getgrent_r_proto=0
12903         ;;
12904 esac
12905
12906 : see if getgrgid_r exists
12907 set getgrgid_r d_getgrgid_r
12908 eval $inlibc
12909 case "$d_getgrgid_r" in
12910 "$define")
12911         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12912         case "$d_getgrgid_r_proto:$usethreads" in
12913         ":define")      d_getgrgid_r_proto=define
12914                 set d_getgrgid_r_proto getgrgid_r $hdrs
12915                 eval $hasproto ;;
12916         *)      ;;
12917         esac
12918         case "$d_getgrgid_r_proto" in
12919         define)
12920         case "$getgrgid_r_proto" in
12921         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12922         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12923         esac
12924         case "$getgrgid_r_proto" in
12925         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12926         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12927         esac
12928         case "$getgrgid_r_proto" in
12929         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12930         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12931         esac
12932         case "$getgrgid_r_proto" in
12933         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12934         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12935         esac
12936         case "$getgrgid_r_proto" in
12937         ''|0)   d_getgrgid_r=undef
12938                 getgrgid_r_proto=0
12939                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12940         * )     case "$getgrgid_r_proto" in
12941                 REENTRANT_PROTO*) ;;
12942                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12943                 esac
12944                 echo "Prototype: $try" ;;
12945         esac
12946         ;;
12947         *)      case "$usethreads" in
12948                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12949                 esac
12950                 d_getgrgid_r=undef
12951                 getgrgid_r_proto=0
12952                 ;;
12953         esac
12954         ;;
12955 *)      getgrgid_r_proto=0
12956         ;;
12957 esac
12958
12959 : see if getgrnam_r exists
12960 set getgrnam_r d_getgrnam_r
12961 eval $inlibc
12962 case "$d_getgrnam_r" in
12963 "$define")
12964         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12965         case "$d_getgrnam_r_proto:$usethreads" in
12966         ":define")      d_getgrnam_r_proto=define
12967                 set d_getgrnam_r_proto getgrnam_r $hdrs
12968                 eval $hasproto ;;
12969         *)      ;;
12970         esac
12971         case "$d_getgrnam_r_proto" in
12972         define)
12973         case "$getgrnam_r_proto" in
12974         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12975         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12976         esac
12977         case "$getgrnam_r_proto" in
12978         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12979         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12980         esac
12981         case "$getgrnam_r_proto" in
12982         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12983         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12984         esac
12985         case "$getgrnam_r_proto" in
12986         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12987         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12988         esac
12989         case "$getgrnam_r_proto" in
12990         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12991         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12992         esac
12993         case "$getgrnam_r_proto" in
12994         ''|0)   d_getgrnam_r=undef
12995                 getgrnam_r_proto=0
12996                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12997         * )     case "$getgrnam_r_proto" in
12998                 REENTRANT_PROTO*) ;;
12999                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13000                 esac
13001                 echo "Prototype: $try" ;;
13002         esac
13003         ;;
13004         *)      case "$usethreads" in
13005                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13006                 esac
13007                 d_getgrnam_r=undef
13008                 getgrnam_r_proto=0
13009                 ;;
13010         esac
13011         ;;
13012 *)      getgrnam_r_proto=0
13013         ;;
13014 esac
13015
13016 : see if gethostbyaddr exists
13017 set gethostbyaddr d_gethbyaddr
13018 eval $inlibc
13019
13020 : see if gethostbyname exists
13021 set gethostbyname d_gethbyname
13022 eval $inlibc
13023
13024 : see if gethostent exists
13025 set gethostent d_gethent
13026 eval $inlibc
13027
13028 : see how we will look up host name
13029 echo " "
13030 call=''
13031 if set gethostname val -f d_gethname; eval $csym; $val; then
13032         echo 'gethostname() found.' >&4
13033         d_gethname="$define"
13034         call=gethostname
13035 fi
13036 if set uname val -f d_uname; eval $csym; $val; then
13037         if ./xenix; then
13038                 $cat <<'EOM'
13039 uname() was found, but you're running xenix, and older versions of xenix
13040 have a broken uname(). If you don't really know whether your xenix is old
13041 enough to have a broken system call, use the default answer.
13042
13043 EOM
13044                 dflt=y
13045                 case "$d_uname" in
13046                 "$define") dflt=n;;
13047                 esac
13048                 rp='Is your uname() broken?'
13049                 . ./myread
13050                 case "$ans" in
13051                 n*) d_uname="$define"; call=uname;;
13052                 esac
13053         else
13054                 echo 'uname() found.' >&4
13055                 d_uname="$define"
13056                 case "$call" in
13057                 '') call=uname ;;
13058                 esac
13059         fi
13060 fi
13061 case "$d_gethname" in
13062 '') d_gethname="$undef";;
13063 esac
13064 case "$d_uname" in
13065 '') d_uname="$undef";;
13066 esac
13067 case "$d_uname$d_gethname" in
13068 *define*)
13069         dflt=n
13070         cat <<EOM
13071  
13072 Every now and then someone has a $call() that lies about the hostname
13073 but can't be fixed for political or economic reasons.  If you wish, I can
13074 pretend $call() isn't there and maybe compute hostname at run-time
13075 thanks to the '$phostname' command.
13076
13077 EOM
13078         rp="Shall I ignore $call() from now on?"
13079         . ./myread
13080         case "$ans" in
13081         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13082         esac;;
13083 esac
13084 case "$phostname" in
13085 '') aphostname='';;
13086 *) case "$aphostname" in
13087         /*) ;;
13088         *) set X $phostname
13089                 shift
13090                 file=$1
13091                 shift
13092                 file=`./loc $file $file $pth`
13093                 aphostname=`echo $file $*`
13094                 ;;
13095         esac
13096         ;;
13097 esac
13098 case "$d_uname$d_gethname" in
13099 *define*) ;;
13100 *)
13101         case "$phostname" in
13102         '')
13103                 echo "There will be no way for $package to get your hostname." >&4;;
13104         *)
13105         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13106                 ;;
13107         esac;;
13108 esac
13109 case "$d_phostname" in
13110 '') d_phostname="$undef";;
13111 esac
13112
13113 : see if gethostbyaddr_r exists
13114 set gethostbyaddr_r d_gethostbyaddr_r
13115 eval $inlibc
13116 case "$d_gethostbyaddr_r" in
13117 "$define")
13118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13119         case "$d_gethostbyaddr_r_proto:$usethreads" in
13120         ":define")      d_gethostbyaddr_r_proto=define
13121                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13122                 eval $hasproto ;;
13123         *)      ;;
13124         esac
13125         case "$d_gethostbyaddr_r_proto" in
13126         define)
13127         case "$gethostbyaddr_r_proto" in
13128         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13129         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13130         esac
13131         case "$gethostbyaddr_r_proto" in
13132         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13133         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13134         esac
13135         case "$gethostbyaddr_r_proto" in
13136         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13137         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13138         esac
13139         case "$gethostbyaddr_r_proto" in
13140         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13141         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13142         esac
13143         case "$gethostbyaddr_r_proto" in
13144         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13145         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13146         esac
13147         case "$gethostbyaddr_r_proto" in
13148         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13149         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13150         esac
13151         case "$gethostbyaddr_r_proto" in
13152         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13153         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13154         esac
13155         case "$gethostbyaddr_r_proto" in
13156         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13157         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13158         esac
13159         case "$gethostbyaddr_r_proto" in
13160         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13161         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13162         esac
13163         case "$gethostbyaddr_r_proto" in
13164         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13165         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13166         esac
13167         case "$gethostbyaddr_r_proto" in
13168         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13169         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13170         esac
13171         case "$gethostbyaddr_r_proto" in
13172         ''|0)   d_gethostbyaddr_r=undef
13173                 gethostbyaddr_r_proto=0
13174                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13175         * )     case "$gethostbyaddr_r_proto" in
13176                 REENTRANT_PROTO*) ;;
13177                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13178                 esac
13179                 echo "Prototype: $try" ;;
13180         esac
13181         ;;
13182         *)      case "$usethreads" in
13183                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13184                 esac
13185                 d_gethostbyaddr_r=undef
13186                 gethostbyaddr_r_proto=0
13187                 ;;
13188         esac
13189         ;;
13190 *)      gethostbyaddr_r_proto=0
13191         ;;
13192 esac
13193
13194 : see if gethostbyname_r exists
13195 set gethostbyname_r d_gethostbyname_r
13196 eval $inlibc
13197 case "$d_gethostbyname_r" in
13198 "$define")
13199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13200         case "$d_gethostbyname_r_proto:$usethreads" in
13201         ":define")      d_gethostbyname_r_proto=define
13202                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13203                 eval $hasproto ;;
13204         *)      ;;
13205         esac
13206         case "$d_gethostbyname_r_proto" in
13207         define)
13208         case "$gethostbyname_r_proto" in
13209         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13210         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13211         esac
13212         case "$gethostbyname_r_proto" in
13213         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13214         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13215         esac
13216         case "$gethostbyname_r_proto" in
13217         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13218         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13219         esac
13220         case "$gethostbyname_r_proto" in
13221         ''|0)   d_gethostbyname_r=undef
13222                 gethostbyname_r_proto=0
13223                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13224         * )     case "$gethostbyname_r_proto" in
13225                 REENTRANT_PROTO*) ;;
13226                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13227                 esac
13228                 echo "Prototype: $try" ;;
13229         esac
13230         ;;
13231         *)      case "$usethreads" in
13232                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13233                 esac
13234                 d_gethostbyname_r=undef
13235                 gethostbyname_r_proto=0
13236                 ;;
13237         esac
13238         ;;
13239 *)      gethostbyname_r_proto=0
13240         ;;
13241 esac
13242
13243 : see if gethostent_r exists
13244 set gethostent_r d_gethostent_r
13245 eval $inlibc
13246 case "$d_gethostent_r" in
13247 "$define")
13248         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13249         case "$d_gethostent_r_proto:$usethreads" in
13250         ":define")      d_gethostent_r_proto=define
13251                 set d_gethostent_r_proto gethostent_r $hdrs
13252                 eval $hasproto ;;
13253         *)      ;;
13254         esac
13255         case "$d_gethostent_r_proto" in
13256         define)
13257         case "$gethostent_r_proto" in
13258         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13259         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13260         esac
13261         case "$gethostent_r_proto" in
13262         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13263         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13264         esac
13265         case "$gethostent_r_proto" in
13266         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13267         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13268         esac
13269         case "$gethostent_r_proto" in
13270         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13271         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13272         esac
13273         case "$gethostent_r_proto" in
13274         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13275         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13276         esac
13277         case "$gethostent_r_proto" in
13278         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13279         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13280         esac
13281         case "$gethostent_r_proto" in
13282         ''|0)   d_gethostent_r=undef
13283                 gethostent_r_proto=0
13284                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13285         * )     case "$gethostent_r_proto" in
13286                 REENTRANT_PROTO*) ;;
13287                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13288                 esac
13289                 echo "Prototype: $try" ;;
13290         esac
13291         ;;
13292         *)      case "$usethreads" in
13293                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13294                 esac
13295                 d_gethostent_r=undef
13296                 gethostent_r_proto=0
13297                 ;;
13298         esac
13299         ;;
13300 *)      gethostent_r_proto=0
13301         ;;
13302 esac
13303
13304 : see if prototypes for various gethostxxx netdb.h functions are available
13305 echo " "
13306 set d_gethostprotos gethostent $i_netdb netdb.h
13307 eval $hasproto
13308
13309 : see if getitimer exists
13310 set getitimer d_getitimer
13311 eval $inlibc
13312
13313 : see if getlogin exists
13314 set getlogin d_getlogin
13315 eval $inlibc
13316
13317 : see if getlogin_r exists
13318 set getlogin_r d_getlogin_r
13319 eval $inlibc
13320 case "$d_getlogin_r" in
13321 "$define")
13322         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13323         case "$d_getlogin_r_proto:$usethreads" in
13324         ":define")      d_getlogin_r_proto=define
13325                 set d_getlogin_r_proto getlogin_r $hdrs
13326                 eval $hasproto ;;
13327         *)      ;;
13328         esac
13329         case "$d_getlogin_r_proto" in
13330         define)
13331         case "$getlogin_r_proto" in
13332         ''|0) try='int getlogin_r(char*, size_t);'
13333         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13334         esac
13335         case "$getlogin_r_proto" in
13336         ''|0) try='int getlogin_r(char*, int);'
13337         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13338         esac
13339         case "$getlogin_r_proto" in
13340         ''|0) try='char* getlogin_r(char*, size_t);'
13341         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13342         esac
13343         case "$getlogin_r_proto" in
13344         ''|0) try='char* getlogin_r(char*, int);'
13345         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13346         esac
13347         case "$getlogin_r_proto" in
13348         ''|0)   d_getlogin_r=undef
13349                 getlogin_r_proto=0
13350                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13351         * )     case "$getlogin_r_proto" in
13352                 REENTRANT_PROTO*) ;;
13353                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13354                 esac
13355                 echo "Prototype: $try" ;;
13356         esac
13357         ;;
13358         *)      case "$usethreads" in
13359                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13360                 esac
13361                 d_getlogin_r=undef
13362                 getlogin_r_proto=0
13363                 ;;
13364         esac
13365         ;;
13366 *)      getlogin_r_proto=0
13367         ;;
13368 esac
13369
13370 : see if getmnt exists
13371 set getmnt d_getmnt
13372 eval $inlibc
13373
13374 : see if getmntent exists
13375 set getmntent d_getmntent
13376 eval $inlibc
13377
13378 : see if getnetbyaddr exists
13379 set getnetbyaddr d_getnbyaddr
13380 eval $inlibc
13381
13382 : see if getnetbyname exists
13383 set getnetbyname d_getnbyname
13384 eval $inlibc
13385
13386 : see if getnetent exists
13387 set getnetent d_getnent
13388 eval $inlibc
13389
13390 : see if getnetbyaddr_r exists
13391 set getnetbyaddr_r d_getnetbyaddr_r
13392 eval $inlibc
13393 case "$d_getnetbyaddr_r" in
13394 "$define")
13395         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13396         case "$d_getnetbyaddr_r_proto:$usethreads" in
13397         ":define")      d_getnetbyaddr_r_proto=define
13398                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13399                 eval $hasproto ;;
13400         *)      ;;
13401         esac
13402         case "$d_getnetbyaddr_r_proto" in
13403         define)
13404         case "$getnetbyaddr_r_proto" in
13405         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13406         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13407         esac
13408         case "$getnetbyaddr_r_proto" in
13409         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13410         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13411         esac
13412         case "$getnetbyaddr_r_proto" in
13413         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13414         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13415         esac
13416         case "$getnetbyaddr_r_proto" in
13417         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13418         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13419         esac
13420         case "$getnetbyaddr_r_proto" in
13421         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13422         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13423         esac
13424         case "$getnetbyaddr_r_proto" in
13425         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13426         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13427         esac
13428         case "$getnetbyaddr_r_proto" in
13429         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13430         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13431         esac
13432         case "$getnetbyaddr_r_proto" in
13433         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13434         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13435         esac
13436         case "$getnetbyaddr_r_proto" in
13437         ''|0)   d_getnetbyaddr_r=undef
13438                 getnetbyaddr_r_proto=0
13439                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13440         * )     case "$getnetbyaddr_r_proto" in
13441                 REENTRANT_PROTO*) ;;
13442                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13443                 esac
13444                 echo "Prototype: $try" ;;
13445         esac
13446         ;;
13447         *)      case "$usethreads" in
13448                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13449                 esac
13450                 d_getnetbyaddr_r=undef
13451                 getnetbyaddr_r_proto=0
13452                 ;;
13453         esac
13454         ;;
13455 *)      getnetbyaddr_r_proto=0
13456         ;;
13457 esac
13458
13459 : see if getnetbyname_r exists
13460 set getnetbyname_r d_getnetbyname_r
13461 eval $inlibc
13462 case "$d_getnetbyname_r" in
13463 "$define")
13464         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13465         case "$d_getnetbyname_r_proto:$usethreads" in
13466         ":define")      d_getnetbyname_r_proto=define
13467                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13468                 eval $hasproto ;;
13469         *)      ;;
13470         esac
13471         case "$d_getnetbyname_r_proto" in
13472         define)
13473         case "$getnetbyname_r_proto" in
13474         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13475         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13476         esac
13477         case "$getnetbyname_r_proto" in
13478         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13479         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13480         esac
13481         case "$getnetbyname_r_proto" in
13482         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13483         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13484         esac
13485         case "$getnetbyname_r_proto" in
13486         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13487         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13488         esac
13489         case "$getnetbyname_r_proto" in
13490         ''|0)   d_getnetbyname_r=undef
13491                 getnetbyname_r_proto=0
13492                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13493         * )     case "$getnetbyname_r_proto" in
13494                 REENTRANT_PROTO*) ;;
13495                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13496                 esac
13497                 echo "Prototype: $try" ;;
13498         esac
13499         ;;
13500         *)      case "$usethreads" in
13501                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13502                 esac
13503                 d_getnetbyname_r=undef
13504                 getnetbyname_r_proto=0
13505                 ;;
13506         esac
13507         ;;
13508 *)      getnetbyname_r_proto=0
13509         ;;
13510 esac
13511
13512 : see if getnetent_r exists
13513 set getnetent_r d_getnetent_r
13514 eval $inlibc
13515 case "$d_getnetent_r" in
13516 "$define")
13517         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13518         case "$d_getnetent_r_proto:$usethreads" in
13519         ":define")      d_getnetent_r_proto=define
13520                 set d_getnetent_r_proto getnetent_r $hdrs
13521                 eval $hasproto ;;
13522         *)      ;;
13523         esac
13524         case "$d_getnetent_r_proto" in
13525         define)
13526         case "$getnetent_r_proto" in
13527         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13528         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13529         esac
13530         case "$getnetent_r_proto" in
13531         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13532         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13533         esac
13534         case "$getnetent_r_proto" in
13535         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13536         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13537         esac
13538         case "$getnetent_r_proto" in
13539         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13540         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13541         esac
13542         case "$getnetent_r_proto" in
13543         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13544         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13545         esac
13546         case "$getnetent_r_proto" in
13547         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13548         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13549         esac
13550         case "$getnetent_r_proto" in
13551         ''|0)   d_getnetent_r=undef
13552                 getnetent_r_proto=0
13553                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13554         * )     case "$getnetent_r_proto" in
13555                 REENTRANT_PROTO*) ;;
13556                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13557                 esac
13558                 echo "Prototype: $try" ;;
13559         esac
13560         ;;
13561         *)      case "$usethreads" in
13562                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13563                 esac
13564                 d_getnetent_r=undef
13565                 getnetent_r_proto=0
13566                 ;;
13567         esac
13568         ;;
13569 *)      getnetent_r_proto=0
13570         ;;
13571 esac
13572
13573 : see if prototypes for various getnetxxx netdb.h functions are available
13574 echo " "
13575 set d_getnetprotos getnetent $i_netdb netdb.h
13576 eval $hasproto
13577
13578 : see if getpagesize exists
13579 set getpagesize d_getpagsz
13580 eval $inlibc
13581
13582
13583 : see if getprotobyname exists
13584 set getprotobyname d_getpbyname
13585 eval $inlibc
13586
13587 : see if getprotobynumber exists
13588 set getprotobynumber d_getpbynumber
13589 eval $inlibc
13590
13591 : see if getprotoent exists
13592 set getprotoent d_getpent
13593 eval $inlibc
13594
13595 : see if getpgid exists
13596 set getpgid d_getpgid
13597 eval $inlibc
13598
13599 : see if getpgrp2 exists
13600 set getpgrp2 d_getpgrp2
13601 eval $inlibc
13602
13603 : see if getppid exists
13604 set getppid d_getppid
13605 eval $inlibc
13606
13607 : see if getpriority exists
13608 set getpriority d_getprior
13609 eval $inlibc
13610
13611 : see if getprotobyname_r exists
13612 set getprotobyname_r d_getprotobyname_r
13613 eval $inlibc
13614 case "$d_getprotobyname_r" in
13615 "$define")
13616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13617         case "$d_getprotobyname_r_proto:$usethreads" in
13618         ":define")      d_getprotobyname_r_proto=define
13619                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13620                 eval $hasproto ;;
13621         *)      ;;
13622         esac
13623         case "$d_getprotobyname_r_proto" in
13624         define)
13625         case "$getprotobyname_r_proto" in
13626         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13627         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13628         esac
13629         case "$getprotobyname_r_proto" in
13630         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13632         esac
13633         case "$getprotobyname_r_proto" in
13634         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13635         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13636         esac
13637         case "$getprotobyname_r_proto" in
13638         ''|0)   d_getprotobyname_r=undef
13639                 getprotobyname_r_proto=0
13640                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getprotobyname_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getprotobyname_r=undef
13652                 getprotobyname_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getprotobyname_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if getprotobynumber_r exists
13661 set getprotobynumber_r d_getprotobynumber_r
13662 eval $inlibc
13663 case "$d_getprotobynumber_r" in
13664 "$define")
13665         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13666         case "$d_getprotobynumber_r_proto:$usethreads" in
13667         ":define")      d_getprotobynumber_r_proto=define
13668                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13669                 eval $hasproto ;;
13670         *)      ;;
13671         esac
13672         case "$d_getprotobynumber_r_proto" in
13673         define)
13674         case "$getprotobynumber_r_proto" in
13675         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13676         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13677         esac
13678         case "$getprotobynumber_r_proto" in
13679         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13680         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13681         esac
13682         case "$getprotobynumber_r_proto" in
13683         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13684         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13685         esac
13686         case "$getprotobynumber_r_proto" in
13687         ''|0)   d_getprotobynumber_r=undef
13688                 getprotobynumber_r_proto=0
13689                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13690         * )     case "$getprotobynumber_r_proto" in
13691                 REENTRANT_PROTO*) ;;
13692                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13693                 esac
13694                 echo "Prototype: $try" ;;
13695         esac
13696         ;;
13697         *)      case "$usethreads" in
13698                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13699                 esac
13700                 d_getprotobynumber_r=undef
13701                 getprotobynumber_r_proto=0
13702                 ;;
13703         esac
13704         ;;
13705 *)      getprotobynumber_r_proto=0
13706         ;;
13707 esac
13708
13709 : see if getprotoent_r exists
13710 set getprotoent_r d_getprotoent_r
13711 eval $inlibc
13712 case "$d_getprotoent_r" in
13713 "$define")
13714         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13715         case "$d_getprotoent_r_proto:$usethreads" in
13716         ":define")      d_getprotoent_r_proto=define
13717                 set d_getprotoent_r_proto getprotoent_r $hdrs
13718                 eval $hasproto ;;
13719         *)      ;;
13720         esac
13721         case "$d_getprotoent_r_proto" in
13722         define)
13723         case "$getprotoent_r_proto" in
13724         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13725         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13726         esac
13727         case "$getprotoent_r_proto" in
13728         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13729         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13730         esac
13731         case "$getprotoent_r_proto" in
13732         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13733         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13734         esac
13735         case "$getprotoent_r_proto" in
13736         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13737         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13738         esac
13739         case "$getprotoent_r_proto" in
13740         ''|0)   d_getprotoent_r=undef
13741                 getprotoent_r_proto=0
13742                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13743         * )     case "$getprotoent_r_proto" in
13744                 REENTRANT_PROTO*) ;;
13745                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13746                 esac
13747                 echo "Prototype: $try" ;;
13748         esac
13749         ;;
13750         *)      case "$usethreads" in
13751                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13752                 esac
13753                 d_getprotoent_r=undef
13754                 getprotoent_r_proto=0
13755                 ;;
13756         esac
13757         ;;
13758 *)      getprotoent_r_proto=0
13759         ;;
13760 esac
13761
13762 : see if prototypes for various getprotoxxx netdb.h functions are available
13763 echo " "
13764 set d_getprotoprotos getprotoent $i_netdb netdb.h
13765 eval $hasproto
13766
13767 : see if getprpwnam exists
13768 set getprpwnam d_getprpwnam
13769 eval $inlibc
13770
13771 : see if getpwent exists
13772 set getpwent d_getpwent
13773 eval $inlibc
13774
13775 : see if getpwent_r exists
13776 set getpwent_r d_getpwent_r
13777 eval $inlibc
13778 case "$d_getpwent_r" in
13779 "$define")
13780         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13781         case "$d_getpwent_r_proto:$usethreads" in
13782         ":define")      d_getpwent_r_proto=define
13783                 set d_getpwent_r_proto getpwent_r $hdrs
13784                 eval $hasproto ;;
13785         *)      ;;
13786         esac
13787         case "$d_getpwent_r_proto" in
13788         define)
13789         case "$getpwent_r_proto" in
13790         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13791         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13792         esac
13793         case "$getpwent_r_proto" in
13794         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13795         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13796         esac
13797         case "$getpwent_r_proto" in
13798         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13799         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13800         esac
13801         case "$getpwent_r_proto" in
13802         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13803         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13804         esac
13805         case "$getpwent_r_proto" in
13806         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13807         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13808         esac
13809         case "$getpwent_r_proto" in
13810         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13811         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13812         esac
13813         case "$getpwent_r_proto" in
13814         ''|0)   d_getpwent_r=undef
13815                 getpwent_r_proto=0
13816                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13817         * )     case "$getpwent_r_proto" in
13818                 REENTRANT_PROTO*) ;;
13819                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13820                 esac
13821                 echo "Prototype: $try" ;;
13822         esac
13823         ;;
13824         *)      case "$usethreads" in
13825                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13826                 esac
13827                 d_getpwent_r=undef
13828                 getpwent_r_proto=0
13829                 ;;
13830         esac
13831         ;;
13832 *)      getpwent_r_proto=0
13833         ;;
13834 esac
13835
13836 : see if getpwnam_r exists
13837 set getpwnam_r d_getpwnam_r
13838 eval $inlibc
13839 case "$d_getpwnam_r" in
13840 "$define")
13841         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13842         case "$d_getpwnam_r_proto:$usethreads" in
13843         ":define")      d_getpwnam_r_proto=define
13844                 set d_getpwnam_r_proto getpwnam_r $hdrs
13845                 eval $hasproto ;;
13846         *)      ;;
13847         esac
13848         case "$d_getpwnam_r_proto" in
13849         define)
13850         case "$getpwnam_r_proto" in
13851         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13852         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13853         esac
13854         case "$getpwnam_r_proto" in
13855         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13856         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13857         esac
13858         case "$getpwnam_r_proto" in
13859         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13860         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13861         esac
13862         case "$getpwnam_r_proto" in
13863         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13864         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13865         esac
13866         case "$getpwnam_r_proto" in
13867         ''|0)   d_getpwnam_r=undef
13868                 getpwnam_r_proto=0
13869                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13870         * )     case "$getpwnam_r_proto" in
13871                 REENTRANT_PROTO*) ;;
13872                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13873                 esac
13874                 echo "Prototype: $try" ;;
13875         esac
13876         ;;
13877         *)      case "$usethreads" in
13878                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13879                 esac
13880                 d_getpwnam_r=undef
13881                 getpwnam_r_proto=0
13882                 ;;
13883         esac
13884         ;;
13885 *)      getpwnam_r_proto=0
13886         ;;
13887 esac
13888
13889 : see if getpwuid_r exists
13890 set getpwuid_r d_getpwuid_r
13891 eval $inlibc
13892 case "$d_getpwuid_r" in
13893 "$define")
13894         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13895         case "$d_getpwuid_r_proto:$usethreads" in
13896         ":define")      d_getpwuid_r_proto=define
13897                 set d_getpwuid_r_proto getpwuid_r $hdrs
13898                 eval $hasproto ;;
13899         *)      ;;
13900         esac
13901         case "$d_getpwuid_r_proto" in
13902         define)
13903         case "$getpwuid_r_proto" in
13904         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13905         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13906         esac
13907         case "$getpwuid_r_proto" in
13908         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13909         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13910         esac
13911         case "$getpwuid_r_proto" in
13912         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13913         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13914         esac
13915         case "$getpwuid_r_proto" in
13916         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13917         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13918         esac
13919         case "$getpwuid_r_proto" in
13920         ''|0)   d_getpwuid_r=undef
13921                 getpwuid_r_proto=0
13922                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13923         * )     case "$getpwuid_r_proto" in
13924                 REENTRANT_PROTO*) ;;
13925                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13926                 esac
13927                 echo "Prototype: $try" ;;
13928         esac
13929         ;;
13930         *)      case "$usethreads" in
13931                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13932                 esac
13933                 d_getpwuid_r=undef
13934                 getpwuid_r_proto=0
13935                 ;;
13936         esac
13937         ;;
13938 *)      getpwuid_r_proto=0
13939         ;;
13940 esac
13941
13942
13943 : see if getservbyname exists
13944 set getservbyname d_getsbyname
13945 eval $inlibc
13946
13947 : see if getservbyport exists
13948 set getservbyport d_getsbyport
13949 eval $inlibc
13950
13951 : see if getservent exists
13952 set getservent d_getsent
13953 eval $inlibc
13954
13955 : see if getservbyname_r exists
13956 set getservbyname_r d_getservbyname_r
13957 eval $inlibc
13958 case "$d_getservbyname_r" in
13959 "$define")
13960         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13961         case "$d_getservbyname_r_proto:$usethreads" in
13962         ":define")      d_getservbyname_r_proto=define
13963                 set d_getservbyname_r_proto getservbyname_r $hdrs
13964                 eval $hasproto ;;
13965         *)      ;;
13966         esac
13967         case "$d_getservbyname_r_proto" in
13968         define)
13969         case "$getservbyname_r_proto" in
13970         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13971         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13972         esac
13973         case "$getservbyname_r_proto" in
13974         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13975         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13976         esac
13977         case "$getservbyname_r_proto" in
13978         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13979         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13980         esac
13981         case "$getservbyname_r_proto" in
13982         ''|0)   d_getservbyname_r=undef
13983                 getservbyname_r_proto=0
13984                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13985         * )     case "$getservbyname_r_proto" in
13986                 REENTRANT_PROTO*) ;;
13987                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13988                 esac
13989                 echo "Prototype: $try" ;;
13990         esac
13991         ;;
13992         *)      case "$usethreads" in
13993                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13994                 esac
13995                 d_getservbyname_r=undef
13996                 getservbyname_r_proto=0
13997                 ;;
13998         esac
13999         ;;
14000 *)      getservbyname_r_proto=0
14001         ;;
14002 esac
14003
14004 : see if getservbyport_r exists
14005 set getservbyport_r d_getservbyport_r
14006 eval $inlibc
14007 case "$d_getservbyport_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14010         case "$d_getservbyport_r_proto:$usethreads" in
14011         ":define")      d_getservbyport_r_proto=define
14012                 set d_getservbyport_r_proto getservbyport_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_getservbyport_r_proto" in
14017         define)
14018         case "$getservbyport_r_proto" in
14019         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14020         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14021         esac
14022         case "$getservbyport_r_proto" in
14023         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14024         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14025         esac
14026         case "$getservbyport_r_proto" in
14027         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14028         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14029         esac
14030         case "$getservbyport_r_proto" in
14031         ''|0)   d_getservbyport_r=undef
14032                 getservbyport_r_proto=0
14033                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14034         * )     case "$getservbyport_r_proto" in
14035                 REENTRANT_PROTO*) ;;
14036                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14037                 esac
14038                 echo "Prototype: $try" ;;
14039         esac
14040         ;;
14041         *)      case "$usethreads" in
14042                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14043                 esac
14044                 d_getservbyport_r=undef
14045                 getservbyport_r_proto=0
14046                 ;;
14047         esac
14048         ;;
14049 *)      getservbyport_r_proto=0
14050         ;;
14051 esac
14052
14053 : see if getservent_r exists
14054 set getservent_r d_getservent_r
14055 eval $inlibc
14056 case "$d_getservent_r" in
14057 "$define")
14058         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14059         case "$d_getservent_r_proto:$usethreads" in
14060         ":define")      d_getservent_r_proto=define
14061                 set d_getservent_r_proto getservent_r $hdrs
14062                 eval $hasproto ;;
14063         *)      ;;
14064         esac
14065         case "$d_getservent_r_proto" in
14066         define)
14067         case "$getservent_r_proto" in
14068         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14069         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14070         esac
14071         case "$getservent_r_proto" in
14072         ''|0) try='int getservent_r(struct servent*, char*, int);'
14073         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14074         esac
14075         case "$getservent_r_proto" in
14076         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14077         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14078         esac
14079         case "$getservent_r_proto" in
14080         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14081         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14082         esac
14083         case "$getservent_r_proto" in
14084         ''|0)   d_getservent_r=undef
14085                 getservent_r_proto=0
14086                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14087         * )     case "$getservent_r_proto" in
14088                 REENTRANT_PROTO*) ;;
14089                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14090                 esac
14091                 echo "Prototype: $try" ;;
14092         esac
14093         ;;
14094         *)      case "$usethreads" in
14095                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14096                 esac
14097                 d_getservent_r=undef
14098                 getservent_r_proto=0
14099                 ;;
14100         esac
14101         ;;
14102 *)      getservent_r_proto=0
14103         ;;
14104 esac
14105
14106 : see if prototypes for various getservxxx netdb.h functions are available
14107 echo " "
14108 set d_getservprotos getservent $i_netdb netdb.h
14109 eval $hasproto
14110
14111 : see if getspnam exists
14112 set getspnam d_getspnam
14113 eval $inlibc
14114
14115 : see if this is a shadow.h system
14116 set shadow.h i_shadow
14117 eval $inhdr
14118
14119 : see if getspnam_r exists
14120 set getspnam_r d_getspnam_r
14121 eval $inlibc
14122 case "$d_getspnam_r" in
14123 "$define")
14124         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14125         case "$d_getspnam_r_proto:$usethreads" in
14126         ":define")      d_getspnam_r_proto=define
14127                 set d_getspnam_r_proto getspnam_r $hdrs
14128                 eval $hasproto ;;
14129         *)      ;;
14130         esac
14131         case "$d_getspnam_r_proto" in
14132         define)
14133         case "$getspnam_r_proto" in
14134         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14135         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14136         esac
14137         case "$getspnam_r_proto" in
14138         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14139         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14140         esac
14141         case "$getspnam_r_proto" in
14142         ''|0)   d_getspnam_r=undef
14143                 getspnam_r_proto=0
14144                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14145         * )     case "$getspnam_r_proto" in
14146                 REENTRANT_PROTO*) ;;
14147                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14148                 esac
14149                 echo "Prototype: $try" ;;
14150         esac
14151         ;;
14152         *)      case "$usethreads" in
14153                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14154                 esac
14155                 d_getspnam_r=undef
14156                 getspnam_r_proto=0
14157                 ;;
14158         esac
14159         ;;
14160 *)      getspnam_r_proto=0
14161         ;;
14162 esac
14163
14164 : see if gettimeofday or ftime exists
14165 set gettimeofday d_gettimeod
14166 eval $inlibc
14167 case "$d_gettimeod" in
14168 "$undef")
14169         set ftime d_ftime 
14170         eval $inlibc
14171         ;;
14172 *)
14173         val="$undef"; set d_ftime; eval $setvar
14174         ;;
14175 esac
14176 case "$d_gettimeod$d_ftime" in
14177 "$undef$undef")
14178         echo " "
14179         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14180         ;;
14181 esac
14182
14183 : see if gmtime_r exists
14184 set gmtime_r d_gmtime_r
14185 eval $inlibc
14186 case "$d_gmtime_r" in
14187 "$define")
14188         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14189         case "$d_gmtime_r_proto:$usethreads" in
14190         ":define")      d_gmtime_r_proto=define
14191                 set d_gmtime_r_proto gmtime_r $hdrs
14192                 eval $hasproto ;;
14193         *)      ;;
14194         esac
14195         case "$d_gmtime_r_proto" in
14196         define)
14197         case "$gmtime_r_proto" in
14198         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14199         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14200         esac
14201         case "$gmtime_r_proto" in
14202         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14203         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14204         esac
14205         case "$gmtime_r_proto" in
14206         ''|0)   d_gmtime_r=undef
14207                 gmtime_r_proto=0
14208                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14209         * )     case "$gmtime_r_proto" in
14210                 REENTRANT_PROTO*) ;;
14211                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14212                 esac
14213                 echo "Prototype: $try" ;;
14214         esac
14215         ;;
14216         *)      case "$usethreads" in
14217                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14218                 esac
14219                 d_gmtime_r=undef
14220                 gmtime_r_proto=0
14221                 ;;
14222         esac
14223         ;;
14224 *)      gmtime_r_proto=0
14225         ;;
14226 esac
14227
14228 : see if hasmntopt exists
14229 set hasmntopt d_hasmntopt
14230 eval $inlibc
14231
14232 : see if this is a netinet/in.h or sys/in.h system
14233 set netinet/in.h i_niin sys/in.h i_sysin
14234 eval $inhdr
14235
14236 : see if arpa/inet.h has to be included
14237 set arpa/inet.h i_arpainet
14238 eval $inhdr
14239
14240 : see if htonl --and friends-- exists
14241 val=''
14242 set htonl val
14243 eval $inlibc
14244
14245 : Maybe they are macros.
14246 case "$val" in
14247 $undef)
14248         $cat >htonl.c <<EOM
14249 #include <stdio.h>
14250 #include <sys/types.h>
14251 #$i_niin I_NETINET_IN
14252 #$i_sysin I_SYS_IN
14253 #$i_arpainet I_ARPA_INET
14254 #ifdef I_NETINET_IN
14255 #include <netinet/in.h>
14256 #endif
14257 #ifdef I_SYS_IN
14258 #include <sys/in.h>
14259 #endif
14260 #ifdef I_ARPA_INET
14261 #include <arpa/inet.h>
14262 #endif
14263 #ifdef htonl
14264 printf("Defined as a macro.");
14265 #endif
14266 EOM
14267         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14268         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14269                 val="$define"
14270                 echo "But it seems to be defined as a macro." >&4
14271         fi
14272         $rm -f htonl.?
14273         ;;
14274 esac
14275 set d_htonl
14276 eval $setvar
14277
14278 : see if ilogbl exists
14279 set ilogbl d_ilogbl
14280 eval $inlibc
14281
14282 : index or strchr
14283 echo " "
14284 if set index val -f; eval $csym; $val; then
14285         if set strchr val -f d_strchr; eval $csym; $val; then
14286                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14287                         val="$define"
14288                         vali="$undef"
14289                         echo "strchr() found." >&4
14290                 else
14291                         val="$undef"
14292                         vali="$define"
14293                         echo "index() found." >&4
14294                 fi
14295         else
14296                 val="$undef"
14297                 vali="$define"
14298                 echo "index() found." >&4
14299         fi
14300 else
14301         if set strchr val -f d_strchr; eval $csym; $val; then
14302                 val="$define"
14303                 vali="$undef"
14304                 echo "strchr() found." >&4
14305         else
14306                 echo "No index() or strchr() found!" >&4
14307                 val="$undef"
14308                 vali="$undef"
14309         fi
14310 fi
14311 set d_strchr; eval $setvar
14312 val="$vali"
14313 set d_index; eval $setvar
14314
14315 : check whether inet_aton exists
14316 set inet_aton d_inetaton
14317 eval $inlibc
14318
14319 : Look for isascii
14320 echo " "
14321 $cat >isascii.c <<EOCP
14322 #include <stdio.h>
14323 #include <ctype.h>
14324 #$i_stdlib I_STDLIB
14325 #ifdef I_STDLIB
14326 #include <stdlib.h>
14327 #endif
14328 int main() {
14329         int c = 'A';
14330         if (isascii(c))
14331                 exit(0);
14332         else
14333                 exit(1);
14334 }
14335 EOCP
14336 set isascii
14337 if eval $compile; then
14338         echo "isascii() found." >&4
14339         val="$define"
14340 else
14341         echo "isascii() NOT found." >&4
14342         val="$undef"
14343 fi
14344 set d_isascii
14345 eval $setvar
14346 $rm -f isascii*
14347
14348 : see if isfinite exists
14349 set isfinite d_isfinite
14350 eval $inlibc
14351
14352 : see if isinf exists
14353 set isinf d_isinf
14354 eval $inlibc
14355
14356 : see if isnan exists
14357 set isnan d_isnan
14358 eval $inlibc
14359
14360 : see if isnanl exists
14361 set isnanl d_isnanl
14362 eval $inlibc
14363
14364 : see if killpg exists
14365 set killpg d_killpg
14366 eval $inlibc
14367
14368 : see if lchown exists
14369 echo " "
14370 $cat > try.c <<'EOCP'
14371 /* System header to define __stub macros and hopefully few prototypes,
14372     which can conflict with char lchown(); below.  */
14373 #include <assert.h>
14374 /* Override any gcc2 internal prototype to avoid an error.  */
14375 /* We use char because int might match the return type of a gcc2
14376    builtin and then its argument prototype would still apply.  */
14377 char lchown();
14378 int main() {
14379     /*  The GNU C library defines this for functions which it implements
14380         to always fail with ENOSYS.  Some functions are actually named
14381         something starting with __ and the normal name is an alias.  */
14382 #if defined (__stub_lchown) || defined (__stub___lchown)
14383 choke me
14384 #else
14385 lchown();
14386 #endif
14387 ; return 0; }
14388 EOCP
14389 set try
14390 if eval $compile; then
14391     $echo "lchown() found." >&4
14392     val="$define"
14393 else
14394     $echo "lchown() NOT found." >&4
14395     val="$undef"
14396 fi
14397 set d_lchown
14398 eval $setvar
14399
14400 : See if number of significant digits in a double precision number is known
14401 echo " "
14402 $cat >ldbl_dig.c <<EOM
14403 #$i_limits I_LIMITS
14404 #$i_float I_FLOAT
14405 #ifdef I_LIMITS
14406 #include <limits.h>
14407 #endif
14408 #ifdef I_FLOAT
14409 #include <float.h>
14410 #endif
14411 #ifdef LDBL_DIG
14412 printf("Contains LDBL_DIG");
14413 #endif
14414 EOM
14415 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14416 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14417         echo "LDBL_DIG found." >&4
14418         val="$define"
14419 else
14420         echo "LDBL_DIG NOT found." >&4
14421         val="$undef"
14422 fi
14423 $rm -f ldbl_dig.?
14424 set d_ldbl_dig
14425 eval $setvar
14426
14427 : see if this is a math.h system
14428 set math.h i_math
14429 eval $inhdr
14430
14431 d_libm_lib_version="$undef"
14432 case $i_math in
14433     $define)
14434         : check to see if math.h defines _LIB_VERSION
14435         echo " "
14436         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14437         $cat >try.c <<EOCP
14438 #include <unistd.h>
14439 #include <math.h>
14440 int main (int argc, char *argv[])
14441 {
14442     printf ("%d\n", _LIB_VERSION);
14443     return (0);
14444     } /* main */
14445 EOCP
14446         set try
14447         if eval $compile; then
14448             foo=`$run ./try`
14449             echo "Yes, it does ($foo)" >&4
14450             d_libm_lib_version="$define"
14451         else
14452             echo "No, it does not (probably harmless)\n" >&4
14453             fi
14454         $rm -f try.* try core core.try.*
14455         ;;
14456
14457     esac
14458
14459 : see if link exists
14460 set link d_link
14461 eval $inlibc
14462
14463 : see if localtime_r exists
14464 set localtime_r d_localtime_r
14465 eval $inlibc
14466 case "$d_localtime_r" in
14467 "$define")
14468         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14469         case "$d_localtime_r_proto:$usethreads" in
14470         ":define")      d_localtime_r_proto=define
14471                 set d_localtime_r_proto localtime_r $hdrs
14472                 eval $hasproto ;;
14473         *)      ;;
14474         esac
14475         case "$d_localtime_r_proto" in
14476         define)
14477         case "$localtime_r_proto" in
14478         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14479         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14480         esac
14481         case "$localtime_r_proto" in
14482         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14483         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14484         esac
14485         case "$localtime_r_proto" in
14486         ''|0)   d_localtime_r=undef
14487                 localtime_r_proto=0
14488                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14489         * )     case "$localtime_r_proto" in
14490                 REENTRANT_PROTO*) ;;
14491                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14492                 esac
14493                 echo "Prototype: $try" ;;
14494         esac
14495         ;;
14496         *)      case "$usethreads" in
14497                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14498                 esac
14499                 d_localtime_r=undef
14500                 localtime_r_proto=0
14501                 ;;
14502         esac
14503         ;;
14504 *)      localtime_r_proto=0
14505         ;;
14506 esac
14507
14508 : see if localeconv exists
14509 set localeconv d_locconv
14510 eval $inlibc
14511
14512 : see if lockf exists
14513 set lockf d_lockf
14514 eval $inlibc
14515
14516 : see if prototype for lseek is available
14517 echo " "
14518 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14519 eval $hasproto
14520
14521 : see if lstat exists
14522 set lstat d_lstat
14523 eval $inlibc
14524
14525 : see if madvise exists
14526 set madvise d_madvise
14527 eval $inlibc
14528
14529 : see if malloc_size exists
14530 set malloc_size d_malloc_size
14531 eval $inlibc
14532
14533 : see if malloc_size_good exists
14534 set malloc_good_size d_malloc_good_size
14535 eval $inlibc
14536
14537 : see if mblen exists
14538 set mblen d_mblen
14539 eval $inlibc
14540
14541 : see if mbstowcs exists
14542 set mbstowcs d_mbstowcs
14543 eval $inlibc
14544
14545 : see if mbtowc exists
14546 set mbtowc d_mbtowc
14547 eval $inlibc
14548
14549 : see if memchr exists
14550 set memchr d_memchr
14551 eval $inlibc
14552
14553 : see if memcmp exists
14554 set memcmp d_memcmp
14555 eval $inlibc
14556
14557 : see if memcpy exists
14558 set memcpy d_memcpy
14559 eval $inlibc
14560
14561 : see if memmove exists
14562 set memmove d_memmove
14563 eval $inlibc
14564
14565 : see if memset exists
14566 set memset d_memset
14567 eval $inlibc
14568
14569 : see if mkdir exists
14570 set mkdir d_mkdir
14571 eval $inlibc
14572
14573 : see if mkdtemp exists
14574 set mkdtemp d_mkdtemp
14575 eval $inlibc
14576
14577 : see if mkfifo exists
14578 set mkfifo d_mkfifo
14579 eval $inlibc
14580
14581 : see if mkstemp exists
14582 set mkstemp d_mkstemp
14583 eval $inlibc
14584
14585 : see if mkstemps exists
14586 set mkstemps d_mkstemps
14587 eval $inlibc
14588
14589 : see if mktime exists
14590 set mktime d_mktime
14591 eval $inlibc
14592
14593 : see if this is a sys/mman.h system
14594 set sys/mman.h i_sysmman
14595 eval $inhdr
14596
14597 : see if mmap exists
14598 set mmap d_mmap
14599 eval $inlibc
14600 : see what shmat returns
14601 : default to something harmless
14602 mmaptype='void *'
14603 case "$i_sysmman$d_mmap" in
14604 "$define$define")
14605         $cat >mmap.c <<'END'
14606 #include <sys/mman.h>
14607 void *mmap();
14608 END
14609         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14610                 mmaptype='void *'
14611         else
14612                 mmaptype='caddr_t'
14613         fi
14614         echo "and it returns ($mmaptype)." >&4
14615         ;;
14616 esac
14617
14618
14619
14620 : see if sqrtl exists
14621 set sqrtl d_sqrtl
14622 eval $inlibc
14623
14624 : see if scalbnl exists
14625 set scalbnl d_scalbnl
14626 eval $inlibc
14627
14628 : see if modfl exists
14629 set modfl d_modfl
14630 eval $inlibc
14631
14632 : see if prototype for modfl is available
14633 echo " "
14634 set d_modflproto modfl $i_math math.h
14635 eval $hasproto
14636
14637 d_modfl_pow32_bug="$undef"
14638
14639 case "$d_longdbl$d_modfl" in
14640 $define$define)
14641         $cat <<EOM
14642 Checking to see whether your modfl() is okay for large values...
14643 EOM
14644 $cat >try.c <<EOCP
14645 #include <math.h> 
14646 #include <stdio.h>
14647 EOCP
14648 if $test "X$d_modflproto" != "X$define"; then
14649         $cat >>try.c <<EOCP
14650 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14651 long double modfl (long double, long double *);
14652 EOCP
14653 fi
14654 $cat >>try.c <<EOCP
14655 int main() {
14656     long double nv = 4294967303.15;
14657     long double v, w;
14658     v = modfl(nv, &w);         
14659 #ifdef __GLIBC__
14660     printf("glibc");
14661 #endif
14662     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14663     return 0;
14664 }
14665 EOCP
14666         case "$osname:$gccversion" in
14667         aix:)   saveccflags="$ccflags"
14668                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14669         esac
14670         set try
14671         if eval $compile; then
14672                 foo=`$run ./try`
14673                 case "$foo" in
14674                 *" 4294967303.150000 1.150000 4294967302.000000")
14675                         echo >&4 "Your modfl() is broken for large values."
14676                         d_modfl_pow32_bug="$define"
14677                         case "$foo" in
14678                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14679                         ;;
14680                         esac
14681                         ;;
14682                 *" 4294967303.150000 0.150000 4294967303.000000")
14683                         echo >&4 "Your modfl() seems okay for large values."
14684                         ;;
14685                 *)      echo >&4 "I don't understand your modfl() at all."
14686                         d_modfl="$undef"
14687                         ;;
14688                 esac
14689                 $rm -f try.* try core core.try.*
14690         else
14691                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14692                 d_modfl="$undef"
14693         fi
14694         case "$osname:$gccversion" in
14695         aix:)   ccflags="$saveccflags" ;; # restore
14696         esac
14697         ;;
14698 esac
14699
14700 if $test "$uselongdouble" = "$define"; then
14701     message=""
14702     if $test "$d_sqrtl" != "$define"; then
14703         message="$message sqrtl"
14704     fi
14705     if $test "$d_modfl" != "$define"; then
14706         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14707             echo "You have both aintl and copysignl, so I can emulate modfl."
14708         else
14709             message="$message modfl"
14710         fi
14711     fi
14712     if $test "$d_frexpl" != "$define"; then
14713         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14714             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14715         else
14716             message="$message frexpl"
14717         fi
14718     fi
14719
14720     if $test "$message" != ""; then
14721         $cat <<EOM >&4
14722
14723 *** You requested the use of long doubles but you do not seem to have
14724 *** the following mathematical functions needed for long double support:
14725 ***    $message
14726 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14727 *** Cannot continue, aborting.
14728
14729 EOM
14730
14731         exit 1
14732     fi
14733 fi
14734
14735 : see if mprotect exists
14736 set mprotect d_mprotect
14737 eval $inlibc
14738
14739 : see if msgctl exists
14740 set msgctl d_msgctl
14741 eval $inlibc
14742
14743 : see if msgget exists
14744 set msgget d_msgget
14745 eval $inlibc
14746
14747 : see if msgsnd exists
14748 set msgsnd d_msgsnd
14749 eval $inlibc
14750
14751 : see if msgrcv exists
14752 set msgrcv d_msgrcv
14753 eval $inlibc
14754
14755 : see how much of the 'msg*(2)' library is present.
14756 h_msg=true
14757 echo " "
14758 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14759 *"$undef"*) h_msg=false;;
14760 esac
14761 case "$osname" in
14762 freebsd)
14763     case "`ipcs 2>&1`" in
14764     "SVID messages"*"not configured"*)
14765         echo "Your $osname does not have the msg*(2) configured." >&4
14766         h_msg=false
14767         val="$undef"
14768         set msgctl d_msgctl
14769         eval $setvar
14770         set msgget d_msgget
14771         eval $setvar
14772         set msgsnd d_msgsnd
14773         eval $setvar
14774         set msgrcv d_msgrcv
14775         eval $setvar
14776         ;;
14777     esac
14778     ;;
14779 esac
14780 : we could also check for sys/ipc.h ...
14781 if $h_msg && $test `./findhdr sys/msg.h`; then
14782         echo "You have the full msg*(2) library." >&4
14783         val="$define"
14784 else
14785         echo "You don't have the full msg*(2) library." >&4
14786         val="$undef"
14787 fi
14788 set d_msg
14789 eval $setvar
14790
14791
14792 echo " "
14793 echo "Checking to see if your system supports struct msghdr..." >&4
14794 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14795 eval $hasstruct
14796 case "$d_msghdr_s" in
14797 "$define")      echo "Yes, it does."   ;;
14798 *)              echo "No, it doesn't." ;;
14799 esac
14800
14801
14802 : see if msync exists
14803 set msync d_msync
14804 eval $inlibc
14805
14806 : see if munmap exists
14807 set munmap d_munmap
14808 eval $inlibc
14809
14810 : see if nice exists
14811 set nice d_nice
14812 eval $inlibc
14813
14814 : see if this is a langinfo.h system
14815 set langinfo.h i_langinfo
14816 eval $inhdr
14817
14818 : see if nl_langinfo exists
14819 set nl_langinfo d_nl_langinfo
14820 eval $inlibc
14821
14822 : check for length of character
14823 echo " "
14824 case "$charsize" in
14825 '')
14826         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14827         $cat >try.c <<EOCP
14828 #include <stdio.h>
14829 #$i_stdlib I_STDLIB
14830 #ifdef I_STDLIB
14831 #include <stdlib.h>
14832 #endif
14833 int main()
14834 {
14835     printf("%d\n", (int)sizeof(char));
14836     exit(0);
14837 }
14838 EOCP
14839         set try
14840         if eval $compile_ok; then
14841                 dflt=`$run ./try`
14842         else
14843                 dflt='1'
14844                 echo "(I can't seem to compile the test program.  Guessing...)"
14845         fi
14846         ;;
14847 *)
14848         dflt="$charsize"
14849         ;;
14850 esac
14851 rp="What is the size of a character (in bytes)?"
14852 . ./myread
14853 charsize="$ans"
14854 $rm -f try.c try
14855
14856 : check for volatile keyword
14857 echo " "
14858 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14859 $cat >try.c <<'EOCP'
14860 int main()
14861 {
14862         typedef struct _goo_struct goo_struct;
14863         goo_struct * volatile goo = ((goo_struct *)0);
14864         struct _goo_struct {
14865                 long long_int;
14866                 int reg_int;
14867                 char char_var;
14868         };
14869         typedef unsigned short foo_t;
14870         char *volatile foo;
14871         volatile int bar;
14872         volatile foo_t blech;
14873         foo = foo;
14874 }
14875 EOCP
14876 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14877         val="$define"
14878         echo "Yup, it does."
14879 else
14880         val="$undef"
14881         echo "Nope, it doesn't."
14882 fi
14883 set d_volatile
14884 eval $setvar
14885 $rm -f try.*
14886
14887
14888 echo " "
14889 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14890
14891 case "$use64bitint:$d_quad:$quadtype" in
14892 define:define:?*)
14893         ivtype="$quadtype"
14894         uvtype="$uquadtype"
14895         ivsize=8
14896         uvsize=8
14897         ;;
14898 *)      ivtype="long"
14899         uvtype="unsigned long"
14900         ivsize=$longsize
14901         uvsize=$longsize
14902         ;;
14903 esac
14904
14905 case "$uselongdouble:$d_longdbl" in
14906 define:define)
14907         nvtype="long double"
14908         nvsize=$longdblsize
14909         ;;
14910 *)      nvtype=double
14911         nvsize=$doublesize
14912         ;;
14913 esac
14914
14915 $echo "(IV will be "$ivtype", $ivsize bytes)"
14916 $echo "(UV will be "$uvtype", $uvsize bytes)"
14917 $echo "(NV will be "$nvtype", $nvsize bytes)"
14918
14919 $cat >try.c <<EOCP
14920 #$i_inttypes I_INTTYPES
14921 #ifdef I_INTTYPES
14922 #include <inttypes.h>
14923 #endif
14924 #include <stdio.h>
14925 int main() {
14926 #ifdef INT8
14927    int8_t i =  INT8_MAX;
14928   uint8_t u = UINT8_MAX;
14929   printf("int8_t\n");
14930 #endif
14931 #ifdef INT16
14932    int16_t i =  INT16_MAX;
14933   uint16_t i = UINT16_MAX;
14934   printf("int16_t\n");
14935 #endif
14936 #ifdef INT32
14937    int32_t i =  INT32_MAX;
14938   uint32_t u = UINT32_MAX;
14939   printf("int32_t\n");
14940 #endif
14941 }
14942 EOCP
14943
14944 case "$i8type" in
14945 '')     case "$charsize" in
14946         1)      i8type=char
14947                 u8type="unsigned char"
14948                 i8size=$charsize
14949                 u8size=$charsize
14950                 ;;
14951         esac
14952         ;;
14953 esac
14954 case "$i8type" in
14955 '')     set try -DINT8
14956         if eval $compile; then
14957                 case "`$run ./try`" in
14958                 int8_t) i8type=int8_t
14959                         u8type=uint8_t
14960                         i8size=1
14961                         u8size=1
14962                         ;;
14963                 esac
14964         fi
14965         ;;
14966 esac
14967 case "$i8type" in
14968 '')     if $test $charsize -ge 1; then
14969                 i8type=char
14970                 u8type="unsigned char"
14971                 i8size=$charsize
14972                 u8size=$charsize
14973         fi
14974         ;;
14975 esac
14976
14977 case "$i16type" in
14978 '')     case "$shortsize" in
14979         2)      i16type=short
14980                 u16type="unsigned short"
14981                 i16size=$shortsize
14982                 u16size=$shortsize
14983                 ;;
14984         esac
14985         ;;
14986 esac
14987 case "$i16type" in
14988 '')     set try -DINT16
14989         if eval $compile; then
14990                 case "`$run ./try`" in
14991                 int16_t)
14992                         i16type=int16_t
14993                         u16type=uint16_t
14994                         i16size=2
14995                         u16size=2
14996                         ;;
14997                 esac
14998         fi
14999         ;;
15000 esac
15001 case "$i16type" in
15002 '')     if $test $shortsize -ge 2; then
15003                 i16type=short
15004                 u16type="unsigned short"
15005                 i16size=$shortsize
15006                 u16size=$shortsize
15007         fi
15008         ;;
15009 esac
15010
15011 case "$i32type" in
15012 '')     case "$longsize" in
15013         4)      i32type=long
15014                 u32type="unsigned long"
15015                 i32size=$longsize
15016                 u32size=$longsize
15017                 ;;
15018         *)      case "$intsize" in
15019                 4)      i32type=int
15020                         u32type="unsigned int"
15021                         i32size=$intsize
15022                         u32size=$intsize
15023                         ;;
15024                 esac
15025                 ;;
15026         esac
15027         ;;
15028 esac
15029 case "$i32type" in
15030 '')     set try -DINT32
15031         if eval $compile; then
15032                 case "`$run ./try`" in
15033                 int32_t)
15034                         i32type=int32_t
15035                         u32type=uint32_t
15036                         i32size=4
15037                         u32size=4
15038                         ;;
15039                 esac
15040         fi
15041         ;;
15042 esac
15043 case "$i32type" in
15044 '')     if $test $intsize -ge 4; then
15045                 i32type=int
15046                 u32type="unsigned int"
15047                 i32size=$intsize
15048                 u32size=$intsize
15049         fi
15050         ;;
15051 esac
15052
15053 case "$i64type" in
15054 '')     case "$d_quad:$quadtype" in
15055         define:?*)
15056                 i64type="$quadtype"
15057                 u64type="$uquadtype"
15058                 i64size=8
15059                 u64size=8
15060                 ;;
15061         esac
15062         ;;
15063 esac
15064
15065 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15066 : volatile so that the compiler has to store it out to memory.
15067 if test X"$d_volatile" = X"$define"; then
15068         volatile=volatile
15069 fi
15070 $cat <<EOP >try.c
15071 #include <stdio.h>
15072 #$i_stdlib I_STDLIB
15073 #ifdef I_STDLIB
15074 #include <stdlib.h>
15075 #endif
15076 #include <sys/types.h>
15077 #include <signal.h>
15078 #ifdef SIGFPE
15079 $volatile int bletched = 0;
15080 $signal_t blech(int s) { bletched = 1; }
15081 #endif
15082 int main() {
15083     $uvtype u = 0;
15084     $nvtype d;
15085     int     n = 8 * $uvsize;
15086     int     i;
15087 #ifdef SIGFPE
15088     signal(SIGFPE, blech);
15089 #endif
15090
15091     for (i = 0; i < n; i++) {
15092       u = u << 1 | ($uvtype)1;
15093       d = ($nvtype)u;
15094       if (($uvtype)d != u)
15095         break;
15096       if (d <= 0)
15097         break;
15098       d = ($nvtype)(u - 1);
15099       if (($uvtype)d != (u - 1))
15100         break;
15101 #ifdef SIGFPE
15102       if (bletched) {
15103         break;
15104 #endif
15105       } 
15106     }
15107     printf("%d\n", ((i == n) ? -n : i));
15108     exit(0);
15109 }
15110 EOP
15111 set try
15112
15113 d_nv_preserves_uv="$undef"
15114 if eval $compile; then
15115         nv_preserves_uv_bits="`$run ./try`"
15116 fi
15117 case "$nv_preserves_uv_bits" in
15118 \-[1-9]*)       
15119         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15120         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15121         d_nv_preserves_uv="$define"
15122         ;;
15123 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15124         d_nv_preserves_uv="$undef" ;;
15125 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15126         nv_preserves_uv_bits="$undef" ;;
15127 esac
15128
15129 $rm -f try.* try
15130
15131 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15132 : volatile so that the compiler has to store it out to memory.
15133 if test X"$d_volatile" = X"$define"; then
15134         volatile=volatile
15135 fi
15136 $cat <<EOP >try.c
15137 #include <stdio.h>
15138 #$i_stdlib I_STDLIB
15139 #ifdef I_STDLIB
15140 #include <stdlib.h>
15141 #endif
15142 #$i_string I_STRING
15143 #ifdef I_STRING
15144 #  include <string.h>
15145 #else
15146 #  include <strings.h>
15147 #endif
15148 #include <sys/types.h>
15149 #include <signal.h>
15150 #ifdef SIGFPE
15151 $volatile int bletched = 0;
15152 $signal_t blech(int s) { bletched = 1; }
15153 #endif
15154
15155 int checkit($nvtype d, char *where) {
15156     unsigned char *p = (char *)&d;
15157     unsigned char *end = p + sizeof(d);
15158     int fail = 0;
15159
15160     while (p < end)
15161         fail += *p++;
15162
15163     if (!fail)
15164         return 0;
15165
15166     p = (char *)&d;
15167     printf("No - %s: 0x", where);
15168     while (p < end)
15169         printf ("%02X", *p++);
15170     printf("\n");
15171     return 1;
15172 }
15173
15174 int main(int argc, char **argv) {
15175     $nvtype d = 0.0;
15176     int fail = 0;
15177     fail += checkit(d, "0.0");
15178
15179     /* The compiler shouldn't be assuming that bletched is 0  */
15180     d = bletched;
15181
15182     fail += checkit(d, "bleched");
15183
15184 #ifdef SIGFPE
15185     signal(SIGFPE, blech);
15186 #endif
15187
15188     /* Paranoia - the compiler should have no way of knowing that ANSI says
15189        that argv[argc] will always be NULL.  Actually, if it did assume this it
15190        would be buggy, as this is C and main() can be called from elsewhere in
15191        the program.  */
15192     d = argv[argc] ? 1 : 0;
15193
15194     if (d) {
15195         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15196     }
15197
15198     fail += checkit(d, "ternary");
15199
15200     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15201
15202     if (d != 0.0) {
15203         printf("No - memset doesn't give 0.0\n");
15204         /* This might just blow up:  */
15205         printf("(gives %g)\n", d);
15206         return 1;
15207     }
15208     
15209 #ifdef SIGFPE
15210     if (bletched) {
15211         printf("No - something bleched\n");
15212         return 1;
15213     }
15214 #endif
15215     if (fail) {
15216       printf("No - %d fail(s)\n", fail);
15217       return 1;
15218     }
15219     printf("Yes\n");
15220     return 0;
15221 }
15222 EOP
15223 set try
15224
15225 d_nv_zero_is_allbits_zero="$undef"
15226 if eval $compile; then
15227     xxx="`$run ./try`"
15228     case "$?" in
15229         0)
15230             case "$xxx" in
15231                 Yes)  cat >&4 <<EOM
15232 0.0 is represented as all bits zero in memory
15233 EOM
15234                     d_nv_zero_is_allbits_zero="$define"
15235                     ;;
15236                 *)  cat >&4 <<EOM
15237 0.0 is not represented as all bits zero in memory
15238 EOM
15239                     d_nv_zero_is_allbits_zero="$undef"
15240                     ;;
15241             esac
15242             ;;
15243         *)  cat >&4 <<EOM
15244 0.0 is not represented as all bits zero in memory
15245 EOM
15246             d_nv_zero_is_allbits_zero="$undef"
15247             ;;
15248     esac
15249 fi
15250
15251 $rm -f try.* try
15252
15253
15254 : check for off64_t
15255 echo " "
15256 echo "Checking to see if you have off64_t..." >&4
15257 $cat >try.c <<EOCP
15258 #include <sys/types.h>
15259 #include <unistd.h>
15260 int main() { off64_t x = 7; }
15261 EOCP
15262 set try
15263 if eval $compile; then
15264         val="$define"
15265         echo "You have off64_t."
15266 else
15267         val="$undef"
15268         echo "You do not have off64_t."
15269         case "$lseeksize" in
15270         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15271         esac
15272 fi
15273 $rm -f try.* try
15274 set d_off64_t
15275 eval $setvar
15276
15277 : how to create joinable pthreads
15278 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15279         echo " "
15280         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15281         $cat >try.c <<'EOCP'
15282 #include <pthread.h>
15283 int main() {
15284     int detachstate = JOINABLE;
15285 }
15286 EOCP
15287         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15288         if eval $compile; then
15289                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15290                 val="$undef" # Yes, undef.
15291                 set d_old_pthread_create_joinable
15292                 eval $setvar
15293                 val=""
15294                 set old_pthread_create_joinable
15295                 eval $setvar
15296         else
15297                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15298                 if eval $compile; then
15299                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15300                         val="$define"
15301                         set d_old_pthread_create_joinable
15302                         eval $setvar
15303                         val=PTHREAD_CREATE_UNDETACHED
15304                         set old_pthread_create_joinable
15305                         eval $setvar
15306                 else            
15307                         set try -DJOINABLE=__UNDETACHED
15308                         if eval $compile; then
15309                                 echo "You seem to use __UNDETACHED." >&4
15310                                 val="$define"
15311                                 set d_old_pthread_create_joinable
15312                                 eval $setvar
15313                                 val=__UNDETACHED
15314                                 set old_pthread_create_joinable
15315                                 eval $setvar
15316                         else
15317                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15318                                 val="$define"
15319                                 set d_old_pthread_create_joinable
15320                                 eval $setvar
15321                                 val=0
15322                                 set old_pthread_create_joinable
15323                                 eval $setvar
15324                         fi
15325                 fi
15326         fi
15327         $rm -f try try.*
15328 else
15329     d_old_pthread_create_joinable="$undef"
15330     old_pthread_create_joinable=""
15331 fi
15332
15333 : see if pause exists
15334 set pause d_pause
15335 eval $inlibc
15336
15337 : see if pipe exists
15338 set pipe d_pipe
15339 eval $inlibc
15340
15341 : see if poll exists
15342 set poll d_poll
15343 eval $inlibc
15344
15345 : see if readlink exists
15346 set readlink d_readlink
15347 eval $inlibc
15348
15349 echo " "
15350 procselfexe=''
15351 val="$undef"
15352 case "$d_readlink" in
15353 "$define")
15354         if $issymlink /proc/self/exe ; then
15355                 $ls -l /proc/self/exe > reflect
15356                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15357                         echo "You have Linux-like /proc/self/exe."
15358                         procselfexe='"/proc/self/exe"'
15359                         val="$define"
15360                 fi
15361         fi
15362         if $issymlink /proc/curproc/file ; then
15363                 $ls -l /proc/curproc/file > reflect
15364                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15365                         echo "You have BSD-like /proc/curproc/file."
15366                         procselfexe='"/proc/curproc/file"'
15367                         val="$define"
15368                 fi
15369         fi
15370         ;;
15371 esac
15372 $rm -f reflect
15373 set d_procselfexe
15374 eval $setvar
15375
15376 : see whether the pthread_atfork exists
15377 $cat >try.c <<EOP
15378 #include <pthread.h>
15379 #include <stdio.h>
15380 int main() {
15381 #ifdef  PTHREAD_ATFORK
15382         pthread_atfork(NULL,NULL,NULL);
15383 #endif
15384 }
15385 EOP
15386
15387 : see if pthread_atfork exists
15388 set try -DPTHREAD_ATFORK
15389 if eval $compile; then
15390     val="$define"
15391 else
15392     val="$undef"
15393 fi
15394 case "$usethreads" in
15395 $define)
15396         case "$val" in
15397         $define) echo 'pthread_atfork found.' >&4        ;;
15398         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15399         esac
15400 esac
15401 set d_pthread_atfork
15402 eval $setvar
15403
15404 : see if pthread_attr_setscope exists
15405 set pthread_attr_setscope d_pthread_attr_setscope
15406 eval $inlibc
15407
15408
15409 : see whether the various POSIXish _yields exist
15410 $cat >try.c <<EOP
15411 #include <pthread.h>
15412 #include <stdio.h>
15413 int main() {
15414 #ifdef SCHED_YIELD
15415         sched_yield();
15416 #else
15417 #ifdef PTHREAD_YIELD
15418         pthread_yield();
15419 #else
15420 #ifdef PTHREAD_YIELD_NULL
15421         pthread_yield(NULL);
15422 #endif
15423 #endif
15424 #endif
15425 }
15426 EOP
15427 : see if sched_yield exists
15428 set try -DSCHED_YIELD
15429 if eval $compile; then
15430     val="$define"
15431     sched_yield='sched_yield()'
15432 else
15433     val="$undef"
15434 fi
15435 case "$usethreads" in
15436 $define)
15437         case "$val" in
15438         $define) echo 'sched_yield() found.' >&4        ;;
15439         *)       echo 'sched_yield() NOT found.' >&4    ;;
15440         esac
15441 esac
15442 set d_sched_yield
15443 eval $setvar
15444
15445 : see if pthread_yield exists
15446 set try -DPTHREAD_YIELD
15447 if eval $compile; then
15448     val="$define"
15449     case "$sched_yield" in
15450     '') sched_yield='pthread_yield()' ;;
15451     esac
15452 else
15453     set try -DPTHREAD_YIELD_NULL
15454     if eval $compile; then
15455         val="$define"
15456         case "$sched_yield" in
15457         '') sched_yield='pthread_yield(NULL)' ;;
15458         esac
15459     else
15460         val="$undef"
15461     fi
15462 fi
15463 case "$usethreads" in
15464 $define)
15465         case "$val" in
15466         $define) echo 'pthread_yield() found.' >&4      ;;
15467         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15468         esac
15469         ;;
15470 esac
15471 set d_pthread_yield
15472 eval $setvar
15473
15474 case "$sched_yield" in
15475 '') sched_yield=undef ;;
15476 esac
15477
15478 $rm -f try try.*
15479
15480 : see if random_r exists
15481 set random_r d_random_r
15482 eval $inlibc
15483 case "$d_random_r" in
15484 "$define")
15485         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15486         case "$d_random_r_proto:$usethreads" in
15487         ":define")      d_random_r_proto=define
15488                 set d_random_r_proto random_r $hdrs
15489                 eval $hasproto ;;
15490         *)      ;;
15491         esac
15492         case "$d_random_r_proto" in
15493         define)
15494         case "$random_r_proto" in
15495         ''|0) try='int random_r(int*, struct random_data*);'
15496         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15497         esac
15498         case "$random_r_proto" in
15499         ''|0) try='int random_r(long*, struct random_data*);'
15500         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15501         esac
15502         case "$random_r_proto" in
15503         ''|0) try='int random_r(struct random_data*, int32_t*);'
15504         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15505         esac
15506         case "$random_r_proto" in
15507         ''|0)   d_random_r=undef
15508                 random_r_proto=0
15509                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15510         * )     case "$random_r_proto" in
15511                 REENTRANT_PROTO*) ;;
15512                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15513                 esac
15514                 echo "Prototype: $try" ;;
15515         esac
15516         ;;
15517         *)      case "$usethreads" in
15518                 define) echo "random_r has no prototype, not using it." >&4 ;;
15519                 esac
15520                 d_random_r=undef
15521                 random_r_proto=0
15522                 ;;
15523         esac
15524         ;;
15525 *)      random_r_proto=0
15526         ;;
15527 esac
15528
15529 : see if readdir and friends exist
15530 set readdir d_readdir
15531 eval $inlibc
15532 set seekdir d_seekdir
15533 eval $inlibc
15534 set telldir d_telldir
15535 eval $inlibc
15536 set rewinddir d_rewinddir
15537 eval $inlibc
15538
15539 : see if readdir64_r exists
15540 set readdir64_r d_readdir64_r
15541 eval $inlibc
15542 case "$d_readdir64_r" in
15543 "$define")
15544         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15545         case "$d_readdir64_r_proto:$usethreads" in
15546         ":define")      d_readdir64_r_proto=define
15547                 set d_readdir64_r_proto readdir64_r $hdrs
15548                 eval $hasproto ;;
15549         *)      ;;
15550         esac
15551         case "$d_readdir64_r_proto" in
15552         define)
15553         case "$readdir64_r_proto" in
15554         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15555         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15556         esac
15557         case "$readdir64_r_proto" in
15558         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15559         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15560         esac
15561         case "$readdir64_r_proto" in
15562         ''|0)   d_readdir64_r=undef
15563                 readdir64_r_proto=0
15564                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15565         * )     case "$readdir64_r_proto" in
15566                 REENTRANT_PROTO*) ;;
15567                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15568                 esac
15569                 echo "Prototype: $try" ;;
15570         esac
15571         ;;
15572         *)      case "$usethreads" in
15573                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15574                 esac
15575                 d_readdir64_r=undef
15576                 readdir64_r_proto=0
15577                 ;;
15578         esac
15579         ;;
15580 *)      readdir64_r_proto=0
15581         ;;
15582 esac
15583
15584 : see if readdir_r exists
15585 set readdir_r d_readdir_r
15586 eval $inlibc
15587 case "$d_readdir_r" in
15588 "$define")
15589         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15590         case "$d_readdir_r_proto:$usethreads" in
15591         ":define")      d_readdir_r_proto=define
15592                 set d_readdir_r_proto readdir_r $hdrs
15593                 eval $hasproto ;;
15594         *)      ;;
15595         esac
15596         case "$d_readdir_r_proto" in
15597         define)
15598         case "$readdir_r_proto" in
15599         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15600         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15601         esac
15602         case "$readdir_r_proto" in
15603         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15604         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15605         esac
15606         case "$readdir_r_proto" in
15607         ''|0)   d_readdir_r=undef
15608                 readdir_r_proto=0
15609                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15610         * )     case "$readdir_r_proto" in
15611                 REENTRANT_PROTO*) ;;
15612                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15613                 esac
15614                 echo "Prototype: $try" ;;
15615         esac
15616         ;;
15617         *)      case "$usethreads" in
15618                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15619                 esac
15620                 d_readdir_r=undef
15621                 readdir_r_proto=0
15622                 ;;
15623         esac
15624         ;;
15625 *)      readdir_r_proto=0
15626         ;;
15627 esac
15628
15629 : see if readv exists
15630 set readv d_readv
15631 eval $inlibc
15632
15633 : see if recvmsg exists
15634 set recvmsg d_recvmsg
15635 eval $inlibc
15636
15637 : see if rename exists
15638 set rename d_rename
15639 eval $inlibc
15640
15641 : see if rmdir exists
15642 set rmdir d_rmdir
15643 eval $inlibc
15644
15645 : see if memory.h is available.
15646 val=''
15647 set memory.h val
15648 eval $inhdr
15649
15650 : See if it conflicts with string.h
15651 case "$val" in
15652 $define)
15653         case "$strings" in
15654         '') ;;
15655         *)
15656                 $cppstdin $cppflags $cppminus < $strings > mem.h
15657                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15658                         echo " "
15659                         echo "We won't be including <memory.h>."
15660                         val="$undef"
15661                 fi
15662                 $rm -f mem.h
15663                 ;;
15664         esac
15665 esac
15666 set i_memory
15667 eval $setvar
15668
15669 : can bcopy handle overlapping blocks?
15670 echo " "
15671 val="$undef"
15672 case "$d_memmove" in
15673 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15674 *)      case "$d_bcopy" in
15675         "$define")
15676                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15677                 $cat >try.c <<EOCP
15678 #$i_memory I_MEMORY
15679 #$i_stdlib I_STDLIB
15680 #$i_string I_STRING
15681 #$i_unistd I_UNISTD
15682 EOCP
15683         $cat >>try.c <<'EOCP'
15684 #include <stdio.h>
15685 #ifdef I_MEMORY
15686 #  include <memory.h>
15687 #endif
15688 #ifdef I_STDLIB
15689 #  include <stdlib.h>
15690 #endif
15691 #ifdef I_STRING
15692 #  include <string.h>
15693 #else
15694 #  include <strings.h>
15695 #endif
15696 #ifdef I_UNISTD
15697 #  include <unistd.h>  /* Needed for NetBSD */
15698 #endif
15699 int main()
15700 {
15701 char buf[128], abc[128];
15702 char *b;
15703 int len;
15704 int off;
15705 int align;
15706
15707 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15708    try to store the string in read-only memory. */
15709 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15710
15711 for (align = 7; align >= 0; align--) {
15712         for (len = 36; len; len--) {
15713                 b = buf+align;
15714                 bcopy(abc, b, len);
15715                 for (off = 1; off <= len; off++) {
15716                         bcopy(b, b+off, len);
15717                         bcopy(b+off, b, len);
15718                         if (bcmp(b, abc, len))
15719                                 exit(1);
15720                 }
15721         }
15722 }
15723 exit(0);
15724 }
15725 EOCP
15726                 set try
15727                 if eval $compile_ok; then
15728                         if ./try 2>/dev/null; then
15729                                 echo "Yes, it can."
15730                                 val="$define"
15731                         else
15732                                 echo "It can't, sorry."
15733                         fi
15734                 else
15735                         echo "(I can't compile the test program, so we'll assume not...)"
15736                 fi
15737                 ;;
15738         esac
15739         $rm -f try.* try core
15740         ;;
15741 esac
15742 set d_safebcpy
15743 eval $setvar
15744
15745 : can memcpy handle overlapping blocks?
15746 echo " "
15747 val="$undef"
15748 case "$d_memmove" in
15749 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15750 *)      case "$d_memcpy" in
15751         "$define")
15752                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15753                 $cat >try.c <<EOCP
15754 #$i_memory I_MEMORY
15755 #$i_stdlib I_STDLIB
15756 #$i_string I_STRING
15757 #$i_unistd I_UNISTD
15758 EOCP
15759         $cat >>try.c <<'EOCP'
15760 #include <stdio.h>
15761 #ifdef I_MEMORY
15762 #  include <memory.h>
15763 #endif
15764 #ifdef I_STDLIB
15765 #  include <stdlib.h>
15766 #endif
15767 #ifdef I_STRING
15768 #  include <string.h>
15769 #else
15770 #  include <strings.h>
15771 #endif
15772 #ifdef I_UNISTD
15773 #  include <unistd.h>  /* Needed for NetBSD */
15774 #endif
15775 int main()
15776 {
15777 char buf[128], abc[128];
15778 char *b;
15779 int len;
15780 int off;
15781 int align;
15782
15783 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15784    try to store the string in read-only memory. */
15785 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15786
15787 for (align = 7; align >= 0; align--) {
15788         for (len = 36; len; len--) {
15789                 b = buf+align;
15790                 memcpy(b, abc, len);
15791                 for (off = 1; off <= len; off++) {
15792                         memcpy(b+off, b, len);
15793                         memcpy(b, b+off, len);
15794                         if (memcmp(b, abc, len))
15795                                 exit(1);
15796                 }
15797         }
15798 }
15799 exit(0);
15800 }
15801 EOCP
15802                 set try
15803                 if eval $compile_ok; then
15804                         if ./try 2>/dev/null; then
15805                                 echo "Yes, it can."
15806                                 val="$define"
15807                         else
15808                                 echo "It can't, sorry."
15809                         fi
15810                 else
15811                         echo "(I can't compile the test program, so we'll assume not...)"
15812                 fi
15813                 ;;
15814         esac
15815         $rm -f try.* try core
15816         ;;
15817 esac
15818 set d_safemcpy
15819 eval $setvar
15820
15821 : can memcmp be trusted to compare relative magnitude?
15822 val="$undef"
15823 case "$d_memcmp" in
15824 "$define")
15825         echo " "
15826         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15827         $cat >try.c <<EOCP
15828 #$i_memory I_MEMORY
15829 #$i_stdlib I_STDLIB
15830 #$i_string I_STRING
15831 #$i_unistd I_UNISTD
15832 EOCP
15833         $cat >>try.c <<'EOCP'
15834 #include <stdio.h>
15835 #ifdef I_MEMORY
15836 #  include <memory.h>
15837 #endif
15838 #ifdef I_STDLIB
15839 #  include <stdlib.h>
15840 #endif
15841 #ifdef I_STRING
15842 #  include <string.h>
15843 #else
15844 #  include <strings.h>
15845 #endif
15846 #ifdef I_UNISTD
15847 #  include <unistd.h>  /* Needed for NetBSD */
15848 #endif
15849 int main()
15850 {
15851 char a = -1;
15852 char b = 0;
15853 if ((a < b) && memcmp(&a, &b, 1) < 0)
15854         exit(1);
15855 exit(0);
15856 }
15857 EOCP
15858         set try
15859         if eval $compile_ok; then
15860                 if $run ./try 2>/dev/null; then
15861                         echo "Yes, it can."
15862                         val="$define"
15863                 else
15864                         echo "No, it can't (it uses signed chars)."
15865                 fi
15866         else
15867                 echo "(I can't compile the test program, so we'll assume not...)"
15868         fi
15869         ;;
15870 esac
15871 $rm -f try.* try core
15872 set d_sanemcmp
15873 eval $setvar
15874
15875 : see if prototype for sbrk is available
15876 echo " "
15877 set d_sbrkproto sbrk $i_unistd unistd.h
15878 eval $hasproto
15879
15880 : see if select exists
15881 set select d_select
15882 eval $inlibc
15883
15884 : see if semctl exists
15885 set semctl d_semctl
15886 eval $inlibc
15887
15888 : see if semget exists
15889 set semget d_semget
15890 eval $inlibc
15891
15892 : see if semop exists
15893 set semop d_semop
15894 eval $inlibc
15895
15896 : see how much of the 'sem*(2)' library is present.
15897 h_sem=true
15898 echo " "
15899 case "$d_semctl$d_semget$d_semop" in
15900 *"$undef"*) h_sem=false;;
15901 esac
15902 case "$osname" in
15903 freebsd)
15904     case "`ipcs 2>&1`" in
15905     "SVID messages"*"not configured"*)
15906         echo "Your $osname does not have the sem*(2) configured." >&4
15907         h_sem=false
15908         val="$undef"
15909         set semctl d_semctl
15910         eval $setvar
15911         set semget d_semget
15912         eval $setvar
15913         set semop d_semop
15914         eval $setvar
15915         ;;
15916     esac
15917     ;;
15918 esac
15919 : we could also check for sys/ipc.h ...
15920 if $h_sem && $test `./findhdr sys/sem.h`; then
15921         echo "You have the full sem*(2) library." >&4
15922         val="$define"
15923 else
15924         echo "You don't have the full sem*(2) library." >&4
15925         val="$undef"
15926 fi
15927 set d_sem
15928 eval $setvar
15929
15930 : see whether sys/sem.h defines union semun
15931 echo " "
15932 $cat > try.c <<'END'
15933 #include <sys/types.h>
15934 #include <sys/ipc.h>
15935 #include <sys/sem.h>
15936 int main () { union semun semun; semun.buf = 0; }
15937 END
15938 set try
15939 if eval $compile; then
15940     echo "You have union semun in <sys/sem.h>." >&4
15941     val="$define"
15942 else
15943     echo "You do not have union semun in <sys/sem.h>." >&4
15944     val="$undef"
15945 fi
15946 $rm -f try try.c
15947 set d_union_semun
15948 eval $setvar
15949
15950 : see how to do semctl IPC_STAT
15951 case "$d_sem" in
15952 $define)
15953     echo " "
15954     $cat > try.h <<END
15955 #ifndef S_IRUSR
15956 #   ifdef S_IREAD
15957 #       define S_IRUSR S_IREAD
15958 #       define S_IWUSR S_IWRITE
15959 #       define S_IXUSR S_IEXEC
15960 #   else
15961 #       define S_IRUSR 0400
15962 #       define S_IWUSR 0200
15963 #       define S_IXUSR 0100
15964 #   endif
15965 #   define S_IRGRP (S_IRUSR>>3)
15966 #   define S_IWGRP (S_IWUSR>>3)
15967 #   define S_IXGRP (S_IXUSR>>3)
15968 #   define S_IROTH (S_IRUSR>>6)
15969 #   define S_IWOTH (S_IWUSR>>6)
15970 #   define S_IXOTH (S_IXUSR>>6)
15971 #endif
15972 #ifndef S_IRWXU
15973 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15974 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15975 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15976 #endif
15977 END
15978     : see whether semctl IPC_STAT can use union semun
15979     case "$d_semctl_semun" in
15980     '')
15981       val="$undef"
15982       $cat > try.c <<END
15983 #include <sys/types.h>
15984 #include <sys/ipc.h>
15985 #include <sys/sem.h>
15986 #include <sys/stat.h>
15987 #include <stdio.h>
15988 #include <errno.h>
15989 #include "try.h"
15990 #ifndef errno
15991 extern int errno;
15992 #endif
15993 #$d_union_semun HAS_UNION_SEMUN
15994 int main() {
15995     union semun
15996 #ifndef HAS_UNION_SEMUN
15997     {
15998         int val;
15999         struct semid_ds *buf;
16000         unsigned short *array;
16001     }
16002 #endif
16003     arg;
16004     int sem, st;
16005
16006 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16007     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16008     if (sem > -1) {
16009         struct semid_ds argbuf;
16010         arg.buf = &argbuf;
16011 #       ifdef IPC_STAT
16012         st = semctl(sem, 0, IPC_STAT, arg);
16013         if (st == 0)
16014             printf("semun\n");
16015         else
16016 #       endif /* IPC_STAT */
16017             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16018 #       ifdef IPC_RMID
16019         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16020 #       endif /* IPC_RMID */
16021             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16022     } else
16023 #endif /* IPC_PRIVATE && ... */
16024         printf("semget failed: errno = %d\n", errno);
16025   return 0;
16026 }
16027 END
16028       set try
16029       if eval $compile; then
16030           xxx=`$run ./try`
16031           case "$xxx" in
16032           semun) val="$define" ;;
16033           esac
16034       fi
16035       $rm -f try try.c
16036       set d_semctl_semun
16037       eval $setvar
16038       ;;
16039     esac
16040     case "$d_semctl_semun" in
16041     $define)
16042         echo "You can use union semun for semctl IPC_STAT." >&4
16043         also='also'
16044         ;;
16045     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16046         also=''
16047         ;;
16048     esac
16049
16050     : see whether semctl IPC_STAT can use struct semid_ds pointer
16051     case "$d_semctl_semid_ds" in
16052     '')
16053       val="$undef"
16054       $cat > try.c <<'END'
16055 #include <sys/types.h>
16056 #include <sys/ipc.h>
16057 #include <sys/sem.h>
16058 #include <sys/stat.h>
16059 #include "try.h"
16060 #include <stdio.h>
16061 #include <errno.h>
16062 #ifndef errno
16063 extern int errno;
16064 #endif
16065 int main() {
16066     struct semid_ds 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 #       ifdef IPC_STAT
16073         st = semctl(sem, 0, IPC_STAT, &arg);
16074         if (st == 0)
16075             printf("semid_ds\n");
16076         else
16077 #       endif /* IPC_STAT */
16078             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16079 #       ifdef IPC_RMID
16080         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16081 #       endif /* IPC_RMID */
16082             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16083     } else
16084 #endif /* IPC_PRIVATE && ... */
16085         printf("semget failed: errno = %d\n", errno);
16086
16087     return 0;
16088 }
16089 END
16090       set try
16091       if eval $compile; then
16092           xxx=`$run ./try`
16093           case "$xxx" in
16094           semid_ds) val="$define" ;;
16095           esac
16096       fi
16097       $rm -f try try.c
16098       set d_semctl_semid_ds
16099       eval $setvar
16100       ;;
16101     esac
16102     case "$d_semctl_semid_ds" in
16103     $define)
16104         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16105         ;;
16106     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16107         ;;
16108     esac
16109     $rm -f try.h
16110     ;;
16111 *)  val="$undef"
16112
16113     # We do not have the full sem*(2) library, so assume we can not
16114     # use either.
16115
16116     set d_semctl_semun
16117     eval $setvar
16118
16119     set d_semctl_semid_ds
16120     eval $setvar
16121     ;;
16122 esac
16123
16124 : see if sendmsg exists
16125 set sendmsg d_sendmsg
16126 eval $inlibc
16127
16128 : see if setegid exists
16129 set setegid d_setegid
16130 eval $inlibc
16131
16132 : see if seteuid exists
16133 set seteuid d_seteuid
16134 eval $inlibc
16135
16136 : see if setgrent exists
16137 set setgrent d_setgrent
16138 eval $inlibc
16139
16140 : see if setgrent_r exists
16141 set setgrent_r d_setgrent_r
16142 eval $inlibc
16143 case "$d_setgrent_r" in
16144 "$define")
16145         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16146         case "$d_setgrent_r_proto:$usethreads" in
16147         ":define")      d_setgrent_r_proto=define
16148                 set d_setgrent_r_proto setgrent_r $hdrs
16149                 eval $hasproto ;;
16150         *)      ;;
16151         esac
16152         case "$d_setgrent_r_proto" in
16153         define)
16154         case "$setgrent_r_proto" in
16155         ''|0) try='int setgrent_r(FILE**);'
16156         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16157         esac
16158         case "$setgrent_r_proto" in
16159         ''|0) try='void setgrent_r(FILE**);'
16160         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16161         esac
16162         case "$setgrent_r_proto" in
16163         ''|0)   d_setgrent_r=undef
16164                 setgrent_r_proto=0
16165                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16166         * )     case "$setgrent_r_proto" in
16167                 REENTRANT_PROTO*) ;;
16168                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16169                 esac
16170                 echo "Prototype: $try" ;;
16171         esac
16172         ;;
16173         *)      case "$usethreads" in
16174                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16175                 esac
16176                 d_setgrent_r=undef
16177                 setgrent_r_proto=0
16178                 ;;
16179         esac
16180         ;;
16181 *)      setgrent_r_proto=0
16182         ;;
16183 esac
16184
16185 : see if sethostent exists
16186 set sethostent d_sethent
16187 eval $inlibc
16188
16189 : see if sethostent_r exists
16190 set sethostent_r d_sethostent_r
16191 eval $inlibc
16192 case "$d_sethostent_r" in
16193 "$define")
16194         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16195         case "$d_sethostent_r_proto:$usethreads" in
16196         ":define")      d_sethostent_r_proto=define
16197                 set d_sethostent_r_proto sethostent_r $hdrs
16198                 eval $hasproto ;;
16199         *)      ;;
16200         esac
16201         case "$d_sethostent_r_proto" in
16202         define)
16203         case "$sethostent_r_proto" in
16204         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16205         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16206         esac
16207         case "$sethostent_r_proto" in
16208         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16209         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16210         esac
16211         case "$sethostent_r_proto" in
16212         ''|0)   d_sethostent_r=undef
16213                 sethostent_r_proto=0
16214                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16215         * )     case "$sethostent_r_proto" in
16216                 REENTRANT_PROTO*) ;;
16217                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16218                 esac
16219                 echo "Prototype: $try" ;;
16220         esac
16221         ;;
16222         *)      case "$usethreads" in
16223                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16224                 esac
16225                 d_sethostent_r=undef
16226                 sethostent_r_proto=0
16227                 ;;
16228         esac
16229         ;;
16230 *)      sethostent_r_proto=0
16231         ;;
16232 esac
16233
16234 : see if setitimer exists
16235 set setitimer d_setitimer
16236 eval $inlibc
16237
16238 : see if setlinebuf exists
16239 set setlinebuf d_setlinebuf
16240 eval $inlibc
16241
16242 : see if setlocale exists
16243 set setlocale d_setlocale
16244 eval $inlibc
16245
16246 : see if locale.h is available
16247 set locale.h i_locale
16248 eval $inhdr
16249
16250 : see if setlocale_r exists
16251 set setlocale_r d_setlocale_r
16252 eval $inlibc
16253 case "$d_setlocale_r" in
16254 "$define")
16255         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16256         case "$d_setlocale_r_proto:$usethreads" in
16257         ":define")      d_setlocale_r_proto=define
16258                 set d_setlocale_r_proto setlocale_r $hdrs
16259                 eval $hasproto ;;
16260         *)      ;;
16261         esac
16262         case "$d_setlocale_r_proto" in
16263         define)
16264         case "$setlocale_r_proto" in
16265         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16266         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16267         esac
16268         case "$setlocale_r_proto" in
16269         ''|0)   d_setlocale_r=undef
16270                 setlocale_r_proto=0
16271                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16272         * )     case "$setlocale_r_proto" in
16273                 REENTRANT_PROTO*) ;;
16274                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16275                 esac
16276                 echo "Prototype: $try" ;;
16277         esac
16278         ;;
16279         *)      case "$usethreads" in
16280                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16281                 esac
16282                 d_setlocale_r=undef
16283                 setlocale_r_proto=0
16284                 ;;
16285         esac
16286         ;;
16287 *)      setlocale_r_proto=0
16288         ;;
16289 esac
16290
16291 : see if setnetent exists
16292 set setnetent d_setnent
16293 eval $inlibc
16294
16295 : see if setnetent_r exists
16296 set setnetent_r d_setnetent_r
16297 eval $inlibc
16298 case "$d_setnetent_r" in
16299 "$define")
16300         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16301         case "$d_setnetent_r_proto:$usethreads" in
16302         ":define")      d_setnetent_r_proto=define
16303                 set d_setnetent_r_proto setnetent_r $hdrs
16304                 eval $hasproto ;;
16305         *)      ;;
16306         esac
16307         case "$d_setnetent_r_proto" in
16308         define)
16309         case "$setnetent_r_proto" in
16310         ''|0) try='int setnetent_r(int, struct netent_data*);'
16311         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16312         esac
16313         case "$setnetent_r_proto" in
16314         ''|0) try='void setnetent_r(int, struct netent_data*);'
16315         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16316         esac
16317         case "$setnetent_r_proto" in
16318         ''|0)   d_setnetent_r=undef
16319                 setnetent_r_proto=0
16320                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16321         * )     case "$setnetent_r_proto" in
16322                 REENTRANT_PROTO*) ;;
16323                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16324                 esac
16325                 echo "Prototype: $try" ;;
16326         esac
16327         ;;
16328         *)      case "$usethreads" in
16329                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16330                 esac
16331                 d_setnetent_r=undef
16332                 setnetent_r_proto=0
16333                 ;;
16334         esac
16335         ;;
16336 *)      setnetent_r_proto=0
16337         ;;
16338 esac
16339
16340 : see if setprotoent exists
16341 set setprotoent d_setpent
16342 eval $inlibc
16343
16344 : see if setpgid exists
16345 set setpgid d_setpgid
16346 eval $inlibc
16347
16348 : see if setpgrp2 exists
16349 set setpgrp2 d_setpgrp2
16350 eval $inlibc
16351
16352 : see if setpriority exists
16353 set setpriority d_setprior
16354 eval $inlibc
16355
16356 : see if setproctitle exists
16357 set setproctitle d_setproctitle
16358 eval $inlibc
16359
16360 : see if setprotoent_r exists
16361 set setprotoent_r d_setprotoent_r
16362 eval $inlibc
16363 case "$d_setprotoent_r" in
16364 "$define")
16365         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16366         case "$d_setprotoent_r_proto:$usethreads" in
16367         ":define")      d_setprotoent_r_proto=define
16368                 set d_setprotoent_r_proto setprotoent_r $hdrs
16369                 eval $hasproto ;;
16370         *)      ;;
16371         esac
16372         case "$d_setprotoent_r_proto" in
16373         define)
16374         case "$setprotoent_r_proto" in
16375         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16376         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16377         esac
16378         case "$setprotoent_r_proto" in
16379         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16380         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16381         esac
16382         case "$setprotoent_r_proto" in
16383         ''|0)   d_setprotoent_r=undef
16384                 setprotoent_r_proto=0
16385                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16386         * )     case "$setprotoent_r_proto" in
16387                 REENTRANT_PROTO*) ;;
16388                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16389                 esac
16390                 echo "Prototype: $try" ;;
16391         esac
16392         ;;
16393         *)      case "$usethreads" in
16394                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16395                 esac
16396                 d_setprotoent_r=undef
16397                 setprotoent_r_proto=0
16398                 ;;
16399         esac
16400         ;;
16401 *)      setprotoent_r_proto=0
16402         ;;
16403 esac
16404
16405 : see if setpwent exists
16406 set setpwent d_setpwent
16407 eval $inlibc
16408
16409 : see if setpwent_r exists
16410 set setpwent_r d_setpwent_r
16411 eval $inlibc
16412 case "$d_setpwent_r" in
16413 "$define")
16414         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16415         case "$d_setpwent_r_proto:$usethreads" in
16416         ":define")      d_setpwent_r_proto=define
16417                 set d_setpwent_r_proto setpwent_r $hdrs
16418                 eval $hasproto ;;
16419         *)      ;;
16420         esac
16421         case "$d_setpwent_r_proto" in
16422         define)
16423         case "$setpwent_r_proto" in
16424         ''|0) try='int setpwent_r(FILE**);'
16425         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16426         esac
16427         case "$setpwent_r_proto" in
16428         ''|0) try='void setpwent_r(FILE**);'
16429         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16430         esac
16431         case "$setpwent_r_proto" in
16432         ''|0)   d_setpwent_r=undef
16433                 setpwent_r_proto=0
16434                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16435         * )     case "$setpwent_r_proto" in
16436                 REENTRANT_PROTO*) ;;
16437                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16438                 esac
16439                 echo "Prototype: $try" ;;
16440         esac
16441         ;;
16442         *)      case "$usethreads" in
16443                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16444                 esac
16445                 d_setpwent_r=undef
16446                 setpwent_r_proto=0
16447                 ;;
16448         esac
16449         ;;
16450 *)      setpwent_r_proto=0
16451         ;;
16452 esac
16453
16454 : see if setregid exists
16455 set setregid d_setregid
16456 eval $inlibc
16457 set setresgid d_setresgid
16458 eval $inlibc
16459
16460 : see if setreuid exists
16461 set setreuid d_setreuid
16462 eval $inlibc
16463 set setresuid d_setresuid
16464 eval $inlibc
16465
16466 : see if setrgid exists
16467 set setrgid d_setrgid
16468 eval $inlibc
16469
16470 : see if setruid exists
16471 set setruid d_setruid
16472 eval $inlibc
16473
16474 : see if setservent exists
16475 set setservent d_setsent
16476 eval $inlibc
16477
16478 : see if setservent_r exists
16479 set setservent_r d_setservent_r
16480 eval $inlibc
16481 case "$d_setservent_r" in
16482 "$define")
16483         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16484         case "$d_setservent_r_proto:$usethreads" in
16485         ":define")      d_setservent_r_proto=define
16486                 set d_setservent_r_proto setservent_r $hdrs
16487                 eval $hasproto ;;
16488         *)      ;;
16489         esac
16490         case "$d_setservent_r_proto" in
16491         define)
16492         case "$setservent_r_proto" in
16493         ''|0) try='int setservent_r(int, struct servent_data*);'
16494         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16495         esac
16496         case "$setservent_r_proto" in
16497         ''|0) try='void setservent_r(int, struct servent_data*);'
16498         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16499         esac
16500         case "$setservent_r_proto" in
16501         ''|0)   d_setservent_r=undef
16502                 setservent_r_proto=0
16503                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16504         * )     case "$setservent_r_proto" in
16505                 REENTRANT_PROTO*) ;;
16506                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16507                 esac
16508                 echo "Prototype: $try" ;;
16509         esac
16510         ;;
16511         *)      case "$usethreads" in
16512                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16513                 esac
16514                 d_setservent_r=undef
16515                 setservent_r_proto=0
16516                 ;;
16517         esac
16518         ;;
16519 *)      setservent_r_proto=0
16520         ;;
16521 esac
16522
16523 : see if setsid exists
16524 set setsid d_setsid
16525 eval $inlibc
16526
16527 : see if setvbuf exists
16528 set setvbuf d_setvbuf
16529 eval $inlibc
16530
16531 : see if sfio.h is available
16532 set sfio.h i_sfio
16533 eval $inhdr
16534
16535
16536 : see if sfio library is available
16537 case "$i_sfio" in
16538 $define)
16539         val=''
16540         set sfreserve val
16541         eval $inlibc
16542         ;;
16543 *)
16544         val="$undef"
16545         ;;
16546 esac
16547 : Ok, but do we want to use it.
16548 case "$val" in
16549 $define)
16550         case "$usesfio" in
16551         true|$define|[yY]*) dflt='y';;
16552         *) dflt='n';;
16553         esac
16554         echo "$package can use the sfio library, but it is experimental."
16555         case "$useperlio" in
16556         "$undef")
16557             echo "For sfio also the PerlIO abstraction layer is needed."
16558             echo "Earlier you said you wouldn't want that."
16559             ;;
16560         esac
16561         rp="You seem to have sfio available, do you want to try using it?"
16562         . ./myread
16563         case "$ans" in
16564         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16565                 useperlio="$define"
16566                 val="$define"
16567                 ;;
16568         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16569                 val="$undef"
16570                 ;;
16571         esac
16572         ;;
16573 *)      case "$usesfio" in
16574         true|$define|[yY]*)
16575                 echo "Sorry, cannot find sfio on this machine." >&4
16576                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16577                 val="$undef"
16578                 ;;
16579         esac
16580         ;;
16581 esac
16582 set d_sfio
16583 eval $setvar
16584 case "$d_sfio" in
16585 $define) usesfio='true';;
16586 *) usesfio='false';;
16587 esac
16588 case "$d_sfio" in
16589 $define) ;;
16590 *)      : Remove sfio from list of libraries to use
16591         case "$libs" in
16592         *-lsfio*)
16593                 echo "Removing unneeded -lsfio from library list" >&4
16594                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16595                 shift
16596                 libs="$*"
16597                 echo "libs = $libs" >&4
16598                 ;;
16599         esac
16600 ;;
16601 esac
16602
16603
16604 : see if shmctl exists
16605 set shmctl d_shmctl
16606 eval $inlibc
16607
16608 : see if shmget exists
16609 set shmget d_shmget
16610 eval $inlibc
16611
16612 : see if shmat exists
16613 set shmat d_shmat
16614 eval $inlibc
16615 : see what shmat returns
16616 case "$d_shmat" in
16617 "$define")
16618         $cat >shmat.c <<'END'
16619 #include <sys/shm.h>
16620 void *shmat();
16621 END
16622         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16623                 shmattype='void *'
16624         else
16625                 shmattype='char *'
16626         fi
16627         echo "and it returns ($shmattype)." >&4
16628         : see if a prototype for shmat is available
16629         xxx=`./findhdr sys/shm.h`
16630         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16631         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16632                 val="$define"
16633         else
16634                 val="$undef"
16635         fi
16636         $rm -f shmat.[co]
16637         ;;
16638 *)
16639         val="$undef"
16640         ;;
16641 esac
16642 set d_shmatprototype
16643 eval $setvar
16644
16645 : see if shmdt exists
16646 set shmdt d_shmdt
16647 eval $inlibc
16648
16649 : see how much of the 'shm*(2)' library is present.
16650 h_shm=true
16651 echo " "
16652 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16653 *"$undef"*) h_shm=false;;
16654 esac
16655 case "$osname" in
16656 freebsd)
16657     case "`ipcs 2>&1`" in
16658     "SVID shared memory"*"not configured"*)
16659         echo "Your $osname does not have the shm*(2) configured." >&4
16660         h_shm=false
16661         val="$undef"
16662         set shmctl d_shmctl
16663         evat $setvar
16664         set shmget d_shmget
16665         evat $setvar
16666         set shmat d_shmat
16667         evat $setvar
16668         set shmdt d_shmdt
16669         evat $setvar
16670         ;;
16671     esac
16672     ;;
16673 esac
16674 : we could also check for sys/ipc.h ...
16675 if $h_shm && $test `./findhdr sys/shm.h`; then
16676         echo "You have the full shm*(2) library." >&4
16677         val="$define"
16678 else
16679         echo "You don't have the full shm*(2) library." >&4
16680         val="$undef"
16681 fi
16682 set d_shm
16683 eval $setvar
16684
16685 echo " "
16686 : see if we have sigaction
16687 if set sigaction val -f d_sigaction; eval $csym; $val; then
16688         echo 'sigaction() found.' >&4
16689         $cat > try.c <<EOP
16690 #include <stdio.h>
16691 #include <sys/types.h>
16692 #include <signal.h>
16693 #$i_stdlib I_STDLIB
16694 #ifdef I_STDLIB
16695 #include <stdlib.h>
16696 #endif
16697 int main()
16698 {
16699     struct sigaction act, oact;
16700     act.sa_flags = 0;
16701     oact.sa_handler = 0;
16702     /* so that act and oact are used */
16703     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16704 }
16705 EOP
16706         set try
16707         if eval $compile_ok; then
16708                 val="$define"
16709         else
16710                 echo "But you don't seem to have a useable struct sigaction." >&4
16711                 val="$undef"
16712         fi
16713 else
16714         echo 'sigaction NOT found.' >&4
16715         val="$undef"
16716 fi
16717 set d_sigaction; eval $setvar
16718 $rm -f try try$_o try.c
16719
16720 : see if sigprocmask exists
16721 set sigprocmask d_sigprocmask
16722 eval $inlibc
16723
16724 : see if sigsetjmp exists
16725 echo " "
16726 case "$d_sigsetjmp" in
16727 '')
16728         $cat >try.c <<EOP
16729 #include <setjmp.h>
16730 #$i_stdlib I_STDLIB
16731 #ifdef I_STDLIB
16732 #include <stdlib.h>
16733 #endif
16734 sigjmp_buf env;
16735 int set = 1;
16736 int main()
16737 {
16738         if (sigsetjmp(env,1))
16739                 exit(set);
16740         set = 0;
16741         siglongjmp(env, 1);
16742         exit(1);
16743 }
16744 EOP
16745         set try
16746         if eval $compile; then
16747                 if $run ./try >/dev/null 2>&1; then
16748                         echo "POSIX sigsetjmp found." >&4
16749                         val="$define"
16750                 else
16751                         $cat >&4 <<EOM
16752 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16753 I'll ignore them.
16754 EOM
16755                         val="$undef"
16756                 fi
16757         else
16758                 echo "sigsetjmp not found." >&4
16759                 val="$undef"
16760         fi
16761         ;;
16762 *) val="$d_sigsetjmp"
16763         case "$d_sigsetjmp" in
16764         $define) echo "POSIX sigsetjmp found." >&4;;
16765         $undef) echo "sigsetjmp not found." >&4;;
16766         esac
16767         ;;
16768 esac
16769 set d_sigsetjmp
16770 eval $setvar
16771 $rm -f try.c try
16772
16773 : see if snprintf exists
16774 set snprintf d_snprintf
16775 eval $inlibc
16776
16777 : see if vsnprintf exists
16778 set vsnprintf d_vsnprintf
16779 eval $inlibc
16780
16781 case "$d_snprintf-$d_vsnprintf" in
16782 "$define-$define")
16783     $cat <<EOM
16784 Checking whether your snprintf() and vsnprintf() work okay...
16785 EOM
16786     $cat >try.c <<'EOCP'
16787 /* v?snprintf testing logic courtesy of Russ Allbery.
16788  * According to C99:
16789  * - if the buffer is too short it still must be \0-terminated
16790  * - if the buffer is too short the potentially required length
16791  *   must be returned and not -1
16792  * - if the buffer is NULL the potentially required length
16793  *   must be returned and not -1 or core dump
16794  */
16795 #include <stdio.h>
16796 #include <stdarg.h>
16797
16798 char buf[2];
16799
16800 int test (char *format, ...)
16801 {
16802     va_list args;
16803     int count;
16804
16805     va_start (args, format);
16806     count = vsnprintf (buf, sizeof buf, format, args);
16807     va_end (args);
16808     return count;
16809 }
16810
16811 int main ()
16812 {
16813     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16814              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16815 }
16816 EOCP
16817     set try
16818     if eval $compile; then
16819         `$run ./try`
16820         case "$?" in
16821         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16822         *) cat <<EOM >&4
16823 Your snprintf() and snprintf() don't seem to be working okay.
16824 EOM
16825            d_snprintf="$undef"
16826            d_vsnprintf="$undef"
16827            ;;
16828         esac
16829     else
16830         echo "(I can't seem to compile the test program--assuming they don't)"
16831         d_snprintf="$undef"
16832         d_vsnprintf="$undef"
16833     fi
16834     $rm -f try.* try core core.try.*
16835     ;;
16836 esac
16837
16838 : see if sockatmark exists
16839 set sockatmark d_sockatmark
16840 eval $inlibc
16841
16842 : see if prototype for sockatmark is available
16843 echo " "
16844 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16845 eval $hasproto
16846
16847 : see if socks5_init exists
16848 set socks5_init d_socks5_init
16849 eval $inlibc
16850
16851 : see if sprintf returns the length of the string in the buffer as per ANSI
16852 $echo "Checking whether sprintf returns the length of the string..." >&4
16853 $cat <<EOP >try.c
16854 #include <stdio.h>
16855 #$i_stdlib I_STDLIB
16856 #ifdef I_STDLIB
16857 #include <stdlib.h>
16858 #endif
16859 #$i_string I_STRING
16860 #ifdef I_STRING
16861 #  include <string.h>
16862 #else
16863 #  include <strings.h>
16864 #endif
16865 #$i_math I_MATH
16866 #ifdef I_MATH
16867 #include <math.h>
16868 #endif
16869
16870 char buffer[256];
16871
16872 int check (size_t expect, int test) {
16873   size_t got = strlen(buffer);
16874   if (expect == got)
16875     return 0;
16876
16877   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16878        test, buffer);
16879   exit (test);
16880 }
16881
16882 int main(int argc, char **argv) {
16883   int test = 0;
16884
16885   check(sprintf(buffer, ""), ++test);
16886   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16887   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16888
16889   return 0;
16890 }
16891 EOP
16892 set try
16893
16894 d_sprintf_returns_strlen="$undef"
16895 if eval $compile; then
16896     xxx="`$run ./try`"
16897     case "$?" in
16898         0) cat >&4 <<EOM
16899 sprintf returns the length of the string (as ANSI says it should)
16900 EOM
16901         d_sprintf_returns_strlen="$define"
16902         ;;
16903         *) cat >&4 <<EOM
16904 sprintf does not return the length of the string (how old is this system?)
16905 EOM
16906         d_sprintf_returns_strlen="$undef"
16907         ;;
16908     esac
16909 fi
16910
16911 $rm -f try.* try
16912
16913 : see if srand48_r exists
16914 set srand48_r d_srand48_r
16915 eval $inlibc
16916 case "$d_srand48_r" in
16917 "$define")
16918         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16919         case "$d_srand48_r_proto:$usethreads" in
16920         ":define")      d_srand48_r_proto=define
16921                 set d_srand48_r_proto srand48_r $hdrs
16922                 eval $hasproto ;;
16923         *)      ;;
16924         esac
16925         case "$d_srand48_r_proto" in
16926         define)
16927         case "$srand48_r_proto" in
16928         ''|0) try='int srand48_r(long, struct drand48_data*);'
16929         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16930         esac
16931         case "$srand48_r_proto" in
16932         ''|0)   d_srand48_r=undef
16933                 srand48_r_proto=0
16934                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16935         * )     case "$srand48_r_proto" in
16936                 REENTRANT_PROTO*) ;;
16937                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16938                 esac
16939                 echo "Prototype: $try" ;;
16940         esac
16941         ;;
16942         *)      case "$usethreads" in
16943                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16944                 esac
16945                 d_srand48_r=undef
16946                 srand48_r_proto=0
16947                 ;;
16948         esac
16949         ;;
16950 *)      srand48_r_proto=0
16951         ;;
16952 esac
16953
16954 : see if srandom_r exists
16955 set srandom_r d_srandom_r
16956 eval $inlibc
16957 case "$d_srandom_r" in
16958 "$define")
16959         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16960         case "$d_srandom_r_proto:$usethreads" in
16961         ":define")      d_srandom_r_proto=define
16962                 set d_srandom_r_proto srandom_r $hdrs
16963                 eval $hasproto ;;
16964         *)      ;;
16965         esac
16966         case "$d_srandom_r_proto" in
16967         define)
16968         case "$srandom_r_proto" in
16969         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16970         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16971         esac
16972         case "$srandom_r_proto" in
16973         ''|0)   d_srandom_r=undef
16974                 srandom_r_proto=0
16975                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16976         * )     case "$srandom_r_proto" in
16977                 REENTRANT_PROTO*) ;;
16978                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16979                 esac
16980                 echo "Prototype: $try" ;;
16981         esac
16982         ;;
16983         *)      case "$usethreads" in
16984                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16985                 esac
16986                 d_srandom_r=undef
16987                 srandom_r_proto=0
16988                 ;;
16989         esac
16990         ;;
16991 *)      srandom_r_proto=0
16992         ;;
16993 esac
16994
16995 : see if prototype for setresgid is available
16996 echo " "
16997 set d_sresgproto setresgid $i_unistd unistd.h
16998 eval $hasproto
16999
17000 : see if prototype for setresuid is available
17001 echo " "
17002 set d_sresuproto setresuid $i_unistd unistd.h
17003 eval $hasproto
17004
17005 : see if sys/stat.h is available
17006 set sys/stat.h i_sysstat
17007 eval $inhdr
17008
17009
17010 : see if stat knows about block sizes
17011 echo " "
17012 echo "Checking to see if your struct stat has st_blocks field..." >&4
17013 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17014 eval $hasfield
17015
17016
17017 : see if this is a sys/vfs.h system
17018 set sys/vfs.h i_sysvfs
17019 eval $inhdr
17020
17021
17022 : see if this is a sys/statfs.h system
17023 set sys/statfs.h i_sysstatfs
17024 eval $inhdr
17025
17026
17027 echo " "
17028 echo "Checking to see if your system supports struct statfs..." >&4
17029 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
17030 eval $hasstruct
17031 case "$d_statfs_s" in
17032 "$define")      echo "Yes, it does."   ;;
17033 *)              echo "No, it doesn't." ;;
17034 esac
17035
17036
17037
17038 : see if struct statfs knows about f_flags
17039 case "$d_statfs_s" in
17040 define) 
17041         echo " "
17042         echo "Checking to see if your struct statfs has f_flags field..." >&4
17043         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
17044         eval $hasfield
17045         ;;
17046 *)      val="$undef"
17047         set d_statfs_f_flags
17048         eval $setvar
17049         ;;
17050 esac
17051 case "$d_statfs_f_flags" in
17052 "$define")      echo "Yes, it does."   ;;
17053 *)              echo "No, it doesn't." ;;
17054 esac
17055
17056 $cat >&4 <<EOM
17057 Checking how to access stdio streams by file descriptor number...
17058 EOM
17059 case "$stdio_stream_array" in
17060 '')     $cat >try.c <<EOCP
17061 #include <stdio.h>
17062 int main() {
17063   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17064     printf("yes\n");
17065 }
17066 EOCP
17067         for s in _iob __iob __sF
17068         do
17069                 set try -DSTDIO_STREAM_ARRAY=$s
17070                 if eval $compile; then
17071                         case "`$run ./try`" in
17072                         yes)    stdio_stream_array=$s; break ;;
17073                         esac
17074                 fi
17075         done
17076         $rm -f try.* try$exe_ext
17077 esac
17078 case "$stdio_stream_array" in
17079 '')     $cat >&4 <<EOM
17080 I can't figure out how to access stdio streams by file descriptor number.
17081 EOM
17082         d_stdio_stream_array="$undef"
17083         ;;
17084 *)      $cat >&4 <<EOM
17085 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17086 EOM
17087         d_stdio_stream_array="$define"
17088         ;;
17089 esac
17090
17091 : see if strcoll exists
17092 set strcoll d_strcoll
17093 eval $inlibc
17094
17095 : check for structure copying
17096 echo " "
17097 echo "Checking to see if your C compiler can copy structs..." >&4
17098 $cat >try.c <<'EOCP'
17099 int main()
17100 {
17101         struct blurfl {
17102                 int dyick;
17103         } foo, bar;
17104
17105         foo = bar;
17106 }
17107 EOCP
17108 if $cc -c try.c >/dev/null 2>&1 ; then
17109         val="$define"
17110         echo "Yup, it can."
17111 else
17112         val="$undef"
17113         echo "Nope, it can't."
17114 fi
17115 set d_strctcpy
17116 eval $setvar
17117 $rm -f try.*
17118
17119 : see if strerror and/or sys_errlist[] exist
17120 echo " "
17121 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17122     if set strerror val -f d_strerror; eval $csym; $val; then
17123                 echo 'strerror() found.' >&4
17124                 d_strerror="$define"
17125                 d_strerrm='strerror(e)'
17126                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17127                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17128                         d_syserrlst="$define"
17129                 else
17130                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17131                         d_syserrlst="$undef"
17132                 fi
17133     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17134                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17135                 echo 'strerror() found in string header.' >&4
17136                 d_strerror="$define"
17137                 d_strerrm='strerror(e)'
17138                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17139                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17140                                 d_syserrlst="$define"
17141                 else
17142                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17143                         d_syserrlst="$undef"
17144                 fi
17145     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17146                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17147                 d_strerror="$undef"
17148                 d_syserrlst="$define"
17149                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17150     else
17151                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17152                 d_strerror="$undef"
17153                 d_syserrlst="$undef"
17154                 d_strerrm='"unknown"'
17155     fi
17156 fi
17157
17158 : see if strerror_r exists
17159 set strerror_r d_strerror_r
17160 eval $inlibc
17161 case "$d_strerror_r" in
17162 "$define")
17163         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17164         case "$d_strerror_r_proto:$usethreads" in
17165         ":define")      d_strerror_r_proto=define
17166                 set d_strerror_r_proto strerror_r $hdrs
17167                 eval $hasproto ;;
17168         *)      ;;
17169         esac
17170         case "$d_strerror_r_proto" in
17171         define)
17172         case "$strerror_r_proto" in
17173         ''|0) try='int strerror_r(int, char*, size_t);'
17174         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17175         esac
17176         case "$strerror_r_proto" in
17177         ''|0) try='int strerror_r(int, char*, int);'
17178         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17179         esac
17180         case "$strerror_r_proto" in
17181         ''|0) try='char* strerror_r(int, char*, size_t);'
17182         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17183         esac
17184         case "$strerror_r_proto" in
17185         ''|0)   d_strerror_r=undef
17186                 strerror_r_proto=0
17187                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17188         * )     case "$strerror_r_proto" in
17189                 REENTRANT_PROTO*) ;;
17190                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17191                 esac
17192                 echo "Prototype: $try" ;;
17193         esac
17194         ;;
17195         *)      case "$usethreads" in
17196                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17197                 esac
17198                 d_strerror_r=undef
17199                 strerror_r_proto=0
17200                 ;;
17201         esac
17202         ;;
17203 *)      strerror_r_proto=0
17204         ;;
17205 esac
17206
17207 : see if strftime exists
17208 set strftime d_strftime
17209 eval $inlibc
17210
17211 : see if strlcat exists
17212 set strlcat d_strlcat
17213 eval $inlibc
17214
17215 : see if strlcpy exists
17216 set strlcpy d_strlcpy
17217 eval $inlibc
17218
17219 : see if strtod exists
17220 set strtod d_strtod
17221 eval $inlibc
17222
17223 : see if strtol exists
17224 set strtol d_strtol
17225 eval $inlibc
17226
17227 : see if strtold exists
17228 set strtold d_strtold
17229 eval $inlibc
17230
17231 : see if strtoll exists
17232 set strtoll d_strtoll
17233 eval $inlibc
17234
17235 case "$d_longlong-$d_strtoll" in
17236 "$define-$define")
17237         $cat <<EOM
17238 Checking whether your strtoll() works okay...
17239 EOM
17240         $cat >try.c <<'EOCP'
17241 #include <errno.h>
17242 #ifdef __hpux
17243 #define strtoll __strtoll
17244 #endif
17245 #ifdef __EMX__
17246 #define strtoll _strtoll
17247 #endif
17248 #include <stdio.h>
17249 extern long long int strtoll(char *s, char **, int); 
17250 static int bad = 0;
17251 int check(char *s, long long ell, int een) {
17252         long long gll;
17253         errno = 0;
17254         gll = strtoll(s, 0, 10);
17255         if (!((gll == ell) && (errno == een)))
17256                 bad++;
17257 }
17258 int main() {
17259         check(" 1",                                      1LL, 0);
17260         check(" 0",                                      0LL, 0);
17261         check("-1",                                     -1LL, 0);
17262         check("-9223372036854775808", -9223372036854775808LL, 0);
17263         check("-9223372036854775808", -9223372036854775808LL, 0);
17264         check(" 9223372036854775807",  9223372036854775807LL, 0);
17265         check("-9223372036854775808", -9223372036854775808LL, 0);
17266         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17267         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17268         if (!bad)
17269                 printf("ok\n");
17270 }
17271 EOCP
17272         set try
17273         if eval $compile; then
17274                 yyy=`$run ./try`
17275                 case "$yyy" in
17276                 ok) echo "Your strtoll() seems to be working okay." ;;
17277                 *) cat <<EOM >&4
17278 Your strtoll() doesn't seem to be working okay.
17279 EOM
17280                    d_strtoll="$undef"
17281                    ;;
17282                 esac
17283         else
17284                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17285                 d_strtoll="$undef"
17286         fi
17287         ;;
17288 esac
17289
17290 : see if strtoq exists
17291 set strtoq d_strtoq
17292 eval $inlibc
17293
17294 : see if strtoul exists
17295 set strtoul d_strtoul
17296 eval $inlibc
17297
17298 case "$d_strtoul" in
17299 "$define")
17300         $cat <<EOM
17301 Checking whether your strtoul() works okay...
17302 EOM
17303         $cat >try.c <<'EOCP'
17304 #include <errno.h>
17305 #include <stdio.h>
17306 extern unsigned long int strtoul(char *s, char **, int); 
17307 static int bad = 0;
17308 void check(char *s, unsigned long eul, int een) {
17309         unsigned long gul;
17310         errno = 0;
17311         gul = strtoul(s, 0, 10);
17312         if (!((gul == eul) && (errno == een)))
17313                 bad++;
17314 }
17315 int main() {
17316         check(" 1", 1L, 0);
17317         check(" 0", 0L, 0);
17318 EOCP
17319         case "$longsize" in
17320         8)
17321             $cat >>try.c <<'EOCP'
17322         check("18446744073709551615", 18446744073709551615UL, 0);
17323         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17324 #if 0 /* strtoul() for /^-/ strings is undefined. */
17325         check("-1", 18446744073709551615UL, 0);
17326         check("-18446744073709551614", 2, 0);
17327         check("-18446744073709551615", 1, 0);
17328         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17329         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17330 #endif
17331 EOCP
17332                 ;;
17333         4)
17334                     $cat >>try.c <<'EOCP'
17335         check("4294967295", 4294967295UL, 0);
17336         check("4294967296", 4294967295UL, ERANGE);
17337 #if 0 /* strtoul() for /^-/ strings is undefined. */
17338         check("-1", 4294967295UL, 0);
17339         check("-4294967294", 2, 0);
17340         check("-4294967295", 1, 0);
17341         check("-4294967296", 4294967295UL, ERANGE);
17342         check("-4294967297", 4294967295UL, ERANGE);
17343 #endif
17344 EOCP
17345                 ;;
17346         *)
17347 : Should we write these tests to be more portable by sprintf-ing
17348 : ~0 and then manipulating that char string as input for strtol?
17349                 ;;
17350         esac
17351         $cat >>try.c <<'EOCP'
17352         if (!bad)
17353                 printf("ok\n");
17354         return 0;
17355 }
17356 EOCP
17357         set try
17358         if eval $compile; then
17359                 case "`$run ./try`" in
17360                 ok) echo "Your strtoul() seems to be working okay." ;;
17361                 *) cat <<EOM >&4
17362 Your strtoul() doesn't seem to be working okay.
17363 EOM
17364                    d_strtoul="$undef"
17365                    ;;
17366                 esac
17367         fi
17368         ;;
17369 esac
17370
17371 : see if strtoull exists
17372 set strtoull d_strtoull
17373 eval $inlibc
17374
17375 case "$d_longlong-$d_strtoull" in
17376 "$define-$define")
17377         $cat <<EOM
17378 Checking whether your strtoull() works okay...
17379 EOM
17380         $cat >try.c <<'EOCP'
17381 #include <errno.h>
17382 #ifdef __hpux
17383 #define strtoull __strtoull
17384 #endif
17385 #include <stdio.h>
17386 extern unsigned long long int strtoull(char *s, char **, int); 
17387 static int bad = 0;
17388 int check(char *s, long long eull, int een) {
17389         long long gull;
17390         errno = 0;
17391         gull = strtoull(s, 0, 10);
17392         if (!((gull == eull) && (errno == een)))
17393                 bad++;
17394 }
17395 int main() {
17396         check(" 1",                                        1LL, 0);
17397         check(" 0",                                        0LL, 0);
17398         check("18446744073709551615",  18446744073709551615ULL, 0);
17399         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17400 #if 0 /* strtoull() for /^-/ strings is undefined. */
17401         check("-1",                    18446744073709551615ULL, 0);
17402         check("-18446744073709551614",                     2LL, 0);
17403         check("-18446744073709551615",                     1LL, 0);
17404         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17405         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17406 #endif
17407         if (!bad)
17408                 printf("ok\n");
17409 }
17410 EOCP
17411         set try
17412         if eval $compile; then
17413                 case "`$run ./try`" in
17414                 ok) echo "Your strtoull() seems to be working okay." ;;
17415                 *) cat <<EOM >&4
17416 Your strtoull() doesn't seem to be working okay.
17417 EOM
17418                    d_strtoull="$undef"
17419                    ;;
17420                 esac
17421         fi
17422         ;;
17423 esac
17424
17425 : see if strtouq exists
17426 set strtouq d_strtouq
17427 eval $inlibc
17428
17429 case "$d_strtouq" in
17430 "$define")
17431         $cat <<EOM
17432 Checking whether your strtouq() works okay...
17433 EOM
17434         $cat >try.c <<'EOCP'
17435 #include <errno.h>
17436 #include <stdio.h>
17437 extern unsigned long long int strtouq(char *s, char **, int); 
17438 static int bad = 0;
17439 void check(char *s, unsigned long long eull, int een) {
17440         unsigned long long gull;
17441         errno = 0;
17442         gull = strtouq(s, 0, 10);
17443         if (!((gull == eull) && (errno == een)))
17444                 bad++;
17445 }
17446 int main() {
17447         check(" 1",                                        1LL, 0);
17448         check(" 0",                                        0LL, 0);
17449         check("18446744073709551615",  18446744073709551615ULL, 0);
17450         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17451 #if 0 /* strtouq() for /^-/ strings is undefined. */
17452         check("-1",                    18446744073709551615ULL, 0);
17453         check("-18446744073709551614",                     2LL, 0);
17454         check("-18446744073709551615",                     1LL, 0);
17455         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17456         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17457 #endif
17458         if (!bad)
17459                 printf("ok\n");
17460         return 0;
17461 }
17462 EOCP
17463         set try
17464         if eval $compile; then
17465                 case "`$run ./try`" in
17466                 ok) echo "Your strtouq() seems to be working okay." ;;
17467                 *) cat <<EOM >&4
17468 Your strtouq() doesn't seem to be working okay.
17469 EOM
17470                    d_strtouq="$undef"
17471                    ;;
17472                 esac
17473         fi
17474         ;;
17475 esac
17476
17477 : see if strxfrm exists
17478 set strxfrm d_strxfrm
17479 eval $inlibc
17480
17481 : see if symlink exists
17482 set symlink d_symlink
17483 eval $inlibc
17484
17485 : see if syscall exists
17486 set syscall d_syscall
17487 eval $inlibc
17488
17489 : see if prototype for syscall is available
17490 echo " "
17491 set d_syscallproto syscall $i_unistd unistd.h
17492 eval $hasproto
17493
17494 : see if sysconf exists
17495 set sysconf d_sysconf
17496 eval $inlibc
17497
17498 : see if system exists
17499 set system d_system
17500 eval $inlibc
17501
17502 : see if tcgetpgrp exists
17503 set tcgetpgrp d_tcgetpgrp
17504 eval $inlibc
17505
17506 : see if tcsetpgrp exists
17507 set tcsetpgrp d_tcsetpgrp
17508 eval $inlibc
17509
17510 : see if prototype for telldir is available
17511 echo " "
17512 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17513 eval $hasproto
17514
17515 : see if time exists
17516 echo " "
17517 if test "X$d_time" = X -o X"$timetype" = X; then
17518     if set time val -f d_time; eval $csym; $val; then
17519                 echo 'time() found.' >&4
17520                 val="$define"
17521                 rp="What is the type returned by time() on this system?"
17522                 set time_t timetype long stdio.h sys/types.h
17523                 eval $typedef_ask
17524     else
17525                 echo 'time() not found, hope that will do.' >&4
17526                 val="$undef"
17527                 timetype='int';
17528     fi
17529     set d_time
17530     eval $setvar
17531 fi
17532
17533 : see if this is a sys/times.h system
17534 set sys/times.h i_systimes
17535 eval $inhdr
17536
17537 : see if times exists
17538 echo " "
17539 if set times val -f d_times; eval $csym; $val; then
17540         echo 'times() found.' >&4
17541         d_times="$define"
17542         inc=''
17543         case "$i_systimes" in
17544         "$define") inc='sys/times.h';;
17545         esac
17546         rp="What is the type returned by times() on this system?"
17547         set clock_t clocktype long stdio.h sys/types.h $inc
17548         eval $typedef_ask
17549 else
17550         echo 'times() NOT found, hope that will do.' >&4
17551         d_times="$undef"
17552         clocktype='int'
17553 fi
17554
17555 : see if tmpnam_r exists
17556 set tmpnam_r d_tmpnam_r
17557 eval $inlibc
17558 case "$d_tmpnam_r" in
17559 "$define")
17560         hdrs="$i_systypes sys/types.h define stdio.h "
17561         case "$d_tmpnam_r_proto:$usethreads" in
17562         ":define")      d_tmpnam_r_proto=define
17563                 set d_tmpnam_r_proto tmpnam_r $hdrs
17564                 eval $hasproto ;;
17565         *)      ;;
17566         esac
17567         case "$d_tmpnam_r_proto" in
17568         define)
17569         case "$tmpnam_r_proto" in
17570         ''|0) try='char* tmpnam_r(char*);'
17571         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17572         esac
17573         case "$tmpnam_r_proto" in
17574         ''|0)   d_tmpnam_r=undef
17575                 tmpnam_r_proto=0
17576                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17577         * )     case "$tmpnam_r_proto" in
17578                 REENTRANT_PROTO*) ;;
17579                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17580                 esac
17581                 echo "Prototype: $try" ;;
17582         esac
17583         ;;
17584         *)      case "$usethreads" in
17585                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17586                 esac
17587                 d_tmpnam_r=undef
17588                 tmpnam_r_proto=0
17589                 ;;
17590         esac
17591         ;;
17592 *)      tmpnam_r_proto=0
17593         ;;
17594 esac
17595
17596 : see if truncate exists
17597 set truncate d_truncate
17598 eval $inlibc
17599
17600 : see if ttyname_r exists
17601 set ttyname_r d_ttyname_r
17602 eval $inlibc
17603 case "$d_ttyname_r" in
17604 "$define")
17605         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17606         case "$d_ttyname_r_proto:$usethreads" in
17607         ":define")      d_ttyname_r_proto=define
17608                 set d_ttyname_r_proto ttyname_r $hdrs
17609                 eval $hasproto ;;
17610         *)      ;;
17611         esac
17612         case "$d_ttyname_r_proto" in
17613         define)
17614         case "$ttyname_r_proto" in
17615         ''|0) try='int ttyname_r(int, char*, size_t);'
17616         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17617         esac
17618         case "$ttyname_r_proto" in
17619         ''|0) try='int ttyname_r(int, char*, int);'
17620         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17621         esac
17622         case "$ttyname_r_proto" in
17623         ''|0) try='char* ttyname_r(int, char*, int);'
17624         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17625         esac
17626         case "$ttyname_r_proto" in
17627         ''|0)   d_ttyname_r=undef
17628                 ttyname_r_proto=0
17629                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17630         * )     case "$ttyname_r_proto" in
17631                 REENTRANT_PROTO*) ;;
17632                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17633                 esac
17634                 echo "Prototype: $try" ;;
17635         esac
17636         ;;
17637         *)      case "$usethreads" in
17638                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17639                 esac
17640                 d_ttyname_r=undef
17641                 ttyname_r_proto=0
17642                 ;;
17643         esac
17644         ;;
17645 *)      ttyname_r_proto=0
17646         ;;
17647 esac
17648
17649 : see if tzname[] exists
17650 echo " "
17651 if set tzname val -a d_tzname; eval $csym; $val; then
17652         val="$define"
17653         echo 'tzname[] found.' >&4
17654 else
17655         val="$undef"
17656         echo 'tzname[] NOT found.' >&4
17657 fi
17658 set d_tzname
17659 eval $setvar
17660
17661 case "$osname" in
17662 next|rhapsody|darwin) multiarch="$define" ;;
17663 esac
17664 case "$multiarch" in
17665 ''|[nN]*) multiarch="$undef" ;;
17666 esac
17667
17668 : check for ordering of bytes in a UV
17669 echo " "
17670 case "$usecrosscompile$multiarch" in
17671 *$define*)
17672         $cat <<EOM
17673 You seem to be either cross-compiling or doing a multiarchitecture build,
17674 skipping the byteorder check.
17675
17676 EOM
17677         byteorder='ffff'
17678         ;;
17679 *)
17680         case "$byteorder" in
17681         '')
17682                 $cat <<'EOM'
17683 In the following, larger digits indicate more significance.  A big-endian
17684 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17685 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17686 machines may have weird orders like 3412.  A Cray will report 87654321,
17687 an Alpha will report 12345678. If the test program works the default is
17688 probably right.
17689 I'm now running the test program...
17690 EOM
17691                 $cat >try.c <<EOCP
17692 #include <stdio.h>
17693 #$i_stdlib I_STDLIB
17694 #ifdef I_STDLIB
17695 #include <stdlib.h>
17696 #endif
17697 #include <sys/types.h>
17698 typedef $uvtype UV;
17699 int main()
17700 {
17701         int i;
17702         union {
17703                 UV l;
17704                 char c[$uvsize];
17705         } u;
17706
17707         if ($uvsize > 4)
17708                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17709         else
17710                 u.l = (UV)0x04030201;
17711         for (i = 0; i < $uvsize; i++)
17712                 printf("%c", u.c[i]+'0');
17713         printf("\n");
17714         exit(0);
17715 }
17716 EOCP
17717                 xxx_prompt=y
17718                 set try
17719                 if eval $compile && ./try > /dev/null; then
17720                         dflt=`$run ./try`
17721                         case "$dflt" in
17722                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17723                                 echo "(The test program ran ok.)"
17724                                 echo "byteorder=$dflt"
17725                                 xxx_prompt=n
17726                         ;;
17727                         ????|????????) echo "(The test program ran ok.)" ;;
17728                         *) echo "(The test program didn't run right for some reason.)" ;;
17729                         esac
17730                 else
17731                         dflt='4321'
17732                         cat <<'EOM'
17733 (I can't seem to compile the test program.  Guessing big-endian...)
17734 EOM
17735                 fi
17736                 case "$xxx_prompt" in
17737                 y)
17738                         rp="What is the order of bytes in $uvtype?"
17739                         . ./myread
17740                         byteorder="$ans"
17741                         ;;
17742                 *)      byteorder=$dflt
17743                         ;;
17744                 esac
17745                 ;;
17746         esac
17747         $rm -f try.c try
17748         ;;
17749 esac
17750
17751
17752 $cat <<EOM
17753
17754 Checking to see whether you can access character data unalignedly...
17755 EOM
17756 case "$d_u32align" in
17757 '')   $cat >try.c <<EOCP
17758 #include <stdio.h>
17759 #$i_stdlib I_STDLIB
17760 #ifdef I_STDLIB
17761 #include <stdlib.h>
17762 #endif
17763 #define U32 $u32type
17764 #define BYTEORDER 0x$byteorder
17765 #define U8 $u8type
17766 #include <signal.h>
17767 #ifdef SIGBUS
17768 $signal_t bletch(int s) { exit(4); }
17769 #endif
17770 int main() {
17771 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17772     U8 buf[8];
17773     U32 *up;
17774     int i;
17775
17776     if (sizeof(U32) != 4) {
17777         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17778         exit(1);
17779     }
17780
17781     fflush(stdout);
17782
17783 #ifdef SIGBUS
17784     signal(SIGBUS, bletch);
17785 #endif
17786
17787     buf[0] = 0;
17788     buf[1] = 0;
17789     buf[2] = 0;
17790     buf[3] = 1;
17791     buf[4] = 0;
17792     buf[5] = 0;
17793     buf[6] = 0;
17794     buf[7] = 1;
17795
17796     for (i = 0; i < 4; i++) {
17797         up = (U32*)(buf + i);
17798         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17799                (*up == 1 << (8*(3-i)))  /* little-endian */
17800               )
17801            )
17802         {
17803             printf("read failed (%x)\n", *up);
17804             exit(2);
17805         }
17806     }
17807
17808     /* write test */
17809     for (i = 0; i < 4; i++) {
17810         up = (U32*)(buf + i);
17811         *up = 0xBeef;
17812         if (*up != 0xBeef) {
17813             printf("write failed (%x)\n", *up);
17814             exit(3);
17815         }
17816     }
17817
17818     exit(0);
17819 #else
17820     printf("1\n");
17821     exit(1);
17822 #endif
17823     return 0;
17824 }
17825 EOCP
17826 set try
17827 if eval $compile_ok; then
17828         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17829         $run ./try 2>&1 >/dev/null
17830         case "$?" in
17831         0)      cat >&4 <<EOM
17832 You can access character data pretty unalignedly.
17833 EOM
17834                 d_u32align="$undef"
17835                 ;;
17836         *)      cat >&4 <<EOM
17837 It seems that you must access character data in an aligned manner.
17838 EOM
17839                 d_u32align="$define"
17840                 ;;
17841         esac
17842 else
17843         rp='Can you access character data at unaligned addresses?'
17844         dflt='n'
17845         . ./myread
17846         case "$ans" in
17847         [yY]*)  d_u32align="$undef"  ;;
17848         *)      d_u32align="$define" ;;
17849         esac
17850 fi
17851 $rm -f core core.try.* try.core
17852 ;;
17853 esac
17854
17855 : see if ualarm exists
17856 set ualarm d_ualarm
17857 eval $inlibc
17858
17859 : see if umask exists
17860 set umask d_umask
17861 eval $inlibc
17862
17863 : see if unordered exists
17864 set unordered d_unordered
17865 eval $inlibc
17866
17867 : see if unsetenv exists
17868 set unsetenv d_unsetenv
17869 eval $inlibc
17870
17871 : see if usleep exists
17872 set usleep d_usleep
17873 eval $inlibc
17874
17875 : see if prototype for usleep is available
17876 echo " "
17877 set d_usleepproto usleep $i_unistd unistd.h
17878 eval $hasproto
17879
17880 : see if ustat exists
17881 set ustat d_ustat
17882 eval $inlibc
17883
17884 : backward compatibility for d_hvfork
17885 if test X$d_hvfork != X; then
17886         d_vfork="$d_hvfork"
17887         d_hvfork=''
17888 fi
17889 : see if there is a vfork
17890 val=''
17891 set vfork val
17892 eval $inlibc
17893
17894 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17895 : perl on Solaris 2.x, and probably elsewhere.
17896 case "$val" in
17897 $define)
17898         echo " "
17899         case "$usevfork" in
17900         false) dflt='n';;
17901         *) dflt='y';;
17902         esac
17903         cat <<'EOM'
17904  
17905 Perl can only use a vfork() that doesn't suffer from strict
17906 restrictions on calling functions or modifying global data in
17907 the child.  For example, glibc-2.1 contains such a vfork()
17908 that is unsuitable.  If your system provides a proper fork()
17909 call, chances are that you do NOT want perl to use vfork().
17910
17911 EOM
17912         rp="Do you still want to use vfork()?"
17913         . ./myread
17914         case "$ans" in
17915         y|Y) ;;
17916         *)
17917                 echo "Ok, we won't use vfork()."
17918                 val="$undef"
17919                 ;;
17920         esac
17921         ;;
17922 esac
17923 set d_vfork
17924 eval $setvar
17925 case "$d_vfork" in
17926 $define) usevfork='true';;
17927 *) usevfork='false';;
17928 esac
17929
17930 : see if closedir exists
17931 set closedir d_closedir
17932 eval $inlibc
17933
17934 case "$d_closedir" in
17935 "$define")
17936         echo " "
17937         echo "Checking whether closedir() returns a status..." >&4
17938         cat > try.c <<EOM
17939 #$i_dirent I_DIRENT             /**/
17940 #$i_sysdir I_SYS_DIR            /**/
17941 #$i_sysndir I_SYS_NDIR          /**/
17942 #$i_systypes I_SYS_TYPES        /**/
17943
17944 #if defined(I_SYS_TYPES)
17945 #include <sys/types.h>
17946 #endif
17947 #if defined(I_DIRENT)
17948 #include <dirent.h>
17949 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17950 #include <sys/dir.h>
17951 #endif
17952 #else
17953 #ifdef I_SYS_NDIR
17954 #include <sys/ndir.h>
17955 #else
17956 #ifdef I_SYS_DIR
17957 #ifdef hp9000s500
17958 #include <ndir.h>       /* may be wrong in the future */
17959 #else
17960 #include <sys/dir.h>
17961 #endif
17962 #endif
17963 #endif
17964 #endif 
17965 int main() { return closedir(opendir(".")); }
17966 EOM
17967         set try
17968         if eval $compile_ok; then
17969                 if $run ./try > /dev/null 2>&1 ; then
17970                         echo "Yes, it does."
17971                         val="$undef"
17972                 else
17973                         echo "No, it doesn't."
17974                         val="$define"
17975                 fi
17976         else
17977                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17978                 val="$define"
17979         fi
17980         ;;
17981 *)
17982         val="$undef";
17983         ;;
17984 esac
17985 set d_void_closedir
17986 eval $setvar
17987 $rm -f try try.*
17988 : see if there is a wait4
17989 set wait4 d_wait4
17990 eval $inlibc
17991
17992 : see if waitpid exists
17993 set waitpid d_waitpid
17994 eval $inlibc
17995
17996 : see if wcstombs exists
17997 set wcstombs d_wcstombs
17998 eval $inlibc
17999
18000 : see if wctomb exists
18001 set wctomb d_wctomb
18002 eval $inlibc
18003
18004 : see if writev exists
18005 set writev d_writev
18006 eval $inlibc
18007
18008 : preserve RCS keywords in files with variable substitution, grrr
18009 Date='$Date'
18010 Id='$Id'
18011 Log='$Log'
18012 RCSfile='$RCSfile'
18013 Revision='$Revision'
18014
18015 : check for alignment requirements
18016 echo " "
18017 case "$usecrosscompile$multiarch" in
18018 *$define*)
18019         $cat <<EOM
18020 You seem to be either cross-compiling or doing a multiarchitecture build,
18021 skipping the memory alignment check.
18022
18023 EOM
18024         case "$alignbytes" in
18025         '') alignbytes=8 ;;
18026         esac
18027         ;;
18028 *)
18029         case "$alignbytes" in
18030         '') echo "Checking alignment constraints..." >&4
18031                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18032                         $cat >try.c <<'EOCP'
18033 typedef long double NV;
18034 EOCP
18035                 else
18036                         $cat >try.c <<'EOCP'
18037 typedef double NV;
18038 EOCP
18039                 fi
18040                 $cat >>try.c <<'EOCP'
18041 #include <stdio.h>
18042 struct foobar {
18043         char foo;
18044         NV bar;
18045 } try_algn;
18046 int main()
18047 {
18048     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18049     return(0);
18050 }
18051 EOCP
18052                 set try
18053                 if eval $compile_ok; then
18054                         dflt=`$run ./try`
18055                 else
18056                         dflt='8'
18057                         echo "(I can't seem to compile the test program...)"
18058                 fi
18059                 ;;
18060         *) dflt="$alignbytes"
18061                 ;;
18062         esac
18063         rp="Doubles must be aligned on a how-many-byte boundary?"
18064         . ./myread
18065         alignbytes="$ans"
18066         $rm -f try.c try
18067         ;;
18068 esac
18069
18070
18071 : set the base revision
18072 baserev=5.0
18073
18074 : how do we concatenate cpp tokens here?
18075 echo " "
18076 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18077 $cat >cpp_stuff.c <<'EOCP'
18078 #define RCAT(a,b)a/**/b
18079 #define ACAT(a,b)a ## b
18080 RCAT(Rei,ser)
18081 ACAT(Cir,cus)
18082 EOCP
18083 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18084 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18085         echo "Oh!  Smells like ANSI's been here." >&4
18086         echo "We can catify or stringify, separately or together!"
18087         cpp_stuff=42
18088 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18089         echo "Ah, yes!  The good old days!" >&4
18090         echo "However, in the good old days we don't know how to stringify and"
18091         echo "catify at the same time."
18092         cpp_stuff=1
18093 else
18094         $cat >&4 <<EOM
18095 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18096 You're going to have to edit the values of CAT[2-5] in config.h...
18097 EOM
18098         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18099 fi
18100 $rm -f cpp_stuff.*
18101
18102 : see if this is a db.h system
18103 set db.h i_db
18104 eval $inhdr
18105
18106 case "$i_db" in
18107 $define)
18108         : Check db version.
18109         echo " "
18110         echo "Checking Berkeley DB version ..." >&4
18111         $cat >try.c <<EOCP
18112 #$d_const HASCONST
18113 #ifndef HASCONST
18114 #define const
18115 #endif
18116 #include <sys/types.h>
18117 #include <stdio.h>
18118 #$i_stdlib I_STDLIB
18119 #ifdef I_STDLIB
18120 #include <stdlib.h>
18121 #endif
18122 #include <db.h>
18123 int main(int argc, char *argv[])
18124 {
18125 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18126     int Major, Minor, Patch ;
18127     unsigned long Version ;
18128     (void)db_version(&Major, &Minor, &Patch) ;
18129     if (argc == 2) {
18130         printf("%d %d %d %d %d %d\n",
18131                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18132                Major, Minor, Patch);
18133         exit(0);
18134     }
18135     printf("You have Berkeley DB Version 2 or greater.\n");
18136
18137     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18138                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18139     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18140                 Major, Minor, Patch) ;
18141
18142     /* check that db.h & libdb are compatible */
18143     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18144         printf("db.h and libdb are incompatible.\n") ;
18145         exit(3);        
18146     }
18147
18148     printf("db.h and libdb are compatible.\n") ;
18149
18150     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18151                 + DB_VERSION_PATCH ;
18152
18153     /* needs to be >= 2.3.4 */
18154     if (Version < 2003004) {
18155     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18156         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18157         exit(2);        
18158     }
18159
18160     exit(0);
18161 #else
18162 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18163     if (argc == 2) {
18164         printf("1 0 0\n");
18165         exit(0);
18166     }
18167     printf("You have Berkeley DB Version 1.\n");
18168     exit(0);    /* DB version < 2: the coast is clear. */
18169 #else
18170     exit(1);    /* <db.h> not Berkeley DB? */
18171 #endif
18172 #endif
18173 }
18174 EOCP
18175         set try
18176         if eval $compile_ok && $run ./try; then
18177                 echo 'Looks OK.' >&4
18178                 set `$run ./try 1`
18179                 db_version_major=$1
18180                 db_version_minor=$2
18181                 db_version_patch=$3
18182         else
18183                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18184                 i_db=$undef
18185                 case " $libs " in
18186                 *"-ldb "*)
18187                         : Remove db from list of libraries to use
18188                         echo "Removing unusable -ldb from library list" >&4
18189                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18190                         shift
18191                         libs="$*"
18192                         echo "libs = $libs" >&4
18193                         ;;
18194                 esac
18195         fi
18196         $rm -f try.*
18197         ;;
18198 esac
18199
18200 case "$i_db" in
18201 define)
18202         : Check the return type needed for hash 
18203         echo " "
18204         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18205         $cat >try.c <<EOCP
18206 #$d_const HASCONST
18207 #ifndef HASCONST
18208 #define const
18209 #endif
18210 #include <sys/types.h>
18211 #include <db.h>
18212
18213 #ifndef DB_VERSION_MAJOR
18214 u_int32_t hash_cb (ptr, size)
18215 const void *ptr;
18216 size_t size;
18217 {
18218 }
18219 HASHINFO info;
18220 int main()
18221 {
18222         info.hash = hash_cb;
18223 }
18224 #endif
18225 EOCP
18226         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18227                 if $contains warning try.out >>/dev/null 2>&1 ; then
18228                         db_hashtype='int'
18229                 else
18230                         db_hashtype='u_int32_t'
18231                 fi
18232         else
18233                 : XXX Maybe we should just give up here.
18234                 db_hashtype=u_int32_t
18235                 $cat try.out >&4
18236                 echo "Help:  I can't seem to compile the db test program." >&4
18237                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18238         fi
18239         $rm -f try.*
18240         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18241         ;;
18242 *)      db_hashtype=u_int32_t
18243         ;;
18244 esac
18245 case "$i_db" in
18246 define)
18247         : Check the return type needed for prefix 
18248         echo " "
18249         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18250         cat >try.c <<EOCP
18251 #$d_const HASCONST
18252 #ifndef HASCONST
18253 #define const
18254 #endif
18255 #include <sys/types.h>
18256 #include <db.h>
18257
18258 #ifndef DB_VERSION_MAJOR
18259 size_t prefix_cb (key1, key2)
18260 const DBT *key1;
18261 const DBT *key2;
18262 {
18263 }
18264 BTREEINFO info;
18265 int main()
18266 {
18267         info.prefix = prefix_cb;
18268 }
18269 #endif
18270 EOCP
18271         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18272                 if $contains warning try.out >>/dev/null 2>&1 ; then
18273                         db_prefixtype='int'
18274                 else
18275                         db_prefixtype='size_t'
18276                 fi
18277         else
18278                 db_prefixtype='size_t'
18279                 : XXX Maybe we should just give up here.
18280                 $cat try.out >&4
18281                 echo "Help:  I can't seem to compile the db test program." >&4
18282                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18283         fi
18284         $rm -f try.*
18285         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18286         ;;
18287 *)      db_prefixtype='size_t'
18288         ;;
18289 esac
18290
18291
18292 : How can we generate normalized random numbers ?
18293 echo " "
18294 echo "Looking for a random number function..." >&4
18295 case "$randfunc" in
18296 '')
18297         if set drand48 val -f; eval $csym; $val; then
18298                 dflt="drand48"
18299                 echo "Good, found drand48()." >&4
18300         elif set random val -f; eval $csym; $val; then
18301                 dflt="random"
18302                 echo "OK, found random()." >&4
18303         else
18304                 dflt="rand"
18305                 echo "Yick, looks like I have to use rand()." >&4
18306         fi
18307         echo " "
18308         ;;
18309 *)
18310         dflt="$randfunc"
18311         ;;
18312 esac
18313 cont=true
18314
18315 case "$ccflags" in
18316 *-Dmy_rand=*|*-Dmy_srand=*)
18317         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18318         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18319         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18320         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18321         ;;
18322 esac
18323
18324 while $test "$cont"; do
18325         rp="Use which function to generate random numbers?"
18326         . ./myread
18327         if $test "$ans" = "$dflt"; then
18328                 : null
18329         else
18330                 randbits=''
18331         fi
18332         randfunc="$ans"
18333         if set $ans val -f; eval $csym; $val; then
18334                 cont=''
18335         else
18336                 dflt=y
18337                 rp="I cannot find function $ans. Use that name anyway?"
18338                 . ./myread
18339                 dflt=rand
18340                 case "$ans" in
18341                         [yY]*) cont='';;
18342                 esac
18343         fi
18344         case "$cont" in
18345         '')
18346                 case "$randfunc" in
18347                 drand48)
18348                         drand01="drand48()"
18349                         seedfunc="srand48"
18350                         randbits=48
18351                         randseedtype=long
18352                         ;;
18353                 rand|random)
18354                         case "$randbits" in
18355                         '')
18356 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18357                                 $cat >try.c <<EOCP
18358 #$i_unistd I_UNISTD
18359 #$i_stdlib I_STDLIB
18360 #include <stdio.h>
18361 #ifdef I_UNISTD
18362 #  include <unistd.h>
18363 #endif
18364 #ifdef I_STDLIB
18365 #  include <stdlib.h>
18366 #endif
18367 int main()
18368 {
18369         register int i;
18370         register unsigned long tmp;
18371         register unsigned long max = 0L;
18372
18373         for (i = 1000; i; i--) {
18374                 tmp = (unsigned long) $randfunc();
18375                 if (tmp > max) max = tmp;
18376         }
18377         for (i = 0; max; i++)
18378                 max /= 2;
18379         printf("%d\n",i);
18380 }
18381 EOCP
18382                                 set try
18383                                 if eval $compile_ok; then
18384                                         dflt=`try`
18385                                 else
18386                                         dflt='?'
18387                                         echo "(I can't seem to compile the test program...)"
18388                                 fi
18389                                 ;;
18390                         *)
18391                                 dflt="$randbits"
18392                                 ;;
18393                         esac
18394                         rp="How many bits does your $randfunc() function produce?"
18395                         . ./myread
18396                         randbits="$ans"
18397                         $rm -f try.c try
18398                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18399                         seedfunc="s$randfunc"
18400                         randseedtype=unsigned
18401                         ;;
18402                 *)
18403                         dflt="31"
18404                         rp="How many bits does your $randfunc() function produce?"
18405                         . ./myread
18406                         randbits="$ans"
18407                         seedfunc="s$randfunc"
18408                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18409                         if set $seedfunc val -f; eval $csym; $val; then
18410                                 echo "(Using $seedfunc() to seed random generator)"
18411                         else
18412                                 echo "(Warning: no $seedfunc() to seed random generator)"
18413                                 seedfunc=rand
18414                         fi
18415                         randseedtype=unsigned
18416                         ;;
18417                 esac
18418                 ;;
18419         esac
18420 done
18421
18422 echo " "
18423 echo "Determining whether or not we are on an EBCDIC system..." >&4
18424 $cat >try.c <<'EOM'
18425 int main()
18426 {
18427   if ('M'==0xd4) return 0;
18428   return 1;
18429 }
18430 EOM
18431
18432 val=$undef
18433 set try
18434 if eval $compile_ok; then
18435         if $run ./try; then
18436                 echo "You seem to speak EBCDIC." >&4
18437                 val="$define"
18438         else
18439                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18440         fi
18441 else
18442         echo "I'm unable to compile the test program." >&4
18443         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18444 fi
18445 $rm -f try try.*
18446 set ebcdic
18447 eval $setvar
18448
18449 echo " "
18450 $cat >&4 <<EOM
18451 Checking how to flush all pending stdio output...
18452 EOM
18453 # I only know how to find the first 32 possibly open files on SunOS.
18454 # See also hints/sunos_4_1.sh and util.c  --AD
18455 case "$osname" in
18456 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18457 esac
18458 $cat >>try.c <<EOCP
18459 #include <stdio.h>
18460 #$i_stdlib I_STDLIB
18461 #ifdef I_STDLIB
18462 #include <stdlib.h>
18463 #endif
18464 #$i_unistd I_UNISTD
18465 #ifdef I_UNISTD
18466 # include <unistd.h>
18467 #endif
18468 #$d_sysconf HAS_SYSCONF
18469 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18470 #ifdef HAS_STDIO_STREAM_ARRAY
18471 # define STDIO_STREAM_ARRAY $stdio_stream_array
18472 #endif
18473 int main() {
18474   FILE* p;
18475   unlink("try.out");
18476   p = fopen("try.out", "w");
18477 #ifdef TRY_FPUTC
18478   fputc('x', p);
18479 #else
18480 # ifdef TRY_FPRINTF
18481   fprintf(p, "x");
18482 # endif
18483 #endif
18484 #ifdef TRY_FFLUSH_NULL
18485   fflush(NULL);
18486 #endif
18487 #ifdef TRY_FFLUSH_ALL
18488   {
18489     long open_max = -1;
18490 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18491     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18492 # else
18493 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18494     open_max = sysconf(_SC_OPEN_MAX);
18495 #  else
18496 #   ifdef FOPEN_MAX
18497     open_max = FOPEN_MAX;
18498 #   else
18499 #    ifdef OPEN_MAX
18500     open_max = OPEN_MAX;
18501 #    else
18502 #     ifdef _NFILE
18503     open_max = _NFILE;
18504 #     endif
18505 #    endif
18506 #   endif
18507 #  endif
18508 # endif 
18509 # ifdef HAS_STDIO_STREAM_ARRAY
18510     if (open_max > 0) {
18511       long i;
18512       for (i = 0; i < open_max; i++)
18513             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18514                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18515                 STDIO_STREAM_ARRAY[i]._flag)
18516                 fflush(&STDIO_STREAM_ARRAY[i]);
18517     }   
18518   }
18519 # endif
18520 #endif
18521   _exit(42);
18522 }
18523 EOCP
18524 : first we have to find out how _not_ to flush
18525 $to try.c
18526 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18527     output=''
18528     set try -DTRY_FPUTC
18529     if eval $compile; then
18530             $run ./try 2>/dev/null
18531             code="$?"
18532             $from try.out
18533             if $test ! -s try.out -a "X$code" = X42; then
18534                 output=-DTRY_FPUTC
18535             fi
18536     fi
18537     case "$output" in
18538     '')
18539             set try -DTRY_FPRINTF
18540             if eval $compile; then
18541                     $run ./try 2>/dev/null
18542                     code="$?"
18543                     $from try.out
18544                     if $test ! -s try.out -a "X$code" = X42; then
18545                         output=-DTRY_FPRINTF
18546                     fi
18547             fi
18548         ;;
18549     esac
18550 fi
18551 : check for fflush NULL behaviour
18552 case "$fflushNULL" in
18553 '')     set try -DTRY_FFLUSH_NULL $output
18554         if eval $compile; then
18555                 $run ./try 2>/dev/null
18556                 code="$?"
18557                 $from try.out
18558                 if $test -s try.out -a "X$code" = X42; then
18559                         fflushNULL="`$cat try.out`"
18560                 else
18561                         if $test "X$code" != X42; then
18562                                 $cat >&4 <<EOM
18563 (If this test failed, don't worry, we'll try another method shortly.)
18564 EOM
18565                         fi
18566                 fi
18567         fi
18568         $rm -f core try.core core.try.*
18569         case "$fflushNULL" in
18570         x)      $cat >&4 <<EOM
18571 Your fflush(NULL) works okay for output streams.
18572 Let's see if it clobbers input pipes...
18573 EOM
18574 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18575 # bug that improperly flushes the input end of pipes.  So we avoid the
18576 # autoflush on fork/system/exec support for now. :-(
18577 $cat >tryp.c <<EOCP
18578 #include <stdio.h>
18579 int
18580 main(int argc, char **argv)
18581 {
18582     char buf[1024];
18583     int i;
18584     char *bp = buf;
18585     while (1) {
18586         while ((i = getc(stdin)) != -1
18587                && (*bp++ = i) != '\n'
18588                && bp < &buf[1024])
18589         /* DO NOTHING */ ;
18590         *bp = '\0';
18591         fprintf(stdout, "%s", buf);
18592         fflush(NULL);
18593         if (i == -1)
18594             return 0;
18595         bp = buf;
18596     }
18597 }
18598 EOCP
18599                 fflushNULL="$define"
18600                 set tryp
18601                 if eval $compile; then
18602                     $rm -f tryp.out
18603                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18604                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18605                        $cat >&4 <<EOM
18606 fflush(NULL) seems to behave okay with input streams.
18607 EOM
18608                         fflushNULL="$define"
18609                     else
18610                         $cat >&4 <<EOM
18611 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18612 EOM
18613                         fflushNULL="$undef"
18614                     fi
18615                 fi
18616                 $rm -f core tryp.c tryp.core core.tryp.*
18617                 ;;
18618         '')     $cat >&4 <<EOM
18619 Your fflush(NULL) isn't working (contrary to ANSI C).
18620 EOM
18621                 fflushNULL="$undef"
18622                 ;;
18623         *)      $cat >&4 <<EOM
18624 Cannot figure out whether your fflush(NULL) works or not.
18625 I'm assuming it doesn't (contrary to ANSI C).
18626 EOM
18627                 fflushNULL="$undef"
18628                 ;;
18629         esac
18630         ;;
18631 $define|true|[yY]*)
18632         fflushNULL="$define"
18633         ;;
18634 *)
18635         fflushNULL="$undef"
18636         ;;
18637 esac
18638 : check explicit looping only if NULL did not work, and if the pipe
18639 : bug does not show up on an explicit flush too
18640 case "$fflushNULL" in
18641 "$undef")
18642         $cat >tryp.c <<EOCP
18643 #include <stdio.h>
18644 int
18645 main(int argc, char **argv)
18646 {
18647     char buf[1024];
18648     int i;
18649     char *bp = buf;
18650     while (1) {
18651         while ((i = getc(stdin)) != -1
18652                && (*bp++ = i) != '\n'
18653                && bp < &buf[1024])
18654         /* DO NOTHING */ ;
18655         *bp = '\0';
18656         fprintf(stdout, "%s", buf);
18657         fflush(stdin);
18658         if (i == -1)
18659             return 0;
18660         bp = buf;
18661     }
18662 }
18663 EOCP
18664         set tryp
18665         if eval $compile; then
18666             $rm -f tryp.out
18667             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18668             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18669                $cat >&4 <<EOM
18670 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18671 EOM
18672                 : now check for fflushall behaviour
18673                 case "$fflushall" in
18674                 '')     set try -DTRY_FFLUSH_ALL $output
18675                         if eval $compile; then
18676                                 $cat >&4 <<EOM
18677 (Now testing the other method--but note that this also may fail.)
18678 EOM
18679                                 $run ./try 2>/dev/null
18680                                 code=$?
18681                                 $from try.out
18682                                 if $test -s try.out -a "X$code" = X42; then
18683                                         fflushall="`$cat try.out`"
18684                                 fi
18685                         fi
18686                         $rm -f core try.core core.try.*
18687                         case "$fflushall" in
18688                         x)      $cat >&4 <<EOM
18689 Whew. Flushing explicitly all the stdio streams works.
18690 EOM
18691                                 fflushall="$define"
18692                                 ;;
18693                         '')     $cat >&4 <<EOM
18694 Sigh. Flushing explicitly all the stdio streams doesn't work.
18695 EOM
18696                                 fflushall="$undef"
18697                                 ;;
18698                         *)      $cat >&4 <<EOM
18699 Cannot figure out whether flushing stdio streams explicitly works or not.
18700 I'm assuming it doesn't.
18701 EOM
18702                                 fflushall="$undef"
18703                                 ;;
18704                         esac
18705                         ;;
18706                 "$define"|true|[yY]*)
18707                         fflushall="$define"
18708                         ;;
18709                 *)
18710                         fflushall="$undef"
18711                         ;;
18712                 esac
18713             else
18714                 $cat >&4 <<EOM
18715 All is futile.  Even fflush(stdin) clobbers input pipes!
18716 EOM
18717                 fflushall="$undef"
18718             fi
18719         else
18720             fflushall="$undef"
18721         fi
18722         $rm -f core tryp.c tryp.core core.tryp.*
18723         ;;
18724 *)      fflushall="$undef"
18725         ;;
18726 esac
18727
18728 case "$fflushNULL$fflushall" in
18729 undefundef)
18730         $cat <<EOM
18731 OK, I give up.  I cannot figure out how to flush pending stdio output.
18732 We won't be flushing handles at all before fork/exec/popen.
18733 EOM
18734         ;;
18735 esac
18736 $rm -f try.* try$exe_ext
18737
18738 : Store the full pathname to the ar program for use in the C program
18739 : Respect a hint or command line value for full_ar.
18740 case "$full_ar" in
18741 '') full_ar=$ar ;;
18742 esac
18743
18744 : Store the full pathname to the sed program for use in the C program
18745 full_sed=$sed
18746
18747 : see what type gids are declared as in the kernel
18748 echo " "
18749 echo "Looking for the type for group ids returned by getgid()."
18750 set gid_t gidtype xxx stdio.h sys/types.h
18751 eval $typedef
18752 case "$gidtype" in
18753 xxx)
18754         xxx=`./findhdr sys/user.h`
18755         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18756         case $1 in
18757         unsigned) dflt="$1 $2" ;;
18758         *) dflt="$1" ;;
18759         esac
18760         ;;
18761 *) dflt="$gidtype";;
18762 esac
18763 case "$gidtype" in
18764 gid_t) echo "gid_t found." ;;
18765 *)      rp="What is the type for group ids returned by getgid()?"
18766         . ./myread
18767         gidtype="$ans"
18768         ;;
18769 esac
18770
18771 echo " "
18772 case "$gidtype" in
18773 *_t) zzz="$gidtype"     ;;
18774 *)   zzz="gid"          ;;
18775 esac
18776 echo "Checking the size of $zzz..." >&4 
18777 cat > try.c <<EOCP
18778 #include <sys/types.h>
18779 #include <stdio.h>
18780 #$i_stdlib I_STDLIB
18781 #ifdef I_STDLIB
18782 #include <stdlib.h>
18783 #endif
18784 int main() {
18785     printf("%d\n", (int)sizeof($gidtype));
18786     exit(0);
18787 }
18788 EOCP
18789 set try
18790 if eval $compile_ok; then
18791         yyy=`$run ./try`
18792         case "$yyy" in
18793         '')     gidsize=4
18794                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18795                 ;;
18796         *)      gidsize=$yyy
18797                 echo "Your $zzz is $gidsize bytes long."
18798                 ;;
18799         esac
18800 else
18801         gidsize=4
18802         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18803 fi
18804
18805
18806 echo " "
18807 case "$gidtype" in
18808 *_t) zzz="$gidtype"     ;;
18809 *)   zzz="gid"          ;;
18810 esac
18811 echo "Checking the sign of $zzz..." >&4 
18812 cat > try.c <<EOCP
18813 #include <sys/types.h>
18814 #include <stdio.h>
18815 int main() {
18816         $gidtype foo = -1;
18817         if (foo < 0)
18818                 printf("-1\n");
18819         else
18820                 printf("1\n");
18821 }
18822 EOCP
18823 set try
18824 if eval $compile; then
18825         yyy=`$run ./try`
18826         case "$yyy" in
18827         '')     gidsign=1
18828                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18829                 ;;
18830         *)      gidsign=$yyy
18831                 case "$gidsign" in
18832                  1) echo "Your $zzz is unsigned." ;;
18833                 -1) echo "Your $zzz is signed."   ;;
18834                 esac
18835                 ;;
18836         esac
18837 else
18838         gidsign=1
18839         echo "(I can't compile the test program--guessing unsigned.)" >&4
18840 fi
18841
18842
18843 echo " "
18844
18845 if $test X"$quadtype" != X; then
18846
18847 echo "Checking how to print 64-bit integers..." >&4
18848
18849 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18850         $cat >try.c <<'EOCP'
18851 #include <sys/types.h>
18852 #include <stdio.h>
18853 int main() {
18854   int q = 12345678901;
18855   printf("%ld\n", q);
18856 }
18857 EOCP
18858         set try
18859         if eval $compile; then
18860                 yyy=`$run ./try`
18861                 case "$yyy" in
18862                 12345678901)
18863                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18864                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18865                         echo "We will use %d."
18866                         ;;
18867                 esac
18868         fi
18869 fi
18870
18871 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18872         $cat >try.c <<'EOCP'
18873 #include <sys/types.h>
18874 #include <stdio.h>
18875 int main() {
18876   long q = 12345678901;
18877   printf("%ld\n", q);
18878 }
18879 EOCP
18880         set try
18881         if eval $compile; then
18882                 yyy=`$run ./try`
18883                 case "$yyy" in
18884                 12345678901)
18885                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18886                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18887                         echo "We will use %ld."
18888                         ;;
18889                 esac
18890         fi
18891 fi
18892
18893 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18894         $cat >try.c <<'EOCP'
18895 #include <sys/types.h>
18896 #include <inttypes.h>
18897 #include <stdio.h>
18898 int main() {
18899   int64_t q = 12345678901;
18900   printf("%" PRId64 "\n", q);
18901 }
18902 EOCP
18903         set try
18904         if eval $compile; then
18905                 yyy=`$run ./try`
18906                 case "$yyy" in
18907                 12345678901)
18908                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18909                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18910                         echo "We will use the C9X style."
18911                         ;;
18912                 esac
18913         fi
18914 fi
18915
18916 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18917         $cat >try.c <<EOCP
18918 #include <sys/types.h>
18919 #include <stdio.h>
18920 int main() {
18921   $quadtype q = 12345678901;
18922   printf("%Ld\n", q);
18923 }
18924 EOCP
18925         set try
18926         if eval $compile; then
18927                 yyy=`$run ./try`
18928                 case "$yyy" in
18929                 12345678901)
18930                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18931                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18932                         echo "We will use %Ld."
18933                         ;;
18934                 esac
18935         fi
18936 fi
18937
18938 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18939         $cat >try.c <<'EOCP'
18940 #include <sys/types.h>
18941 #include <stdio.h>
18942 int main() {
18943   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18944   printf("%lld\n", q);
18945 }
18946 EOCP
18947         set try
18948         if eval $compile; then
18949                 yyy=`$run ./try`
18950                 case "$yyy" in
18951                 12345678901)
18952                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18953                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18954                         echo "We will use the %lld style."
18955                         ;;
18956                 esac
18957         fi
18958 fi
18959
18960 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18961         $cat >try.c <<EOCP
18962 #include <sys/types.h>
18963 #include <stdio.h>
18964 int main() {
18965   $quadtype q = 12345678901;
18966   printf("%qd\n", q);
18967 }
18968 EOCP
18969         set try
18970         if eval $compile; then
18971                 yyy=`$run ./try`
18972                 case "$yyy" in
18973                 12345678901)
18974                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18975                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18976                         echo "We will use %qd."
18977                         ;;
18978                 esac
18979         fi
18980 fi
18981
18982 if $test X"$sPRId64" = X; then
18983         echo "Cannot figure out how to print 64-bit integers." >&4
18984 fi
18985
18986 $rm -f try try.*
18987
18988 fi
18989
18990 case "$sPRId64" in
18991 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18992         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18993         ;;
18994 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18995         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18996         ;;
18997 esac
18998
18999
19000 echo " "
19001 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19002
19003 if $test X"$ivsize" = X8; then
19004         ivdformat="$sPRId64"
19005         uvuformat="$sPRIu64"
19006         uvoformat="$sPRIo64"
19007         uvxformat="$sPRIx64"
19008         uvXUformat="$sPRIXU64"
19009 else
19010         if $test X"$ivsize" = X"$longsize"; then
19011                 ivdformat='"ld"'
19012                 uvuformat='"lu"'
19013                 uvoformat='"lo"'
19014                 uvxformat='"lx"'
19015                 uvXUformat='"lX"'
19016         else
19017                 if $test X"$ivsize" = X"$intsize"; then
19018                         ivdformat='"d"'
19019                         uvuformat='"u"'
19020                         uvoformat='"o"'
19021                         uvxformat='"x"'
19022                         uvXUformat='"X"'
19023                 else
19024                         : far out
19025                         if $test X"$ivsize" = X"$shortsize"; then
19026                                 ivdformat='"hd"'
19027                                 uvuformat='"hu"'
19028                                 uvoformat='"ho"'
19029                                 uvxformat='"hx"'
19030                                 uvXUformat='"hX"'
19031                         fi
19032                 fi
19033         fi
19034 fi
19035
19036 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19037         nveformat="$sPRIeldbl"
19038         nvfformat="$sPRIfldbl"
19039         nvgformat="$sPRIgldbl"
19040         nvEUformat="$sPRIEUldbl"
19041         nvFUformat="$sPRIFUldbl"
19042         nvGUformat="$sPRIGUldbl"
19043 else
19044         nveformat='"e"'
19045         nvfformat='"f"'
19046         nvgformat='"g"'
19047         nvEUformat='"E"'
19048         nvFUformat='"F"'
19049         nvGUformat='"G"'
19050 fi
19051
19052 case "$ivdformat" in
19053 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19054     exit 1
19055     ;;
19056 esac
19057
19058
19059 echo " "
19060 $echo "Checking the format string to be used for gids..." >&4
19061
19062 case "$gidsign" in
19063 -1)     if $test X"$gidsize" = X"$ivsize"; then
19064                 gidformat="$ivdformat"
19065         else
19066                 if $test X"$gidsize" = X"$longsize"; then
19067                         gidformat='"ld"'
19068                 else
19069                         if $test X"$gidsize" = X"$intsize"; then
19070                                 gidformat='"d"'
19071                         else
19072                                 if $test X"$gidsize" = X"$shortsize"; then
19073                                         gidformat='"hd"'
19074                                 fi
19075                         fi
19076                 fi
19077         fi
19078         ;;
19079 *)      if $test X"$gidsize" = X"$uvsize"; then
19080                 gidformat="$uvuformat"
19081         else
19082                 if $test X"$gidsize" = X"$longsize"; then
19083                         gidformat='"lu"'
19084                 else
19085                         if $test X"$gidsize" = X"$intsize"; then
19086                                 gidformat='"u"'
19087                         else
19088                                 if $test X"$gidsize" = X"$shortsize"; then
19089                                         gidformat='"hu"'
19090                                 fi
19091                         fi
19092                 fi
19093         fi
19094         ;;
19095 esac
19096
19097 : see if getgroups exists
19098 set getgroups d_getgrps
19099 eval $inlibc
19100
19101 : see if setgroups exists
19102 set setgroups d_setgrps
19103 eval $inlibc
19104
19105
19106 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19107 echo " "
19108 case "$d_getgrps$d_setgrps" in
19109 *define*)
19110         case "$groupstype" in
19111         '') dflt="$gidtype" ;;
19112         *)  dflt="$groupstype" ;;
19113         esac
19114         $cat <<EOM
19115 What type of pointer is the second argument to getgroups() and setgroups()?
19116 Usually this is the same as group ids, $gidtype, but not always.
19117
19118 EOM
19119         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19120         . ./myread
19121         groupstype="$ans"
19122         ;;
19123 *)  groupstype="$gidtype";;
19124 esac
19125
19126
19127 if $test $patchlevel -lt 9; then
19128 : MAD is not available in 5.8.x or earlier.
19129     ans=n;
19130 else
19131     case "$mad" in
19132     $define|true|[yY]*) dflt='y' ;;
19133     *)                  dflt='n' ;;
19134     esac
19135     cat <<EOM
19136
19137 Would you like to build with Misc Attribute Decoration? This is development
19138 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19139 overhead on the interpreter.
19140
19141 If this doesn't make any sense to you, just accept the default '$dflt'.
19142 EOM
19143     rp='Build Perl with MAD?'
19144     . ./myread
19145 fi
19146 case "$ans" in
19147 y|Y)    val="$define"
19148         madlyh='madly.h madly.act madly.tab'
19149         madlysrc='madly.c'
19150         madlyobj="madly$_o" ;;
19151 *)      val="$undef"
19152         madlyh=''
19153         madlysrc=''
19154         madlyobj='' ;;
19155 esac
19156 set mad
19157 eval $setvar
19158
19159 echo " "
19160 echo "Checking if your $make program sets \$(MAKE)..." >&4
19161 case "$make_set_make" in
19162 '')
19163         $sed 's/^X //' > testmake.mak << 'EOF'
19164 Xall:
19165 X       @echo 'maketemp="$(MAKE)"'
19166 EOF
19167         case "`$make -f testmake.mak 2>/dev/null`" in
19168         *maketemp=*) make_set_make='#' ;;
19169         *)      make_set_make="MAKE=$make" ;;
19170         esac
19171         $rm -f testmake.mak
19172         ;;
19173 esac
19174 case "$make_set_make" in
19175 '#') echo "Yup, it does.";;
19176 *) echo "Nope, it doesn't.";;
19177 esac
19178
19179 : see what type is used for mode_t
19180 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19181 set mode_t modetype int stdio.h sys/types.h
19182 eval $typedef_ask
19183
19184 : see if we need va_copy
19185 echo " "
19186 case "$i_stdarg" in
19187 "$define")
19188         $cat >try.c <<EOCP
19189 #include <stdarg.h>
19190 #include <stdio.h>
19191 #$i_stdlib I_STDLIB
19192 #ifdef I_STDLIB
19193 #include <stdlib.h>
19194 #endif
19195 #include <signal.h>
19196
19197 int
19198 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19199 {
19200   return vfprintf(f, fmt, *valp);
19201 }
19202  
19203 int    
19204 myvfprintf(FILE *f, const  char *fmt, va_list val)
19205 {
19206   return ivfprintf(f, fmt, &val);
19207 }
19208       
19209 int
19210 myprintf(char *fmt, ...) 
19211 {
19212   va_list val;
19213   va_start(val, fmt);
19214   return myvfprintf(stdout, fmt, val); 
19215 }         
19216
19217 int
19218 main(int ac, char **av)
19219 {
19220   signal(SIGSEGV, exit);
19221
19222   myprintf("%s%cs all right, then\n", "that", '\'');                            
19223   exit(0);      
19224 }
19225 EOCP
19226         set try
19227         if eval $compile && $run ./try 2>&1 >/dev/null; then
19228                 case "`$run ./try`" in
19229                 "that's all right, then")
19230                         okay=yes
19231                         ;;
19232                 esac
19233         fi
19234         case "$okay" in
19235         yes)    echo "It seems that you don't need va_copy()." >&4
19236                 need_va_copy="$undef"
19237                 ;;
19238         *)      echo "It seems that va_copy() or similar will be needed." >&4
19239                 need_va_copy="$define"
19240                 ;;
19241         esac
19242         $rm -f try.* core core.* *.core *.core.*
19243         ;;
19244 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19245         ;;
19246 esac
19247
19248 : see what type is used for size_t
19249 rp="What is the type used for the length parameter for string functions?"
19250 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19251 eval $typedef_ask
19252
19253 : check for type of arguments to gethostbyaddr. 
19254 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19255         case "$d_gethbyaddr" in
19256         $define)
19257                 $cat <<EOM
19258
19259 Checking to see what type of arguments are accepted by gethostbyaddr().
19260 EOM
19261                 hdrs="$define sys/types.h
19262                         $d_socket sys/socket.h 
19263                         $i_niin netinet/in.h 
19264                         $i_netdb netdb.h
19265                         $i_unistd unistd.h"
19266                 : The first arg can 'char *' or 'void *'
19267                 : The second arg is some of integral type
19268                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19269                         for yyy in size_t long int; do
19270                                 case "$netdb_host_type" in
19271                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19272                                         if ./protochk "$try" $hdrs; then
19273                                                 echo "Your system accepts $xxx for the first arg."
19274                                                 echo "...and $yyy for the second arg."
19275                                                 netdb_host_type="$xxx"
19276                                                 netdb_hlen_type="$yyy"
19277                                         fi
19278                                         ;;
19279                                 esac
19280                         done
19281                 done
19282                 : In case none of those worked, prompt the user.
19283                 case "$netdb_host_type" in
19284                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19285                         dflt='char *'
19286                         . ./myread
19287                         netdb_host_type=$ans
19288                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19289                         dflt="$sizetype"
19290                         . ./myread
19291                         netdb_hlen_type=$ans
19292                         ;;
19293                 esac
19294                 ;;
19295         *)      : no gethostbyaddr, so pick harmless defaults
19296                 netdb_host_type='char *'
19297                 netdb_hlen_type="$sizetype"
19298                 ;;
19299         esac
19300         # Remove the "const" if needed. -- but then we'll have a 
19301         # prototype clash!
19302         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19303 fi
19304
19305 : check for type of argument to gethostbyname. 
19306 if test "X$netdb_name_type" = X ; then
19307         case "$d_gethbyname" in
19308         $define)
19309                 $cat <<EOM
19310
19311 Checking to see what type of argument is accepted by gethostbyname().
19312 EOM
19313                 hdrs="$define sys/types.h
19314                         $d_socket sys/socket.h 
19315                         $i_niin netinet/in.h 
19316                         $i_netdb netdb.h
19317                         $i_unistd unistd.h"
19318                 for xxx in "const char *" "char *"; do
19319                         case "$netdb_name_type" in
19320                         '')     try="extern struct hostent *gethostbyname($xxx);"
19321                                 if ./protochk "$try" $hdrs; then
19322                                         echo "Your system accepts $xxx."
19323                                         netdb_name_type="$xxx"
19324                                 fi
19325                                 ;;
19326                         esac
19327                 done
19328                 : In case none of those worked, prompt the user.
19329                 case "$netdb_name_type" in
19330                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19331                         dflt='char *'
19332                         . ./myread
19333                         netdb_name_type=$ans
19334                         ;;
19335                 esac
19336                 ;;
19337         *)      : no gethostbyname, so pick harmless default
19338                 netdb_name_type='char *'
19339                 ;;
19340         esac
19341 fi
19342
19343 : check for type of 1st argument to getnetbyaddr. 
19344 if test "X$netdb_net_type" = X ; then
19345         case "$d_getnbyaddr" in
19346         $define)
19347                 $cat <<EOM
19348
19349 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19350 EOM
19351                 hdrs="$define sys/types.h
19352                         $d_socket sys/socket.h 
19353                         $i_niin netinet/in.h 
19354                         $i_netdb netdb.h
19355                         $i_unistd unistd.h"
19356                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19357                         case "$netdb_net_type" in
19358                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19359                                 if ./protochk "$try" $hdrs; then
19360                                         echo "Your system accepts $xxx."
19361                                         netdb_net_type="$xxx"
19362                                 fi
19363                                 ;;
19364                         esac
19365                 done
19366                 : In case none of those worked, prompt the user.
19367                 case "$netdb_net_type" in
19368                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19369                         dflt='long'
19370                         . ./myread
19371                         netdb_net_type=$ans
19372                         ;;
19373                 esac
19374                 ;;
19375         *)      : no getnetbyaddr, so pick harmless default
19376                 netdb_net_type='long'
19377                 ;;
19378         esac
19379 fi
19380 : locate the preferred pager for this system
19381 fn=f/
19382 case "$pager" in
19383 '')
19384         dflt=''
19385         case "$pg" in
19386         /*) dflt=$pg;;
19387         [a-zA-Z]:/*) dflt=$pg;;
19388         esac
19389         case "$more" in
19390         /*) dflt=$more;;
19391         [a-zA-Z]:/*) dflt=$more;;
19392         esac
19393         case "$less" in
19394         /*) dflt=$less;;
19395         [a-zA-Z]:/*) dflt=$less;;
19396         esac
19397         case "$dflt" in
19398         '') dflt=/usr/ucb/more;;
19399         esac
19400         ;;
19401 *)      dflt="$pager"
19402         : Instruct ./getfile to trust the hinted or previous pager value,
19403         : even if it does not begin with a slash.  For example, on os2,
19404         : pager might be cmd /c more.  See comments in UU/getfile.
19405         fn="f/($pager)"
19406         ;;
19407 esac
19408 echo " "
19409 rp='What pager is used on your system?'
19410 . ./getfile
19411 pager="$ans"
19412
19413 : see what type pids are declared as in the kernel
19414 rp="What is the type of process ids on this system?"
19415 set pid_t pidtype int stdio.h sys/types.h
19416 eval $typedef_ask
19417
19418 : see if ar generates random libraries by itself
19419 echo " "
19420 echo "Checking how to generate random libraries on your machine..." >&4
19421 echo 'int bar1() { return bar2(); }' > bar1.c
19422 echo 'int bar2() { return 2; }' > bar2.c
19423 $cat > foo.c <<EOP
19424 #$i_stdlib I_STDLIB
19425 #ifdef I_STDLIB
19426 #include <stdlib.h>
19427 #endif
19428 int main() { printf("%d\n", bar1()); exit(0); }
19429 EOP
19430 $cc $ccflags -c bar1.c >/dev/null 2>&1
19431 $cc $ccflags -c bar2.c >/dev/null 2>&1
19432 $cc $ccflags -c foo.c >/dev/null 2>&1
19433 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19434 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19435         $run ./foobar >/dev/null 2>&1; then
19436         echo "$ar appears to generate random libraries itself."
19437         orderlib=false
19438         if [ "X$ranlib" = "X" ]; then
19439             ranlib=":"
19440         fi
19441 elif $ar s bar$_a >/dev/null 2>&1 &&
19442         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19443         $run ./foobar >/dev/null 2>&1; then
19444                 echo "a table of contents needs to be added with '$ar s'."
19445                 orderlib=false
19446                 ranlib="$ar s"
19447 elif $ar ts bar$_a >/dev/null 2>&1 &&
19448         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19449         $run ./foobar >/dev/null 2>&1; then
19450                 echo "a table of contents needs to be added with '$ar ts'."
19451                 orderlib=false
19452                 ranlib="$ar ts"
19453 else
19454         case "$ranlib" in
19455         :) ranlib='';;
19456         '')
19457                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19458                 $test -f $ranlib || ranlib=''
19459                 ;;
19460         esac
19461         if $test -n "$ranlib"; then
19462                 echo "your system has '$ranlib'; we'll use that."
19463                 orderlib=false
19464         else
19465                 echo "your system doesn't seem to support random libraries"
19466                 echo "so we'll use lorder and tsort to order the libraries."
19467                 orderlib=true
19468                 ranlib=":"
19469         fi
19470 fi
19471 $rm -f foo* bar*
19472
19473 : check for type of arguments to select. 
19474 case "$selecttype" in
19475 '') case "$d_select" in
19476         $define)
19477                 echo " "
19478                 $cat <<EOM
19479 Checking to see what type of arguments are accepted by select().
19480 EOM
19481                 hdrs="$define sys/types.h
19482                         $i_systime sys/time.h 
19483                         $i_sysselct sys/select.h
19484                         $d_socket sys/socket.h"
19485                 : The first arg can be int, unsigned, or size_t
19486                 : The last arg may or may not be 'const'
19487                 val=''
19488                 : void pointer has been seen but using that
19489                 : breaks the selectminbits test
19490                 for xxx in 'fd_set *' 'int *'; do
19491                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19492                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19493                                         case "$val" in
19494                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19495                                                 if ./protochk "$try" $hdrs; then
19496                                                         echo "Your system accepts $xxx."
19497                                                         val="$xxx"
19498                                                 fi
19499                                                 ;;
19500                                         esac
19501                                 done
19502                         done
19503                 done
19504                 case "$val" in
19505                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19506                         case "$d_fd_set" in
19507                                 $define) dflt="fd_set *" ;;
19508                                 *)              dflt="int *" ;;
19509                         esac
19510                         . ./myread
19511                         val=$ans
19512                         ;;
19513                 esac
19514                 selecttype="$val"
19515                 ;;
19516         *)      : no select, so pick a harmless default
19517                 selecttype='int *'
19518                 ;;
19519         esac
19520         ;;
19521 esac
19522
19523 : check for the select 'width'
19524 case "$selectminbits" in
19525 '') safebits=`expr $ptrsize \* 8`
19526     case "$d_select" in
19527         $define)
19528                 $cat <<EOM
19529
19530 Checking to see on how many bits at a time your select() operates...
19531 EOM
19532                 $cat >try.c <<EOCP
19533 #include <sys/types.h>
19534 #$i_time I_TIME
19535 #$i_systime I_SYS_TIME
19536 #$i_systimek I_SYS_TIME_KERNEL
19537 #ifdef I_TIME
19538 #   include <time.h>
19539 #endif
19540 #ifdef I_SYS_TIME
19541 #   ifdef I_SYS_TIME_KERNEL
19542 #       define KERNEL
19543 #   endif
19544 #   include <sys/time.h>
19545 #   ifdef I_SYS_TIME_KERNEL
19546 #       undef KERNEL
19547 #   endif
19548 #endif
19549 #$i_sysselct I_SYS_SELECT
19550 #ifdef I_SYS_SELECT
19551 #include <sys/select.h>
19552 #endif
19553 #$d_socket HAS_SOCKET
19554 #ifdef HAS_SOCKET
19555 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19556 #endif
19557 #include <stdio.h>
19558 #$i_stdlib I_STDLIB
19559 #ifdef I_STDLIB
19560 #include <stdlib.h>
19561 #endif
19562 $selecttype b;
19563 #define S sizeof(*(b))
19564 #define MINBITS 64
19565 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19566 #define NBITS  (NBYTES * 8)
19567 int main() {
19568     char *s = (char *)malloc(NBYTES);
19569     struct timeval t;
19570     int i;
19571     FILE* fp;
19572     int fd;
19573
19574     if (!s)
19575         exit(1);
19576     fclose(stdin);
19577     fp = fopen("try.c", "r");
19578     if (fp == 0)
19579       exit(2);
19580     fd = fileno(fp);
19581     if (fd < 0)
19582       exit(3);
19583     b = ($selecttype)s;
19584     for (i = 0; i < NBITS; i++)
19585         FD_SET(i, b);
19586     t.tv_sec  = 0;
19587     t.tv_usec = 0;
19588     select(fd + 1, b, 0, 0, &t);
19589     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19590     free(s);
19591     printf("%d\n", i + 1);
19592     return 0;
19593 }
19594 EOCP
19595                 set try
19596                 if eval $compile_ok; then
19597                         selectminbits=`$run ./try`
19598                         case "$selectminbits" in
19599                         '')     cat >&4 <<EOM
19600 Cannot figure out on how many bits at a time your select() operates.
19601 I'll play safe and guess it is $safebits bits.
19602 EOM
19603                                 selectminbits=$safebits
19604                                 bits="$safebits bits"
19605                                 ;;
19606                         1)      bits="1 bit" ;;
19607                         *)      bits="$selectminbits bits" ;;
19608                         esac
19609                         echo "Your select() operates on $bits at a time." >&4
19610                 else
19611                         rp='What is the minimum number of bits your select() operates on?'
19612                         case "$byteorder" in
19613                         12345678)       dflt=64 ;;
19614                         1234)           dflt=32 ;;
19615                         *)              dflt=1  ;;
19616                         esac
19617                         . ./myread
19618                         val=$ans
19619                         selectminbits="$val"
19620                 fi
19621                 $rm -f try.* try
19622                 ;;
19623         *)      : no select, so pick a harmless default
19624                 selectminbits=$safebits
19625                 ;;
19626         esac
19627         ;;
19628 esac
19629
19630 : Trace out the files included by signal.h, then look for SIGxxx names.
19631 : Remove SIGARRAYSIZE used by HPUX.
19632 : Remove SIGSTKSIZE used by Linux.
19633 : Remove SIGSTKSZ used by Posix.
19634 : Remove SIGTYP void lines used by OS2.
19635 : Some cpps, like os390, dont give the file name anywhere
19636 if [ "X$fieldn" = X ]; then
19637         : Just make some guesses.  We check them later.
19638         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19639 else
19640         xxx=`echo '#include <signal.h>' |
19641         $cppstdin $cppminus $cppflags 2>/dev/null |
19642         $grep '^[       ]*#.*include' | 
19643         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19644 fi
19645 : Check this list of files to be sure we have parsed the cpp output ok.
19646 : This will also avoid potentially non-existent files, such 
19647 : as ../foo/bar.h
19648 xxxfiles=''
19649 for xx in $xxx /dev/null ; do
19650         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19651 done
19652 : If we have found no files, at least try signal.h
19653 case "$xxxfiles" in
19654 '')     xxxfiles=`./findhdr signal.h` ;;
19655 esac
19656 xxx=`awk '
19657 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19658         print substr($2, 4, 20)
19659 }
19660 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19661         print substr($3, 4, 20)
19662 }' $xxxfiles`
19663 : Append some common names just in case the awk scan failed.
19664 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19665 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19666 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19667 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19668 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19669
19670 : generate a few handy files for later
19671 $cat > signal.c <<EOCP
19672 #include <sys/types.h>
19673 #include <signal.h>
19674 #$i_stdlib I_STDLIB
19675 #ifdef I_STDLIB
19676 #include <stdlib.h>
19677 #endif
19678 #include <stdio.h>
19679 int main() {
19680
19681 /* Strange style to avoid deeply-nested #if/#else/#endif */
19682 #ifndef NSIG
19683 #  ifdef _NSIG
19684 #    define NSIG (_NSIG)
19685 #  endif
19686 #endif
19687
19688 #ifndef NSIG
19689 #  ifdef SIGMAX
19690 #    define NSIG (SIGMAX+1)
19691 #  endif
19692 #endif
19693
19694 #ifndef NSIG
19695 #  ifdef SIG_MAX
19696 #    define NSIG (SIG_MAX+1)
19697 #  endif
19698 #endif
19699
19700 #ifndef NSIG
19701 #  ifdef _SIG_MAX
19702 #    define NSIG (_SIG_MAX+1)
19703 #  endif
19704 #endif
19705
19706 #ifndef NSIG
19707 #  ifdef MAXSIG
19708 #    define NSIG (MAXSIG+1)
19709 #  endif
19710 #endif
19711
19712 #ifndef NSIG
19713 #  ifdef MAX_SIG
19714 #    define NSIG (MAX_SIG+1)
19715 #  endif
19716 #endif
19717
19718 #ifndef NSIG
19719 #  ifdef SIGARRAYSIZE
19720 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19721 #  endif
19722 #endif
19723
19724 #ifndef NSIG
19725 #  ifdef _sys_nsig
19726 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19727 #  endif
19728 #endif
19729
19730 /* Default to some arbitrary number that's big enough to get most
19731    of the common signals.
19732 */
19733 #ifndef NSIG
19734 #    define NSIG 50
19735 #endif
19736
19737 printf("NSIG %d\n", NSIG);
19738
19739 #ifndef JUST_NSIG
19740
19741 EOCP
19742
19743 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19744 {
19745         printf "#ifdef SIG"; printf $1; printf "\n"
19746         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19747         printf $1; printf ");\n"
19748         printf "#endif\n"
19749 }
19750 END {
19751         printf "#endif /* JUST_NSIG */\n";
19752         printf "exit(0);\n}\n";
19753 }
19754 ' >>signal.c
19755 $cat >signal.awk <<'EOP'
19756 BEGIN { ndups = 0 }
19757 $1 ~ /^NSIG$/ { nsig = $2 }
19758 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19759     if ($2 > maxsig) { maxsig = $2 }
19760     if (sig_name[$2]) {
19761         dup_name[ndups] = $1
19762         dup_num[ndups] = $2
19763         ndups++ 
19764     }
19765     else {
19766         sig_name[$2] = $1
19767         sig_num[$2] = $2
19768     }
19769 }
19770 END { 
19771     if (nsig == 0) {
19772         nsig = maxsig + 1
19773     }
19774     printf("NSIG %d\n", nsig);
19775     for (n = 1; n < nsig; n++) {
19776         if (sig_name[n]) {
19777             printf("%s %d\n", sig_name[n], sig_num[n])
19778         }
19779         else {
19780             printf("NUM%d %d\n", n, n) 
19781         }
19782     }
19783     for (n = 0; n < ndups; n++) {
19784         printf("%s %d\n", dup_name[n], dup_num[n])
19785     }
19786 }
19787 EOP
19788 $cat >signal_cmd <<EOS
19789 $startsh
19790 if $test -s signal.lst; then
19791     echo "Using your existing signal.lst file"
19792         exit 0
19793 fi
19794 xxx="$xxx"
19795 EOS
19796 $cat >>signal_cmd <<'EOS'
19797
19798 set signal
19799 if eval $compile_ok; then
19800         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19801 else
19802         echo "(I can't seem be able to compile the whole test program)" >&4
19803         echo "(I'll try it in little pieces.)" >&4
19804         set signal -DJUST_NSIG
19805         if eval $compile_ok; then
19806                 $run ./signal$_exe > signal.nsg
19807                 $cat signal.nsg
19808         else
19809                 echo "I can't seem to figure out how many signals you have." >&4
19810                 echo "Guessing 50." >&4
19811                 echo 'NSIG 50' > signal.nsg
19812         fi
19813         : Now look at all the signal names, one at a time.
19814         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19815                 $cat > signal.c <<EOCP
19816 #include <sys/types.h>
19817 #include <signal.h>
19818 #include <stdio.h>
19819 int main() {
19820 printf("$xx %d\n", SIG${xx});
19821 return 0;
19822 }
19823 EOCP
19824                 set signal
19825                 if eval $compile; then
19826                         echo "SIG${xx} found."
19827                         $run ./signal$_exe  >> signal.ls1
19828                 else
19829                         echo "SIG${xx} NOT found."
19830                 fi
19831         done
19832         if $test -s signal.ls1; then
19833                 $cat signal.nsg signal.ls1 |
19834                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19835         fi
19836
19837 fi
19838 if $test -s signal.lst; then
19839         :
19840 else
19841         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19842         echo 'kill -l' >signal
19843         set X `csh -f <signal`
19844         $rm -f signal
19845         shift
19846         case $# in
19847         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19848         esac
19849         echo $@ | $tr ' ' $trnl | \
19850             $awk '{ printf "%s %d\n", $1, ++s; }
19851                   END { printf "NSIG %d\n", ++s }' >signal.lst
19852 fi
19853 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19854 EOS
19855 chmod a+x signal_cmd
19856 $eunicefix signal_cmd
19857
19858 : generate list of signal names
19859 echo " "
19860 case "$sig_name_init" in
19861 '') doinit=yes ;;
19862 *)  case "$sig_num_init" in
19863     ''|*,*) doinit=yes ;;
19864     esac ;;
19865 esac
19866 case "$doinit" in
19867 yes)
19868         echo "Generating a list of signal names and numbers..." >&4
19869         . ./signal_cmd
19870         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19871         sig_name=`$awk 'BEGIN { printf "ZERO " }
19872                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19873         sig_num=`$awk  'BEGIN { printf "0 " }
19874                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19875         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19876                              !/^NSIG/   { printf "\"%s\", ", $1 }
19877                              END        { printf "0\n" }' signal.lst`
19878         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19879                              !/^NSIG/   { printf "%d, ", $2}
19880                              END        { printf "0\n"}' signal.lst`
19881         ;;
19882 esac
19883 echo "The following $sig_count signals are available:"
19884 echo " "
19885 echo $sig_name | $awk \
19886 'BEGIN { linelen = 0 }
19887 {
19888         for (i = 1; i <= NF; i++) {
19889                 name = "SIG" $i " "
19890                 linelen = linelen + length(name)
19891                 if (linelen > 70) {
19892                         printf "\n"
19893                         linelen = length(name)
19894                 }
19895                 printf "%s", name
19896         }
19897         printf "\n"
19898 }'
19899 sig_size=`echo $sig_name | awk '{print NF}'`
19900 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19901
19902 echo " "
19903 case "$sizetype" in
19904 *_t) zzz="$sizetype"    ;;
19905 *)   zzz="filesize"     ;;
19906 esac
19907 echo "Checking the size of $zzz..." >&4 
19908 cat > try.c <<EOCP
19909 #include <sys/types.h>
19910 #include <stdio.h>
19911 #$i_stdlib I_STDLIB
19912 #ifdef I_STDLIB
19913 #include <stdlib.h>
19914 #endif
19915 int main() {
19916     printf("%d\n", (int)sizeof($sizetype));
19917     exit(0);
19918 }
19919 EOCP
19920 set try
19921 if eval $compile_ok; then
19922         yyy=`$run ./try`
19923         case "$yyy" in
19924         '')     sizesize=4
19925                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19926                 ;;
19927         *)      sizesize=$yyy
19928                 echo "Your $zzz size is $sizesize bytes."
19929                 ;;
19930         esac
19931 else
19932         sizesize=4
19933         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19934 fi
19935
19936
19937 : check for socklen_t
19938 echo " "
19939 echo "Checking to see if you have socklen_t..." >&4
19940 $cat >try.c <<EOCP
19941 #include <sys/types.h>
19942 #$d_socket HAS_SOCKET
19943 #ifdef HAS_SOCKET
19944 #include <sys/socket.h>
19945 #endif
19946 int main() { socklen_t x = 16; }
19947 EOCP
19948 set try
19949 if eval $compile; then
19950         val="$define"
19951         echo "You have socklen_t."
19952 else
19953         val="$undef"
19954         echo "You do not have socklen_t."
19955         case "$sizetype" in
19956         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19957         esac
19958 fi
19959 $rm -f try try.*
19960 set d_socklen_t
19961 eval $setvar
19962
19963 : see if this is a socks.h system
19964 set socks.h i_socks
19965 eval $inhdr
19966
19967 : check for type of the size argument to socket calls
19968 case "$d_socket" in
19969 "$define")
19970         $cat <<EOM
19971
19972 Checking to see what type is the last argument of accept().
19973 EOM
19974         yyy=''
19975         case "$d_socklen_t" in
19976         "$define") yyy="$yyy socklen_t"
19977         esac
19978         yyy="$yyy $sizetype int long unsigned"
19979         for xxx in $yyy; do
19980                 case "$socksizetype" in
19981                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19982                         case "$usesocks" in
19983                         "$define")
19984                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19985                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19986                                         socksizetype="$xxx"
19987                                 fi
19988                                 ;;
19989                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19990                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19991                                         socksizetype="$xxx"
19992                                 fi
19993                                 ;;
19994                         esac
19995                         ;;
19996                 esac
19997         done
19998 : In case none of those worked, prompt the user.
19999         case "$socksizetype" in
20000         '')     rp='What is the type for socket address structure sizes?'
20001                 dflt='int'
20002                 . ./myread
20003                 socksizetype=$ans
20004                 ;;
20005         esac
20006         ;;
20007 *)      : no sockets, so pick relatively harmless default
20008         socksizetype='int'
20009         ;;
20010 esac
20011
20012 : see what type is used for signed size_t
20013 set ssize_t ssizetype int stdio.h sys/types.h
20014 eval $typedef
20015 dflt="$ssizetype"
20016 $cat > try.c <<EOM
20017 #include <stdio.h>
20018 #$i_stdlib I_STDLIB
20019 #ifdef I_STDLIB
20020 #include <stdlib.h>
20021 #endif
20022 #include <sys/types.h>
20023 #define Size_t $sizetype
20024 #define SSize_t $dflt
20025 int main()
20026 {
20027         if (sizeof(Size_t) == sizeof(SSize_t))
20028                 printf("$dflt\n");
20029         else if (sizeof(Size_t) == sizeof(int))
20030                 printf("int\n");
20031         else 
20032                 printf("long\n");
20033         exit(0);
20034 }
20035 EOM
20036 echo " "
20037 set try
20038 if eval $compile_ok && $run ./try > /dev/null; then
20039         ssizetype=`$run ./try`
20040         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20041 else
20042         $cat >&4 <<EOM
20043 Help! I can't compile and run the ssize_t test program: please enlighten me!
20044 (This is probably a misconfiguration in your system or libraries, and
20045 you really ought to fix it.  Still, I'll try anyway.)
20046
20047 I need a type that is the same size as $sizetype, but is guaranteed to
20048 be signed.  Common values are ssize_t, int and long.
20049
20050 EOM
20051         rp="What signed type is the same size as $sizetype?"
20052         . ./myread
20053         ssizetype="$ans"
20054 fi
20055 $rm -f try try.*
20056
20057 : see what type of char stdio uses.
20058 echo " "
20059 echo '#include <stdio.h>' > stdio.c
20060 $cppstdin $cppminus < stdio.c > stdioh
20061 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20062         echo "Your stdio uses unsigned chars." >&4
20063         stdchar="unsigned char"
20064 else
20065         echo "Your stdio uses signed chars." >&4
20066         stdchar="char"
20067 fi
20068 $rm -f stdio.* stdioh
20069
20070 : see what type uids are declared as in the kernel
20071 echo " "
20072 echo "Looking for the type for user ids returned by getuid()."
20073 set uid_t uidtype xxx stdio.h sys/types.h
20074 eval $typedef
20075 case "$uidtype" in
20076 xxx)
20077         xxx=`./findhdr sys/user.h`
20078         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20079         case $1 in
20080         unsigned) dflt="$1 $2" ;;
20081         *) dflt="$1" ;;
20082         esac
20083         ;;
20084 *) dflt="$uidtype";;
20085 esac
20086 case "$uidtype" in
20087 uid_t)  echo "uid_t found." ;;
20088 *)      rp="What is the type for user ids returned by getuid()?"
20089         . ./myread
20090         uidtype="$ans"
20091         ;;
20092 esac
20093
20094 echo " "
20095 case "$uidtype" in
20096 *_t) zzz="$uidtype"     ;;
20097 *)   zzz="uid"          ;;
20098 esac
20099 echo "Checking the size of $zzz..." >&4 
20100 cat > try.c <<EOCP
20101 #include <sys/types.h>
20102 #include <stdio.h>
20103 #$i_stdlib I_STDLIB
20104 #ifdef I_STDLIB
20105 #include <stdlib.h>
20106 #endif
20107 int main() {
20108     printf("%d\n", (int)sizeof($uidtype));
20109     exit(0);
20110 }
20111 EOCP
20112 set try
20113 if eval $compile_ok; then
20114         yyy=`$run ./try`
20115         case "$yyy" in
20116         '')     uidsize=4
20117                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20118                 ;;
20119         *)      uidsize=$yyy
20120                 echo "Your $zzz is $uidsize bytes long."
20121                 ;;
20122         esac
20123 else
20124         uidsize=4
20125         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20126 fi
20127
20128 echo " "
20129 case "$uidtype" in
20130 *_t) zzz="$uidtype"     ;;
20131 *)   zzz="uid"          ;;
20132 esac
20133 echo "Checking the sign of $zzz..." >&4
20134 cat > try.c <<EOCP
20135 #include <sys/types.h>
20136 #include <stdio.h>
20137 int main() {
20138         $uidtype foo = -1;
20139         if (foo < 0)
20140                 printf("-1\n");
20141         else
20142                 printf("1\n");
20143 }
20144 EOCP
20145 set try
20146 if eval $compile; then
20147         yyy=`$run ./try`
20148         case "$yyy" in
20149         '')     uidsign=1
20150                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20151                 ;;
20152         *)      uidsign=$yyy
20153                 case "$uidsign" in
20154                  1) echo "Your $zzz is unsigned." ;;
20155                 -1) echo "Your $zzz is signed."   ;;
20156                 esac
20157                 ;;
20158         esac
20159 else
20160         uidsign=1
20161         echo "(I can't compile the test program--guessing unsigned.)" >&4
20162 fi
20163
20164
20165
20166 echo " "
20167 $echo "Checking the format string to be used for uids..." >&4
20168
20169 case "$uidsign" in
20170 -1)     if $test X"$uidsize" = X"$ivsize"; then
20171                 uidformat="$ivdformat"
20172         else
20173                 if $test X"$uidsize" = X"$longsize"; then
20174                         uidformat='"ld"'
20175                 else
20176                         if $test X"$uidsize" = X"$intsize"; then
20177                                 uidformat='"d"'
20178                         else
20179                                 if $test X"$uidsize" = X"$shortsize"; then
20180                                         uidformat='"hd"'
20181                                 fi
20182                         fi
20183                 fi
20184         fi
20185         ;;
20186 *)      if $test X"$uidsize" = X"$uvsize"; then
20187                 uidformat="$uvuformat"
20188         else
20189                 if $test X"$uidsize" = X"$longsize"; then
20190                         uidformat='"lu"'
20191                 else
20192                         if $test X"$uidsize" = X"$intsize"; then
20193                                 uidformat='"u"'
20194                         else
20195                                 if $test X"$uidsize" = X"$shortsize"; then
20196                                         uidformat='"hu"'
20197                                 fi
20198                         fi
20199                 fi
20200         fi
20201         ;;
20202 esac
20203
20204
20205 case "$usesitecustomize" in
20206     $define|true|[Yy]*)
20207         usesitecustomize="$define"
20208         ;;
20209     *)
20210         usesitecustomize="$undef"
20211         ;;
20212     esac
20213
20214 : determine compiler compiler
20215 case "$yacc" in
20216 '')
20217         dflt=yacc;;
20218 *)
20219         dflt="$yacc";;
20220 esac
20221 echo " "
20222 comp='yacc'
20223 if $test -f "$byacc$_exe"; then
20224         dflt="$byacc"
20225         comp="byacc or $comp"
20226 fi
20227 if $test -f "$bison$_exe"; then
20228         comp="$comp or bison -y"
20229 fi
20230 rp="Which compiler compiler ($comp) shall I use?"
20231 . ./myread
20232 yacc="$ans"
20233 case "$yacc" in
20234 *bis*)
20235         case "$yacc" in
20236         *-y*) ;;
20237         *)
20238                 yacc="$yacc -y"
20239                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20240                 ;;
20241         esac
20242         ;;
20243 esac
20244
20245 : see if this is a fp.h system
20246 set fp.h i_fp
20247 eval $inhdr
20248
20249 : see if this is a fp_class.h system
20250 set fp_class.h i_fp_class
20251 eval $inhdr
20252
20253 : see if this is a ieeefp.h system
20254 case "$i_ieeefp" in
20255 '' ) set ieeefp.h i_ieeefp
20256      eval $inhdr
20257      ;;
20258 esac
20259
20260 : see if this is a libutil.h system
20261 set libutil.h i_libutil
20262 eval $inhdr
20263
20264 : see if mach cthreads are available
20265 if test "X$usethreads" = "X$define"; then
20266         set mach/cthreads.h i_machcthr
20267         eval $inhdr
20268 else
20269         i_machcthr="$undef"
20270 fi
20271
20272
20273
20274 : see if this is a mntent.h system
20275 set mntent.h i_mntent
20276 eval $inhdr
20277
20278 : see if ndbm.h is available
20279 set ndbm.h t_ndbm
20280 eval $inhdr
20281
20282 case "$t_ndbm" in
20283 $undef)
20284     # Some Linux distributions such as RedHat 7.1 put the
20285     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20286     if $test -f /usr/include/gdbm/ndbm.h; then
20287         echo '<gdbm/ndbm.h> found.'
20288         ccflags="$ccflags -I/usr/include/gdbm"
20289         cppflags="$cppflags -I/usr/include/gdbm"
20290         t_ndbm=$define
20291     fi
20292     ;;
20293 esac
20294
20295 case "$t_ndbm" in
20296 $define)
20297         : see if dbm_open exists
20298         set dbm_open d_dbm_open
20299         eval $inlibc
20300         case "$d_dbm_open" in
20301         $undef)
20302                 t_ndbm="$undef"
20303                 echo "We won't be including <ndbm.h>"
20304                 ;;
20305         esac
20306         ;;
20307 esac
20308 val="$t_ndbm"
20309 set i_ndbm
20310 eval $setvar
20311
20312 : see if net/errno.h is available
20313 val=''
20314 set net/errno.h val
20315 eval $inhdr
20316
20317 : Unfortunately, it causes problems on some systems.  Arrgh.
20318 case "$val" in
20319 $define)
20320         cat > try.c <<'EOM'
20321 #include <stdio.h>
20322 #include <errno.h>
20323 #include <net/errno.h>
20324 int func()
20325 {
20326         return ENOTSOCK;
20327 }
20328 EOM
20329         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20330                 echo "We'll be including <net/errno.h>." >&4
20331         else
20332                 echo "We won't be including <net/errno.h>." >&4
20333                 val="$undef"
20334         fi
20335         $rm -f try.* try
20336         ;;
20337 esac
20338 set i_neterrno
20339 eval $setvar
20340
20341 : see if netinet/tcp.h is available
20342 set netinet/tcp.h i_netinettcp
20343 eval $inhdr
20344
20345 : see if this is a poll.h system
20346 set poll.h i_poll
20347 eval $inhdr
20348
20349 : see if this is a prot.h system
20350 set prot.h i_prot
20351 eval $inhdr
20352
20353 echo " "
20354 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20355 $cat <<'EOSH' > Cppsym.know
20356 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20357 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20358 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20359 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20360 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20361 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20362 bull c cadmus clipper CMU COFF COMPILER_VERSION
20363 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20364 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20365 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20366 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20367 GLIBC GLIBC_MINOR
20368 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20369 H3050R H3050RX hbullx20 hcx host_mips
20370 hp200 hp300 hp700 HP700 hp800 hp9000
20371 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20372 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20373 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20374 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20375 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20376 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20377 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20378 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20379 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20380 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20381 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20382 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20383 MATH_HAS_NO_SIDE_EFFECTS
20384 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20385 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20386 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20387 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20388 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20389 NetBSD news1500 news1700 news1800 news1900 news3700
20390 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20391 ns32016 ns32332 ns32k nsc32000
20392 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20393 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20394 pc532 pdp11 PGC PIC plexus PORTAR posix
20395 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20396 POSIX_C_SOURCE POSIX_SOURCE POWER
20397 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20398 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20399 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20400 sony sony_news sonyrisc sparc sparclite spectrum
20401 stardent stdc STDC_EXT stratos sun sun3 sun386
20402 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20403 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20404 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20405 sysV68 sysV88 Tek4132 Tek4300 titan
20406 TM3200 TM5400 TM5600
20407 tower tower32 tower32_200 tower32_600 tower32_700
20408 tower32_800 tower32_850 tss
20409 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20410 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20411 unix UNIX95 UNIX99 unixpc unos
20412 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20413 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20414 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20415 USGr4 USGr4_2
20416 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20417 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20418 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20419 z8000
20420 EOSH
20421 # Maybe put other stuff here too.
20422 cat <<EOSH >>Cppsym.know
20423 $osname
20424 EOSH
20425 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20426 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20427 $cat Cppsym.know > Cppsym.c
20428 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20429 $rm -f Cppsym.a Cppsym.b Cppsym.c
20430 cat <<EOSH > Cppsym
20431 $startsh
20432 if $test \$# -gt 0; then
20433     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20434     if $test -s Cppsym.got; then
20435         $rm -f Cppsym.got
20436         exit 0
20437     fi
20438     $rm -f Cppsym.got
20439     exit 1
20440 else
20441     $tr " " "$trnl" | ./Cppsym.try
20442     exit 0
20443 fi
20444 EOSH
20445 chmod +x Cppsym
20446 $eunicefix Cppsym
20447 cat <<EOSH > Cppsym.try
20448 $startsh
20449 cat <<'EOCP' > try.c
20450 #include <stdio.h>
20451 #if cpp_stuff == 1
20452 #define STRINGIFY(a)    "a"
20453 #endif
20454 #if cpp_stuff == 42
20455 #define StGiFy(a)  #a
20456 #define STRINGIFY(a)    StGiFy(a)
20457 #endif
20458 #if $cpp_stuff != 1 && $cpp_stuff != 42
20459 #   include "Bletch: How does this C preprocessor stringify macros?"
20460 #endif
20461 int main() {
20462 EOCP
20463 $awk \\
20464 EOSH
20465 cat <<'EOSH' >> Cppsym.try
20466 'length($1) > 0 {
20467     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20468     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20469     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20470     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20471 }'       >> try.c
20472 echo 'return 0;}' >> try.c
20473 EOSH
20474 cat <<EOSH >> Cppsym.try
20475 ccflags="$ccflags"
20476 case "$osname-$gccversion" in
20477 irix-) ccflags="\$ccflags -woff 1178" ;;
20478 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20479 esac
20480 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20481 EOSH
20482 chmod +x Cppsym.try
20483 $eunicefix Cppsym.try
20484 ./Cppsym < Cppsym.know > Cppsym.true
20485 : Add in any linux cpp "predefined macros":
20486 case "$osname::$gccversion" in
20487   *linux*::*.*)
20488     tHdrH=_tmpHdr
20489     rm -f $tHdrH'.h' $tHdrH
20490     touch $tHdrH'.h'
20491     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20492        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20493        if [ -s $tHdrH'_cppsym.real' ]; then
20494           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20495        fi
20496     fi
20497     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20498   ;;
20499 esac
20500 : now check the C compiler for additional symbols
20501 postprocess_cc_v=''
20502 case "$osname" in
20503 aix) postprocess_cc_v="|$tr , ' '" ;;
20504 esac
20505 $cat >ccsym <<EOS
20506 $startsh
20507 $cat >tmp.c <<EOF
20508 extern int foo;
20509 EOF
20510 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20511 do
20512         case "\$i" in
20513         -D*) echo "\$i" | $sed 's/^-D//';;
20514         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20515         esac
20516 done
20517 $rm -f try.c
20518 EOS
20519 postprocess_cc_v=''
20520 chmod +x ccsym
20521 $eunicefix ccsym
20522 ./ccsym > ccsym1.raw
20523 if $test -s ccsym1.raw; then
20524        $sort ccsym1.raw | $uniq >ccsym.raw
20525 else
20526        mv ccsym1.raw ccsym.raw
20527 fi
20528
20529 $awk '/\=/ { print $0; next }
20530         { print $0"=1" }' ccsym.raw >ccsym.list
20531 $comm -13 Cppsym.true ccsym.list >ccsym.own
20532 $comm -12 Cppsym.true ccsym.list >ccsym.com
20533 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20534 also=''
20535 if $test -z ccsym.raw; then
20536         echo "Your C compiler doesn't seem to define any symbols!" >&4
20537         echo " "
20538         echo "However, your C preprocessor defines the following symbols:"
20539         $cat Cppsym.true
20540         ccsymbols=''
20541         cppsymbols=`$cat Cppsym.true`
20542         cppsymbols=`echo $cppsymbols`
20543         cppccsymbols="$cppsymbols"
20544 else
20545         if $test -s ccsym.com; then
20546                 echo "Your C compiler and pre-processor define these symbols:"
20547                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20548                 also='also '
20549                 symbols='ones'
20550                 cppccsymbols=`$cat ccsym.com`
20551                 cppccsymbols=`echo $cppccsymbols`
20552                 $test "$silent" || sleep 1
20553         fi
20554         if $test -s ccsym.cpp; then
20555                 $test "$also" && echo " "
20556                 echo "Your C pre-processor ${also}defines the following symbols:"
20557                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20558                 also='further '
20559                 cppsymbols=`$cat ccsym.cpp`
20560                 cppsymbols=`echo $cppsymbols`
20561                 $test "$silent" || sleep 1
20562         fi
20563         if $test -s ccsym.own; then
20564                 $test "$also" && echo " "
20565                 echo "Your C compiler ${also}defines the following cpp symbols:"
20566                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20567                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20568                 ccsymbols=`$cat ccsym.own`
20569                 ccsymbols=`echo $ccsymbols`
20570                 $test "$silent" || sleep 1
20571         fi
20572 fi
20573
20574 : see if this is a termio system
20575 val="$undef"
20576 val2="$undef"
20577 val3="$undef"
20578 if $test `./findhdr termios.h`; then
20579         set tcsetattr i_termios
20580         eval $inlibc
20581         val3="$i_termios"
20582 fi
20583 echo " "
20584 case "$val3" in
20585 "$define") echo "You have POSIX termios.h... good!" >&4;;
20586 *) if ./Cppsym pyr; then
20587                 case "`/bin/universe`" in
20588                 ucb) if $test `./findhdr sgtty.h`; then
20589                                 val2="$define"
20590                                 echo "<sgtty.h> found." >&4
20591                         else
20592                                 echo "System is pyramid with BSD universe."
20593                                 echo "<sgtty.h> not found--you could have problems." >&4
20594                         fi;;
20595                 *) if $test `./findhdr termio.h`; then
20596                                 val="$define"
20597                                 echo "<termio.h> found." >&4
20598                         else
20599                                 echo "System is pyramid with USG universe."
20600                                 echo "<termio.h> not found--you could have problems." >&4
20601                         fi;;
20602                 esac
20603         elif ./usg; then
20604                 if $test `./findhdr termio.h`; then
20605                         echo "<termio.h> found." >&4
20606                         val="$define"
20607                 elif $test `./findhdr sgtty.h`; then
20608                         echo "<sgtty.h> found." >&4
20609                         val2="$define"
20610                 else
20611 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20612                 fi
20613         else
20614                 if $test `./findhdr sgtty.h`; then
20615                         echo "<sgtty.h> found." >&4
20616                         val2="$define"
20617                 elif $test `./findhdr termio.h`; then
20618                         echo "<termio.h> found." >&4
20619                         val="$define"
20620                 else
20621 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20622                 fi
20623         fi;;
20624 esac
20625 set i_termio; eval $setvar
20626 val=$val2; set i_sgtty; eval $setvar
20627 val=$val3; set i_termios; eval $setvar
20628
20629 : see if stddef is available
20630 set stddef.h i_stddef
20631 eval $inhdr
20632
20633 : see if this is a sunmath.h system
20634 set sunmath.h i_sunmath
20635 eval $inhdr
20636
20637 : see if sys/access.h is available
20638 set sys/access.h i_sysaccess
20639 eval $inhdr
20640
20641 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20642 set sys/filio.h i_sysfilio
20643 eval $inhdr
20644 echo " "
20645 if $test `./findhdr sys/ioctl.h`; then
20646         val="$define"
20647         echo '<sys/ioctl.h> found.' >&4
20648 else
20649         val="$undef"
20650         if $test $i_sysfilio = "$define"; then
20651             echo '<sys/ioctl.h> NOT found.' >&4
20652         else
20653                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20654                 $test $i_termio = "$define" && xxx="termio.h"
20655                 $test $i_termios = "$define" && xxx="termios.h"
20656 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20657         fi
20658 fi
20659 set i_sysioctl
20660 eval $setvar
20661
20662 : see if socket ioctl defs are in sys/sockio.h
20663 echo " "
20664 xxx=`./findhdr sys/sockio.h`
20665 if $test "$xxx"; then
20666         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20667                 val="$define"
20668                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20669         else
20670                 val="$undef"
20671                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20672         fi
20673 else
20674         val="$undef"
20675         $cat <<EOM
20676 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20677 EOM
20678 fi
20679 set i_syssockio
20680 eval $setvar
20681
20682
20683 : see if this is a syslog.h system
20684 set syslog.h i_syslog
20685 eval $inhdr
20686
20687
20688 : see if this is a sys/mode.h system
20689 set sys/mode.h i_sysmode
20690 eval $inhdr
20691
20692 : see if sys/resource.h has to be included
20693 set sys/resource.h i_sysresrc
20694 eval $inhdr
20695
20696 : see if sys/security.h is available
20697 set sys/security.h i_syssecrt
20698 eval $inhdr
20699
20700 : see if this is a sys/statvfs.h system
20701 set sys/statvfs.h i_sysstatvfs
20702 eval $inhdr
20703
20704 : see if this is a sys/un.h system
20705 set sys/un.h i_sysun
20706 eval $inhdr
20707
20708
20709 : see if this is a sys/utsname.h system
20710 set sys/utsname.h i_sysutsname
20711 eval $inhdr
20712
20713 : see if this is a syswait system
20714 set sys/wait.h i_syswait
20715 eval $inhdr
20716
20717 : see if this is a ustat.h system
20718 set ustat.h i_ustat
20719 eval $inhdr
20720
20721 : see if this is an utime system
20722 set utime.h i_utime
20723 eval $inhdr
20724
20725 : see if this is a values.h system
20726 set values.h i_values
20727 eval $inhdr
20728
20729 : see if this is a vfork system
20730 case "$d_vfork" in
20731 "$define")
20732         set vfork.h i_vfork
20733         eval $inhdr
20734         ;;
20735 *)
20736         i_vfork="$undef"
20737         ;;
20738 esac
20739
20740 : see if gdbm.h is available
20741 set gdbm.h t_gdbm
20742 eval $inhdr
20743 case "$t_gdbm" in
20744 $define)
20745         : see if gdbm_open exists
20746         set gdbm_open d_gdbm_open
20747         eval $inlibc
20748         case "$d_gdbm_open" in
20749         $undef)
20750                 t_gdbm="$undef"
20751                 echo "We won't be including <gdbm.h>"
20752                 ;;
20753         esac
20754         ;;
20755 esac
20756 val="$t_gdbm"
20757 set i_gdbm
20758 eval $setvar
20759
20760 echo " "
20761 echo "Looking for extensions..." >&4
20762 : If we are using the old config.sh, known_extensions may contain
20763 : old or inaccurate or duplicate values.
20764 known_extensions=''
20765 nonxs_extensions=''
20766 : We do not use find because it might not be available.
20767 : We do not just use MANIFEST because the user may have dropped
20768 : some additional extensions into the source tree and expect them
20769 : to be built.
20770
20771 : Function to recursively find available extensions, ignoring DynaLoader
20772 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20773 find_extensions='
20774     for xxx in *; do
20775        case "$xxx" in
20776            DynaLoader|dynaload) ;;
20777            *)
20778            if $test -f $xxx/$xxx.xs; then
20779                known_extensions="$known_extensions $1$xxx";
20780            elif $test -f $xxx/Makefile.PL; then
20781                nonxs_extensions="$nonxs_extensions $1$xxx";
20782            else
20783                if $test -d $xxx -a $# -lt 10; then
20784                    set $1$xxx/ $*;
20785                    cd "$xxx";
20786                    eval $find_extensions;
20787                    cd ..;
20788                    shift;
20789                fi;
20790            fi
20791            ;;
20792        esac;
20793     done'
20794 tdir=`pwd`
20795 cd "$rsrc/ext"
20796 set X
20797 shift
20798 eval $find_extensions
20799 # Special case:  Add in threads/shared since it is not picked up by the
20800 # recursive find above (and adding in general recursive finding breaks
20801 # SDBM_File/sdbm).  A.D.  10/25/2001.
20802 known_extensions="$known_extensions threads/shared"
20803 set X $nonxs_extensions
20804 shift
20805 nonxs_extensions="$*"
20806 set X $known_extensions
20807 shift
20808 known_extensions="$*"
20809 cd "$tdir"
20810
20811 : Now see which are supported on this system.
20812 avail_ext=''
20813 for xxx in $known_extensions ; do
20814         case "$xxx" in
20815         DB_File|db_file)
20816                 case "$i_db" in
20817                 $define) avail_ext="$avail_ext $xxx" ;;
20818                 esac
20819                 ;;
20820         GDBM_File|gdbm_fil)
20821                 case "$i_gdbm" in 
20822                 $define) avail_ext="$avail_ext $xxx" ;;
20823                 esac
20824                 ;;
20825         I18N/Langinfo|i18n_lan)
20826                 case "$i_langinfo$d_nl_langinfo" in 
20827                 $define$define) avail_ext="$avail_ext $xxx" ;;
20828                 esac
20829                 ;;
20830         NDBM_File|ndbm_fil)
20831                 case "$i_ndbm" in
20832                 $define)
20833                     case "$osname-$use64bitint" in
20834                     hpux-define)
20835                         case "$libs" in
20836                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20837                         esac
20838                         ;;
20839                     *) avail_ext="$avail_ext $xxx" ;;
20840                     esac
20841                     ;;
20842                 esac
20843                 ;;
20844         ODBM_File|odbm_fil) 
20845                 case "${i_dbm}${i_rpcsvcdbm}" in
20846                 *"${define}"*)
20847                     case "$osname-$use64bitint" in
20848                     hpux-define)
20849                         case "$libs" in
20850                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20851                         esac
20852                         ;;
20853                     *) avail_ext="$avail_ext $xxx" ;;
20854                     esac
20855                     ;;
20856                 esac
20857                 ;;
20858         POSIX|posix)
20859                 case "$useposix" in
20860                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20861                 esac
20862                 ;;
20863         Opcode|opcode)
20864                 case "$useopcode" in
20865                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20866                 esac
20867                 ;;
20868         Socket|socket)
20869                 case "$d_socket" in 
20870                 true|$define|y)
20871                     case "$osname" in
20872                     beos) ;; # not unless BONE
20873                     *) avail_ext="$avail_ext $xxx" ;;
20874                     esac
20875                     ;;
20876                 esac
20877                 ;;
20878         Sys/Syslog|sys/syslog)
20879                 : XXX syslog requires socket
20880                 case "$d_socket" in 
20881                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20882                 esac
20883                 ;;
20884         Thread|thread)
20885                 case "$usethreads" in
20886                 true|$define|y)
20887                         case "$useithreads" in
20888                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20889                         esac
20890                 esac
20891                 ;;
20892         XS/APItest|xs/apitest)
20893                 # This is just for testing.  Skip it unless we have dynamic loading.
20894
20895                 case "$usedl" in
20896                 $define) avail_ext="$avail_ext $xxx" ;;
20897                 esac
20898                 ;;
20899         XS/Typemap|xs/typemap)
20900                 # This is just for testing.  Skip it unless we have dynamic loading.
20901                 case "$usedl" in
20902                 $define) avail_ext="$avail_ext $xxx" ;;
20903                 esac
20904                 ;;
20905         threads|threads/shared)
20906                 # threads and threads::shared are special cases.
20907                 # To stop people from asking "Perl 5.8.0 was supposed
20908                 # to have this new fancy threads implementation but my
20909                 # perl doesn't have it" and from people trying to
20910                 # (re)install the threads module using CPAN.pm and
20911                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20912                 # the threads.pm and threads/shared.pm will always be
20913                 # there, croaking informatively ("you need to rebuild
20914                 # all of Perl with threads, sorry") when threads haven't
20915                 # been compiled in.
20916                 # --jhi
20917                 avail_ext="$avail_ext $xxx"
20918                 ;;
20919         IPC/SysV|ipc/sysv)
20920                 : XXX Do we need a useipcsysv variable here
20921                 case "${d_msg}${d_sem}${d_shm}" in 
20922                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20923                 esac
20924                 ;;
20925         *)      avail_ext="$avail_ext $xxx"
20926                 ;;
20927         esac
20928 done
20929
20930 set X $avail_ext
20931 shift
20932 avail_ext="$*"
20933
20934 case "$onlyextensions" in
20935 '') ;;
20936 *)  keepextensions=''
20937     echo "You have requested that only certains extensions be included..." >&4
20938     for i in $onlyextensions; do
20939         case " $avail_ext " in
20940         *" $i "*)
20941             echo "Keeping extension $i."
20942             keepextensions="$keepextensions $i"
20943             ;;
20944         *) echo "Ignoring extension $i." ;;
20945         esac
20946     done
20947     avail_ext="$keepextensions"
20948     ;;
20949 esac
20950
20951 case "$noextensions" in
20952 '') ;;
20953 *)  keepextensions=''
20954     echo "You have requested that certain extensions be ignored..." >&4
20955     for i in $avail_ext; do
20956         case " $noextensions " in
20957         *" $i "*) echo "Ignoring extension $i." ;;
20958         *) echo "Keeping extension $i.";
20959            keepextensions="$keepextensions $i"
20960            ;;
20961         esac
20962     done
20963     avail_ext="$keepextensions"
20964     ;;
20965 esac
20966
20967 : Now see which nonxs extensions are supported on this system.
20968 : For now assume all are.
20969 nonxs_ext=''
20970 for xxx in $nonxs_extensions ; do
20971         case "$xxx" in
20972         *)      nonxs_ext="$nonxs_ext $xxx"
20973                 ;;
20974         esac
20975 done
20976
20977 set X $nonxs_ext
20978 shift
20979 nonxs_ext="$*"
20980
20981 case $usedl in
20982 $define)
20983         $cat <<EOM
20984 A number of extensions are supplied with $package.  You may choose to
20985 compile these extensions for dynamic loading (the default), compile
20986 them into the $package executable (static loading), or not include
20987 them at all.  Answer "none" to include no extensions.
20988 Note that DynaLoader is always built and need not be mentioned here.
20989
20990 EOM
20991         case "$dynamic_ext" in
20992         '')
20993                 : Exclude those listed in static_ext
20994                 dflt=''
20995                 for xxx in $avail_ext; do
20996                         case " $static_ext " in
20997                         *" $xxx "*) ;;
20998                         *) dflt="$dflt $xxx" ;;
20999                         esac
21000                 done
21001                 set X $dflt
21002                 shift
21003                 dflt="$*"
21004                 ;;
21005         *)      dflt="$dynamic_ext"
21006                 # Perhaps we are reusing an old out-of-date config.sh.
21007                 case "$hint" in
21008                 previous)
21009                         if test X"$dynamic_ext" != X"$avail_ext"; then
21010                                 $cat <<EOM
21011 NOTICE:  Your previous config.sh list may be incorrect. 
21012 The extensions now available to you are 
21013         ${avail_ext}
21014 but the default list from your previous config.sh is
21015         ${dynamic_ext} 
21016
21017 EOM
21018                         fi
21019                         ;;
21020                 esac
21021                 ;;
21022         esac
21023         case "$dflt" in
21024         '')     dflt=none;;
21025         esac
21026         rp="What extensions do you wish to load dynamically?"
21027         . ./myread
21028         case "$ans" in
21029         none) dynamic_ext=' ' ;;
21030         *) dynamic_ext="$ans" ;;
21031         esac
21032
21033         case "$static_ext" in
21034         '')
21035                 : Exclude those already listed in dynamic linking
21036                 dflt=''
21037                 for xxx in $avail_ext; do
21038                         case " $dynamic_ext " in
21039                         *" $xxx "*) ;;
21040                         *) dflt="$dflt $xxx" ;;
21041                         esac
21042                 done
21043                 set X $dflt
21044                 shift
21045                 dflt="$*"
21046                 ;;
21047         *)  dflt="$static_ext" 
21048                 ;;
21049         esac
21050
21051         case "$dflt" in
21052         '')     dflt=none;;
21053         esac
21054         rp="What extensions do you wish to load statically?"
21055         . ./myread
21056         case "$ans" in
21057         none) static_ext=' ' ;;
21058         *) static_ext="$ans" ;;
21059         esac
21060         ;;
21061 *)
21062         $cat <<EOM
21063 A number of extensions are supplied with $package.  Answer "none" 
21064 to include no extensions. 
21065 Note that DynaLoader is always built and need not be mentioned here.
21066
21067 EOM
21068         case "$static_ext" in
21069         '') dflt="$avail_ext" ;;
21070         *)      dflt="$static_ext"
21071                 # Perhaps we are reusing an old out-of-date config.sh.
21072                 case "$hint" in
21073                 previous)
21074                         if test X"$static_ext" != X"$avail_ext"; then
21075                                 $cat <<EOM
21076 NOTICE:  Your previous config.sh list may be incorrect. 
21077 The extensions now available to you are 
21078         ${avail_ext}
21079 but the default list from your previous config.sh is
21080         ${static_ext} 
21081
21082 EOM
21083                         fi
21084                         ;;
21085                 esac
21086                 ;;
21087         esac
21088         : Exclude those that are not xs extensions
21089         case "$dflt" in
21090         '')     dflt=none;;
21091         esac
21092         rp="What extensions do you wish to include?"
21093         . ./myread
21094         case "$ans" in
21095         none) static_ext=' ' ;;
21096         *) static_ext="$ans" ;;
21097         esac
21098         ;;
21099 esac
21100 #        
21101 # Encode is a special case.  If we are building Encode as a static
21102 # extension, we need to explicitly list its subextensions as well.
21103 # For other nested extensions, this is handled automatically by
21104 # the appropriate Makefile.PL.
21105 case " $static_ext " in
21106         *" Encode "*) # Add the subextensions of Encode
21107         cd "$rsrc/ext"
21108         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21109                 static_ext="$static_ext Encode/$xxx"
21110         done
21111         cd "$tdir"
21112         ;;
21113 esac
21114
21115 set X $dynamic_ext $static_ext $nonxs_ext
21116 shift
21117 extensions="$*"
21118
21119 # Sanity check:  We require an extension suitable for use with
21120 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21121 # should show up as failures in the test suite, but it's helpful to
21122 # catch them now.) The 'extensions' list is normally sorted
21123 # alphabetically, so we need to accept either
21124 #    DB_File ... Fcntl ... IO  ....
21125 # or something like
21126 #    Fcntl ... NDBM_File ... IO  ....
21127 case " $extensions"  in
21128 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21129 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21130 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21131 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21132    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21133    ;;
21134 esac
21135
21136 : Remove libraries needed only for extensions
21137 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21138 : The exception is SunOS 4.x, which needs them.
21139 case "${osname}X${osvers}" in
21140 sunos*X4*)
21141     perllibs="$libs"
21142     ;;
21143 *) case "$usedl" in
21144     $define|true|[yY]*)
21145             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21146             shift
21147             perllibs="$*"
21148             ;;
21149     *)  perllibs="$libs"
21150             ;;
21151     esac
21152     ;;
21153 esac
21154
21155 : Remove build directory name from cppstdin so it can be used from
21156 : either the present location or the final installed location.
21157 echo " "
21158 : Get out of the UU directory to get correct path name.
21159 cd ..
21160 case "$cppstdin" in
21161 `pwd`/cppstdin)
21162         echo "Stripping down cppstdin path name"
21163         cppstdin=cppstdin
21164         ;;
21165 esac
21166 cd UU
21167
21168 : end of configuration questions
21169 echo " "
21170 echo "End of configuration questions."
21171 echo " "
21172
21173 : back to where it started
21174 if test -d ../UU; then
21175         cd ..
21176 fi
21177
21178 : configuration may be patched via a 'config.arch' file
21179 if $test -f config.arch; then
21180         echo "I see a config.arch file, loading it."
21181         . ./config.arch
21182 fi
21183
21184 : configuration may be patched via a 'config.over' file
21185 if $test -f config.over; then
21186         echo " "
21187         dflt=y
21188         rp='I see a config.over file.  Do you wish to load it?'
21189         . UU/myread
21190         case "$ans" in
21191         n*) echo "OK, I'll ignore it.";;
21192         *)      . ./config.over
21193                 echo "Configuration override changes have been loaded."
21194                 ;;
21195         esac
21196 fi
21197
21198 : in case they want portability, strip down executable paths
21199 case "$d_portable" in
21200 "$define")
21201         echo " "
21202         echo "Stripping down executable paths..." >&4
21203         for file in $loclist $trylist; do
21204                 eval temp=\$$file
21205                 eval $file=`basename $temp`
21206         done
21207         ;;
21208 esac
21209
21210 : create config.sh file
21211 echo " "
21212 echo "Creating config.sh..." >&4
21213 $spitshell <<EOT >config.sh
21214 $startsh
21215 #
21216 # This file was produced by running the Configure script. It holds all the
21217 # definitions figured out by Configure. Should you modify one of these values,
21218 # do not forget to propagate your changes by running "Configure -der". You may
21219 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21220 #
21221
21222 # Package name      : $package
21223 # Source directory  : $src
21224 # Configuration time: $cf_time
21225 # Configured by     : $cf_by
21226 # Target system     : $myuname
21227
21228 Author='$Author'
21229 Date='$Date'
21230 Header='$Header'
21231 Id='$Id'
21232 Locker='$Locker'
21233 Log='$Log'
21234 Mcc='$Mcc'
21235 RCSfile='$RCSfile'
21236 Revision='$Revision'
21237 Source='$Source'
21238 State='$State'
21239 _a='$_a'
21240 _exe='$_exe'
21241 _o='$_o'
21242 afs='$afs'
21243 afsroot='$afsroot'
21244 alignbytes='$alignbytes'
21245 ansi2knr='$ansi2knr'
21246 aphostname='$aphostname'
21247 api_revision='$api_revision'
21248 api_subversion='$api_subversion'
21249 api_version='$api_version'
21250 api_versionstring='$api_versionstring'
21251 ar='$ar'
21252 archlib='$archlib'
21253 archlibexp='$archlibexp'
21254 archname64='$archname64'
21255 archname='$archname'
21256 archobjs='$archobjs'
21257 asctime_r_proto='$asctime_r_proto'
21258 awk='$awk'
21259 baserev='$baserev'
21260 bash='$bash'
21261 bin='$bin'
21262 binexp='$binexp'
21263 bison='$bison'
21264 byacc='$byacc'
21265 byteorder='$byteorder'
21266 c='$c'
21267 castflags='$castflags'
21268 cat='$cat'
21269 cc='$cc'
21270 cccdlflags='$cccdlflags'
21271 ccdlflags='$ccdlflags'
21272 ccflags='$ccflags'
21273 ccflags_uselargefiles='$ccflags_uselargefiles'
21274 ccname='$ccname'
21275 ccsymbols='$ccsymbols'
21276 ccversion='$ccversion'
21277 cf_by='$cf_by'
21278 cf_email='$cf_email'
21279 cf_time='$cf_time'
21280 charsize='$charsize'
21281 chgrp='$chgrp'
21282 chmod='$chmod'
21283 chown='$chown'
21284 clocktype='$clocktype'
21285 comm='$comm'
21286 compress='$compress'
21287 contains='$contains'
21288 cp='$cp'
21289 cpio='$cpio'
21290 cpp='$cpp'
21291 cpp_stuff='$cpp_stuff'
21292 cppccsymbols='$cppccsymbols'
21293 cppflags='$cppflags'
21294 cpplast='$cpplast'
21295 cppminus='$cppminus'
21296 cpprun='$cpprun'
21297 cppstdin='$cppstdin'
21298 cppsymbols='$cppsymbols'
21299 crypt_r_proto='$crypt_r_proto'
21300 cryptlib='$cryptlib'
21301 csh='$csh'
21302 ctermid_r_proto='$ctermid_r_proto'
21303 ctime_r_proto='$ctime_r_proto'
21304 d_Gconvert='$d_Gconvert'
21305 d_PRIEUldbl='$d_PRIEUldbl'
21306 d_PRIFUldbl='$d_PRIFUldbl'
21307 d_PRIGUldbl='$d_PRIGUldbl'
21308 d_PRIXU64='$d_PRIXU64'
21309 d_PRId64='$d_PRId64'
21310 d_PRIeldbl='$d_PRIeldbl'
21311 d_PRIfldbl='$d_PRIfldbl'
21312 d_PRIgldbl='$d_PRIgldbl'
21313 d_PRIi64='$d_PRIi64'
21314 d_PRIo64='$d_PRIo64'
21315 d_PRIu64='$d_PRIu64'
21316 d_PRIx64='$d_PRIx64'
21317 d_SCNfldbl='$d_SCNfldbl'
21318 d__fwalk='$d__fwalk'
21319 d_access='$d_access'
21320 d_accessx='$d_accessx'
21321 d_aintl='$d_aintl'
21322 d_alarm='$d_alarm'
21323 d_archlib='$d_archlib'
21324 d_asctime_r='$d_asctime_r'
21325 d_atolf='$d_atolf'
21326 d_atoll='$d_atoll'
21327 d_attribute_format='$d_attribute_format'
21328 d_attribute_malloc='$d_attribute_malloc'
21329 d_attribute_nonnull='$d_attribute_nonnull'
21330 d_attribute_noreturn='$d_attribute_noreturn'
21331 d_attribute_pure='$d_attribute_pure'
21332 d_attribute_unused='$d_attribute_unused'
21333 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21334 d_bcmp='$d_bcmp'
21335 d_bcopy='$d_bcopy'
21336 d_bsd='$d_bsd'
21337 d_bsdgetpgrp='$d_bsdgetpgrp'
21338 d_bsdsetpgrp='$d_bsdsetpgrp'
21339 d_builtin_choose_expr='$d_builtin_choose_expr'
21340 d_builtin_expect='$d_builtin_expect'
21341 d_bzero='$d_bzero'
21342 d_c99_variadic_macros='$d_c99_variadic_macros'
21343 d_casti32='$d_casti32'
21344 d_castneg='$d_castneg'
21345 d_charvspr='$d_charvspr'
21346 d_chown='$d_chown'
21347 d_chroot='$d_chroot'
21348 d_chsize='$d_chsize'
21349 d_class='$d_class'
21350 d_clearenv='$d_clearenv'
21351 d_closedir='$d_closedir'
21352 d_cmsghdr_s='$d_cmsghdr_s'
21353 d_const='$d_const'
21354 d_copysignl='$d_copysignl'
21355 d_cplusplus='$d_cplusplus'
21356 d_crypt='$d_crypt'
21357 d_crypt_r='$d_crypt_r'
21358 d_csh='$d_csh'
21359 d_ctermid_r='$d_ctermid_r'
21360 d_ctime_r='$d_ctime_r'
21361 d_cuserid='$d_cuserid'
21362 d_dbl_dig='$d_dbl_dig'
21363 d_dbminitproto='$d_dbminitproto'
21364 d_difftime='$d_difftime'
21365 d_dirfd='$d_dirfd'
21366 d_dirnamlen='$d_dirnamlen'
21367 d_dlerror='$d_dlerror'
21368 d_dlopen='$d_dlopen'
21369 d_dlsymun='$d_dlsymun'
21370 d_dosuid='$d_dosuid'
21371 d_drand48_r='$d_drand48_r'
21372 d_drand48proto='$d_drand48proto'
21373 d_dup2='$d_dup2'
21374 d_eaccess='$d_eaccess'
21375 d_endgrent='$d_endgrent'
21376 d_endgrent_r='$d_endgrent_r'
21377 d_endhent='$d_endhent'
21378 d_endhostent_r='$d_endhostent_r'
21379 d_endnent='$d_endnent'
21380 d_endnetent_r='$d_endnetent_r'
21381 d_endpent='$d_endpent'
21382 d_endprotoent_r='$d_endprotoent_r'
21383 d_endpwent='$d_endpwent'
21384 d_endpwent_r='$d_endpwent_r'
21385 d_endsent='$d_endsent'
21386 d_endservent_r='$d_endservent_r'
21387 d_eofnblk='$d_eofnblk'
21388 d_eunice='$d_eunice'
21389 d_faststdio='$d_faststdio'
21390 d_fchdir='$d_fchdir'
21391 d_fchmod='$d_fchmod'
21392 d_fchown='$d_fchown'
21393 d_fcntl='$d_fcntl'
21394 d_fcntl_can_lock='$d_fcntl_can_lock'
21395 d_fd_macros='$d_fd_macros'
21396 d_fd_set='$d_fd_set'
21397 d_fds_bits='$d_fds_bits'
21398 d_fgetpos='$d_fgetpos'
21399 d_finite='$d_finite'
21400 d_finitel='$d_finitel'
21401 d_flexfnam='$d_flexfnam'
21402 d_flock='$d_flock'
21403 d_flockproto='$d_flockproto'
21404 d_fork='$d_fork'
21405 d_fp_class='$d_fp_class'
21406 d_fpathconf='$d_fpathconf'
21407 d_fpclass='$d_fpclass'
21408 d_fpclassify='$d_fpclassify'
21409 d_fpclassl='$d_fpclassl'
21410 d_fpos64_t='$d_fpos64_t'
21411 d_frexpl='$d_frexpl'
21412 d_fs_data_s='$d_fs_data_s'
21413 d_fseeko='$d_fseeko'
21414 d_fsetpos='$d_fsetpos'
21415 d_fstatfs='$d_fstatfs'
21416 d_fstatvfs='$d_fstatvfs'
21417 d_fsync='$d_fsync'
21418 d_ftello='$d_ftello'
21419 d_ftime='$d_ftime'
21420 d_futimes='$d_futimes'
21421 d_getcwd='$d_getcwd'
21422 d_getespwnam='$d_getespwnam'
21423 d_getfsstat='$d_getfsstat'
21424 d_getgrent='$d_getgrent'
21425 d_getgrent_r='$d_getgrent_r'
21426 d_getgrgid_r='$d_getgrgid_r'
21427 d_getgrnam_r='$d_getgrnam_r'
21428 d_getgrps='$d_getgrps'
21429 d_gethbyaddr='$d_gethbyaddr'
21430 d_gethbyname='$d_gethbyname'
21431 d_gethent='$d_gethent'
21432 d_gethname='$d_gethname'
21433 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21434 d_gethostbyname_r='$d_gethostbyname_r'
21435 d_gethostent_r='$d_gethostent_r'
21436 d_gethostprotos='$d_gethostprotos'
21437 d_getitimer='$d_getitimer'
21438 d_getlogin='$d_getlogin'
21439 d_getlogin_r='$d_getlogin_r'
21440 d_getmnt='$d_getmnt'
21441 d_getmntent='$d_getmntent'
21442 d_getnbyaddr='$d_getnbyaddr'
21443 d_getnbyname='$d_getnbyname'
21444 d_getnent='$d_getnent'
21445 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21446 d_getnetbyname_r='$d_getnetbyname_r'
21447 d_getnetent_r='$d_getnetent_r'
21448 d_getnetprotos='$d_getnetprotos'
21449 d_getpagsz='$d_getpagsz'
21450 d_getpbyname='$d_getpbyname'
21451 d_getpbynumber='$d_getpbynumber'
21452 d_getpent='$d_getpent'
21453 d_getpgid='$d_getpgid'
21454 d_getpgrp2='$d_getpgrp2'
21455 d_getpgrp='$d_getpgrp'
21456 d_getppid='$d_getppid'
21457 d_getprior='$d_getprior'
21458 d_getprotobyname_r='$d_getprotobyname_r'
21459 d_getprotobynumber_r='$d_getprotobynumber_r'
21460 d_getprotoent_r='$d_getprotoent_r'
21461 d_getprotoprotos='$d_getprotoprotos'
21462 d_getprpwnam='$d_getprpwnam'
21463 d_getpwent='$d_getpwent'
21464 d_getpwent_r='$d_getpwent_r'
21465 d_getpwnam_r='$d_getpwnam_r'
21466 d_getpwuid_r='$d_getpwuid_r'
21467 d_getsbyname='$d_getsbyname'
21468 d_getsbyport='$d_getsbyport'
21469 d_getsent='$d_getsent'
21470 d_getservbyname_r='$d_getservbyname_r'
21471 d_getservbyport_r='$d_getservbyport_r'
21472 d_getservent_r='$d_getservent_r'
21473 d_getservprotos='$d_getservprotos'
21474 d_getspnam='$d_getspnam'
21475 d_getspnam_r='$d_getspnam_r'
21476 d_gettimeod='$d_gettimeod'
21477 d_gmtime_r='$d_gmtime_r'
21478 d_gnulibc='$d_gnulibc'
21479 d_grpasswd='$d_grpasswd'
21480 d_hasmntopt='$d_hasmntopt'
21481 d_htonl='$d_htonl'
21482 d_ilogbl='$d_ilogbl'
21483 d_inc_version_list='$d_inc_version_list'
21484 d_index='$d_index'
21485 d_inetaton='$d_inetaton'
21486 d_int64_t='$d_int64_t'
21487 d_isascii='$d_isascii'
21488 d_isfinite='$d_isfinite'
21489 d_isinf='$d_isinf'
21490 d_isnan='$d_isnan'
21491 d_isnanl='$d_isnanl'
21492 d_killpg='$d_killpg'
21493 d_lchown='$d_lchown'
21494 d_ldbl_dig='$d_ldbl_dig'
21495 d_libm_lib_version='$d_libm_lib_version'
21496 d_link='$d_link'
21497 d_localtime_r='$d_localtime_r'
21498 d_locconv='$d_locconv'
21499 d_lockf='$d_lockf'
21500 d_longdbl='$d_longdbl'
21501 d_longlong='$d_longlong'
21502 d_lseekproto='$d_lseekproto'
21503 d_lstat='$d_lstat'
21504 d_madvise='$d_madvise'
21505 d_malloc_good_size='$d_malloc_good_size'
21506 d_malloc_size='$d_malloc_size'
21507 d_mblen='$d_mblen'
21508 d_mbstowcs='$d_mbstowcs'
21509 d_mbtowc='$d_mbtowc'
21510 d_memchr='$d_memchr'
21511 d_memcmp='$d_memcmp'
21512 d_memcpy='$d_memcpy'
21513 d_memmove='$d_memmove'
21514 d_memset='$d_memset'
21515 d_mkdir='$d_mkdir'
21516 d_mkdtemp='$d_mkdtemp'
21517 d_mkfifo='$d_mkfifo'
21518 d_mkstemp='$d_mkstemp'
21519 d_mkstemps='$d_mkstemps'
21520 d_mktime='$d_mktime'
21521 d_mmap='$d_mmap'
21522 d_modfl='$d_modfl'
21523 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21524 d_modflproto='$d_modflproto'
21525 d_mprotect='$d_mprotect'
21526 d_msg='$d_msg'
21527 d_msg_ctrunc='$d_msg_ctrunc'
21528 d_msg_dontroute='$d_msg_dontroute'
21529 d_msg_oob='$d_msg_oob'
21530 d_msg_peek='$d_msg_peek'
21531 d_msg_proxy='$d_msg_proxy'
21532 d_msgctl='$d_msgctl'
21533 d_msgget='$d_msgget'
21534 d_msghdr_s='$d_msghdr_s'
21535 d_msgrcv='$d_msgrcv'
21536 d_msgsnd='$d_msgsnd'
21537 d_msync='$d_msync'
21538 d_munmap='$d_munmap'
21539 d_mymalloc='$d_mymalloc'
21540 d_nice='$d_nice'
21541 d_nl_langinfo='$d_nl_langinfo'
21542 d_nv_preserves_uv='$d_nv_preserves_uv'
21543 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21544 d_off64_t='$d_off64_t'
21545 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21546 d_oldpthreads='$d_oldpthreads'
21547 d_oldsock='$d_oldsock'
21548 d_open3='$d_open3'
21549 d_pathconf='$d_pathconf'
21550 d_pause='$d_pause'
21551 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21552 d_phostname='$d_phostname'
21553 d_pipe='$d_pipe'
21554 d_poll='$d_poll'
21555 d_portable='$d_portable'
21556 d_procselfexe='$d_procselfexe'
21557 d_pthread_atfork='$d_pthread_atfork'
21558 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21559 d_pthread_yield='$d_pthread_yield'
21560 d_pwage='$d_pwage'
21561 d_pwchange='$d_pwchange'
21562 d_pwclass='$d_pwclass'
21563 d_pwcomment='$d_pwcomment'
21564 d_pwexpire='$d_pwexpire'
21565 d_pwgecos='$d_pwgecos'
21566 d_pwpasswd='$d_pwpasswd'
21567 d_pwquota='$d_pwquota'
21568 d_qgcvt='$d_qgcvt'
21569 d_quad='$d_quad'
21570 d_random_r='$d_random_r'
21571 d_readdir64_r='$d_readdir64_r'
21572 d_readdir='$d_readdir'
21573 d_readdir_r='$d_readdir_r'
21574 d_readlink='$d_readlink'
21575 d_readv='$d_readv'
21576 d_recvmsg='$d_recvmsg'
21577 d_rename='$d_rename'
21578 d_rewinddir='$d_rewinddir'
21579 d_rmdir='$d_rmdir'
21580 d_safebcpy='$d_safebcpy'
21581 d_safemcpy='$d_safemcpy'
21582 d_sanemcmp='$d_sanemcmp'
21583 d_sbrkproto='$d_sbrkproto'
21584 d_scalbnl='$d_scalbnl'
21585 d_sched_yield='$d_sched_yield'
21586 d_scm_rights='$d_scm_rights'
21587 d_seekdir='$d_seekdir'
21588 d_select='$d_select'
21589 d_sem='$d_sem'
21590 d_semctl='$d_semctl'
21591 d_semctl_semid_ds='$d_semctl_semid_ds'
21592 d_semctl_semun='$d_semctl_semun'
21593 d_semget='$d_semget'
21594 d_semop='$d_semop'
21595 d_sendmsg='$d_sendmsg'
21596 d_setegid='$d_setegid'
21597 d_seteuid='$d_seteuid'
21598 d_setgrent='$d_setgrent'
21599 d_setgrent_r='$d_setgrent_r'
21600 d_setgrps='$d_setgrps'
21601 d_sethent='$d_sethent'
21602 d_sethostent_r='$d_sethostent_r'
21603 d_setitimer='$d_setitimer'
21604 d_setlinebuf='$d_setlinebuf'
21605 d_setlocale='$d_setlocale'
21606 d_setlocale_r='$d_setlocale_r'
21607 d_setnent='$d_setnent'
21608 d_setnetent_r='$d_setnetent_r'
21609 d_setpent='$d_setpent'
21610 d_setpgid='$d_setpgid'
21611 d_setpgrp2='$d_setpgrp2'
21612 d_setpgrp='$d_setpgrp'
21613 d_setprior='$d_setprior'
21614 d_setproctitle='$d_setproctitle'
21615 d_setprotoent_r='$d_setprotoent_r'
21616 d_setpwent='$d_setpwent'
21617 d_setpwent_r='$d_setpwent_r'
21618 d_setregid='$d_setregid'
21619 d_setresgid='$d_setresgid'
21620 d_setresuid='$d_setresuid'
21621 d_setreuid='$d_setreuid'
21622 d_setrgid='$d_setrgid'
21623 d_setruid='$d_setruid'
21624 d_setsent='$d_setsent'
21625 d_setservent_r='$d_setservent_r'
21626 d_setsid='$d_setsid'
21627 d_setvbuf='$d_setvbuf'
21628 d_sfio='$d_sfio'
21629 d_shm='$d_shm'
21630 d_shmat='$d_shmat'
21631 d_shmatprototype='$d_shmatprototype'
21632 d_shmctl='$d_shmctl'
21633 d_shmdt='$d_shmdt'
21634 d_shmget='$d_shmget'
21635 d_sigaction='$d_sigaction'
21636 d_sigprocmask='$d_sigprocmask'
21637 d_sigsetjmp='$d_sigsetjmp'
21638 d_sitearch='$d_sitearch'
21639 d_snprintf='$d_snprintf'
21640 d_sockatmark='$d_sockatmark'
21641 d_sockatmarkproto='$d_sockatmarkproto'
21642 d_socket='$d_socket'
21643 d_socklen_t='$d_socklen_t'
21644 d_sockpair='$d_sockpair'
21645 d_socks5_init='$d_socks5_init'
21646 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21647 d_sqrtl='$d_sqrtl'
21648 d_srand48_r='$d_srand48_r'
21649 d_srandom_r='$d_srandom_r'
21650 d_sresgproto='$d_sresgproto'
21651 d_sresuproto='$d_sresuproto'
21652 d_statblks='$d_statblks'
21653 d_statfs_f_flags='$d_statfs_f_flags'
21654 d_statfs_s='$d_statfs_s'
21655 d_statvfs='$d_statvfs'
21656 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21657 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21658 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21659 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21660 d_stdio_stream_array='$d_stdio_stream_array'
21661 d_stdiobase='$d_stdiobase'
21662 d_stdstdio='$d_stdstdio'
21663 d_strchr='$d_strchr'
21664 d_strcoll='$d_strcoll'
21665 d_strctcpy='$d_strctcpy'
21666 d_strerrm='$d_strerrm'
21667 d_strerror='$d_strerror'
21668 d_strerror_r='$d_strerror_r'
21669 d_strftime='$d_strftime'
21670 d_strlcat='$d_strlcat'
21671 d_strlcpy='$d_strlcpy'
21672 d_strtod='$d_strtod'
21673 d_strtol='$d_strtol'
21674 d_strtold='$d_strtold'
21675 d_strtoll='$d_strtoll'
21676 d_strtoq='$d_strtoq'
21677 d_strtoul='$d_strtoul'
21678 d_strtoull='$d_strtoull'
21679 d_strtouq='$d_strtouq'
21680 d_strxfrm='$d_strxfrm'
21681 d_suidsafe='$d_suidsafe'
21682 d_symlink='$d_symlink'
21683 d_syscall='$d_syscall'
21684 d_syscallproto='$d_syscallproto'
21685 d_sysconf='$d_sysconf'
21686 d_sysernlst='$d_sysernlst'
21687 d_syserrlst='$d_syserrlst'
21688 d_system='$d_system'
21689 d_tcgetpgrp='$d_tcgetpgrp'
21690 d_tcsetpgrp='$d_tcsetpgrp'
21691 d_telldir='$d_telldir'
21692 d_telldirproto='$d_telldirproto'
21693 d_time='$d_time'
21694 d_times='$d_times'
21695 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21696 d_tm_tm_zone='$d_tm_tm_zone'
21697 d_tmpnam_r='$d_tmpnam_r'
21698 d_truncate='$d_truncate'
21699 d_ttyname_r='$d_ttyname_r'
21700 d_tzname='$d_tzname'
21701 d_u32align='$d_u32align'
21702 d_ualarm='$d_ualarm'
21703 d_umask='$d_umask'
21704 d_uname='$d_uname'
21705 d_union_semun='$d_union_semun'
21706 d_unordered='$d_unordered'
21707 d_unsetenv='$d_unsetenv'
21708 d_usleep='$d_usleep'
21709 d_usleepproto='$d_usleepproto'
21710 d_ustat='$d_ustat'
21711 d_vendorarch='$d_vendorarch'
21712 d_vendorbin='$d_vendorbin'
21713 d_vendorlib='$d_vendorlib'
21714 d_vendorscript='$d_vendorscript'
21715 d_vfork='$d_vfork'
21716 d_void_closedir='$d_void_closedir'
21717 d_voidsig='$d_voidsig'
21718 d_voidtty='$d_voidtty'
21719 d_volatile='$d_volatile'
21720 d_vprintf='$d_vprintf'
21721 d_vsnprintf='$d_vsnprintf'
21722 d_wait4='$d_wait4'
21723 d_waitpid='$d_waitpid'
21724 d_wcstombs='$d_wcstombs'
21725 d_wctomb='$d_wctomb'
21726 d_writev='$d_writev'
21727 d_xenix='$d_xenix'
21728 date='$date'
21729 db_hashtype='$db_hashtype'
21730 db_prefixtype='$db_prefixtype'
21731 db_version_major='$db_version_major'
21732 db_version_minor='$db_version_minor'
21733 db_version_patch='$db_version_patch'
21734 defvoidused='$defvoidused'
21735 direntrytype='$direntrytype'
21736 dlext='$dlext'
21737 dlsrc='$dlsrc'
21738 doublesize='$doublesize'
21739 drand01='$drand01'
21740 drand48_r_proto='$drand48_r_proto'
21741 dynamic_ext='$dynamic_ext'
21742 eagain='$eagain'
21743 ebcdic='$ebcdic'
21744 echo='$echo'
21745 egrep='$egrep'
21746 emacs='$emacs'
21747 endgrent_r_proto='$endgrent_r_proto'
21748 endhostent_r_proto='$endhostent_r_proto'
21749 endnetent_r_proto='$endnetent_r_proto'
21750 endprotoent_r_proto='$endprotoent_r_proto'
21751 endpwent_r_proto='$endpwent_r_proto'
21752 endservent_r_proto='$endservent_r_proto'
21753 eunicefix='$eunicefix'
21754 exe_ext='$exe_ext'
21755 expr='$expr'
21756 extensions='$extensions'
21757 extras='$extras'
21758 fflushNULL='$fflushNULL'
21759 fflushall='$fflushall'
21760 find='$find'
21761 firstmakefile='$firstmakefile'
21762 flex='$flex'
21763 fpossize='$fpossize'
21764 fpostype='$fpostype'
21765 freetype='$freetype'
21766 from='$from'
21767 full_ar='$full_ar'
21768 full_csh='$full_csh'
21769 full_sed='$full_sed'
21770 gccansipedantic='$gccansipedantic'
21771 gccosandvers='$gccosandvers'
21772 gccversion='$gccversion'
21773 getgrent_r_proto='$getgrent_r_proto'
21774 getgrgid_r_proto='$getgrgid_r_proto'
21775 getgrnam_r_proto='$getgrnam_r_proto'
21776 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21777 gethostbyname_r_proto='$gethostbyname_r_proto'
21778 gethostent_r_proto='$gethostent_r_proto'
21779 getlogin_r_proto='$getlogin_r_proto'
21780 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21781 getnetbyname_r_proto='$getnetbyname_r_proto'
21782 getnetent_r_proto='$getnetent_r_proto'
21783 getprotobyname_r_proto='$getprotobyname_r_proto'
21784 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21785 getprotoent_r_proto='$getprotoent_r_proto'
21786 getpwent_r_proto='$getpwent_r_proto'
21787 getpwnam_r_proto='$getpwnam_r_proto'
21788 getpwuid_r_proto='$getpwuid_r_proto'
21789 getservbyname_r_proto='$getservbyname_r_proto'
21790 getservbyport_r_proto='$getservbyport_r_proto'
21791 getservent_r_proto='$getservent_r_proto'
21792 getspnam_r_proto='$getspnam_r_proto'
21793 gidformat='$gidformat'
21794 gidsign='$gidsign'
21795 gidsize='$gidsize'
21796 gidtype='$gidtype'
21797 glibpth='$glibpth'
21798 gmake='$gmake'
21799 gmtime_r_proto='$gmtime_r_proto'
21800 gnulibc_version='$gnulibc_version'
21801 grep='$grep'
21802 groupcat='$groupcat'
21803 groupstype='$groupstype'
21804 gzip='$gzip'
21805 h_fcntl='$h_fcntl'
21806 h_sysfile='$h_sysfile'
21807 hint='$hint'
21808 hostcat='$hostcat'
21809 html1dir='$html1dir'
21810 html1direxp='$html1direxp'
21811 html3dir='$html3dir'
21812 html3direxp='$html3direxp'
21813 i16size='$i16size'
21814 i16type='$i16type'
21815 i32size='$i32size'
21816 i32type='$i32type'
21817 i64size='$i64size'
21818 i64type='$i64type'
21819 i8size='$i8size'
21820 i8type='$i8type'
21821 i_arpainet='$i_arpainet'
21822 i_bsdioctl='$i_bsdioctl'
21823 i_crypt='$i_crypt'
21824 i_db='$i_db'
21825 i_dbm='$i_dbm'
21826 i_dirent='$i_dirent'
21827 i_dld='$i_dld'
21828 i_dlfcn='$i_dlfcn'
21829 i_fcntl='$i_fcntl'
21830 i_float='$i_float'
21831 i_fp='$i_fp'
21832 i_fp_class='$i_fp_class'
21833 i_gdbm='$i_gdbm'
21834 i_grp='$i_grp'
21835 i_ieeefp='$i_ieeefp'
21836 i_inttypes='$i_inttypes'
21837 i_langinfo='$i_langinfo'
21838 i_libutil='$i_libutil'
21839 i_limits='$i_limits'
21840 i_locale='$i_locale'
21841 i_machcthr='$i_machcthr'
21842 i_malloc='$i_malloc'
21843 i_math='$i_math'
21844 i_memory='$i_memory'
21845 i_mntent='$i_mntent'
21846 i_ndbm='$i_ndbm'
21847 i_netdb='$i_netdb'
21848 i_neterrno='$i_neterrno'
21849 i_netinettcp='$i_netinettcp'
21850 i_niin='$i_niin'
21851 i_poll='$i_poll'
21852 i_prot='$i_prot'
21853 i_pthread='$i_pthread'
21854 i_pwd='$i_pwd'
21855 i_rpcsvcdbm='$i_rpcsvcdbm'
21856 i_sfio='$i_sfio'
21857 i_sgtty='$i_sgtty'
21858 i_shadow='$i_shadow'
21859 i_socks='$i_socks'
21860 i_stdarg='$i_stdarg'
21861 i_stddef='$i_stddef'
21862 i_stdlib='$i_stdlib'
21863 i_string='$i_string'
21864 i_sunmath='$i_sunmath'
21865 i_sysaccess='$i_sysaccess'
21866 i_sysdir='$i_sysdir'
21867 i_sysfile='$i_sysfile'
21868 i_sysfilio='$i_sysfilio'
21869 i_sysin='$i_sysin'
21870 i_sysioctl='$i_sysioctl'
21871 i_syslog='$i_syslog'
21872 i_sysmman='$i_sysmman'
21873 i_sysmode='$i_sysmode'
21874 i_sysmount='$i_sysmount'
21875 i_sysndir='$i_sysndir'
21876 i_sysparam='$i_sysparam'
21877 i_sysresrc='$i_sysresrc'
21878 i_syssecrt='$i_syssecrt'
21879 i_sysselct='$i_sysselct'
21880 i_syssockio='$i_syssockio'
21881 i_sysstat='$i_sysstat'
21882 i_sysstatfs='$i_sysstatfs'
21883 i_sysstatvfs='$i_sysstatvfs'
21884 i_systime='$i_systime'
21885 i_systimek='$i_systimek'
21886 i_systimes='$i_systimes'
21887 i_systypes='$i_systypes'
21888 i_sysuio='$i_sysuio'
21889 i_sysun='$i_sysun'
21890 i_sysutsname='$i_sysutsname'
21891 i_sysvfs='$i_sysvfs'
21892 i_syswait='$i_syswait'
21893 i_termio='$i_termio'
21894 i_termios='$i_termios'
21895 i_time='$i_time'
21896 i_unistd='$i_unistd'
21897 i_ustat='$i_ustat'
21898 i_utime='$i_utime'
21899 i_values='$i_values'
21900 i_varargs='$i_varargs'
21901 i_varhdr='$i_varhdr'
21902 i_vfork='$i_vfork'
21903 ignore_versioned_solibs='$ignore_versioned_solibs'
21904 inc_version_list='$inc_version_list'
21905 inc_version_list_init='$inc_version_list_init'
21906 incpath='$incpath'
21907 inews='$inews'
21908 initialinstalllocation='$initialinstalllocation'
21909 installarchlib='$installarchlib'
21910 installbin='$installbin'
21911 installhtml1dir='$installhtml1dir'
21912 installhtml3dir='$installhtml3dir'
21913 installman1dir='$installman1dir'
21914 installman3dir='$installman3dir'
21915 installprefix='$installprefix'
21916 installprefixexp='$installprefixexp'
21917 installprivlib='$installprivlib'
21918 installscript='$installscript'
21919 installsitearch='$installsitearch'
21920 installsitebin='$installsitebin'
21921 installsitehtml1dir='$installsitehtml1dir'
21922 installsitehtml3dir='$installsitehtml3dir'
21923 installsitelib='$installsitelib'
21924 installsiteman1dir='$installsiteman1dir'
21925 installsiteman3dir='$installsiteman3dir'
21926 installsitescript='$installsitescript'
21927 installstyle='$installstyle'
21928 installusrbinperl='$installusrbinperl'
21929 installvendorarch='$installvendorarch'
21930 installvendorbin='$installvendorbin'
21931 installvendorhtml1dir='$installvendorhtml1dir'
21932 installvendorhtml3dir='$installvendorhtml3dir'
21933 installvendorlib='$installvendorlib'
21934 installvendorman1dir='$installvendorman1dir'
21935 installvendorman3dir='$installvendorman3dir'
21936 installvendorscript='$installvendorscript'
21937 intsize='$intsize'
21938 issymlink='$issymlink'
21939 ivdformat='$ivdformat'
21940 ivsize='$ivsize'
21941 ivtype='$ivtype'
21942 known_extensions='$known_extensions'
21943 ksh='$ksh'
21944 ld='$ld'
21945 lddlflags='$lddlflags'
21946 ldflags='$ldflags'
21947 ldflags_uselargefiles='$ldflags_uselargefiles'
21948 ldlibpthname='$ldlibpthname'
21949 less='$less'
21950 lib_ext='$lib_ext'
21951 libc='$libc'
21952 libperl='$libperl'
21953 libpth='$libpth'
21954 libs='$libs'
21955 libsdirs='$libsdirs'
21956 libsfiles='$libsfiles'
21957 libsfound='$libsfound'
21958 libspath='$libspath'
21959 libswanted='$libswanted'
21960 libswanted_uselargefiles='$libswanted_uselargefiles'
21961 line='$line'
21962 lint='$lint'
21963 lkflags='$lkflags'
21964 ln='$ln'
21965 lns='$lns'
21966 localtime_r_proto='$localtime_r_proto'
21967 locincpth='$locincpth'
21968 loclibpth='$loclibpth'
21969 longdblsize='$longdblsize'
21970 longlongsize='$longlongsize'
21971 longsize='$longsize'
21972 lp='$lp'
21973 lpr='$lpr'
21974 ls='$ls'
21975 lseeksize='$lseeksize'
21976 lseektype='$lseektype'
21977 mad='$mad'
21978 madlyh='$madlyh'
21979 madlyobj='$madlyobj'
21980 madlysrc='$madlysrc'
21981 mail='$mail'
21982 mailx='$mailx'
21983 make='$make'
21984 make_set_make='$make_set_make'
21985 mallocobj='$mallocobj'
21986 mallocsrc='$mallocsrc'
21987 malloctype='$malloctype'
21988 man1dir='$man1dir'
21989 man1direxp='$man1direxp'
21990 man1ext='$man1ext'
21991 man3dir='$man3dir'
21992 man3direxp='$man3direxp'
21993 man3ext='$man3ext'
21994 mips_type='$mips_type'
21995 mistrustnm='$mistrustnm'
21996 mkdir='$mkdir'
21997 mmaptype='$mmaptype'
21998 modetype='$modetype'
21999 more='$more'
22000 multiarch='$multiarch'
22001 mv='$mv'
22002 myarchname='$myarchname'
22003 mydomain='$mydomain'
22004 myhostname='$myhostname'
22005 myuname='$myuname'
22006 n='$n'
22007 need_va_copy='$need_va_copy'
22008 netdb_hlen_type='$netdb_hlen_type'
22009 netdb_host_type='$netdb_host_type'
22010 netdb_name_type='$netdb_name_type'
22011 netdb_net_type='$netdb_net_type'
22012 nm='$nm'
22013 nm_opt='$nm_opt'
22014 nm_so_opt='$nm_so_opt'
22015 nonxs_ext='$nonxs_ext'
22016 nroff='$nroff'
22017 nvEUformat='$nvEUformat'
22018 nvFUformat='$nvFUformat'
22019 nvGUformat='$nvGUformat'
22020 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22021 nveformat='$nveformat'
22022 nvfformat='$nvfformat'
22023 nvgformat='$nvgformat'
22024 nvsize='$nvsize'
22025 nvtype='$nvtype'
22026 o_nonblock='$o_nonblock'
22027 obj_ext='$obj_ext'
22028 old_pthread_create_joinable='$old_pthread_create_joinable'
22029 optimize='$optimize'
22030 orderlib='$orderlib'
22031 osname='$osname'
22032 osvers='$osvers'
22033 otherlibdirs='$otherlibdirs'
22034 package='$package'
22035 pager='$pager'
22036 passcat='$passcat'
22037 patchlevel='$patchlevel'
22038 path_sep='$path_sep'
22039 perl5='$perl5'
22040 perl='$perl'
22041 perl_patchlevel='$perl_patchlevel'
22042 perladmin='$perladmin'
22043 perllibs='$perllibs'
22044 perlpath='$perlpath'
22045 pg='$pg'
22046 phostname='$phostname'
22047 pidtype='$pidtype'
22048 plibpth='$plibpth'
22049 pmake='$pmake'
22050 pr='$pr'
22051 prefix='$prefix'
22052 prefixexp='$prefixexp'
22053 privlib='$privlib'
22054 privlibexp='$privlibexp'
22055 procselfexe='$procselfexe'
22056 prototype='$prototype'
22057 ptrsize='$ptrsize'
22058 quadkind='$quadkind'
22059 quadtype='$quadtype'
22060 randbits='$randbits'
22061 randfunc='$randfunc'
22062 random_r_proto='$random_r_proto'
22063 randseedtype='$randseedtype'
22064 ranlib='$ranlib'
22065 rd_nodata='$rd_nodata'
22066 readdir64_r_proto='$readdir64_r_proto'
22067 readdir_r_proto='$readdir_r_proto'
22068 revision='$revision'
22069 rm='$rm'
22070 rmail='$rmail'
22071 run='$run'
22072 runnm='$runnm'
22073 sPRIEUldbl='$sPRIEUldbl'
22074 sPRIFUldbl='$sPRIFUldbl'
22075 sPRIGUldbl='$sPRIGUldbl'
22076 sPRIXU64='$sPRIXU64'
22077 sPRId64='$sPRId64'
22078 sPRIeldbl='$sPRIeldbl'
22079 sPRIfldbl='$sPRIfldbl'
22080 sPRIgldbl='$sPRIgldbl'
22081 sPRIi64='$sPRIi64'
22082 sPRIo64='$sPRIo64'
22083 sPRIu64='$sPRIu64'
22084 sPRIx64='$sPRIx64'
22085 sSCNfldbl='$sSCNfldbl'
22086 sched_yield='$sched_yield'
22087 scriptdir='$scriptdir'
22088 scriptdirexp='$scriptdirexp'
22089 sed='$sed'
22090 seedfunc='$seedfunc'
22091 selectminbits='$selectminbits'
22092 selecttype='$selecttype'
22093 sendmail='$sendmail'
22094 setgrent_r_proto='$setgrent_r_proto'
22095 sethostent_r_proto='$sethostent_r_proto'
22096 setlocale_r_proto='$setlocale_r_proto'
22097 setnetent_r_proto='$setnetent_r_proto'
22098 setprotoent_r_proto='$setprotoent_r_proto'
22099 setpwent_r_proto='$setpwent_r_proto'
22100 setservent_r_proto='$setservent_r_proto'
22101 sh='$sh'
22102 shar='$shar'
22103 sharpbang='$sharpbang'
22104 shmattype='$shmattype'
22105 shortsize='$shortsize'
22106 shrpenv='$shrpenv'
22107 shsharp='$shsharp'
22108 sig_count='$sig_count'
22109 sig_name='$sig_name'
22110 sig_name_init='$sig_name_init'
22111 sig_num='$sig_num'
22112 sig_num_init='$sig_num_init'
22113 sig_size='$sig_size'
22114 signal_t='$signal_t'
22115 sitearch='$sitearch'
22116 sitearchexp='$sitearchexp'
22117 sitebin='$sitebin'
22118 sitebinexp='$sitebinexp'
22119 sitehtml1dir='$sitehtml1dir'
22120 sitehtml1direxp='$sitehtml1direxp'
22121 sitehtml3dir='$sitehtml3dir'
22122 sitehtml3direxp='$sitehtml3direxp'
22123 sitelib='$sitelib'
22124 sitelib_stem='$sitelib_stem'
22125 sitelibexp='$sitelibexp'
22126 siteman1dir='$siteman1dir'
22127 siteman1direxp='$siteman1direxp'
22128 siteman3dir='$siteman3dir'
22129 siteman3direxp='$siteman3direxp'
22130 siteprefix='$siteprefix'
22131 siteprefixexp='$siteprefixexp'
22132 sitescript='$sitescript'
22133 sitescriptexp='$sitescriptexp'
22134 sizesize='$sizesize'
22135 sizetype='$sizetype'
22136 sleep='$sleep'
22137 smail='$smail'
22138 so='$so'
22139 sockethdr='$sockethdr'
22140 socketlib='$socketlib'
22141 socksizetype='$socksizetype'
22142 sort='$sort'
22143 spackage='$spackage'
22144 spitshell='$spitshell'
22145 srand48_r_proto='$srand48_r_proto'
22146 srandom_r_proto='$srandom_r_proto'
22147 src='$src'
22148 ssizetype='$ssizetype'
22149 startperl='$startperl'
22150 startsh='$startsh'
22151 static_ext='$static_ext'
22152 stdchar='$stdchar'
22153 stdio_base='$stdio_base'
22154 stdio_bufsiz='$stdio_bufsiz'
22155 stdio_cnt='$stdio_cnt'
22156 stdio_filbuf='$stdio_filbuf'
22157 stdio_ptr='$stdio_ptr'
22158 stdio_stream_array='$stdio_stream_array'
22159 strerror_r_proto='$strerror_r_proto'
22160 strings='$strings'
22161 submit='$submit'
22162 subversion='$subversion'
22163 sysman='$sysman'
22164 tail='$tail'
22165 tar='$tar'
22166 targetarch='$targetarch'
22167 tbl='$tbl'
22168 tee='$tee'
22169 test='$test'
22170 timeincl='$timeincl'
22171 timetype='$timetype'
22172 tmpnam_r_proto='$tmpnam_r_proto'
22173 to='$to'
22174 touch='$touch'
22175 tr='$tr'
22176 trnl='$trnl'
22177 troff='$troff'
22178 ttyname_r_proto='$ttyname_r_proto'
22179 u16size='$u16size'
22180 u16type='$u16type'
22181 u32size='$u32size'
22182 u32type='$u32type'
22183 u64size='$u64size'
22184 u64type='$u64type'
22185 u8size='$u8size'
22186 u8type='$u8type'
22187 uidformat='$uidformat'
22188 uidsign='$uidsign'
22189 uidsize='$uidsize'
22190 uidtype='$uidtype'
22191 uname='$uname'
22192 uniq='$uniq'
22193 uquadtype='$uquadtype'
22194 use5005threads='$use5005threads'
22195 use64bitall='$use64bitall'
22196 use64bitint='$use64bitint'
22197 usecrosscompile='$usecrosscompile'
22198 usedl='$usedl'
22199 usefaststdio='$usefaststdio'
22200 useithreads='$useithreads'
22201 uselargefiles='$uselargefiles'
22202 uselongdouble='$uselongdouble'
22203 usemallocwrap='$usemallocwrap'
22204 usemorebits='$usemorebits'
22205 usemultiplicity='$usemultiplicity'
22206 usemymalloc='$usemymalloc'
22207 usenm='$usenm'
22208 useopcode='$useopcode'
22209 useperlio='$useperlio'
22210 useposix='$useposix'
22211 usereentrant='$usereentrant'
22212 userelocatableinc='$userelocatableinc'
22213 usesfio='$usesfio'
22214 useshrplib='$useshrplib'
22215 usesitecustomize='$usesitecustomize'
22216 usesocks='$usesocks'
22217 usethreads='$usethreads'
22218 usevendorprefix='$usevendorprefix'
22219 usevfork='$usevfork'
22220 usrinc='$usrinc'
22221 uuname='$uuname'
22222 uvXUformat='$uvXUformat'
22223 uvoformat='$uvoformat'
22224 uvsize='$uvsize'
22225 uvtype='$uvtype'
22226 uvuformat='$uvuformat'
22227 uvxformat='$uvxformat'
22228 vendorarch='$vendorarch'
22229 vendorarchexp='$vendorarchexp'
22230 vendorbin='$vendorbin'
22231 vendorbinexp='$vendorbinexp'
22232 vendorhtml1dir='$vendorhtml1dir'
22233 vendorhtml1direxp='$vendorhtml1direxp'
22234 vendorhtml3dir='$vendorhtml3dir'
22235 vendorhtml3direxp='$vendorhtml3direxp'
22236 vendorlib='$vendorlib'
22237 vendorlib_stem='$vendorlib_stem'
22238 vendorlibexp='$vendorlibexp'
22239 vendorman1dir='$vendorman1dir'
22240 vendorman1direxp='$vendorman1direxp'
22241 vendorman3dir='$vendorman3dir'
22242 vendorman3direxp='$vendorman3direxp'
22243 vendorprefix='$vendorprefix'
22244 vendorprefixexp='$vendorprefixexp'
22245 vendorscript='$vendorscript'
22246 vendorscriptexp='$vendorscriptexp'
22247 version='$version'
22248 version_patchlevel_string='$version_patchlevel_string'
22249 versiononly='$versiononly'
22250 vi='$vi'
22251 voidflags='$voidflags'
22252 xlibpth='$xlibpth'
22253 yacc='$yacc'
22254 yaccflags='$yaccflags'
22255 zcat='$zcat'
22256 zip='$zip'
22257 EOT
22258
22259 : Add in command line options if available
22260 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22261
22262 : add special variables
22263 $test -f $src/patchlevel.h && \
22264 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22265 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22266 echo "PERL_CONFIG_SH=true" >>config.sh
22267
22268 : propagate old symbols
22269 if $test -f UU/config.sh; then
22270         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22271         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22272         $sort | $uniq -u >UU/oldsyms
22273         set X `cat UU/oldsyms`
22274         shift
22275         case $# in
22276         0) ;;
22277         *)
22278                 cat <<EOM
22279 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22280 EOM
22281                 echo "# Variables propagated from previous config.sh file." >>config.sh
22282                 for sym in `cat UU/oldsyms`; do
22283                         echo "    Propagating $hint variable "'$'"$sym..."
22284                         eval 'tmp="$'"${sym}"'"'
22285                         echo "$tmp" | \
22286                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22287                 done
22288                 ;;
22289         esac
22290 fi
22291
22292 : Finish up by extracting the .SH files
22293 case "$alldone" in
22294 exit)
22295         $rm -rf UU
22296         echo "Extraction done."
22297         exit 0
22298         ;;
22299 cont)
22300         ;;
22301 '')
22302         dflt=''
22303         nostick=true
22304         $cat <<EOM
22305
22306 If you'd like to make any changes to the config.sh file before I begin
22307 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22308
22309 EOM
22310         rp="Press return or use a shell escape to edit config.sh:"
22311         . UU/myread
22312         nostick=''
22313         case "$ans" in
22314         '') ;;
22315         *) : in case they cannot read
22316                 sh 1>&4 -c "$ans";;
22317         esac
22318         ;;
22319 esac
22320
22321 : if this fails, just run all the .SH files by hand
22322 . ./config.sh
22323
22324 echo " "
22325 exec 1>&4
22326 pwd=`pwd`
22327 . ./UU/extract
22328 cd "$pwd"
22329
22330 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22331         dflt=y
22332         case "$silent" in
22333         true) ;;
22334         *)
22335                 $cat <<EOM
22336
22337 Now you need to generate make dependencies by running "$make depend".
22338 You might prefer to run it in background: "$make depend > makedepend.out &"
22339 It can take a while, so you might not want to run it right now.
22340
22341 EOM
22342                 ;;
22343         esac
22344         rp="Run $make depend now?"
22345         . UU/myread
22346         case "$ans" in
22347         y*)
22348                 $make depend && echo "Now you must run '$make'."
22349                 ;;
22350         *)
22351                 echo "You must run '$make depend' then '$make'."
22352                 ;;
22353         esac
22354 elif test -f [Mm]akefile; then
22355         echo " "
22356         echo "Now you must run a $make."
22357 else
22358         echo "Configure done."
22359 fi
22360
22361 if $test -f Policy.sh; then
22362     $cat <<EOM
22363
22364 If you compile $package on a different machine or from a different object
22365 directory, copy the Policy.sh file from this object directory to the
22366 new one before you run Configure -- this will help you with most of
22367 the policy defaults.
22368
22369 EOM
22370 fi
22371 if $test -f config.msg; then
22372     echo "Hmm.  I also noted the following information while running:"
22373     echo " "
22374     $cat config.msg >&4
22375     $rm -f config.msg
22376 fi
22377 $rm -f kit*isdone ark*isdone
22378 $rm -rf UU
22379
22380 : End of Configure
22381