This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlipc: Convert tabs to spaces.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32 #
33 # Generated on Thu Aug 12 11:38:08 CEST 2010 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_static_inline=''
752 perl_static_inline=''
753 d_fstatvfs=''
754 d_statvfs=''
755 d_stdio_cnt_lval=''
756 d_stdio_ptr_lval=''
757 d_stdio_ptr_lval_nochange_cnt=''
758 d_stdio_ptr_lval_sets_cnt=''
759 d_stdiobase=''
760 d_stdstdio=''
761 stdio_base=''
762 stdio_bufsiz=''
763 stdio_cnt=''
764 stdio_filbuf=''
765 stdio_ptr=''
766 d_index=''
767 d_strchr=''
768 d_strcoll=''
769 d_strctcpy=''
770 d_strerrm=''
771 d_strerror=''
772 d_sysernlst=''
773 d_syserrlst=''
774 d_strerror_r=''
775 strerror_r_proto=''
776 d_strftime=''
777 d_strlcat=''
778 d_strlcpy=''
779 d_strtod=''
780 d_strtol=''
781 d_strtold=''
782 d_strtoll=''
783 d_strtoq=''
784 d_strtoul=''
785 d_strtoull=''
786 d_strtouq=''
787 d_strxfrm=''
788 d_symlink=''
789 d_syscall=''
790 d_syscallproto=''
791 d_sysconf=''
792 d_system=''
793 d_tcgetpgrp=''
794 d_tcsetpgrp=''
795 d_telldirproto=''
796 d_time=''
797 timetype=''
798 d_asctime64=''
799 d_ctime64=''
800 d_difftime64=''
801 d_gmtime64=''
802 d_localtime64=''
803 d_mktime64=''
804 d_timegm=''
805 clocktype=''
806 d_times=''
807 d_tmpnam_r=''
808 tmpnam_r_proto=''
809 d_truncate=''
810 d_ttyname_r=''
811 ttyname_r_proto=''
812 d_tzname=''
813 d_u32align=''
814 d_ualarm=''
815 d_umask=''
816 d_semctl_semid_ds=''
817 d_semctl_semun=''
818 d_union_semun=''
819 d_unordered=''
820 d_unsetenv=''
821 d_usleep=''
822 d_usleepproto=''
823 d_ustat=''
824 d_pseudofork=''
825 d_vfork=''
826 usevfork=''
827 d_voidsig=''
828 signal_t=''
829 d_volatile=''
830 d_charvspr=''
831 d_vprintf=''
832 d_wait4=''
833 d_waitpid=''
834 d_wcstombs=''
835 d_wctomb=''
836 d_writev=''
837 dlext=''
838 bin_ELF=''
839 cccdlflags=''
840 ccdlflags=''
841 dlsrc=''
842 ld=''
843 lddlflags=''
844 usedl=''
845 doublesize=''
846 ebcdic=''
847 fflushNULL=''
848 fflushall=''
849 fpossize=''
850 fpostype=''
851 gccansipedantic=''
852 gccosandvers=''
853 gccversion=''
854 gidformat=''
855 gidsign=''
856 gidsize=''
857 gidtype=''
858 groupstype=''
859 h_fcntl=''
860 h_sysfile=''
861 html1dir=''
862 html1direxp=''
863 installhtml1dir=''
864 html3dir=''
865 html3direxp=''
866 installhtml3dir=''
867 i_arpainet=''
868 i_assert=''
869 i_crypt=''
870 db_hashtype=''
871 db_prefixtype=''
872 db_version_major=''
873 db_version_minor=''
874 db_version_patch=''
875 i_db=''
876 i_dbm=''
877 i_rpcsvcdbm=''
878 d_dirnamlen=''
879 direntrytype=''
880 i_dirent=''
881 i_dld=''
882 i_dlfcn=''
883 i_fcntl=''
884 i_float=''
885 i_fp=''
886 i_fp_class=''
887 i_gdbm=''
888 d_grpasswd=''
889 i_grp=''
890 i_ieeefp=''
891 i_inttypes=''
892 i_langinfo=''
893 i_libutil=''
894 i_limits=''
895 i_locale=''
896 i_machcthr=''
897 i_malloc=''
898 i_mallocmalloc=''
899 i_math=''
900 i_memory=''
901 i_mntent=''
902 d_gdbm_ndbm_h_uses_prototypes=''
903 d_gdbmndbm_h_uses_prototypes=''
904 d_ndbm=''
905 d_ndbm_h_uses_prototypes=''
906 i_gdbm_ndbm=''
907 i_gdbmndbm=''
908 i_ndbm=''
909 i_netdb=''
910 i_neterrno=''
911 i_netinettcp=''
912 i_niin=''
913 i_sysin=''
914 i_poll=''
915 i_prot=''
916 i_pthread=''
917 d_pwage=''
918 d_pwchange=''
919 d_pwclass=''
920 d_pwcomment=''
921 d_pwexpire=''
922 d_pwgecos=''
923 d_pwpasswd=''
924 d_pwquota=''
925 i_pwd=''
926 i_sfio=''
927 i_shadow=''
928 i_socks=''
929 i_stddef=''
930 i_stdlib=''
931 i_string=''
932 strings=''
933 i_sunmath=''
934 i_sysaccess=''
935 i_sysdir=''
936 i_sysfile=''
937 d_voidtty=''
938 i_bsdioctl=''
939 i_sysfilio=''
940 i_sysioctl=''
941 i_syssockio=''
942 i_syslog=''
943 i_sysmman=''
944 i_sysmode=''
945 i_sysmount=''
946 i_sysndir=''
947 i_sysparam=''
948 i_syspoll=''
949 i_sysresrc=''
950 i_syssecrt=''
951 i_sysselct=''
952 i_sysstat=''
953 i_sysstatfs=''
954 i_sysstatvfs=''
955 i_systimes=''
956 i_systypes=''
957 i_sysuio=''
958 i_sysun=''
959 i_sysutsname=''
960 i_sysvfs=''
961 i_syswait=''
962 i_sgtty=''
963 i_termio=''
964 i_termios=''
965 d_tm_tm_gmtoff=''
966 d_tm_tm_zone=''
967 i_systime=''
968 i_systimek=''
969 i_time=''
970 timeincl=''
971 i_unistd=''
972 i_ustat=''
973 i_utime=''
974 i_values=''
975 i_stdarg=''
976 i_varargs=''
977 i_varhdr=''
978 i_vfork=''
979 d_inc_version_list=''
980 inc_version_list=''
981 inc_version_list_init=''
982 installprefix=''
983 installprefixexp=''
984 installstyle=''
985 installusrbinperl=''
986 intsize=''
987 longsize=''
988 shortsize=''
989 issymlink=''
990 libc=''
991 ldlibpthname=''
992 libperl=''
993 shrpenv=''
994 useshrplib=''
995 glibpth=''
996 libpth=''
997 loclibpth=''
998 plibpth=''
999 xlibpth=''
1000 ignore_versioned_solibs=''
1001 libs=''
1002 libsdirs=''
1003 libsfiles=''
1004 libsfound=''
1005 libspath=''
1006 lns=''
1007 d_PRIEUldbl=''
1008 d_PRIFUldbl=''
1009 d_PRIGUldbl=''
1010 d_PRIeldbl=''
1011 d_PRIfldbl=''
1012 d_PRIgldbl=''
1013 d_SCNfldbl=''
1014 sPRIEUldbl=''
1015 sPRIFUldbl=''
1016 sPRIGUldbl=''
1017 sPRIeldbl=''
1018 sPRIfldbl=''
1019 sPRIgldbl=''
1020 sSCNfldbl=''
1021 lseeksize=''
1022 lseektype=''
1023 mad=''
1024 madlyh=''
1025 madlyobj=''
1026 madlysrc=''
1027 make_set_make=''
1028 d_mymalloc=''
1029 freetype=''
1030 mallocobj=''
1031 mallocsrc=''
1032 malloctype=''
1033 usemallocwrap=''
1034 usemymalloc=''
1035 installman1dir=''
1036 man1dir=''
1037 man1direxp=''
1038 man1ext=''
1039 installman3dir=''
1040 man3dir=''
1041 man3direxp=''
1042 man3ext=''
1043 modetype=''
1044 multiarch=''
1045 mydomain=''
1046 myhostname=''
1047 phostname=''
1048 c=''
1049 n=''
1050 d_eofnblk=''
1051 eagain=''
1052 o_nonblock=''
1053 rd_nodata=''
1054 need_va_copy=''
1055 netdb_hlen_type=''
1056 netdb_host_type=''
1057 netdb_name_type=''
1058 netdb_net_type=''
1059 groupcat=''
1060 hostcat=''
1061 passcat=''
1062 orderlib=''
1063 ranlib=''
1064 d_perl_otherlibdirs=''
1065 otherlibdirs=''
1066 package=''
1067 spackage=''
1068 pager=''
1069 api_revision=''
1070 api_subversion=''
1071 api_version=''
1072 api_versionstring=''
1073 patchlevel=''
1074 perl_patchlevel=''
1075 revision=''
1076 subversion=''
1077 version=''
1078 version_patchlevel_string=''
1079 perl5=''
1080 perladmin=''
1081 perlpath=''
1082 d_nv_preserves_uv=''
1083 d_nv_zero_is_allbits_zero=''
1084 i16size=''
1085 i16type=''
1086 i32size=''
1087 i32type=''
1088 i64size=''
1089 i64type=''
1090 i8size=''
1091 i8type=''
1092 ivsize=''
1093 ivtype=''
1094 nv_overflows_integers_at=''
1095 nv_preserves_uv_bits=''
1096 nvsize=''
1097 nvtype=''
1098 u16size=''
1099 u16type=''
1100 u32size=''
1101 u32type=''
1102 u64size=''
1103 u64type=''
1104 u8size=''
1105 u8type=''
1106 uvsize=''
1107 uvtype=''
1108 ivdformat=''
1109 nvEUformat=''
1110 nvFUformat=''
1111 nvGUformat=''
1112 nveformat=''
1113 nvfformat=''
1114 nvgformat=''
1115 uvXUformat=''
1116 uvoformat=''
1117 uvuformat=''
1118 uvxformat=''
1119 pidtype=''
1120 prefix=''
1121 prefixexp=''
1122 installprivlib=''
1123 privlib=''
1124 privlibexp=''
1125 prototype=''
1126 ptrsize=''
1127 d_PRIXU64=''
1128 d_PRId64=''
1129 d_PRIi64=''
1130 d_PRIo64=''
1131 d_PRIu64=''
1132 d_PRIx64=''
1133 sPRIXU64=''
1134 sPRId64=''
1135 sPRIi64=''
1136 sPRIo64=''
1137 sPRIu64=''
1138 sPRIx64=''
1139 d_quad=''
1140 quadkind=''
1141 quadtype=''
1142 uquadtype=''
1143 drand01=''
1144 randbits=''
1145 randfunc=''
1146 randseedtype=''
1147 seedfunc=''
1148 installscript=''
1149 scriptdir=''
1150 scriptdirexp=''
1151 selectminbits=''
1152 selecttype=''
1153 sh=''
1154 sig_count=''
1155 sig_name=''
1156 sig_name_init=''
1157 sig_num=''
1158 sig_num_init=''
1159 sig_size=''
1160 d_sitearch=''
1161 installsitearch=''
1162 sitearch=''
1163 sitearchexp=''
1164 installsitebin=''
1165 sitebin=''
1166 sitebinexp=''
1167 installsitehtml1dir=''
1168 sitehtml1dir=''
1169 sitehtml1direxp=''
1170 installsitehtml3dir=''
1171 sitehtml3dir=''
1172 sitehtml3direxp=''
1173 installsitelib=''
1174 sitelib=''
1175 sitelib_stem=''
1176 sitelibexp=''
1177 installsiteman1dir=''
1178 siteman1dir=''
1179 siteman1direxp=''
1180 installsiteman3dir=''
1181 siteman3dir=''
1182 siteman3direxp=''
1183 siteprefix=''
1184 siteprefixexp=''
1185 installsitescript=''
1186 sitescript=''
1187 sitescriptexp=''
1188 sizesize=''
1189 sizetype=''
1190 so=''
1191 socksizetype=''
1192 sharpbang=''
1193 shsharp=''
1194 spitshell=''
1195 src=''
1196 ssizetype=''
1197 startperl=''
1198 startsh=''
1199 stdchar=''
1200 d_stdio_stream_array=''
1201 stdio_stream_array=''
1202 sysman=''
1203 sGMTIME_max=''
1204 sGMTIME_min=''
1205 sLOCALTIME_max=''
1206 sLOCALTIME_min=''
1207 trnl=''
1208 uidformat=''
1209 uidsign=''
1210 uidsize=''
1211 uidtype=''
1212 archname64=''
1213 use64bitall=''
1214 use64bitint=''
1215 dtrace=''
1216 usedtrace=''
1217 usefaststdio=''
1218 ccflags_uselargefiles=''
1219 ldflags_uselargefiles=''
1220 libswanted_uselargefiles=''
1221 uselargefiles=''
1222 uselongdouble=''
1223 usemorebits=''
1224 usemultiplicity=''
1225 nm_opt=''
1226 nm_so_opt=''
1227 runnm=''
1228 usenm=''
1229 useperlio=''
1230 usesocks=''
1231 d_oldpthreads=''
1232 use5005threads=''
1233 useithreads=''
1234 usereentrant=''
1235 usethreads=''
1236 incpath=''
1237 mips_type=''
1238 usrinc=''
1239 vaproto=''
1240 d_vendorarch=''
1241 installvendorarch=''
1242 vendorarch=''
1243 vendorarchexp=''
1244 d_vendorbin=''
1245 installvendorbin=''
1246 vendorbin=''
1247 vendorbinexp=''
1248 installvendorhtml1dir=''
1249 vendorhtml1dir=''
1250 vendorhtml1direxp=''
1251 installvendorhtml3dir=''
1252 vendorhtml3dir=''
1253 vendorhtml3direxp=''
1254 d_vendorlib=''
1255 installvendorlib=''
1256 vendorlib=''
1257 vendorlib_stem=''
1258 vendorlibexp=''
1259 installvendorman1dir=''
1260 vendorman1dir=''
1261 vendorman1direxp=''
1262 installvendorman3dir=''
1263 vendorman3dir=''
1264 vendorman3direxp=''
1265 usevendorprefix=''
1266 vendorprefix=''
1267 vendorprefixexp=''
1268 d_vendorscript=''
1269 installvendorscript=''
1270 vendorscript=''
1271 vendorscriptexp=''
1272 versiononly=''
1273 defvoidused=''
1274 voidflags=''
1275 yacc=''
1276 yaccflags=''
1277 CONFIG=''
1278
1279 : Detect odd OSs
1280 define='define'
1281 undef='undef'
1282 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1283 rmlist=''
1284
1285 : We must find out about Eunice early
1286 eunicefix=':'
1287 if test -f /etc/unixtovms; then
1288         eunicefix=/etc/unixtovms
1289 fi
1290 if test -f /etc/unixtovms.exe; then
1291         eunicefix=/etc/unixtovms.exe
1292 fi
1293
1294 : Set executable suffix now -- needed before hints available
1295 if test -f "/libs/version.library"; then
1296 : Amiga OS
1297     _exe=""
1298 elif test -f "/system/gnu_library/bin/ar.pm"; then
1299 : Stratus VOS
1300     _exe=".pm"
1301 elif test -n "$DJGPP"; then
1302 : DOS DJGPP
1303     _exe=".exe"
1304 elif test -d c:/. -o -n "$is_os2" ; then
1305 : OS/2 or cygwin
1306     _exe=".exe"
1307 fi
1308
1309 groupstype=''
1310 i_whoami=''
1311 : Trailing extension.  Override this in a hint file, if needed.
1312 : Extra object files, if any, needed on this platform.
1313 archobjs=''
1314 archname=''
1315 libnames=''
1316 : change the next line if compiling for Xenix/286 on Xenix/386
1317 xlibpth='/usr/lib/386 /lib/386'
1318 : Possible local library directories to search.
1319 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1320 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1321
1322 : general looking path for locating libraries
1323 glibpth="/lib /usr/lib $xlibpth"
1324 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1325 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1326 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1327 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1328
1329 : Private path used by Configure to find libraries.  Its value
1330 : is prepended to libpth. This variable takes care of special
1331 : machines, like the mips.  Usually, it should be empty.
1332 plibpth=''
1333
1334 : default library list
1335 libswanted=''
1336 : some systems want to use only the non-versioned libso:s
1337 ignore_versioned_solibs=''
1338 : set usethreads on the Configure command line to enable threads.
1339 usereentrant='undef'
1340 : full support for void wanted by default
1341 defvoidused=15
1342
1343 : Possible local include directories to search.
1344 : Set locincpth to "" in a hint file to defeat local include searches.
1345 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1346 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1347 :
1348 : no include file wanted by default
1349 inclwanted=''
1350
1351 : Enable -DEBUGGING and -DDEBUGGING from the command line
1352 EBUGGING=''
1353 DEBUGGING=old
1354
1355 ccname=''
1356 ccversion=''
1357 perllibs=''
1358 : set useposix=false in your hint file to disable the POSIX extension.
1359 useposix=true
1360 : set useopcode=false in your hint file to disable the Opcode extension.
1361 useopcode=true
1362 archname64=''
1363 ccflags_uselargefiles=''
1364 ldflags_uselargefiles=''
1365 libswanted_uselargefiles=''
1366 : set usemultiplicity on the Configure command line to enable multiplicity.
1367 : set usesocks on the Configure command line to enable socks.
1368 : List of libraries we want.
1369 : If anyone needs extra -lxxx, put those in a hint file.
1370 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1371 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1372 : We probably want to search /usr/shlib before most other libraries.
1373 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1374 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1375 glibpth="/usr/shlib $glibpth"
1376 : Do not use vfork unless overridden by a hint file.
1377 usevfork=false
1378
1379 : Find the basic shell for Bourne shell scripts
1380 case "$sh" in
1381 '')
1382         case "$SYSTYPE" in
1383         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1384         *) xxx='/bin/sh';;
1385         esac
1386         if test -f "$xxx"; then
1387                 sh="$xxx"
1388         else
1389                 : Build up a list and do a single loop so we can 'break' out.
1390                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1391                 for xxx in sh bash ksh pdksh ash; do
1392                         for p in $pth; do
1393                                 try="$try ${p}/${xxx}"
1394                         done
1395                 done
1396                 for xxx in $try; do
1397                         if test -f "$xxx"; then
1398                                 sh="$xxx";
1399                                 break
1400                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1401                                 sh="$xxx";
1402                                 break
1403                         elif test -f "$xxx.exe"; then
1404                                 sh="$xxx";
1405                                 break
1406                         fi
1407                 done
1408         fi
1409         ;;
1410 esac
1411
1412 case "$sh" in
1413 '')     cat >&2 <<EOM
1414 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1415
1416 Usually it's in /bin/sh.  How did you even get this far?
1417 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1418 we'll try to straighten this all out.
1419 EOM
1420         exit 1
1421         ;;
1422 esac
1423
1424 : see if sh knows # comments
1425 if `$sh -c '#' >/dev/null 2>&1`; then
1426         shsharp=true
1427         spitshell=cat
1428         xcat=/bin/cat
1429         test -f $xcat$_exe || xcat=/usr/bin/cat
1430         if test ! -f $xcat$_exe; then
1431                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1432                         if test -f $p/cat$_exe; then
1433                                 xcat=$p/cat
1434                                 break
1435                         fi
1436                 done
1437                 if test ! -f $xcat$_exe; then
1438                         echo "Can't find cat anywhere!"
1439                         exit 1
1440                 fi
1441         fi
1442         echo "#!$xcat" >sharp
1443         $eunicefix sharp
1444         chmod +x sharp
1445         ./sharp > today 2>/dev/null
1446         if test -s today; then
1447                 sharpbang='#!'
1448         else
1449                 echo "#! $xcat" > sharp
1450                 $eunicefix sharp
1451                 chmod +x sharp
1452                 ./sharp > today 2>/dev/null
1453                 if test -s today; then
1454                         sharpbang='#! '
1455                 else
1456                         sharpbang=': use '
1457                 fi
1458         fi
1459 else
1460         echo " "
1461         echo "Your $sh doesn't grok # comments--I will strip them later on."
1462         shsharp=false
1463         cd ..
1464         echo "exec grep -v '^[  ]*#'" >spitshell
1465         chmod +x spitshell
1466         $eunicefix spitshell
1467         spitshell=`pwd`/spitshell
1468         cd UU
1469         echo "I presume that if # doesn't work, #! won't work either!"
1470         sharpbang=': use '
1471 fi
1472 rm -f sharp today
1473
1474 : figure out how to guarantee sh startup
1475 case "$startsh" in
1476 '') startsh=${sharpbang}${sh} ;;
1477 *)
1478 esac
1479 cat >sharp <<EOSS
1480 $startsh
1481 set abc
1482 test "$?abc" != 1
1483 EOSS
1484
1485 chmod +x sharp
1486 $eunicefix sharp
1487 if ./sharp; then
1488         : echo "Yup, it does."
1489 else
1490         echo "Hmm... '$startsh' does not guarantee sh startup..."
1491         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1492 fi
1493 rm -f sharp
1494
1495 : Save command line options in file UU/cmdline.opt for later use in
1496 : generating config.sh.
1497 cat > cmdline.opt <<EOSH
1498 : Configure command line arguments.
1499 config_arg0='$0'
1500 config_args='$*'
1501 config_argc=$#
1502 EOSH
1503 argn=1
1504 args_exp=''
1505 args_sep=''
1506 for arg in "$@"; do
1507         cat >>cmdline.opt <<EOSH
1508 config_arg$argn='$arg'
1509 EOSH
1510         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1511 $arg
1512 EOC
1513         arg_exp=`cat cmdl.opt`
1514         args_exp="$args_exp$args_sep'$arg_exp'"
1515         argn=`expr $argn + 1`
1516         args_sep=' '
1517 done
1518 rm -f cmdl.opt
1519
1520 : produce awk script to parse command line options
1521 cat >options.awk <<'EOF'
1522 BEGIN {
1523         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1524
1525         len = length(optstr);
1526         for (i = 1; i <= len; i++) {
1527                 c = substr(optstr, i, 1);
1528                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1529                 if (a == ":") {
1530                         arg[c] = 1;
1531                         i++;
1532                 }
1533                 opt[c] = 1;
1534         }
1535 }
1536 {
1537         expect = 0;
1538         str = $0;
1539         if (substr(str, 1, 1) != "-") {
1540                 printf("'%s'\n", str);
1541                 next;
1542         }
1543         len = length($0);
1544         for (i = 2; i <= len; i++) {
1545                 c = substr(str, i, 1);
1546                 if (!opt[c]) {
1547                         printf("-%s\n", substr(str, i));
1548                         next;
1549                 }
1550                 printf("-%s\n", c);
1551                 if (arg[c]) {
1552                         if (i < len)
1553                                 printf("'%s'\n", substr(str, i + 1));
1554                         else
1555                                 expect = 1;
1556                         next;
1557                 }
1558         }
1559 }
1560 END {
1561         if (expect)
1562                 print "?";
1563 }
1564 EOF
1565
1566 : process the command line options
1567 set X `for arg in "$@"; do echo "X$arg"; done |
1568         sed -e s/X// | awk -f options.awk`
1569 eval "set $*"
1570 shift
1571 rm -f options.awk
1572
1573 : set up default values
1574 fastread=''
1575 reuseval=false
1576 config_sh=''
1577 alldone=''
1578 error=''
1579 silent=''
1580 extractsh=''
1581 override=''
1582 knowitall=''
1583 rm -f optdef.sh posthint.sh
1584 cat >optdef.sh <<EOS
1585 $startsh
1586 EOS
1587
1588
1589 : option parsing
1590 while test $# -gt 0; do
1591         case "$1" in
1592         -d) shift; fastread=yes;;
1593         -e) shift; alldone=cont;;
1594         -f)
1595                 shift
1596                 cd ..
1597                 if test -r "$1"; then
1598                         config_sh="$1"
1599                 else
1600                         echo "$me: cannot read config file $1." >&2
1601                         error=true
1602                 fi
1603                 cd UU
1604                 shift;;
1605         --help|\
1606         -h) shift; error=true;;
1607         -r) shift; reuseval=true;;
1608         -s) shift; silent=true; realsilent=true;;
1609         -E) shift; alldone=exit;;
1610         -K) shift; knowitall=true;;
1611         -O) shift; override=true;;
1612         -S) shift; silent=true; extractsh=true;;
1613         -D)
1614                 shift
1615                 case "$1" in
1616                 *=)
1617                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1618                         echo "$me: ignoring -D $1" >&2
1619                         ;;
1620                 *=*) echo "$1" | \
1621                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1622                 *) echo "$1='define'" >> optdef.sh;;
1623                 esac
1624                 shift
1625                 ;;
1626         -U)
1627                 shift
1628                 case "$1" in
1629                 *=) echo "$1" >> optdef.sh;;
1630                 *=*)
1631                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1632                         echo "$me: ignoring -U $1" >&2
1633                         ;;
1634                 *) echo "$1='undef'" >> optdef.sh;;
1635                 esac
1636                 shift
1637                 ;;
1638         -A)
1639             shift
1640             xxx=''
1641             yyy="$1"
1642             zzz=''
1643             uuu=undef
1644             case "$yyy" in
1645             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1646                  case "$zzz" in
1647                  *:*) zzz='' ;;
1648                  *)   xxx=append
1649                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1650                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1651                  esac
1652                  ;;
1653             esac
1654             case "$xxx" in
1655             '')  case "$yyy" in
1656                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1658                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1659                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1661                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1662                  esac
1663                  ;;
1664             esac
1665             case "$xxx" in
1666             append)
1667                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1668             clear)
1669                 echo "$yyy=''"                  >> posthint.sh ;;
1670             define)
1671                 case "$zzz" in
1672                 '') zzz=define ;;
1673                 esac
1674                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1675             eval)
1676                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1677             prepend)
1678                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1679             undef)
1680                 case "$zzz" in
1681                 '') zzz="$uuu" ;;
1682                 esac
1683                 echo "$yyy=$zzz"                >> posthint.sh ;;
1684             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1685             esac
1686             shift
1687             ;;
1688         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1689             exit 0;;
1690         --) break;;
1691         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1692         *) break;;
1693         esac
1694 done
1695
1696 case "$error" in
1697 true)
1698         cat >&2 <<EOM
1699 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1700                  [-U symbol] [-U symbol=] [-A command:symbol...]
1701   -d : use defaults for all answers.
1702   -e : go on without questioning past the production of config.sh.
1703   -f : specify an alternate default configuration file.
1704   -h : print this help message and exit (with an error status).
1705   -r : reuse C symbols value if possible (skips costly nm extraction).
1706   -s : silent mode, only echoes questions and essential information.
1707   -D : define symbol to have some value:
1708          -D symbol         symbol gets the value 'define'
1709          -D symbol=value   symbol gets the value 'value'
1710        common used examples (see INSTALL for more info):
1711          -Duse64bitint            use 64bit integers
1712          -Duse64bitall            use 64bit integers and pointers
1713          -Dusethreads             use thread support
1714          -Dinc_version_list=none  do not include older perl trees in @INC
1715          -DEBUGGING=none          DEBUGGING options
1716          -Dcc=gcc                 choose your compiler
1717          -Dprefix=/opt/perl5      choose your destination
1718   -E : stop at the end of questions, after having produced config.sh.
1719   -K : do not use unless you know what you are doing.
1720   -O : let -D and -U override definitions from loaded configuration file.
1721   -S : perform variable substitutions on all .SH files (can mix with -f)
1722   -U : undefine symbol:
1723          -U symbol    symbol gets the value 'undef'
1724          -U symbol=   symbol gets completely empty
1725        e.g.:  -Uversiononly
1726   -A : manipulate symbol after the platform specific hints have been applied:
1727          -A append:symbol=value   append value to symbol
1728          -A symbol=value          like append:, but with a separating space
1729          -A define:symbol=value   define symbol to have value
1730          -A clear:symbol          define symbol to be ''
1731          -A define:symbol         define symbol to be 'define'
1732          -A eval:symbol=value     define symbol to be eval of value
1733          -A prepend:symbol=value  prepend value to symbol
1734          -A undef:symbol          define symbol to be 'undef'
1735          -A undef:symbol=         define symbol to be ''
1736        e.g.:  -A prepend:libswanted='cl pthread '
1737               -A ccflags=-DSOME_MACRO
1738   -V : print version number and exit (with a zero status).
1739 EOM
1740         exit 1
1741         ;;
1742 esac
1743
1744 : Sanity checks
1745 case "$fastread$alldone" in
1746 yescont|yesexit) ;;
1747 *)
1748         case "$extractsh" in
1749         true) ;;
1750         *)
1751                 if test ! -t 0; then
1752                         echo "Say 'sh Configure', not 'sh <Configure'"
1753                         exit 1
1754                 fi
1755                 ;;
1756         esac
1757         ;;
1758 esac
1759
1760 exec 4>&1
1761 case "$silent" in
1762 true) exec 1>/dev/null;;
1763 esac
1764
1765 : run the defines and the undefines, if any, but leave the file out there...
1766 touch optdef.sh
1767 . ./optdef.sh
1768 : create the posthint manipulation script and leave the file out there...
1769 touch posthint.sh
1770
1771 : set package name
1772 package='perl5'
1773 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1774 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1775 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1776 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1777 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1778 esac
1779
1780 : Some greps do not return status, grrr.
1781 echo "grimblepritz" >grimble
1782 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1783         contains=contains
1784 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1785         contains=grep
1786 else
1787         contains=contains
1788 fi
1789 rm -f grimble
1790 : the following should work in any shell
1791 case "$contains" in
1792 contains*)
1793         echo " "
1794         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1795         cat >contains <<'EOSS'
1796 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1797 EOSS
1798 chmod +x contains
1799 esac
1800
1801 : Find the path to the source tree
1802 case "$src" in
1803 '') case "$0" in
1804     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1805          case "$src" in
1806          /*)    ;;
1807          .)     ;;
1808          *)     src=`cd ../$src && pwd` ;;
1809          esac
1810          ;;
1811     *)   src='.';;
1812     esac;;
1813 esac
1814 case "$src" in
1815 '')     src=/
1816         rsrc=/
1817         ;;
1818 /*)     rsrc="$src";;
1819 *)      rsrc="../$src";;
1820 esac
1821 if test -f $rsrc/Configure && \
1822         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1823 then
1824    : found it, so we are ok.
1825 else
1826         rsrc=''
1827         for src in . .. ../.. ../../.. ../../../..; do
1828                 if test -f ../$src/Configure && \
1829                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1830                 then
1831                         rsrc=../$src
1832                         break
1833                 fi
1834         done
1835 fi
1836 case "$rsrc" in
1837 '')
1838         cat <<EOM >&4
1839
1840 Sorry, I can't seem to locate the source dir for $package.  Please start
1841 Configure with an explicit path -- i.e. /some/path/Configure.
1842
1843 EOM
1844         exit 1
1845         ;;
1846 ../.)   rsrc='..';;
1847 *)
1848         echo " "
1849         echo "Sources for $package found in \"$src\"." >&4
1850         ;;
1851 esac
1852
1853 : script used to extract .SH files with variable substitutions
1854 cat >extract <<'EOS'
1855 PERL_CONFIG_SH=true
1856 echo "Doing variable substitutions on .SH files..."
1857 if test -f MANIFEST; then
1858         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1859 else
1860         echo "(Looking for .SH files under the source directory.)"
1861         set x `(cd "$src"; find . -name "*.SH" -print)`
1862 fi
1863 shift
1864 case $# in
1865 0) set x `(cd "$src"; echo *.SH)`; shift;;
1866 esac
1867 if test ! -f "$src/$1"; then
1868         shift
1869 fi
1870 mkdir_p='
1871 name=$1;
1872 create="";
1873 while test $name; do
1874         if test ! -d "$name"; then
1875                 create="$name $create";
1876                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1877                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1878         else
1879                 name="";
1880         fi;
1881 done;
1882 for file in $create; do
1883         mkdir $file;
1884 done
1885 '
1886 for file in $*; do
1887         case "$src" in
1888         ".")
1889                 case "$file" in
1890                 */*)
1891                         dir=`expr X$file : 'X\(.*\)/'`
1892                         file=`expr X$file : 'X.*/\(.*\)'`
1893                         (cd "$dir" && . ./$file)
1894                         ;;
1895                 *)
1896                         . ./$file
1897                         ;;
1898                 esac
1899                 ;;
1900         *)
1901                 case "$file" in
1902                 */*)
1903                         dir=`expr X$file : 'X\(.*\)/'`
1904                         file=`expr X$file : 'X.*/\(.*\)'`
1905                         (set x $dir; shift; eval $mkdir_p)
1906                         sh <"$src/$dir/$file"
1907                         ;;
1908                 *)
1909                         sh <"$src/$file"
1910                         ;;
1911                 esac
1912                 ;;
1913         esac
1914 done
1915 if test -f "$src/config_h.SH"; then
1916         if test ! -f config.h; then
1917         : oops, they left it out of MANIFEST, probably, so do it anyway.
1918         . "$src/config_h.SH"
1919         fi
1920 fi
1921 EOS
1922
1923 : extract files and exit if asked to do so
1924 case "$extractsh" in
1925 true)
1926         case "$realsilent" in
1927         true) ;;
1928         *) exec 1>&4;;
1929         esac
1930         case "$config_sh" in
1931         '') config_sh='config.sh';;
1932         esac
1933         echo " "
1934         echo "Fetching answers from $config_sh..."
1935         cd ..
1936         . $config_sh
1937         test "$override" && . ./optdef.sh
1938         echo " "
1939         . UU/extract
1940         rm -rf UU
1941         echo "Extraction done."
1942         exit 0
1943         ;;
1944 esac
1945
1946 : Eunice requires " " instead of "", can you believe it
1947 echo " "
1948 : Here we go...
1949 echo "Beginning of configuration questions for $package."
1950
1951 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1952
1953 : first determine how to suppress newline on echo command
1954 echo " "
1955 echo "Checking echo to see how to suppress newlines..."
1956 (echo "hi there\c" ; echo " ") >.echotmp
1957 if $contains c .echotmp >/dev/null 2>&1 ; then
1958         echo "...using -n."
1959         n='-n'
1960         c=''
1961 else
1962         cat <<'EOM'
1963 ...using \c
1964 EOM
1965         n=''
1966         c='\c'
1967 fi
1968 echo $n "The star should be here-->$c"
1969 echo '*'
1970 rm -f .echotmp
1971
1972 : Now test for existence of everything in MANIFEST
1973 echo " "
1974 if test -f "$rsrc/MANIFEST"; then
1975         echo "First let's make sure your kit is complete.  Checking..." >&4
1976         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1977                 (split -l 50 2>/dev/null || split -50)
1978         rm -f missing
1979         tmppwd=`pwd`
1980         for filelist in x??; do
1981                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1982                         >/dev/null 2>>"$tmppwd/missing")
1983         done
1984         if test -s missing; then
1985                 cat missing >&4
1986                 cat >&4 <<'EOM'
1987
1988 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1989
1990 You have the option of continuing the configuration process, despite the
1991 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1992 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1993 and contact the author (perlbug@perl.org).
1994
1995 EOM
1996                 echo $n "Continue? [n] $c" >&4
1997                 read ans
1998                 case "$ans" in
1999                 y*)
2000                         echo "Continuing..." >&4
2001                         rm -f missing
2002                         ;;
2003                 *)
2004                         echo "ABORTING..." >&4
2005                         kill $$
2006                         ;;
2007                 esac
2008         else
2009                 echo "Looks good..."
2010         fi
2011 else
2012         echo "There is no MANIFEST file.  I hope your kit is complete !"
2013 fi
2014 rm -f missing x??
2015
2016 : Find the appropriate value for a newline for tr
2017 echo " "
2018 if test -n "$DJGPP"; then
2019        trnl='\012'
2020 fi
2021 if test X"$trnl" = X; then
2022         case "`echo foo|tr '\n' x 2>/dev/null`" in
2023         foox) trnl='\n' ;;
2024         esac
2025 fi
2026 if test X"$trnl" = X; then
2027         case "`echo foo|tr '\012' x 2>/dev/null`" in
2028         foox) trnl='\012' ;;
2029         esac
2030 fi
2031 if test X"$trnl" = X; then
2032        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2033        fooxy) trnl='\n\r' ;;
2034        esac
2035 fi
2036 if test X"$trnl" = X; then
2037         cat <<EOM >&2
2038
2039 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2040
2041 EOM
2042         exit 1
2043 fi
2044
2045 : compute the number of columns on the terminal for proper question formatting
2046 case "$COLUMNS" in
2047 '') COLUMNS='80';;
2048 esac
2049
2050 : set up the echo used in my read
2051 myecho="case \"\$xxxm\" in
2052 '') echo $n \"\$rp $c\" >&4;;
2053 *) case \"\$rp\" in
2054         '') echo $n \"[\$xxxm] $c\";;
2055         *)
2056                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2057                         echo \"\$rp\" >&4
2058                         echo $n \"[\$xxxm] $c\" >&4
2059                 else
2060                         echo $n \"\$rp [\$xxxm] $c\" >&4
2061                 fi
2062                 ;;
2063         esac;;
2064 esac"
2065
2066 : now set up to do reads with possible shell escape and default assignment
2067 cat <<EOSC >myread
2068 $startsh
2069 xxxm=\$dflt
2070 $myecho
2071 ans='!'
2072 case "\$fastread" in
2073 yes) case "\$dflt" in
2074         '') ;;
2075         *) ans='';
2076                 case "\$silent-\$rp" in
2077                 true-) ;;
2078                 *) echo " " >&4;;
2079                 esac;;
2080         esac;;
2081 *) case "\$silent" in
2082         true) case "\$rp" in
2083                 '') ans='';;
2084                 esac;;
2085         esac;;
2086 esac
2087 while expr "X\$ans" : "X!" >/dev/null; do
2088         read answ
2089         set x \$xxxm
2090         shift
2091         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2092         case  "\$answ" in
2093         "!")
2094                 sh 1>&4
2095                 echo " "
2096                 $myecho
2097                 ;;
2098         !*)
2099                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2100                 shift
2101                 sh 1>&4 -c "\$*"
2102                 echo " "
2103                 $myecho
2104                 ;;
2105         "\$ans")
2106                 case "\$ans" in
2107                 \\&*)
2108                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2109                         shift
2110                         case "\$1" in
2111                         -d)
2112                                 fastread=yes
2113                                 echo "(OK, I'll run with -d after this question.)" >&4
2114                                 ;;
2115                         -*)
2116                                 echo "*** Sorry, \$1 not supported yet." >&4
2117                                 ;;
2118                         esac
2119                         $myecho
2120                         ans=!
2121                         ;;
2122                 esac;;
2123         *)
2124                 case "\$aok" in
2125                 y)
2126                         echo "*** Substitution done -- please confirm."
2127                         xxxm="\$ans"
2128                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2129                         xxxm="\$ans"
2130                         ans=!
2131                         ;;
2132                 *)
2133                         echo "*** Error -- try again."
2134                         ans=!
2135                         ;;
2136                 esac
2137                 $myecho
2138                 ;;
2139         esac
2140         case "\$ans\$xxxm\$nostick" in
2141         '')
2142                 ans=!
2143                 $myecho
2144                 ;;
2145         esac
2146 done
2147 case "\$ans" in
2148 '') ans="\$xxxm";;
2149 esac
2150 EOSC
2151
2152 : create .config dir to save info across Configure sessions
2153 test -d ../.config || mkdir ../.config
2154 cat >../.config/README <<EOF
2155 This directory created by Configure to save information that should
2156 persist across sessions for $package.
2157
2158 You may safely delete it if you wish.
2159 EOF
2160
2161 : See if we are using a devel version and want that
2162 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2163 case "$usedevel" in
2164 $define|true|[yY]*)
2165     usedevel="$define" ;;
2166 *) case "$xversion" in
2167    *[13579])
2168         cat >&4 <<EOH
2169 *** WHOA THERE!!! ***
2170
2171     This is an UNSTABLE DEVELOPMENT release.
2172     The version of this $package distribution is $xversion, that is, odd,
2173     (as opposed to even) and that signifies a development release.
2174     If you want a maintenance release, you want an even-numbered version.
2175
2176     Do ***NOT*** install this into production use.
2177     Data corruption and crashes are possible.
2178
2179     It is most seriously suggested that you do not continue any further
2180     unless you want to help in developing and debugging Perl.
2181
2182     If you *still* want to build perl, you can answer 'y' now,
2183     or pass -Dusedevel to Configure.
2184
2185 EOH
2186         rp='Do you really want to continue?'
2187         dflt='n'
2188         . ./myread
2189         case "$ans" in
2190         [yY]) echo >&4 "Okay, continuing."
2191               usedevel="$define" ;;
2192         *) echo >&4 "Okay, bye."
2193            exit 1
2194            ;;
2195         esac
2196         ;;
2197     esac
2198     usedevel="$undef"
2199     ;;
2200 esac
2201 case "$usedevel" in
2202 $define|true|[yY]*)
2203         case "$versiononly" in
2204         '') versiononly="$define" ;;
2205         esac
2206         case "$installusrbinperl" in
2207         '') installusrbinperl="$undef" ;;
2208         esac
2209         ;;
2210 esac
2211
2212 : general instructions
2213 needman=true
2214 firsttime=true
2215 user=`(logname) 2>/dev/null`
2216 case "$user" in
2217 '') user=`whoami 2>&1`;;
2218 esac
2219 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2220         firsttime=false
2221         echo " "
2222         rp='Would you like to see the instructions?'
2223         dflt=n
2224         . ./myread
2225         case "$ans" in
2226         [yY]*) ;;
2227         *) needman=false;;
2228         esac
2229 fi
2230 if $needman; then
2231         cat <<EOH
2232
2233 This installation shell script will examine your system and ask you questions
2234 to determine how the perl5 package should be installed. If you get
2235 stuck on a question, you may use a ! shell escape to start a subshell or
2236 execute a command.  Many of the questions will have default answers in square
2237 brackets; typing carriage return will give you the default.
2238
2239 On some of the questions which ask for file or directory names you are allowed
2240 to use the ~name construct to specify the login directory belonging to "name",
2241 even if you don't have a shell which knows about that.  Questions where this is
2242 allowed will be marked "(~name ok)".
2243
2244 EOH
2245         rp=''
2246         dflt='Type carriage return to continue'
2247         . ./myread
2248         cat <<'EOH'
2249
2250 The prompter used in this script allows you to use shell variables and
2251 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2252 in the default answer, as if the default line was a set of arguments given to a
2253 script shell.  This means you may also use $* to repeat the whole default line,
2254 so you do not have to re-type everything to add something to the default.
2255
2256 Everytime there is a substitution, you will have to confirm.  If there is an
2257 error (e.g. an unmatched backtick), the default answer will remain unchanged
2258 and you will be prompted again.
2259
2260 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2261 the questions and use the computed defaults (or the previous answers if there
2262 was already a config.sh file). Type 'Configure -h' for a list of options.
2263 You may also start interactively and then answer '& -d' at any prompt to turn
2264 on the non-interactive behaviour for the remainder of the execution.
2265
2266 EOH
2267         . ./myread
2268         cat <<EOH
2269
2270 Much effort has been expended to ensure that this shell script will run on any
2271 Unix system.  If despite that it blows up on yours, your best bet is to edit
2272 Configure and run it again.  If you can't run Configure for some reason,
2273 you'll have to generate a config.sh file by hand.  Whatever problems you
2274 have, let me (perlbug@perl.org) know how I blew it.
2275
2276 This installation script affects things in two ways:
2277
2278 1) it may do direct variable substitutions on some of the files included
2279    in this kit.
2280 2) it builds a config.h file for inclusion in C programs.  You may edit
2281    any of these files as the need arises after running this script.
2282
2283 If you make a mistake on a question, there is no easy way to back up to it
2284 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2285 files.  Configure will offer to let you do this before it runs the SH files.
2286
2287 EOH
2288         dflt='Type carriage return to continue'
2289         . ./myread
2290         case "$firsttime" in
2291         true) echo $user >>../.config/instruct;;
2292         esac
2293 fi
2294
2295 : find out where common programs are
2296 echo " "
2297 echo "Locating common programs..." >&4
2298 cat <<EOSC >loc
2299 $startsh
2300 case \$# in
2301 0) exit 1;;
2302 esac
2303 thing=\$1
2304 shift
2305 dflt=\$1
2306 shift
2307 for dir in \$*; do
2308         case "\$thing" in
2309         .)
2310         if test -d \$dir/\$thing; then
2311                 echo \$dir
2312                 exit 0
2313         fi
2314         ;;
2315         *)
2316         for thisthing in \$dir/\$thing; do
2317                 : just loop through to pick last item
2318         done
2319         if test -f \$thisthing; then
2320                 echo \$thisthing
2321                 exit 0
2322         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2323                 echo \$thisthing
2324                 exit 0
2325         elif test -f \$dir/\$thing.exe; then
2326                 if test -n "$DJGPP"; then
2327                         echo \$dir/\$thing.exe
2328                 elif test "$eunicefix" != ":"; then
2329                         : on Eunice apparently
2330                         echo \$dir/\$thing
2331                 fi
2332                 exit 0
2333         fi
2334         ;;
2335         esac
2336 done
2337 echo \$dflt
2338 exit 1
2339 EOSC
2340 chmod +x loc
2341 $eunicefix loc
2342 loclist="
2343 awk
2344 cat
2345 chmod
2346 comm
2347 cp
2348 echo
2349 expr
2350 grep
2351 ls
2352 mkdir
2353 rm
2354 sed
2355 sort
2356 touch
2357 tr
2358 uniq
2359 "
2360 trylist="
2361 ar
2362 bison
2363 byacc
2364 cpp
2365 csh
2366 date
2367 egrep
2368 gmake
2369 gzip
2370 less
2371 ln
2372 make
2373 more
2374 nm
2375 nroff
2376 pg
2377 test
2378 uname
2379 zip
2380 "
2381 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2382 pth="$pth /lib /usr/lib"
2383 for file in $loclist; do
2384         eval xxx=\$$file
2385         case "$xxx" in
2386         /*|?:[\\/]*)
2387                 if test -f "$xxx"; then
2388                         : ok
2389                 else
2390                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391                         xxx=`./loc $file $file $pth`
2392                 fi
2393                 ;;
2394         '') xxx=`./loc $file $file $pth`;;
2395         *) xxx=`./loc $xxx $xxx $pth`;;
2396         esac
2397         eval $file=$xxx$_exe
2398         eval _$file=$xxx
2399         case "$xxx" in
2400         /*)
2401                 echo $file is in $xxx.
2402                 ;;
2403         ?:[\\/]*)
2404                 echo $file is in $xxx.
2405                 ;;
2406         *)
2407                 echo "I don't know where '$file' is, and my life depends on it." >&4
2408                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2409                 exit 1
2410                 ;;
2411         esac
2412 done
2413 echo " "
2414 echo "Don't worry if any of the following aren't found..."
2415 say=offhand
2416 for file in $trylist; do
2417         eval xxx=\$$file
2418         case "$xxx" in
2419         /*|?:[\\/]*)
2420                 if test -f "$xxx"; then
2421                         : ok
2422                 else
2423                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2424                         xxx=`./loc $file $file $pth`
2425                 fi
2426                 ;;
2427         '') xxx=`./loc $file $file $pth`;;
2428         *) xxx=`./loc $xxx $xxx $pth`;;
2429         esac
2430         eval $file=$xxx$_exe
2431         eval _$file=$xxx
2432         case "$xxx" in
2433         /*)
2434                 echo $file is in $xxx.
2435                 ;;
2436         ?:[\\/]*)
2437                 echo $file is in $xxx.
2438                 ;;
2439         *)
2440                 echo "I don't see $file out there, $say."
2441                 say=either
2442                 ;;
2443         esac
2444 done
2445 case "$egrep" in
2446 egrep)
2447         echo "Substituting grep for egrep."
2448         egrep=$grep
2449         _egrep=$grep
2450         ;;
2451 esac
2452 case "$less" in
2453 '')     ;;
2454 *)      if $less -R </dev/null >/dev/null; then
2455                echo "Substituting less -R for less."
2456                less="$less -R"
2457                _less=$less
2458         fi
2459         ;;
2460 esac
2461 case "$ln" in
2462 ln)
2463         echo "Substituting cp for ln."
2464         ln=$cp
2465         _ln=$cp
2466         ;;
2467 esac
2468 case "$make" in
2469 make)
2470         case "$gmake" in
2471         gmake)
2472         echo "I can't find make or gmake, and my life depends on it." >&4
2473         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2474         exit 1
2475         ;;
2476         esac
2477         ;;
2478 esac
2479 case "$gmake" in
2480 gmake)  ;;
2481 *)      # We can't have osname yet.
2482         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2483                 # Assume that gmake, if found, is definitely GNU make
2484                 # and prefer it over the system make.
2485                 echo "Substituting gmake for make."
2486                 make=$gmake
2487                 _make=$gmake
2488         fi
2489         ;;
2490 esac
2491 case "$test" in
2492 test)
2493         echo "Hopefully test is built into your sh."
2494         ;;
2495 *)
2496         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2497                 echo "Using the test built into your sh."
2498                 test=test
2499                 _test=test
2500         fi
2501         ;;
2502 esac
2503 case "$echo" in
2504 echo)
2505         echo "Hopefully echo is built into your sh."
2506         ;;
2507 '') ;;
2508 *)
2509         echo " "
2510 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2511         $echo $n "hi there$c" >foo1
2512         echo $n "hi there$c" >foo2
2513         if cmp foo1 foo2 >/dev/null 2>&1; then
2514                 echo "They are compatible.  In fact, they may be identical."
2515         else
2516                 case "$n" in
2517                 '-n') n='' c='\c';;
2518                 *) n='-n' c='';;
2519                 esac
2520                 cat <<FOO
2521 They are not compatible!  You are probably running ksh on a non-USG system.
2522 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2523 have echo built in and we may have to run some Bourne shell scripts.  That
2524 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2525
2526 FOO
2527                 $echo $n "The star should be here-->$c"
2528                 $echo "*"
2529         fi
2530         $rm -f foo1 foo2
2531         ;;
2532 esac
2533
2534 # This question was auctioned at YAPC::Europe-2007 in Vienna
2535 # I never promised you could answer it. I only auctioned the question.
2536 cat <<FOO
2537 The following message is sponsored by
2538
2539   Dresden.pm<--The stars should be here.
2540
2541 Dear Perl user, system administrator or package
2542 maintainer, the Perl community sends greetings to
2543 you. Do you (emblematical) greet back [Y/n]? n
2544
2545 FOO
2546
2547 : Check what type of C compiler we use
2548 cat <<EOS >trygcc
2549 $startsh
2550 EOS
2551 cat <<'EOSC' >>trygcc
2552 case "$cc" in
2553 '') ;;
2554 *)  $rm -f try try.*
2555     $cat >try.c <<EOM
2556 int main(int argc, char *argv[]) {
2557   return 0;
2558 }
2559 EOM
2560     if $cc -o try $ccflags $ldflags try.c; then
2561        :
2562     else
2563         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2564         despair=yes
2565         trygcc=yes
2566         case "$cc" in
2567         *gcc*) trygcc=no ;;
2568         esac
2569         # Skip this test because it gives a false match on output like:
2570         #    ./trygcc: line 23: cc: command not found
2571         # case "`$cc -v -c try.c 2>&1`" in
2572         # *gcc*) trygcc=no ;;
2573         # esac
2574         if $test X"$trygcc" = Xyes; then
2575             if gcc -o try -c try.c; then
2576                 echo " "
2577                 echo "You seem to have a working gcc, though." >&4
2578                 # Switching compilers may undo the work of hints files.
2579                 # The most common problem is -D_REENTRANT for threads.
2580                 # This heuristic catches that case, but gets false positives
2581                 # if -Dusethreads was not actually specified.  Better to
2582                 # bail out here with a useful message than fail 
2583                 # mysteriously later. Should we perhaps just try to
2584                 # re-invoke Configure -Dcc=gcc config_args ?
2585                 if $test -f usethreads.cbu; then
2586                         $cat >&4 <<EOM 
2587
2588 *** However, any setting of the C compiler flags (e.g. for thread support)
2589 *** will be lost.  It may be necessary for you to restart Configure and
2590 *** add -Dcc=gcc to your Configure command line.
2591
2592 EOM
2593                         rp="Would you like to go ahead and try gcc anyway?"
2594                         dflt=n
2595                 else
2596                         rp="Would you like to use it?"
2597                         dflt=y
2598                 fi
2599                 if $test -f myread; then
2600                     . ./myread
2601                 else
2602                     if $test -f UU/myread; then
2603                         . ./UU/myread
2604                     else
2605                         echo "Cannot find myread, sorry.  Aborting." >&2
2606                         exit 1
2607                     fi
2608                 fi  
2609                 case "$ans" in
2610                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2611                 esac
2612             fi
2613         fi
2614     fi
2615     $rm -f try try.*
2616     ;;
2617 esac
2618 EOSC
2619
2620 cat <<EOS >checkcc
2621 $startsh
2622 EOS
2623 cat <<'EOSC' >>checkcc
2624 case "$cc" in        
2625 '') ;;
2626 *)  $rm -f try try.*              
2627     $cat >try.c <<EOM
2628 int main(int argc, char *argv[]) {
2629   return 0;
2630 }
2631 EOM
2632     if $cc -o try $ccflags $ldflags try.c; then
2633        :
2634     else
2635         if $test X"$despair" = Xyes; then
2636            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2637         fi
2638         $cat >&4 <<EOM         
2639 You need to find a working C compiler.
2640 Either (purchase and) install the C compiler supplied by your OS vendor,
2641 or for a free C compiler try http://gcc.gnu.org/
2642 I cannot continue any further, aborting.
2643 EOM
2644         exit 1
2645     fi
2646     $rm -f try try.*
2647     ;;
2648 esac
2649 EOSC
2650
2651 : determine whether symbolic links are supported
2652 echo " "
2653 $touch blurfl
2654 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2655         echo "Symbolic links are supported." >&4
2656         lns="$ln -s"
2657 else
2658         echo "Symbolic links are NOT supported." >&4
2659         lns="$ln"
2660 fi
2661 $rm -f blurfl sym
2662
2663 : determine whether symbolic links are supported
2664 echo " "
2665 case "$lns" in
2666 *"ln"*" -s")
2667         echo "Checking how to test for symbolic links..." >&4
2668         $lns blurfl sym
2669         if $test "X$issymlink" = X; then
2670                 case "$newsh" in
2671                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2672                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673                 esac
2674                 if test $? = 0; then
2675                         issymlink="test -h"
2676                 else
2677                         echo "Your builtin 'test -h' may be broken." >&4
2678                         case "$test" in
2679                         /*)     ;;
2680                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2681                                 for p in $pth
2682                                 do
2683                                         if test -f "$p/$test"; then
2684                                                 test="$p/$test"
2685                                                 break
2686                                         fi
2687                                 done
2688                                 ;;
2689                         esac
2690                         case "$test" in
2691                         /*)
2692                                 echo "Trying external '$test -h'." >&4
2693                                 issymlink="$test -h"
2694                                 if $test ! -h sym >/dev/null 2>&1; then
2695                                         echo "External '$test -h' is broken, too." >&4
2696                                         issymlink=''
2697                                 fi
2698                                 ;;
2699                         *)      issymlink='' ;;
2700                         esac
2701                 fi              
2702         fi
2703         if $test "X$issymlink" = X; then
2704                 if $test -L sym 2>/dev/null; then
2705                         issymlink="$test -L"
2706                         echo "The builtin '$test -L' worked." >&4
2707                 fi
2708         fi
2709         if $test "X$issymlink" != X; then
2710                 echo "You can test for symbolic links with '$issymlink'." >&4
2711         else
2712                 echo "I do not know how you can test for symbolic links." >&4
2713         fi
2714         $rm -f blurfl sym
2715         ;;
2716 *)      echo "No symbolic links, so not testing for their testing..." >&4
2717         ;;
2718 esac
2719 echo " "
2720
2721 : Make symlinks util
2722 case "$mksymlinks" in
2723 $define|true|[yY]*)
2724         case "$src" in
2725         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2726                 exit 1
2727                 ;;
2728         *)      case "$lns:$issymlink" in
2729                 *"ln"*" -s:"*"test -"?)
2730                         echo "Creating the symbolic links..." >&4
2731                         echo "(First creating the subdirectories...)" >&4
2732                         cd ..
2733                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2734                                 read directory
2735                                 test -z "$directory" && break
2736                                 mkdir -p $directory
2737                         done
2738                         # Sanity check 1.
2739                         if test ! -d t/base; then
2740                                 echo "Failed to create the subdirectories.  Aborting." >&4
2741                                 exit 1
2742                         fi
2743                         echo "(Then creating the symlinks...)" >&4
2744                         awk '{print $1}' $src/MANIFEST | while true; do
2745                                 read filename
2746                                 test -z "$filename" && break
2747                                 if test -f $filename; then
2748                                         if $issymlink $filename; then
2749                                                 rm -f $filename
2750                                         fi
2751                                 fi
2752                                 if test -f $filename; then
2753                                         echo "$filename already exists, not symlinking."
2754                                 else
2755                                         ln -s $src/$filename $filename
2756                                 fi
2757                         done
2758                         # Sanity check 2.
2759                         if test ! -f t/base/lex.t; then
2760                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2761                                 exit 1
2762                         fi
2763                         cd UU
2764                         ;;
2765                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2766                         ;;
2767                 esac
2768                 ;;
2769         esac
2770         ;;
2771 esac
2772
2773 : Check for Cross-Compilation
2774 case "$usecrosscompile" in
2775 $define|true|[yY]*)
2776         $echo "Cross-compiling..."
2777         croak=''
2778         case "$cc" in
2779         *-*-gcc) # A cross-compiling gcc, probably.
2780             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2781             ar=$targetarch-ar
2782             # leave out ld, choosing it is more complex
2783             nm=$targetarch-nm
2784             ranlib=$targetarch-ranlib
2785             $echo 'extern int foo;' > try.c
2786             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2787             shift
2788             if $test $# -gt 0; then
2789                 incpth="$incpth $*"
2790                 incpth="`$echo $incpth|$sed 's/^ //'`"
2791                 echo "Guessing incpth '$incpth'." >&4
2792                 for i in $*; do
2793                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2794                     if $test -d $j; then
2795                         libpth="$libpth $j"
2796                     fi
2797                 done   
2798                 libpth="`$echo $libpth|$sed 's/^ //'`"
2799                 echo "Guessing libpth '$libpth'." >&4
2800             fi
2801             $rm -f try.c
2802             ;;
2803         esac
2804         case "$targetarch" in
2805         '') echo "Targetarch not defined." >&4; croak=y ;;
2806         *)  echo "Using targetarch $targetarch." >&4 ;;
2807         esac
2808         case "$incpth" in
2809         '') echo "Incpth not defined." >&4; croak=y ;;
2810         *)  echo "Using incpth '$incpth'." >&4 ;;
2811         esac
2812         case "$libpth" in
2813         '') echo "Libpth not defined." >&4; croak=y ;;
2814         *)  echo "Using libpth '$libpth'." >&4 ;;
2815         esac
2816         case "$usrinc" in
2817         '') for i in $incpth; do
2818                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2819                     usrinc=$i
2820                     echo "Guessing usrinc $usrinc." >&4
2821                     break
2822                 fi
2823             done
2824             case "$usrinc" in
2825             '') echo "Usrinc not defined." >&4; croak=y ;;
2826             esac
2827             ;;
2828         *)  echo "Using usrinc $usrinc." >&4 ;;
2829         esac
2830         case "$targethost" in
2831         '') echo "Targethost not defined." >&4; croak=y ;;
2832         *)  echo "Using targethost $targethost." >&4
2833         esac
2834         locincpth=' '
2835         loclibpth=' '
2836         case "$croak" in
2837         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2838         esac
2839         case "$src" in
2840         /*) run=$src/Cross/run
2841             targetmkdir=$src/Cross/mkdir
2842             to=$src/Cross/to
2843             from=$src/Cross/from
2844             ;;
2845         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2846             run=$pwd/Cross/run
2847             targetmkdir=$pwd/Cross/mkdir
2848             to=$pwd/Cross/to
2849             from=$pwd/Cross/from
2850             ;;
2851         esac
2852         case "$targetrun" in
2853         '') targetrun=ssh ;;
2854         esac
2855         case "$targetto" in
2856         '') targetto=scp ;;
2857         esac
2858         case "$targetfrom" in
2859         '') targetfrom=scp ;;
2860         esac
2861         run=$run-$targetrun
2862         to=$to-$targetto
2863         from=$from-$targetfrom
2864         case "$targetdir" in
2865         '')  targetdir=/tmp
2866              echo "Guessing targetdir $targetdir." >&4
2867              ;;
2868         esac
2869         case "$targetuser" in
2870         '')  targetuser=root
2871              echo "Guessing targetuser $targetuser." >&4
2872              ;;
2873         esac
2874         case "$targetfrom" in
2875         scp)    q=-q ;;
2876         *)      q='' ;;
2877         esac
2878         case "$targetrun" in
2879         ssh|rsh)
2880             cat >$run <<EOF
2881 #!/bin/sh
2882 case "\$1" in
2883 -cwd)
2884   shift
2885   cwd=\$1
2886   shift
2887   ;;
2888 esac
2889 case "\$cwd" in
2890 '') cwd=$targetdir ;;
2891 esac
2892 exe=\$1
2893 shift
2894 if $test ! -f \$exe.xok; then
2895   $to \$exe
2896   $touch \$exe.xok
2897 fi
2898 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2899 EOF
2900             ;;
2901         *)  echo "Unknown targetrun '$targetrun'" >&4
2902             exit 1
2903             ;;
2904         esac
2905         case "$targetmkdir" in
2906         */Cross/mkdir)
2907             cat >$targetmkdir <<EOF
2908 #!/bin/sh
2909 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2910 EOF
2911             $chmod a+rx $targetmkdir
2912             ;;
2913         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2914             exit 1
2915             ;;
2916         esac
2917         case "$targetto" in
2918         scp|rcp)
2919             cat >$to <<EOF
2920 #!/bin/sh
2921 for f in \$@
2922 do
2923   case "\$f" in
2924   /*)
2925     $targetmkdir \`dirname \$f\`
2926     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2927     ;;
2928   *)
2929     $targetmkdir $targetdir/\`dirname \$f\`
2930     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2931     ;;
2932   esac
2933 done
2934 exit 0
2935 EOF
2936             ;;
2937         cp) cat >$to <<EOF
2938 #!/bin/sh
2939 for f in \$@
2940 do
2941   case "\$f" in
2942   /*)
2943     $mkdir -p $targetdir/\`dirname \$f\`
2944     $cp \$f $targetdir/\$f || exit 1
2945     ;;
2946   *)
2947     $targetmkdir $targetdir/\`dirname \$f\`
2948     $cp \$f $targetdir/\$f || exit 1
2949     ;;
2950   esac
2951 done
2952 exit 0
2953 EOF
2954             ;;
2955         *)  echo "Unknown targetto '$targetto'" >&4
2956             exit 1
2957             ;;
2958         esac
2959         case "$targetfrom" in
2960         scp|rcp)
2961           cat >$from <<EOF
2962 #!/bin/sh
2963 for f in \$@
2964 do
2965   $rm -f \$f
2966   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2967 done
2968 exit 0
2969 EOF
2970             ;;
2971         cp) cat >$from <<EOF
2972 #!/bin/sh
2973 for f in \$@
2974 do
2975   $rm -f \$f
2976   cp $targetdir/\$f . || exit 1
2977 done
2978 exit 0
2979 EOF
2980             ;;
2981         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2982             exit 1
2983             ;;
2984         esac
2985         if $test ! -f $run; then
2986             echo "Target 'run' script '$run' not found." >&4
2987         else
2988             $chmod a+rx $run
2989         fi
2990         if $test ! -f $to; then
2991             echo "Target 'to' script '$to' not found." >&4
2992         else
2993             $chmod a+rx $to
2994         fi
2995         if $test ! -f $from; then
2996             echo "Target 'from' script '$from' not found." >&4
2997         else
2998             $chmod a+rx $from
2999         fi
3000         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3001             exit 1
3002         fi
3003         cat >&4 <<EOF
3004 Using '$run' for remote execution,
3005 and '$from' and '$to'
3006 for remote file transfer.
3007 EOF
3008         ;;
3009 *)      run=''
3010         to=:
3011         from=:
3012         usecrosscompile='undef'
3013         targetarch=''
3014         ;;
3015 esac
3016
3017 : see whether [:lower:] and [:upper:] are supported character classes
3018 echo " "
3019 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3020 ABYZ)
3021         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3022         up='[:upper:]'
3023         low='[:lower:]'
3024         ;;
3025 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3026         # (0xd9 and 0xe2), therefore that is a nice testing point.
3027         if test "X$up" = X -o "X$low" = X; then
3028             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3029             rs) up='[A-Z]'
3030                 low='[a-z]'
3031                 ;;
3032             esac
3033         fi
3034         if test "X$up" = X -o "X$low" = X; then
3035             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3036             rs) up='A-Z'
3037                 low='a-z'
3038                 ;;
3039             esac
3040         fi
3041         if test "X$up" = X -o "X$low" = X; then
3042             case "`echo RS | od -x 2>/dev/null`" in
3043             *D9E2*|*d9e2*)
3044                 echo "Hey, this might be EBCDIC." >&4
3045                 if test "X$up" = X -o "X$low" = X; then
3046                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3047                     rs) up='[A-IJ-RS-Z]'
3048                         low='[a-ij-rs-z]'
3049                         ;;
3050                     esac
3051                 fi
3052                 if test "X$up" = X -o "X$low" = X; then
3053                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3054                     rs) up='A-IJ-RS-Z'
3055                         low='a-ij-rs-z'
3056                         ;;
3057                     esac
3058                 fi
3059                 ;;
3060             esac
3061         fi
3062 esac
3063 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3064 rs)
3065     echo "Using $up and $low to convert case." >&4
3066     ;;
3067 *)
3068     echo "I don't know how to translate letters from upper to lower case." >&4
3069     echo "Your tr is not acting any way I know of." >&4
3070     exit 1
3071     ;;
3072 esac
3073 : set up the translation script tr, must be called with ./tr of course
3074 cat >tr <<EOSC
3075 $startsh
3076 case "\$1\$2" in
3077 '[A-Z][a-z]') exec $tr '$up' '$low';;
3078 '[a-z][A-Z]') exec $tr '$low' '$up';;
3079 esac
3080 exec $tr "\$@"
3081 EOSC
3082 chmod +x tr
3083 $eunicefix tr
3084
3085 : Try to determine whether config.sh was made on this system
3086 case "$config_sh" in
3087 '')
3088 myuname=`$uname -a 2>/dev/null`
3089 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3090 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3091 # because the A-Z/a-z are not consecutive.
3092 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3093         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3094 newmyuname="$myuname"
3095 dflt=n
3096 case "$knowitall" in
3097 '')
3098         if test -f ../config.sh; then
3099                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3100                         eval "`grep myuname= ../config.sh`"
3101                 fi
3102                 if test "X$myuname" = "X$newmyuname"; then
3103                         dflt=y
3104                 fi
3105         fi
3106         ;;
3107 *) dflt=y;;
3108 esac
3109
3110 : Get old answers from old config file if Configure was run on the
3111 : same system, otherwise use the hints.
3112 hint=default
3113 cd ..
3114 if test -f config.sh; then
3115         echo " "
3116         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3117         . UU/myread
3118         case "$ans" in
3119         n*|N*) echo "OK, I'll ignore it."
3120                 mv config.sh config.sh.old
3121                 myuname="$newmyuname"
3122                 ;;
3123         *)  echo "Fetching default answers from your old config.sh file..." >&4
3124                 tmp_n="$n"
3125                 tmp_c="$c"
3126                 tmp_sh="$sh"
3127                 . ./config.sh
3128                 cp config.sh UU
3129                 n="$tmp_n"
3130                 c="$tmp_c"
3131                 : Older versions did not always set $sh.  Catch re-use of such
3132                 : an old config.sh.
3133                 case "$sh" in
3134                 '') sh="$tmp_sh" ;;
3135                 esac
3136                 hint=previous
3137                 ;;
3138         esac
3139 fi
3140 . ./UU/checkcc
3141 if test ! -f config.sh; then
3142         $cat <<EOM
3143
3144 First time through, eh?  I have some defaults handy for some systems
3145 that need some extra help getting the Configure answers right:
3146
3147 EOM
3148         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3149         dflt=''
3150         : Half the following guesses are probably wrong... If you have better
3151         : tests or hints, please send them to perlbug@perl.org
3152         : The metaconfig authors would also appreciate a copy...
3153         $test -f /irix && osname=irix
3154         $test -f /xenix && osname=sco_xenix
3155         $test -f /dynix && osname=dynix
3156         $test -f /dnix && osname=dnix
3157         $test -f /lynx.os && osname=lynxos
3158         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3159         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3160         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3161         $test -f /bin/mips && /bin/mips && osname=mips
3162         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3163                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3164         $test -d /usr/apollo/bin && osname=apollo
3165         $test -f /etc/saf/_sactab && osname=svr4
3166         $test -d /usr/include/minix && osname=minix
3167         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3168         if $test -d /MachTen -o -d /MachTen_Folder; then
3169                 osname=machten
3170                 if $test -x /sbin/version; then
3171                         osvers=`/sbin/version | $awk '{print $2}' |
3172                         $sed -e 's/[A-Za-z]$//'`
3173                 elif $test -x /usr/etc/version; then
3174                         osvers=`/usr/etc/version | $awk '{print $2}' |
3175                         $sed -e 's/[A-Za-z]$//'`
3176                 else
3177                         osvers="$2.$3"
3178                 fi
3179         fi
3180
3181         $test -f /sys/posix.dll &&
3182                 $test -f /usr/bin/what &&
3183                 set X `/usr/bin/what /sys/posix.dll` &&
3184                 $test "$3" = UWIN &&
3185                 osname=uwin &&
3186                 osvers="$5"
3187
3188         if $test -f $uname; then
3189                 set X $myuname
3190                 shift
3191
3192                 case "$5" in
3193                 fps*) osname=fps ;;
3194                 mips*)
3195                         case "$4" in
3196                         umips) osname=umips ;;
3197                         *) osname=mips ;;
3198                         esac;;
3199                 [23]100) osname=mips ;;
3200                 next*) osname=next ;;
3201                 i386*)
3202                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3203                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3204                                 osname='sco'
3205                                 osvers=$tmp
3206                         elif $test -f /etc/kconfig; then
3207                                 osname=isc
3208                                 if test "$lns" = "$ln -s"; then
3209                                         osvers=4
3210                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3211                                         osvers=3
3212                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3213                                         osvers=2
3214                                 fi
3215                         fi
3216                         tmp=''
3217                         ;;
3218                 pc*)
3219                         if test -n "$DJGPP"; then
3220                                 osname=dos
3221                                 osvers=djgpp
3222                         fi
3223                         ;;
3224                 esac
3225
3226                 case "$1" in
3227                 aix) osname=aix
3228                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3229                         case "$tmp" in
3230                         # oslevel can fail with:
3231                         # oslevel: Unable to acquire lock.
3232                         *not\ found) osvers="$4"."$3" ;;
3233                         '<3240'|'<>3240') osvers=3.2.0 ;;
3234                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3235                         '=3250'|'>3250') osvers=3.2.5 ;;
3236                         *) osvers=$tmp;;
3237                         esac
3238                         ;;
3239                 bsd386) osname=bsd386
3240                         osvers=`$uname -r`
3241                         ;;
3242                 cygwin*) osname=cygwin
3243                         osvers="$3"
3244                         ;;
3245                 *dc.osx) osname=dcosx
3246                         osvers="$3"
3247                         ;;
3248                 dnix) osname=dnix
3249                         osvers="$3"
3250                         ;;
3251                 domainos) osname=apollo
3252                         osvers="$3"
3253                         ;;
3254                 dgux)   osname=dgux
3255                         osvers="$3"
3256                         ;;
3257                 dragonfly) osname=dragonfly
3258                         osvers="$3"
3259                         ;;
3260                 dynixptx*) osname=dynixptx
3261                         osvers=`echo "$4"|sed 's/^v//'`
3262                         ;;
3263                 freebsd) osname=freebsd
3264                         osvers="$3" ;;
3265                 genix)  osname=genix ;;
3266                 gnu)    osname=gnu
3267                         osvers="$3" ;;
3268                 hp*)    osname=hpux
3269                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3270                         ;;
3271                 irix*)  osname=irix
3272                         case "$3" in
3273                         4*) osvers=4 ;;
3274                         5*) osvers=5 ;;
3275                         *)      osvers="$3" ;;
3276                         esac
3277                         ;;
3278                 linux)  osname=linux
3279                         case "$3" in
3280                         *)      osvers="$3" ;;
3281                         esac
3282                         ;;
3283                 MiNT)   osname=mint
3284                         ;;
3285                 netbsd*) osname=netbsd
3286                         osvers="$3"
3287                         ;;
3288                 news-os) osvers="$3"
3289                         case "$3" in
3290                         4*) osname=newsos4 ;;
3291                         *) osname=newsos ;;
3292                         esac
3293                         ;;
3294                 next*) osname=next ;;
3295                 nonstop-ux) osname=nonstopux ;;
3296                 openbsd) osname=openbsd
3297                         osvers="$3"
3298                         ;;
3299                 os2)    osname=os2
3300                         osvers="$4"
3301                         ;;
3302                 POSIX-BC | posix-bc ) osname=posix-bc
3303                         osvers="$3"
3304                         ;;
3305                 powerux | power_ux | powermax_os | powermaxos | \
3306                 powerunix | power_unix) osname=powerux
3307                         osvers="$3"
3308                         ;;
3309                 qnx) osname=qnx
3310                         osvers="$4"
3311                         ;;
3312                 solaris) osname=solaris
3313                         case "$3" in
3314                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3315                         *)      osvers="$3" ;;
3316                         esac
3317                         ;;
3318                 sunos) osname=sunos
3319                         case "$3" in
3320                         5*) osname=solaris
3321                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3322                         *)      osvers="$3" ;;
3323                         esac
3324                         ;;
3325                 titanos) osname=titanos
3326                         case "$3" in
3327                         1*) osvers=1 ;;
3328                         2*) osvers=2 ;;
3329                         3*) osvers=3 ;;
3330                         4*) osvers=4 ;;
3331                         *)      osvers="$3" ;;
3332                         esac
3333                         ;;
3334                 ultrix) osname=ultrix
3335                         osvers="$3"
3336                         ;;
3337                 osf1|mls+)      case "$5" in
3338                                 alpha)
3339                                         osname=dec_osf
3340                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3341                                         case "$osvers" in
3342                                         [1-9].[0-9]*) ;;
3343                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3344                                         esac
3345                                         ;;
3346                         hp*)    osname=hp_osf1  ;;
3347                         mips)   osname=mips_osf1 ;;
3348                         esac
3349                         ;;
3350                 # UnixWare 7.1.2 is known as Open UNIX 8
3351                 openunix|unixware) osname=svr5
3352                         osvers="$4"
3353                         ;;
3354                 uts)    osname=uts
3355                         osvers="$3"
3356                         ;;
3357                 vos) osvers="$3"
3358                         ;;
3359                 $2) case "$osname" in
3360                         *isc*) ;;
3361                         *freebsd*) ;;
3362                         svr*)
3363                                 : svr4.x or possibly later
3364                                 case "svr$3" in
3365                                 ${osname}*)
3366                                         osname=svr$3
3367                                         osvers=$4
3368                                         ;;
3369                                 esac
3370                                 case "$osname" in
3371                                 svr4.0)
3372                                         : Check for ESIX
3373                                         if test -f /stand/boot ; then
3374                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3375                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3376                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3377                                                         if test -n "$isesix"; then
3378                                                                 osname=esix4
3379                                                         fi
3380                                                 fi
3381                                         fi
3382                                         ;;
3383                                 esac
3384                                 ;;
3385                         *)      if test -f /etc/systemid; then
3386                                         osname=sco
3387                                         set `echo $3 | $sed 's/\./ /g'` $4
3388                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3389                                                 osvers=$1.$2.$3
3390                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3391                                                 osvers=$1.$2
3392                                         elif $test -f $src/hints/sco_$1.sh; then
3393                                                 osvers=$1
3394                                         fi
3395                                 else
3396                                         case "$osname" in
3397                                         '') : Still unknown.  Probably a generic Sys V.
3398                                                 osname="sysv"
3399                                                 osvers="$3"
3400                                                 ;;
3401                                         esac
3402                                 fi
3403                                 ;;
3404                         esac
3405                         ;;
3406                 *)      case "$osname" in
3407                         '') : Still unknown.  Probably a generic BSD.
3408                                 osname="$1"
3409                                 osvers="$3"
3410                                 ;;
3411                         esac
3412                         ;;
3413                 esac
3414         else
3415                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3416                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3417                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3418                                 osname=news_os
3419                         fi
3420                         $rm -f UU/kernel.what
3421                 elif test -d c:/. -o -n "$is_os2" ; then
3422                         set X $myuname
3423                         osname=os2
3424                         osvers="$5"
3425                 fi
3426         fi
3427
3428         case "$targetarch" in
3429         '') ;;
3430         *)  hostarch=$osname
3431             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3432             osvers=''
3433             ;;
3434         esac
3435
3436         : Now look for a hint file osname_osvers, unless one has been
3437         : specified already.
3438         case "$hintfile" in
3439         ''|' ')
3440                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3441                 : Also try without trailing minor version numbers.
3442                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3443                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3444                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3445                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3446                 case "$file" in
3447                 '') dflt=none ;;
3448                 *)  case "$osvers" in
3449                         '') dflt=$file
3450                                 ;;
3451                         *)  if $test -f $src/hints/$file.sh ; then
3452                                         dflt=$file
3453                                 elif $test -f $src/hints/$xfile.sh ; then
3454                                         dflt=$xfile
3455                                 elif $test -f $src/hints/$xxfile.sh ; then
3456                                         dflt=$xxfile
3457                                 elif $test -f $src/hints/$xxxfile.sh ; then
3458                                         dflt=$xxxfile
3459                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3460                                         dflt=$xxxxfile
3461                                 elif $test -f "$src/hints/${osname}.sh" ; then
3462                                         dflt="${osname}"
3463                                 else
3464                                         dflt=none
3465                                 fi
3466                                 ;;
3467                         esac
3468                         ;;
3469                 esac
3470                 if $test -f Policy.sh ; then
3471                         case "$dflt" in
3472                         *Policy*) ;;
3473                         none) dflt="Policy" ;;
3474                         *) dflt="Policy $dflt" ;;
3475                         esac
3476                 fi
3477                 ;;
3478         *)
3479                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3480                 ;;
3481         esac
3482
3483         if $test -f Policy.sh ; then
3484                 $cat <<EOM
3485
3486 There's also a Policy hint file available, which should make the
3487 site-specific (policy) questions easier to answer.
3488 EOM
3489
3490         fi
3491
3492         $cat <<EOM
3493
3494 You may give one or more space-separated answers, or "none" if appropriate.
3495 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3496 previous run of Configure, you may specify it as well as or instead of
3497 OS-specific hints.  If hints are provided for your OS, you should use them:
3498 although Perl can probably be built without hints on many platforms, using
3499 hints often improve performance and may enable features that Configure can't
3500 set up on its own. If there are no hints that match your OS, specify "none";
3501 DO NOT give a wrong version or a wrong OS.
3502
3503 EOM
3504
3505         rp="Which of these apply, if any?"
3506         . UU/myread
3507         tans=$ans
3508         for file in $tans; do
3509                 if $test X$file = XPolicy -a -f Policy.sh; then
3510                         . Policy.sh
3511                         $cat Policy.sh >> UU/config.sh
3512                 elif $test -f $src/hints/$file.sh; then
3513                         . $src/hints/$file.sh
3514                         $cat $src/hints/$file.sh >> UU/config.sh
3515                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3516                         : nothing
3517                 else
3518                         : Give one chance to correct a possible typo.
3519                         echo "$file.sh does not exist"
3520                         dflt=$file
3521                         rp="hint to use instead?"
3522                         . UU/myread
3523                         for file in $ans; do
3524                                 if $test -f "$src/hints/$file.sh"; then
3525                                         . $src/hints/$file.sh
3526                                         $cat $src/hints/$file.sh >> UU/config.sh
3527                                 elif $test X$ans = X -o X$ans = Xnone ; then
3528                                         : nothing
3529                                 else
3530                                         echo "$file.sh does not exist -- ignored."
3531                                 fi
3532                         done
3533                 fi
3534         done
3535
3536         hint=recommended
3537         : Remember our hint file for later.
3538         if $test -f "$src/hints/$file.sh" ; then
3539                 hintfile="$file"
3540         else
3541                 hintfile=''
3542         fi
3543 fi
3544 cd UU
3545 ;;
3546 *)
3547         echo " "
3548         echo "Fetching default answers from $config_sh..." >&4
3549         tmp_n="$n"
3550         tmp_c="$c"
3551         cd ..
3552         cp $config_sh config.sh 2>/dev/null
3553         chmod +w config.sh
3554         . ./config.sh
3555         cd UU
3556         cp ../config.sh .
3557         n="$tmp_n"
3558         c="$tmp_c"
3559         hint=previous
3560         ;;
3561 esac
3562 test "$override" && . ./optdef.sh
3563
3564 : Restore computed paths
3565 for file in $loclist $trylist; do
3566         eval $file="\$_$file"
3567 done
3568
3569 cat << EOM
3570
3571 Configure uses the operating system name and version to set some defaults.
3572 The default value is probably right if the name rings a bell. Otherwise,
3573 since spelling matters for me, either accept the default or answer "none"
3574 to leave it blank.
3575
3576 EOM
3577 case "$osname" in
3578         ''|' ')
3579                 case "$hintfile" in
3580                 ''|' '|none) dflt=none ;;
3581                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3582                 esac
3583                 ;;
3584         *) dflt="$osname" ;;
3585 esac
3586 rp="Operating system name?"
3587 . ./myread
3588 case "$ans" in
3589 none)  osname='' ;;
3590 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3591 esac
3592 echo " "
3593 case "$osvers" in
3594         ''|' ')
3595                 case "$hintfile" in
3596                 ''|' '|none) dflt=none ;;
3597                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3598                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3599                         case "$dflt" in
3600                         ''|' ') dflt=none ;;
3601                         esac
3602                         ;;
3603                 esac
3604                 ;;
3605         *) dflt="$osvers" ;;
3606 esac
3607 rp="Operating system version?"
3608 . ./myread
3609 case "$ans" in
3610 none)  osvers='' ;;
3611 *) osvers="$ans" ;;
3612 esac
3613
3614
3615 . ./posthint.sh
3616
3617 : who configured the system
3618 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3619 case "$cf_by" in
3620 "")
3621         cf_by=`(logname) 2>/dev/null`
3622         case "$cf_by" in
3623         "")
3624                 cf_by=`(whoami) 2>/dev/null`
3625                 case "$cf_by" in
3626                 "") cf_by=unknown ;;
3627                 esac ;;
3628         esac ;;
3629 esac
3630
3631 : decide how portable to be.  Allow command line overrides.
3632 case "$d_portable" in
3633 "$undef") ;;
3634 *)      d_portable="$define" ;;
3635 esac
3636
3637 : set up shell script to do ~ expansion
3638 cat >filexp <<EOSS
3639 $startsh
3640 : expand filename
3641 case "\$1" in
3642  \~/*|\~)
3643         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3644         ;;
3645  \~*)
3646         if $test -f /bin/csh; then
3647                 /bin/csh -f -c "glob \$1"
3648                 failed=\$?
3649                 echo ""
3650                 exit \$failed
3651         else
3652                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3653                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3654                 if $test ! -d "\$dir"; then
3655                         me=\`basename \$0\`
3656                         echo "\$me: can't locate home directory for: \$name" >&2
3657                         exit 1
3658                 fi
3659                 case "\$1" in
3660                 */*)
3661                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3662                         ;;
3663                 *)
3664                         echo \$dir
3665                         ;;
3666                 esac
3667         fi
3668         ;;
3669 *)
3670         echo \$1
3671         ;;
3672 esac
3673 EOSS
3674 chmod +x filexp
3675 $eunicefix filexp
3676
3677 : now set up to get a file name
3678 cat <<EOS >getfile
3679 $startsh
3680 EOS
3681 cat <<'EOSC' >>getfile
3682 tilde=''
3683 fullpath=''
3684 already=''
3685 skip=''
3686 none_ok=''
3687 exp_file=''
3688 nopath_ok=''
3689 orig_rp="$rp"
3690 orig_dflt="$dflt"
3691 case "$gfpth" in
3692 '') gfpth='.' ;;
3693 esac
3694
3695 case "$fn" in
3696 *\(*)
3697         : getfile will accept an answer from the comma-separated list
3698         : enclosed in parentheses even if it does not meet other criteria.
3699         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3700         fn=`echo $fn | sed 's/(.*)//'`
3701         ;;
3702 esac
3703
3704 case "$fn" in
3705 *:*)
3706         loc_file=`expr $fn : '.*:\(.*\)'`
3707         fn=`expr $fn : '\(.*\):.*'`
3708         ;;
3709 esac
3710
3711 case "$fn" in
3712 *~*) tilde=true;;
3713 esac
3714 case "$fn" in
3715 */*) fullpath=true;;
3716 esac
3717 case "$fn" in
3718 *+*) skip=true;;
3719 esac
3720 case "$fn" in
3721 *n*) none_ok=true;;
3722 esac
3723 case "$fn" in
3724 *e*) exp_file=true;;
3725 esac
3726 case "$fn" in
3727 *p*) nopath_ok=true;;
3728 esac
3729
3730 case "$fn" in
3731 *f*) type='File';;
3732 *d*) type='Directory';;
3733 *l*) type='Locate';;
3734 esac
3735
3736 what="$type"
3737 case "$what" in
3738 Locate) what='File';;
3739 esac
3740
3741 case "$exp_file" in
3742 '')
3743         case "$d_portable" in
3744         "$define") ;;
3745         *) exp_file=true;;
3746         esac
3747         ;;
3748 esac
3749
3750 cd ..
3751 while test "$type"; do
3752         redo=''
3753         rp="$orig_rp"
3754         dflt="$orig_dflt"
3755         case "$tilde" in
3756         true) rp="$rp (~name ok)";;
3757         esac
3758         . UU/myread
3759         if test -f UU/getfile.ok && \
3760                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3761         then
3762                 value="$ans"
3763                 ansexp="$ans"
3764                 break
3765         fi
3766         case "$ans" in
3767         none)
3768                 value=''
3769                 ansexp=''
3770                 case "$none_ok" in
3771                 true) type='';;
3772                 esac
3773                 ;;
3774         *)
3775                 case "$tilde" in
3776                 '') value="$ans"
3777                         ansexp="$ans";;
3778                 *)
3779                         value=`UU/filexp $ans`
3780                         case $? in
3781                         0)
3782                                 if test "$ans" != "$value"; then
3783                                         echo "(That expands to $value on this system.)"
3784                                 fi
3785                                 ;;
3786                         *) value="$ans";;
3787                         esac
3788                         ansexp="$value"
3789                         case "$exp_file" in
3790                         '') value="$ans";;
3791                         esac
3792                         ;;
3793                 esac
3794                 case "$fullpath" in
3795                 true)
3796                         case "$ansexp" in
3797                         /*) value="$ansexp" ;;
3798                         [a-zA-Z]:/*) value="$ansexp" ;;
3799                         *)
3800                                 redo=true
3801                                 case "$already" in
3802                                 true)
3803                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3804                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3805                                         ;;
3806                                 *)
3807                                 echo "Please give a full path name, starting with slash." >&4
3808                                         case "$tilde" in
3809                                         true)
3810                                 echo "Note that using ~name is ok provided it expands well." >&4
3811                                                 already=true
3812                                                 ;;
3813                                         esac
3814                                 esac
3815                                 ;;
3816                         esac
3817                         ;;
3818                 esac
3819                 case "$redo" in
3820                 '')
3821                         case "$type" in
3822                         File)
3823                                 for fp in $gfpth; do
3824                                         if test "X$fp" = X.; then
3825                                             pf="$ansexp"
3826                                         else    
3827                                             pf="$fp/$ansexp"
3828                                         fi
3829                                         if test -f "$pf"; then
3830                                                 type=''
3831                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3832                                         then
3833                                                 echo "($value is not a plain file, but that's ok.)"
3834                                                 type=''
3835                                         fi
3836                                         if test X"$type" = X; then
3837                                             value="$pf"
3838                                             break
3839                                         fi
3840                                 done
3841                                 ;;
3842                         Directory)
3843                                 for fp in $gfpth; do
3844                                         if test "X$fp" = X.; then
3845                                             dir="$ans"
3846                                             direxp="$ansexp"
3847                                         else    
3848                                             dir="$fp/$ansexp"
3849                                             direxp="$fp/$ansexp"
3850                                         fi
3851                                         if test -d "$direxp"; then
3852                                                 type=''
3853                                                 value="$dir"
3854                                                 break
3855                                         fi
3856                                 done
3857                                 ;;
3858                         Locate)
3859                                 if test -d "$ansexp"; then
3860                                         echo "(Looking for $loc_file in directory $value.)"
3861                                         value="$value/$loc_file"
3862                                         ansexp="$ansexp/$loc_file"
3863                                 fi
3864                                 if test -f "$ansexp"; then
3865                                         type=''
3866                                 fi
3867                                 case "$nopath_ok" in
3868                                 true)   case "$value" in
3869                                         */*) ;;
3870                                         *)      echo "Assuming $value will be in people's path."
3871                                                 type=''
3872                                                 ;;
3873                                         esac
3874                                         ;;
3875                                 esac
3876                                 ;;
3877                         esac
3878
3879                         case "$skip" in
3880                         true) type='';
3881                         esac
3882
3883                         case "$type" in
3884                         '') ;;
3885                         *)
3886                                 if test "$fastread" = yes; then
3887                                         dflt=y
3888                                 else
3889                                         dflt=n
3890                                 fi
3891                                 rp="$what $value doesn't exist.  Use that name anyway?"
3892                                 . UU/myread
3893                                 dflt=''
3894                                 case "$ans" in
3895                                 y*) type='';;
3896                                 *) echo " ";;
3897                                 esac
3898                                 ;;
3899                         esac
3900                         ;;
3901                 esac
3902                 ;;
3903         esac
3904 done
3905 cd UU
3906 ans="$value"
3907 rp="$orig_rp"
3908 dflt="$orig_dflt"
3909 rm -f getfile.ok
3910 test "X$gfpthkeep" != Xy && gfpth=""
3911 EOSC
3912
3913 : determine root of directory hierarchy where package will be installed.
3914 case "$prefix" in
3915 '')
3916         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3917         ;;
3918 *?/)
3919         dflt=`echo "$prefix" | sed 's/.$//'`
3920         ;;
3921 *)
3922         dflt="$prefix"
3923         ;;
3924 esac
3925 $cat <<EOM
3926
3927 By default, $package will be installed in $dflt/bin, manual pages
3928 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3929 installation directories. Typically this is something like /usr/local.
3930 If you wish to have binaries under /usr/bin but other parts of the
3931 installation under /usr/local, that's ok: you will be prompted
3932 separately for each of the installation directories, the prefix being
3933 only used to set the defaults.
3934
3935 EOM
3936 fn=d~
3937 rp='Installation prefix to use?'
3938 . ./getfile
3939 oldprefix=''
3940 case "$prefix" in
3941 '') ;;
3942 *)
3943         case "$ans" in
3944         "$prefix") ;;
3945         *) oldprefix="$prefix";;
3946         esac
3947         ;;
3948 esac
3949 prefix="$ans"
3950 prefixexp="$ansexp"
3951
3952 : allow them to override the AFS root
3953 case "$afsroot" in
3954 '')     afsroot=/afs ;;
3955 *)      afsroot=$afsroot ;;
3956 esac
3957
3958 : is AFS running?
3959 echo " "
3960 case "$afs" in
3961 $define|true)   afs=true ;;
3962 $undef|false)   afs=false ;;
3963 *)      if $test -d $afsroot; then
3964                 afs=true
3965         else
3966                 afs=false
3967         fi
3968         ;;
3969 esac
3970 if $afs; then
3971         echo "AFS may be running... I'll be extra cautious then..." >&4
3972 else
3973         echo "AFS does not seem to be running..." >&4
3974 fi
3975
3976 : determine installation prefix for where package is to be installed.
3977 if $afs; then 
3978 $cat <<EOM
3979
3980 Since you are running AFS, I need to distinguish the directory in which
3981 files will reside from the directory in which they are installed (and from
3982 which they are presumably copied to the former directory by occult means).
3983
3984 EOM
3985         case "$installprefix" in
3986         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3987         *) dflt="$installprefix";;
3988         esac
3989 else
3990 $cat <<EOM
3991
3992 In some special cases, particularly when building $package for distribution,
3993 it is convenient to distinguish the directory in which files should be
3994 installed from the directory ($prefix) in which they will
3995 eventually reside.  For most users, these two directories are the same.
3996
3997 EOM
3998         case "$installprefix" in
3999         '') dflt=$prefix ;;
4000         *) dflt=$installprefix;;
4001         esac
4002 fi
4003 fn=d~
4004 rp='What installation prefix should I use for installing files?'
4005 . ./getfile
4006 installprefix="$ans"
4007 installprefixexp="$ansexp"
4008
4009 : Perform the prefixexp/installprefixexp correction if necessary
4010 cat <<EOS >installprefix
4011 $startsh
4012 EOS
4013 cat <<'EOSC' >>installprefix
4014 : Change installation prefix, if necessary.
4015 if $test X"$prefix" != X"$installprefix"; then
4016     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4017 else
4018     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4019 fi
4020 EOSC
4021 chmod +x installprefix
4022 $eunicefix installprefix
4023
4024 : Set variables such as privlib and privlibexp from the output of ./getfile
4025 : performing the prefixexp/installprefixexp correction if necessary.
4026 cat <<EOS >setprefixvar
4027 $startsh
4028 EOS
4029 cat <<'EOSC' >>setprefixvar
4030 eval "${prefixvar}=\"\$ans\""
4031 eval "${prefixvar}exp=\"\$ansexp\""
4032 . ./installprefix
4033 EOSC
4034 chmod +x setprefixvar
4035 $eunicefix setprefixvar
4036
4037 : set up the script used to warn in case of inconsistency
4038 cat <<EOS >whoa
4039 $startsh
4040 EOS
4041 cat <<'EOSC' >>whoa
4042 dflt=y
4043 case "$hint" in
4044     recommended)
4045         case "$hintfile" in
4046         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4047                 ;;
4048         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4049                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4050                 ;;
4051         esac
4052         ;;
4053     *)  echo " "
4054         echo "*** WHOA THERE!!! ***" >&4
4055         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4056         ;;
4057 esac
4058 rp="    Keep the $hint value?"
4059 . ./myread
4060 case "$ans" in
4061 y) td=$was; tu=$was;;
4062 esac
4063 EOSC
4064
4065 : function used to set '$1' to '$val'
4066 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4067 case "$val$was" in
4068 $define$undef) . ./whoa; eval "$var=\$td";;
4069 $undef$define) . ./whoa; eval "$var=\$tu";;
4070 *) eval "$var=$val";;
4071 esac'
4072
4073 : Check is we will use socks
4074 case "$usesocks" in
4075 $define|true|[yY]*)     dflt='y';;
4076 *) dflt='n';;
4077 esac
4078 cat <<EOM
4079
4080 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4081 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4082 to use the PerlIO abstraction layer, this will be implicitly selected.
4083
4084 If this doesn't make any sense to you, just accept the default '$dflt'.
4085 EOM
4086 rp='Build Perl for SOCKS?'
4087 . ./myread
4088 case "$ans" in
4089 y|Y)    val="$define" ;;
4090 *)      val="$undef" ;;
4091 esac
4092 set usesocks
4093 eval $setvar
4094
4095 case "$usesocks" in
4096 $define|true|[yY]*) useperlio="$define";;
4097 esac
4098
4099 : Check if we want perlio
4100 case "$useperlio" in
4101 $define|true|[yY]*|'')  dflt='y';;
4102 *) dflt='n';;
4103 esac
4104 cat <<EOM
4105
4106 Previous version of $package used the standard IO mechanisms as
4107 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4108 alternate IO mechanisms via the PerlIO abstraction layer, but the
4109 stdio mechanism is still available if needed.  The abstraction layer
4110 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4111 Using PerlIO with sfio may cause problems with some extension modules.
4112
4113 If this doesn't make any sense to you, just accept the default '$dflt'.
4114 EOM
4115 rp='Use the PerlIO abstraction layer?'
4116 . ./myread
4117 case "$ans" in
4118 y|Y)
4119         val="$define"
4120         ;;
4121 *)
4122         echo "Ok, doing things the stdio way."
4123         val="$undef"
4124         ;;
4125 esac
4126 set useperlio
4127 eval $setvar
4128
4129 case "$usesocks" in
4130 $define|true|[yY]*)
4131         case "$useperlio" in
4132         $define|true|[yY]*) ;;
4133         *)      cat >&4 <<EOM
4134
4135 You are using the SOCKS proxy protocol library which means that you
4136 should also use the PerlIO layer.  You may be headed for trouble.
4137
4138 EOM
4139                 ;;
4140         esac
4141         ;;
4142 esac
4143
4144 : get the patchlevel
4145 echo " "
4146 echo "Getting the current patchlevel..." >&4
4147 if $test -r $rsrc/patchlevel.h;then
4148         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4149         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4150         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4151         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4152         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4153         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4154         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4155 else
4156         revision=0
4157         patchlevel=0
4158         subversion=0
4159         api_revision=0
4160         api_version=0
4161         api_subversion=0
4162         perl_patchlevel=0
4163         $echo "(You do not have patchlevel.h.  Eek.)"
4164 fi
4165 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4166 version_patchlevel_string="version $patchlevel subversion $subversion"
4167 case "$perl_patchlevel" in
4168 0|'') ;;
4169 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4170     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4171     ;;
4172 esac
4173
4174 $echo "(You have $package $version_patchlevel_string.)"
4175
4176 case "$osname" in
4177 dos|vms)
4178         : XXX Should be a Configure test for double-dots in filenames.
4179         version=`echo $revision $patchlevel $subversion | \
4180                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4181         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4182                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4183         ;;
4184 *)
4185         version=`echo $revision $patchlevel $subversion | \
4186                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4187         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4188                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4189         ;;
4190 esac
4191 : Special case the 5.005_xx maintenance series, which used 5.005
4192 : without any subversion label as a subdirectory in $sitelib
4193 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4194         api_versionstring='5.005'
4195 fi
4196
4197 : Do we want threads support and if so, what type
4198 case "$usethreads" in
4199 $define|true|[yY]*)     dflt='y';;
4200 *)     # Catch case where user specified ithreads or 5005threads but
4201        # forgot -Dusethreads (A.D. 4/2002)
4202        case "$useithreads$use5005threads" in
4203        *$define*)
4204                 case "$useperlio" in
4205                 "$define")      dflt='y' ;;
4206                 *)              dflt='n' ;;
4207                 esac
4208                 ;;
4209        *)       dflt='n';;
4210        esac
4211        ;;
4212 esac
4213 cat <<EOM
4214
4215 Perl can be built to take advantage of threads on some systems.
4216 To do so, Configure can be run with -Dusethreads.
4217
4218 Note that Perl built with threading support runs slightly slower
4219 and uses more memory than plain Perl. The current implementation
4220 is believed to be stable, but it is fairly new, and so should be
4221 treated with caution.
4222
4223 If this doesn't make any sense to you, just accept the default '$dflt'.
4224 EOM
4225 rp='Build a threading Perl?'
4226 . ./myread
4227 case "$ans" in
4228 y|Y)    val="$define" ;;
4229 *)      val="$undef" ;;
4230 esac
4231 set usethreads
4232 eval $setvar
4233
4234 if $test $patchlevel -lt 9; then
4235     case "$usethreads" in
4236     $define)
4237         $cat <<EOM
4238
4239 Since release 5.6, Perl has had two different threading implementations,
4240 the newer interpreter-based version (ithreads) with one interpreter per
4241 thread, and the older 5.005 version (5005threads).
4242 The 5005threads version is effectively unmaintained and will probably be
4243 removed in Perl 5.10, so there should be no need to build a Perl using it
4244 unless needed for backwards compatibility with some existing 5.005threads
4245 code.
4246
4247 EOM
4248         : Default to ithreads unless overridden on command line or with
4249         : old config.sh
4250         dflt='y'
4251         case "$use5005threads" in
4252                 $define|true|[yY]*) dflt='n';;
4253         esac
4254         case "$useithreads" in
4255                 $undef|false|[nN]*) dflt='n';;
4256         esac
4257         rp='Use the newer interpreter-based ithreads?'
4258         . ./myread
4259         case "$ans" in
4260         y|Y)    val="$define" ;;
4261         *)      val="$undef" ;;
4262         esac
4263         set useithreads
4264         eval $setvar
4265         : Now set use5005threads to the opposite value.
4266         case "$useithreads" in
4267         $define) val="$undef" ;;
4268         *) val="$define" ;;
4269         esac
4270         set use5005threads
4271         eval $setvar
4272         ;;
4273     *)
4274         useithreads="$undef"
4275         use5005threads="$undef"
4276         ;;
4277     esac
4278
4279     case "$useithreads$use5005threads" in
4280     "$define$define")
4281         $cat >&4 <<EOM
4282
4283 You cannot have both the ithreads and the 5.005 threads enabled
4284 at the same time.  Disabling the 5.005 threads since they are
4285 much less stable than the ithreads.
4286
4287 EOM
4288         use5005threads="$undef"
4289         ;;
4290     esac
4291
4292 else
4293 : perl-5.9.x and later
4294
4295     if test X"$usethreads" = "X$define"; then
4296         case "$use5005threads" in
4297             $define|true|[yY]*)
4298                 $cat >&4 <<EOM
4299
4300 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4301
4302 EOM
4303             ;;
4304         esac
4305     fi
4306
4307     use5005threads="$undef"
4308     useithreads="$usethreads"
4309 fi
4310
4311 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4312         cat >&4 <<EOF
4313 ***
4314 *** To build with ithreads you must also use the PerlIO layer.
4315 *** Cannot continue, aborting.
4316 ***
4317 EOF
4318         exit 1
4319 fi
4320
4321 case "$d_oldpthreads" in
4322 '')     : Configure tests would be welcome here.  For now, assume undef.
4323         val="$undef" ;;
4324 *)      val="$d_oldpthreads" ;;
4325 esac
4326 set d_oldpthreads
4327 eval $setvar
4328
4329
4330 : Look for a hint-file generated 'call-back-unit'.  If the
4331 : user has specified that a threading perl is to be built,
4332 : we may need to set or change some other defaults.
4333 if $test -f usethreads.cbu; then
4334     echo "Your platform has some specific hints regarding threaded builds, using them..."
4335     . ./usethreads.cbu
4336 else
4337     case "$usethreads" in
4338         "$define"|true|[yY]*)
4339                 $cat <<EOM
4340 (Your platform does not have any specific hints for threaded builds.
4341  Assuming POSIX threads, then.)
4342 EOM
4343         ;;
4344     esac
4345 fi
4346
4347 : Check if multiplicity is required
4348 cat <<EOM
4349
4350 Perl can be built so that multiple Perl interpreters can coexist
4351 within the same Perl executable.
4352 EOM
4353
4354 case "$useithreads" in
4355 $define)
4356         cat <<EOM
4357 This multiple interpreter support is required for interpreter-based threads.
4358 EOM
4359         val="$define"
4360         ;;
4361 *)      case "$usemultiplicity" in
4362         $define|true|[yY]*)     dflt='y';;
4363         *) dflt='n';;
4364         esac
4365         echo " "
4366         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4367         rp='Build Perl for multiplicity?'
4368         . ./myread
4369         case "$ans" in
4370         y|Y)    val="$define" ;;
4371         *)      val="$undef" ;;
4372         esac
4373         ;;
4374 esac
4375 set usemultiplicity
4376 eval $setvar
4377
4378 : Check if morebits is requested
4379 case "$usemorebits" in
4380 "$define"|true|[yY]*)
4381         use64bitint="$define"
4382         uselongdouble="$define"
4383         usemorebits="$define"
4384         ;;
4385 *)      usemorebits="$undef"
4386         ;;
4387 esac
4388
4389 : Determine the C compiler to be used
4390 echo " "
4391 case "$cc" in
4392 '') dflt=cc;;
4393 *) dflt="$cc";;
4394 esac
4395 rp="Use which C compiler?"
4396 . ./myread
4397 cc="$ans"
4398
4399 : See whether they have no cc but they do have gcc
4400 . ./trygcc
4401 if $test -f cc.cbu; then
4402     . ./cc.cbu
4403 fi
4404 . ./checkcc
4405
4406 : make some quick guesses about what we are up against
4407 echo " "
4408 $echo $n "Hmm...  $c"
4409 echo exit 1 >bsd
4410 echo exit 1 >usg
4411 echo exit 1 >v7
4412 echo exit 1 >osf1
4413 echo exit 1 >eunice
4414 echo exit 1 >xenix
4415 echo exit 1 >venix
4416 echo exit 1 >os2
4417 d_bsd="$undef"
4418 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4419 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4420 then
4421         echo "Looks kind of like an OSF/1 system, but we'll see..."
4422         echo exit 0 >osf1
4423 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4424         xxx=`./loc addbib blurfl $pth`
4425         if $test -f $xxx; then
4426         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4427                 echo exit 0 >bsd
4428                 echo exit 0 >usg
4429         else
4430                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4431                         echo "Looks kind of like an extended USG system, but we'll see..."
4432                 else
4433                         echo "Looks kind of like a USG system, but we'll see..."
4434                 fi
4435                 echo exit 0 >usg
4436         fi
4437 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4438         echo "Looks kind of like a BSD system, but we'll see..."
4439         d_bsd="$define"
4440         echo exit 0 >bsd
4441 else
4442         echo "Looks kind of like a Version 7 system, but we'll see..."
4443         echo exit 0 >v7
4444 fi
4445 case "$eunicefix" in
4446 *unixtovms*)
4447         $cat <<'EOI'
4448 There is, however, a strange, musty smell in the air that reminds me of
4449 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4450 EOI
4451         echo exit 0 >eunice
4452         d_eunice="$define"
4453 : it so happens the Eunice I know will not run shell scripts in Unix format
4454         ;;
4455 *)
4456         echo " "
4457         echo "Congratulations.  You aren't running Eunice."
4458         d_eunice="$undef"
4459         ;;
4460 esac
4461 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4462 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4463 : semicolon as a patch separator
4464 case "$p_" in
4465 :) ;;
4466 *)
4467         $cat <<'EOI'
4468 I have the feeling something is not exactly right, however...don't tell me...
4469 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4470 (Or you may be running DOS with DJGPP.)
4471 EOI
4472         echo exit 0 >os2
4473         ;;
4474 esac
4475 if test -f /xenix; then
4476         echo "Actually, this looks more like a XENIX system..."
4477         echo exit 0 >xenix
4478         d_xenix="$define"
4479 else
4480         echo " "
4481         echo "It's not Xenix..."
4482         d_xenix="$undef"
4483 fi
4484 chmod +x xenix
4485 $eunicefix xenix
4486 if test -f /venix; then
4487         echo "Actually, this looks more like a VENIX system..."
4488         echo exit 0 >venix
4489 else
4490         echo " "
4491         if ./xenix; then
4492                 : null
4493         else
4494                 echo "Nor is it Venix..."
4495         fi
4496 fi
4497 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4498 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4499 $rm -f foo
4500
4501 : Check if we are using GNU gcc and what its version is
4502 echo " "
4503 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4504 $cat >try.c <<EOM
4505 #include <stdio.h>
4506 int main() {
4507 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4508 #ifdef __VERSION__
4509         printf("%s\n", __VERSION__);
4510 #else
4511         printf("%s\n", "1");
4512 #endif
4513 #endif
4514         return(0);
4515 }
4516 EOM
4517 if $cc -o try $ccflags $ldflags try.c; then
4518         gccversion=`$run ./try`
4519         case "$gccversion" in
4520         '') echo "You are not using GNU cc." ;;
4521         *)  echo "You are using GNU cc $gccversion."
4522             ccname=gcc
4523             ;;
4524         esac
4525 else
4526         echo " "
4527         echo "*** WHOA THERE!!! ***" >&4
4528         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4529         case "$knowitall" in
4530         '')
4531         echo "    You'd better start hunting for one and let me know about it." >&4
4532                 exit 1
4533                 ;;
4534         esac
4535 fi
4536 $rm -f try try.*
4537 case "$gccversion" in
4538 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4539 esac
4540 case "$gccversion" in
4541 '') gccosandvers='' ;;
4542 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4543    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4544    gccshortvers=''
4545    case "$gccosandvers" in
4546    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4547    $osname$osvers) ;; # looking good
4548    $osname*) cat <<EOM >&4
4549
4550 *** WHOA THERE!!! ***
4551
4552     Your gcc has not been compiled for the exact release of
4553     your operating system ($gccosandvers versus $osname$osvers).
4554
4555     In general it is a good idea to keep gcc synchronized with
4556     the operating system because otherwise serious problems
4557     may ensue when trying to compile software, like Perl.
4558
4559     I'm trying to be optimistic here, though, and will continue.
4560     If later during the configuration and build icky compilation
4561     problems appear (headerfile conflicts being the most common
4562     manifestation), I suggest reinstalling the gcc to match
4563     your operating system release.
4564
4565 EOM
4566       ;;
4567    *) gccosandvers='' ;; # failed to parse, better be silent
4568    esac
4569    ;;
4570 esac
4571 case "$ccname" in
4572 '') ccname="$cc" ;;
4573 esac
4574
4575 # gcc 3.* complain about adding -Idirectories that they already know about,
4576 # so we will take those off from locincpth.
4577 case "$gccversion" in
4578 3*)
4579     echo "main(){}">try.c
4580     for incdir in $locincpth; do
4581        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4582              grep '^c[cp]p*[01]: warning: changing search order '`
4583        if test "X$warn" != X; then
4584            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4585        fi
4586     done
4587     $rm -f try try.*
4588 esac
4589
4590 : What should the include directory be ?
4591 echo " "
4592 $echo $n "Hmm...  $c"
4593 dflt='/usr/include'
4594 incpath=''
4595 mips_type=''
4596 if $test -f /bin/mips && /bin/mips; then
4597         echo "Looks like a MIPS system..."
4598         $cat >usr.c <<'EOCP'
4599 #ifdef SYSTYPE_BSD43
4600 /bsd43
4601 #endif
4602 EOCP
4603         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4604                 dflt='/bsd43/usr/include'
4605                 incpath='/bsd43'
4606                 mips_type='BSD 4.3'
4607         else
4608                 mips_type='System V'
4609         fi
4610         $rm -f usr.c usr.out
4611         echo "and you're compiling with the $mips_type compiler and libraries."
4612         xxx_prompt=y
4613         echo "exit 0" >mips
4614 else
4615         echo "Doesn't look like a MIPS system."
4616         xxx_prompt=n
4617         echo "exit 1" >mips
4618 fi
4619 chmod +x mips
4620 $eunicefix mips
4621 case "$usrinc" in
4622 '') ;;
4623 *) dflt="$usrinc";;
4624 esac
4625 case "$xxx_prompt" in
4626 y)      fn=d/
4627         echo " "
4628         rp='Where are the include files you want to use?'
4629         . ./getfile
4630         usrinc="$ans"
4631         ;;
4632 *)      usrinc="$dflt"
4633         ;;
4634 esac
4635
4636 : see how we invoke the C preprocessor
4637 echo " "
4638 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4639 cat <<'EOT' >testcpp.c
4640 #define ABC abc
4641 #define XYZ xyz
4642 ABC.XYZ
4643 EOT
4644 cd ..
4645 if test ! -f cppstdin; then
4646         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4647                 # AIX cc -E doesn't show the absolute headerfile
4648                 # locations but we'll cheat by using the -M flag.
4649                 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
4650         else
4651                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4652         fi
4653 else
4654         echo "Keeping your $hint cppstdin wrapper."
4655 fi
4656 chmod 755 cppstdin
4657 wrapper=`pwd`/cppstdin
4658 ok='false'
4659 cd UU
4660
4661 if $test "X$cppstdin" != "X" && \
4662         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4663         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4664 then
4665         echo "You used to use $cppstdin $cppminus so we'll use that again."
4666         case "$cpprun" in
4667         '') echo "But let's see if we can live without a wrapper..." ;;
4668         *)
4669                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4670                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4671                 then
4672                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4673                         ok='true'
4674                 else
4675                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4676                 fi
4677                 ;;
4678         esac
4679 else
4680         case "$cppstdin" in
4681         '') ;;
4682         *)
4683                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4684                 ;;
4685         esac
4686 fi
4687
4688 if $ok; then
4689         : nothing
4690 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4691         $cc -E <testcpp.c >testcpp.out 2>&1; \
4692         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693         echo "Yup, it does."
4694         x_cpp="$cc -E"
4695         x_minus='';
4696 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4697         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4698         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699         echo "Yup, it does."
4700         x_cpp="$cc -E"
4701         x_minus='-';
4702 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4703         $cc -P <testcpp.c >testcpp.out 2>&1; \
4704         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4705         echo "Yipee, that works!"
4706         x_cpp="$cc -P"
4707         x_minus='';
4708 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4709         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4710         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4711         echo "At long last!"
4712         x_cpp="$cc -P"
4713         x_minus='-';
4714 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4715         $cpp <testcpp.c >testcpp.out 2>&1; \
4716         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4717         echo "It works!"
4718         x_cpp="$cpp"
4719         x_minus='';
4720 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4721         $cpp - <testcpp.c >testcpp.out 2>&1; \
4722         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4723         echo "Hooray, it works!  I was beginning to wonder."
4724         x_cpp="$cpp"
4725         x_minus='-';
4726 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4727         $wrapper <testcpp.c >testcpp.out 2>&1; \
4728         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4729         x_cpp="$wrapper"
4730         x_minus=''
4731         echo "Eureka!"
4732 else
4733         dflt=''
4734         rp="No dice.  I can't find a C preprocessor.  Name one:"
4735         . ./myread
4736         x_cpp="$ans"
4737         x_minus=''
4738         $x_cpp <testcpp.c >testcpp.out 2>&1
4739         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4740                 echo "OK, that will do." >&4
4741         else
4742 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4743                 exit 1
4744         fi
4745 fi
4746
4747 case "$ok" in
4748 false)
4749         cppstdin="$x_cpp"
4750         cppminus="$x_minus"
4751         cpprun="$x_cpp"
4752         cpplast="$x_minus"
4753         set X $x_cpp
4754         shift
4755         case "$1" in
4756         "$cpp")
4757                 echo "Perhaps can we force $cc -E using a wrapper..."
4758                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4759                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4760                 then
4761                         echo "Yup, we can."
4762                         cppstdin="$wrapper"
4763                         cppminus='';
4764                 else
4765                         echo "Nope, we'll have to live without it..."
4766                 fi
4767                 ;;
4768         esac
4769         case "$cpprun" in
4770         "$wrapper")
4771                 cpprun=''
4772                 cpplast=''
4773                 ;;
4774         esac
4775         ;;
4776 esac
4777
4778 case "$cppstdin" in
4779 "$wrapper"|'cppstdin') ;;
4780 *) $rm -f $wrapper;;
4781 esac
4782 $rm -f testcpp.c testcpp.out
4783
4784 : Set private lib path
4785 case "$plibpth" in
4786 '') if ./mips; then
4787                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4788         fi;;
4789 esac
4790 case "$libpth" in
4791 ' ') dlist='';;
4792 '') dlist="$loclibpth $plibpth $glibpth";;
4793 *) dlist="$libpth";;
4794 esac
4795
4796 : Now check and see which directories actually exist, avoiding duplicates
4797 libpth=''
4798 for xxx in $dlist
4799 do
4800     if $test -d $xxx; then
4801                 case " $libpth " in
4802                 *" $xxx "*) ;;
4803                 *) libpth="$libpth $xxx";;
4804                 esac
4805     fi
4806 done
4807 $cat <<'EOM'
4808
4809 Some systems have incompatible or broken versions of libraries.  Among
4810 the directories listed in the question below, please remove any you
4811 know not to be holding relevant libraries, and add any that are needed.
4812 Say "none" for none.
4813
4814 EOM
4815 case "$libpth" in
4816 '') dflt='none';;
4817 *)
4818         set X $libpth
4819         shift
4820         dflt=${1+"$@"}
4821         ;;
4822 esac
4823 rp="Directories to use for library searches?"
4824 . ./myread
4825 case "$ans" in
4826 none) libpth=' ';;
4827 *) libpth="$ans";;
4828 esac
4829
4830 : compute shared library extension
4831 case "$so" in
4832 '')
4833         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4834                 dflt='sl'
4835         else
4836                 dflt='so'
4837         fi
4838         ;;
4839 *) dflt="$so";;
4840 esac
4841 $cat <<EOM
4842
4843 On some systems, shared libraries may be available.  Answer 'none' if
4844 you want to suppress searching of shared libraries for the remainder
4845 of this configuration.
4846
4847 EOM
4848 rp='What is the file extension used for shared libraries?'
4849 . ./myread
4850 so="$ans"
4851
4852 : Define several unixisms.
4853 : Hints files or command line option can be used to override them.
4854 : The convoluted testing is in case hints files set either the old
4855 : or the new name.
4856 case "$_exe" in
4857 '')     case "$exe_ext" in
4858         '')     ;;
4859         *)      _exe="$exe_ext" ;;
4860         esac
4861         ;;
4862 esac
4863 case "$_a" in
4864 '')     case "$lib_ext" in
4865     '') _a='.a';;
4866         *)      _a="$lib_ext" ;;
4867         esac
4868         ;;
4869 esac
4870 case "$_o" in
4871 '') case "$obj_ext" in
4872         '')     _o='.o';;
4873         *)      _o="$obj_ext";;
4874         esac
4875         ;;
4876 esac
4877 case "$p_" in
4878 '') case "$path_sep" in
4879         '')     p_=':';;
4880         *)      p_="$path_sep";;
4881         esac
4882         ;;
4883 esac
4884 exe_ext=$_exe
4885 lib_ext=$_a
4886 obj_ext=$_o
4887 path_sep=$p_
4888
4889 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4890
4891 : Which makefile gets called first.  This is used by make depend.
4892 case "$firstmakefile" in
4893 '') firstmakefile='makefile';;
4894 esac
4895
4896 : Check for uselongdouble support
4897 case "$ccflags" in
4898 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4899 esac
4900
4901 case "$uselongdouble" in
4902 $define|true|[yY]*)     dflt='y';;
4903 *) dflt='n';;
4904 esac
4905 cat <<EOM
4906
4907 Perl can be built to take advantage of long doubles which
4908 (if available) may give more accuracy and range for floating point numbers.
4909
4910 If this doesn't make any sense to you, just accept the default '$dflt'.
4911 EOM
4912 rp='Try to use long doubles if available?'
4913 . ./myread
4914 case "$ans" in
4915 y|Y)    val="$define"   ;;
4916 *)      val="$undef"    ;;
4917 esac
4918 set uselongdouble
4919 eval $setvar
4920
4921 case "$uselongdouble" in
4922 true|[yY]*) uselongdouble="$define" ;;
4923 esac
4924
4925 : Look for a hint-file generated 'call-back-unit'.  If the
4926 : user has specified that long doubles should be used,
4927 : we may need to set or change some other defaults.
4928 if $test -f uselongdouble.cbu; then
4929     echo "Your platform has some specific hints regarding long doubles, using them..."
4930     . ./uselongdouble.cbu
4931 else
4932     case "$uselongdouble" in
4933         $define)
4934                 $cat <<EOM
4935 (Your platform does not have any specific hints for long doubles.)
4936 EOM
4937         ;;
4938     esac
4939 fi
4940
4941 : Looking for optional libraries
4942 echo " "
4943 echo "Checking for optional libraries..." >&4
4944 case "$libs" in
4945 ' '|'') dflt='';;
4946 *) dflt="$libs";;
4947 esac
4948 case "$libswanted" in
4949 '') libswanted='c_s';;
4950 esac
4951 case "$usesocks" in
4952 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4953 esac
4954 libsfound=''
4955 libsfiles=''
4956 libsdirs=''
4957 libspath=''
4958 for thisdir in $libpth $xlibpth; do
4959   test -d $thisdir && libspath="$libspath $thisdir"
4960 done
4961 for thislib in $libswanted; do
4962         for thisdir in $libspath; do
4963             xxx=''
4964             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4965                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4966                 $test -f "$xxx" && eval $libscheck
4967                 $test -f "$xxx" && libstyle=shared
4968             fi
4969             if test ! -f "$xxx"; then
4970                 xxx=$thisdir/lib$thislib.$so
4971                 $test -f "$xxx" && eval $libscheck
4972                 $test -f "$xxx" && libstyle=shared
4973             fi
4974             if test ! -f "$xxx"; then
4975                 xxx=$thisdir/lib$thislib$_a
4976                 $test -f "$xxx" && eval $libscheck
4977                 $test -f "$xxx" && libstyle=static
4978             fi
4979             if test ! -f "$xxx"; then
4980                 xxx=$thisdir/$thislib$_a
4981                 $test -f "$xxx" && eval $libscheck
4982                 $test -f "$xxx" && libstyle=static
4983             fi
4984             if test ! -f "$xxx"; then
4985                 xxx=$thisdir/lib${thislib}_s$_a
4986                 $test -f "$xxx" && eval $libscheck
4987                 $test -f "$xxx" && libstyle=static
4988                 $test -f "$xxx" && thislib=${thislib}_s
4989             fi
4990             if test ! -f "$xxx"; then
4991                 xxx=$thisdir/Slib$thislib$_a
4992                 $test -f "$xxx" && eval $libscheck
4993                 $test -f "$xxx" && libstyle=static
4994             fi
4995             if $test -f "$xxx"; then
4996                 case "$libstyle" in
4997                 shared) echo "Found -l$thislib (shared)." ;;
4998                 static) echo "Found -l$thislib." ;;
4999                 *)      echo "Found -l$thislib ($libstyle)." ;;
5000                 esac
5001                 case " $dflt " in
5002                 *"-l$thislib "*);;
5003                 *) dflt="$dflt -l$thislib"
5004                    libsfound="$libsfound $xxx"
5005                    yyy=`basename $xxx`
5006                    libsfiles="$libsfiles $yyy"
5007                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5008                    case " $libsdirs " in
5009                    *" $yyy "*) ;;
5010                    *) libsdirs="$libsdirs $yyy" ;;
5011                    esac
5012                    ;;
5013                 esac
5014                 break
5015             fi
5016         done
5017         if $test ! -f "$xxx"; then
5018             echo "No -l$thislib."
5019         fi
5020 done
5021 set X $dflt
5022 shift
5023 dflt="$*"
5024 case "$libs" in
5025 '') dflt="$dflt";;
5026 *) dflt="$libs";;
5027 esac
5028 case "$dflt" in
5029 ' '|'') dflt='none';;
5030 esac
5031
5032 $cat <<EOM
5033
5034 In order to compile $package on your machine, a number of libraries
5035 are usually needed.  Include any other special libraries here as well.
5036 Say "none" for none.  The default list is almost always right.
5037 EOM
5038
5039 echo " "
5040 rp="What libraries to use?"
5041 . ./myread
5042 case "$ans" in
5043 none) libs=' ';;
5044 *) libs="$ans";;
5045 esac
5046
5047 : determine optimization, if desired, or use for debug flag also
5048 case "$optimize" in
5049 ' '|$undef) dflt='none';;
5050 '') dflt='-O';;
5051 *) dflt="$optimize";;
5052 esac
5053 $cat <<EOH
5054
5055 By default, $package compiles with the -O flag to use the optimizer.
5056 Alternately, you might want to use the symbolic debugger, which uses
5057 the -g flag (on traditional Unix systems).  Either flag can be
5058 specified here.  To use neither flag, specify the word "none".
5059
5060 EOH
5061 rp="What optimizer/debugger flag should be used?"
5062 . ./myread
5063 optimize="$ans"
5064 case "$optimize" in
5065 'none') optimize=" ";;
5066 esac
5067
5068 : Check what DEBUGGING is required from the command line
5069 : -DEBUGGING      or -DDEBUGGING or
5070 : -DEBUGGING=both                       = -g + -DDEBUGGING
5071 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5072 : -DEBUGGING=none or -UDEBUGGING        =
5073 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5074 case "$EBUGGING" in
5075 '')     ;;
5076 *)      DEBUGGING=$EBUGGING ;;
5077 esac
5078
5079 case "$DEBUGGING" in
5080 -g|both|$define)
5081     case "$optimize" in
5082         *-g*) ;;
5083         *)    optimize="$optimize -g" ;;
5084     esac ;;
5085 none|$undef)
5086     case "$optimize" in
5087         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5088                 shift
5089                 optimize="$*"
5090                 ;;
5091     esac ;;
5092 esac
5093
5094 dflt=''
5095 case "$DEBUGGING" in
5096 both|$define) dflt='-DDEBUGGING'
5097 esac
5098
5099 : argument order is deliberate, as the flag will start with - which set could
5100 : think is an option
5101 checkccflag='check=$1; flag=$2; callback=$3;
5102 echo " ";
5103 echo "Checking if your compiler accepts $flag" 2>&1;
5104 echo "int main(void) { return 0; }" > gcctest.c;
5105 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5106     echo "Yes, it does." 2>&1;
5107     if $test -s gcctest.out ; then
5108         echo "But your platform does not like it:";
5109         cat gcctest.out;
5110     else
5111         case "$ccflags" in
5112         *$check*)
5113             echo "Leaving current flags $ccflags alone." 2>&1
5114             ;;
5115         *) dflt="$dflt $flag";
5116             eval $callback
5117             ;;
5118         esac
5119     fi
5120 else
5121     echo "Nope, it does not, but that is ok." 2>&1;
5122 fi
5123 '
5124
5125 : We will not override a previous value, but we might want to
5126 : augment a hint file
5127 case "$hint" in
5128 default|recommended)
5129         case "$gccversion" in
5130         1*) dflt="$dflt -fpcc-struct-return" ;;
5131         esac
5132         case "$optimize:$DEBUGGING" in
5133         *-g*:old) dflt="$dflt -DDEBUGGING";;
5134         esac
5135         case "$gccversion" in
5136         2*) if $test -d /etc/conf/kconfig.d &&
5137                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5138                 then
5139                         # Interactive Systems (ISC) POSIX mode.
5140                         dflt="$dflt -posix"
5141                 fi
5142                 ;;
5143         esac
5144         case "$gccversion" in
5145         1*) ;;
5146         2.[0-8]*) ;;
5147         ?*)     set strict-aliasing -fno-strict-aliasing
5148                 eval $checkccflag
5149                 ;;
5150         esac
5151         # For gcc, adding -pipe speeds up compilations for some, but apparently
5152         # some assemblers can't read from stdin.  (It also slows down compilations
5153         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5154         case "$gccversion" in
5155         ?*)     set pipe -pipe
5156                 eval $checkccflag
5157                 ;;
5158         esac
5159
5160         # on x86_64 (at least) we require an extra library (libssp) in the
5161         # link command line. This library is not named, so I infer that it is
5162         # an implementation detail that may change. Hence the safest approach
5163         # is to add the flag to the flags passed to the compiler at link time,
5164         # as that way the compiler can do the right implementation dependant
5165         # thing. (NWC)
5166         case "$gccversion" in
5167         ?*)     set stack-protector -fstack-protector
5168                 eval $checkccflag
5169                 ;;
5170         esac
5171         ;;
5172 esac
5173
5174 case "$mips_type" in
5175 *BSD*|'') inclwanted="$locincpth $usrinc";;
5176 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5177 esac
5178 for thisincl in $inclwanted; do
5179         if $test -d $thisincl; then
5180                 if $test x$thisincl != x$usrinc; then
5181                         case "$dflt" in
5182                         *" -I$thisincl "*);;
5183                         *) dflt="$dflt -I$thisincl ";;
5184                         esac
5185                 fi
5186         fi
5187 done
5188
5189 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5190         xxx=true;
5191 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5192         xxx=true;
5193 else
5194         xxx=false;
5195 fi;
5196 if $xxx; then
5197         case "$dflt" in
5198         *$2*);;
5199         *) dflt="$dflt -D$2";;
5200         esac;
5201 fi'
5202
5203 set signal.h LANGUAGE_C; eval $inctest
5204
5205 case "$usesocks" in
5206 $define)
5207         ccflags="$ccflags -DSOCKS"
5208         ;;
5209 esac
5210
5211 case "$hint" in
5212 default|recommended) dflt="$ccflags $dflt" ;;
5213 *) dflt="$ccflags";;
5214 esac
5215
5216 case "$dflt" in
5217 ''|' ') dflt=none;;
5218 esac
5219
5220 $cat <<EOH
5221
5222 Your C compiler may want other flags.  For this question you should include
5223 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5224 but you should NOT include libraries or ld flags like -lwhatever.  If you
5225 want $package to honor its debug switch, you should include -DDEBUGGING here.
5226 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5227
5228 To use no flags, specify the word "none".
5229
5230 EOH
5231 set X $dflt
5232 shift
5233 dflt=${1+"$@"}
5234 rp="Any additional cc flags?"
5235 . ./myread
5236 case "$ans" in
5237 none) ccflags='';;
5238 *) ccflags="$ans";;
5239 esac
5240
5241 : the following weeds options from ccflags that are of no interest to cpp
5242 case "$cppflags" in
5243 '') cppflags="$ccflags" ;;
5244 *)  cppflags="$cppflags $ccflags" ;;
5245 esac
5246 case "$gccversion" in
5247 1*) cppflags="$cppflags -D__GNUC__"
5248 esac
5249 case "$mips_type" in
5250 '');;
5251 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5252 esac
5253 case "$cppflags" in
5254 '');;
5255 *)
5256         echo " "
5257         echo "Let me guess what the preprocessor flags are..." >&4
5258         set X $cppflags
5259         shift
5260         cppflags=''
5261         $cat >cpp.c <<'EOM'
5262 #define BLURFL foo
5263
5264 BLURFL xx LFRULB
5265 EOM
5266         previous=''
5267         for flag in $*
5268         do
5269                 case "$flag" in
5270                 -*) ftry="$flag";;
5271                 *) ftry="$previous $flag";;
5272                 esac
5273                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5274                         >cpp1.out 2>/dev/null && \
5275                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5276                         >cpp2.out 2>/dev/null && \
5277                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5278                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5279                 then
5280                         cppflags="$cppflags $ftry"
5281                         previous=''
5282                 else
5283                         previous="$flag"
5284                 fi
5285         done
5286         set X $cppflags
5287         shift
5288         cppflags=${1+"$@"}
5289         case "$cppflags" in
5290         *-*)  echo "They appear to be: $cppflags";;
5291         esac
5292         $rm -f cpp.c cpp?.out
5293         ;;
5294 esac
5295
5296 : flags used in final linking phase
5297 case "$ldflags" in
5298 '') if ./venix; then
5299                 dflt='-i -z'
5300         else
5301                 dflt=''
5302         fi
5303         case "$ccflags" in
5304         *-posix*) dflt="$dflt -posix" ;;
5305         esac
5306         ;;
5307 *) dflt="$ldflags";;
5308 esac
5309 # See note above about -fstack-protector
5310 case "$ccflags" in
5311 *-fstack-protector*) 
5312         case "$dflt" in
5313         *-fstack-protector*) ;; # Don't add it again
5314         *) dflt="$dflt -fstack-protector" ;; 
5315         esac
5316         ;;
5317 esac
5318
5319 : Try to guess additional flags to pick up local libraries.
5320 for thislibdir in $libpth; do
5321         case " $loclibpth " in
5322         *" $thislibdir "*)
5323                 case "$dflt " in
5324                 *"-L$thislibdir "*) ;;
5325                 *)  dflt="$dflt -L$thislibdir" ;;
5326                 esac
5327                 ;;
5328         esac
5329 done
5330
5331 case "$dflt" in
5332 '') dflt='none' ;;
5333 esac
5334
5335 $cat <<EOH
5336
5337 Your C linker may need flags.  For this question you should
5338 include -L/whatever and any other flags used by the C linker, but you
5339 should NOT include libraries like -lwhatever.
5340
5341 Make sure you include the appropriate -L/path flags if your C linker
5342 does not normally search all of the directories you specified above,
5343 namely
5344         $libpth
5345 To use no flags, specify the word "none".
5346
5347 EOH
5348
5349 rp="Any additional ld flags (NOT including libraries)?"
5350 . ./myread
5351 case "$ans" in
5352 none) ldflags='';;
5353 *) ldflags="$ans";;
5354 esac
5355 rmlist="$rmlist pdp11"
5356
5357 : coherency check
5358 echo " "
5359 echo "Checking your choice of C compiler and flags for coherency..." >&4
5360 $cat > try.c <<'EOF'
5361 #include <stdio.h>
5362 int main() { printf("Ok\n"); return(0); }
5363 EOF
5364 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5365 shift
5366 $cat >try.msg <<'EOM'
5367 I've tried to compile and run the following simple program:
5368
5369 EOM
5370 $cat try.c >> try.msg
5371
5372 $cat >> try.msg <<EOM
5373
5374 I used the command:
5375
5376         $*
5377         $run ./try
5378
5379 and I got the following output:
5380
5381 EOM
5382 dflt=y
5383 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5384         if $sh -c "$run ./try " >>try.msg 2>&1; then
5385                 xxx=`$run ./try`
5386                 case "$xxx" in
5387                 "Ok") dflt=n ;;
5388                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5389                         case " $libs " in
5390                         *" -lsfio "*)
5391                                 cat >> try.msg <<'EOQS'
5392 If $libs contains -lsfio, and sfio is mis-configured, then it
5393 sometimes (apparently) runs and exits with a 0 status, but with no
5394 output!  It may have to do with sfio's use of _exit vs. exit.
5395
5396 EOQS
5397                                 rp="You have a big problem.  Shall I abort Configure"
5398                                 dflt=y
5399                                 ;;
5400                         esac
5401                         ;;
5402                 esac
5403         else
5404                 echo "The program compiled OK, but exited with status $?." >>try.msg
5405                 rp="You have a problem.  Shall I abort Configure"
5406                 dflt=y
5407         fi
5408 else
5409         echo "I can't compile the test program." >>try.msg
5410         rp="You have a BIG problem.  Shall I abort Configure"
5411         dflt=y
5412 fi
5413 case "$dflt" in
5414 y)
5415         $cat try.msg >&4
5416         case "$knowitall" in
5417         '')
5418                 echo "(The supplied flags or libraries might be incorrect.)"
5419                 ;;
5420         *) dflt=n;;
5421         esac
5422         echo " "
5423         . ./myread
5424         case "$ans" in
5425         n*|N*) ;;
5426         *)      echo "Ok.  Stopping Configure." >&4
5427                 exit 1
5428                 ;;
5429         esac
5430         ;;
5431 n) echo "OK, that should do.";;
5432 esac
5433 $rm_try gcctest gcctest.out
5434
5435 : define a shorthand compile call
5436 compile='
5437 mc_file=$1;
5438 shift;
5439 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5440 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5441 exit 1;
5442 fi;
5443 esac;
5444 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5445 : define a shorthand compile call for compilations that should be ok.
5446 compile_ok='
5447 mc_file=$1;
5448 shift;
5449 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5450
5451 : determine filename position in cpp output
5452 echo " "
5453 echo "Computing filename position in cpp output for #include directives..." >&4
5454 case "$osname" in
5455 vos) testaccess=-e ;;
5456 *)   testaccess=-r ;;
5457 esac
5458 echo '#include <stdio.h>' > foo.c
5459 $cat >fieldn <<EOF
5460 $startsh
5461 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5462 $grep '^[       ]*#.*stdio\.h' | \
5463 while read cline; do
5464         pos=1
5465         set \$cline
5466         while $test \$# -gt 0; do
5467                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5468                         echo "\$pos"
5469                         exit 0
5470                 fi
5471                 shift
5472                 pos=\`expr \$pos + 1\`
5473         done
5474 done
5475 EOF
5476 chmod +x fieldn
5477 fieldn=`./fieldn`
5478 $rm -f foo.c fieldn
5479 case $fieldn in
5480 '') pos='???';;
5481 1) pos=first;;
5482 2) pos=second;;
5483 3) pos=third;;
5484 *) pos="${fieldn}th";;
5485 esac
5486 echo "Your cpp writes the filename in the $pos field of the line."
5487
5488 case "$osname" in
5489 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5490 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5491 *)   cppfilter='' ;;
5492 esac
5493 : locate header file
5494 $cat >findhdr <<EOF
5495 $startsh
5496 wanted=\$1
5497 name=''
5498 for usrincdir in $usrinc
5499 do
5500         if test -f \$usrincdir/\$wanted; then
5501                 echo "\$usrincdir/\$wanted"
5502                 exit 0
5503         fi
5504 done
5505 awkprg='{ print \$$fieldn }'
5506 echo "#include <\$wanted>" > foo\$\$.c
5507 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5508 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5509 while read cline; do
5510         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5511         case "\$name" in
5512         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5513         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5514         *) exit 2;;
5515         esac;
5516 done;
5517 #
5518 # status = 0: grep returned 0 lines, case statement not executed
5519 # status = 1: headerfile found
5520 # status = 2: while loop executed, no headerfile found
5521 #
5522 status=\$?
5523 $rm -f foo\$\$.c;
5524 if test \$status -eq 1; then
5525         exit 0;
5526 fi
5527 exit 1
5528 EOF
5529 chmod +x findhdr
5530
5531 : define an alternate in-header-list? function
5532 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5533 cont=true; xxf="echo \"<\$1> found.\" >&4";
5534 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5535 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5536 esac;
5537 case $# in 4) instead=instead;; *) instead="at last";; esac;
5538 while $test "$cont"; do
5539         xxx=`./findhdr $1`
5540         var=$2; eval "was=\$$2";
5541         if $test "$xxx" && $test -r "$xxx";
5542         then eval $xxf;
5543         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5544                 cont="";
5545         else eval $xxnf;
5546         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5547         set $yyy; shift; shift; yyy=$@;
5548         case $# in 0) cont="";;
5549         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5550                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5551         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5552                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5553         esac;
5554 done;
5555 while $test "$yyy";
5556 do set $yyy; var=$2; eval "was=\$$2";
5557         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5558         set $yyy; shift; shift; yyy=$@;
5559 done'
5560
5561 : see if stdlib is available
5562 set stdlib.h i_stdlib
5563 eval $inhdr
5564
5565 : check for lengths of integral types
5566 echo " "
5567 case "$intsize" in
5568 '')
5569         echo "Checking to see how big your integers are..." >&4
5570         $cat >try.c <<EOCP
5571 #include <stdio.h>
5572 #$i_stdlib I_STDLIB
5573 #ifdef I_STDLIB
5574 #include <stdlib.h>
5575 #endif
5576 int main()
5577 {
5578         printf("intsize=%d;\n", (int)sizeof(int));
5579         printf("longsize=%d;\n", (int)sizeof(long));
5580         printf("shortsize=%d;\n", (int)sizeof(short));
5581         exit(0);
5582 }
5583 EOCP
5584         set try
5585         if eval $compile_ok && $run ./try > /dev/null; then
5586                 eval `$run ./try`
5587                 echo "Your integers are $intsize bytes long."
5588                 echo "Your long integers are $longsize bytes long."
5589                 echo "Your short integers are $shortsize bytes long."
5590         else
5591                 $cat >&4 <<EOM
5592 !
5593 Help! I can't compile and run the intsize test program: please enlighten me!
5594 (This is probably a misconfiguration in your system or libraries, and
5595 you really ought to fix it.  Still, I'll try anyway.)
5596 !
5597 EOM
5598                 dflt=4
5599                 rp="What is the size of an integer (in bytes)?"
5600                 . ./myread
5601                 intsize="$ans"
5602                 dflt=$intsize
5603                 rp="What is the size of a long integer (in bytes)?"
5604                 . ./myread
5605                 longsize="$ans"
5606                 dflt=2
5607                 rp="What is the size of a short integer (in bytes)?"
5608                 . ./myread
5609                 shortsize="$ans"
5610         fi
5611         ;;
5612 esac
5613 $rm_try
5614
5615 : check for long long
5616 echo " "
5617 echo "Checking to see if you have long long..." >&4
5618 echo 'int main() { long long x = 7; return 0; }' > try.c
5619 set try
5620 if eval $compile; then
5621         val="$define"
5622         echo "You have long long."
5623 else
5624         val="$undef"
5625         echo "You do not have long long."
5626 fi
5627 $rm_try
5628 set d_longlong
5629 eval $setvar
5630
5631 : check for length of long long
5632 case "${d_longlong}${longlongsize}" in
5633 $define)
5634         echo " "
5635         echo "Checking to see how big your long longs are..." >&4
5636         $cat >try.c <<'EOCP'
5637 #include <stdio.h>
5638 int main()
5639 {
5640     printf("%d\n", (int)sizeof(long long));
5641     return(0);
5642 }
5643 EOCP
5644         set try
5645         if eval $compile_ok; then
5646                 longlongsize=`$run ./try`
5647                 echo "Your long longs are $longlongsize bytes long."
5648         else
5649                 dflt='8'
5650                 echo " "
5651                 echo "(I can't seem to compile the test program.  Guessing...)"
5652                 rp="What is the size of a long long (in bytes)?"
5653                 . ./myread
5654                 longlongsize="$ans"
5655         fi
5656         if $test "X$longsize" = "X$longlongsize"; then
5657                 echo "(That isn't any different from an ordinary long.)"
5658         fi
5659         ;;
5660 esac
5661 $rm_try
5662
5663 : see if inttypes.h is available
5664 : we want a real compile instead of Inhdr because some systems
5665 : have an inttypes.h which includes non-existent headers
5666 echo " "
5667 $cat >try.c <<EOCP
5668 #include <inttypes.h>
5669 int main() {
5670         static int32_t foo32 = 0x12345678;
5671 }
5672 EOCP
5673 set try
5674 if eval $compile; then
5675         echo "<inttypes.h> found." >&4
5676         val="$define"
5677 else
5678         echo "<inttypes.h> NOT found." >&4
5679         val="$undef"
5680 fi
5681 $rm_try
5682 set i_inttypes
5683 eval $setvar
5684
5685 : check for int64_t
5686 echo " "
5687 echo "Checking to see if you have int64_t..." >&4
5688 $cat >try.c <<EOCP
5689 #include <sys/types.h>
5690 #$i_inttypes I_INTTYPES
5691 #ifdef I_INTTYPES
5692 #include <inttypes.h>
5693 #endif
5694 int main() { int64_t x = 7; }
5695 EOCP
5696 set try
5697 if eval $compile; then
5698         val="$define"
5699         echo "You have int64_t."
5700 else
5701         val="$undef"
5702         echo "You do not have int64_t."
5703 fi
5704 $rm_try
5705 set d_int64_t
5706 eval $setvar
5707
5708 : Check if 64bit ints have a quad type
5709 echo " "
5710 echo "Checking which 64-bit integer type we could use..." >&4
5711
5712 case "$intsize" in
5713 8) val=int
5714    set quadtype
5715    eval $setvar
5716    val='"unsigned int"'
5717    set uquadtype
5718    eval $setvar
5719    quadkind=1
5720    ;;
5721 *) case "$longsize" in
5722    8) val=long
5723       set quadtype
5724       eval $setvar
5725       val='"unsigned long"'
5726       set uquadtype
5727       eval $setvar
5728       quadkind=2
5729       ;;
5730    *) case "$d_longlong:$longlongsize" in
5731       define:8)
5732         val='"long long"'
5733         set quadtype
5734         eval $setvar
5735         val='"unsigned long long"'
5736         set uquadtype
5737         eval $setvar
5738         quadkind=3
5739         ;;
5740       *) case "$d_int64_t" in
5741          define)
5742            val=int64_t
5743            set quadtype
5744            eval $setvar
5745            val=uint64_t
5746            set uquadtype
5747            eval $setvar
5748            quadkind=4
5749            ;;
5750          esac
5751          ;;
5752       esac
5753       ;;
5754    esac
5755    ;;
5756 esac
5757
5758 case "$quadtype" in
5759 '')     echo "Alas, no 64-bit integer types in sight." >&4
5760         d_quad="$undef"
5761         ;;
5762 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5763         d_quad="$define"
5764         ;;
5765 esac
5766
5767 : Do we want 64bit support
5768 case "$uselonglong" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5773 EOM
5774         use64bitint="$define"
5775         ;;
5776 esac
5777 case "$use64bits" in
5778 "$define"|true|[yY]*)
5779         cat <<EOM >&4
5780
5781 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5782 EOM
5783         use64bitint="$define"
5784         ;;
5785 esac
5786 case "$use64bitints" in
5787 "$define"|true|[yY]*)
5788         cat <<EOM >&4
5789
5790 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5791 EOM
5792         use64bitint="$define"
5793         ;;
5794 esac
5795 case "$use64bitsint" in
5796 "$define"|true|[yY]*)
5797         cat <<EOM >&4
5798
5799 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5800 EOM
5801         use64bitint="$define"
5802         ;;
5803 esac
5804 case "$uselonglongs" in
5805 "$define"|true|[yY]*)
5806         cat <<EOM >&4
5807
5808 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5809 EOM
5810         use64bitint="$define"
5811         ;;
5812 esac
5813 case "$use64bitsall" in
5814 "$define"|true|[yY]*)
5815         cat <<EOM >&4
5816
5817 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5818 EOM
5819         use64bitall="$define"
5820         ;;
5821 esac
5822
5823 case "$ccflags" in
5824 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5825 esac
5826 case "$use64bitall" in
5827 "$define"|true|[yY]*) use64bitint="$define" ;;
5828 esac
5829
5830 case "$longsize" in
5831 8) cat <<EOM
5832
5833 You have natively 64-bit long integers.
5834 EOM
5835    val="$define"
5836    ;;
5837 *) case "$use64bitint" in
5838    "$define"|true|[yY]*) dflt='y';;
5839    *) dflt='n';;
5840    esac
5841    case "$d_quad" in
5842    "$define") ;;
5843    *) dflt='n' ;;
5844    esac
5845    cat <<EOM
5846
5847 Perl can be built to take advantage of 64-bit integer types
5848 on some systems.  To do so, Configure can be run with -Duse64bitint.
5849 Choosing this option will most probably introduce binary incompatibilities.
5850
5851 If this doesn't make any sense to you, just accept the default '$dflt'.
5852 (The default has been chosen based on your configuration.)
5853 EOM
5854    rp='Try to use 64-bit integers, if available?'
5855    . ./myread
5856    case "$ans" in
5857    [yY]*) val="$define" ;;
5858    *)     val="$undef"  ;;
5859    esac
5860    ;;
5861 esac
5862 set use64bitint
5863 eval $setvar
5864
5865 case "$use64bitall" in
5866 "$define"|true|[yY]*) dflt='y' ;;
5867 *) case "$longsize" in
5868    8) dflt='y' ;;
5869    *) dflt='n' ;;
5870    esac
5871    ;;
5872 esac
5873 cat <<EOM
5874
5875 You may also choose to try maximal 64-bitness.  It means using as much
5876 64-bitness as possible on the platform.  This in turn means even more
5877 binary incompatibilities.  On the other hand, your platform may not
5878 have any more 64-bitness available than what you already have chosen.
5879
5880 If this doesn't make any sense to you, just accept the default '$dflt'.
5881 (The default has been chosen based on your configuration.)
5882 EOM
5883 rp='Try to use maximal 64-bit support, if available?'
5884 . ./myread
5885 case "$ans" in
5886 [yY]*) val="$define" ;;
5887 *)     val="$undef"  ;;
5888 esac
5889 set use64bitall
5890 eval $setvar
5891 case "$use64bitall" in
5892 "$define")
5893         case "$use64bitint" in
5894         "$undef")
5895                 cat <<EOM
5896
5897 Since you have chosen a maximally 64-bit build, I'm also turning on
5898 the use of 64-bit integers.
5899 EOM
5900                 use64bitint="$define" ;;
5901         esac
5902         ;;
5903 esac
5904
5905 : Look for a hint-file generated 'call-back-unit'.  If the
5906 : user has specified that a 64-bit perl is to be built,
5907 : we may need to set or change some other defaults.
5908 if $test -f use64bitint.cbu; then
5909         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5910         . ./use64bitint.cbu
5911 fi
5912 case "$use64bitint" in
5913 "$define"|true|[yY]*)
5914         case "$longsize" in
5915         4) case "$archname64" in
5916            '') archname64=64int ;;
5917            esac
5918            ;;
5919         esac
5920         ;;
5921 esac
5922
5923 : Look for a hint-file generated 'call-back-unit'.  If the
5924 : user has specified that a maximally 64-bit perl is to be built,
5925 : we may need to set or change some other defaults.
5926 if $test -f use64bitall.cbu; then
5927         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5928         . ./use64bitall.cbu
5929 fi
5930 case "$use64bitall" in
5931 "$define"|true|[yY]*)
5932         case "$longsize" in
5933         4) case "$archname64" in
5934            ''|64int) archname64=64all ;;
5935            esac
5936            ;;
5937         esac
5938         ;;
5939 esac
5940
5941 case "$d_quad:$use64bitint" in
5942 $undef:$define)
5943         cat >&4 <<EOF
5944
5945 *** You have chosen to use 64-bit integers,
5946 *** but none can be found.
5947 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5948 *** Cannot continue, aborting.
5949
5950 EOF
5951         exit 1
5952         ;;
5953 esac
5954
5955 : check for length of double
5956 echo " "
5957 case "$doublesize" in
5958 '')
5959         echo "Checking to see how big your double precision numbers are..." >&4
5960         $cat >try.c <<EOCP
5961 #include <stdio.h>
5962 #$i_stdlib I_STDLIB
5963 #ifdef I_STDLIB
5964 #include <stdlib.h>
5965 #endif
5966 int main()
5967 {
5968     printf("%d\n", (int)sizeof(double));
5969     exit(0);
5970 }
5971 EOCP
5972         set try
5973         if eval $compile_ok; then
5974                 doublesize=`$run ./try`
5975                 echo "Your double is $doublesize bytes long."
5976         else
5977                 dflt='8'
5978                 echo "(I can't seem to compile the test program.  Guessing...)"
5979                 rp="What is the size of a double precision number (in bytes)?"
5980                 . ./myread
5981                 doublesize="$ans"
5982         fi
5983         ;;
5984 esac
5985 $rm_try
5986
5987 : check for long doubles
5988 echo " "
5989 echo "Checking to see if you have long double..." >&4
5990 echo 'int main() { long double x = 7.0; }' > try.c
5991 set try
5992 if eval $compile; then
5993         val="$define"
5994         echo "You have long double."
5995 else
5996         val="$undef"
5997         echo "You do not have long double."
5998 fi
5999 $rm_try
6000 set d_longdbl
6001 eval $setvar
6002
6003 : check for length of long double
6004 case "${d_longdbl}${longdblsize}" in
6005 $define)
6006         echo " "
6007         echo "Checking to see how big your long doubles are..." >&4
6008         $cat >try.c <<'EOCP'
6009 #include <stdio.h>
6010 int main()
6011 {
6012         printf("%d\n", sizeof(long double));
6013 }
6014 EOCP
6015         set try
6016         set try
6017         if eval $compile; then
6018                 longdblsize=`$run ./try`
6019                 echo "Your long doubles are $longdblsize bytes long."
6020         else
6021                 dflt='8'
6022                 echo " "
6023                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6024                 rp="What is the size of a long double (in bytes)?"
6025                 . ./myread
6026                 longdblsize="$ans"
6027         fi
6028         if $test "X$doublesize" = "X$longdblsize"; then
6029                 echo "That isn't any different from an ordinary double."
6030                 echo "I'll keep your setting anyway, but you may see some"
6031                 echo "harmless compilation warnings."
6032         fi
6033         ;;
6034 esac
6035 $rm_try
6036
6037 : determine the architecture name
6038 echo " "
6039 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6040         tarch=`arch`"-$osname"
6041 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6042         if uname -m > tmparch 2>&1 ; then
6043                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6044                         -e 's/$/'"-$osname/" tmparch`
6045         else
6046                 tarch="$osname"
6047         fi
6048         $rm -f tmparch
6049 else
6050         tarch="$osname"
6051 fi
6052 case "$myarchname" in
6053 ''|"$tarch") ;;
6054 *)
6055         echo "(Your architecture name used to be $myarchname.)"
6056         archname=''
6057         ;;
6058 esac
6059 case "$targetarch" in
6060 '') ;;
6061 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6062 esac
6063 myarchname="$tarch"
6064 case "$archname" in
6065 '') dflt="$tarch";;
6066 *) dflt="$archname";;
6067 esac
6068 rp='What is your architecture name'
6069 . ./myread
6070 archname="$ans"
6071 case "$usethreads" in
6072 $define)
6073         echo "Threads selected." >&4
6074         case "$archname" in
6075         *-thread*) echo "...and architecture name already has -thread." >&4
6076                 ;;
6077         *)      archname="$archname-thread"
6078                 echo "...setting architecture name to $archname." >&4
6079                 ;;
6080         esac
6081         ;;
6082 esac
6083 case "$usemultiplicity" in
6084 $define)
6085         echo "Multiplicity selected." >&4
6086         case "$archname" in
6087         *-multi*) echo "...and architecture name already has -multi." >&4
6088                 ;;
6089         *)      archname="$archname-multi"
6090                 echo "...setting architecture name to $archname." >&4
6091                 ;;
6092         esac
6093         ;;
6094 esac
6095 case "$use64bitint$use64bitall" in
6096 *"$define"*)
6097         case "$archname64" in
6098         '')
6099                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6100                 ;;
6101         *)
6102                 case "$use64bitint" in
6103                 "$define") echo "64 bit integers selected." >&4 ;;
6104                 esac
6105                 case "$use64bitall" in
6106                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6107                 esac
6108                 case "$archname" in
6109                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6110                         ;;
6111                 *)      archname="$archname-$archname64"
6112                         echo "...setting architecture name to $archname." >&4
6113                         ;;
6114                 esac
6115                 ;;
6116         esac
6117 esac
6118 case "$uselongdouble" in
6119 $define)
6120         echo "Long doubles selected." >&4
6121         case "$longdblsize" in
6122         $doublesize)
6123                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6124                 ;;
6125         *)
6126                 case "$archname" in
6127                 *-ld*) echo "...and architecture name already has -ld." >&4
6128                         ;;
6129                 *)      archname="$archname-ld"
6130                         echo "...setting architecture name to $archname." >&4
6131                         ;;
6132                 esac
6133                 ;;
6134         esac
6135         ;;
6136 esac
6137 case "$useperlio" in
6138 $define)
6139         echo "Perlio selected." >&4
6140         ;;
6141 *)
6142         echo "Perlio not selected, using stdio." >&4
6143         case "$archname" in
6144         *-stdio*) echo "...and architecture name already has -stdio." >&4
6145                 ;;
6146         *)      archname="$archname-stdio"
6147                 echo "...setting architecture name to $archname." >&4
6148                 ;;
6149         esac
6150         ;;
6151 esac
6152 if $test -f archname.cbu; then
6153         echo "Your platform has some specific hints for architecture name, using them..."
6154         . ./archname.cbu
6155 fi
6156
6157 : set the prefixit variable, to compute a suitable default value
6158 prefixit='case "$3" in
6159 ""|none)
6160         case "$oldprefix" in
6161         "") eval "$1=\"\$$2\"";;
6162         *)
6163                 case "$3" in
6164                 "") eval "$1=";;
6165                 none)
6166                         eval "tp=\"\$$2\"";
6167                         case "$tp" in
6168                         ""|" ") eval "$1=\"\$$2\"";;
6169                         *) eval "$1=";;
6170                         esac;;
6171                 esac;;
6172         esac;;
6173 *)
6174         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6175         case "$tp" in
6176         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6177         /*-$oldprefix/*|\~*-$oldprefix/*)
6178                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6179         *) eval "$1=\"\$$2\"";;
6180         esac;;
6181 esac'
6182
6183 : determine installation style
6184 : For now, try to deduce it from prefix unless it is already set.
6185 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6186 case "$installstyle" in
6187 '')     case "$prefix" in
6188                 *perl*) dflt='lib';;
6189                 *) dflt='lib/perl5' ;;
6190         esac
6191         ;;
6192 *)      dflt="$installstyle" ;;
6193 esac
6194 : Probably not worth prompting for this since we prompt for all
6195 : the directories individually, and the prompt would be too long and
6196 : confusing anyway.
6197 installstyle=$dflt
6198
6199 : determine where public executables go
6200 echo " "
6201 set dflt bin bin
6202 eval $prefixit
6203 fn=d~
6204 rp='Pathname where the public executables will reside?'
6205 . ./getfile
6206 if $test "X$ansexp" != "X$binexp"; then
6207         installbin=''
6208 fi
6209 prefixvar=bin
6210 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6211 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6212 :     this via initialinstalllocation
6213 . ./setprefixvar
6214
6215 case "$userelocatableinc" in
6216 $define|true|[yY]*)     dflt='y' ;;
6217 *)                      dflt='n' ;;
6218 esac
6219 cat <<EOM
6220
6221 Would you like to build Perl so that the installation is relocatable, so that
6222 library paths in @INC are determined relative to the path of the perl binary?
6223 This is not advised for system Perl installs, or if you need to run setid
6224 scripts or scripts under taint mode.
6225
6226 If this doesn't make any sense to you, just accept the default '$dflt'.
6227 EOM
6228 rp='Use relocatable @INC?'
6229 . ./myread
6230 case "$ans" in
6231 y|Y)    val="$define" ;;
6232 *)      val="$undef"  ;;
6233 esac
6234 set userelocatableinc
6235 eval $setvar
6236
6237 initialinstalllocation="$binexp"
6238 : Default prefix is now "up one level from where the binaries are"
6239 case "$userelocatableinc" in
6240 $define|true|[yY]*)
6241     bin=".../"
6242     binexp=".../"
6243     prefix=".../.."
6244     prefixexp=".../.."
6245     installprefixexp=".../.."
6246     ;;
6247 esac
6248
6249 : determine where private library files go
6250 : Usual default is /usr/local/lib/perl5/$version.
6251 : Also allow things like /opt/perl/lib/$version, since
6252 : /opt/perl/lib/perl5... would be redundant.
6253 : The default "style" setting is made in installstyle.U
6254 case "$installstyle" in
6255 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6256 *)       set dflt privlib lib/$version ;;
6257 esac
6258 eval $prefixit
6259 $cat <<EOM
6260
6261 There are some auxiliary files for $package that need to be put into a
6262 private library directory that is accessible by everyone.
6263
6264 EOM
6265 fn=$binexp
6266 fn=d~+
6267 rp='Pathname where the private library files will reside?'
6268 . ./getfile
6269 prefixvar=privlib
6270 . ./setprefixvar
6271
6272 : set the prefixup variable, to restore leading tilda escape
6273 prefixup='case "$prefixexp" in
6274 "$prefix") ;;
6275 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6276 esac'
6277
6278 : determine where public architecture dependent libraries go
6279 set archlib archlib
6280 eval $prefixit
6281 : privlib default is /usr/local/lib/$package/$version
6282 : archlib default is /usr/local/lib/$package/$version/$archname
6283 : privlib may have an optional trailing /share.
6284 tdflt=`echo $privlib | $sed 's,/share$,,'`
6285 tdflt=$tdflt/$archname
6286 case "$archlib" in
6287 '')     dflt=$tdflt
6288         ;;
6289 *)      dflt="$archlib"
6290     ;;
6291 esac
6292 $cat <<EOM
6293
6294 $spackage contains architecture-dependent library files.  If you are
6295 sharing libraries in a heterogeneous environment, you might store
6296 these files in a separate location.  Otherwise, you can just include
6297 them with the rest of the public library files.
6298
6299 EOM
6300 fn=$binexp
6301 fn=d+~
6302 rp='Where do you want to put the public architecture-dependent libraries?'
6303 . ./getfile
6304 prefixvar=archlib
6305 . ./setprefixvar
6306 if $test X"$archlib" = X"$privlib"; then
6307         d_archlib="$undef"
6308 else
6309         d_archlib="$define"
6310 fi
6311
6312 : see if setuid scripts can be secure
6313 $cat <<EOM
6314
6315 Some kernels have a bug that prevents setuid #! scripts from being
6316 secure.  Some sites have disabled setuid #! scripts because of this.
6317
6318 First let's decide if your kernel supports secure setuid #! scripts.
6319 (If setuid #! scripts would be secure but have been disabled anyway,
6320 don't say that they are secure if asked.)
6321
6322 EOM
6323
6324 val="$undef"
6325 if $test -d /dev/fd; then
6326         echo "#!$ls" >reflect
6327         chmod +x,u+s reflect
6328         ./reflect >flect 2>&1
6329         if $contains "/dev/fd" flect >/dev/null; then
6330                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6331                 val="$define"
6332         else
6333                 $cat <<EOM
6334 If you are not sure if they are secure, I can check but I'll need a
6335 username and password different from the one you are using right now.
6336 If you don't have such a username or don't want me to test, simply
6337 enter 'none'.
6338
6339 EOM
6340                 rp='Other username to test security of setuid scripts with?'
6341                 dflt='none'
6342                 . ./myread
6343                 case "$ans" in
6344                 n|none)
6345                         case "$d_suidsafe" in
6346                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6347                                 dflt=n;;
6348                         "$undef")
6349                                 echo "Well, the $hint value is *not* secure." >&4
6350                                 dflt=n;;
6351                         *)      echo "Well, the $hint value *is* secure." >&4
6352                                 dflt=y;;
6353                         esac
6354                         ;;
6355                 *)
6356                         $rm -f reflect flect
6357                         echo "#!$ls" >reflect
6358                         chmod +x,u+s reflect
6359                         echo >flect
6360                         chmod a+w flect
6361                         echo '"su" will (probably) prompt you for '"$ans's password."
6362                         su $ans -c './reflect >flect'
6363                         if $contains "/dev/fd" flect >/dev/null; then
6364                                 echo "Okay, it looks like setuid scripts are secure." >&4
6365                                 dflt=y
6366                         else
6367                                 echo "I don't think setuid scripts are secure." >&4
6368                                 dflt=n
6369                         fi
6370                         ;;
6371                 esac
6372                 rp='Does your kernel have *secure* setuid scripts?'
6373                 . ./myread
6374                 case "$ans" in
6375                 [yY]*)  val="$define";;
6376                 *)      val="$undef";;
6377                 esac
6378         fi
6379 else
6380         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6381         echo "(That's for file descriptors, not floppy disks.)"
6382         val="$undef"
6383 fi
6384 set d_suidsafe
6385 eval $setvar
6386
6387 $rm -f reflect flect
6388
6389 : now see if they want to do setuid emulation
6390 if $test $patchlevel -lt 11; then
6391 echo " "
6392 val="$undef"
6393 case "$d_suidsafe" in
6394 "$define")
6395         val="$undef"
6396         echo "No need to emulate SUID scripts since they are secure here." >&4
6397         ;;
6398 *)
6399         $cat <<EOM
6400 Some systems have disabled setuid scripts, especially systems where
6401 setuid scripts cannot be secure.  On systems where setuid scripts have
6402 been disabled, the setuid/setgid bits on scripts are currently
6403 useless.  It is possible for $package to detect those bits and emulate
6404 setuid/setgid in a secure fashion.  This emulation will only work if
6405 setuid scripts have been disabled in your kernel.
6406
6407 EOM
6408         case "$d_dosuid" in
6409         "$define") dflt=y ;;
6410         *) dflt=n ;;
6411         esac
6412         rp="Do you want to do setuid/setgid emulation?"
6413         . ./myread
6414         case "$ans" in
6415         [yY]*)  val="$define";;
6416         *)      val="$undef";;
6417         esac
6418         ;;
6419 esac
6420 set d_dosuid
6421 eval $setvar
6422 else
6423     case "$d_dosuid" in
6424         "$define")
6425         cat >&4 <<EOH
6426
6427 SUID emulation has been removed for 5.12
6428 Please re-run Configure without -Dd_dosuid
6429
6430 EOH
6431         exit 1;
6432         ;;
6433     esac
6434     d_dosuid=undef
6435 fi
6436
6437 : Find perl5.005 or later.
6438 echo "Looking for a previously installed perl5.005 or later... "
6439 case "$perl5" in
6440 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6441                 : Check if this perl is recent and can load a simple module
6442                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6443                         perl5=$tdir/perl
6444                         break;
6445                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6446                         perl5=$tdir/perl5
6447                         break;
6448                 fi
6449         done
6450         ;;
6451 *)      perl5="$perl5"
6452         ;;
6453 esac
6454 case "$perl5" in
6455 '')     echo "None found.  That's ok.";;
6456 *)      echo "Using $perl5." ;;
6457 esac
6458
6459 : Set the siteprefix variables
6460 $cat <<EOM
6461
6462 After $package is installed, you may wish to install various
6463 add-on modules and utilities.  Typically, these add-ons will
6464 be installed under $prefix with the rest
6465 of this package.  However, you may wish to install such add-ons
6466 elsewhere under a different prefix.
6467
6468 If you do not wish to put everything under a single prefix, that's
6469 ok.  You will be prompted for the individual locations; this siteprefix
6470 is only used to suggest the defaults.
6471
6472 The default should be fine for most people.
6473
6474 EOM
6475 fn=d~+
6476 rp='Installation prefix to use for add-on modules and utilities?'
6477 : XXX Here might be another good place for an installstyle setting.
6478 case "$siteprefix" in
6479 '') dflt=$prefix ;;
6480 *)  dflt=$siteprefix ;;
6481 esac
6482 . ./getfile
6483 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6484 oldsiteprefix=''
6485 case "$siteprefix" in
6486 '') ;;
6487 *)      case "$ans" in
6488         "$prefix") ;;
6489         *) oldsiteprefix="$prefix";;
6490         esac
6491         ;;
6492 esac
6493 siteprefix="$ans"
6494 siteprefixexp="$ansexp"
6495
6496 : determine where site specific libraries go.
6497 : Usual default is /usr/local/lib/perl5/site_perl/$version
6498 : The default "style" setting is made in installstyle.U
6499 : XXX No longer works with Prefixit stuff.
6500 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6501 case "$sitelib" in
6502 '') case "$installstyle" in
6503         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6504         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6505         esac
6506         ;;
6507 *)      dflt="$sitelib"
6508         ;;
6509 esac
6510 $cat <<EOM
6511
6512 The installation process will create a directory for
6513 site-specific extensions and modules.  Most users find it convenient
6514 to place all site-specific files in this directory rather than in the
6515 main distribution directory.
6516
6517 EOM
6518 fn=d~+
6519 rp='Pathname for the site-specific library files?'
6520 . ./getfile
6521 prefixvar=sitelib
6522 . ./setprefixvar
6523 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6524
6525 : Determine list of previous versions to include in @INC
6526 $cat > getverlist <<EOPL
6527 #!$perl5 -w
6528 use File::Basename;
6529 \$api_versionstring = "$api_versionstring";
6530 \$version = "$version";
6531 \$stem = "$sitelib_stem";
6532 \$archname = "$archname";
6533 EOPL
6534         $cat >> getverlist <<'EOPL'
6535 # The list found is store twice for each entry: the original name, and
6536 # the binary broken down version as pack "sss", so sorting is easy and
6537 # unambiguous. This will work for all versions that have a maximum of
6538 # three digit groups, separate by '.'s or '_'s. Names are extended with
6539 # ".0.0" to ensure at least three elements for the pack.
6540 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6541
6542 # Can't have leading @ because metaconfig interprets it as a command!
6543 ;@inc_version_list=();
6544 # XXX Redo to do opendir/readdir?
6545 if (-d $stem) {
6546     chdir($stem);
6547     ;@candidates = map {
6548         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6549     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6550 }
6551 else {
6552     ;@candidates = ();
6553 }
6554
6555 ($pversion, $aversion, $vsn5005) = map {
6556     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6557 foreach $d (@candidates) {
6558     if ($d->[1] lt $pversion) {
6559         if ($d->[1] ge $aversion) {
6560             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6561         }
6562         elsif ($d->[1] ge $vsn5005) {
6563             unshift(@inc_version_list, grep { -d } $d->[0]);
6564         }
6565     }
6566     else {
6567         # Skip newer version.  I.e. don't look in
6568         # 5.7.0 if we're installing 5.6.1.
6569     }
6570 }
6571
6572 if (@inc_version_list) {
6573     print join(' ', @inc_version_list);
6574 }
6575 else {
6576     # Blank space to preserve value for next Configure run.
6577     print " ";
6578 }
6579 EOPL
6580 chmod +x getverlist
6581 case "$inc_version_list" in
6582 '')     if test -x "$perl5$exe_ext"; then
6583                 dflt=`$perl5 getverlist`
6584         else
6585                 dflt='none'
6586         fi
6587         ;;
6588 $undef) dflt='none' ;;
6589 *)  eval dflt=\"$inc_version_list\" ;;
6590 esac
6591 case "$dflt" in
6592 ''|' ') dflt=none ;;
6593 esac
6594 case "$dflt" in
6595 5.005) dflt=none ;;
6596 esac
6597 $cat <<EOM
6598
6599 In order to ease the process of upgrading, this version of perl
6600 can be configured to use modules built and installed with earlier
6601 versions of perl that were installed under $prefix.  Specify here
6602 the list of earlier versions that this version of perl should check.
6603 If Configure detected no earlier versions of perl installed under
6604 $prefix, then the list will be empty.  Answer 'none' to tell perl
6605 to not search earlier versions.
6606
6607 The default should almost always be sensible, so if you're not sure,
6608 just accept the default.
6609 EOM
6610
6611 rp='List of earlier versions to include in @INC?'
6612 . ./myread
6613 case "$ans" in
6614 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6615 *) inc_version_list="$ans" ;;
6616 esac
6617 case "$inc_version_list" in
6618 ''|' ')
6619         inc_version_list_init='0'
6620         d_inc_version_list="$undef"
6621         ;;
6622 *)      inc_version_list_init=`echo $inc_version_list |
6623                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6624         d_inc_version_list="$define"
6625         ;;
6626 esac
6627 $rm -f getverlist
6628
6629 : see if malloc/malloc.h has to be included
6630 set malloc/malloc.h i_mallocmalloc
6631 eval $inhdr
6632
6633 : see if this is a malloc.h system
6634 : we want a real compile instead of Inhdr because some systems have a
6635 : malloc.h that just gives a compile error saying to use stdlib.h instead
6636 echo " "
6637 $cat >try.c <<EOCP
6638 #include <stdlib.h>
6639 #include <malloc.h>
6640 #$i_mallocmalloc I_MALLOCMALLOC
6641 #ifdef I_MALLOCMALLOC
6642 # include <malloc/malloc.h>
6643 #endif
6644
6645 int main () { return 0; }
6646 EOCP
6647 set try
6648 if eval $compile; then
6649     echo "<malloc.h> found." >&4
6650     val="$define"
6651 else
6652     echo "<malloc.h> NOT found." >&4
6653     val="$undef"
6654 fi
6655 $rm_try
6656 set i_malloc
6657 eval $setvar
6658
6659 : check for void type
6660 echo " "
6661 echo "Checking to see how well your C compiler groks the void type..." >&4
6662 case "$voidflags" in
6663 '')
6664         $cat >try.c <<EOCP
6665 #$i_stdlib I_STDLIB
6666 #ifdef I_STDLIB
6667 #include <stdlib.h>
6668 #endif
6669 #if TRY & 1
6670 void sub() {
6671 #else
6672 sub() {
6673 #endif
6674         extern void moo();      /* function returning void */
6675         void (*goo)();          /* ptr to func returning void */
6676 #if TRY & 8
6677         void *hue;              /* generic ptr */
6678 #endif
6679 #if TRY & 2
6680         void (*foo[10])();
6681 #endif
6682
6683 #if TRY & 4
6684         if(goo == moo) {
6685                 exit(0);
6686         }
6687 #endif
6688         exit(0);
6689 }
6690 int main() { sub(); }
6691 EOCP
6692         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6693                 voidflags=$defvoidused
6694         echo "Good.  It appears to support void to the level $package wants.">&4
6695                 if $contains warning .out >/dev/null 2>&1; then
6696                         echo "However, you might get some warnings that look like this:"
6697                         $cat .out
6698                 fi
6699         else
6700 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6701                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6702                         echo "It supports 1..."
6703                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6704                                 echo "It also supports 2..."
6705                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6706                                         voidflags=7
6707                                         echo "And it supports 4 but not 8 definitely."
6708                                 else
6709                                         echo "It doesn't support 4..."
6710                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6711                                                 voidflags=11
6712                                                 echo "But it supports 8."
6713                                         else
6714                                                 voidflags=3
6715                                                 echo "Neither does it support 8."
6716                                         fi
6717                                 fi
6718                         else
6719                                 echo "It does not support 2..."
6720                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6721                                         voidflags=13
6722                                         echo "But it supports 4 and 8."
6723                                 else
6724                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6725                                                 voidflags=5
6726                                                 echo "And it supports 4 but has not heard about 8."
6727                                         else
6728                                                 echo "However it supports 8 but not 4."
6729                                         fi
6730                                 fi
6731                         fi
6732                 else
6733                         echo "There is no support at all for void."
6734                         voidflags=0
6735                 fi
6736         fi
6737 esac
6738 case "$voidflags" in
6739 "$defvoidused") ;;
6740 *)      $cat >&4 <<'EOM'
6741   Support flag bits are:
6742     1: basic void declarations.
6743     2: arrays of pointers to functions returning void.
6744     4: operations between pointers to and addresses of void functions.
6745     8: generic void pointers.
6746 EOM
6747         dflt="$voidflags";
6748         rp="Your void support flags add up to what?"
6749         . ./myread
6750         voidflags="$ans"
6751         ;;
6752 esac
6753 $rm_try
6754
6755 : check for length of pointer
6756 echo " "
6757 case "$ptrsize" in
6758 '')
6759         echo "Checking to see how big your pointers are..." >&4
6760         if test "$voidflags" -gt 7; then
6761                 echo '#define VOID_PTR char *' > try.c
6762         else
6763                 echo '#define VOID_PTR void *' > try.c
6764         fi
6765         $cat >>try.c <<EOCP
6766 #include <stdio.h>
6767 #$i_stdlib I_STDLIB
6768 #ifdef I_STDLIB
6769 #include <stdlib.h>
6770 #endif
6771 int main()
6772 {
6773     printf("%d\n", (int)sizeof(VOID_PTR));
6774     exit(0);
6775 }
6776 EOCP
6777         set try
6778         if eval $compile_ok; then
6779                 ptrsize=`$run ./try`
6780                 echo "Your pointers are $ptrsize bytes long."
6781         else
6782                 dflt='4'
6783                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6784                 rp="What is the size of a pointer (in bytes)?"
6785                 . ./myread
6786                 ptrsize="$ans"
6787         fi
6788         ;;
6789 esac
6790 $rm_try
6791 case "$use64bitall" in
6792 "$define"|true|[yY]*)
6793         case "$ptrsize" in
6794         4)      cat <<EOM >&4
6795
6796 *** You have chosen a maximally 64-bit build,
6797 *** but your pointers are only 4 bytes wide.
6798 *** Please rerun Configure without -Duse64bitall.
6799 EOM
6800                 case "$d_quad" in
6801                 define)
6802                         cat <<EOM >&4
6803 *** Since you have quads, you could possibly try with -Duse64bitint.
6804 EOM
6805                         ;;
6806                 esac
6807                 cat <<EOM >&4
6808 *** Cannot continue, aborting.
6809
6810 EOM
6811
6812                 exit 1
6813                 ;;
6814         esac
6815         ;;
6816 esac
6817
6818
6819 : determine whether to use malloc wrapping
6820 echo " "
6821 case "$usemallocwrap" in
6822 [yY]*|true|$define)     dflt='y' ;;
6823 [nN]*|false|$undef)     dflt='n' ;;
6824 *)      case "$usedevel" in
6825         [yY]*|true|$define)     dflt='y' ;;
6826         *) dflt='n' ;;
6827         esac
6828         ;;
6829 esac
6830 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6831 . ./myread
6832 usemallocwrap="$ans"
6833 case "$ans" in
6834 y*|true)
6835         usemallocwrap="$define" ;;
6836 *)
6837         usemallocwrap="$undef" ;;
6838 esac
6839
6840 : determine which malloc to compile in
6841 echo " "
6842 case "$usemymalloc" in
6843 [yY]*|true|$define)     dflt='y' ;;
6844 [nN]*|false|$undef)     dflt='n' ;;
6845 *)      case "$ptrsize" in
6846         4) dflt='y' ;;
6847         *) dflt='n' ;;
6848         esac
6849         ;;
6850 esac
6851 rp="Do you wish to attempt to use the malloc that comes with $package?"
6852 . ./myread
6853 usemymalloc="$ans"
6854 case "$ans" in
6855 y*|true)
6856         usemymalloc='y'
6857         mallocsrc='malloc.c'
6858         mallocobj="malloc$_o"
6859         d_mymalloc="$define"
6860         case "$libs" in
6861         *-lmalloc*)
6862                 : Remove malloc from list of libraries to use
6863                 echo "Removing unneeded -lmalloc from library list" >&4
6864                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6865                 shift
6866                 libs="$*"
6867                 echo "libs = $libs" >&4
6868                 ;;
6869         esac
6870         ;;
6871 *)
6872         usemymalloc='n'
6873         mallocsrc=''
6874         mallocobj=''
6875         d_mymalloc="$undef"
6876         ;;
6877 esac
6878
6879 : compute the return types of malloc and free
6880 echo " "
6881 $cat >malloc.c <<END
6882 #$i_malloc I_MALLOC
6883 #$i_stdlib I_STDLIB
6884 #include <stdio.h>
6885 #include <sys/types.h>
6886 #ifdef I_MALLOC
6887 #include <malloc.h>
6888 #endif
6889 #ifdef I_STDLIB
6890 #include <stdlib.h>
6891 #endif
6892 #ifdef TRY_MALLOC
6893 void *malloc();
6894 #endif
6895 #ifdef TRY_FREE
6896 void free();
6897 #endif
6898 END
6899 case "$malloctype" in
6900 '')
6901         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6902                 malloctype='void *'
6903         else
6904                 malloctype='char *'
6905         fi
6906         ;;
6907 esac
6908 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6909
6910 case "$freetype" in
6911 '')
6912         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6913                 freetype='void'
6914         else
6915                 freetype='int'
6916         fi
6917         ;;
6918 esac
6919 echo "Your system uses $freetype free(), it would seem." >&4
6920 $rm -f malloc.[co]
6921 : determine where site specific architecture-dependent libraries go.
6922 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6923 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6924 : sitelib may have an optional trailing /share.
6925 case "$sitearch" in
6926 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6927         dflt="$dflt/$archname"
6928         ;;
6929 *)      dflt="$sitearch"
6930         ;;
6931 esac
6932 set sitearch sitearch none
6933 eval $prefixit
6934 $cat <<EOM
6935
6936 The installation process will also create a directory for
6937 architecture-dependent site-specific extensions and modules.
6938
6939 EOM
6940 fn=d~+
6941 rp='Pathname for the site-specific architecture-dependent library files?'
6942 . ./getfile
6943 prefixvar=sitearch
6944 . ./setprefixvar
6945 if $test X"$sitearch" = X"$sitelib"; then
6946         d_sitearch="$undef"
6947 else
6948         d_sitearch="$define"
6949 fi
6950
6951 : Set the vendorprefix variables
6952 $cat <<EOM
6953
6954 The installation process will also create a directory for
6955 vendor-supplied add-ons.  Vendors who supply perl with their system
6956 may find it convenient to place all vendor-supplied files in this
6957 directory rather than in the main distribution directory.  This will
6958 ease upgrades between binary-compatible maintenance versions of perl.
6959
6960 Of course you may also use these directories in whatever way you see
6961 fit.  For example, you might use them to access modules shared over a
6962 company-wide network.
6963
6964 The default answer should be fine for most people.
6965 This causes further questions about vendor add-ons to be skipped
6966 and no vendor-specific directories will be configured for perl.
6967
6968 EOM
6969 rp='Do you want to configure vendor-specific add-on directories?'
6970 case "$usevendorprefix" in
6971 define|true|[yY]*) dflt=y ;;
6972 *)      : User may have set vendorprefix directly on Configure command line.
6973         case "$vendorprefix" in
6974         ''|' ') dflt=n ;;
6975         *)      dflt=y ;;
6976         esac
6977         ;;
6978 esac
6979 . ./myread
6980 case "$ans" in
6981 [yY]*)  fn=d~+
6982         rp='Installation prefix to use for vendor-supplied add-ons?'
6983         case "$vendorprefix" in
6984         '') dflt='' ;;
6985         *)  dflt=$vendorprefix ;;
6986         esac
6987         . ./getfile
6988         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6989         oldvendorprefix=''
6990         case "$vendorprefix" in
6991         '') ;;
6992         *)      case "$ans" in
6993                 "$prefix") ;;
6994                 *) oldvendorprefix="$prefix";;
6995                 esac
6996                 ;;
6997         esac
6998         usevendorprefix="$define"
6999         vendorprefix="$ans"
7000         vendorprefixexp="$ansexp"
7001         ;;
7002 *)      usevendorprefix="$undef"
7003         vendorprefix=''
7004         vendorprefixexp=''
7005         ;;
7006 esac
7007
7008 : Set the vendorlib variables
7009 case "$vendorprefix" in
7010 '')     d_vendorlib="$undef"
7011         vendorlib=''
7012         vendorlibexp=''
7013         ;;
7014 *)      d_vendorlib="$define"
7015         : determine where vendor-supplied modules go.
7016         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7017         case "$vendorlib" in
7018         '')
7019                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7020                 case "$installstyle" in
7021                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7022                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7023                 esac
7024                 ;;
7025         *)      dflt="$vendorlib"
7026                 ;;
7027         esac
7028         fn=d~+
7029         rp='Pathname for the vendor-supplied library files?'
7030         . ./getfile
7031         vendorlib="$ans"
7032         vendorlibexp="$ansexp"
7033         ;;
7034 esac
7035 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7036 prefixvar=vendorlib
7037 . ./installprefix
7038
7039 : Set the vendorarch variables
7040 case "$vendorprefix" in
7041 '')     d_vendorarch="$undef"
7042         vendorarch=''
7043         vendorarchexp=''
7044         ;;
7045 *)      d_vendorarch="$define"
7046         : determine where vendor-supplied architecture-dependent libraries go.
7047         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7048         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7049         : vendorlib may have an optional trailing /share.
7050         case "$vendorarch" in
7051         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7052                 dflt="$dflt/$archname"
7053                 ;;
7054         *)      dflt="$vendorarch" ;;
7055         esac
7056         fn=d~+
7057         rp='Pathname for vendor-supplied architecture-dependent files?'
7058         . ./getfile
7059         vendorarch="$ans"
7060         vendorarchexp="$ansexp"
7061         ;;
7062 esac
7063 prefixvar=vendorarch
7064 . ./installprefix
7065 if $test X"$vendorarch" = X"$vendorlib"; then
7066         d_vendorarch="$undef"
7067 else
7068         d_vendorarch="$define"
7069 fi
7070
7071 : Final catch-all directories to search
7072 $cat <<EOM
7073
7074 Lastly, you can have perl look in other directories for extensions and
7075 modules in addition to those already specified.
7076 These directories will be searched after 
7077         $sitearch 
7078         $sitelib 
7079 EOM
7080 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7081 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7082 echo ' '
7083 case "$otherlibdirs" in
7084 ''|' ') dflt='none' ;;
7085 *)      dflt="$otherlibdirs" ;;
7086 esac
7087 $cat <<EOM
7088 Enter a colon-separated set of extra paths to include in perl's @INC
7089 search path, or enter 'none' for no extra paths.
7090
7091 EOM
7092
7093 rp='Colon-separated list of additional directories for perl to search?'
7094 . ./myread
7095 case "$ans" in
7096 ' '|''|none)    otherlibdirs=' ' ;;     
7097 *)      otherlibdirs="$ans" ;;
7098 esac
7099 case "$otherlibdirs" in
7100 ' ') val=$undef ;;
7101 *)      val=$define ;;
7102 esac
7103 set d_perl_otherlibdirs
7104 eval $setvar
7105
7106 : Cruising for prototypes
7107 echo " "
7108 echo "Checking out function prototypes..." >&4
7109 $cat >prototype.c <<EOCP
7110 #$i_stdlib I_STDLIB
7111 #ifdef I_STDLIB
7112 #include <stdlib.h>
7113 #endif
7114 int main(int argc, char *argv[]) {
7115         exit(0);}
7116 EOCP
7117 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7118         echo "Your C compiler appears to support function prototypes."
7119         val="$define"
7120 else
7121         echo "Your C compiler doesn't seem to understand function prototypes."
7122         val="$undef"
7123 fi
7124 set prototype
7125 eval $setvar
7126 $rm -f prototype*
7127
7128 : Check if ansi2knr is required
7129 case "$prototype" in
7130 "$define") ;;
7131 *)      ansi2knr='ansi2knr'
7132         echo " "
7133         cat <<EOM >&4
7134
7135 $me:  FATAL ERROR:
7136 This version of $package can only be compiled by a compiler that 
7137 understands function prototypes.  Unfortunately, your C compiler 
7138         $cc $ccflags
7139 doesn't seem to understand them.  Sorry about that.
7140
7141 If GNU cc is available for your system, perhaps you could try that instead.  
7142
7143 Eventually, we hope to support building Perl with pre-ANSI compilers.
7144 If you would like to help in that effort, please contact <perlbug@perl.org>.
7145
7146 Aborting Configure now.
7147 EOM
7148         exit 2
7149         ;;
7150 esac
7151
7152 : DTrace support
7153 dflt_dtrace='/usr/sbin/dtrace'
7154 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7155
7156 cat <<EOM
7157
7158 Perl can be built to support DTrace on platforms that support it.
7159 DTrace is a diagnosis and performance analysis tool from Sun.
7160
7161 If this doesn't make any sense to you, just accept the default '$dflt'.
7162 EOM
7163
7164 while $test 1 ; do
7165         case "$usedtrace" in
7166         $define|true|[yY]*)
7167                 dflt='y'
7168                 ;;
7169         ?*)
7170                 dflt='y'
7171                 dflt_dtrace=$usedtrace
7172                 ;;
7173         *)
7174                 dflt='n'
7175                 ;;
7176         esac
7177
7178         rp='Support DTrace if available?'
7179         . ./myread
7180         case "$ans" in
7181         y|Y)    val="$define" ;;
7182         *)      val="$undef" ;;
7183         esac
7184         set usedtrace
7185         eval $setvar
7186
7187         test "X$usedtrace" != "X$define" && break
7188
7189         echo " "
7190         rp='Where is the dtrace executable?'
7191         dflt=$dflt_dtrace
7192         . ./getfile
7193         val="$ans"
7194         set dtrace
7195         eval $setvar
7196
7197         if $test -f $dtrace
7198         then
7199                 if $dtrace -h -s ../perldtrace.d \
7200                         -o perldtrace.tmp >/dev/null 2>&1 \
7201                         && rm -f perldtrace.tmp
7202                 then
7203                         echo " "
7204                         echo "Good: your $dtrace knows about the -h flag."
7205                 else
7206                         cat >&2 <<EOM
7207
7208 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7209 ***
7210 *** Your installed dtrace doesn't support the -h switch to compile a D
7211 *** program into a C header. Can't continue.
7212
7213 EOM
7214                         exit 1
7215                 fi
7216                 break;
7217         fi
7218
7219         case "$fastread" in
7220         yes)
7221                 cat >&2 <<EOM
7222
7223 *** $me:  Fatal Error:  $dtrace not found.
7224 *** Can't continue.
7225
7226 EOM
7227                 exit 1
7228                 ;;
7229         *)
7230                 echo "*** $dtrace was not found."
7231                 echo " "
7232                 ;;
7233         esac
7234 done
7235
7236 : See if we want extra modules installed
7237 echo " "
7238 case "$extras" in
7239 '') dflt='n';;
7240 *) dflt='y';;
7241 esac
7242 cat <<EOM
7243 Perl can be built with extra modules or bundles of modules which
7244 will be fetched from the CPAN and installed alongside Perl.
7245
7246 Notice that you will need access to the CPAN; either via the Internet,
7247 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7248 be asked later to configure the CPAN.pm module which will in turn do
7249 the installation of the rest of the extra modules or bundles.)
7250
7251 Notice also that if the modules require any external software such as
7252 libraries and headers (the libz library and the zlib.h header for the
7253 Compress::Zlib module, for example) you MUST have any such software
7254 already installed, this configuration process will NOT install such
7255 things for you.
7256
7257 If this doesn't make any sense to you, just accept the default '$dflt'.
7258 EOM
7259 rp='Install any extra modules (y or n)?'
7260 . ./myread
7261 case "$ans" in
7262 y|Y)
7263         cat <<EOM
7264
7265 Please list any extra modules or bundles to be installed from CPAN,
7266 with spaces between the names.  The names can be in any format the
7267 'install' command of CPAN.pm will understand.  (Answer 'none',
7268 without the quotes, to install no extra modules or bundles.)
7269 EOM
7270         rp='Extras?'
7271         dflt="$extras"
7272         . ./myread
7273         extras="$ans"
7274 esac
7275 case "$extras" in
7276 ''|'none')
7277         val=''
7278         $rm -f ../extras.lst
7279         ;;
7280 *)      echo "(Saving the list of extras for later...)"
7281         echo "$extras" > ../extras.lst
7282         val="'$extras'"
7283         ;;
7284 esac
7285 set extras
7286 eval $setvar
7287 echo " "
7288
7289 : determine where html pages for programs go
7290 set html1dir html1dir none
7291 eval $prefixit
7292 $cat <<EOM
7293
7294 If you wish to install html files for programs in $spackage, indicate
7295 the appropriate directory here.  To skip installing html files,
7296 answer "none".
7297 EOM
7298 case "$html1dir" in
7299 ''|none|$undef|' ') dflt=none ;;
7300 *) dflt=$html1dir ;;
7301 esac
7302 fn=dn+~
7303 rp="Directory for the main $spackage html pages?"
7304 . ./getfile
7305 prefixvar=html1dir
7306 . ./setprefixvar
7307 : Use ' ' for none so value is preserved next time through Configure
7308 $test X"$html1dir" = "X" && html1dir=' '
7309
7310 : determine where html pages for libraries and modules go
7311 set html3dir html3dir none
7312 eval $prefixit
7313 $cat <<EOM
7314
7315 If you wish to install html files for modules associated with $spackage,
7316 indicate the appropriate directory here.  To skip installing html files,
7317 answer "none".
7318 EOM
7319 : There is no obvious default.  If they have specified html1dir, then
7320 : try to key off that, possibly changing .../html1 into .../html3.
7321 case "$html3dir" in
7322 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7323 *) dflt=$html3dir ;;
7324 esac
7325 fn=dn+~
7326 rp="Directory for the $spackage module html pages?"
7327 . ./getfile
7328 prefixvar=html3dir
7329 . ./setprefixvar
7330 : Use ' ' for none so value is preserved next time through Configure
7331 $test X"$html3dir" = "X" && html3dir=' '
7332
7333 : determine whether to install perl also as /usr/bin/perl
7334
7335 echo " "
7336 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7337         $cat <<EOM
7338 Many scripts expect perl to be installed as /usr/bin/perl.
7339
7340 If you want to, I can install the perl you are about to compile
7341 as /usr/bin/perl (in addition to $bin/perl).
7342 EOM
7343         if test -f /usr/bin/perl; then
7344             $cat <<EOM
7345
7346 However, please note that because you already have a /usr/bin/perl,
7347 overwriting that with a new Perl would very probably cause problems.
7348 Therefore I'm assuming you don't want to do that (unless you insist).
7349
7350 EOM
7351             case "$installusrbinperl" in
7352             "$define"|[yY]*)    dflt='y';;
7353             *)                  dflt='n';;
7354             esac
7355         else
7356             $cat <<EOM
7357
7358 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7359
7360 EOM
7361             case "$installusrbinperl" in
7362             "$undef"|[nN]*)     dflt='n';;
7363             *)                  dflt='y';;
7364             esac
7365         fi
7366         rp="Do you want to install perl as /usr/bin/perl?"
7367         . ./myread
7368         case "$ans" in
7369         [yY]*)  val="$define";;
7370         *)      val="$undef" ;;
7371         esac
7372 else
7373         val="$undef"
7374 fi
7375 set installusrbinperl
7376 eval $setvar
7377
7378 : Check if we are using the GNU C library
7379 echo " "
7380 echo "Checking for GNU C Library..." >&4
7381 cat >try.c <<'EOCP'
7382 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7383    alone are insufficient to distinguish different versions, such as
7384    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7385    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7386 */
7387 #include <stdio.h>
7388 int main(void)
7389 {
7390 #ifdef __GLIBC__
7391 #   ifdef __GLIBC_MINOR__
7392 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7393 #           include <gnu/libc-version.h>
7394             printf("%s\n",  gnu_get_libc_version());
7395 #       else
7396             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7397 #       endif
7398 #   else
7399         printf("%d\n",  __GLIBC__);
7400 #   endif
7401     return 0;
7402 #else
7403     return 1;
7404 #endif
7405 }
7406 EOCP
7407 set try
7408 if eval $compile_ok && $run ./try > glibc.ver; then
7409         val="$define"
7410         gnulibc_version=`$cat glibc.ver`
7411         echo "You are using the GNU C Library version $gnulibc_version"
7412 else
7413         val="$undef"
7414         gnulibc_version=''
7415         echo "You are not using the GNU C Library"
7416 fi
7417 $rm_try glibc.ver
7418 set d_gnulibc
7419 eval $setvar
7420
7421 : see if nm is to be used to determine whether a symbol is defined or not
7422 case "$usenm" in
7423 '')
7424         dflt=''
7425         case "$d_gnulibc" in
7426         "$define")
7427                 echo " "
7428                 echo "nm probably won't work on the GNU C Library." >&4
7429                 dflt=n
7430                 ;;
7431         esac
7432         case "$dflt" in
7433         '') 
7434                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7435                         echo " "
7436                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7437                         echo "'nm' won't be sufficient on this sytem." >&4
7438                         dflt=n
7439                 fi
7440                 ;;
7441         esac
7442         case "$dflt" in
7443         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7444                 if $test $dflt -gt 20; then
7445                         dflt=y
7446                 else
7447                         dflt=n
7448                 fi
7449                 ;;
7450         esac
7451         ;;
7452 *)
7453         case "$usenm" in
7454         true|$define) dflt=y;;
7455         *) dflt=n;;
7456         esac
7457         ;;
7458 esac
7459 $cat <<EOM
7460
7461 I can use $nm to extract the symbols from your C libraries. This
7462 is a time consuming task which may generate huge output on the disk (up
7463 to 3 megabytes) but that should make the symbols extraction faster. The
7464 alternative is to skip the 'nm' extraction part and to compile a small
7465 test program instead to determine whether each symbol is present. If
7466 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7467 this may be the best solution.
7468
7469 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7470
7471 EOM
7472 rp="Shall I use $nm to extract C symbols from the libraries?"
7473 . ./myread
7474 case "$ans" in
7475 [Nn]*) usenm=false;;
7476 *) usenm=true;;
7477 esac
7478
7479 runnm=$usenm
7480 case "$reuseval" in
7481 true) runnm=false;;
7482 esac
7483
7484 : nm options which may be necessary
7485 case "$nm_opt" in
7486 '') if $test -f /mach_boot; then
7487                 nm_opt=''       # Mach
7488         elif $test -d /usr/ccs/lib; then
7489                 nm_opt='-p'     # Solaris (and SunOS?)
7490         elif $test -f /dgux; then
7491                 nm_opt='-p'     # DG-UX
7492         elif $test -f /lib64/rld; then
7493                 nm_opt='-p'     # 64-bit Irix
7494         else
7495                 nm_opt=''
7496         fi;;
7497 esac
7498
7499 : nm options which may be necessary for shared libraries but illegal
7500 : for archive libraries.  Thank you, Linux.
7501 case "$nm_so_opt" in
7502 '')     case "$myuname" in
7503         *linux*|gnu*)
7504                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7505                         nm_so_opt='--dynamic'
7506                 fi
7507                 ;;
7508         esac
7509         ;;
7510 esac
7511
7512 : Figure out where the libc is located
7513 case "$runnm" in
7514 true)
7515 : get list of predefined functions in a handy place
7516 echo " "
7517 case "$libc" in
7518 '') libc=unknown
7519         case "$libs" in
7520         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7521         esac
7522         ;;
7523 esac
7524 case "$libs" in
7525 '') ;;
7526 *)  for thislib in $libs; do
7527         case "$thislib" in
7528         -lc|-lc_s)
7529                 : Handle C library specially below.
7530                 ;;
7531         -l*)
7532                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7533                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7534                         :
7535                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7536                         :
7537                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7538                         :
7539                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7540                         :
7541                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7542                         :
7543                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7544                         :
7545                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7546                         :
7547                 else
7548                         try=''
7549                 fi
7550                 libnames="$libnames $try"
7551                 ;;
7552         *) libnames="$libnames $thislib" ;;
7553         esac
7554         done
7555         ;;
7556 esac
7557 xxx=normal
7558 case "$libc" in
7559 unknown)
7560         set /lib/libc.$so
7561         for xxx in $libpth; do
7562                 $test -r $1 || set $xxx/libc.$so
7563                 : The messy sed command sorts on library version numbers.
7564                 $test -r $1 || \
7565                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7566                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7567                                 h
7568                                 s/[0-9][0-9]*/0000&/g
7569                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7570                                 G
7571                                 s/\n/ /' | \
7572                          $sort | $sed -e 's/^.* //'`
7573                 eval set \$$#
7574         done
7575         $test -r $1 || set /usr/ccs/lib/libc.$so
7576         $test -r $1 || set /lib/libsys_s$_a
7577         ;;
7578 *)
7579         set blurfl
7580         ;;
7581 esac
7582 if $test -r "$1"; then
7583         echo "Your (shared) C library seems to be in $1."
7584         libc="$1"
7585 elif $test -r /lib/libc && $test -r /lib/clib; then
7586         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7587         xxx=apollo
7588         libc='/lib/clib /lib/libc'
7589         if $test -r /lib/syslib; then
7590                 echo "(Your math library is in /lib/syslib.)"
7591                 libc="$libc /lib/syslib"
7592         fi
7593 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7594         echo "Your C library seems to be in $libc, as you said before."
7595 elif $test -r $incpath/usr/lib/libc$_a; then
7596         libc=$incpath/usr/lib/libc$_a;
7597         echo "Your C library seems to be in $libc.  That's fine."
7598 elif $test -r /lib/libc$_a; then
7599         libc=/lib/libc$_a;
7600         echo "Your C library seems to be in $libc.  You're normal."
7601 else
7602         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7603                 :
7604         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7605                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7606         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7607                 :
7608         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7609                 :
7610         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7611                 :
7612         else
7613                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7614         fi
7615         if $test -r "$tans"; then
7616                 echo "Your C library seems to be in $tans, of all places."
7617                 libc=$tans
7618         else
7619                 libc='blurfl'
7620         fi
7621 fi
7622 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7623         dflt="$libc"
7624         cat <<EOM
7625
7626 If the guess above is wrong (which it might be if you're using a strange
7627 compiler, or your machine supports multiple models), you can override it here.
7628
7629 EOM
7630 else
7631         dflt=''
7632         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7633         cat >&4 <<EOM
7634 I can't seem to find your C library.  I've looked in the following places:
7635
7636 EOM
7637         $sed 's/^/      /' libpath
7638         cat <<EOM
7639
7640 None of these seems to contain your C library. I need to get its name...
7641
7642 EOM
7643 fi
7644 fn=f
7645 rp='Where is your C library?'
7646 . ./getfile
7647 libc="$ans"
7648
7649 echo " "
7650 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7651 set X `cat libnames`
7652 shift
7653 xxx=files
7654 case $# in 1) xxx=file; esac
7655 echo "Extracting names from the following $xxx for later perusal:" >&4
7656 echo " "
7657 $sed 's/^/      /' libnames >&4
7658 echo " "
7659 $echo $n "This may take a while...$c" >&4
7660
7661 for file in $*; do
7662         case $file in
7663         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7664         *) $nm $nm_opt $file 2>/dev/null;;
7665         esac
7666 done >libc.tmp
7667
7668 $echo $n ".$c"
7669 $grep fprintf libc.tmp > libc.ptf
7670 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7671 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7672 xxx='[ADTSIWi]'
7673 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7678         eval $xscan;\
7679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680                 eval $xrun
7681 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7682         eval $xscan;\
7683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684                 eval $xrun
7685 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7690         eval $xscan;\
7691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692                 eval $xrun
7693 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7694         eval $xscan;\
7695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696                 eval $xrun
7697 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7698                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7703         eval $xscan;\
7704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705                 eval $xrun
7706 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7707         eval $xscan;\
7708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709                 eval $xrun
7710 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7711         eval $xscan;\
7712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7713                 eval $xrun
7714 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7715         eval $xscan;\
7716         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7717                 eval $xrun
7718 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7719         eval $xscan;\
7720         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7721                 eval $xrun
7722 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7723         eval $xscan;\
7724         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7725                 eval $xrun
7726 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7727         eval $xscan;\
7728         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7729                 eval $xrun
7730 else
7731         $nm -p $* 2>/dev/null >libc.tmp
7732         $grep fprintf libc.tmp > libc.ptf
7733         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7734                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7735         then
7736                 nm_opt='-p'
7737                 eval $xrun
7738         else
7739                 echo " "
7740                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7741                 com=''
7742                 if $ar t $libc > libc.tmp && \
7743                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7744                 then
7745                         for thisname in $libnames $libc; do
7746                                 $ar t $thisname >>libc.tmp
7747                         done
7748                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7749                         echo "Ok." >&4
7750                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7751                         for thisname in $libnames $libc; do
7752                                 $ar tv $thisname >>libc.tmp
7753                                 emximp -o tmp.imp $thisname \
7754                                     2>/dev/null && \
7755                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7756                                     < tmp.imp >>libc.tmp
7757                                 $rm -f tmp.imp
7758                         done
7759                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7760                         echo "Ok." >&4
7761                 else
7762                         echo "$ar didn't seem to work right." >&4
7763                         echo "Maybe this is a Cray...trying bld instead..." >&4
7764                         if  bld t $libc | \
7765                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7766                                 $test -s libc.list
7767                         then
7768                                 for thisname in $libnames; do
7769                                         bld t $libnames | \
7770                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7771                                         $ar t $thisname >>libc.tmp
7772                                 done
7773                                 echo "Ok." >&4
7774                         else
7775                                 echo "That didn't work either.  Giving up." >&4
7776                                 exit 1
7777                         fi
7778                 fi
7779         fi
7780 fi
7781 nm_extract="$com"
7782 case "$PASE" in
7783 define)
7784     echo " "
7785     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7786     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7787     ;;
7788 *)  if $test -f /lib/syscalls.exp; then
7789         echo " "
7790         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7791         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7792                 /lib/syscalls.exp >>libc.list
7793     fi
7794     ;;
7795 esac
7796 ;;
7797 esac
7798 $rm -f libnames libpath
7799
7800 : see if dld is available
7801 set dld.h i_dld
7802 eval $inhdr
7803
7804 : Check if we are using C++
7805 echo " "
7806 echo "Checking for C++..." >&4
7807 $cat >try.c <<'EOCP'
7808 #include <stdio.h>
7809 int main(void)
7810 {
7811 #ifdef __cplusplus
7812     return 0;
7813 #else
7814     return 1;
7815 #endif
7816 }
7817 EOCP
7818 set try
7819 if eval $compile_ok && $run ./try; then
7820         val="$define"
7821         echo "You are using a C++ compiler."
7822 else
7823         val="$undef"
7824         echo "You are not using a C++ compiler."
7825 fi
7826 $rm_try cplusplus$$
7827 set d_cplusplus
7828 eval $setvar
7829
7830 : is a C symbol defined?
7831 csym='tlook=$1;
7832 case "$3" in
7833 -v) tf=libc.tmp; tdc="";;
7834 -a) tf=libc.tmp; tdc="[]";;
7835 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7836 esac;
7837 case "$d_cplusplus" in
7838     $define)    extern_C="extern \"C\"" ;;
7839     *)          extern_C="extern"       ;;
7840 esac;
7841 tx=yes;
7842 case "$reuseval-$4" in
7843 true-) ;;
7844 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7845 esac;
7846 case "$tx" in
7847 yes)
7848         tval=false;
7849         if $test "$runnm" = true; then
7850                 if $contains $tlook $tf >/dev/null 2>&1; then
7851                         tval=true;
7852                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7853                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7854                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7855                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7856                         $rm_try;
7857                 fi;
7858         else
7859                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7860                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7861                 $rm_try;
7862         fi;
7863         ;;
7864 *)
7865         case "$tval" in
7866         $define) tval=true;;
7867         *) tval=false;;
7868         esac;
7869         ;;
7870 esac;
7871 eval "$2=$tval"'
7872
7873 : define an is-in-libc? function
7874 inlibc='echo " "; td=$define; tu=$undef;
7875 sym=$1; var=$2; eval "was=\$$2";
7876 tx=yes;
7877 case "$reuseval$was" in
7878 true) ;;
7879 true*) tx=no;;
7880 esac;
7881 case "$tx" in
7882 yes)
7883         set $sym tres -f;
7884         eval $csym;
7885         case "$tres" in
7886         true)
7887                 echo "$sym() found." >&4;
7888                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7889         *)
7890                 echo "$sym() NOT found." >&4;
7891                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7892         esac;;
7893 *)
7894         case "$was" in
7895         $define) echo "$sym() found." >&4;;
7896         *) echo "$sym() NOT found." >&4;;
7897         esac;;
7898 esac'
7899
7900 : see if dlopen exists
7901 xxx_runnm="$runnm"
7902 xxx_ccflags="$ccflags"
7903 runnm=false
7904 : with g++ one needs -shared to get is-in-libc to work for dlopen
7905 case "$gccversion" in
7906 '')     ;;
7907 *)      case "$d_cplusplus" in
7908         "$define") ccflags="$ccflags -shared" ;;
7909         esac
7910         ;;
7911 esac
7912 set dlopen d_dlopen
7913 eval $inlibc
7914 runnm="$xxx_runnm"
7915 ccflags="$xxx_ccflags"
7916
7917 : see if this is a unistd.h system
7918 set unistd.h i_unistd
7919 eval $inhdr
7920
7921 : determine which dynamic loading, if any, to compile in
7922 echo " "
7923 dldir="ext/DynaLoader"
7924 case "$usedl" in
7925 $define|y|true)
7926         dflt='y'
7927         usedl="$define"
7928         ;;
7929 $undef|n|false)
7930         dflt='n'
7931         usedl="$undef"
7932         ;;
7933 *)
7934         dflt='n'
7935         case "$d_dlopen" in
7936             $define) dflt='y' ;;
7937         esac
7938         case "$i_dld" in
7939             $define) dflt='y' ;;
7940         esac
7941         : Does a dl_xxx.xs file exist for this operating system
7942         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7943         ;;
7944 esac
7945 rp="Do you wish to use dynamic loading?"
7946 . ./myread
7947 usedl="$ans"
7948 bin_ELF="$undef"
7949 case "$ans" in
7950 y*) usedl="$define"
7951         case "$dlsrc" in
7952         '')
7953                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7954                         dflt="$dldir/dl_${osname}.xs"
7955                 elif $test "$d_dlopen" = "$define" ; then
7956                         dflt="$dldir/dl_dlopen.xs"
7957                 elif $test "$i_dld" = "$define" ; then
7958                         dflt="$dldir/dl_dld.xs"
7959                 else
7960                         dflt=''
7961                 fi
7962                 ;;
7963         *)      dflt="$dldir/$dlsrc"
7964                 ;;
7965         esac
7966     echo "The following dynamic loading files are available:"
7967         : Can not go over to $dldir because getfile has path hard-coded in.
7968         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7969         rp="Source file to use for dynamic loading"
7970         fn="fne"
7971         gfpth="$src"
7972         . ./getfile
7973         usedl="$define"
7974         : emulate basename
7975         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7976
7977         $cat << EOM
7978
7979 Some systems may require passing special flags to $cc -c to
7980 compile modules that will be used to create a shared library.
7981 To use no flags, say "none".
7982
7983 EOM
7984     case "$cccdlflags" in
7985     '') case "$gccversion" in
7986                 '') case "$osname" in
7987                         hpux)   dflt='+z' ;;
7988                         next)   dflt='none' ;;
7989                         irix*)  dflt='-KPIC' ;;
7990                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7991                         sunos)  dflt='-pic' ;;
7992                         *)      dflt='none' ;;
7993                     esac
7994                         ;;
7995                 *)  case "$osname" in
7996                         darwin) dflt='none' ;;
7997                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7998                         *)      dflt='-fpic' ;;
7999                     esac ;;
8000             esac ;;
8001         ' ') dflt='none' ;;
8002     *)  dflt="$cccdlflags" ;;
8003     esac
8004     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8005     . ./myread
8006     case "$ans" in
8007     none) cccdlflags=' ' ;;
8008     *) cccdlflags="$ans" ;;
8009     esac
8010
8011     cat << EOM
8012
8013 Some systems use ld to create libraries that can be dynamically loaded,
8014 while other systems (such as those using ELF) use $cc.
8015
8016 EOM
8017         case "$ld" in
8018         '')     $cat >try.c <<EOM
8019 /* Test for whether ELF binaries are produced */
8020 #include <fcntl.h>
8021 #$i_stdlib I_STDLIB
8022 #ifdef I_STDLIB
8023 #include <stdlib.h>
8024 #endif
8025 #$i_unistd I_UNISTD
8026 #ifdef I_UNISTD
8027 #include <unistd.h>
8028 #endif
8029 int main() {
8030         char b[4];
8031         int i = open("a.out",O_RDONLY);
8032         if(i == -1)
8033                 exit(1); /* fail */
8034         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8035                 exit(0); /* succeed (yes, it's ELF) */
8036         else
8037                 exit(1); /* fail */
8038 }
8039 EOM
8040                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8041                         cat <<EOM
8042 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8043 EOM
8044                         dflt="$cc"
8045                         bin_ELF="$define"
8046                 else
8047                         echo "I'll use ld to build dynamic libraries."
8048                         dflt='ld'
8049                 fi
8050                 $rm_try
8051                 ;;
8052         *)      dflt="$ld"
8053                 ;;
8054         esac
8055
8056     rp="What command should be used to create dynamic libraries?"
8057     . ./myread
8058         ld="$ans"
8059
8060     cat << EOM
8061
8062 Some systems may require passing special flags to $ld to create a
8063 library that can be dynamically loaded.  If your ld flags include
8064 -L/other/path options to locate libraries outside your loader's normal
8065 search path, you may need to specify those -L options here as well.  To
8066 use no flags, say "none".
8067
8068 EOM
8069     case "$lddlflags" in
8070     '') case "$osname" in
8071                         beos) dflt='-nostart' ;;
8072                         haiku) dflt='-shared' ;;
8073                         hpux) dflt='-b';
8074                               case "$gccversion" in
8075                               '') dflt="$dflt +vnocompatwarnings" ;;
8076                               esac
8077                               ;;
8078                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8079                         next)  dflt='none' ;;
8080                         solaris) dflt='-G' ;;
8081                         sunos) dflt='-assert nodefinitions' ;;
8082                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8083                 *)     dflt='none' ;;
8084                         esac
8085                         ;;
8086     *) dflt="$lddlflags" ;;
8087     esac
8088
8089         : Try to guess additional flags to pick up local libraries.
8090         : Be careful not to append to a plain 'none'
8091         case "$dflt" in
8092         none) dflt='' ;;
8093         esac
8094         for thisflag in $ldflags; do
8095                 case "$thisflag" in
8096                 -L*|-R*|-Wl,-R*)
8097                         case " $dflt " in
8098                         *" $thisflag "*) ;;
8099                         *) dflt="$dflt $thisflag" ;;
8100                         esac
8101                         ;;
8102                 esac
8103         done
8104
8105         case "$dflt" in
8106         ''|' ') dflt='none' ;;
8107         esac
8108
8109         case "$ldflags" in
8110         *-fstack-protector*)
8111             case "$dflt" in
8112                         *-fstack-protector*) ;; # Don't add it again
8113                         *) dflt="$dflt -fstack-protector" ;; 
8114                 esac
8115                 ;;
8116         esac
8117
8118
8119     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8120     . ./myread
8121     case "$ans" in
8122     none) lddlflags=' ' ;;
8123     *) lddlflags="$ans" ;;
8124     esac
8125
8126         cat <<EOM
8127
8128 Some systems may require passing special flags to $cc to indicate that
8129 the resulting executable will use dynamic linking.  To use no flags,
8130 say "none".
8131
8132 EOM
8133     case "$ccdlflags" in
8134     '') case "$osname" in
8135             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8136             next|sunos) dflt='none' ;;
8137             *)          dflt='none' ;;
8138             esac ;;
8139     ' ')  dflt='none' ;;
8140     *)  dflt="$ccdlflags" ;;
8141     esac
8142     rp="Any special flags to pass to $cc to use dynamic linking?"
8143     . ./myread
8144     case "$ans" in
8145     none) ccdlflags=' ' ;;
8146     *) ccdlflags="$ans" ;;
8147     esac
8148     ;;
8149 *)  usedl="$undef"
8150         ld='ld'
8151     dlsrc='dl_none.xs'
8152     lddlflags=''
8153     ccdlflags=''
8154     ;;
8155 esac
8156
8157 : Do we want a shared libperl?
8158 also=''
8159 case "$usedl" in
8160 $undef)
8161         # No dynamic loading being used, so don't bother even to prompt.
8162         useshrplib='false'
8163         ;;
8164 *)      case "$useshrplib" in
8165         '')     case "$osname" in
8166                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8167                         dflt=y
8168                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8169                         ;;
8170                 next*)
8171                         case "$osvers" in
8172                         4*)     dflt=y
8173                                 also='Building a shared libperl is needed for MAB support.'
8174                                 ;;
8175                         *)      dflt=n
8176                                 ;;
8177                         esac
8178                         ;;
8179                 *)      dflt=n
8180                         ;;
8181                 esac
8182                 ;;
8183         $define|true|[Yy]*)
8184                 dflt=y
8185                 ;;
8186         *)      dflt=n
8187                 ;;
8188         esac
8189         $cat << EOM
8190
8191 The perl executable is normally obtained by linking perlmain.c with
8192 libperl${_a}, any static extensions (usually just DynaLoader), and
8193 any other libraries needed on this system (such as -lm, etc.).  Since
8194 your system supports dynamic loading, it is probably possible to build
8195 a shared libperl.$so.  If you will have more than one executable linked
8196 to libperl.$so, this will significantly reduce the size of each
8197 executable, but it may have a noticeable effect on performance.  The
8198 default is probably sensible for your system.
8199 $also
8200
8201 EOM
8202         rp="Build a shared libperl.$so (y/n)"
8203         . ./myread
8204         case "$ans" in
8205         true|$define|[Yy]*)
8206                 useshrplib='true'  ;;
8207         *)      useshrplib='false' ;;
8208         esac
8209         ;;
8210 esac
8211
8212 case "$useshrplib" in
8213 true)
8214         case "$userelocatableinc" in
8215         true|define)
8216                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8217                 echo "See INSTALL for an explanation why that won't work." >&4
8218                 exit 4
8219                 ;;
8220         esac
8221         case "$libperl" in
8222         '')
8223                 # Figure out a good name for libperl.so.  Since it gets stored in
8224                 # a version-specific architecture-dependent library, the version
8225                 # number isn't really that important, except for making cc/ld happy.
8226                 #
8227                 # A name such as libperl.so.10.1
8228                 majmin="libperl.$so.$patchlevel.$subversion"
8229                 # A name such as libperl.so.100
8230                 majonly=`echo $patchlevel $subversion |
8231                         $awk '{printf "%d%02d", $1, $2}'`
8232                 majonly=libperl.$so.$majonly
8233                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8234                 # rely on figuring it out from the naming of libc.
8235                 case "${osname}${osvers}" in
8236                 next4*)
8237                         dflt=libperl.5.$so
8238                         # XXX How handle the --version stuff for MAB?
8239                         ;;
8240                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8241                         dflt=libperl.$so
8242                         ;;
8243                 cygwin*) # ld links now against the dll directly
8244                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8245                         majonly=`echo $patchlevel $subversion |
8246                                 $awk '{printf "%03d%03d", $1, $2}'`
8247                         majonly=cygperl5.$majonly.$so
8248                         dflt=$majmin
8249                         ;;
8250                 *)      # Try to guess based on whether libc has major.minor.
8251                         case "$libc" in
8252                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8253                         *libc.$so.[0-9]*) dflt=$majonly ;;
8254                         *)      dflt=libperl.$so ;;
8255                         esac
8256                         ;;
8257                 esac
8258                 ;;
8259         *)      dflt=$libperl
8260                 ;;
8261         esac
8262         cat << EOM
8263
8264 I need to select a good name for the shared libperl.  If your system uses
8265 library names with major and minor numbers, then you might want something
8266 like $majmin.  Alternatively, if your system uses a single version
8267 number for shared libraries, then you might want to use $majonly.
8268 Or, your system might be quite happy with a simple libperl.$so.
8269
8270 Since the shared libperl will get installed into a version-specific
8271 architecture-dependent directory, the version number of the shared perl
8272 library probably isn't important, so the default should be o.k.
8273
8274 EOM
8275         rp='What name do you want to give to the shared libperl?'
8276         . ./myread
8277         libperl=$ans
8278         echo "Ok, I'll use $libperl"
8279         ;;
8280 *)
8281         libperl="libperl${_a}"
8282         ;;
8283 esac
8284
8285 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8286 case "$shrpdir" in
8287 '') ;;
8288 *)      $cat >&4 <<EOM
8289 WARNING:  Use of the shrpdir variable for the installation location of
8290 the shared $libperl is not supported.  It was never documented and
8291 will not work in this version.  Let me (perlbug@perl.org)
8292 know of any problems this may cause.
8293
8294 EOM
8295         case "$shrpdir" in
8296         "$archlibexp/CORE")
8297                 $cat >&4 <<EOM
8298 But your current setting of $shrpdir is
8299 the default anyway, so it's harmless.
8300 EOM
8301                 ;;
8302         *)
8303                 $cat >&4 <<EOM
8304 Further, your current attempted setting of $shrpdir
8305 conflicts with the value of $archlibexp/CORE
8306 that installperl will use.
8307 EOM
8308                 ;;
8309         esac
8310         ;;
8311 esac
8312
8313 # How will the perl executable find the installed shared $libperl?
8314 # Add $xxx to ccdlflags.
8315 # If we can't figure out a command-line option, use $shrpenv to
8316 # set env LD_RUN_PATH.  The main perl makefile uses this.
8317 shrpdir=$archlibexp/CORE
8318 xxx=''
8319 tmp_shrpenv=''
8320 if "$useshrplib"; then
8321     case "$osname" in
8322         aix)
8323                 # We'll set it in Makefile.SH...
8324                 ;;
8325         solaris)
8326                 xxx="-R $shrpdir"
8327                 ;;
8328         freebsd|netbsd|openbsd|interix|dragonfly)
8329                 xxx="-Wl,-R$shrpdir"
8330                 ;;
8331         bsdos|linux|irix*|dec_osf|gnu*)
8332                 xxx="-Wl,-rpath,$shrpdir"
8333                 ;;
8334         next)
8335                 # next doesn't like the default...
8336                 ;;
8337         beos)
8338                 # beos doesn't like the default, either.
8339                 ;;
8340         haiku)
8341                 # Haiku doesn't like the default, either.
8342                 ;;
8343         hpux*)
8344                 # hpux doesn't like the default, either.
8345                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8346                 ;;
8347         cygwin)
8348                 # cygwin needs only ldlibpth
8349                 ;;
8350         *)
8351                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8352                 ;;
8353         esac
8354         case "$xxx" in
8355         '') ;;
8356         *)
8357                 # Only add $xxx if it isn't already in ccdlflags.
8358                 case " $ccdlflags " in
8359                 *" $xxx "*)     ;;
8360                 *)      ccdlflags="$ccdlflags $xxx"
8361                         cat <<EOM >&4
8362
8363 Adding $xxx to the flags
8364 passed to $ld so that the perl executable will find the
8365 installed shared $libperl.
8366
8367 EOM
8368                         ;;
8369                 esac
8370                 ;;
8371         esac
8372 fi
8373 # Fix ccdlflags in AIX for building external extensions.
8374 # (For building Perl itself bare -bE:perl.exp is needed,
8375 #  Makefile.SH takes care of this.)
8376 case "$osname" in
8377 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8378 esac
8379 # Respect a hint or command-line value.
8380 case "$shrpenv" in
8381 '') shrpenv="$tmp_shrpenv" ;;
8382 esac
8383 case "$ldlibpthname" in
8384 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8385 none)   ldlibpthname='' ;;
8386 esac
8387
8388 : determine where manual pages are on this system
8389 echo " "
8390 case "$sysman" in
8391 '') 
8392         syspath='/usr/share/man/man1 /usr/man/man1'
8393         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8394         syspath="$syspath /usr/man/u_man/man1"
8395         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8396         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8397         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8398         sysman=`./loc . /usr/man/man1 $syspath`
8399         ;;
8400 esac
8401 if $test -d "$sysman"; then
8402         echo "System manual is in $sysman." >&4
8403 else
8404         echo "Could not find manual pages in source form." >&4
8405 fi
8406
8407 : determine where manual pages go
8408 set man1dir man1dir none
8409 eval $prefixit
8410 $cat <<EOM
8411
8412 $spackage has manual pages available in source form.
8413 EOM
8414 case "$nroff" in
8415 nroff)
8416         echo "However, you don't have nroff, so they're probably useless to you."
8417         case "$man1dir" in
8418         '') man1dir="none";;
8419         esac;;
8420 esac
8421 echo "If you don't want the manual sources installed, answer 'none'."
8422 case "$man1dir" in
8423 ' ') dflt=none
8424         ;;
8425 '')
8426         lookpath="$prefixexp/share/man/man1"
8427         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8428         lookpath="$lookpath $prefixexp/man/p_man/man1"
8429         lookpath="$lookpath $prefixexp/man/u_man/man1"
8430         lookpath="$lookpath $prefixexp/man/man.1"
8431         case "$sysman" in
8432         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8433         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8434         esac
8435         set dflt
8436         eval $prefixup
8437         ;;
8438 *)  dflt="$man1dir"
8439         ;;
8440 esac
8441 echo " "
8442 fn=dn+~
8443 rp="Where do the main $spackage manual pages (source) go?"
8444 . ./getfile
8445 if $test "X$man1direxp" != "X$ansexp"; then
8446         installman1dir=''
8447 fi
8448 prefixvar=man1dir
8449 . ./setprefixvar
8450
8451 case "$man1dir" in
8452 '')     man1dir=' '
8453         installman1dir='';;
8454 esac
8455
8456 : What suffix to use on installed man pages
8457
8458 case "$man1dir" in
8459 ' ')
8460         man1ext='0'
8461         ;;
8462 *)
8463         rp="What suffix should be used for the main $spackage man pages?"
8464         case "$man1ext" in
8465         '')     case "$man1dir" in
8466                 *1)  dflt=1 ;;
8467                 *1p) dflt=1p ;;
8468                 *1pm) dflt=1pm ;;
8469                 *l) dflt=l;;
8470                 *n) dflt=n;;
8471                 *o) dflt=o;;
8472                 *p) dflt=p;;
8473                 *C) dflt=C;;
8474                 *L) dflt=L;;
8475                 *L1) dflt=L1;;
8476                 *) dflt=1;;
8477                 esac
8478                 ;;
8479         *)      dflt="$man1ext";;
8480         esac
8481         . ./myread
8482         man1ext="$ans"
8483         ;;
8484 esac
8485
8486 : see if we can have long filenames
8487 echo " "
8488 first=123456789abcdef
8489 $rm -f $first
8490 if (echo hi >$first) 2>/dev/null; then
8491         if $test -f 123456789abcde; then
8492                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8493                 val="$undef"
8494         else
8495                 echo 'You can have filenames longer than 14 characters.'>&4
8496                 val="$define"
8497         fi
8498 else
8499         $cat <<'EOM'
8500 You can't have filenames longer than 14 chars.
8501 You can't even think about them!
8502 EOM
8503         val="$undef"
8504 fi
8505 set d_flexfnam
8506 eval $setvar
8507 $rm -rf 123456789abcde*
8508
8509 : determine where library module manual pages go
8510 set man3dir man3dir none
8511 eval $prefixit
8512 $cat <<EOM
8513
8514 $spackage has manual pages for many of the library modules.
8515 EOM
8516
8517 case "$nroff" in
8518 nroff)
8519         $cat <<'EOM'
8520 However, you don't have nroff, so they're probably useless to you.
8521 EOM
8522         case "$man3dir" in
8523         '') man3dir="none";;
8524         esac;;
8525 esac
8526
8527 case "$d_flexfnam" in
8528 undef)
8529         $cat <<'EOM'
8530 However, your system can't handle the long file names like File::Basename.3.
8531 EOM
8532         case "$man3dir" in
8533         '') man3dir="none";;
8534         esac;;
8535 esac
8536
8537 echo "If you don't want the manual sources installed, answer 'none'."
8538 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8539 case "$man3dir" in
8540 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8541         if $test -d "$privlib/man/man3"; then
8542                 cat <<EOM >&4
8543
8544 WARNING:  Previous versions of perl installed man3 pages into
8545 $privlib/man/man3.  This version will suggest a
8546 new default of $dflt.
8547 EOM
8548                 tdflt=$dflt
8549                 dflt='n'
8550                 rp='Do you wish to preserve the old behavior?(y/n)'
8551                 . ./myread
8552                 case "$ans" in
8553                 y*) dflt="$privlib/man/man3" ;;
8554                 *)  dflt=$tdflt ;;
8555                 esac
8556     fi
8557         ;;
8558 *)      dflt="$man3dir" ;;
8559 esac
8560 case "$dflt" in
8561 ' ') dflt=none ;;
8562 esac
8563 echo " "
8564 fn=dn+~
8565 rp="Where do the $package library man pages (source) go?"
8566 . ./getfile
8567 prefixvar=man3dir
8568 . ./setprefixvar
8569
8570 case "$man3dir" in
8571 '')     man3dir=' '
8572         installman3dir='';;
8573 esac
8574
8575 : What suffix to use on installed man pages
8576 case "$man3dir" in
8577 ' ')
8578         man3ext='0'
8579         ;;
8580 *)
8581         rp="What suffix should be used for the $package library man pages?"
8582         case "$man3ext" in
8583         '')     case "$man3dir" in
8584                 *3)  dflt=3 ;;
8585                 *3p) dflt=3p ;;
8586                 *3pm) dflt=3pm ;;
8587                 *l) dflt=l;;
8588                 *n) dflt=n;;
8589                 *o) dflt=o;;
8590                 *p) dflt=p;;
8591                 *C) dflt=C;;
8592                 *L) dflt=L;;
8593                 *L3) dflt=L3;;
8594                 *) dflt=3;;
8595                 esac
8596                 ;;
8597         *)      dflt="$man3ext";;
8598         esac
8599         . ./myread
8600         man3ext="$ans"
8601         ;;
8602 esac
8603
8604 : see if we have to deal with yellow pages, now NIS.
8605 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8606         if $test -f /usr/etc/nibindd; then
8607                 echo " "
8608                 echo "I'm fairly confident you're on a NeXT."
8609                 echo " "
8610                 rp='Do you get the hosts file via NetInfo?'
8611                 dflt=y
8612                 case "$hostcat" in
8613                 nidump*) ;;
8614                 '') ;;
8615                 *) dflt=n;;
8616                 esac
8617                 . ./myread
8618                 case "$ans" in
8619                 y*) hostcat='nidump hosts .';;
8620                 *)      case "$hostcat" in
8621                         nidump*) hostcat='';;
8622                         esac
8623                         ;;
8624                 esac
8625         fi
8626         case "$hostcat" in
8627         nidump*) ;;
8628         *)
8629                 case "$hostcat" in
8630                 *ypcat*) dflt=y;;
8631                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8632                                 dflt=y
8633                         else
8634                                 dflt=n
8635                         fi;;
8636                 *) dflt=n;;
8637                 esac
8638                 echo " "
8639                 rp='Are you getting the hosts file via yellow pages?'
8640                 . ./myread
8641                 case "$ans" in
8642                 y*) hostcat='ypcat hosts';;
8643                 *) hostcat='cat /etc/hosts';;
8644                 esac
8645                 ;;
8646         esac
8647 fi
8648 case "$hostcat" in
8649 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8650 esac
8651 case "$groupcat" in
8652 '') test -f /etc/group && groupcat='cat /etc/group';;
8653 esac
8654 case "$passcat" in
8655 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8656 esac
8657
8658 : now get the host name
8659 echo " "
8660 echo "Figuring out host name..." >&4
8661 case "$myhostname" in
8662 '') cont=true
8663         echo 'Maybe "hostname" will work...'
8664         if tans=`sh -c hostname 2>&1` ; then
8665                 myhostname=$tans
8666                 phostname=hostname
8667                 cont=''
8668         fi
8669         ;;
8670 *) cont='';;
8671 esac
8672 if $test "$cont"; then
8673         if ./xenix; then
8674                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8675                 if tans=`cat /etc/systemid 2>&1` ; then
8676                         myhostname=$tans
8677                         phostname='cat /etc/systemid'
8678                         echo "Whadyaknow.  Xenix always was a bit strange..."
8679                         cont=''
8680                 fi
8681         elif $test -r /etc/systemid; then
8682                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8683         fi
8684 fi
8685 if $test "$cont"; then
8686         echo 'No, maybe "uuname -l" will work...'
8687         if tans=`sh -c 'uuname -l' 2>&1` ; then
8688                 myhostname=$tans
8689                 phostname='uuname -l'
8690         else
8691                 echo 'Strange.  Maybe "uname -n" will work...'
8692                 if tans=`sh -c 'uname -n' 2>&1` ; then
8693                         myhostname=$tans
8694                         phostname='uname -n'
8695                 else
8696                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8697                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8698                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8699                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8700                         else
8701                                 case "$myhostname" in
8702                                 '') echo "Does this machine have an identity crisis or something?"
8703                                         phostname='';;
8704                                 *)
8705                                         echo "Well, you said $myhostname before..."
8706                                         phostname='echo $myhostname';;
8707                                 esac
8708                         fi
8709                 fi
8710         fi
8711 fi
8712 case "$myhostname" in
8713 '') myhostname=noname ;;
8714 esac
8715 : you do not want to know about this
8716 set $myhostname
8717 myhostname=$1
8718
8719 : verify guess
8720 if $test "$myhostname" ; then
8721         dflt=y
8722         rp='Your host name appears to be "'$myhostname'".'" Right?"
8723         . ./myread
8724         case "$ans" in
8725         y*) ;;
8726         *) myhostname='';;
8727         esac
8728 fi
8729
8730 : bad guess or no guess
8731 while $test "X$myhostname" = X ; do
8732         dflt=''
8733         rp="Please type the (one word) name of your host:"
8734         . ./myread
8735         myhostname="$ans"
8736 done
8737
8738 : translate upper to lower if necessary
8739 case "$myhostname" in
8740 *[A-Z]*)
8741         echo "(Normalizing case in your host name)"
8742         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8743         ;;
8744 esac
8745
8746 case "$myhostname" in
8747 *.*)
8748         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8749         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8750         echo "(Trimming domain name from host name--host name is now $myhostname)"
8751         ;;
8752 *) case "$mydomain" in
8753         '')
8754                 {
8755                         test "X$hostcat" = "Xypcat hosts" &&
8756                         ypmatch "$myhostname" hosts 2>/dev/null |\
8757                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8758                         $test -s hosts
8759                 } || {
8760                         test "X$hostcat" != "X" &&
8761                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8762                                         /[       ]$myhostname[  . ]/p" > hosts
8763                 }
8764                 tmp_re="[       . ]"
8765                 if $test -f hosts; then
8766                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8767                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8768                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8769                                 hosts | $sort | $uniq | \
8770                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8771                         case `$echo X$dflt` in
8772                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8773                                 dflt=.
8774                                 ;;
8775                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8776                                 ;;
8777                         esac
8778                 else
8779                         echo "(I cannot locate a hosts database anywhere)"
8780                         dflt=.
8781                 fi
8782                 case "$dflt" in
8783                 .)
8784                         tans=`./loc resolv.conf X /etc /usr/etc`
8785                         if $test -f "$tans"; then
8786                                 echo "(Attempting domain name extraction from $tans)"
8787                                 dflt=.`$sed -n -e 's/   / /g' \
8788                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8789                                   -e 1q 2>/dev/null`
8790                                 case "$dflt" in
8791                                 .) dflt=.`$sed -n -e 's/        / /g' \
8792                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8793                                      -e 1q 2>/dev/null`
8794                                         ;;
8795                                 esac
8796                         fi
8797                         ;;
8798                 esac
8799                 case "$dflt" in
8800                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8801                         dflt=.`sh -c domainname 2>/dev/null`
8802                         case "$dflt" in
8803                         '') dflt='.';;
8804                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8805                         esac
8806                         ;;
8807                 esac
8808                 case "$dflt$osname" in
8809                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8810                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8811                         ;;
8812                 esac
8813                 case "$dflt" in
8814                 .) echo "(Lost all hope -- silly guess then)"
8815                         dflt='.nonet'
8816                         ;;
8817                 esac
8818                 $rm -f hosts
8819                 ;;
8820         *) dflt="$mydomain";;
8821         esac;;
8822 esac
8823 echo " "
8824 rp="What is your domain name?"
8825 . ./myread
8826 tans="$ans"
8827 case "$ans" in
8828 '') ;;
8829 .*) ;;
8830 *) tans=".$tans";;
8831 esac
8832 mydomain="$tans"
8833
8834 : translate upper to lower if necessary
8835 case "$mydomain" in
8836 *[A-Z]*)
8837         echo "(Normalizing case in your domain name)"
8838         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8839         ;;
8840 esac
8841
8842 : a little sanity check here
8843 case "$phostname" in
8844 '') ;;
8845 *)
8846         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8847         $myhostname$mydomain|$myhostname) ;;
8848         *)
8849                 case "$phostname" in
8850                 sed*)
8851                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8852                         ;;
8853                 *)
8854                         echo "(That doesn't agree with your $phostname command, by the way.)"
8855                         ;;
8856                 esac
8857         ;;
8858         esac
8859         ;;
8860 esac
8861
8862 : determine the e-mail address of the user who is running us
8863 $cat <<EOM
8864
8865 I need to get your e-mail address in Internet format if possible, i.e.
8866 something like user@host.domain. Please answer accurately since I have
8867 no easy means to double check it. The default value provided below
8868 is most probably close to reality but may not be valid from outside
8869 your organization...
8870
8871 EOM
8872 cont=x
8873 while test "$cont"; do
8874         case "$cf_email" in
8875         '') dflt="$cf_by@$myhostname$mydomain";;
8876         *) dflt="$cf_email";;
8877         esac
8878         rp='What is your e-mail address?'
8879         . ./myread
8880         cf_email="$ans"
8881         case "$cf_email" in
8882         *@*.*) cont='' ;;
8883         *)
8884                 rp='Address does not look like an Internet one.  Use it anyway?'
8885                 case "$fastread" in
8886                 yes) dflt=y ;;
8887                 *) dflt=n ;;
8888                 esac
8889                 . ./myread
8890                 case "$ans" in
8891                 y*) cont='' ;;
8892                 *) echo " " ;;
8893                 esac
8894                 ;;
8895         esac
8896 done
8897
8898 : Ask e-mail of administrator
8899 $cat <<EOM
8900
8901 If you or somebody else will be maintaining perl at your site, please
8902 fill in the correct e-mail address here so that they may be contacted
8903 if necessary. Currently, the "perlbug" program included with perl
8904 will send mail to this address in addition to perlbug@perl.org. You may
8905 enter "none" for no administrator.
8906
8907 EOM
8908 case "$perladmin" in
8909 '') dflt="$cf_email";;
8910 *) dflt="$perladmin";;
8911 esac
8912 rp='Perl administrator e-mail address'
8913 . ./myread
8914 perladmin="$ans"
8915
8916 : determine whether to only install version-specific parts.
8917 echo " "
8918 $cat <<EOM
8919 Do you want to install only the version-specific parts of the perl
8920 distribution?  Usually you do *not* want to do this.
8921 EOM
8922 case "$versiononly" in
8923 "$define"|[Yy]*|true) dflt='y' ;;
8924 *) dflt='n';
8925 esac
8926 rp="Do you want to install only the version-specific parts of perl?"
8927 . ./myread
8928 case "$ans" in
8929 [yY]*)  val="$define";;
8930 *)      val="$undef" ;;
8931 esac
8932 set versiononly
8933 eval $setvar
8934
8935 case "$versiononly" in
8936 "$define") inc_version_list=''
8937            inc_version_list_init=0
8938            ;;
8939 esac
8940
8941 : figure out how to guarantee perl startup
8942 : XXX Note that this currently takes advantage of the bug that binexp ignores
8943 :     the Configure -Dinstallprefix setting, which in turn means that under
8944 :     relocatable @INC, initialinstalllocation is what binexp started as.
8945 case "$startperl" in
8946 '')
8947         case "$sharpbang" in
8948         *!)
8949                 $cat <<EOH
8950
8951 I can use the #! construct to start perl on your system. This will
8952 make startup of perl scripts faster, but may cause problems if you
8953 want to share those scripts and perl is not in a standard place
8954 ($initialinstalllocation/perl) on all your platforms. The alternative
8955 is to force a shell by starting the script with a single ':' character.
8956
8957 EOH
8958                 case "$versiononly" in
8959                 "$define")      dflt="$initialinstalllocation/perl$version";;
8960                 *)              dflt="$initialinstalllocation/perl";;
8961                 esac
8962                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8963                 . ./myread
8964                 case "$ans" in
8965                 none)   startperl=": # use perl";;
8966                 *)      startperl="#!$ans"
8967                         if $test 30 -lt `echo "$ans" | wc -c`; then
8968                                 $cat >&4 <<EOM
8969
8970 WARNING:  Some systems limit the #! command to 32 characters.
8971 If you experience difficulty running Perl scripts with #!, try
8972 installing Perl in a directory with a shorter pathname.
8973
8974 EOM
8975                         fi ;;
8976                 esac
8977                 ;;
8978         *) startperl=": # use perl"
8979                 ;;
8980         esac
8981         ;;
8982 esac
8983 echo "I'll use $startperl to start perl scripts."
8984
8985 : figure best path for perl in scripts
8986 case "$perlpath" in
8987 '')
8988         case "$versiononly" in
8989         "$define")      perlpath="$initialinstalllocation/perl$version";;
8990         *)              perlpath="$initialinstalllocation/perl";;
8991         esac
8992         case "$startperl" in
8993         *!*) ;;
8994         *)
8995                 $cat <<EOH
8996
8997 I will use the "eval 'exec'" idiom to start Perl on your system.
8998 I can use the full path of your Perl binary for this purpose, but
8999 doing so may cause problems if you want to share those scripts and
9000 Perl is not always in a standard place ($initialinstalllocation/perl).
9001
9002 EOH
9003                 dflt="$initialinstalllocation/perl"
9004                 rp="What path shall I use in \"eval 'exec'\"?"
9005                 . ./myread
9006                 perlpath="$ans"
9007                 ;;
9008         esac
9009         ;;
9010 esac
9011 case "$startperl" in
9012 *!*)    ;;
9013 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9014 esac
9015
9016 : determine where public executable scripts go
9017 set scriptdir scriptdir
9018 eval $prefixit
9019 case "$scriptdir" in
9020 '')
9021         dflt="$bin"
9022         : guess some guesses
9023         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9024         $test -d /usr/share/bin     && dflt=/usr/share/bin
9025         $test -d /usr/local/script  && dflt=/usr/local/script
9026         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9027         $test -d $prefixexp/script  && dflt=$prefixexp/script
9028         set dflt
9029         eval $prefixup
9030         ;;
9031 *)  dflt="$scriptdir"
9032         ;;
9033 esac
9034 $cat <<EOM
9035
9036 Some installations have a separate directory just for executable scripts so
9037 that they can mount it across multiple architectures but keep the scripts in
9038 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9039 Or you might just lump your scripts in with all your other executables.
9040
9041 EOM
9042 fn=d~
9043 rp='Where do you keep publicly executable scripts?'
9044 . ./getfile
9045 if $test "X$ansexp" != "X$scriptdirexp"; then
9046         installscript=''
9047 fi
9048 installscriptdir=''
9049 prefixvar=scriptdir
9050 . ./setprefixvar
9051 : A little fix up for an irregularly named variable.
9052 installscript="$installscriptdir"
9053
9054 : determine where add-on public executables go
9055 case "$sitebin" in
9056 '')     dflt=$siteprefix/bin ;;
9057 *)      dflt=$sitebin ;;
9058 esac
9059 fn=d~
9060 rp='Pathname where the add-on public executables should be installed?'
9061 . ./getfile
9062 prefixvar=sitebin
9063 . ./setprefixvar
9064
9065 : determine where add-on html pages go
9066 : There is no standard location, so try to copy the previously-selected
9067 : directory structure for the core html pages.
9068 case "$sitehtml1dir" in
9069 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9070 *)     dflt=$sitehtml1dir ;;
9071 esac
9072 case "$dflt" in
9073 ''|' ') dflt=none ;;
9074 esac
9075 fn=dn+~
9076 rp='Pathname where the site-specific html pages should be installed?'
9077 . ./getfile
9078 prefixvar=sitehtml1dir
9079 . ./setprefixvar
9080
9081 : determine where add-on library html pages go
9082 : There is no standard location, so try to copy the previously-selected
9083 : directory structure for the core html pages.
9084 case "$sitehtml3dir" in
9085 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9086 *)     dflt=$sitehtml3dir ;;
9087 esac
9088 case "$dflt" in
9089 ''|' ') dflt=none ;;
9090 esac
9091 fn=dn+~
9092 rp='Pathname where the site-specific library html pages should be installed?'
9093 . ./getfile
9094 prefixvar=sitehtml3dir
9095 . ./setprefixvar
9096
9097 : determine where add-on manual pages go
9098 case "$siteman1dir" in
9099 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9100 *)      dflt=$siteman1dir ;;
9101 esac
9102 case "$dflt" in
9103 ''|' ') dflt=none ;;
9104 esac
9105 fn=dn+~
9106 rp='Pathname where the site-specific manual pages should be installed?'
9107 . ./getfile
9108 prefixvar=siteman1dir
9109 . ./setprefixvar
9110
9111 : determine where add-on library man pages go
9112 case "$siteman3dir" in
9113 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9114 *)      dflt=$siteman3dir ;;
9115 esac
9116 case "$dflt" in
9117 ''|' ') dflt=none ;;
9118 esac
9119 fn=dn+~
9120 rp='Pathname where the site-specific library manual pages should be installed?'
9121 . ./getfile
9122 prefixvar=siteman3dir
9123 . ./setprefixvar
9124
9125 : determine where add-on public executable scripts go
9126 case "$sitescript" in
9127 '')     dflt=$siteprefix/script
9128         $test -d $dflt || dflt=$sitebin ;;
9129 *)  dflt="$sitescript" ;;
9130 esac
9131 fn=d~+
9132 rp='Pathname where add-on public executable scripts should be installed?'
9133 . ./getfile
9134 prefixvar=sitescript
9135 . ./setprefixvar
9136
9137 : Check if faststdio is requested and available
9138 case "$usefaststdio" in
9139 $define|true|[yY]*|'')
9140         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9141         case "$xversion" in
9142         [68])   dflt='y' ;;
9143         *)      dflt='n' ;;
9144         esac
9145         ;;
9146 *) dflt='n';;
9147 esac
9148 cat <<EOM
9149
9150 Perl can be built to use 'fast stdio', which means using the stdio
9151 library but also directly manipulating the stdio buffers to enable
9152 faster I/O.  Using stdio is better for backward compatibility (especially
9153 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9154 interface has been preferred instead of stdio.
9155
9156 If this doesn't make any sense to you, just accept the default '$dflt'.
9157 EOM
9158 rp='Use the "fast stdio" if available?'
9159 . ./myread
9160 case "$ans" in
9161 y|Y)    val="$define" ;;
9162 *)      val="$undef" ;;
9163 esac
9164 set usefaststdio
9165 eval $setvar
9166
9167
9168 : define an is-a-typedef? function
9169 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9170 case "$inclist" in
9171 "") inclist="sys/types.h";;
9172 esac;
9173 eval "varval=\$$var";
9174 case "$varval" in
9175 "")
9176         $rm -f temp.c;
9177         for inc in $inclist; do
9178                 echo "#include <$inc>" >>temp.c;
9179         done;
9180         echo "#ifdef $type" >> temp.c;
9181         echo "printf(\"We have $type\");" >> temp.c;
9182         echo "#endif" >> temp.c;
9183         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9184         if $contains $type temp.E >/dev/null 2>&1; then
9185                 eval "$var=\$type";
9186         else
9187                 eval "$var=\$def";
9188         fi;
9189         $rm -f temp.?;;
9190 *) eval "$var=\$varval";;
9191 esac'
9192
9193 : define an is-a-typedef? function that prompts if the type is not available.
9194 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9195 case "$inclist" in
9196 "") inclist="sys/types.h";;
9197 esac;
9198 eval "varval=\$$var";
9199 case "$varval" in
9200 "")
9201         $rm -f temp.c;
9202         for inc in $inclist; do
9203                 echo "#include <$inc>" >>temp.c;
9204         done;
9205         echo "#ifdef $type" >> temp.c;
9206         echo "printf(\"We have $type\");" >> temp.c;
9207         echo "#endif" >> temp.c;
9208         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9209         echo " " ;
9210         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9211         if $contains $type temp.E >/dev/null 2>&1; then
9212                 echo "$type found." >&4;
9213                 eval "$var=\$type";
9214         else
9215                 echo "$type NOT found." >&4;
9216                 dflt="$def";
9217                 . ./myread ;
9218                 eval "$var=\$ans";
9219         fi;
9220         $rm -f temp.?;;
9221 *) eval "$var=\$varval";;
9222 esac'
9223
9224 : see what type lseek is declared as in the kernel
9225 rp="What is the type used for lseek's offset on this system?"
9226 set off_t lseektype long stdio.h sys/types.h
9227 eval $typedef_ask
9228
9229 echo " "
9230 echo "Checking to see how big your file offsets are..." >&4
9231 $cat >try.c <<EOCP
9232 #include <sys/types.h>
9233 #include <stdio.h>
9234 int main()
9235 {
9236     printf("%d\n", (int)sizeof($lseektype));
9237     return(0);
9238 }
9239 EOCP
9240 set try
9241 if eval $compile_ok; then
9242         lseeksize=`$run ./try`
9243         echo "Your file offsets are $lseeksize bytes long."
9244 else
9245         dflt=$longsize
9246         echo " "
9247         echo "(I can't seem to compile the test program.  Guessing...)"
9248         rp="What is the size of your file offsets (in bytes)?"
9249         . ./myread
9250         lseeksize="$ans"
9251 fi
9252 $rm_try
9253
9254 : see what type file positions are declared as in the library
9255 rp="What is the type for file position used by fsetpos()?"
9256 set fpos_t fpostype long stdio.h sys/types.h
9257 eval $typedef_ask
9258
9259 : Check size for Fpos_t
9260 echo " "
9261 case "$fpostype" in
9262 *_t) zzz="$fpostype"    ;;
9263 *)   zzz="fpos_t"       ;;
9264 esac
9265 echo "Checking the size of $zzz..." >&4
9266 cat > try.c <<EOCP
9267 #include <sys/types.h>
9268 #include <stdio.h>
9269 #$i_stdlib I_STDLIB
9270 #ifdef I_STDLIB
9271 #include <stdlib.h>
9272 #endif
9273 int main() {
9274     printf("%d\n", (int)sizeof($fpostype));
9275     exit(0);
9276 }
9277 EOCP
9278 set try
9279 if eval $compile_ok; then
9280         yyy=`$run ./try`
9281         case "$yyy" in
9282         '')     fpossize=4
9283                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9284                 ;;
9285         *)      fpossize=$yyy
9286                 echo "Your $zzz is $fpossize bytes long."
9287                 ;;
9288         esac
9289 else
9290         dflt="$longsize"
9291         echo " " >&4
9292         echo "(I can't compile the test program.  Guessing...)" >&4
9293         rp="What is the size of your file positions (in bytes)?"
9294         . ./myread
9295         fpossize="$ans"
9296 fi
9297
9298 : Check for large file support
9299 # Backward compatibility (uselfs is deprecated).
9300 case "$uselfs" in
9301 "$define"|true|[yY]*)
9302         cat <<EOM >&4
9303
9304 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9305 EOM
9306         uselargefiles="$define"
9307         ;;
9308 esac
9309
9310 case "$lseeksize:$fpossize" in
9311 8:8) cat <<EOM
9312
9313 You can have files larger than 2 gigabytes.
9314 EOM
9315    val="$define" ;;
9316 *)    case "$uselargefiles" in
9317    "$undef"|false|[nN]*) dflt='n' ;;
9318    *)   dflt='y' ;;
9319    esac
9320    cat <<EOM
9321
9322 Perl can be built to understand large files (files larger than 2 gigabytes)
9323 on some systems.  To do so, Configure can be run with -Duselargefiles.
9324
9325 If this doesn't make any sense to you, just accept the default '$dflt'.
9326 EOM
9327    rp='Try to understand large files, if available?'
9328    . ./myread
9329    case "$ans" in
9330    y|Y)         val="$define" ;;
9331    *)           val="$undef"  ;;
9332    esac
9333    ;;
9334 esac
9335 set uselargefiles
9336 eval $setvar
9337 : Look for a hint-file generated 'call-back-unit'.  If the
9338 : user has specified that a large files perl is to be built,
9339 : we may need to set or change some other defaults.
9340 if $test -f uselargefiles.cbu; then
9341         echo "Your platform has some specific hints regarding large file builds, using them..."
9342         . ./uselargefiles.cbu
9343 fi
9344 case "$uselargefiles" in
9345 "$define")
9346         if $test -f uselargefiles.cbu; then
9347                 echo " "
9348                 echo "Rechecking to see how big your file offsets are..." >&4
9349                 $cat >try.c <<EOCP
9350 #include <sys/types.h>
9351 #include <stdio.h>
9352 int main()
9353 {
9354     printf("%d\n", (int)sizeof($lseektype));
9355     return(0);
9356 }
9357 EOCP
9358                 set try
9359                 if eval $compile_ok; then
9360                         lseeksize=`$run ./try`
9361                         $echo "Your file offsets are now $lseeksize bytes long."
9362                 else
9363                         dflt="$lseeksize"
9364                         echo " "
9365                         echo "(I can't seem to compile the test program.  Guessing...)"
9366                         rp="What is the size of your file offsets (in bytes)?"
9367                         . ./myread
9368                         lseeksize="$ans"
9369                 fi
9370                 case "$fpostype" in
9371                 *_t) zzz="$fpostype"    ;;
9372                 *)   zzz="fpos_t"       ;;
9373                 esac
9374                 $echo $n "Rechecking the size of $zzz...$c" >&4
9375                 $cat > try.c <<EOCP
9376 #include <sys/types.h>
9377 #include <stdio.h>
9378 #$i_stdlib I_STDLIB
9379 #ifdef I_STDLIB
9380 #include <stdlib.h>
9381 #endif
9382 int main() {
9383     printf("%d\n", (int)sizeof($fpostype));
9384     return(0);
9385 }
9386 EOCP
9387                 set try
9388                 if eval $compile_ok; then
9389                         yyy=`$run ./try`
9390                         dflt="$lseeksize"
9391                         case "$yyy" in
9392                         '')     echo " "
9393                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9394                                 ;;
9395                         *)      fpossize=$yyy
9396                                 echo " $fpossize bytes." >&4
9397                                 ;;
9398                         esac
9399                 else
9400                         dflt="$fpossize"
9401                         echo " "
9402                         echo "(I can't compile the test program.  Guessing...)" >&4
9403                         rp="What is the size of your file positions (in bytes)?"
9404                         . ./myread
9405                         fpossize="$ans"
9406                 fi
9407                 $rm_try
9408         fi
9409         ;;
9410 esac
9411
9412 : Set the vendorbin variables
9413 case "$vendorprefix" in
9414 '')     d_vendorbin="$undef"
9415         vendorbin=''
9416         vendorbinexp=''
9417         ;;
9418 *)      d_vendorbin="$define"
9419         : determine where vendor-supplied executables go.
9420         case "$vendorbin" in
9421         '') dflt=$vendorprefix/bin ;;
9422         *)      dflt="$vendorbin" ;;
9423         esac
9424         fn=d~+
9425         rp='Pathname for the vendor-supplied executables directory?'
9426         . ./getfile
9427         vendorbin="$ans"
9428         vendorbinexp="$ansexp"
9429         ;;
9430 esac
9431 prefixvar=vendorbin
9432 . ./installprefix
9433
9434 : Set the vendorhtml1dir variables
9435 case "$vendorprefix" in
9436 '')     vendorhtml1dir=''
9437         vendorhtml1direxp=''
9438         ;;
9439 *)      : determine where vendor-supplied html pages go.
9440         : There is no standard location, so try to copy the previously-selected
9441         : directory structure for the core html pages.
9442         : XXX Better default suggestions would be welcome.
9443         case "$vendorhtml1dir" in
9444         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9445         *)      dflt=$vendorhtml1dir ;;
9446         esac
9447         case "$dflt" in
9448         ''|' ') dflt=none ;;
9449         esac
9450         fn=dn+~
9451         rp='Pathname for the vendor-supplied html pages?'
9452         . ./getfile
9453         vendorhtml1dir="$ans"
9454         vendorhtml1direxp="$ansexp"
9455         ;;
9456 esac
9457 : Use ' ' for none so value is preserved next time through Configure
9458 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9459 prefixvar=vendorhtml1dir
9460 . ./installprefix
9461
9462 : Set the vendorhtml3dir variables
9463 case "$vendorprefix" in
9464 '')     vendorhtml3dir=''
9465         vendorhtml3direxp=''
9466         ;;
9467 *)      : determine where vendor-supplied module html pages go.
9468         : There is no standard location, so try to copy the previously-selected
9469         : directory structure for the core html pages.
9470         : XXX Better default suggestions would be welcome.
9471         case "$vendorhtml3dir" in
9472         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9473         *)      dflt=$vendorhtml3dir ;;
9474         esac
9475         case "$dflt" in
9476         ''|' ') dflt=none ;;
9477         esac
9478         fn=dn+~
9479         rp='Pathname for the vendor-supplied html pages?'
9480         . ./getfile
9481         vendorhtml3dir="$ans"
9482         vendorhtml3direxp="$ansexp"
9483         ;;
9484 esac
9485 : Use ' ' for none so value is preserved next time through Configure
9486 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9487 prefixvar=vendorhtml3dir
9488 . ./installprefix
9489
9490 : Set the vendorman1dir variables
9491 case "$vendorprefix" in
9492 '')     vendorman1dir=''
9493         vendorman1direxp=''
9494         ;;
9495 *)      : determine where vendor-supplied manual pages go.
9496         case "$vendorman1dir" in
9497         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9498         *)      dflt=$vendorman1dir ;;
9499         esac
9500         case "$dflt" in
9501         ''|' ') dflt=none ;;
9502         esac
9503         fn=nd~+
9504         rp='Pathname for the vendor-supplied manual section 1 pages?'
9505         . ./getfile
9506         vendorman1dir="$ans"
9507         vendorman1direxp="$ansexp"
9508         ;;
9509 esac
9510 : Use ' ' for none so value is preserved next time through Configure
9511 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9512 prefixvar=vendorman1dir
9513 . ./installprefix
9514
9515 : Set the vendorman3dir variables
9516 case "$vendorprefix" in
9517 '')     vendorman3dir=''
9518         vendorman3direxp=''
9519         ;;
9520 *)      : determine where vendor-supplied module manual pages go.
9521         case "$vendorman3dir" in
9522         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9523         *)      dflt=$vendorman3dir ;;
9524         esac
9525         case "$dflt" in
9526         ''|' ') dflt=none ;;
9527         esac
9528         fn=nd~+
9529         rp='Pathname for the vendor-supplied manual section 3 pages?'
9530         . ./getfile
9531         vendorman3dir="$ans"
9532         vendorman3direxp="$ansexp"
9533         ;;
9534 esac
9535 : Use ' ' for none so value is preserved next time through Configure
9536 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9537 prefixvar=vendorman3dir
9538 . ./installprefix
9539
9540 : Set the vendorscript variables
9541 case "$vendorprefix" in
9542 '')     d_vendorscript="$undef"
9543         vendorscript=''
9544         vendorscriptexp=''
9545         ;;
9546 *)      d_vendorscript="$define"
9547         : determine where vendor-supplied scripts go.
9548         case "$vendorscript" in
9549         '')     dflt=$vendorprefix/script
9550                 $test -d $dflt || dflt=$vendorbin ;;
9551         *)  dflt="$vendorscript" ;;
9552         esac
9553         $cat <<EOM
9554
9555 The installation process will create a directory for
9556 vendor-supplied scripts.
9557
9558 EOM
9559         fn=d~+
9560         rp='Pathname for the vendor-supplied scripts directory?'
9561         . ./getfile
9562         vendorscript="$ans"
9563         vendorscriptexp="$ansexp"
9564         ;;
9565 esac
9566 prefixvar=vendorscript
9567 . ./installprefix
9568
9569 : script used to emit important warnings
9570 cat >warn <<EOS
9571 $startsh
9572 if test \$# -gt 0; then
9573         echo "\$@" >msg
9574 else
9575         cat >msg
9576 fi
9577 echo "*** WARNING:" >&4
9578 sed -e 's/^/*** /' <msg >&4
9579 echo "*** " >&4
9580 cat msg >>config.msg
9581 echo " " >>config.msg
9582 rm -f msg
9583 EOS
9584 chmod +x warn
9585 $eunicefix warn
9586
9587 : see which of string.h or strings.h is needed
9588 echo " "
9589 strings=`./findhdr string.h`
9590 if $test "$strings" && $test -r "$strings"; then
9591         echo "Using <string.h> instead of <strings.h>." >&4
9592         val="$define"
9593 else
9594         val="$undef"
9595         strings=`./findhdr strings.h`
9596         if $test "$strings" && $test -r "$strings"; then
9597                 echo "Using <strings.h> instead of <string.h>." >&4
9598         else
9599                 ./warn "No string header found -- You'll surely have problems."
9600         fi
9601 fi
9602 set i_string
9603 eval $setvar
9604 case "$i_string" in
9605 "$undef") strings=`./findhdr strings.h`;;
9606 *)        strings=`./findhdr string.h`;;
9607 esac
9608
9609 : see if qgcvt exists
9610 set qgcvt d_qgcvt
9611 eval $inlibc
9612
9613 : Check print/scan long double stuff
9614 echo " "
9615
9616 if $test X"$d_longdbl" = X"$define"; then
9617
9618 echo "Checking how to print long doubles..." >&4
9619
9620 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9621         $cat >try.c <<'EOCP'
9622 #include <sys/types.h>
9623 #include <stdio.h>
9624 int main() {
9625   double d = 123.456;
9626   printf("%.3f\n", d);
9627 }
9628 EOCP
9629         set try
9630         if eval $compile; then
9631                 yyy=`$run ./try`
9632                 case "$yyy" in
9633                 123.456)
9634                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9635                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9636                         echo "We will use %f."
9637                         ;;
9638                 esac
9639         fi
9640 fi
9641
9642 if $test X"$sPRIfldbl" = X; then
9643         $cat >try.c <<'EOCP'
9644 #include <sys/types.h>
9645 #include <stdio.h>
9646 int main() {
9647   long double d = 123.456;
9648   printf("%.3Lf\n", d);
9649 }
9650 EOCP
9651         set try
9652         if eval $compile; then
9653                 yyy=`$run ./try`
9654                 case "$yyy" in
9655                 123.456)
9656                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9657                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9658                         echo "We will use %Lf."
9659                         ;;
9660                 esac
9661         fi
9662 fi
9663
9664 if $test X"$sPRIfldbl" = X; then
9665         $cat >try.c <<'EOCP'
9666 #include <sys/types.h>
9667 #include <stdio.h>
9668 int main() {
9669   long double d = 123.456;
9670   printf("%.3llf\n", d);
9671 }
9672 EOCP
9673         set try
9674         if eval $compile; then
9675                 yyy=`$run ./try`
9676                 case "$yyy" in
9677                 123.456)
9678                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9679                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9680                         echo "We will use %llf."
9681                         ;;
9682                 esac
9683         fi
9684 fi
9685
9686 if $test X"$sPRIfldbl" = X; then
9687         $cat >try.c <<'EOCP'
9688 #include <sys/types.h>
9689 #include <stdio.h>
9690 int main() {
9691   long double d = 123.456;
9692   printf("%.3lf\n", d);
9693 }
9694 EOCP
9695         set try
9696         if eval $compile; then
9697                 yyy=`$run ./try`
9698                 case "$yyy" in
9699                 123.456)
9700                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9701                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9702                         echo "We will use %lf."
9703                         ;;
9704                 esac
9705         fi
9706 fi
9707
9708 if $test X"$sPRIfldbl" = X; then
9709         echo "Cannot figure out how to print long doubles." >&4
9710 else
9711         sSCNfldbl=$sPRIfldbl    # expect consistency
9712 fi
9713
9714 $rm_try
9715
9716 fi # d_longdbl
9717
9718 case "$sPRIfldbl" in
9719 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9720         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9721         d_SCNfldbl="$undef";
9722         ;;
9723 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9724         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9725         d_SCNfldbl="$define";
9726         ;;
9727 esac
9728
9729 : Check how to convert floats to strings.
9730
9731 if test "X$d_Gconvert" = X; then
9732
9733 echo " "
9734 echo "Checking for an efficient way to convert floats to strings."
9735 echo " " > try.c
9736 case "$uselongdouble" in
9737 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9738 esac
9739 case "$d_longdbl" in
9740 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9741 esac
9742 case "$d_PRIgldbl" in
9743 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9744 esac
9745 $cat >>try.c <<EOP
9746 #ifdef TRY_gconvert
9747 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9748 char *myname = "gconvert";
9749 #endif
9750 #ifdef TRY_gcvt
9751 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9752 char *myname = "gcvt";
9753 #endif
9754 #ifdef TRY_qgcvt
9755 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9756 char *myname = "qgcvt";
9757 #define DOUBLETYPE long double
9758 #endif
9759 #ifdef TRY_sprintf
9760 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9761 #ifdef HAS_PRIgldbl
9762 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9763 #else
9764 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9765 #endif
9766 #else
9767 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9768 #endif
9769 char *myname = "sprintf";
9770 #endif
9771
9772 #ifndef DOUBLETYPE
9773 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9774 #define DOUBLETYPE long double
9775 #else
9776 #define DOUBLETYPE double
9777 #endif
9778 #endif
9779
9780 #include <stdio.h>
9781
9782 #$i_stdlib I_STDLIB
9783 #ifdef I_STDLIB
9784 #include <stdlib.h>
9785 #endif
9786 #$i_string I_STRING
9787 #ifdef I_STRING
9788 #  include <string.h>
9789 #else
9790 #  include <strings.h>
9791 #endif
9792
9793 int checkit(char *expect, char *got)
9794 {
9795     if (strcmp(expect, got)) {
9796                 printf("%s oddity:  Expected %s, got %s\n",
9797                         myname, expect, got);
9798                 exit(1);
9799         }
9800 }
9801
9802 int main()
9803 {
9804         char buf[64];
9805         buf[63] = '\0';
9806
9807         /* This must be 1st test on (which?) platform */
9808         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9809         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9810         checkit("0.1", buf);
9811
9812         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9813         checkit("0.01", buf);
9814
9815         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9816         checkit("0.001", buf);
9817
9818         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9819         checkit("0.0001", buf);
9820
9821         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9822         if (strlen(buf) > 5)
9823             checkit("9e-005", buf); /* for Microsoft ?? */
9824         else
9825             checkit("9e-05", buf);
9826
9827         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9828         checkit("1", buf);
9829
9830         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9831         checkit("1.1", buf);
9832
9833         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9834         checkit("1.01", buf);
9835
9836         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9837         checkit("1.001", buf);
9838
9839         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9840         checkit("1.0001", buf);
9841
9842         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9843         checkit("1.00001", buf);
9844
9845         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9846         checkit("1.000001", buf);
9847
9848         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9849         checkit("0", buf);
9850
9851         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9852         checkit("-1", buf);
9853
9854         /* Some Linux gcvt's give 1.e+5 here. */
9855         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9856         checkit("100000", buf);
9857
9858         /* Some Linux gcvt's give -1.e+5 here. */
9859         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9860         checkit("-100000", buf);
9861
9862         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9863         checkit("123.456", buf);
9864
9865         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9866         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9867         /* 34 should be enough to scare even long double
9868          * places into using the e notation. */
9869         if (strlen(buf) > 5)
9870             checkit("1e+034", buf); /* for Microsoft */
9871         else
9872             checkit("1e+34", buf);
9873
9874         /* For Perl, if you add additional tests here, also add them to
9875          * t/base/num.t for benefit of platforms not using Configure or
9876          * overriding d_Gconvert */
9877
9878         exit(0);
9879 }
9880 EOP
9881 : first add preferred functions to our list
9882 xxx_list=""
9883 for xxx_convert in $gconvert_preference; do
9884     case $xxx_convert in
9885     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9886     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9887     esac
9888 done
9889 : then add any others
9890 for xxx_convert in gconvert gcvt sprintf; do
9891     case "$xxx_list" in
9892     *$xxx_convert*) ;;
9893     *) xxx_list="$xxx_list $xxx_convert" ;;
9894     esac
9895 done
9896
9897 case "$d_longdbl$uselongdouble" in
9898 "$define$define")
9899     : again, add prefered functions to our list first
9900     xxx_ld_list=""
9901     for xxx_convert in $gconvert_ld_preference; do
9902         case $xxx_convert in
9903         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9904         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9905         esac
9906     done
9907     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9908     for xxx_convert in qgcvt sprintf $xxx_list; do
9909         case "$xxx_ld_list" in
9910         $xxx_convert*|*" $xxx_convert"*) ;;
9911         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9912         esac
9913     done
9914     : if sprintf cannot do long doubles, move it to the end
9915     if test "$d_PRIgldbl" != "$define"; then
9916         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9917     fi
9918     : if no qgcvt, remove it
9919     if test "$d_qgcvt" != "$define"; then
9920         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9921     fi
9922     : use the ld_list
9923     xxx_list="$xxx_ld_list"
9924     ;;
9925 esac
9926
9927 for xxx_convert in $xxx_list; do
9928         echo "Trying $xxx_convert..."
9929         $rm -f try try$_o core
9930         set try -DTRY_$xxx_convert
9931         if eval $compile; then
9932                 echo "$xxx_convert() found." >&4
9933                 if $run ./try; then
9934                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9935                         break;
9936                 else
9937                         echo "...But $xxx_convert didn't work as I expected."
9938                         xxx_convert=''
9939                 fi
9940         else
9941                 echo "$xxx_convert NOT found." >&4
9942         fi
9943 done
9944
9945 if test X$xxx_convert = X; then
9946     echo "*** WHOA THERE!!! ***" >&4
9947     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9948     xxx_convert=sprintf
9949 fi
9950
9951 case "$xxx_convert" in
9952 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9953 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9954 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9955 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9956    "$define$define$define")
9957       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9958    "$define$define$undef")
9959       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9960    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9961    esac
9962    ;;
9963 esac
9964
9965 fi
9966 $rm_try
9967
9968 : see if _fwalk exists
9969 set fwalk d__fwalk
9970 eval $inlibc
9971
9972 : Initialize h_fcntl
9973 h_fcntl=false
9974
9975 : Initialize h_sysfile
9976 h_sysfile=false
9977
9978 : access call always available on UNIX
9979 set access d_access
9980 eval $inlibc
9981
9982 : locate the flags for 'access()'
9983 case "$d_access" in
9984 "$define")
9985         echo " "
9986         $cat >access.c <<EOCP
9987 #include <sys/types.h>
9988 #ifdef I_FCNTL
9989 #include <fcntl.h>
9990 #endif
9991 #ifdef I_SYS_FILE
9992 #include <sys/file.h>
9993 #endif
9994 #ifdef I_UNISTD
9995 #include <unistd.h>
9996 #endif
9997 #$i_stdlib I_STDLIB
9998 #ifdef I_STDLIB
9999 #include <stdlib.h>
10000 #endif
10001 int main() {
10002         exit(R_OK);
10003 }
10004 EOCP
10005         : check sys/file.h first, no particular reason here
10006         if $test `./findhdr sys/file.h` && \
10007                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10008                 h_sysfile=true;
10009                 echo "<sys/file.h> defines the *_OK access constants." >&4
10010         elif $test `./findhdr fcntl.h` && \
10011                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10012                 h_fcntl=true;
10013                 echo "<fcntl.h> defines the *_OK access constants." >&4
10014         elif $test `./findhdr unistd.h` && \
10015                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10016                 echo "<unistd.h> defines the *_OK access constants." >&4
10017         else
10018                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10019         fi
10020         ;;
10021 esac
10022 $rm -f access*
10023
10024 : see if accessx exists
10025 set accessx d_accessx
10026 eval $inlibc
10027
10028 : see if aintl exists
10029 set aintl d_aintl
10030 eval $inlibc
10031
10032 : see if alarm exists
10033 set alarm d_alarm
10034 eval $inlibc
10035
10036 : see if 64bit time functions exists
10037
10038 set ctime64 d_ctime64
10039 eval $inlibc
10040
10041 set localtime64 d_localtime64
10042 eval $inlibc
10043
10044 set gmtime64 d_gmtime64
10045 eval $inlibc
10046
10047 set mktime64 d_mktime64
10048 eval $inlibc
10049
10050 set difftime64 d_difftime64
10051 eval $inlibc
10052
10053 set asctime64 d_asctime64
10054 eval $inlibc
10055
10056 : see if POSIX threads are available
10057 set pthread.h i_pthread
10058 eval $inhdr
10059
10060 : define a fucntion to check prototypes
10061 $cat > protochk <<EOSH
10062 $startsh
10063 cc="$cc"
10064 optimize="$optimize"
10065 ccflags="$ccflags"
10066 prototype="$prototype"
10067 define="$define"
10068 rm_try="$rm_try"
10069 usethreads=$usethreads
10070 i_pthread=$i_pthread
10071 pthread_h_first=$pthread_h_first
10072 EOSH
10073
10074 $cat >> protochk <<'EOSH'
10075
10076 $rm_try
10077 foo="$1"
10078 shift
10079 while test $# -ge 2; do
10080         case "$1" in
10081                 $define) echo "#include <$2>" >> try.c ;;
10082                 literal) echo "$2" >> try.c ;;
10083         esac
10084     # Extra magic for the benefit of systems that need pthread.h
10085     # to be included early to correctly detect threadsafe functions.
10086     # Such functions must guarantee themselves, though, that the usethreads
10087     # and i_pthread have been defined, before calling protochk.
10088     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10089         echo "#include <pthread.h>" >> try.c
10090         pthread_h_done=yes
10091     fi
10092     shift 2
10093 done
10094 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10095 cat >> try.c <<'EOCP'
10096 #ifdef CAN_PROTOTYPE
10097 #define _(args) args
10098 #else
10099 #define _(args) ()
10100 #endif
10101 EOCP
10102 echo "$foo" >> try.c
10103 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10104 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10105 status=$?
10106 $rm_try
10107 exit $status
10108 EOSH
10109 chmod +x protochk
10110 $eunicefix protochk
10111
10112 : Define hasproto macro for Configure internal use
10113 hasproto='varname=$1; func=$2; shift; shift;
10114 while $test $# -ge 2; do
10115         case "$1" in
10116         $define) echo "#include <$2>";;
10117         esac ;
10118     shift 2;
10119 done > try.c;
10120 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10121 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10122         echo "$func() prototype found.";
10123         val="$define";
10124 else
10125         echo "$func() prototype NOT found.";
10126         val="$undef";
10127 fi;
10128 set $varname;
10129 eval $setvar;
10130 $rm_try tryout.c'
10131
10132 : see if sys/types.h has to be included
10133 set sys/types.h i_systypes
10134 eval $inhdr
10135
10136 : see if sys/select.h has to be included
10137 set sys/select.h i_sysselct
10138 eval $inhdr
10139
10140 : Define hasfield macro for Configure internal use
10141 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10142 while $test $# -ge 2; do
10143         case "$1" in
10144         $define) echo "#include <$2>";;
10145         esac ;
10146     shift 2;
10147 done > try.c;
10148 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10149 set try;
10150 if eval $compile; then
10151         val="$define";
10152 else
10153         val="$undef";
10154 fi;
10155 set $varname;
10156 eval $setvar;
10157 $rm_try'
10158
10159 : see if we should include time.h, sys/time.h, or both
10160 echo " "
10161 if test "X$timeincl" = X; then
10162         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10163         $echo $n "I'm now running the test program...$c"
10164         $cat >try.c <<EOCP
10165 #include <sys/types.h>
10166 #ifdef I_TIME
10167 #include <time.h>
10168 #endif
10169 #ifdef I_SYSTIME
10170 #ifdef SYSTIMEKERNEL
10171 #define KERNEL
10172 #endif
10173 #include <sys/time.h>
10174 #endif
10175 #ifdef I_SYSSELECT
10176 #include <sys/select.h>
10177 #endif
10178 #$i_stdlib I_STDLIB
10179 #ifdef I_STDLIB
10180 #include <stdlib.h>
10181 #endif
10182 int main()
10183 {
10184         struct tm foo;
10185 #ifdef S_TIMEVAL
10186         struct timeval bar;
10187 #endif
10188 #ifdef S_TIMEZONE
10189         struct timezone tzp;
10190 #endif
10191         if (foo.tm_sec == foo.tm_sec)
10192                 exit(0);
10193 #ifdef S_TIMEVAL
10194         if (bar.tv_sec == bar.tv_sec)
10195                 exit(0);
10196 #endif
10197         exit(1);
10198 }
10199 EOCP
10200         flags=''
10201         for s_timezone in '-DS_TIMEZONE' ''; do
10202         sysselect=''
10203         for s_timeval in '-DS_TIMEVAL' ''; do
10204         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10205         for i_time in '' '-DI_TIME'; do
10206         for i_systime in '-DI_SYSTIME' ''; do
10207                 case "$flags" in
10208                 '') $echo $n ".$c"
10209                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10210                         if eval $compile; then
10211                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10212                                 shift
10213                                 flags="$*"
10214                                 echo " "
10215                                 $echo $n "Succeeded with $flags$c"
10216                         fi
10217                         ;;
10218                 esac
10219         done
10220         done
10221         done
10222         done
10223         done
10224         timeincl=''
10225         echo " "
10226         case "$flags" in
10227         *SYSTIMEKERNEL*) i_systimek="$define"
10228                 timeincl=`./findhdr sys/time.h`
10229                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10230         *) i_systimek="$undef";;
10231         esac
10232         case "$flags" in
10233         *I_TIME*) i_time="$define"
10234                 timeincl=`./findhdr time.h`" $timeincl"
10235                 echo "We'll include <time.h>." >&4;;
10236         *) i_time="$undef";;
10237         esac
10238         case "$flags" in
10239         *I_SYSTIME*) i_systime="$define"
10240                 timeincl=`./findhdr sys/time.h`" $timeincl"
10241                 echo "We'll include <sys/time.h>." >&4;;
10242         *) i_systime="$undef";;
10243         esac
10244         $rm_try
10245 fi
10246 : see if struct tm knows about tm_zone
10247 case "$i_systime$i_time" in
10248 *$define*)
10249         echo " "
10250         echo "Checking to see if your struct tm has tm_zone field..." >&4
10251         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10252         eval $hasfield
10253         ;;
10254 *)      val="$undef"
10255         set d_tm_tm_zone
10256         eval $setvar
10257         ;;
10258 esac
10259 case "$d_tm_tm_zone" in
10260 "$define")      echo "Yes, it does."   ;;
10261 *)              echo "No, it doesn't." ;;
10262 esac
10263 : see if struct tm knows about tm_gmtoff
10264 case "$i_systime$i_time" in
10265 *$define*)
10266         echo " "
10267         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10268         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10269         eval $hasfield
10270         ;;
10271 *)      val="$undef"
10272         set d_tm_tm_gmtoff
10273         eval $setvar
10274         ;;
10275 esac
10276 case "$d_tm_tm_gmtoff" in
10277 "$define")      echo "Yes, it does."   ;;
10278 *)              echo "No, it doesn't." ;;
10279 esac
10280
10281 : see if asctime_r exists
10282 set asctime_r d_asctime_r
10283 eval $inlibc
10284 case "$d_asctime_r" in
10285 "$define")
10286         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10287         case "$d_asctime_r_proto:$usethreads" in
10288         ":define")      d_asctime_r_proto=define
10289                 set d_asctime_r_proto asctime_r $hdrs
10290                 eval $hasproto ;;
10291         *)      ;;
10292         esac
10293         case "$d_asctime_r_proto" in
10294         define)
10295         case "$asctime_r_proto" in
10296         ''|0) try='char* asctime_r(const struct tm*, char*);'
10297         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10298         esac
10299         case "$asctime_r_proto" in
10300         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10301         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10302         esac
10303         case "$asctime_r_proto" in
10304         ''|0) try='int asctime_r(const struct tm*, char*);'
10305         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10306         esac
10307         case "$asctime_r_proto" in
10308         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10309         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10310         esac
10311         case "$asctime_r_proto" in
10312         ''|0)   d_asctime_r=undef
10313                 asctime_r_proto=0
10314                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10315         * )     case "$asctime_r_proto" in
10316                 REENTRANT_PROTO*) ;;
10317                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10318                 esac
10319                 echo "Prototype: $try" ;;
10320         esac
10321         ;;
10322         *)      case "$usethreads" in
10323                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10324                 esac
10325                 d_asctime_r=undef
10326                 asctime_r_proto=0
10327                 ;;
10328         esac
10329         ;;
10330 *)      asctime_r_proto=0
10331         ;;
10332 esac
10333
10334 : see if atolf exists
10335 set atolf d_atolf
10336 eval $inlibc
10337
10338 : see if atoll exists
10339 set atoll d_atoll
10340 eval $inlibc
10341
10342 : Look for GCC-style attribute format
10343 case "$d_attribute_format" in
10344 '')
10345 echo " "
10346 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10347 $cat >attrib.c <<'EOCP'
10348 #include <stdio.h>
10349 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10350 EOCP
10351 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10352         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10353                 echo "Your C compiler doesn't support __attribute__((format))."
10354                 val="$undef"
10355         else
10356                 echo "Your C compiler supports __attribute__((format))."
10357                 val="$define"
10358         fi
10359 else
10360         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10361         val="$undef"
10362 fi
10363 ;;
10364 *) val="$d_attribute_format" ;;
10365 esac
10366 set d_attribute_format
10367 eval $setvar
10368 $rm -f attrib*
10369
10370 : Look for GCC-style attribute format with null format allowed
10371 case "$d_printf_format_null" in
10372 '') case "$d_attribute_format" in
10373     $define)
10374         echo " "
10375         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10376 $cat >attrib.c <<EOCP
10377 #include <stdio.h>
10378 #$i_stdlib I_STDLIB
10379 #ifdef I_STDLIB
10380 #include <stdlib.h>
10381 #endif
10382 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10383 int null_printf (char* pat,...) { return (int)pat; }
10384 int main () { exit(null_printf(NULL)); }
10385 EOCP
10386         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10387             : run the executable in case it produces a run-time warning
10388             if $run ./attrib >>attrib.out 2>&1; then
10389                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10390                     echo "Your C compiler doesn't allow __printf__ format to be null."
10391                     val="$undef"
10392                 else
10393                     echo "Your C compiler allows __printf__ format to be null."
10394                     val="$define"
10395                 fi
10396             else
10397             echo "Your C compiler executable failed with __printf__ format null."
10398             val="$undef"
10399         fi
10400     else
10401         echo "Your C compiler fails with __printf__ format null."
10402         val="$undef"
10403     fi
10404     ;;
10405     *)  val="$undef" ;;
10406     esac
10407 ;;
10408 *)  val="$d_printf_format_null" ;;
10409 esac
10410 set d_printf_format_null
10411 eval $setvar
10412 $rm -f attrib*
10413
10414 : Look for GCC-style attribute malloc
10415 case "$d_attribute_malloc" in
10416 '')
10417 echo " "
10418 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10419 $cat >attrib.c <<'EOCP'
10420 #include <stdio.h>
10421 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10422 EOCP
10423 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10424         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10425                 echo "Your C compiler doesn't support __attribute__((malloc))."
10426                 val="$undef"
10427         else
10428                 echo "Your C compiler supports __attribute__((malloc))."
10429                 val="$define"
10430         fi
10431 else
10432         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10433         val="$undef"
10434 fi
10435 ;;
10436 *) val="$d_attribute_malloc" ;;
10437 esac
10438 set d_attribute_malloc
10439 eval $setvar
10440 $rm -f attrib*
10441
10442 : Look for GCC-style attribute nonnull
10443 case "$d_attribute_nonnull" in
10444 '')
10445 echo " "
10446 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10447 $cat >attrib.c <<'EOCP'
10448 #include <stdio.h>
10449 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10450 EOCP
10451 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10452         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10453                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10454                 val="$undef"
10455         else
10456                 echo "Your C compiler supports __attribute__((nonnull))."
10457                 val="$define"
10458         fi
10459 else
10460         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10461         val="$undef"
10462 fi
10463 ;;
10464 *) val="$d_attribute_nonnull" ;;
10465 esac
10466 set d_attribute_nonnull
10467 eval $setvar
10468 $rm -f attrib*
10469
10470 : Look for GCC-style attribute noreturn
10471 case "$d_attribute_noreturn" in
10472 '')
10473 echo " "
10474 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10475 $cat >attrib.c <<'EOCP'
10476 #include <stdio.h>
10477 void fall_over_dead( void ) __attribute__((noreturn));
10478 EOCP
10479 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10480         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10481                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10482                 val="$undef"
10483         else
10484                 echo "Your C compiler supports __attribute__((noreturn))."
10485                 val="$define"
10486         fi
10487 else
10488         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10489         val="$undef"
10490 fi
10491 ;;
10492 *) val="$d_attribute_noreturn" ;;
10493 esac
10494 set d_attribute_noreturn
10495 eval $setvar
10496 $rm -f attrib*
10497
10498 : Look for GCC-style attribute pure
10499 case "$d_attribute_pure" in
10500 '')
10501 echo " "
10502 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10503 $cat >attrib.c <<'EOCP'
10504 #include <stdio.h>
10505 int square( int n ) __attribute__((pure));
10506 EOCP
10507 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10508         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10509                 echo "Your C compiler doesn't support __attribute__((pure))."
10510                 val="$undef"
10511         else
10512                 echo "Your C compiler supports __attribute__((pure))."
10513                 val="$define"
10514         fi
10515 else
10516         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10517         val="$undef"
10518 fi
10519 ;;
10520 *) val="$d_attribute_pure" ;;
10521 esac
10522 set d_attribute_pure
10523 eval $setvar
10524 $rm -f attrib*
10525
10526 : Look for GCC-style attribute unused
10527 case "$d_attribute_unused" in
10528 '')
10529 echo " "
10530 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10531 $cat >attrib.c <<'EOCP'
10532 #include <stdio.h>
10533 int do_something( int dummy __attribute__((unused)), int n );
10534 EOCP
10535 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10536         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10537                 echo "Your C compiler doesn't support __attribute__((unused))."
10538                 val="$undef"
10539         else
10540                 echo "Your C compiler supports __attribute__((unused))."
10541                 val="$define"
10542         fi
10543 else
10544         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10545         val="$undef"
10546 fi
10547 ;;
10548 *) val="$d_attribute_unused" ;;
10549 esac
10550 set d_attribute_unused
10551 eval $setvar
10552 $rm -f attrib*
10553
10554 : Look for GCC-style attribute deprecated
10555 case "$d_attribute_deprecated" in
10556 '')
10557 echo " "
10558 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10559 $cat >attrib.c <<'EOCP'
10560 #include <stdio.h>
10561 int I_am_deprecated(void) __attribute__((deprecated));
10562 EOCP
10563 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10564         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10565                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10566                 val="$undef"
10567         else
10568                 echo "Your C compiler supports __attribute__((deprecated))."
10569                 val="$define"
10570         fi
10571 else
10572         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10573         val="$undef"
10574 fi
10575 ;;
10576 *) val="$d_attribute_deprecated" ;;
10577 esac
10578 set d_attribute_deprecated
10579 eval $setvar
10580 $rm -f attrib*
10581
10582 : Look for GCC-style attribute warn_unused_result
10583 case "$d_attribute_warn_unused_result" in
10584 '')
10585 echo " "
10586 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10587 $cat >attrib.c <<'EOCP'
10588 #include <stdio.h>
10589 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10590 EOCP
10591 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10592         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10593                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10594                 val="$undef"
10595         else
10596                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10597                 val="$define"
10598         fi
10599 else
10600         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10601         val="$undef"
10602 fi
10603 ;;
10604 *) val="$d_attribute_warn_unused_result" ;;
10605 esac
10606 set d_attribute_warn_unused_result
10607 eval $setvar
10608 $rm -f attrib*
10609
10610 : see if bcmp exists
10611 set bcmp d_bcmp
10612 eval $inlibc
10613
10614 : see if bcopy exists
10615 set bcopy d_bcopy
10616 eval $inlibc
10617
10618 : see if getpgrp exists
10619 set getpgrp d_getpgrp
10620 eval $inlibc
10621
10622 case "$d_getpgrp" in
10623 "$define")
10624         echo " "
10625         echo "Checking to see which flavor of getpgrp is in use..."
10626         $cat >try.c <<EOP
10627 #$i_unistd I_UNISTD
10628 #include <sys/types.h>
10629 #ifdef I_UNISTD
10630 #  include <unistd.h>
10631 #endif
10632 #$i_stdlib I_STDLIB
10633 #ifdef I_STDLIB
10634 #include <stdlib.h>
10635 #endif
10636 int main()
10637 {
10638         if (getuid() == 0) {
10639                 printf("(I see you are running Configure as super-user...)\n");
10640                 setuid(1);
10641         }
10642 #ifdef TRY_BSD_PGRP
10643         if (getpgrp(1) == 0)
10644                 exit(0);
10645 #else
10646         if (getpgrp() > 0)
10647                 exit(0);
10648 #endif
10649         exit(1);
10650 }
10651 EOP
10652         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10653                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10654                 val="$define"
10655         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10656                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10657                 val="$undef"
10658         else
10659                 echo "I can't seem to compile and run the test program."
10660                 if ./usg; then
10661                         xxx="a USG one, i.e. you use getpgrp()."
10662                 else
10663                         # SVR4 systems can appear rather BSD-ish.
10664                         case "$i_unistd" in
10665                         $undef)
10666                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10667                                 val="$define"
10668                                 ;;
10669                         $define)
10670                                 xxx="probably a USG one, i.e. you use getpgrp()."
10671                                 val="$undef"
10672                                 ;;
10673                         esac
10674                 fi
10675                 echo "Assuming your getpgrp is $xxx" >&4
10676         fi
10677         ;;
10678 *) val="$undef";;
10679 esac
10680 set d_bsdgetpgrp
10681 eval $setvar
10682 $rm_try
10683
10684 : see if setpgrp exists
10685 set setpgrp d_setpgrp
10686 eval $inlibc
10687
10688 case "$d_setpgrp" in
10689 "$define")
10690         echo " "
10691         echo "Checking to see which flavor of setpgrp is in use..."
10692         $cat >try.c <<EOP
10693 #$i_unistd I_UNISTD
10694 #include <sys/types.h>
10695 #ifdef I_UNISTD
10696 #  include <unistd.h>
10697 #endif
10698 #$i_stdlib I_STDLIB
10699 #ifdef I_STDLIB
10700 #include <stdlib.h>
10701 #endif
10702 int main()
10703 {
10704         if (getuid() == 0) {
10705                 printf("(I see you are running Configure as super-user...)\n");
10706                 setuid(1);
10707         }
10708 #ifdef TRY_BSD_PGRP
10709         if (-1 == setpgrp(1, 1))
10710                 exit(0);
10711 #else
10712         if (setpgrp() != -1)
10713                 exit(0);
10714 #endif
10715         exit(1);
10716 }
10717 EOP
10718         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10719                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10720                 val="$define"
10721         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10722                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10723                 val="$undef"
10724         else
10725                 echo "(I can't seem to compile and run the test program.)"
10726                 if ./usg; then
10727                         xxx="a USG one, i.e. you use setpgrp()."
10728                 else
10729                         # SVR4 systems can appear rather BSD-ish.
10730                         case "$i_unistd" in
10731                         $undef)
10732                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10733                                 val="$define"
10734                                 ;;
10735                         $define)
10736                                 xxx="probably a USG one, i.e. you use setpgrp()."
10737                                 val="$undef"
10738                                 ;;
10739                         esac
10740                 fi
10741                 echo "Assuming your setpgrp is $xxx" >&4
10742         fi
10743         ;;
10744 *) val="$undef";;
10745 esac
10746 set d_bsdsetpgrp
10747 eval $setvar
10748 $rm_try
10749
10750 : Look for GCC-style __builtin_choose_expr
10751 case "$d_builtin_choose_expr" in
10752 '')
10753     echo " "
10754     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10755     $cat >try.c <<'EOCP'
10756 #include <assert.h>
10757 #include <stdlib.h>
10758 #include <stdio.h>
10759
10760 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10761
10762 int main(void) {
10763     assert( SYRINX(1) == 2112 );
10764     assert( SYRINX(1) != 5150 );
10765     assert( SYRINX(0) == 5150 );
10766     assert( SYRINX(0) != 2112 );
10767     puts( "All good!" );
10768     exit(0);
10769 }
10770
10771 EOCP
10772     set try
10773     if eval $compile && $run ./try; then
10774         echo "Your C compiler supports __builtin_choose_expr."
10775         val="$define"
10776     else
10777         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10778         val="$undef"
10779     fi
10780 ;;
10781 *) val="$d_builtin_choose_expr" ;;
10782 esac
10783
10784 set d_builtin_choose_expr
10785 eval $setvar
10786 $rm_try
10787
10788 : Look for GCC-style __builtin_expect
10789 case "$d_builtin_expect" in
10790 '')
10791     echo " "
10792     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10793     $cat >try.c <<'EOCP'
10794 int main(void) {
10795     int n = 50;
10796     if ( __builtin_expect(n, 0) ) n = 1;
10797     /* Remember shell exit code truth is 0, C truth is non-zero */
10798     return !(n == 1);
10799 }
10800 EOCP
10801     set try
10802     if eval $compile && $run ./try; then
10803         echo "Your C compiler supports __builtin_expect."
10804         val="$define"
10805     else
10806         echo "Your C compiler doesn't seem to understand __builtin_expect."
10807         val="$undef"
10808     fi
10809     ;;
10810 *) val="$d_builtin_expect" ;;
10811 esac
10812
10813 set d_builtin_expect
10814 eval $setvar
10815 $rm_try
10816
10817 : see if bzero exists
10818 set bzero d_bzero
10819 eval $inlibc
10820
10821 : see if stdarg is available
10822 echo " "
10823 if $test `./findhdr stdarg.h`; then
10824         echo "<stdarg.h> found." >&4
10825         valstd="$define"
10826 else
10827         echo "<stdarg.h> NOT found." >&4
10828         valstd="$undef"
10829 fi
10830
10831 : see if varags is available
10832 echo " "
10833 if $test `./findhdr varargs.h`; then
10834         echo "<varargs.h> found." >&4
10835 else
10836         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10837 fi
10838
10839 : set up the varargs testing programs
10840 $cat > varargs.c <<EOP
10841 #ifdef I_STDARG
10842 #include <stdarg.h>
10843 #endif
10844 #ifdef I_VARARGS
10845 #include <varargs.h>
10846 #endif
10847
10848 #ifdef I_STDARG
10849 int f(char *p, ...)
10850 #else
10851 int f(va_alist)
10852 va_dcl
10853 #endif
10854 {
10855         va_list ap;
10856 #ifndef I_STDARG
10857         char *p;
10858 #endif
10859 #ifdef I_STDARG
10860         va_start(ap,p);
10861 #else
10862         va_start(ap);
10863         p = va_arg(ap, char *);
10864 #endif
10865         va_end(ap);
10866         return 0;
10867 }
10868 EOP
10869 $cat > varargs <<EOP
10870 $startsh
10871 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10872         echo "true"
10873 else
10874         echo "false"
10875 fi
10876 $rm -f varargs$_o
10877 EOP
10878 chmod +x varargs
10879
10880 : now check which varargs header should be included
10881 echo " "
10882 i_varhdr=''
10883 case "$valstd" in
10884 "$define")
10885         if `./varargs I_STDARG`; then
10886                 val='stdarg.h'
10887         elif `./varargs I_VARARGS`; then
10888                 val='varargs.h'
10889         fi
10890         ;;
10891 *)
10892         if `./varargs I_VARARGS`; then
10893                 val='varargs.h'
10894         fi
10895         ;;
10896 esac
10897 case "$val" in
10898 '')
10899 echo "I could not find the definition for va_dcl... You have problems..." >&4
10900         val="$undef"; set i_stdarg; eval $setvar
10901         val="$undef"; set i_varargs; eval $setvar
10902         ;;
10903 *)
10904         set i_varhdr
10905         eval $setvar
10906         case "$i_varhdr" in
10907         stdarg.h)
10908                 val="$define"; set i_stdarg; eval $setvar
10909                 val="$undef"; set i_varargs; eval $setvar
10910                 ;;
10911         varargs.h)
10912                 val="$undef"; set i_stdarg; eval $setvar
10913                 val="$define"; set i_varargs; eval $setvar
10914                 ;;
10915         esac
10916         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10917 esac
10918 $rm -f varargs*
10919
10920 : see if the Compiler supports C99 variadic macros
10921 case "$i_stdarg$i_stdlib" in
10922     "$define$define")
10923     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10924     $cat >try.c <<EOCP
10925 #include <stdio.h>
10926 #include <stdarg.h>
10927
10928 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10929
10930 int main() {
10931   char buf[20];
10932   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10933   puts(buf);
10934   return 0;
10935 }
10936 EOCP
10937     set try
10938     if eval $compile && $run ./try 2>&1 >/dev/null; then
10939         case "`$run ./try`" in
10940             "123 456 789")
10941             echo "You have C99 variadic macros." >&4
10942             d_c99_variadic_macros="$define"
10943             ;;
10944             *)
10945             echo "You don't have functional C99 variadic macros." >&4
10946             d_c99_variadic_macros="$undef"
10947             ;;
10948         esac
10949     else
10950         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10951         d_c99_variadic_macros="$undef"
10952     fi
10953     $rm_try
10954     ;;
10955     *)
10956     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10957     d_c99_variadic_macros="$undef"
10958     ;;
10959 esac
10960
10961 : see if signal is declared as pointer to function returning int or void
10962 echo " "
10963 xxx=`./findhdr signal.h`
10964 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10965 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10966         echo "You have int (*signal())() instead of void." >&4
10967         val="$undef"
10968 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10969         echo "You have void (*signal())()." >&4
10970         val="$define"
10971 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10972         echo "You have int (*signal())() instead of void." >&4
10973         val="$undef"
10974 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10975         echo "You have void (*signal())()." >&4
10976         val="$define"
10977 else
10978         case "$d_voidsig" in
10979         '')
10980         echo "I can't determine whether signal handler returns void or int..." >&4
10981                 dflt=void
10982                 rp="What type does your signal handler return?"
10983                 . ./myread
10984                 case "$ans" in
10985                 v*) val="$define";;
10986                 *) val="$undef";;
10987                 esac;;
10988         "$define")
10989                 echo "As you already told me, signal handler returns void." >&4
10990                 val="$define"
10991                 ;;
10992         *)      echo "As you already told me, signal handler returns int." >&4
10993                 val="$undef"
10994                 ;;
10995         esac
10996 fi
10997 set d_voidsig
10998 eval $setvar
10999 case "$d_voidsig" in
11000 "$define") signal_t="void";;
11001 *) signal_t="int";;
11002 esac
11003 $rm -f $$.tmp
11004
11005 : check for ability to cast large floats to 32-bit ints.
11006 echo " "
11007 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11008 if $test "$intsize" -ge 4; then
11009         xxx=int
11010 else
11011         xxx=long
11012 fi
11013 $cat >try.c <<EOCP
11014 #include <stdio.h>
11015 #$i_stdlib I_STDLIB
11016 #ifdef I_STDLIB
11017 #include <stdlib.h>
11018 #endif
11019 #include <sys/types.h>
11020 #include <signal.h>
11021 $signal_t blech(int s) { exit(3); }
11022 int main()
11023 {
11024         $xxx i32;
11025         double f, g;
11026         int result = 0;
11027         char str[16];
11028         signal(SIGFPE, blech);
11029
11030         /* Don't let compiler optimize the test away.  Store the number
11031            in a writable string for gcc to pass to sscanf under HP-UX.
11032         */
11033         sprintf(str, "2147483647");
11034         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11035         g = 10 * f;
11036         i32  = ($xxx) g;
11037
11038         /* x86 processors will probably give 0x8000 0000, which is a
11039            sign change.  We don't want that.  We want to mimic SPARC
11040            behavior here, which is to preserve the sign and give
11041            back 0x7fff ffff.
11042         */
11043         if (i32 != ($xxx) f)
11044                 result |= 1;
11045         exit(result);
11046 }
11047 EOCP
11048 set try
11049 if eval $compile_ok; then
11050         $run ./try
11051         yyy=$?
11052 else
11053         echo "(I can't seem to compile the test program--assuming it can't)"
11054         yyy=1
11055 fi
11056 case "$yyy" in
11057 0)      val="$define"
11058         echo "Yup, it can."
11059         ;;
11060 *)      val="$undef"
11061         echo "Nope, it can't."
11062         ;;
11063 esac
11064 set d_casti32
11065 eval $setvar
11066 $rm_try
11067
11068 : check for ability to cast negative floats to unsigned
11069 echo " "
11070 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11071 $cat >try.c <<EOCP
11072 #include <stdio.h>
11073 #$i_stdlib I_STDLIB
11074 #ifdef I_STDLIB
11075 #include <stdlib.h>
11076 #endif
11077 #include <sys/types.h>
11078 #include <signal.h>
11079 $signal_t blech(int s) { exit(7); }
11080 $signal_t blech_in_list(int s) { exit(4); }
11081 unsigned long dummy_long(unsigned long p) { return p; }
11082 unsigned int dummy_int(unsigned int p) { return p; }
11083 unsigned short dummy_short(unsigned short p) { return p; }
11084 int main()
11085 {
11086         double f;
11087         unsigned long along;
11088         unsigned int aint;
11089         unsigned short ashort;
11090         int result = 0;
11091         char str[16];
11092
11093         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11094            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11095            optimized the whole file away
11096         */
11097         /* Store the number in a writable string for gcc to pass to
11098            sscanf under HP-UX.
11099         */
11100         sprintf(str, "-123");
11101         sscanf(str, "%lf", &f);  /* f = -123.; */
11102
11103         signal(SIGFPE, blech);
11104         along = (unsigned long)f;
11105         aint = (unsigned int)f;
11106         ashort = (unsigned short)f;
11107         if (along != (unsigned long)-123)
11108                 result |= 1;
11109         if (aint != (unsigned int)-123)
11110                 result |= 1;
11111         if (ashort != (unsigned short)-123)
11112                 result |= 1;
11113         sprintf(str, "1073741824.");
11114         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11115         f = f + f;
11116         along = 0;
11117         along = (unsigned long)f;
11118         if (along != 0x80000000)
11119                 result |= 2;
11120         f -= 1.;
11121         along = 0;
11122         along = (unsigned long)f;
11123         if (along != 0x7fffffff)
11124                 result |= 1;
11125         f += 2.;
11126         along = 0;
11127         along = (unsigned long)f;
11128         if (along != 0x80000001)
11129                 result |= 2;
11130         if (result)
11131                 exit(result);
11132         signal(SIGFPE, blech_in_list);
11133         sprintf(str, "123.");
11134         sscanf(str, "%lf", &f);  /* f = 123.; */
11135         along = dummy_long((unsigned long)f);
11136         aint = dummy_int((unsigned int)f);
11137         ashort = dummy_short((unsigned short)f);
11138         if (along != (unsigned long)123)
11139                 result |= 4;
11140         if (aint != (unsigned int)123)
11141                 result |= 4;
11142         if (ashort != (unsigned short)123)
11143                 result |= 4;
11144         exit(result);
11145
11146 }
11147 EOCP
11148 set try
11149 if eval $compile_ok; then
11150         $run ./try
11151         castflags=$?
11152 else
11153         echo "(I can't seem to compile the test program--assuming it can't)"
11154         castflags=7
11155 fi
11156 case "$castflags" in
11157 0)      val="$define"
11158         echo "Yup, it can."
11159         ;;
11160 *)      val="$undef"
11161         echo "Nope, it can't."
11162         ;;
11163 esac
11164 set d_castneg
11165 eval $setvar
11166 $rm_try
11167
11168 : see if vprintf exists
11169 echo " "
11170 if set vprintf val -f d_vprintf; eval $csym; $val; then
11171         echo 'vprintf() found.' >&4
11172         val="$define"
11173         $cat >try.c <<EOF
11174 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11175 #$i_varargs I_VARARGS
11176
11177 #$i_stdlib I_STDLIB
11178 #$i_unistd I_UNISTD
11179
11180 #ifdef I_STDARG
11181 #  include <stdarg.h>
11182 #else /* I_VARARGS */
11183 #  include <varargs.h>
11184 #endif
11185
11186 #ifdef I_UNISTD
11187 #  include <unistd.h>
11188 #endif
11189
11190 #ifdef I_STDLIB
11191 #  include <stdlib.h>
11192 #endif
11193
11194 #include <stdio.h> /* vsprintf prototype */
11195
11196 #ifdef I_STDARG
11197 void xxx(int n, ...)
11198 {
11199     va_list args;
11200     char buf[10];
11201     va_start(args, n);
11202     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11203 }
11204 int main() { xxx(1, "foo"); }
11205
11206 #else /* I_VARARGS */
11207
11208 xxx(va_alist)
11209 va_dcl
11210 {
11211     va_list args;
11212     char buf[10];
11213     va_start(args);
11214     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11215 }
11216 int main() { xxx("foo"); }
11217
11218 #endif
11219
11220 EOF
11221         set try
11222         if eval $compile_ok; then
11223                 if $run ./try; then
11224                         echo "Your vsprintf() returns (int)." >&4
11225                         val2="$undef"
11226                 else
11227                         echo "Your vsprintf() returns (char*)." >&4
11228                         val2="$define"
11229                 fi
11230         else
11231                 echo 'I am unable to compile the vsprintf() test program.' >&4
11232                 # We shouldn't get here.  If we do, assume the standard signature,
11233                 # not the old BSD one.
11234                 echo 'Guessing that vsprintf() returns (int).' >&4
11235                 val2="$undef"
11236         fi
11237 else
11238         echo 'vprintf() NOT found.' >&4
11239         val="$undef"
11240         val2="$undef"
11241 fi
11242 $rm_try
11243 set d_vprintf
11244 eval $setvar
11245 val=$val2
11246 set d_charvspr
11247 eval $setvar
11248
11249 : see if chown exists
11250 set chown d_chown
11251 eval $inlibc
11252
11253 : see if chroot exists
11254 set chroot d_chroot
11255 eval $inlibc
11256
11257 : see if chsize exists
11258 set chsize d_chsize
11259 eval $inlibc
11260
11261 : see if class exists
11262 set class d_class
11263 eval $inlibc
11264
11265 : see if clearenv exists
11266 set clearenv d_clearenv
11267 eval $inlibc
11268
11269 : Define hasstruct macro for Configure internal use
11270 hasstruct='varname=$1; struct=$2; shift; shift;
11271 while $test $# -ge 2; do
11272         case "$1" in
11273         $define) echo "#include <$2>";;
11274         esac ;
11275     shift 2;
11276 done > try.c;
11277 echo "int main () { struct $struct foo; }" >> try.c;
11278 set try;
11279 if eval $compile; then
11280         val="$define";
11281 else
11282         val="$undef";
11283 fi;
11284 set $varname;
11285 eval $setvar;
11286 $rm_try'
11287
11288 : see whether socket exists
11289 socketlib=''
11290 sockethdr=''
11291 echo " "
11292 $echo $n "Hmm... $c" >&4
11293 if set socket val -f d_socket; eval $csym; $val; then
11294         echo "Looks like you have Berkeley networking support." >&4
11295         d_socket="$define"
11296         if set setsockopt val -f; eval $csym; $val; then
11297                 d_oldsock="$undef"
11298         else
11299                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11300                 d_oldsock="$define"
11301         fi
11302 else
11303         if $contains socklib libc.list >/dev/null 2>&1; then
11304                 echo "Looks like you have Berkeley networking support." >&4
11305                 d_socket="$define"
11306                 : we will have to assume that it supports the 4.2 BSD interface
11307                 d_oldsock="$undef"
11308         else
11309                 echo "You don't have Berkeley networking in libc$_a..." >&4
11310                 if test "X$d_socket" = "X$define"; then
11311                    echo "...but you seem to believe that you have sockets." >&4
11312                 else
11313                         for net in net socket
11314                         do
11315                                 if test -f /usr/lib/lib$net$_a; then
11316                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11317                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11318                                         if $contains socket libc.list >/dev/null 2>&1; then
11319                                                 d_socket="$define"
11320                                                 socketlib="-l$net"
11321                                                 case "$net" in
11322                                                 net)
11323                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11324                                                         sockethdr="-I/usr/netinclude"
11325                                                         ;;
11326                                                 esac
11327                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11328                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11329                                                         d_oldsock="$undef"
11330                                                 else
11331                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11332                                                         d_oldsock="$define"
11333                                                 fi
11334                                                 break
11335                                         fi
11336                                 fi
11337                         done
11338                         if test "X$d_socket" != "X$define"; then
11339                            echo "or anywhere else I see." >&4
11340                            d_socket="$undef"
11341                            d_oldsock="$undef"
11342                         fi
11343                 fi
11344         fi
11345 fi
11346
11347 : see if socketpair exists
11348 set socketpair d_sockpair
11349 eval $inlibc
11350
11351
11352 echo " "
11353 echo "Checking the availability of certain socket constants..." >&4
11354 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11355         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11356         $cat >try.c <<EOF
11357 #include <sys/types.h>
11358 #include <sys/socket.h>
11359 int main() {
11360     int i = $ENUM;
11361 }
11362 EOF
11363         val="$undef"
11364         set try; if eval $compile; then
11365                 val="$define"
11366         fi
11367         set d_${enum}; eval $setvar
11368         $rm_try
11369 done
11370
11371 : see if this is a sys/uio.h system
11372 set sys/uio.h i_sysuio
11373 eval $inhdr
11374
11375 : Check for cmsghdr support
11376 echo " "
11377 echo "Checking to see if your system supports struct cmsghdr..." >&4
11378 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11379 eval $hasstruct
11380 case "$d_cmsghdr_s" in
11381 "$define")      echo "Yes, it does."   ;;
11382 *)              echo "No, it doesn't." ;;
11383 esac
11384
11385
11386 : check for const keyword
11387 echo " "
11388 echo 'Checking to see if your C compiler knows about "const"...' >&4
11389 $cat >const.c <<'EOCP'
11390 typedef struct spug { int drokk; } spug;
11391 int main()
11392 {
11393         const char *foo;
11394         const spug y = { 0 };
11395 }
11396 EOCP
11397 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11398         val="$define"
11399         echo "Yup, it does."
11400 else
11401         val="$undef"
11402         echo "Nope, it doesn't."
11403 fi
11404 set d_const
11405 eval $setvar
11406
11407 : see if copysignl exists
11408 set copysignl d_copysignl
11409 eval $inlibc
11410
11411 : see if crypt exists
11412 echo " "
11413 set crypt d_crypt
11414 eval $inlibc
11415 case "$d_crypt" in
11416 $define) cryptlib='' ;;
11417 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11418                 echo 'crypt() found.' >&4
11419                 val="$define"
11420                 cryptlib=''
11421         else
11422                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11423                 if $test -z "$cryptlib"; then
11424                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11425                 else
11426                         cryptlib=-lcrypt
11427                 fi
11428                 if $test -z "$cryptlib"; then
11429                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11430                 else
11431                         cryptlib=-lcrypt
11432                 fi
11433                 if $test -z "$cryptlib"; then
11434                         cryptlib=`./loc libcrypt$_a "" $libpth`
11435                 else
11436                         cryptlib=-lcrypt
11437                 fi
11438                 if $test -z "$cryptlib"; then
11439                         echo 'crypt() NOT found.' >&4
11440                         val="$undef"
11441                 else
11442                         val="$define"
11443                 fi
11444         fi
11445         set d_crypt
11446         eval $setvar
11447         ;;
11448 esac
11449
11450 : see if this is a crypt.h system
11451 set crypt.h i_crypt
11452 eval $inhdr
11453
11454 : see if crypt_r exists
11455 set crypt_r d_crypt_r
11456 eval $inlibc
11457 case "$d_crypt_r" in
11458 "$define")
11459         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11460         case "$d_crypt_r_proto:$usethreads" in
11461         ":define")      d_crypt_r_proto=define
11462                 set d_crypt_r_proto crypt_r $hdrs
11463                 eval $hasproto ;;
11464         *)      ;;
11465         esac
11466         case "$d_crypt_r_proto" in
11467         define)
11468         case "$crypt_r_proto" in
11469         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11470         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11471         esac
11472         case "$crypt_r_proto" in
11473         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11474         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11475         esac
11476         case "$crypt_r_proto" in
11477         ''|0)   d_crypt_r=undef
11478                 crypt_r_proto=0
11479                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11480         * )     case "$crypt_r_proto" in
11481                 REENTRANT_PROTO*) ;;
11482                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11483                 esac
11484                 echo "Prototype: $try" ;;
11485         esac
11486         ;;
11487         *)      case "$usethreads" in
11488                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11489                 esac
11490                 d_crypt_r=undef
11491                 crypt_r_proto=0
11492                 ;;
11493         esac
11494         ;;
11495 *)      crypt_r_proto=0
11496         ;;
11497 esac
11498
11499 : get csh whereabouts
11500 case "$csh" in
11501 'csh') val="$undef" ;;
11502 *) val="$define" ;;
11503 esac
11504 set d_csh
11505 eval $setvar
11506 : Respect a hint or command line value for full_csh.
11507 case "$full_csh" in
11508 '') full_csh=$csh ;;
11509 esac
11510
11511 : see if ctermid exists
11512 set ctermid d_ctermid
11513 eval $inlibc
11514
11515 : see if ctermid_r exists
11516 set ctermid_r d_ctermid_r
11517 eval $inlibc
11518 case "$d_ctermid_r" in
11519 "$define")
11520         hdrs="$i_systypes sys/types.h define stdio.h "
11521         case "$d_ctermid_r_proto:$usethreads" in
11522         ":define")      d_ctermid_r_proto=define
11523                 set d_ctermid_r_proto ctermid_r $hdrs
11524                 eval $hasproto ;;
11525         *)      ;;
11526         esac
11527         case "$d_ctermid_r_proto" in
11528         define)
11529         case "$ctermid_r_proto" in
11530         ''|0) try='char* ctermid_r(char*);'
11531         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11532         esac
11533         case "$ctermid_r_proto" in
11534         ''|0)   d_ctermid_r=undef
11535                 ctermid_r_proto=0
11536                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11537         * )     case "$ctermid_r_proto" in
11538                 REENTRANT_PROTO*) ;;
11539                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11540                 esac
11541                 echo "Prototype: $try" ;;
11542         esac
11543         ;;
11544         *)      case "$usethreads" in
11545                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11546                 esac
11547                 d_ctermid_r=undef
11548                 ctermid_r_proto=0
11549                 ;;
11550         esac
11551         ;;
11552 *)      ctermid_r_proto=0
11553         ;;
11554 esac
11555
11556 : see if ctime_r exists
11557 set ctime_r d_ctime_r
11558 eval $inlibc
11559 case "$d_ctime_r" in
11560 "$define")
11561         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11562         case "$d_ctime_r_proto:$usethreads" in
11563         ":define")      d_ctime_r_proto=define
11564                 set d_ctime_r_proto ctime_r $hdrs
11565                 eval $hasproto ;;
11566         *)      ;;
11567         esac
11568         case "$d_ctime_r_proto" in
11569         define)
11570         case "$ctime_r_proto" in
11571         ''|0) try='char* ctime_r(const time_t*, char*);'
11572         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11573         esac
11574         case "$ctime_r_proto" in
11575         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11576         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11577         esac
11578         case "$ctime_r_proto" in
11579         ''|0) try='int ctime_r(const time_t*, char*);'
11580         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11581         esac
11582         case "$ctime_r_proto" in
11583         ''|0) try='int ctime_r(const time_t*, char*, int);'
11584         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11585         esac
11586         case "$ctime_r_proto" in
11587         ''|0)   d_ctime_r=undef
11588                 ctime_r_proto=0
11589                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11590         * )     case "$ctime_r_proto" in
11591                 REENTRANT_PROTO*) ;;
11592                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11593                 esac
11594                 echo "Prototype: $try" ;;
11595         esac
11596         ;;
11597         *)      case "$usethreads" in
11598                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11599                 esac
11600                 d_ctime_r=undef
11601                 ctime_r_proto=0
11602                 ;;
11603         esac
11604         ;;
11605 *)      ctime_r_proto=0
11606         ;;
11607 esac
11608
11609 : see if cuserid exists
11610 set cuserid d_cuserid
11611 eval $inlibc
11612
11613 : see if this is a limits.h system
11614 set limits.h i_limits
11615 eval $inhdr
11616
11617 : see if this is a float.h system
11618 set float.h i_float
11619 eval $inhdr
11620
11621 : See if number of significant digits in a double precision number is known
11622 echo " "
11623 $cat >dbl_dig.c <<EOM
11624 #$i_limits I_LIMITS
11625 #$i_float I_FLOAT
11626 #ifdef I_LIMITS
11627 #include <limits.h>
11628 #endif
11629 #ifdef I_FLOAT
11630 #include <float.h>
11631 #endif
11632 #ifdef DBL_DIG
11633 printf("Contains DBL_DIG");
11634 #endif
11635 EOM
11636 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11637 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11638         echo "DBL_DIG found." >&4
11639         val="$define"
11640 else
11641         echo "DBL_DIG NOT found." >&4
11642         val="$undef"
11643 fi
11644 $rm -f dbl_dig.?
11645 set d_dbl_dig
11646 eval $setvar
11647
11648 : see if dbm.h is available
11649 : see if dbmclose exists
11650 set dbmclose d_dbmclose
11651 eval $inlibc
11652
11653 case "$d_dbmclose" in
11654 $define)
11655         set dbm.h i_dbm
11656         eval $inhdr
11657         case "$i_dbm" in
11658         $define)
11659                 val="$undef"
11660                 set i_rpcsvcdbm
11661                 eval $setvar
11662                 ;;
11663         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11664                 eval $inhdr
11665                 ;;
11666         esac
11667         ;;
11668 *)      echo "We won't be including <dbm.h>"
11669         val="$undef"
11670         set i_dbm
11671         eval $setvar
11672         val="$undef"
11673         set i_rpcsvcdbm
11674         eval $setvar
11675         ;;
11676 esac
11677
11678 : see if prototype for dbminit is available
11679 echo " "
11680 set d_dbminitproto dbminit $i_dbm dbm.h
11681 eval $hasproto
11682
11683 : see if difftime exists
11684 set difftime d_difftime
11685 eval $inlibc
11686
11687 : see if this is a dirent system
11688 echo " "
11689 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11690         val="$define"
11691         echo "<dirent.h> found." >&4
11692 else
11693         val="$undef"
11694         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11695                 echo "<sys/dir.h> found." >&4
11696                 echo " "
11697         else
11698                 xinc=`./findhdr sys/ndir.h`
11699         fi
11700         echo "<dirent.h> NOT found." >&4
11701 fi
11702 set i_dirent
11703 eval $setvar
11704
11705 : Look for type of directory structure.
11706 echo " "
11707 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11708
11709 case "$direntrytype" in
11710 ''|' ')
11711         case "$i_dirent" in
11712         $define) guess1='struct dirent' ;;
11713         *) guess1='struct direct'  ;;
11714         esac
11715         ;;
11716 *)      guess1="$direntrytype"
11717         ;;
11718 esac
11719
11720 case "$guess1" in
11721 'struct dirent') guess2='struct direct' ;;
11722 *) guess2='struct dirent' ;;
11723 esac
11724
11725 if $contains "$guess1" try.c >/dev/null 2>&1; then
11726         direntrytype="$guess1"
11727         echo "Your directory entries are $direntrytype." >&4
11728 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11729         direntrytype="$guess2"
11730         echo "Your directory entries seem to be $direntrytype." >&4
11731 else
11732         echo "I don't recognize your system's directory entries." >&4
11733         rp="What type is used for directory entries on this system?"
11734         dflt="$guess1"
11735         . ./myread
11736         direntrytype="$ans"
11737 fi
11738 $rm_try
11739
11740 : see if the directory entry stores field length
11741 echo " "
11742 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11743 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11744         echo "Good, your directory entry keeps length information in d_namlen." >&4
11745         val="$define"
11746 else
11747         echo "Your directory entry does not know about the d_namlen field." >&4
11748         val="$undef"
11749 fi
11750 set d_dirnamlen
11751 eval $setvar
11752 $rm_try
11753
11754 : Look for DIR.dd_fd
11755 case "$i_dirent" in
11756 "$define")
11757     echo "Checking to see if DIR has a dd_fd member variable" >&4
11758     $cat >try.c <<EOCP
11759 #$i_stdlib I_STDLIB
11760 #ifdef I_STDLIB
11761 #include <stdlib.h>
11762 #endif
11763 #include <dirent.h>
11764
11765 int main() {
11766     DIR dir;
11767     dir.dd_fd = 1;
11768     return 0;
11769 }
11770 EOCP
11771     val=$undef
11772     set try
11773     if eval $compile; then
11774         echo "Yes, it does."
11775         val="$define"
11776     else
11777         echo "No, it does not."
11778         val="$undef"
11779     fi
11780     ;;
11781 *)
11782     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11783     val="$undef"
11784     ;;
11785 esac
11786 set d_dir_dd_fd
11787 eval $setvar
11788 $rm_try
11789
11790 : see if this is an sysdir system
11791 set sys/dir.h i_sysdir
11792 eval $inhdr
11793
11794 : see if this is an sysndir system
11795 set sys/ndir.h i_sysndir
11796 eval $inhdr
11797
11798 : Look for dirfd
11799 echo " "
11800 $cat >dirfd.c <<EOM
11801 #include <stdio.h>
11802 #$i_stdlib I_STDLIB
11803 #ifdef I_STDLIB
11804 #include <stdlib.h>
11805 #endif
11806 #$i_dirent I_DIRENT             /**/
11807 #$i_sysdir I_SYS_DIR            /**/
11808 #$i_sysndir I_SYS_NDIR          /**/
11809 #$i_systypes I_SYS_TYPES        /**/
11810 #if defined(I_SYS_TYPES)
11811 #include <sys/types.h>
11812 #endif
11813 #if defined(I_DIRENT)
11814 #include <dirent.h>
11815 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11816 #include <sys/dir.h>
11817 #endif
11818 #else
11819 #ifdef I_SYS_NDIR
11820 #include <sys/ndir.h>
11821 #else
11822 #ifdef I_SYS_DIR
11823 #ifdef hp9000s500
11824 #include <ndir.h>       /* may be wrong in the future */
11825 #else
11826 #include <sys/dir.h>
11827 #endif
11828 #endif
11829 #endif
11830 #endif 
11831 int main() {
11832         DIR *dirp = opendir(".");
11833         if (dirfd(dirp) >= 0)
11834                 exit(0);
11835         else
11836                 exit(1);
11837 }
11838 EOM
11839 val=$undef
11840 set dirfd
11841 if eval $compile; then
11842         val="$define"
11843 fi
11844 case "$val" in
11845 $define)        echo "dirfd() found." >&4       ;;
11846 *)              echo "dirfd() NOT found." >&4   ;;
11847 esac
11848 set d_dirfd
11849 eval $setvar
11850 $rm -f dirfd*
11851
11852 : see if dlerror exists
11853 xxx_runnm="$runnm"
11854 runnm=false
11855 set dlerror d_dlerror
11856 eval $inlibc
11857 runnm="$xxx_runnm"
11858
11859 : see if dlfcn is available
11860 set dlfcn.h i_dlfcn
11861 eval $inhdr
11862
11863 : Check what extension to use for shared libs
11864 case "$usedl" in
11865 $define|y|true)
11866         $cat << EOM
11867
11868 On a few systems, the dynamically loaded modules that perl generates and uses
11869 will need a different extension than shared libs. The default will probably
11870 be appropriate.
11871
11872 EOM
11873         case "$dlext" in
11874         '')     dflt="$so" ;;
11875         *)      dflt="$dlext" ;;
11876         esac
11877         rp='What is the extension of dynamically loaded modules'
11878         . ./myread
11879         dlext="$ans"
11880         ;;
11881 *)
11882         dlext="none"
11883         ;;
11884 esac
11885
11886 : Check if dlsym need a leading underscore
11887 echo " "
11888 val="$undef"
11889
11890 case "$dlsrc" in
11891 dl_dlopen.xs)
11892         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11893         $cat >dyna.c <<'EOM'
11894 fred () { }
11895 EOM
11896
11897 $cat >fred.c<<EOM
11898
11899 #include <stdio.h>
11900 #$i_stdlib I_STDLIB
11901 #ifdef I_STDLIB
11902 #include <stdlib.h>
11903 #endif
11904 #$i_dlfcn I_DLFCN
11905 #ifdef I_DLFCN
11906 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11907 #else
11908 #include <sys/types.h>
11909 #include <nlist.h>
11910 #include <link.h>
11911 #endif
11912
11913 extern int fred() ;
11914
11915 int main()
11916 {
11917     void * handle ;
11918     void * symbol ;
11919 #ifndef RTLD_LAZY
11920     int mode = 1 ;
11921 #else
11922     int mode = RTLD_LAZY ;
11923 #endif
11924     handle = dlopen("./dyna.$dlext", mode) ;
11925     if (handle == NULL) {
11926         printf ("1\n") ;
11927         fflush (stdout) ;
11928         exit(0);
11929     }
11930     symbol = dlsym(handle, "fred") ;
11931     if (symbol == NULL) {
11932         /* try putting a leading underscore */
11933         symbol = dlsym(handle, "_fred") ;
11934         if (symbol == NULL) {
11935             printf ("2\n") ;
11936             fflush (stdout) ;
11937             exit(0);
11938         }
11939         printf ("3\n") ;
11940     }
11941     else
11942         printf ("4\n") ;
11943     fflush (stdout) ;
11944     exit(0);
11945 }
11946 EOM
11947         : Call the object file tmp-dyna.o in case dlext=o.
11948         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11949                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11950                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11951                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11952                 xxx=`$run ./fred`
11953                 case $xxx in
11954                 1)      echo "Test program failed using dlopen." >&4
11955                         echo "Perhaps you should not use dynamic loading." >&4;;
11956                 2)      echo "Test program failed using dlsym." >&4
11957                         echo "Perhaps you should not use dynamic loading." >&4;;
11958                 3)      echo "dlsym needs a leading underscore" >&4
11959                         val="$define" ;;
11960                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11961                 esac
11962         else
11963                 echo "I can't compile and run the test program." >&4
11964                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11965         fi
11966         ;;
11967 esac
11968
11969 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11970
11971 set d_dlsymun
11972 eval $setvar
11973
11974 : see if drand48_r exists
11975 set drand48_r d_drand48_r
11976 eval $inlibc
11977 case "$d_drand48_r" in
11978 "$define")
11979         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11980         case "$d_drand48_r_proto:$usethreads" in
11981         ":define")      d_drand48_r_proto=define
11982                 set d_drand48_r_proto drand48_r $hdrs
11983                 eval $hasproto ;;
11984         *)      ;;
11985         esac
11986         case "$d_drand48_r_proto" in
11987         define)
11988         case "$drand48_r_proto" in
11989         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11990         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11991         esac
11992         case "$drand48_r_proto" in
11993         ''|0)   d_drand48_r=undef
11994                 drand48_r_proto=0
11995                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11996         * )     case "$drand48_r_proto" in
11997                 REENTRANT_PROTO*) ;;
11998                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11999                 esac
12000                 echo "Prototype: $try" ;;
12001         esac
12002         ;;
12003         *)      case "$usethreads" in
12004                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12005                 esac
12006                 d_drand48_r=undef
12007                 drand48_r_proto=0
12008                 ;;
12009         esac
12010         ;;
12011 *)      drand48_r_proto=0
12012         ;;
12013 esac
12014
12015 : see if prototype for drand48 is available
12016 echo " "
12017 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12018 eval $hasproto
12019
12020 : see if dup2 exists
12021 set dup2 d_dup2
12022 eval $inlibc
12023
12024 : see if eaccess exists
12025 set eaccess d_eaccess
12026 eval $inlibc
12027
12028 : see if endgrent exists
12029 set endgrent d_endgrent
12030 eval $inlibc
12031
12032 : see if this is an grp system
12033 set grp.h i_grp
12034 eval $inhdr
12035
12036 case "$i_grp" in
12037 $define)
12038         xxx=`./findhdr grp.h`
12039         $cppstdin $cppflags $cppminus < $xxx >$$.h
12040
12041         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12042                 val="$define"
12043         else
12044                 val="$undef"
12045         fi
12046         set d_grpasswd
12047         eval $setvar
12048
12049         $rm -f $$.h
12050         ;;
12051 *)
12052         val="$undef";
12053         set d_grpasswd; eval $setvar
12054         ;;
12055 esac
12056
12057 : see if endgrent_r exists
12058 set endgrent_r d_endgrent_r
12059 eval $inlibc
12060 case "$d_endgrent_r" in
12061 "$define")
12062         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12063         case "$d_endgrent_r_proto:$usethreads" in
12064         ":define")      d_endgrent_r_proto=define
12065                 set d_endgrent_r_proto endgrent_r $hdrs
12066                 eval $hasproto ;;
12067         *)      ;;
12068         esac
12069         case "$d_endgrent_r_proto" in
12070         define)
12071         case "$endgrent_r_proto" in
12072         ''|0) try='int endgrent_r(FILE**);'
12073         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12074         esac
12075         case "$endgrent_r_proto" in
12076         ''|0) try='void endgrent_r(FILE**);'
12077         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12078         esac
12079         case "$endgrent_r_proto" in
12080         ''|0)   d_endgrent_r=undef
12081                 endgrent_r_proto=0
12082                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12083         * )     case "$endgrent_r_proto" in
12084                 REENTRANT_PROTO*) ;;
12085                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12086                 esac
12087                 echo "Prototype: $try" ;;
12088         esac
12089         ;;
12090         *)      case "$usethreads" in
12091                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12092                 esac
12093                 d_endgrent_r=undef
12094                 endgrent_r_proto=0
12095                 ;;
12096         esac
12097         ;;
12098 *)      endgrent_r_proto=0
12099         ;;
12100 esac
12101
12102 : see if endhostent exists
12103 set endhostent d_endhent
12104 eval $inlibc
12105
12106 : see if this is a netdb.h system
12107 set netdb.h i_netdb
12108 eval $inhdr
12109
12110 : see if endhostent_r exists
12111 set endhostent_r d_endhostent_r
12112 eval $inlibc
12113 case "$d_endhostent_r" in
12114 "$define")
12115         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12116         case "$d_endhostent_r_proto:$usethreads" in
12117         ":define")      d_endhostent_r_proto=define
12118                 set d_endhostent_r_proto endhostent_r $hdrs
12119                 eval $hasproto ;;
12120         *)      ;;
12121         esac
12122         case "$d_endhostent_r_proto" in
12123         define)
12124         case "$endhostent_r_proto" in
12125         ''|0) try='int endhostent_r(struct hostent_data*);'
12126         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12127         esac
12128         case "$endhostent_r_proto" in
12129         ''|0) try='void endhostent_r(struct hostent_data*);'
12130         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12131         esac
12132         case "$endhostent_r_proto" in
12133         ''|0)   d_endhostent_r=undef
12134                 endhostent_r_proto=0
12135                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12136         * )     case "$endhostent_r_proto" in
12137                 REENTRANT_PROTO*) ;;
12138                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12139                 esac
12140                 echo "Prototype: $try" ;;
12141         esac
12142         ;;
12143         *)      case "$usethreads" in
12144                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12145                 esac
12146                 d_endhostent_r=undef
12147                 endhostent_r_proto=0
12148                 ;;
12149         esac
12150         ;;
12151 *)      endhostent_r_proto=0
12152         ;;
12153 esac
12154
12155 : see if endnetent exists
12156 set endnetent d_endnent
12157 eval $inlibc
12158
12159 : see if endnetent_r exists
12160 set endnetent_r d_endnetent_r
12161 eval $inlibc
12162 case "$d_endnetent_r" in
12163 "$define")
12164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12165         case "$d_endnetent_r_proto:$usethreads" in
12166         ":define")      d_endnetent_r_proto=define
12167                 set d_endnetent_r_proto endnetent_r $hdrs
12168                 eval $hasproto ;;
12169         *)      ;;
12170         esac
12171         case "$d_endnetent_r_proto" in
12172         define)
12173         case "$endnetent_r_proto" in
12174         ''|0) try='int endnetent_r(struct netent_data*);'
12175         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12176         esac
12177         case "$endnetent_r_proto" in
12178         ''|0) try='void endnetent_r(struct netent_data*);'
12179         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12180         esac
12181         case "$endnetent_r_proto" in
12182         ''|0)   d_endnetent_r=undef
12183                 endnetent_r_proto=0
12184                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12185         * )     case "$endnetent_r_proto" in
12186                 REENTRANT_PROTO*) ;;
12187                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12188                 esac
12189                 echo "Prototype: $try" ;;
12190         esac
12191         ;;
12192         *)      case "$usethreads" in
12193                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12194                 esac
12195                 d_endnetent_r=undef
12196                 endnetent_r_proto=0
12197                 ;;
12198         esac
12199         ;;
12200 *)      endnetent_r_proto=0
12201         ;;
12202 esac
12203
12204 : see if endprotoent exists
12205 set endprotoent d_endpent
12206 eval $inlibc
12207
12208 : see if endprotoent_r exists
12209 set endprotoent_r d_endprotoent_r
12210 eval $inlibc
12211 case "$d_endprotoent_r" in
12212 "$define")
12213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12214         case "$d_endprotoent_r_proto:$usethreads" in
12215         ":define")      d_endprotoent_r_proto=define
12216                 set d_endprotoent_r_proto endprotoent_r $hdrs
12217                 eval $hasproto ;;
12218         *)      ;;
12219         esac
12220         case "$d_endprotoent_r_proto" in
12221         define)
12222         case "$endprotoent_r_proto" in
12223         ''|0) try='int endprotoent_r(struct protoent_data*);'
12224         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12225         esac
12226         case "$endprotoent_r_proto" in
12227         ''|0) try='void endprotoent_r(struct protoent_data*);'
12228         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12229         esac
12230         case "$endprotoent_r_proto" in
12231         ''|0)   d_endprotoent_r=undef
12232                 endprotoent_r_proto=0
12233                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12234         * )     case "$endprotoent_r_proto" in
12235                 REENTRANT_PROTO*) ;;
12236                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12237                 esac
12238                 echo "Prototype: $try" ;;
12239         esac
12240         ;;
12241         *)      case "$usethreads" in
12242                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12243                 esac
12244                 d_endprotoent_r=undef
12245                 endprotoent_r_proto=0
12246                 ;;
12247         esac
12248         ;;
12249 *)      endprotoent_r_proto=0
12250         ;;
12251 esac
12252
12253 : see if endpwent exists
12254 set endpwent d_endpwent
12255 eval $inlibc
12256
12257 : see if this is a pwd.h system
12258 set pwd.h i_pwd
12259 eval $inhdr
12260
12261 case "$i_pwd" in
12262 $define)
12263         xxx=`./findhdr pwd.h`
12264         $cppstdin $cppflags $cppminus < $xxx >$$.h
12265
12266         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12267                 val="$define"
12268         else
12269                 val="$undef"
12270         fi
12271         set d_pwquota
12272         eval $setvar
12273
12274         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12275                 val="$define"
12276         else
12277                 val="$undef"
12278         fi
12279         set d_pwage
12280         eval $setvar
12281
12282         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12283                 val="$define"
12284         else
12285                 val="$undef"
12286         fi
12287         set d_pwchange
12288         eval $setvar
12289
12290         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12291                 val="$define"
12292         else
12293                 val="$undef"
12294         fi
12295         set d_pwclass
12296         eval $setvar
12297
12298         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12299                 val="$define"
12300         else
12301                 val="$undef"
12302         fi
12303         set d_pwexpire
12304         eval $setvar
12305
12306         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12307                 val="$define"
12308         else
12309                 val="$undef"
12310         fi
12311         set d_pwcomment
12312         eval $setvar
12313
12314         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12315                 val="$define"
12316         else
12317                 val="$undef"
12318         fi
12319         set d_pwgecos
12320         eval $setvar
12321
12322         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12323                 val="$define"
12324         else
12325                 val="$undef"
12326         fi
12327         set d_pwpasswd
12328         eval $setvar
12329
12330         $rm -f $$.h
12331         ;;
12332 *)
12333         val="$undef"; 
12334         set d_pwquota; eval $setvar
12335         set d_pwage; eval $setvar
12336         set d_pwchange; eval $setvar
12337         set d_pwclass; eval $setvar
12338         set d_pwexpire; eval $setvar
12339         set d_pwcomment; eval $setvar
12340         set d_pwgecos; eval $setvar
12341         set d_pwpasswd; eval $setvar
12342         ;;
12343 esac
12344
12345 : see if endpwent_r exists
12346 set endpwent_r d_endpwent_r
12347 eval $inlibc
12348 case "$d_endpwent_r" in
12349 "$define")
12350         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12351         case "$d_endpwent_r_proto:$usethreads" in
12352         ":define")      d_endpwent_r_proto=define
12353                 set d_endpwent_r_proto endpwent_r $hdrs
12354                 eval $hasproto ;;
12355         *)      ;;
12356         esac
12357         case "$d_endpwent_r_proto" in
12358         define)
12359         case "$endpwent_r_proto" in
12360         ''|0) try='int endpwent_r(FILE**);'
12361         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12362         esac
12363         case "$endpwent_r_proto" in
12364         ''|0) try='void endpwent_r(FILE**);'
12365         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12366         esac
12367         case "$endpwent_r_proto" in
12368         ''|0)   d_endpwent_r=undef
12369                 endpwent_r_proto=0
12370                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12371         * )     case "$endpwent_r_proto" in
12372                 REENTRANT_PROTO*) ;;
12373                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12374                 esac
12375                 echo "Prototype: $try" ;;
12376         esac
12377         ;;
12378         *)      case "$usethreads" in
12379                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12380                 esac
12381                 d_endpwent_r=undef
12382                 endpwent_r_proto=0
12383                 ;;
12384         esac
12385         ;;
12386 *)      endpwent_r_proto=0
12387         ;;
12388 esac
12389
12390 : see if endservent exists
12391 set endservent d_endsent
12392 eval $inlibc
12393
12394 : see if endservent_r exists
12395 set endservent_r d_endservent_r
12396 eval $inlibc
12397 case "$d_endservent_r" in
12398 "$define")
12399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12400         case "$d_endservent_r_proto:$usethreads" in
12401         ":define")      d_endservent_r_proto=define
12402                 set d_endservent_r_proto endservent_r $hdrs
12403                 eval $hasproto ;;
12404         *)      ;;
12405         esac
12406         case "$d_endservent_r_proto" in
12407         define)
12408         case "$endservent_r_proto" in
12409         ''|0) try='int endservent_r(struct servent_data*);'
12410         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12411         esac
12412         case "$endservent_r_proto" in
12413         ''|0) try='void endservent_r(struct servent_data*);'
12414         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12415         esac
12416         case "$endservent_r_proto" in
12417         ''|0)   d_endservent_r=undef
12418                 endservent_r_proto=0
12419                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12420         * )     case "$endservent_r_proto" in
12421                 REENTRANT_PROTO*) ;;
12422                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12423                 esac
12424                 echo "Prototype: $try" ;;
12425         esac
12426         ;;
12427         *)      case "$usethreads" in
12428                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12429                 esac
12430                 d_endservent_r=undef
12431                 endservent_r_proto=0
12432                 ;;
12433         esac
12434         ;;
12435 *)      endservent_r_proto=0
12436         ;;
12437 esac
12438
12439 : Locate the flags for 'open()'
12440 echo " "
12441 $cat >try.c <<EOCP
12442 #include <sys/types.h>
12443 #ifdef I_FCNTL
12444 #include <fcntl.h>
12445 #endif
12446 #ifdef I_SYS_FILE
12447 #include <sys/file.h>
12448 #endif
12449 #$i_stdlib I_STDLIB
12450 #ifdef I_STDLIB
12451 #include <stdlib.h>
12452 #endif
12453 int main() {
12454         if(O_RDONLY);
12455 #ifdef O_TRUNC
12456         exit(0);
12457 #else
12458         exit(1);
12459 #endif
12460 }
12461 EOCP
12462 : check sys/file.h first to get FREAD on Sun
12463 if $test `./findhdr sys/file.h` && \
12464                 set try -DI_SYS_FILE && eval $compile; then
12465         h_sysfile=true;
12466         echo "<sys/file.h> defines the O_* constants..." >&4
12467         if $run ./try; then
12468                 echo "and you have the 3 argument form of open()." >&4
12469                 val="$define"
12470         else
12471                 echo "but not the 3 argument form of open().  Oh, well." >&4
12472                 val="$undef"
12473         fi
12474 elif $test `./findhdr fcntl.h` && \
12475                 set try -DI_FCNTL && eval $compile; then
12476         h_fcntl=true;
12477         echo "<fcntl.h> defines the O_* constants..." >&4
12478         if $run ./try; then
12479                 echo "and you have the 3 argument form of open()." >&4
12480                 val="$define"
12481         else
12482                 echo "but not the 3 argument form of open().  Oh, well." >&4
12483                 val="$undef"
12484         fi
12485 else
12486         val="$undef"
12487         echo "I can't find the O_* constant definitions!  You got problems." >&4
12488 fi
12489 set d_open3
12490 eval $setvar
12491 $rm_try
12492
12493 : see if this is a sys/file.h system
12494 val=''
12495 set sys/file.h val
12496 eval $inhdr
12497
12498 : do we need to include sys/file.h ?
12499 case "$val" in
12500 "$define")
12501         echo " "
12502         if $h_sysfile; then
12503                 val="$define"
12504                 echo "We'll be including <sys/file.h>." >&4
12505         else
12506                 val="$undef"
12507                 echo "We won't be including <sys/file.h>." >&4
12508         fi
12509         ;;
12510 *)
12511         h_sysfile=false
12512         ;;
12513 esac
12514 set i_sysfile
12515 eval $setvar
12516
12517 : see if fcntl.h is there
12518 val=''
12519 set fcntl.h val
12520 eval $inhdr
12521
12522 : see if we can include fcntl.h
12523 case "$val" in
12524 "$define")
12525         echo " "
12526         if $h_fcntl; then
12527                 val="$define"
12528                 echo "We'll be including <fcntl.h>." >&4
12529         else
12530                 val="$undef"
12531                 if $h_sysfile; then
12532         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12533                 else
12534                         echo "We won't be including <fcntl.h>." >&4
12535                 fi
12536         fi
12537         ;;
12538 *)
12539         h_fcntl=false
12540         val="$undef"
12541         ;;
12542 esac
12543 set i_fcntl
12544 eval $setvar
12545
12546 : see if fork exists
12547 set fork d_fork
12548 eval $inlibc
12549
12550 : see if pipe exists
12551 set pipe d_pipe
12552 eval $inlibc
12553
12554 : check for non-blocking I/O stuff
12555 case "$h_sysfile" in
12556 true) echo "#include <sys/file.h>" > head.c;;
12557 *)
12558        case "$h_fcntl" in
12559        true) echo "#include <fcntl.h>" > head.c;;
12560        *) echo "#include <sys/fcntl.h>" > head.c;;
12561        esac
12562        ;;
12563 esac
12564 echo " "
12565 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12566 case "$o_nonblock" in
12567 '')
12568         $cat head.c > try.c
12569         $cat >>try.c <<EOCP
12570 #include <stdio.h>
12571 #$i_stdlib I_STDLIB
12572 #ifdef I_STDLIB
12573 #include <stdlib.h>
12574 #endif
12575 #$i_fcntl I_FCNTL
12576 #ifdef I_FCNTL
12577 #include <fcntl.h>
12578 #endif
12579 int main() {
12580 #ifdef O_NONBLOCK
12581         printf("O_NONBLOCK\n");
12582         exit(0);
12583 #endif
12584 #ifdef O_NDELAY
12585         printf("O_NDELAY\n");
12586         exit(0);
12587 #endif
12588 #ifdef FNDELAY
12589         printf("FNDELAY\n");
12590         exit(0);
12591 #endif
12592         exit(0);
12593 }
12594 EOCP
12595         set try
12596         if eval $compile_ok; then
12597                 o_nonblock=`$run ./try`
12598                 case "$o_nonblock" in
12599                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12600                 *) echo "Seems like we can use $o_nonblock.";;
12601                 esac
12602         else
12603                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12604         fi
12605         ;;
12606 *) echo "Using $hint value $o_nonblock.";;
12607 esac
12608 $rm_try
12609
12610 echo " "
12611 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12612 case "$eagain" in
12613 '')
12614         case "$d_fork:$d_pipe" in
12615         define:define)
12616         $cat head.c > try.c
12617         $cat >>try.c <<EOCP
12618 #include <errno.h>
12619 #include <sys/types.h>
12620 #include <signal.h>
12621 #include <stdio.h>
12622 #$i_stdlib I_STDLIB
12623 #ifdef I_STDLIB
12624 #include <stdlib.h>
12625 #endif
12626 #$i_fcntl I_FCNTL
12627 #ifdef I_FCNTL
12628 #include <fcntl.h>
12629 #endif
12630 #define MY_O_NONBLOCK $o_nonblock
12631 #ifndef errno  /* XXX need better Configure test */
12632 extern int errno;
12633 #endif
12634 #$i_unistd I_UNISTD
12635 #ifdef I_UNISTD
12636 #include <unistd.h>
12637 #endif
12638 #$i_string I_STRING
12639 #ifdef I_STRING
12640 #include <string.h>
12641 #else
12642 #include <strings.h>
12643 #endif
12644 $signal_t blech(int x) { exit(3); }
12645 EOCP
12646         $cat >> try.c <<'EOCP'
12647 int main()
12648 {
12649         int pd[2];
12650         int pu[2];
12651         char buf[1];
12652         char string[100];
12653
12654         pipe(pd);       /* Down: child -> parent */
12655         pipe(pu);       /* Up: parent -> child */
12656         if (0 != fork()) {
12657                 int ret;
12658                 close(pd[1]);   /* Parent reads from pd[0] */
12659                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12660 #ifdef F_SETFL
12661                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12662                         exit(1);
12663 #else
12664                 exit(4);
12665 #endif
12666                 signal(SIGALRM, blech);
12667                 alarm(5);
12668                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12669                         exit(2);
12670                 sprintf(string, "%d\n", ret);
12671                 write(2, string, strlen(string));
12672                 alarm(0);
12673 #ifdef EAGAIN
12674                 if (errno == EAGAIN) {
12675                         printf("EAGAIN\n");
12676                         goto ok;
12677                 }
12678 #endif
12679 #ifdef EWOULDBLOCK
12680                 if (errno == EWOULDBLOCK)
12681                         printf("EWOULDBLOCK\n");
12682 #endif
12683         ok:
12684                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12685                 sleep(2);                               /* Give it time to close our pipe */
12686                 alarm(5);
12687                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12688                 alarm(0);
12689                 sprintf(string, "%d\n", ret);
12690                 write(4, string, strlen(string));
12691                 exit(0);
12692         }
12693
12694         close(pd[0]);                   /* We write to pd[1] */
12695         close(pu[1]);                   /* We read from pu[0] */
12696         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12697         close(pd[1]);                   /* Pipe pd is now fully closed! */
12698         exit(0);                                /* Bye bye, thank you for playing! */
12699 }
12700 EOCP
12701         set try
12702         if eval $compile_ok; then
12703                 echo "$startsh" >mtry
12704                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12705                 chmod +x mtry
12706                 ./mtry >/dev/null 2>&1
12707                 case $? in
12708                 0) eagain=`$cat try.out`;;
12709                 1) echo "Could not perform non-blocking setting!";;
12710                 2) echo "I did a successful read() for something that was not there!";;
12711                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12712                 4) echo "Could not find F_SETFL!";;
12713                 *) echo "Something terribly wrong happened during testing.";;
12714                 esac
12715                 rd_nodata=`$cat try.ret`
12716                 echo "A read() system call with no data present returns $rd_nodata."
12717                 case "$rd_nodata" in
12718                 0|-1) ;;
12719                 *)
12720                         echo "(That's peculiar, fixing that to be -1.)"
12721                         rd_nodata=-1
12722                         ;;
12723                 esac
12724                 case "$eagain" in
12725                 '')
12726                         echo "Forcing errno EAGAIN on read() with no data available."
12727                         eagain=EAGAIN
12728                         ;;
12729                 *)
12730                         echo "Your read() sets errno to $eagain when no data is available."
12731                         ;;
12732                 esac
12733                 status=`$cat try.err`
12734                 case "$status" in
12735                 0) echo "And it correctly returns 0 to signal EOF.";;
12736                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12737                 *) echo "However, your read() returns '$status' on EOF??";;
12738                 esac
12739                 val="$define"
12740                 if test "$status" = "$rd_nodata"; then
12741                         echo "WARNING: you can't distinguish between EOF and no data!"
12742                         val="$undef"
12743                 fi
12744         else
12745                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12746                 eagain=EAGAIN
12747         fi
12748         ;;
12749         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12750                 eagain=EAGAIN
12751                 val="$define"
12752                 ;;
12753         esac
12754         set d_eofnblk
12755         eval $setvar
12756         ;;
12757 *)
12758         echo "Using $hint value $eagain."
12759         echo "Your read() returns $rd_nodata when no data is present."
12760         case "$d_eofnblk" in
12761         "$define") echo "And you can see EOF because read() returns 0.";;
12762         "$undef") echo "But you can't see EOF status from read() returned value.";;
12763         *)
12764                 echo "(Assuming you can't see EOF status from read anyway.)"
12765                 d_eofnblk=$undef
12766                 ;;
12767         esac
12768         ;;
12769 esac
12770 $rm_try head.c mtry
12771
12772 : see if _ptr and _cnt from stdio act std
12773 echo " "
12774
12775 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12776         echo "(Looks like you have stdio.h from BSD.)"
12777         case "$stdio_ptr" in
12778         '') stdio_ptr='((fp)->_p)'
12779                 ptr_lval=$define
12780                 ;;
12781         *)      ptr_lval=$d_stdio_ptr_lval;;
12782         esac
12783         case "$stdio_cnt" in
12784         '') stdio_cnt='((fp)->_r)'
12785                 cnt_lval=$define
12786                 ;;
12787         *)      cnt_lval=$d_stdio_cnt_lval;;
12788         esac
12789         case "$stdio_base" in
12790         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12791         esac
12792         case "$stdio_bufsiz" in
12793         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12794         esac
12795 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12796         echo "(Looks like you have stdio.h from Linux.)"
12797         case "$stdio_ptr" in
12798         '') stdio_ptr='((fp)->_IO_read_ptr)'
12799                 ptr_lval=$define
12800                 ;;
12801         *)      ptr_lval=$d_stdio_ptr_lval;;
12802         esac
12803         case "$stdio_cnt" in
12804         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12805                 cnt_lval=$undef
12806                 ;;
12807         *)      cnt_lval=$d_stdio_cnt_lval;;
12808         esac
12809         case "$stdio_base" in
12810         '') stdio_base='((fp)->_IO_read_base)';;
12811         esac
12812         case "$stdio_bufsiz" in
12813         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12814         esac
12815 else
12816         case "$stdio_ptr" in
12817         '') stdio_ptr='((fp)->_ptr)'
12818                 ptr_lval=$define
12819                 ;;
12820         *)      ptr_lval=$d_stdio_ptr_lval;;
12821         esac
12822         case "$stdio_cnt" in
12823         '') stdio_cnt='((fp)->_cnt)'
12824                 cnt_lval=$define
12825                 ;;
12826         *)      cnt_lval=$d_stdio_cnt_lval;;
12827         esac
12828         case "$stdio_base" in
12829         '') stdio_base='((fp)->_base)';;
12830         esac
12831         case "$stdio_bufsiz" in
12832         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12833         esac
12834 fi
12835
12836 : test whether _ptr and _cnt really work
12837 echo "Checking how std your stdio is..." >&4
12838 $cat >try.c <<EOP
12839 #include <stdio.h>
12840 #$i_stdlib I_STDLIB
12841 #ifdef I_STDLIB
12842 #include <stdlib.h>
12843 #endif
12844 #define FILE_ptr(fp)    $stdio_ptr
12845 #define FILE_cnt(fp)    $stdio_cnt
12846 int main() {
12847         FILE *fp = fopen("try.c", "r");
12848         char c = getc(fp);
12849         if (
12850                 18 <= FILE_cnt(fp) &&
12851                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12852         )
12853                 exit(0);
12854         exit(1);
12855 }
12856 EOP
12857 val="$undef"
12858 set try
12859 if eval $compile && $to try.c; then
12860         if $run ./try; then
12861                 echo "Your stdio acts pretty std."
12862                 val="$define"
12863         else
12864                 echo "Your stdio isn't very std."
12865         fi
12866 else
12867         echo "Your stdio doesn't appear very std."
12868 fi
12869 $rm_try
12870
12871 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12872 # direct buffer manipulation no longer works.  The Configure tests
12873 # should be changed to correctly detect this, but until then,
12874 # the following check should at least let perl compile and run.
12875 # (This quick fix should be updated before 5.8.1.)
12876 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12877 # A. Dougherty, June 3, 2002.
12878 case "$d_gnulibc" in
12879 $define)
12880         case "$gnulibc_version" in
12881         2.[01]*)  ;;
12882         2.2) ;;
12883         2.2.[0-9]) ;;
12884         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12885                 val="$undef"
12886                 ;;
12887         esac
12888         ;;
12889 esac
12890 set d_stdstdio
12891 eval $setvar
12892
12893 : Can _ptr be used as an lvalue?
12894 case "$d_stdstdio$ptr_lval" in
12895 $define$define) val=$define ;;
12896 *) val=$undef ;;
12897 esac
12898 set d_stdio_ptr_lval
12899 eval $setvar
12900
12901 : Can _cnt be used as an lvalue?
12902 case "$d_stdstdio$cnt_lval" in
12903 $define$define) val=$define ;;
12904 *) val=$undef ;;
12905 esac
12906 set d_stdio_cnt_lval
12907 eval $setvar
12908
12909
12910 : test whether setting _ptr sets _cnt as a side effect
12911 d_stdio_ptr_lval_sets_cnt="$undef"
12912 d_stdio_ptr_lval_nochange_cnt="$undef"
12913 case "$d_stdio_ptr_lval$d_stdstdio" in
12914 $define$define)
12915         echo "Checking to see what happens if we set the stdio ptr..." >&4
12916 $cat >try.c <<EOP
12917 #include <stdio.h>
12918 /* Can we scream? */
12919 /* Eat dust sed :-) */
12920 /* In the buffer space, no one can hear you scream. */
12921 #$i_stdlib I_STDLIB
12922 #ifdef I_STDLIB
12923 #include <stdlib.h>
12924 #endif
12925 #define FILE_ptr(fp)    $stdio_ptr
12926 #define FILE_cnt(fp)    $stdio_cnt
12927 #include <sys/types.h>
12928 int main() {
12929         FILE *fp = fopen("try.c", "r");
12930         int c;
12931         char *ptr;
12932         size_t cnt;
12933         if (!fp) {
12934             puts("Fail even to read");
12935             exit(1);
12936         }
12937         c = getc(fp); /* Read away the first # */
12938         if (c == EOF) {
12939             puts("Fail even to read");
12940             exit(1);
12941         }
12942         if (!(
12943                 18 <= FILE_cnt(fp) &&
12944                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12945         )) {
12946                 puts("Fail even to read");
12947                 exit (1);
12948         }
12949         ptr = (char*) FILE_ptr(fp);
12950         cnt = (size_t)FILE_cnt(fp);
12951
12952         FILE_ptr(fp) += 42;
12953
12954         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12955                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12956                 exit (1);
12957         }
12958         if (FILE_cnt(fp) <= 20) {
12959                 printf ("Fail (<20 chars to test)");
12960                 exit (1);
12961         }
12962         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12963                 puts("Fail compare");
12964                 exit (1);
12965         }
12966         if (cnt == FILE_cnt(fp)) {
12967                 puts("Pass_unchanged");
12968                 exit (0);
12969         }
12970         if (FILE_cnt(fp) == (cnt - 42)) {
12971                 puts("Pass_changed");
12972                 exit (0);
12973         }
12974         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12975         return 1;
12976
12977 }
12978 EOP
12979         set try
12980         if eval $compile && $to try.c; then
12981                 case `$run ./try` in
12982                 Pass_changed)
12983                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12984                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12985                 Pass_unchanged)
12986                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12987                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12988                 Fail*)
12989                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12990                 *)
12991                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12992         esac
12993         else
12994                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12995         fi
12996         $rm_try
12997         ;;
12998 esac
12999
13000 : see if _base is also standard
13001 val="$undef"
13002 case "$d_stdstdio" in
13003 $define)
13004         $cat >try.c <<EOP
13005 #include <stdio.h>
13006 #$i_stdlib I_STDLIB
13007 #ifdef I_STDLIB
13008 #include <stdlib.h>
13009 #endif
13010 #define FILE_base(fp)   $stdio_base
13011 #define FILE_bufsiz(fp) $stdio_bufsiz
13012 int main() {
13013         FILE *fp = fopen("try.c", "r");
13014         char c = getc(fp);
13015         if (
13016                 19 <= FILE_bufsiz(fp) &&
13017                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13018         )
13019                 exit(0);
13020         exit(1);
13021 }
13022 EOP
13023         set try
13024         if eval $compile && $to try.c; then
13025                 if $run ./try; then
13026                         echo "And its _base field acts std."
13027                         val="$define"
13028                 else
13029                         echo "But its _base field isn't std."
13030                 fi
13031         else
13032                 echo "However, it seems to be lacking the _base field."
13033         fi
13034         $rm_try
13035         ;;
13036 esac
13037 set d_stdiobase
13038 eval $setvar
13039
13040 : see if fast_stdio exists
13041 val="$undef"
13042 case "$d_stdstdio:$d_stdio_ptr_lval" in
13043 "$define:$define")
13044         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13045         *$define*)
13046                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13047                 val="$define"
13048                 ;;
13049         esac
13050         ;;
13051 esac
13052 set d_faststdio
13053 eval $setvar
13054
13055
13056
13057 : see if fchdir exists
13058 set fchdir d_fchdir
13059 eval $inlibc
13060
13061 : see if fchmod exists
13062 set fchmod d_fchmod
13063 eval $inlibc
13064
13065 : see if fchown exists
13066 set fchown d_fchown
13067 eval $inlibc
13068
13069 : see if this is an fcntl system
13070 set fcntl d_fcntl
13071 eval $inlibc
13072
13073 : See if fcntl-based locking works.
13074 echo " "
13075 $cat >try.c <<EOCP
13076 #$i_stdlib I_STDLIB
13077 #ifdef I_STDLIB
13078 #include <stdlib.h>
13079 #endif
13080 #include <unistd.h>
13081 #include <fcntl.h>
13082 #include <signal.h>
13083 $signal_t blech(int x) { exit(3); }
13084 int main() {
13085 #if defined(F_SETLK) && defined(F_SETLKW)
13086      struct flock flock;
13087      int retval, fd;
13088      fd = open("try.c", O_RDONLY);
13089      flock.l_type = F_RDLCK;
13090      flock.l_whence = SEEK_SET;
13091      flock.l_start = flock.l_len = 0;
13092      signal(SIGALRM, blech);
13093      alarm(10);
13094      retval = fcntl(fd, F_SETLK, &flock);
13095      close(fd);
13096      (retval < 0 ? exit(2) : exit(0));
13097 #else
13098      exit(2);
13099 #endif
13100 }
13101 EOCP
13102 echo "Checking if fcntl-based file locking works... "
13103 case "$d_fcntl" in
13104 "$define")
13105         set try
13106         if eval $compile_ok; then
13107                 if $run ./try; then
13108                         echo "Yes, it seems to work."
13109                         val="$define"
13110                 else
13111                         echo "Nope, it didn't work."
13112                         val="$undef"
13113                         case "$?" in
13114                         3) $cat >&4 <<EOM
13115 ***
13116 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13117 *** This is (almost) impossible.
13118 *** If your NFS lock daemons are not feeling well, something like
13119 *** this may happen, please investigate.  Cannot continue, aborting.
13120 ***
13121 EOM
13122                                 exit 1
13123                                 ;;
13124                         esac
13125                 fi
13126         else
13127                 echo "I'm unable to compile the test program, so I'll assume not."
13128                 val="$undef"
13129         fi
13130         ;;
13131 *) val="$undef";
13132         echo "Nope, since you don't even have fcntl()."
13133         ;;
13134 esac
13135 set d_fcntl_can_lock
13136 eval $setvar
13137 $rm_try
13138
13139 : check for fd_set items
13140 $cat <<EOM
13141
13142 Checking to see how well your C compiler handles fd_set and friends ...
13143 EOM
13144 $cat >try.c <<EOCP
13145 #$i_stdlib I_STDLIB
13146 #ifdef I_STDLIB
13147 #include <stdlib.h>
13148 #endif
13149 #$i_systime I_SYS_TIME
13150 #$i_sysselct I_SYS_SELECT
13151 #$d_socket HAS_SOCKET
13152 #include <sys/types.h>
13153 #ifdef HAS_SOCKET
13154 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13155 #endif
13156 #ifdef I_SYS_TIME
13157 #include <sys/time.h>
13158 #endif
13159 #ifdef I_SYS_SELECT
13160 #include <sys/select.h>
13161 #endif
13162 int main() {
13163         fd_set fds;
13164
13165 #ifdef TRYBITS
13166         if(fds.fds_bits);
13167 #endif
13168
13169 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13170         exit(0);
13171 #else
13172         exit(1);
13173 #endif
13174 }
13175 EOCP
13176 set try -DTRYBITS
13177 if eval $compile; then
13178         d_fds_bits="$define"
13179         d_fd_set="$define"
13180         echo "Well, your system knows about the normal fd_set typedef..." >&4
13181         if $run ./try; then
13182                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13183                 d_fd_macros="$define"
13184         else
13185                 $cat >&4 <<'EOM'
13186 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13187 EOM
13188                 d_fd_macros="$undef"
13189         fi
13190 else
13191         $cat <<'EOM'
13192 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13193 EOM
13194         set try
13195         if eval $compile; then
13196                 d_fds_bits="$undef"
13197                 d_fd_set="$define"
13198                 echo "Well, your system has some sort of fd_set available..." >&4
13199                 if $run ./try; then
13200                         echo "and you have the normal fd_set macros." >&4
13201                         d_fd_macros="$define"
13202                 else
13203                         $cat <<'EOM'
13204 but not the normal fd_set macros!  Gross!  More work for me...
13205 EOM
13206                         d_fd_macros="$undef"
13207                 fi
13208         else
13209         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13210                 d_fd_set="$undef"
13211                 d_fds_bits="$undef"
13212                 d_fd_macros="$undef"
13213         fi
13214 fi
13215 $rm_try
13216
13217 : see if fgetpos exists
13218 set fgetpos d_fgetpos
13219 eval $inlibc
13220
13221 : see if finite exists
13222 set finite d_finite
13223 eval $inlibc
13224
13225 : see if finitel exists
13226 set finitel d_finitel
13227 eval $inlibc
13228
13229 : see if flock exists
13230 set flock d_flock
13231 eval $inlibc
13232
13233 : see if prototype for flock is available
13234 echo " "
13235 set d_flockproto flock $i_sysfile sys/file.h
13236 eval $hasproto
13237
13238 : see if fp_class exists
13239 set fp_class d_fp_class
13240 eval $inlibc
13241
13242 : see if pathconf exists
13243 set pathconf d_pathconf
13244 eval $inlibc
13245
13246 : see if fpathconf exists
13247 set fpathconf d_fpathconf
13248 eval $inlibc
13249
13250 : see if fpclass exists
13251 set fpclass d_fpclass
13252 eval $inlibc
13253
13254 : see if fpclassify exists
13255 set fpclassify d_fpclassify
13256 eval $inlibc
13257
13258 : see if fpclassl exists
13259 set fpclassl d_fpclassl
13260 eval $inlibc
13261
13262 : check for fpos64_t
13263 echo " "
13264 echo "Checking to see if you have fpos64_t..." >&4
13265 $cat >try.c <<EOCP
13266 #include <stdio.h>
13267 int main() { fpos64_t x = 7; }
13268 EOCP
13269 set try
13270 if eval $compile; then
13271         val="$define"
13272         echo "You have fpos64_t."
13273 else
13274         val="$undef"
13275         echo "You do not have fpos64_t."
13276         case "$fpossize" in
13277         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13278         esac
13279 fi
13280 $rm_try
13281 set d_fpos64_t
13282 eval $setvar
13283
13284 : see if frexpl exists
13285 set frexpl d_frexpl
13286 eval $inlibc
13287
13288 : see if this is a sys/param system
13289 set sys/param.h i_sysparam
13290 eval $inhdr
13291
13292 : see if this is a sys/mount.h system
13293 set sys/mount.h i_sysmount
13294 eval $inhdr
13295
13296 : Check for fs_data_s
13297 echo " "
13298 echo "Checking to see if your system supports struct fs_data..." >&4
13299 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13300 eval $hasstruct
13301 case "$d_fs_data_s" in
13302 "$define")      echo "Yes, it does."   ;;
13303 *)              echo "No, it doesn't." ;;
13304 esac
13305
13306 : see if fseeko exists
13307 set fseeko d_fseeko
13308 eval $inlibc
13309 case "$longsize" in
13310 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13311 esac
13312
13313 : see if fsetpos exists
13314 set fsetpos d_fsetpos
13315 eval $inlibc
13316
13317 : see if fstatfs exists
13318 set fstatfs d_fstatfs
13319 eval $inlibc
13320
13321 : see if statvfs exists
13322 set statvfs d_statvfs
13323 eval $inlibc
13324
13325 : see if fstatvfs exists
13326 set fstatvfs d_fstatvfs
13327 eval $inlibc
13328
13329
13330 : see if fsync exists
13331 set fsync d_fsync
13332 eval $inlibc
13333
13334 : see if ftello exists
13335 set ftello d_ftello
13336 eval $inlibc
13337 case "$longsize" in
13338 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13339 esac
13340
13341 : check for a working futimes
13342 d_futimes="$undef"
13343 echo " "
13344 echo "Checking if you have a working futimes()" >&4
13345 $cat >try.c <<EOCP
13346 #include <stdio.h>
13347 #include <sys/time.h>
13348 #include <errno.h>
13349 #include <fcntl.h>
13350
13351 int main ()
13352 {
13353     int fd, rv;
13354     fd = open ("try.c", O_RDWR);
13355     if (-1 == fd) exit (1);
13356     rv = futimes (fd, NULL);
13357     exit (rv == -1 ? errno : 0);
13358 }
13359 EOCP
13360 set try
13361 if eval $compile; then
13362     `$run ./try`
13363     rc=$?
13364     case "$rc" in
13365         0)  echo "Yes, you have" >&4
13366             d_futimes="$define"
13367             ;;
13368         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13369             ;;
13370     esac
13371 else
13372     echo "No, it does not (probably harmless)" >&4
13373 fi
13374 $rm_try
13375
13376 : see if ndbm.h is available
13377 set ndbm.h i_ndbm
13378 eval $inhdr
13379 : Compatibility location for RedHat 7.1
13380 set gdbm/ndbm.h i_gdbmndbm
13381 eval $inhdr
13382 : Compatibility location for Debian 4.0
13383 set gdbm-ndbm.h i_gdbm_ndbm
13384 eval $inhdr
13385
13386 val="$undef"
13387 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13388         : see if dbm_open exists
13389         set dbm_open d_dbm_open
13390         eval $inlibc
13391         case "$d_dbm_open" in
13392         $undef)
13393                 i_ndbm="$undef"
13394                 i_gdbmndbm="$undef"
13395                 i_gdbm_ndbm="$undef"
13396                 echo "We won't be including <ndbm.h>"
13397                 val="$undef"
13398                 ;;
13399         *) val="$define"
13400            ;;
13401         esac
13402 fi
13403 set d_ndbm
13404 eval $setvar
13405
13406 ndbm_hdr_protochk='name=$1; hdr=$2;
13407 eval "ihdr=\$""i_$name";
13408 val="$undef";
13409 if $test "$ihdr" = "$define"; then
13410         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13411         case "$d_cplusplus" in
13412         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13413         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13414         esac;
13415         case "$val" in
13416         $define) $echo "Your <$hdr> seems to have prototypes";;
13417         *) $echo "Your <$hdr> does not seem to have prototypes";;
13418         esac;
13419 fi;
13420 set "d_${name}_h_uses_prototypes";
13421 eval $setvar'
13422
13423 set ndbm ndbm.h
13424 eval $ndbm_hdr_protochk
13425 set gdbmndbm gdbm/ndbm.h
13426 eval $ndbm_hdr_protochk
13427 set gdbm_ndbm gdbm-ndbm.h
13428 eval $ndbm_hdr_protochk
13429
13430 : see if getaddrinfo exists
13431 set getaddrinfo d_getaddrinfo
13432 eval $inlibc
13433
13434 : see if getcwd exists
13435 set getcwd d_getcwd
13436 eval $inlibc
13437
13438 : see if getespwnam exists
13439 set getespwnam d_getespwnam
13440 eval $inlibc
13441
13442 : see if getfsstat exists
13443 set getfsstat d_getfsstat
13444 eval $inlibc
13445
13446 : see if getgrent exists
13447 set getgrent d_getgrent
13448 eval $inlibc
13449
13450 : see if getgrent_r exists
13451 set getgrent_r d_getgrent_r
13452 eval $inlibc
13453 case "$d_getgrent_r" in
13454 "$define")
13455         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13456         case "$d_getgrent_r_proto:$usethreads" in
13457         ":define")      d_getgrent_r_proto=define
13458                 set d_getgrent_r_proto getgrent_r $hdrs
13459                 eval $hasproto ;;
13460         *)      ;;
13461         esac
13462         case "$d_getgrent_r_proto" in
13463         define)
13464         case "$getgrent_r_proto" in
13465         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13466         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13467         esac
13468         case "$getgrent_r_proto" in
13469         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13470         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13471         esac
13472         case "$getgrent_r_proto" in
13473         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13474         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13475         esac
13476         case "$getgrent_r_proto" in
13477         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13478         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13479         esac
13480         case "$getgrent_r_proto" in
13481         ''|0) try='int getgrent_r(struct group*, char*, int);'
13482         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13483         esac
13484         case "$getgrent_r_proto" in
13485         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13486         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13487         esac
13488         case "$getgrent_r_proto" in
13489         ''|0)   d_getgrent_r=undef
13490                 getgrent_r_proto=0
13491                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13492         * )     case "$getgrent_r_proto" in
13493                 REENTRANT_PROTO*) ;;
13494                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13495                 esac
13496                 echo "Prototype: $try" ;;
13497         esac
13498         ;;
13499         *)      case "$usethreads" in
13500                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13501                 esac
13502                 d_getgrent_r=undef
13503                 getgrent_r_proto=0
13504                 ;;
13505         esac
13506         ;;
13507 *)      getgrent_r_proto=0
13508         ;;
13509 esac
13510
13511 : see if getgrgid_r exists
13512 set getgrgid_r d_getgrgid_r
13513 eval $inlibc
13514 case "$d_getgrgid_r" in
13515 "$define")
13516         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13517         case "$d_getgrgid_r_proto:$usethreads" in
13518         ":define")      d_getgrgid_r_proto=define
13519                 set d_getgrgid_r_proto getgrgid_r $hdrs
13520                 eval $hasproto ;;
13521         *)      ;;
13522         esac
13523         case "$d_getgrgid_r_proto" in
13524         define)
13525         case "$getgrgid_r_proto" in
13526         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13527         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13528         esac
13529         case "$getgrgid_r_proto" in
13530         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13531         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13532         esac
13533         case "$getgrgid_r_proto" in
13534         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13535         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13536         esac
13537         case "$getgrgid_r_proto" in
13538         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13539         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13540         esac
13541         case "$getgrgid_r_proto" in
13542         ''|0)   d_getgrgid_r=undef
13543                 getgrgid_r_proto=0
13544                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13545         * )     case "$getgrgid_r_proto" in
13546                 REENTRANT_PROTO*) ;;
13547                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13548                 esac
13549                 echo "Prototype: $try" ;;
13550         esac
13551         ;;
13552         *)      case "$usethreads" in
13553                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13554                 esac
13555                 d_getgrgid_r=undef
13556                 getgrgid_r_proto=0
13557                 ;;
13558         esac
13559         ;;
13560 *)      getgrgid_r_proto=0
13561         ;;
13562 esac
13563
13564 : see if getgrnam_r exists
13565 set getgrnam_r d_getgrnam_r
13566 eval $inlibc
13567 case "$d_getgrnam_r" in
13568 "$define")
13569         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13570         case "$d_getgrnam_r_proto:$usethreads" in
13571         ":define")      d_getgrnam_r_proto=define
13572                 set d_getgrnam_r_proto getgrnam_r $hdrs
13573                 eval $hasproto ;;
13574         *)      ;;
13575         esac
13576         case "$d_getgrnam_r_proto" in
13577         define)
13578         case "$getgrnam_r_proto" in
13579         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13580         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13581         esac
13582         case "$getgrnam_r_proto" in
13583         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13584         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13585         esac
13586         case "$getgrnam_r_proto" in
13587         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13588         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13589         esac
13590         case "$getgrnam_r_proto" in
13591         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13592         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13593         esac
13594         case "$getgrnam_r_proto" in
13595         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13596         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13597         esac
13598         case "$getgrnam_r_proto" in
13599         ''|0)   d_getgrnam_r=undef
13600                 getgrnam_r_proto=0
13601                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13602         * )     case "$getgrnam_r_proto" in
13603                 REENTRANT_PROTO*) ;;
13604                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13605                 esac
13606                 echo "Prototype: $try" ;;
13607         esac
13608         ;;
13609         *)      case "$usethreads" in
13610                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13611                 esac
13612                 d_getgrnam_r=undef
13613                 getgrnam_r_proto=0
13614                 ;;
13615         esac
13616         ;;
13617 *)      getgrnam_r_proto=0
13618         ;;
13619 esac
13620
13621 : see if gethostbyaddr exists
13622 set gethostbyaddr d_gethbyaddr
13623 eval $inlibc
13624
13625 : see if gethostbyname exists
13626 set gethostbyname d_gethbyname
13627 eval $inlibc
13628
13629 : see if gethostent exists
13630 set gethostent d_gethent
13631 eval $inlibc
13632
13633 : see how we will look up host name
13634 echo " "
13635 call=''
13636 if set gethostname val -f d_gethname; eval $csym; $val; then
13637         echo 'gethostname() found.' >&4
13638         d_gethname="$define"
13639         call=gethostname
13640 fi
13641 if set uname val -f d_uname; eval $csym; $val; then
13642         if ./xenix; then
13643                 $cat <<'EOM'
13644 uname() was found, but you're running xenix, and older versions of xenix
13645 have a broken uname(). If you don't really know whether your xenix is old
13646 enough to have a broken system call, use the default answer.
13647
13648 EOM
13649                 dflt=y
13650                 case "$d_uname" in
13651                 "$define") dflt=n;;
13652                 esac
13653                 rp='Is your uname() broken?'
13654                 . ./myread
13655                 case "$ans" in
13656                 n*) d_uname="$define"; call=uname;;
13657                 esac
13658         else
13659                 echo 'uname() found.' >&4
13660                 d_uname="$define"
13661                 case "$call" in
13662                 '') call=uname ;;
13663                 esac
13664         fi
13665 fi
13666 case "$d_gethname" in
13667 '') d_gethname="$undef";;
13668 esac
13669 case "$d_uname" in
13670 '') d_uname="$undef";;
13671 esac
13672 case "$d_uname$d_gethname" in
13673 *define*)
13674         dflt=n
13675         cat <<EOM
13676
13677 Every now and then someone has a $call() that lies about the hostname
13678 but can't be fixed for political or economic reasons.  If you wish, I can
13679 pretend $call() isn't there and maybe compute hostname at run-time
13680 thanks to the '$phostname' command.
13681
13682 EOM
13683         rp="Shall I ignore $call() from now on?"
13684         . ./myread
13685         case "$ans" in
13686         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13687         esac;;
13688 esac
13689 case "$phostname" in
13690 '') aphostname='';;
13691 *) case "$aphostname" in
13692         /*) ;;
13693         *) set X $phostname
13694                 shift
13695                 file=$1
13696                 shift
13697                 file=`./loc $file $file $pth`
13698                 aphostname=`echo $file $*`
13699                 ;;
13700         esac
13701         ;;
13702 esac
13703 case "$d_uname$d_gethname" in
13704 *define*) ;;
13705 *)
13706         case "$phostname" in
13707         '')
13708                 echo "There will be no way for $package to get your hostname." >&4;;
13709         *)
13710         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13711                 ;;
13712         esac;;
13713 esac
13714 case "$d_phostname" in
13715 '') d_phostname="$undef";;
13716 esac
13717
13718 : see if gethostbyaddr_r exists
13719 set gethostbyaddr_r d_gethostbyaddr_r
13720 eval $inlibc
13721 case "$d_gethostbyaddr_r" in
13722 "$define")
13723         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13724         case "$d_gethostbyaddr_r_proto:$usethreads" in
13725         ":define")      d_gethostbyaddr_r_proto=define
13726                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13727                 eval $hasproto ;;
13728         *)      ;;
13729         esac
13730         case "$d_gethostbyaddr_r_proto" in
13731         define)
13732         case "$gethostbyaddr_r_proto" in
13733         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13734         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13735         esac
13736         case "$gethostbyaddr_r_proto" in
13737         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13738         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13739         esac
13740         case "$gethostbyaddr_r_proto" in
13741         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13742         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13743         esac
13744         case "$gethostbyaddr_r_proto" in
13745         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13746         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13747         esac
13748         case "$gethostbyaddr_r_proto" in
13749         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13750         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13751         esac
13752         case "$gethostbyaddr_r_proto" in
13753         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13754         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13755         esac
13756         case "$gethostbyaddr_r_proto" in
13757         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13758         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13759         esac
13760         case "$gethostbyaddr_r_proto" in
13761         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13762         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13763         esac
13764         case "$gethostbyaddr_r_proto" in
13765         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13766         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13767         esac
13768         case "$gethostbyaddr_r_proto" in
13769         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13770         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13771         esac
13772         case "$gethostbyaddr_r_proto" in
13773         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13774         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13775         esac
13776         case "$gethostbyaddr_r_proto" in
13777         ''|0)   d_gethostbyaddr_r=undef
13778                 gethostbyaddr_r_proto=0
13779                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13780         * )     case "$gethostbyaddr_r_proto" in
13781                 REENTRANT_PROTO*) ;;
13782                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13783                 esac
13784                 echo "Prototype: $try" ;;
13785         esac
13786         ;;
13787         *)      case "$usethreads" in
13788                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13789                 esac
13790                 d_gethostbyaddr_r=undef
13791                 gethostbyaddr_r_proto=0
13792                 ;;
13793         esac
13794         ;;
13795 *)      gethostbyaddr_r_proto=0
13796         ;;
13797 esac
13798
13799 : see if gethostbyname_r exists
13800 set gethostbyname_r d_gethostbyname_r
13801 eval $inlibc
13802 case "$d_gethostbyname_r" in
13803 "$define")
13804         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13805         case "$d_gethostbyname_r_proto:$usethreads" in
13806         ":define")      d_gethostbyname_r_proto=define
13807                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13808                 eval $hasproto ;;
13809         *)      ;;
13810         esac
13811         case "$d_gethostbyname_r_proto" in
13812         define)
13813         case "$gethostbyname_r_proto" in
13814         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13815         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13816         esac
13817         case "$gethostbyname_r_proto" in
13818         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13819         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13820         esac
13821         case "$gethostbyname_r_proto" in
13822         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13823         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13824         esac
13825         case "$gethostbyname_r_proto" in
13826         ''|0)   d_gethostbyname_r=undef
13827                 gethostbyname_r_proto=0
13828                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13829         * )     case "$gethostbyname_r_proto" in
13830                 REENTRANT_PROTO*) ;;
13831                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13832                 esac
13833                 echo "Prototype: $try" ;;
13834         esac
13835         ;;
13836         *)      case "$usethreads" in
13837                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13838                 esac
13839                 d_gethostbyname_r=undef
13840                 gethostbyname_r_proto=0
13841                 ;;
13842         esac
13843         ;;
13844 *)      gethostbyname_r_proto=0
13845         ;;
13846 esac
13847
13848 : see if gethostent_r exists
13849 set gethostent_r d_gethostent_r
13850 eval $inlibc
13851 case "$d_gethostent_r" in
13852 "$define")
13853         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13854         case "$d_gethostent_r_proto:$usethreads" in
13855         ":define")      d_gethostent_r_proto=define
13856                 set d_gethostent_r_proto gethostent_r $hdrs
13857                 eval $hasproto ;;
13858         *)      ;;
13859         esac
13860         case "$d_gethostent_r_proto" in
13861         define)
13862         case "$gethostent_r_proto" in
13863         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13864         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13865         esac
13866         case "$gethostent_r_proto" in
13867         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13868         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13869         esac
13870         case "$gethostent_r_proto" in
13871         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13872         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13873         esac
13874         case "$gethostent_r_proto" in
13875         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13876         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13877         esac
13878         case "$gethostent_r_proto" in
13879         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13880         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13881         esac
13882         case "$gethostent_r_proto" in
13883         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13884         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13885         esac
13886         case "$gethostent_r_proto" in
13887         ''|0)   d_gethostent_r=undef
13888                 gethostent_r_proto=0
13889                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13890         * )     case "$gethostent_r_proto" in
13891                 REENTRANT_PROTO*) ;;
13892                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13893                 esac
13894                 echo "Prototype: $try" ;;
13895         esac
13896         ;;
13897         *)      case "$usethreads" in
13898                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13899                 esac
13900                 d_gethostent_r=undef
13901                 gethostent_r_proto=0
13902                 ;;
13903         esac
13904         ;;
13905 *)      gethostent_r_proto=0
13906         ;;
13907 esac
13908
13909 : see if prototypes for various gethostxxx netdb.h functions are available
13910 echo " "
13911 set d_gethostprotos gethostent $i_netdb netdb.h
13912 eval $hasproto
13913
13914 : see if getitimer exists
13915 set getitimer d_getitimer
13916 eval $inlibc
13917
13918 : see if getlogin exists
13919 set getlogin d_getlogin
13920 eval $inlibc
13921
13922 : see if getlogin_r exists
13923 set getlogin_r d_getlogin_r
13924 eval $inlibc
13925 case "$d_getlogin_r" in
13926 "$define")
13927         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13928         case "$d_getlogin_r_proto:$usethreads" in
13929         ":define")      d_getlogin_r_proto=define
13930                 set d_getlogin_r_proto getlogin_r $hdrs
13931                 eval $hasproto ;;
13932         *)      ;;
13933         esac
13934         case "$d_getlogin_r_proto" in
13935         define)
13936         case "$getlogin_r_proto" in
13937         ''|0) try='int getlogin_r(char*, size_t);'
13938         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13939         esac
13940         case "$getlogin_r_proto" in
13941         ''|0) try='int getlogin_r(char*, int);'
13942         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13943         esac
13944         case "$getlogin_r_proto" in
13945         ''|0) try='char* getlogin_r(char*, size_t);'
13946         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13947         esac
13948         case "$getlogin_r_proto" in
13949         ''|0) try='char* getlogin_r(char*, int);'
13950         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13951         esac
13952         case "$getlogin_r_proto" in
13953         ''|0)   d_getlogin_r=undef
13954                 getlogin_r_proto=0
13955                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13956         * )     case "$getlogin_r_proto" in
13957                 REENTRANT_PROTO*) ;;
13958                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13959                 esac
13960                 echo "Prototype: $try" ;;
13961         esac
13962         ;;
13963         *)      case "$usethreads" in
13964                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13965                 esac
13966                 d_getlogin_r=undef
13967                 getlogin_r_proto=0
13968                 ;;
13969         esac
13970         ;;
13971 *)      getlogin_r_proto=0
13972         ;;
13973 esac
13974
13975 : see if getmnt exists
13976 set getmnt d_getmnt
13977 eval $inlibc
13978
13979 : see if getmntent exists
13980 set getmntent d_getmntent
13981 eval $inlibc
13982
13983 : see if getnameinfo exists
13984 set getnameinfo d_getnameinfo
13985 eval $inlibc
13986
13987 : see if getnetbyaddr exists
13988 set getnetbyaddr d_getnbyaddr
13989 eval $inlibc
13990
13991 : see if getnetbyname exists
13992 set getnetbyname d_getnbyname
13993 eval $inlibc
13994
13995 : see if getnetent exists
13996 set getnetent d_getnent
13997 eval $inlibc
13998
13999 : see if getnetbyaddr_r exists
14000 set getnetbyaddr_r d_getnetbyaddr_r
14001 eval $inlibc
14002 case "$d_getnetbyaddr_r" in
14003 "$define")
14004         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14005         case "$d_getnetbyaddr_r_proto:$usethreads" in
14006         ":define")      d_getnetbyaddr_r_proto=define
14007                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14008                 eval $hasproto ;;
14009         *)      ;;
14010         esac
14011         case "$d_getnetbyaddr_r_proto" in
14012         define)
14013         case "$getnetbyaddr_r_proto" in
14014         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14015         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14016         esac
14017         case "$getnetbyaddr_r_proto" in
14018         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14019         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14020         esac
14021         case "$getnetbyaddr_r_proto" in
14022         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14023         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14024         esac
14025         case "$getnetbyaddr_r_proto" in
14026         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14027         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14028         esac
14029         case "$getnetbyaddr_r_proto" in
14030         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14031         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14032         esac
14033         case "$getnetbyaddr_r_proto" in
14034         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14035         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14036         esac
14037         case "$getnetbyaddr_r_proto" in
14038         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14039         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14040         esac
14041         case "$getnetbyaddr_r_proto" in
14042         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14043         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14044         esac
14045         case "$getnetbyaddr_r_proto" in
14046         ''|0)   d_getnetbyaddr_r=undef
14047                 getnetbyaddr_r_proto=0
14048                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14049         * )     case "$getnetbyaddr_r_proto" in
14050                 REENTRANT_PROTO*) ;;
14051                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14052                 esac
14053                 echo "Prototype: $try" ;;
14054         esac
14055         ;;
14056         *)      case "$usethreads" in
14057                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14058                 esac
14059                 d_getnetbyaddr_r=undef
14060                 getnetbyaddr_r_proto=0
14061                 ;;
14062         esac
14063         ;;
14064 *)      getnetbyaddr_r_proto=0
14065         ;;
14066 esac
14067
14068 : see if getnetbyname_r exists
14069 set getnetbyname_r d_getnetbyname_r
14070 eval $inlibc
14071 case "$d_getnetbyname_r" in
14072 "$define")
14073         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14074         case "$d_getnetbyname_r_proto:$usethreads" in
14075         ":define")      d_getnetbyname_r_proto=define
14076                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14077                 eval $hasproto ;;
14078         *)      ;;
14079         esac
14080         case "$d_getnetbyname_r_proto" in
14081         define)
14082         case "$getnetbyname_r_proto" in
14083         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14084         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14085         esac
14086         case "$getnetbyname_r_proto" in
14087         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14088         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14089         esac
14090         case "$getnetbyname_r_proto" in
14091         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14092         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14093         esac
14094         case "$getnetbyname_r_proto" in
14095         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14096         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14097         esac
14098         case "$getnetbyname_r_proto" in
14099         ''|0)   d_getnetbyname_r=undef
14100                 getnetbyname_r_proto=0
14101                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14102         * )     case "$getnetbyname_r_proto" in
14103                 REENTRANT_PROTO*) ;;
14104                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14105                 esac
14106                 echo "Prototype: $try" ;;
14107         esac
14108         ;;
14109         *)      case "$usethreads" in
14110                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14111                 esac
14112                 d_getnetbyname_r=undef
14113                 getnetbyname_r_proto=0
14114                 ;;
14115         esac
14116         ;;
14117 *)      getnetbyname_r_proto=0
14118         ;;
14119 esac
14120
14121 : see if getnetent_r exists
14122 set getnetent_r d_getnetent_r
14123 eval $inlibc
14124 case "$d_getnetent_r" in
14125 "$define")
14126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14127         case "$d_getnetent_r_proto:$usethreads" in
14128         ":define")      d_getnetent_r_proto=define
14129                 set d_getnetent_r_proto getnetent_r $hdrs
14130                 eval $hasproto ;;
14131         *)      ;;
14132         esac
14133         case "$d_getnetent_r_proto" in
14134         define)
14135         case "$getnetent_r_proto" in
14136         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14137         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14138         esac
14139         case "$getnetent_r_proto" in
14140         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14141         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14142         esac
14143         case "$getnetent_r_proto" in
14144         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14145         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14146         esac
14147         case "$getnetent_r_proto" in
14148         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14149         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14150         esac
14151         case "$getnetent_r_proto" in
14152         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14153         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14154         esac
14155         case "$getnetent_r_proto" in
14156         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14157         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14158         esac
14159         case "$getnetent_r_proto" in
14160         ''|0)   d_getnetent_r=undef
14161                 getnetent_r_proto=0
14162                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14163         * )     case "$getnetent_r_proto" in
14164                 REENTRANT_PROTO*) ;;
14165                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14166                 esac
14167                 echo "Prototype: $try" ;;
14168         esac
14169         ;;
14170         *)      case "$usethreads" in
14171                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14172                 esac
14173                 d_getnetent_r=undef
14174                 getnetent_r_proto=0
14175                 ;;
14176         esac
14177         ;;
14178 *)      getnetent_r_proto=0
14179         ;;
14180 esac
14181
14182 : see if prototypes for various getnetxxx netdb.h functions are available
14183 echo " "
14184 set d_getnetprotos getnetent $i_netdb netdb.h
14185 eval $hasproto
14186
14187 : see if getpagesize exists
14188 set getpagesize d_getpagsz
14189 eval $inlibc
14190
14191 : Optional checks for getprotobyname and getprotobynumber
14192
14193 : see if getprotobyname exists
14194 set getprotobyname d_getpbyname
14195 eval $inlibc
14196
14197 : see if getprotobynumber exists
14198 set getprotobynumber d_getpbynumber
14199 eval $inlibc
14200
14201 : see if getprotoent exists
14202 set getprotoent d_getpent
14203 eval $inlibc
14204
14205 : see if getpgid exists
14206 set getpgid d_getpgid
14207 eval $inlibc
14208
14209 : see if getpgrp2 exists
14210 set getpgrp2 d_getpgrp2
14211 eval $inlibc
14212
14213 : see if getppid exists
14214 set getppid d_getppid
14215 eval $inlibc
14216
14217 : see if getpriority exists
14218 set getpriority d_getprior
14219 eval $inlibc
14220
14221 : see if getprotobyname_r exists
14222 set getprotobyname_r d_getprotobyname_r
14223 eval $inlibc
14224 case "$d_getprotobyname_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14227         case "$d_getprotobyname_r_proto:$usethreads" in
14228         ":define")      d_getprotobyname_r_proto=define
14229                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getprotobyname_r_proto" in
14234         define)
14235         case "$getprotobyname_r_proto" in
14236         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14237         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14238         esac
14239         case "$getprotobyname_r_proto" in
14240         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14241         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14242         esac
14243         case "$getprotobyname_r_proto" in
14244         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14245         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14246         esac
14247         case "$getprotobyname_r_proto" in
14248         ''|0)   d_getprotobyname_r=undef
14249                 getprotobyname_r_proto=0
14250                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14251         * )     case "$getprotobyname_r_proto" in
14252                 REENTRANT_PROTO*) ;;
14253                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14254                 esac
14255                 echo "Prototype: $try" ;;
14256         esac
14257         ;;
14258         *)      case "$usethreads" in
14259                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14260                 esac
14261                 d_getprotobyname_r=undef
14262                 getprotobyname_r_proto=0
14263                 ;;
14264         esac
14265         ;;
14266 *)      getprotobyname_r_proto=0
14267         ;;
14268 esac
14269
14270 : see if getprotobynumber_r exists
14271 set getprotobynumber_r d_getprotobynumber_r
14272 eval $inlibc
14273 case "$d_getprotobynumber_r" in
14274 "$define")
14275         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14276         case "$d_getprotobynumber_r_proto:$usethreads" in
14277         ":define")      d_getprotobynumber_r_proto=define
14278                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14279                 eval $hasproto ;;
14280         *)      ;;
14281         esac
14282         case "$d_getprotobynumber_r_proto" in
14283         define)
14284         case "$getprotobynumber_r_proto" in
14285         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14286         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14287         esac
14288         case "$getprotobynumber_r_proto" in
14289         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14290         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14291         esac
14292         case "$getprotobynumber_r_proto" in
14293         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14294         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14295         esac
14296         case "$getprotobynumber_r_proto" in
14297         ''|0)   d_getprotobynumber_r=undef
14298                 getprotobynumber_r_proto=0
14299                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14300         * )     case "$getprotobynumber_r_proto" in
14301                 REENTRANT_PROTO*) ;;
14302                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14303                 esac
14304                 echo "Prototype: $try" ;;
14305         esac
14306         ;;
14307         *)      case "$usethreads" in
14308                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14309                 esac
14310                 d_getprotobynumber_r=undef
14311                 getprotobynumber_r_proto=0
14312                 ;;
14313         esac
14314         ;;
14315 *)      getprotobynumber_r_proto=0
14316         ;;
14317 esac
14318
14319 : see if getprotoent_r exists
14320 set getprotoent_r d_getprotoent_r
14321 eval $inlibc
14322 case "$d_getprotoent_r" in
14323 "$define")
14324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14325         case "$d_getprotoent_r_proto:$usethreads" in
14326         ":define")      d_getprotoent_r_proto=define
14327                 set d_getprotoent_r_proto getprotoent_r $hdrs
14328                 eval $hasproto ;;
14329         *)      ;;
14330         esac
14331         case "$d_getprotoent_r_proto" in
14332         define)
14333         case "$getprotoent_r_proto" in
14334         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14335         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14336         esac
14337         case "$getprotoent_r_proto" in
14338         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14339         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14340         esac
14341         case "$getprotoent_r_proto" in
14342         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14343         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14344         esac
14345         case "$getprotoent_r_proto" in
14346         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14347         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14348         esac
14349         case "$getprotoent_r_proto" in
14350         ''|0)   d_getprotoent_r=undef
14351                 getprotoent_r_proto=0
14352                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14353         * )     case "$getprotoent_r_proto" in
14354                 REENTRANT_PROTO*) ;;
14355                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14356                 esac
14357                 echo "Prototype: $try" ;;
14358         esac
14359         ;;
14360         *)      case "$usethreads" in
14361                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14362                 esac
14363                 d_getprotoent_r=undef
14364                 getprotoent_r_proto=0
14365                 ;;
14366         esac
14367         ;;
14368 *)      getprotoent_r_proto=0
14369         ;;
14370 esac
14371
14372 : see if prototypes for various getprotoxxx netdb.h functions are available
14373 echo " "
14374 set d_getprotoprotos getprotoent $i_netdb netdb.h
14375 eval $hasproto
14376
14377 : see if getprpwnam exists
14378 set getprpwnam d_getprpwnam
14379 eval $inlibc
14380
14381 : see if getpwent exists
14382 set getpwent d_getpwent
14383 eval $inlibc
14384
14385 : see if getpwent_r exists
14386 set getpwent_r d_getpwent_r
14387 eval $inlibc
14388 case "$d_getpwent_r" in
14389 "$define")
14390         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14391         case "$d_getpwent_r_proto:$usethreads" in
14392         ":define")      d_getpwent_r_proto=define
14393                 set d_getpwent_r_proto getpwent_r $hdrs
14394                 eval $hasproto ;;
14395         *)      ;;
14396         esac
14397         case "$d_getpwent_r_proto" in
14398         define)
14399         case "$getpwent_r_proto" in
14400         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14401         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14402         esac
14403         case "$getpwent_r_proto" in
14404         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14405         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14406         esac
14407         case "$getpwent_r_proto" in
14408         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14409         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14410         esac
14411         case "$getpwent_r_proto" in
14412         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14413         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14414         esac
14415         case "$getpwent_r_proto" in
14416         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14417         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14418         esac
14419         case "$getpwent_r_proto" in
14420         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14421         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14422         esac
14423         case "$getpwent_r_proto" in
14424         ''|0)   d_getpwent_r=undef
14425                 getpwent_r_proto=0
14426                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14427         * )     case "$getpwent_r_proto" in
14428                 REENTRANT_PROTO*) ;;
14429                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14430                 esac
14431                 echo "Prototype: $try" ;;
14432         esac
14433         ;;
14434         *)      case "$usethreads" in
14435                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14436                 esac
14437                 d_getpwent_r=undef
14438                 getpwent_r_proto=0
14439                 ;;
14440         esac
14441         ;;
14442 *)      getpwent_r_proto=0
14443         ;;
14444 esac
14445
14446 : see if getpwnam_r exists
14447 set getpwnam_r d_getpwnam_r
14448 eval $inlibc
14449 case "$d_getpwnam_r" in
14450 "$define")
14451         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14452         case "$d_getpwnam_r_proto:$usethreads" in
14453         ":define")      d_getpwnam_r_proto=define
14454                 set d_getpwnam_r_proto getpwnam_r $hdrs
14455                 eval $hasproto ;;
14456         *)      ;;
14457         esac
14458         case "$d_getpwnam_r_proto" in
14459         define)
14460         case "$getpwnam_r_proto" in
14461         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14462         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14463         esac
14464         case "$getpwnam_r_proto" in
14465         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14466         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14467         esac
14468         case "$getpwnam_r_proto" in
14469         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14470         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14471         esac
14472         case "$getpwnam_r_proto" in
14473         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14474         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14475         esac
14476         case "$getpwnam_r_proto" in
14477         ''|0)   d_getpwnam_r=undef
14478                 getpwnam_r_proto=0
14479                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14480         * )     case "$getpwnam_r_proto" in
14481                 REENTRANT_PROTO*) ;;
14482                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14483                 esac
14484                 echo "Prototype: $try" ;;
14485         esac
14486         ;;
14487         *)      case "$usethreads" in
14488                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14489                 esac
14490                 d_getpwnam_r=undef
14491                 getpwnam_r_proto=0
14492                 ;;
14493         esac
14494         ;;
14495 *)      getpwnam_r_proto=0
14496         ;;
14497 esac
14498
14499 : see if getpwuid_r exists
14500 set getpwuid_r d_getpwuid_r
14501 eval $inlibc
14502 case "$d_getpwuid_r" in
14503 "$define")
14504         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14505         case "$d_getpwuid_r_proto:$usethreads" in
14506         ":define")      d_getpwuid_r_proto=define
14507                 set d_getpwuid_r_proto getpwuid_r $hdrs
14508                 eval $hasproto ;;
14509         *)      ;;
14510         esac
14511         case "$d_getpwuid_r_proto" in
14512         define)
14513         case "$getpwuid_r_proto" in
14514         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14515         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14516         esac
14517         case "$getpwuid_r_proto" in
14518         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14519         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14520         esac
14521         case "$getpwuid_r_proto" in
14522         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14523         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14524         esac
14525         case "$getpwuid_r_proto" in
14526         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14527         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14528         esac
14529         case "$getpwuid_r_proto" in
14530         ''|0)   d_getpwuid_r=undef
14531                 getpwuid_r_proto=0
14532                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14533         * )     case "$getpwuid_r_proto" in
14534                 REENTRANT_PROTO*) ;;
14535                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14536                 esac
14537                 echo "Prototype: $try" ;;
14538         esac
14539         ;;
14540         *)      case "$usethreads" in
14541                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14542                 esac
14543                 d_getpwuid_r=undef
14544                 getpwuid_r_proto=0
14545                 ;;
14546         esac
14547         ;;
14548 *)      getpwuid_r_proto=0
14549         ;;
14550 esac
14551
14552 : Optional checks for getsbyname and getsbyport
14553
14554 : see if getservbyname exists
14555 set getservbyname d_getsbyname
14556 eval $inlibc
14557
14558 : see if getservbyport exists
14559 set getservbyport d_getsbyport
14560 eval $inlibc
14561
14562 : see if getservent exists
14563 set getservent d_getsent
14564 eval $inlibc
14565
14566 : see if getservbyname_r exists
14567 set getservbyname_r d_getservbyname_r
14568 eval $inlibc
14569 case "$d_getservbyname_r" in
14570 "$define")
14571         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14572         case "$d_getservbyname_r_proto:$usethreads" in
14573         ":define")      d_getservbyname_r_proto=define
14574                 set d_getservbyname_r_proto getservbyname_r $hdrs
14575                 eval $hasproto ;;
14576         *)      ;;
14577         esac
14578         case "$d_getservbyname_r_proto" in
14579         define)
14580         case "$getservbyname_r_proto" in
14581         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14582         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14583         esac
14584         case "$getservbyname_r_proto" in
14585         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14586         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14587         esac
14588         case "$getservbyname_r_proto" in
14589         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14590         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14591         esac
14592         case "$getservbyname_r_proto" in
14593         ''|0)   d_getservbyname_r=undef
14594                 getservbyname_r_proto=0
14595                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14596         * )     case "$getservbyname_r_proto" in
14597                 REENTRANT_PROTO*) ;;
14598                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14599                 esac
14600                 echo "Prototype: $try" ;;
14601         esac
14602         ;;
14603         *)      case "$usethreads" in
14604                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14605                 esac
14606                 d_getservbyname_r=undef
14607                 getservbyname_r_proto=0
14608                 ;;
14609         esac
14610         ;;
14611 *)      getservbyname_r_proto=0
14612         ;;
14613 esac
14614
14615 : see if getservbyport_r exists
14616 set getservbyport_r d_getservbyport_r
14617 eval $inlibc
14618 case "$d_getservbyport_r" in
14619 "$define")
14620         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14621         case "$d_getservbyport_r_proto:$usethreads" in
14622         ":define")      d_getservbyport_r_proto=define
14623                 set d_getservbyport_r_proto getservbyport_r $hdrs
14624                 eval $hasproto ;;
14625         *)      ;;
14626         esac
14627         case "$d_getservbyport_r_proto" in
14628         define)
14629         case "$getservbyport_r_proto" in
14630         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14631         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14632         esac
14633         case "$getservbyport_r_proto" in
14634         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14635         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14636         esac
14637         case "$getservbyport_r_proto" in
14638         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14639         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14640         esac
14641         case "$getservbyport_r_proto" in
14642         ''|0)   d_getservbyport_r=undef
14643                 getservbyport_r_proto=0
14644                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14645         * )     case "$getservbyport_r_proto" in
14646                 REENTRANT_PROTO*) ;;
14647                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14648                 esac
14649                 echo "Prototype: $try" ;;
14650         esac
14651         ;;
14652         *)      case "$usethreads" in
14653                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14654                 esac
14655                 d_getservbyport_r=undef
14656                 getservbyport_r_proto=0
14657                 ;;
14658         esac
14659         ;;
14660 *)      getservbyport_r_proto=0
14661         ;;
14662 esac
14663
14664 : see if getservent_r exists
14665 set getservent_r d_getservent_r
14666 eval $inlibc
14667 case "$d_getservent_r" in
14668 "$define")
14669         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14670         case "$d_getservent_r_proto:$usethreads" in
14671         ":define")      d_getservent_r_proto=define
14672                 set d_getservent_r_proto getservent_r $hdrs
14673                 eval $hasproto ;;
14674         *)      ;;
14675         esac
14676         case "$d_getservent_r_proto" in
14677         define)
14678         case "$getservent_r_proto" in
14679         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14680         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14681         esac
14682         case "$getservent_r_proto" in
14683         ''|0) try='int getservent_r(struct servent*, char*, int);'
14684         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14685         esac
14686         case "$getservent_r_proto" in
14687         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14688         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14689         esac
14690         case "$getservent_r_proto" in
14691         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14692         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14693         esac
14694         case "$getservent_r_proto" in
14695         ''|0)   d_getservent_r=undef
14696                 getservent_r_proto=0
14697                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14698         * )     case "$getservent_r_proto" in
14699                 REENTRANT_PROTO*) ;;
14700                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14701                 esac
14702                 echo "Prototype: $try" ;;
14703         esac
14704         ;;
14705         *)      case "$usethreads" in
14706                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14707                 esac
14708                 d_getservent_r=undef
14709                 getservent_r_proto=0
14710                 ;;
14711         esac
14712         ;;
14713 *)      getservent_r_proto=0
14714         ;;
14715 esac
14716
14717 : see if prototypes for various getservxxx netdb.h functions are available
14718 echo " "
14719 set d_getservprotos getservent $i_netdb netdb.h
14720 eval $hasproto
14721
14722 : see if getspnam exists
14723 set getspnam d_getspnam
14724 eval $inlibc
14725
14726 : see if this is a shadow.h system
14727 set shadow.h i_shadow
14728 eval $inhdr
14729
14730 : see if getspnam_r exists
14731 set getspnam_r d_getspnam_r
14732 eval $inlibc
14733 case "$d_getspnam_r" in
14734 "$define")
14735         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14736         case "$d_getspnam_r_proto:$usethreads" in
14737         ":define")      d_getspnam_r_proto=define
14738                 set d_getspnam_r_proto getspnam_r $hdrs
14739                 eval $hasproto ;;
14740         *)      ;;
14741         esac
14742         case "$d_getspnam_r_proto" in
14743         define)
14744         case "$getspnam_r_proto" in
14745         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14746         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14747         esac
14748         case "$getspnam_r_proto" in
14749         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14750         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14751         esac
14752         case "$getspnam_r_proto" in
14753         ''|0)   d_getspnam_r=undef
14754                 getspnam_r_proto=0
14755                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14756         * )     case "$getspnam_r_proto" in
14757                 REENTRANT_PROTO*) ;;
14758                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14759                 esac
14760                 echo "Prototype: $try" ;;
14761         esac
14762         ;;
14763         *)      case "$usethreads" in
14764                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14765                 esac
14766                 d_getspnam_r=undef
14767                 getspnam_r_proto=0
14768                 ;;
14769         esac
14770         ;;
14771 *)      getspnam_r_proto=0
14772         ;;
14773 esac
14774
14775 : see if gettimeofday or ftime exists
14776 set gettimeofday d_gettimeod
14777 eval $inlibc
14778 case "$d_gettimeod" in
14779 "$undef")
14780         set ftime d_ftime 
14781         eval $inlibc
14782         ;;
14783 *)
14784         val="$undef"; set d_ftime; eval $setvar
14785         ;;
14786 esac
14787 case "$d_gettimeod$d_ftime" in
14788 "$undef$undef")
14789         echo " "
14790         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14791         ;;
14792 esac
14793
14794 : see if gmtime_r exists
14795 set gmtime_r d_gmtime_r
14796 eval $inlibc
14797 case "$d_gmtime_r" in
14798 "$define")
14799         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14800         case "$d_gmtime_r_proto:$usethreads" in
14801         ":define")      d_gmtime_r_proto=define
14802                 set d_gmtime_r_proto gmtime_r $hdrs
14803                 eval $hasproto ;;
14804         *)      ;;
14805         esac
14806         case "$d_gmtime_r_proto" in
14807         define)
14808         case "$gmtime_r_proto" in
14809         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14810         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14811         esac
14812         case "$gmtime_r_proto" in
14813         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14814         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14815         esac
14816         case "$gmtime_r_proto" in
14817         ''|0)   d_gmtime_r=undef
14818                 gmtime_r_proto=0
14819                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14820         * )     case "$gmtime_r_proto" in
14821                 REENTRANT_PROTO*) ;;
14822                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14823                 esac
14824                 echo "Prototype: $try" ;;
14825         esac
14826         ;;
14827         *)      case "$usethreads" in
14828                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14829                 esac
14830                 d_gmtime_r=undef
14831                 gmtime_r_proto=0
14832                 ;;
14833         esac
14834         ;;
14835 *)      gmtime_r_proto=0
14836         ;;
14837 esac
14838
14839 : see if hasmntopt exists
14840 set hasmntopt d_hasmntopt
14841 eval $inlibc
14842
14843 : see if this is a netinet/in.h or sys/in.h system
14844 set netinet/in.h i_niin sys/in.h i_sysin
14845 eval $inhdr
14846
14847 : see if arpa/inet.h has to be included
14848 set arpa/inet.h i_arpainet
14849 eval $inhdr
14850
14851 : see if htonl --and friends-- exists
14852 val=''
14853 set htonl val
14854 eval $inlibc
14855
14856 : Maybe they are macros.
14857 case "$val" in
14858 $undef)
14859         $cat >htonl.c <<EOM
14860 #include <stdio.h>
14861 #include <sys/types.h>
14862 #$i_niin I_NETINET_IN
14863 #$i_sysin I_SYS_IN
14864 #$i_arpainet I_ARPA_INET
14865 #ifdef I_NETINET_IN
14866 #include <netinet/in.h>
14867 #endif
14868 #ifdef I_SYS_IN
14869 #include <sys/in.h>
14870 #endif
14871 #ifdef I_ARPA_INET
14872 #include <arpa/inet.h>
14873 #endif
14874 #ifdef htonl
14875 printf("Defined as a macro.");
14876 #endif
14877 EOM
14878         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14879         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14880                 val="$define"
14881                 echo "But it seems to be defined as a macro." >&4
14882         fi
14883         $rm -f htonl.?
14884         ;;
14885 esac
14886 set d_htonl
14887 eval $setvar
14888
14889 : see if ilogbl exists
14890 set ilogbl d_ilogbl
14891 eval $inlibc
14892
14893 : index or strchr
14894 echo " "
14895 if set index val -f; eval $csym; $val; then
14896         if set strchr val -f d_strchr; eval $csym; $val; then
14897                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14898                         val="$define"
14899                         vali="$undef"
14900                         echo "strchr() found." >&4
14901                 else
14902                         val="$undef"
14903                         vali="$define"
14904                         echo "index() found." >&4
14905                 fi
14906         else
14907                 val="$undef"
14908                 vali="$define"
14909                 echo "index() found." >&4
14910         fi
14911 else
14912         if set strchr val -f d_strchr; eval $csym; $val; then
14913                 val="$define"
14914                 vali="$undef"
14915                 echo "strchr() found." >&4
14916         else
14917                 echo "No index() or strchr() found!" >&4
14918                 val="$undef"
14919                 vali="$undef"
14920         fi
14921 fi
14922 set d_strchr; eval $setvar
14923 val="$vali"
14924 set d_index; eval $setvar
14925
14926 : check whether inet_aton exists
14927 set inet_aton d_inetaton
14928 eval $inlibc
14929
14930 : see if inet_ntop exists
14931 set inet_ntop d_inetntop
14932 eval $inlibc
14933
14934 : see if inet_pton exists
14935 set inet_pton d_inetpton
14936 eval $inlibc
14937
14938 : Look for isascii
14939 echo " "
14940 $cat >isascii.c <<EOCP
14941 #include <stdio.h>
14942 #include <ctype.h>
14943 #$i_stdlib I_STDLIB
14944 #ifdef I_STDLIB
14945 #include <stdlib.h>
14946 #endif
14947 int main() {
14948         int c = 'A';
14949         if (isascii(c))
14950                 exit(0);
14951         else
14952                 exit(1);
14953 }
14954 EOCP
14955 set isascii
14956 if eval $compile; then
14957         echo "isascii() found." >&4
14958         val="$define"
14959 else
14960         echo "isascii() NOT found." >&4
14961         val="$undef"
14962 fi
14963 set d_isascii
14964 eval $setvar
14965 $rm -f isascii*
14966
14967 : see if isfinite exists
14968 set isfinite d_isfinite
14969 eval $inlibc
14970
14971 : see if isinf exists
14972 set isinf d_isinf
14973 eval $inlibc
14974
14975 : see if isnan exists
14976 set isnan d_isnan
14977 eval $inlibc
14978
14979 : see if isnanl exists
14980 set isnanl d_isnanl
14981 eval $inlibc
14982
14983 : see if killpg exists
14984 set killpg d_killpg
14985 eval $inlibc
14986
14987 : see if lchown exists
14988 echo " "
14989 $cat > try.c <<'EOCP'
14990 /* System header to define __stub macros and hopefully few prototypes,
14991     which can conflict with char lchown(); below.  */
14992 #include <assert.h>
14993 /* Override any gcc2 internal prototype to avoid an error.  */
14994 /* We use char because int might match the return type of a gcc2
14995    builtin and then its argument prototype would still apply.  */
14996 char lchown();
14997 int main() {
14998     /*  The GNU C library defines this for functions which it implements
14999         to always fail with ENOSYS.  Some functions are actually named
15000         something starting with __ and the normal name is an alias.  */
15001 #if defined (__stub_lchown) || defined (__stub___lchown)
15002 choke me
15003 #else
15004 lchown();
15005 #endif
15006 ; return 0; }
15007 EOCP
15008 set try
15009 if eval $compile; then
15010     $echo "lchown() found." >&4
15011     val="$define"
15012 else
15013     $echo "lchown() NOT found." >&4
15014     val="$undef"
15015 fi
15016 set d_lchown
15017 eval $setvar
15018
15019 : See if number of significant digits in a double precision number is known
15020 echo " "
15021 $cat >ldbl_dig.c <<EOM
15022 #$i_limits I_LIMITS
15023 #$i_float I_FLOAT
15024 #ifdef I_LIMITS
15025 #include <limits.h>
15026 #endif
15027 #ifdef I_FLOAT
15028 #include <float.h>
15029 #endif
15030 #ifdef LDBL_DIG
15031 printf("Contains LDBL_DIG");
15032 #endif
15033 EOM
15034 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15035 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15036         echo "LDBL_DIG found." >&4
15037         val="$define"
15038 else
15039         echo "LDBL_DIG NOT found." >&4
15040         val="$undef"
15041 fi
15042 $rm -f ldbl_dig.?
15043 set d_ldbl_dig
15044 eval $setvar
15045
15046 : see if this is a math.h system
15047 set math.h i_math
15048 eval $inhdr
15049
15050 : check to see if math.h defines _LIB_VERSION
15051 d_libm_lib_version="$undef"
15052 case $i_math in
15053     $define)
15054         echo " "
15055         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15056         $cat >try.c <<EOCP
15057 #include <unistd.h>
15058 #include <math.h>
15059 int main (int argc, char *argv[])
15060 {
15061     printf ("%d\n", _LIB_VERSION);
15062     return (0);
15063     } /* main */
15064 EOCP
15065         set try
15066         if eval $compile; then
15067             foo=`$run ./try`
15068             echo "Yes, it does ($foo)" >&4
15069             d_libm_lib_version="$define"
15070         else
15071             echo "No, it does not (probably harmless)" >&4
15072             fi
15073         $rm_try
15074         ;;
15075
15076     esac
15077
15078 : see if link exists
15079 set link d_link
15080 eval $inlibc
15081
15082 : see if localtime_r exists
15083 set localtime_r d_localtime_r
15084 eval $inlibc
15085 case "$d_localtime_r" in
15086 "$define")
15087         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15088         case "$d_localtime_r_proto:$usethreads" in
15089         ":define")      d_localtime_r_proto=define
15090                 set d_localtime_r_proto localtime_r $hdrs
15091                 eval $hasproto ;;
15092         *)      ;;
15093         esac
15094         case "$d_localtime_r_proto" in
15095         define)
15096         case "$localtime_r_proto" in
15097         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15098         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15099         esac
15100         case "$localtime_r_proto" in
15101         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15102         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15103         esac
15104         case "$localtime_r_proto" in
15105         ''|0)   d_localtime_r=undef
15106                 localtime_r_proto=0
15107                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15108         * )     case "$localtime_r_proto" in
15109                 REENTRANT_PROTO*) ;;
15110                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15111                 esac
15112                 echo "Prototype: $try" ;;
15113         esac
15114         ;;
15115         *)      case "$usethreads" in
15116                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15117                 esac
15118                 d_localtime_r=undef
15119                 localtime_r_proto=0
15120                 ;;
15121         esac
15122         ;;
15123 *)      localtime_r_proto=0
15124         ;;
15125 esac
15126
15127 : see if localtime_r calls tzset
15128 case "$localtime_r_proto" in
15129 REENTRANT_PROTO*)
15130         $cat >try.c <<EOCP
15131 /*  Does our libc's localtime_r call tzset ?
15132  *  return 0 if so, 1 otherwise.
15133  */
15134 #$i_systypes    I_SYS_TYPES
15135 #$i_unistd      I_UNISTD
15136 #$i_time        I_TIME
15137 #$i_stdlib      I_STDLIB
15138 #$i_string      I_STRING
15139 #$i_malloc      I_MALLOC
15140 #ifdef I_SYS_TYPES
15141 #  include <sys/types.h>
15142 #endif
15143 #ifdef I_UNISTD
15144 #  include <unistd.h>
15145 #endif
15146 #ifdef I_TIME
15147 #  include <time.h>
15148 #endif
15149 #ifdef I_STDLIB
15150 #include <stdlib.h>
15151 #endif
15152 #ifdef I_STRING
15153 #  include <string.h>
15154 #else
15155 #  include <strings.h>
15156 #endif
15157 #ifdef I_MALLOC
15158 #  include <malloc.h>
15159 #endif
15160 int main()
15161 {
15162     time_t t = time(0L);
15163     char w_tz[]="TZ" "=GMT+5",
15164          e_tz[]="TZ" "=GMT-5",
15165         *tz_e = (char*)malloc(16),
15166         *tz_w = (char*)malloc(16);
15167     struct tm tm_e, tm_w;
15168     memset(&tm_e,'\0',sizeof(struct tm));
15169     memset(&tm_w,'\0',sizeof(struct tm));
15170     strcpy(tz_e,e_tz);
15171     strcpy(tz_w,w_tz);
15172
15173     putenv(tz_e);
15174     localtime_r(&t, &tm_e);
15175
15176     putenv(tz_w);
15177     localtime_r(&t, &tm_w);
15178
15179     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15180         return 1;
15181     return 0;
15182 }
15183 EOCP
15184         set try
15185         if eval $compile; then
15186             if $run ./try; then
15187                 d_localtime_r_needs_tzset=undef;
15188             else
15189                 d_localtime_r_needs_tzset=define;
15190             fi;
15191         else
15192             d_localtime_r_needs_tzset=undef;
15193         fi;
15194      ;;
15195   *)
15196      d_localtime_r_needs_tzset=undef;
15197      ;;
15198 esac
15199 $rm_try
15200
15201 : see if localeconv exists
15202 set localeconv d_locconv
15203 eval $inlibc
15204
15205 : see if lockf exists
15206 set lockf d_lockf
15207 eval $inlibc
15208
15209 : see if prototype for lseek is available
15210 echo " "
15211 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15212 eval $hasproto
15213
15214 : see if lstat exists
15215 set lstat d_lstat
15216 eval $inlibc
15217
15218 : see if madvise exists
15219 set madvise d_madvise
15220 eval $inlibc
15221
15222 : see if malloc_size exists
15223 set malloc_size d_malloc_size
15224 eval $inlibc
15225
15226 : see if malloc_size_good exists
15227 set malloc_good_size d_malloc_good_size
15228 eval $inlibc
15229
15230 : see if mblen exists
15231 set mblen d_mblen
15232 eval $inlibc
15233
15234 : see if mbstowcs exists
15235 set mbstowcs d_mbstowcs
15236 eval $inlibc
15237
15238 : see if mbtowc exists
15239 set mbtowc d_mbtowc
15240 eval $inlibc
15241
15242 : see if memchr exists
15243 set memchr d_memchr
15244 eval $inlibc
15245
15246 : see if memcmp exists
15247 set memcmp d_memcmp
15248 eval $inlibc
15249
15250 : see if memcpy exists
15251 set memcpy d_memcpy
15252 eval $inlibc
15253
15254 : see if memmove exists
15255 set memmove d_memmove
15256 eval $inlibc
15257
15258 : see if memset exists
15259 set memset d_memset
15260 eval $inlibc
15261
15262 : see if mkdir exists
15263 set mkdir d_mkdir
15264 eval $inlibc
15265
15266 : see if mkdtemp exists
15267 set mkdtemp d_mkdtemp
15268 eval $inlibc
15269
15270 : see if mkfifo exists
15271 set mkfifo d_mkfifo
15272 eval $inlibc
15273
15274 : see if mkstemp exists
15275 set mkstemp d_mkstemp
15276 eval $inlibc
15277
15278 : see if mkstemps exists
15279 set mkstemps d_mkstemps
15280 eval $inlibc
15281
15282 : see if mktime exists
15283 set mktime d_mktime
15284 eval $inlibc
15285
15286 : see if this is a sys/mman.h system
15287 set sys/mman.h i_sysmman
15288 eval $inhdr
15289
15290 : see if mmap exists
15291 set mmap d_mmap
15292 eval $inlibc
15293 : see what shmat returns
15294 : default to something harmless
15295 mmaptype='void *'
15296 case "$i_sysmman$d_mmap" in
15297 "$define$define")
15298         $cat >mmap.c <<'END'
15299 #include <sys/mman.h>
15300 void *mmap();
15301 END
15302         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15303                 mmaptype='void *'
15304         else
15305                 mmaptype='caddr_t'
15306         fi
15307         echo "and it returns ($mmaptype)." >&4
15308         ;;
15309 esac
15310
15311
15312
15313 : see if sqrtl exists
15314 set sqrtl d_sqrtl
15315 eval $inlibc
15316
15317 : see if scalbnl exists
15318 set scalbnl d_scalbnl
15319 eval $inlibc
15320
15321 : see if modfl exists
15322 set modfl d_modfl
15323 eval $inlibc
15324
15325 : see if prototype for modfl is available
15326 echo " "
15327 set d_modflproto modfl $i_math math.h
15328 eval $hasproto
15329
15330 d_modfl_pow32_bug="$undef"
15331
15332 case "$d_longdbl$d_modfl" in
15333 $define$define)
15334         $cat <<EOM
15335 Checking to see whether your modfl() is okay for large values...
15336 EOM
15337 $cat >try.c <<EOCP
15338 #include <math.h>
15339 #include <stdio.h>
15340 EOCP
15341 if $test "X$d_modflproto" != "X$define"; then
15342         $cat >>try.c <<EOCP
15343 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15344 long double modfl (long double, long double *);
15345 EOCP
15346 fi
15347 $cat >>try.c <<EOCP
15348 int main() {
15349     long double nv = 4294967303.15;
15350     long double v, w;
15351     v = modfl(nv, &w);
15352 #ifdef __GLIBC__
15353     printf("glibc");
15354 #endif
15355     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15356     return 0;
15357 }
15358 EOCP
15359         case "$osname:$gccversion" in
15360         aix:)   saveccflags="$ccflags"
15361                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15362         esac
15363         set try
15364         if eval $compile; then
15365                 foo=`$run ./try`
15366                 case "$foo" in
15367                 *" 4294967303.150000 1.150000 4294967302.000000")
15368                         echo >&4 "Your modfl() is broken for large values."
15369                         d_modfl_pow32_bug="$define"
15370                         case "$foo" in
15371                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15372                         ;;
15373                         esac
15374                         ;;
15375                 *" 4294967303.150000 0.150000 4294967303.000000")
15376                         echo >&4 "Your modfl() seems okay for large values."
15377                         ;;
15378                 *)      echo >&4 "I don't understand your modfl() at all."
15379                         d_modfl="$undef"
15380                         ;;
15381                 esac
15382                 $rm_try
15383         else
15384                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15385                 d_modfl="$undef"
15386         fi
15387         case "$osname:$gccversion" in
15388         aix:)   ccflags="$saveccflags" ;; # restore
15389         esac
15390         ;;
15391 esac
15392
15393 if $test "$uselongdouble" = "$define"; then
15394     message=""
15395     if $test "$d_sqrtl" != "$define"; then
15396         message="$message sqrtl"
15397     fi
15398     if $test "$d_modfl" != "$define"; then
15399         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15400             echo "You have both aintl and copysignl, so I can emulate modfl."
15401         else
15402             message="$message modfl"
15403         fi
15404     fi
15405     if $test "$d_frexpl" != "$define"; then
15406         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15407             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15408         else
15409             message="$message frexpl"
15410         fi
15411     fi
15412
15413     if $test "$message" != ""; then
15414         $cat <<EOM >&4
15415
15416 *** You requested the use of long doubles but you do not seem to have
15417 *** the following mathematical functions needed for long double support:
15418 ***    $message
15419 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15420 *** Cannot continue, aborting.
15421
15422 EOM
15423
15424         exit 1
15425     fi
15426 fi
15427
15428 : see if mprotect exists
15429 set mprotect d_mprotect
15430 eval $inlibc
15431
15432 : see if msgctl exists
15433 set msgctl d_msgctl
15434 eval $inlibc
15435
15436 : see if msgget exists
15437 set msgget d_msgget
15438 eval $inlibc
15439
15440 : see if msgsnd exists
15441 set msgsnd d_msgsnd
15442 eval $inlibc
15443
15444 : see if msgrcv exists
15445 set msgrcv d_msgrcv
15446 eval $inlibc
15447
15448 : see how much of the 'msg*(2)' library is present.
15449 h_msg=true
15450 echo " "
15451 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15452 *"$undef"*) h_msg=false;;
15453 esac
15454 case "$osname" in
15455 freebsd)
15456     case "`ipcs 2>&1`" in
15457     "SVID messages"*"not configured"*)
15458         echo "Your $osname does not have the msg*(2) configured." >&4
15459         h_msg=false
15460         val="$undef"
15461         set msgctl d_msgctl
15462         eval $setvar
15463         set msgget d_msgget
15464         eval $setvar
15465         set msgsnd d_msgsnd
15466         eval $setvar
15467         set msgrcv d_msgrcv
15468         eval $setvar
15469         ;;
15470     esac
15471     ;;
15472 esac
15473 : we could also check for sys/ipc.h ...
15474 if $h_msg && $test `./findhdr sys/msg.h`; then
15475         echo "You have the full msg*(2) library." >&4
15476         val="$define"
15477 else
15478         echo "You don't have the full msg*(2) library." >&4
15479         val="$undef"
15480 fi
15481 set d_msg
15482 eval $setvar
15483
15484 : Check for msghdr_s
15485 echo " "
15486 echo "Checking to see if your system supports struct msghdr..." >&4
15487 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15488 eval $hasstruct
15489 case "$d_msghdr_s" in
15490 "$define")      echo "Yes, it does."   ;;
15491 *)              echo "No, it doesn't." ;;
15492 esac
15493
15494
15495 : see if msync exists
15496 set msync d_msync
15497 eval $inlibc
15498
15499 : see if munmap exists
15500 set munmap d_munmap
15501 eval $inlibc
15502
15503 : see if nice exists
15504 set nice d_nice
15505 eval $inlibc
15506
15507 : see if this is a langinfo.h system
15508 set langinfo.h i_langinfo
15509 eval $inhdr
15510
15511 : see if nl_langinfo exists
15512 set nl_langinfo d_nl_langinfo
15513 eval $inlibc
15514
15515 : check for volatile keyword
15516 echo " "
15517 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15518 $cat >try.c <<'EOCP'
15519 int main()
15520 {
15521         typedef struct _goo_struct goo_struct;
15522         goo_struct * volatile goo = ((goo_struct *)0);
15523         struct _goo_struct {
15524                 long long_int;
15525                 int reg_int;
15526                 char char_var;
15527         };
15528         typedef unsigned short foo_t;
15529         char *volatile foo;
15530         volatile int bar;
15531         volatile foo_t blech;
15532         foo = foo;
15533 }
15534 EOCP
15535 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15536         val="$define"
15537         echo "Yup, it does."
15538 else
15539         val="$undef"
15540         echo "Nope, it doesn't."
15541 fi
15542 set d_volatile
15543 eval $setvar
15544 $rm_try
15545
15546 : Check basic sizes
15547 echo " "
15548 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15549
15550 case "$use64bitint:$d_quad:$quadtype" in
15551 define:define:?*)
15552         ivtype="$quadtype"
15553         uvtype="$uquadtype"
15554         ivsize=8
15555         uvsize=8
15556         ;;
15557 *)      ivtype="long"
15558         uvtype="unsigned long"
15559         ivsize=$longsize
15560         uvsize=$longsize
15561         ;;
15562 esac
15563
15564 case "$uselongdouble:$d_longdbl" in
15565 define:define)
15566         nvtype="long double"
15567         nvsize=$longdblsize
15568         ;;
15569 *)      nvtype=double
15570         nvsize=$doublesize
15571         ;;
15572 esac
15573
15574 $echo "(IV will be "$ivtype", $ivsize bytes)"
15575 $echo "(UV will be "$uvtype", $uvsize bytes)"
15576 $echo "(NV will be "$nvtype", $nvsize bytes)"
15577
15578 $cat >try.c <<EOCP
15579 #$i_inttypes I_INTTYPES
15580 #ifdef I_INTTYPES
15581 #include <inttypes.h>
15582 #endif
15583 #include <stdio.h>
15584 int main() {
15585 #ifdef INT8
15586    int8_t i =  INT8_MAX;
15587   uint8_t u = UINT8_MAX;
15588   printf("int8_t\n");
15589 #endif
15590 #ifdef INT16
15591    int16_t i =  INT16_MAX;
15592   uint16_t i = UINT16_MAX;
15593   printf("int16_t\n");
15594 #endif
15595 #ifdef INT32
15596    int32_t i =  INT32_MAX;
15597   uint32_t u = UINT32_MAX;
15598   printf("int32_t\n");
15599 #endif
15600 }
15601 EOCP
15602
15603 i8type="signed char"
15604 u8type="unsigned char"
15605 i8size=1
15606 u8size=1
15607
15608 case "$i16type" in
15609 '')     case "$shortsize" in
15610         2)      i16type=short
15611                 u16type="unsigned short"
15612                 i16size=$shortsize
15613                 u16size=$shortsize
15614                 ;;
15615         esac
15616         ;;
15617 esac
15618 case "$i16type" in
15619 '')     set try -DINT16
15620         if eval $compile; then
15621                 case "`$run ./try`" in
15622                 int16_t)
15623                         i16type=int16_t
15624                         u16type=uint16_t
15625                         i16size=2
15626                         u16size=2
15627                         ;;
15628                 esac
15629         fi
15630         ;;
15631 esac
15632 case "$i16type" in
15633 '')     if $test $shortsize -ge 2; then
15634                 i16type=short
15635                 u16type="unsigned short"
15636                 i16size=$shortsize
15637                 u16size=$shortsize
15638         fi
15639         ;;
15640 esac
15641
15642 case "$i32type" in
15643 '')     case "$longsize" in
15644         4)      i32type=long
15645                 u32type="unsigned long"
15646                 i32size=$longsize
15647                 u32size=$longsize
15648                 ;;
15649         *)      case "$intsize" in
15650                 4)      i32type=int
15651                         u32type="unsigned int"
15652                         i32size=$intsize
15653                         u32size=$intsize
15654                         ;;
15655                 esac
15656                 ;;
15657         esac
15658         ;;
15659 esac
15660 case "$i32type" in
15661 '')     set try -DINT32
15662         if eval $compile; then
15663                 case "`$run ./try`" in
15664                 int32_t)
15665                         i32type=int32_t
15666                         u32type=uint32_t
15667                         i32size=4
15668                         u32size=4
15669                         ;;
15670                 esac
15671         fi
15672         ;;
15673 esac
15674 case "$i32type" in
15675 '')     if $test $intsize -ge 4; then
15676                 i32type=int
15677                 u32type="unsigned int"
15678                 i32size=$intsize
15679                 u32size=$intsize
15680         fi
15681         ;;
15682 esac
15683
15684 case "$i64type" in
15685 '')     case "$d_quad:$quadtype" in
15686         define:?*)
15687                 i64type="$quadtype"
15688                 u64type="$uquadtype"
15689                 i64size=8
15690                 u64size=8
15691                 ;;
15692         esac
15693         ;;
15694 esac
15695
15696 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15697 : volatile so that the compiler has to store it out to memory.
15698 if test X"$d_volatile" = X"$define"; then
15699         volatile=volatile
15700 fi
15701 $cat <<EOP >try.c
15702 #include <stdio.h>
15703 #$i_stdlib I_STDLIB
15704 #ifdef I_STDLIB
15705 #include <stdlib.h>
15706 #endif
15707 #include <sys/types.h>
15708 #include <signal.h>
15709 #ifdef SIGFPE
15710 $volatile int bletched = 0;
15711 $signal_t blech(int s) { bletched = 1; }
15712 #endif
15713 int main() {
15714     $uvtype u = 0;
15715     $nvtype d;
15716     int     n = 8 * $uvsize;
15717     int     i;
15718 #ifdef SIGFPE
15719     signal(SIGFPE, blech);
15720 #endif
15721
15722     for (i = 0; i < n; i++) {
15723       u = u << 1 | ($uvtype)1;
15724       d = ($nvtype)u;
15725       if (($uvtype)d != u)
15726         break;
15727       if (d <= 0)
15728         break;
15729       d = ($nvtype)(u - 1);
15730       if (($uvtype)d != (u - 1))
15731         break;
15732 #ifdef SIGFPE
15733       if (bletched)
15734         break;
15735 #endif
15736     }
15737     printf("%d\n", ((i == n) ? -n : i));
15738     exit(0);
15739 }
15740 EOP
15741 set try
15742
15743 d_nv_preserves_uv="$undef"
15744 if eval $compile; then
15745         nv_preserves_uv_bits="`$run ./try`"
15746 fi
15747 case "$nv_preserves_uv_bits" in
15748 \-[1-9]*)
15749         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15750         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15751         d_nv_preserves_uv="$define"
15752         ;;
15753 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15754         d_nv_preserves_uv="$undef" ;;
15755 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15756         nv_preserves_uv_bits="0" ;;
15757 esac
15758 $rm_try
15759
15760 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15761 : volatile so that the compiler has to store it out to memory.
15762 if test X"$d_volatile" = X"$define"; then
15763         volatile=volatile
15764 fi
15765 $cat <<EOP >try.c
15766 #include <stdio.h>
15767
15768 typedef $nvtype NV;
15769
15770 int
15771 main() {
15772   NV value = 2;
15773   int count = 1;
15774
15775   while(count < 256) {
15776     $volatile NV up = value + 1.0;
15777     $volatile NV negated = -value;
15778     $volatile NV down = negated - 1.0;
15779     $volatile NV got_up = up - value;
15780     int up_good = got_up == 1.0;
15781     int got_down = down - negated;
15782     int down_good = got_down == -1.0;
15783
15784     if (down_good != up_good) {
15785       fprintf(stderr,
15786               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15787               up_good, (double) got_up, down_good, (double) got_down,
15788               count, (double) value);
15789       return 1;
15790     }
15791     if (!up_good) {
15792       while (1) {
15793         if (count > 8) {
15794           count -= 8;
15795           fputs("256.0", stdout);
15796         } else {
15797           count--;
15798           fputs("2.0", stdout);
15799         }
15800         if (!count) {
15801           puts("");
15802           return 0;
15803         }
15804         fputs("*", stdout);
15805       }
15806     }
15807     value *= 2;
15808     ++count;
15809   }
15810   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15811           count, (double) value);
15812   return 1;
15813 }
15814 EOP
15815 set try
15816
15817 nv_overflows_integers_at='0'
15818 if eval $compile; then
15819     xxx="`$run ./try`"
15820     case "$?" in
15821         0)
15822             case "$xxx" in
15823                 2*)  cat >&4 <<EOM
15824 The largest integer your NVs can preserve is equal to $xxx
15825 EOM
15826                     nv_overflows_integers_at="$xxx"
15827                     ;;
15828                 *)  cat >&4 <<EOM
15829 Cannot determine the largest integer value your NVs can hold, unexpected output
15830 '$xxx'
15831 EOM
15832                     ;;
15833             esac
15834             ;;
15835         *)  cat >&4 <<EOM
15836 Cannot determine the largest integer value your NVs can hold
15837 EOM
15838             ;;
15839     esac
15840 fi
15841 $rm_try
15842
15843 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15844 : volatile so that the compiler has to store it out to memory.
15845 if test X"$d_volatile" = X"$define"; then
15846         volatile=volatile
15847 fi
15848 $cat <<EOP >try.c
15849 #include <stdio.h>
15850 #$i_stdlib I_STDLIB
15851 #ifdef I_STDLIB
15852 #include <stdlib.h>
15853 #endif
15854 #$i_string I_STRING
15855 #ifdef I_STRING
15856 #  include <string.h>
15857 #else
15858 #  include <strings.h>
15859 #endif
15860 #include <sys/types.h>
15861 #include <signal.h>
15862 #ifdef SIGFPE
15863 $volatile int bletched = 0;
15864 $signal_t blech(int s) { bletched = 1; }
15865 #endif
15866
15867 int checkit($nvtype d, char *where) {
15868     unsigned char *p = (char *)&d;
15869     unsigned char *end = p + sizeof(d);
15870     int fail = 0;
15871
15872     while (p < end)
15873         fail += *p++;
15874
15875     if (!fail)
15876         return 0;
15877
15878     p = (char *)&d;
15879     printf("No - %s: 0x", where);
15880     while (p < end)
15881         printf ("%02X", *p++);
15882     printf("\n");
15883     return 1;
15884 }
15885
15886 int main(int argc, char **argv) {
15887     $nvtype d = 0.0;
15888     int fail = 0;
15889     fail += checkit(d, "0.0");
15890
15891     /* The compiler shouldn't be assuming that bletched is 0  */
15892     d = bletched;
15893
15894     fail += checkit(d, "bleched");
15895
15896 #ifdef SIGFPE
15897     signal(SIGFPE, blech);
15898 #endif
15899
15900     /* Paranoia - the compiler should have no way of knowing that ANSI says
15901        that argv[argc] will always be NULL.  Actually, if it did assume this it
15902        would be buggy, as this is C and main() can be called from elsewhere in
15903        the program.  */
15904     d = argv[argc] ? 1 : 0;
15905
15906     if (d) {
15907         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15908     }
15909
15910     fail += checkit(d, "ternary");
15911
15912     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15913
15914     if (d != 0.0) {
15915         printf("No - memset doesn't give 0.0\n");
15916         /* This might just blow up:  */
15917         printf("(gives %g)\n", d);
15918         return 1;
15919     }
15920
15921 #ifdef SIGFPE
15922     if (bletched) {
15923         printf("No - something bleched\n");
15924         return 1;
15925     }
15926 #endif
15927     if (fail) {
15928       printf("No - %d fail(s)\n", fail);
15929       return 1;
15930     }
15931     printf("Yes\n");
15932     return 0;
15933 }
15934 EOP
15935 set try
15936
15937 d_nv_zero_is_allbits_zero="$undef"
15938 if eval $compile; then
15939     xxx="`$run ./try`"
15940     case "$?" in
15941         0)
15942             case "$xxx" in
15943                 Yes)  cat >&4 <<EOM
15944 0.0 is represented as all bits zero in memory
15945 EOM
15946                     d_nv_zero_is_allbits_zero="$define"
15947                     ;;
15948                 *)  cat >&4 <<EOM
15949 0.0 is not represented as all bits zero in memory
15950 EOM
15951                     d_nv_zero_is_allbits_zero="$undef"
15952                     ;;
15953             esac
15954             ;;
15955         *)  cat >&4 <<EOM
15956 0.0 is not represented as all bits zero in memory
15957 EOM
15958             d_nv_zero_is_allbits_zero="$undef"
15959             ;;
15960     esac
15961 fi
15962 $rm_try
15963
15964 : check for off64_t
15965 echo " "
15966 echo "Checking to see if you have off64_t..." >&4
15967 $cat >try.c <<EOCP
15968 #include <sys/types.h>
15969 #include <unistd.h>
15970 int main() { off64_t x = 7; }
15971 EOCP
15972 set try
15973 if eval $compile; then
15974         val="$define"
15975         echo "You have off64_t."
15976 else
15977         val="$undef"
15978         echo "You do not have off64_t."
15979         case "$lseeksize" in
15980         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15981         esac
15982 fi
15983 $rm_try
15984 set d_off64_t
15985 eval $setvar
15986
15987 : how to create joinable pthreads
15988 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15989         echo " "
15990         echo "Checking what constant to use for creating joinable pthreads..." >&4
15991         $cat >try.c <<'EOCP'
15992 #include <pthread.h>
15993 int main() {
15994     int detachstate = JOINABLE;
15995 }
15996 EOCP
15997         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15998         if eval $compile; then
15999                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16000                 val="$undef" # Yes, undef.
16001                 set d_old_pthread_create_joinable
16002                 eval $setvar
16003                 val=""
16004                 set old_pthread_create_joinable
16005                 eval $setvar
16006         else
16007                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16008                 if eval $compile; then
16009                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16010                         val="$define"
16011                         set d_old_pthread_create_joinable
16012                         eval $setvar
16013                         val=PTHREAD_CREATE_UNDETACHED
16014                         set old_pthread_create_joinable
16015                         eval $setvar
16016                 else
16017                         set try -DJOINABLE=__UNDETACHED
16018                         if eval $compile; then
16019                                 echo "You seem to use __UNDETACHED." >&4
16020                                 val="$define"
16021                                 set d_old_pthread_create_joinable
16022                                 eval $setvar
16023                                 val=__UNDETACHED
16024                                 set old_pthread_create_joinable
16025                                 eval $setvar
16026                         else
16027                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16028                                 val="$define"
16029                                 set d_old_pthread_create_joinable
16030                                 eval $setvar
16031                                 val=0
16032                                 set old_pthread_create_joinable
16033                                 eval $setvar
16034                         fi
16035                 fi
16036         fi
16037         $rm_try
16038 else
16039     d_old_pthread_create_joinable="$undef"
16040     old_pthread_create_joinable=""
16041 fi
16042
16043 : see if pause exists
16044 set pause d_pause
16045 eval $inlibc
16046
16047 : see if poll exists
16048 set poll d_poll
16049 eval $inlibc
16050
16051 : see if prctl exists
16052 set prctl d_prctl
16053 eval $inlibc
16054
16055 : see if prctl supports PR_SET_NAME
16056 d_prctl_set_name=$undef
16057 case $d_prctl in
16058     $define)
16059         $cat >try.c <<EOM
16060 #include <sys/prctl.h>
16061
16062 int main (int argc, char *argv[])
16063 {
16064     return (prctl (PR_SET_NAME, "Test"));
16065     } /* main */
16066 EOM
16067         set try
16068         if eval $compile_ok && $run ./try; then
16069             echo "Your prctl (PR_SET_NAME, ...) works"
16070             d_prctl_set_name=$define
16071             fi
16072         $rm_try
16073         ;;
16074     esac
16075
16076 : see if readlink exists
16077 set readlink d_readlink
16078 eval $inlibc
16079
16080 : Check if exe is symlink to abs path of executing program
16081 echo " "
16082 procselfexe=''
16083 val="$undef"
16084 case "$d_readlink" in
16085 "$define")
16086         if $issymlink /proc/self/exe ; then
16087                 $ls -l /proc/self/exe > reflect
16088                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16089                         echo "You have Linux-like /proc/self/exe."
16090                         procselfexe='"/proc/self/exe"'
16091                         val="$define"
16092                 fi
16093         fi
16094         if $issymlink /proc/curproc/file ; then
16095                 $ls -l /proc/curproc/file > reflect
16096                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16097                         echo "You have BSD-like /proc/curproc/file."
16098                         procselfexe='"/proc/curproc/file"'
16099                         val="$define"
16100                 fi
16101         fi
16102         ;;
16103 esac
16104 $rm -f reflect
16105 set d_procselfexe
16106 eval $setvar
16107
16108 : backward compatibility for d_hvfork
16109 if test X$d_hvfork != X; then
16110         d_vfork="$d_hvfork"
16111         d_hvfork=''
16112 fi
16113 : see if there is a vfork
16114 val=''
16115 set vfork val
16116 eval $inlibc
16117
16118 d_pseudofork=$undef
16119
16120 : Ok, but do we want to use it. vfork is reportedly unreliable in
16121 : perl on Solaris 2.x, and probably elsewhere.
16122 case "$val" in
16123 $define)
16124         echo " "
16125         case "$usevfork" in
16126         false) dflt='n';;
16127         *) dflt='y';;
16128         esac
16129         cat <<'EOM'
16130
16131 Perl can only use a vfork() that doesn't suffer from strict
16132 restrictions on calling functions or modifying global data in
16133 the child.  For example, glibc-2.1 contains such a vfork()
16134 that is unsuitable.  If your system provides a proper fork()
16135 call, chances are that you do NOT want perl to use vfork().
16136
16137 EOM
16138         rp="Do you still want to use vfork()?"
16139         . ./myread
16140         case "$ans" in
16141         y|Y) ;;
16142         *)
16143                 echo "Ok, we won't use vfork()."
16144                 val="$undef"
16145                 ;;
16146         esac
16147         ;;
16148 esac
16149 set d_vfork
16150 eval $setvar
16151 case "$d_vfork" in
16152 $define) usevfork='true';;
16153 *) usevfork='false';;
16154 esac
16155
16156 : see whether the pthread_atfork exists
16157 $cat >try.c <<EOP
16158 #include <pthread.h>
16159 #include <stdio.h>
16160 int main() {
16161 #ifdef  PTHREAD_ATFORK
16162         pthread_atfork(NULL,NULL,NULL);
16163 #endif
16164 }
16165 EOP
16166
16167 : see if pthread_atfork exists
16168 set try -DPTHREAD_ATFORK
16169 if eval $compile; then
16170     val="$define"
16171 else
16172     val="$undef"
16173 fi
16174 case "$usethreads" in
16175 $define)
16176         case "$val" in
16177         $define) echo 'pthread_atfork found.' >&4        ;;
16178         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16179         esac
16180 esac
16181 set d_pthread_atfork
16182 eval $setvar
16183
16184 : see if pthread_attr_setscope exists
16185 set pthread_attr_setscope d_pthread_attr_setscope
16186 eval $inlibc
16187
16188 : see whether the various POSIXish _yields exist
16189 $cat >try.c <<EOP
16190 #include <pthread.h>
16191 #include <stdio.h>
16192 int main() {
16193 #ifdef SCHED_YIELD
16194         sched_yield();
16195 #else
16196 #ifdef PTHREAD_YIELD
16197         pthread_yield();
16198 #else
16199 #ifdef PTHREAD_YIELD_NULL
16200         pthread_yield(NULL);
16201 #endif
16202 #endif
16203 #endif
16204 }
16205 EOP
16206 : see if sched_yield exists
16207 set try -DSCHED_YIELD
16208 if eval $compile; then
16209     val="$define"
16210     sched_yield='sched_yield()'
16211 else
16212     val="$undef"
16213 fi
16214 case "$usethreads" in
16215 $define)
16216         case "$val" in
16217         $define) echo 'sched_yield() found.' >&4        ;;
16218         *)       echo 'sched_yield() NOT found.' >&4    ;;
16219         esac
16220 esac
16221 set d_sched_yield
16222 eval $setvar
16223
16224 : see if pthread_yield exists
16225 set try -DPTHREAD_YIELD
16226 if eval $compile; then
16227     val="$define"
16228     case "$sched_yield" in
16229     '') sched_yield='pthread_yield()' ;;
16230     esac
16231 else
16232     set try -DPTHREAD_YIELD_NULL
16233     if eval $compile; then
16234         val="$define"
16235         case "$sched_yield" in
16236         '') sched_yield='pthread_yield(NULL)' ;;
16237         esac
16238     else
16239         val="$undef"
16240     fi
16241 fi
16242 case "$usethreads" in
16243 $define)
16244         case "$val" in
16245         $define) echo 'pthread_yield() found.' >&4      ;;
16246         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16247         esac
16248         ;;
16249 esac
16250 set d_pthread_yield
16251 eval $setvar
16252 case "$sched_yield" in
16253 '') sched_yield=undef ;;
16254 esac
16255 $rm_try
16256
16257 : see if random_r exists
16258 set random_r d_random_r
16259 eval $inlibc
16260 case "$d_random_r" in
16261 "$define")
16262         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16263         case "$d_random_r_proto:$usethreads" in
16264         ":define")      d_random_r_proto=define
16265                 set d_random_r_proto random_r $hdrs
16266                 eval $hasproto ;;
16267         *)      ;;
16268         esac
16269         case "$d_random_r_proto" in
16270         define)
16271         case "$random_r_proto" in
16272         ''|0) try='int random_r(int*, struct random_data*);'
16273         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16274         esac
16275         case "$random_r_proto" in
16276         ''|0) try='int random_r(long*, struct random_data*);'
16277         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16278         esac
16279         case "$random_r_proto" in
16280         ''|0) try='int random_r(struct random_data*, int32_t*);'
16281         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16282         esac
16283         case "$random_r_proto" in
16284         ''|0)   d_random_r=undef
16285                 random_r_proto=0
16286                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16287         * )     case "$random_r_proto" in
16288                 REENTRANT_PROTO*) ;;
16289                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16290                 esac
16291                 echo "Prototype: $try" ;;
16292         esac
16293         ;;
16294         *)      case "$usethreads" in
16295                 define) echo "random_r has no prototype, not using it." >&4 ;;
16296                 esac
16297                 d_random_r=undef
16298                 random_r_proto=0
16299                 ;;
16300         esac
16301         ;;
16302 *)      random_r_proto=0
16303         ;;
16304 esac
16305
16306 : see if readdir and friends exist
16307 set readdir d_readdir
16308 eval $inlibc
16309 set seekdir d_seekdir
16310 eval $inlibc
16311 set telldir d_telldir
16312 eval $inlibc
16313 set rewinddir d_rewinddir
16314 eval $inlibc
16315
16316 : see if readdir64_r exists
16317 set readdir64_r d_readdir64_r
16318 eval $inlibc
16319 case "$d_readdir64_r" in
16320 "$define")
16321         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16322         case "$d_readdir64_r_proto:$usethreads" in
16323         ":define")      d_readdir64_r_proto=define
16324                 set d_readdir64_r_proto readdir64_r $hdrs
16325                 eval $hasproto ;;
16326         *)      ;;
16327         esac
16328         case "$d_readdir64_r_proto" in
16329         define)
16330         case "$readdir64_r_proto" in
16331         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16332         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16333         esac
16334         case "$readdir64_r_proto" in
16335         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16336         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16337         esac
16338         case "$readdir64_r_proto" in
16339         ''|0)   d_readdir64_r=undef
16340                 readdir64_r_proto=0
16341                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16342         * )     case "$readdir64_r_proto" in
16343                 REENTRANT_PROTO*) ;;
16344                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16345                 esac
16346                 echo "Prototype: $try" ;;
16347         esac
16348         ;;
16349         *)      case "$usethreads" in
16350                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16351                 esac
16352                 d_readdir64_r=undef
16353                 readdir64_r_proto=0
16354                 ;;
16355         esac
16356         ;;
16357 *)      readdir64_r_proto=0
16358         ;;
16359 esac
16360
16361 : see if readdir_r exists
16362 set readdir_r d_readdir_r
16363 eval $inlibc
16364 case "$d_readdir_r" in
16365 "$define")
16366         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16367         case "$d_readdir_r_proto:$usethreads" in
16368         ":define")      d_readdir_r_proto=define
16369                 set d_readdir_r_proto readdir_r $hdrs
16370                 eval $hasproto ;;
16371         *)      ;;
16372         esac
16373         case "$d_readdir_r_proto" in
16374         define)
16375         case "$readdir_r_proto" in
16376         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16377         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16378         esac
16379         case "$readdir_r_proto" in
16380         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16381         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16382         esac
16383         case "$readdir_r_proto" in
16384         ''|0)   d_readdir_r=undef
16385                 readdir_r_proto=0
16386                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16387         * )     case "$readdir_r_proto" in
16388                 REENTRANT_PROTO*) ;;
16389                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16390                 esac
16391                 echo "Prototype: $try" ;;
16392         esac
16393         ;;
16394         *)      case "$usethreads" in
16395                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16396                 esac
16397                 d_readdir_r=undef
16398                 readdir_r_proto=0
16399                 ;;
16400         esac
16401         ;;
16402 *)      readdir_r_proto=0
16403         ;;
16404 esac
16405
16406 : see if readv exists
16407 set readv d_readv
16408 eval $inlibc
16409
16410 : see if recvmsg exists
16411 set recvmsg d_recvmsg
16412 eval $inlibc
16413
16414 : see if rename exists
16415 set rename d_rename
16416 eval $inlibc
16417
16418 : see if rmdir exists
16419 set rmdir d_rmdir
16420 eval $inlibc
16421
16422 : see if memory.h is available.
16423 val=''
16424 set memory.h val
16425 eval $inhdr
16426
16427 : See if it conflicts with string.h
16428 case "$val" in
16429 $define)
16430         case "$strings" in
16431         '') ;;
16432         *)
16433                 $cppstdin $cppflags $cppminus < $strings > mem.h
16434                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16435                         echo " "
16436                         echo "We won't be including <memory.h>."
16437                         val="$undef"
16438                 fi
16439                 $rm -f mem.h
16440                 ;;
16441         esac
16442 esac
16443 set i_memory
16444 eval $setvar
16445
16446 : can bcopy handle overlapping blocks?
16447 echo " "
16448 val="$undef"
16449 case "$d_memmove" in
16450 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16451 *)      case "$d_bcopy" in
16452         "$define")
16453                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16454                 $cat >try.c <<EOCP
16455 #$i_memory I_MEMORY
16456 #$i_stdlib I_STDLIB
16457 #$i_string I_STRING
16458 #$i_unistd I_UNISTD
16459 EOCP
16460         $cat >>try.c <<'EOCP'
16461 #include <stdio.h>
16462 #ifdef I_MEMORY
16463 #  include <memory.h>
16464 #endif
16465 #ifdef I_STDLIB
16466 #  include <stdlib.h>
16467 #endif
16468 #ifdef I_STRING
16469 #  include <string.h>
16470 #else
16471 #  include <strings.h>
16472 #endif
16473 #ifdef I_UNISTD
16474 #  include <unistd.h>  /* Needed for NetBSD */
16475 #endif
16476 int main()
16477 {
16478 char buf[128], abc[128];
16479 char *b;
16480 int len;
16481 int off;
16482 int align;
16483
16484 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16485    try to store the string in read-only memory. */
16486 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16487
16488 for (align = 7; align >= 0; align--) {
16489         for (len = 36; len; len--) {
16490                 b = buf+align;
16491                 bcopy(abc, b, len);
16492                 for (off = 1; off <= len; off++) {
16493                         bcopy(b, b+off, len);
16494                         bcopy(b+off, b, len);
16495                         if (bcmp(b, abc, len))
16496                                 exit(1);
16497                 }
16498         }
16499 }
16500 exit(0);
16501 }
16502 EOCP
16503                 set try
16504                 if eval $compile_ok; then
16505                         if $run ./try 2>/dev/null; then
16506                                 echo "Yes, it can."
16507                                 val="$define"
16508                         else
16509                                 echo "It can't, sorry."
16510                         fi
16511                 else
16512                         echo "(I can't compile the test program, so we'll assume not...)"
16513                 fi
16514                 ;;
16515         esac
16516         $rm_try
16517         ;;
16518 esac
16519 set d_safebcpy
16520 eval $setvar
16521
16522 : can memcpy handle overlapping blocks?
16523 echo " "
16524 val="$undef"
16525 case "$d_memmove" in
16526 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16527 *)      case "$d_memcpy" in
16528         "$define")
16529                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16530                 $cat >try.c <<EOCP
16531 #$i_memory I_MEMORY
16532 #$i_stdlib I_STDLIB
16533 #$i_string I_STRING
16534 #$i_unistd I_UNISTD
16535 EOCP
16536         $cat >>try.c <<'EOCP'
16537 #include <stdio.h>
16538 #ifdef I_MEMORY
16539 #  include <memory.h>
16540 #endif
16541 #ifdef I_STDLIB
16542 #  include <stdlib.h>
16543 #endif
16544 #ifdef I_STRING
16545 #  include <string.h>
16546 #else
16547 #  include <strings.h>
16548 #endif
16549 #ifdef I_UNISTD
16550 #  include <unistd.h>  /* Needed for NetBSD */
16551 #endif
16552 int main()
16553 {
16554 char buf[128], abc[128];
16555 char *b;
16556 int len;
16557 int off;
16558 int align;
16559
16560 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16561    try to store the string in read-only memory. */
16562 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16563
16564 for (align = 7; align >= 0; align--) {
16565         for (len = 36; len; len--) {
16566                 b = buf+align;
16567                 memcpy(b, abc, len);
16568                 for (off = 1; off <= len; off++) {
16569                         memcpy(b+off, b, len);
16570                         memcpy(b, b+off, len);
16571                         if (memcmp(b, abc, len))
16572                                 exit(1);
16573                 }
16574         }
16575 }
16576 exit(0);
16577 }
16578 EOCP
16579                 set try
16580                 if eval $compile_ok; then
16581                         if $run ./try 2>/dev/null; then
16582                                 echo "Yes, it can."
16583                                 val="$define"
16584                         else
16585                                 echo "It can't, sorry."
16586                         fi
16587                 else
16588                         echo "(I can't compile the test program, so we'll assume not...)"
16589                 fi
16590                 ;;
16591         esac
16592         $rm_try
16593         ;;
16594 esac
16595 set d_safemcpy
16596 eval $setvar
16597
16598 : can memcmp be trusted to compare relative magnitude?
16599 val="$undef"
16600 case "$d_memcmp" in
16601 "$define")
16602         echo " "
16603         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16604         $cat >try.c <<EOCP
16605 #$i_memory I_MEMORY
16606 #$i_stdlib I_STDLIB
16607 #$i_string I_STRING
16608 #$i_unistd I_UNISTD
16609 EOCP
16610         $cat >>try.c <<'EOCP'
16611 #include <stdio.h>
16612 #ifdef I_MEMORY
16613 #  include <memory.h>
16614 #endif
16615 #ifdef I_STDLIB
16616 #  include <stdlib.h>
16617 #endif
16618 #ifdef I_STRING
16619 #  include <string.h>
16620 #else
16621 #  include <strings.h>
16622 #endif
16623 #ifdef I_UNISTD
16624 #  include <unistd.h>  /* Needed for NetBSD */
16625 #endif
16626 int main()
16627 {
16628 char a = -1;
16629 char b = 0;
16630 if ((a < b) && memcmp(&a, &b, 1) < 0)
16631         exit(1);
16632 exit(0);
16633 }
16634 EOCP
16635         set try
16636         if eval $compile_ok; then
16637                 if $run ./try 2>/dev/null; then
16638                         echo "Yes, it can."
16639                         val="$define"
16640                 else
16641                         echo "No, it can't (it uses signed chars)."
16642                 fi
16643         else
16644                 echo "(I can't compile the test program, so we'll assume not...)"
16645         fi
16646         ;;
16647 esac
16648 $rm_try
16649 set d_sanemcmp
16650 eval $setvar
16651
16652 : see if prototype for sbrk is available
16653 echo " "
16654 set d_sbrkproto sbrk $i_unistd unistd.h
16655 eval $hasproto
16656
16657 : see if select exists
16658 set select d_select
16659 eval $inlibc
16660
16661 : see if semctl exists
16662 set semctl d_semctl
16663 eval $inlibc
16664
16665 : see if semget exists
16666 set semget d_semget
16667 eval $inlibc
16668
16669 : see if semop exists
16670 set semop d_semop
16671 eval $inlibc
16672
16673 : see how much of the 'sem*(2)' library is present.
16674 h_sem=true
16675 echo " "
16676 case "$d_semctl$d_semget$d_semop" in
16677 *"$undef"*) h_sem=false;;
16678 esac
16679 case "$osname" in
16680 freebsd)
16681     case "`ipcs 2>&1`" in
16682     "SVID messages"*"not configured"*)
16683         echo "Your $osname does not have the sem*(2) configured." >&4
16684         h_sem=false
16685         val="$undef"
16686         set semctl d_semctl
16687         eval $setvar
16688         set semget d_semget
16689         eval $setvar
16690         set semop d_semop
16691         eval $setvar
16692         ;;
16693     esac
16694     ;;
16695 esac
16696 : we could also check for sys/ipc.h ...
16697 if $h_sem && $test `./findhdr sys/sem.h`; then
16698         echo "You have the full sem*(2) library." >&4
16699         val="$define"
16700 else
16701         echo "You don't have the full sem*(2) library." >&4
16702         val="$undef"
16703 fi
16704 set d_sem
16705 eval $setvar
16706
16707 : see whether sys/sem.h defines union semun
16708 echo " "
16709 $cat > try.c <<'END'
16710 #include <sys/types.h>
16711 #include <sys/ipc.h>
16712 #include <sys/sem.h>
16713 int main () { union semun semun; semun.buf = 0; }
16714 END
16715 set try
16716 if eval $compile; then
16717     echo "You have union semun in <sys/sem.h>." >&4
16718     val="$define"
16719 else
16720     echo "You do not have union semun in <sys/sem.h>." >&4
16721     val="$undef"
16722 fi
16723 $rm_try
16724 set d_union_semun
16725 eval $setvar
16726
16727 : see how to do semctl IPC_STAT
16728 case "$d_sem" in
16729 $define)
16730     echo " "
16731     $cat > tryh.h <<END
16732 #ifndef S_IRUSR
16733 #   ifdef S_IREAD
16734 #       define S_IRUSR S_IREAD
16735 #       define S_IWUSR S_IWRITE
16736 #       define S_IXUSR S_IEXEC
16737 #   else
16738 #       define S_IRUSR 0400
16739 #       define S_IWUSR 0200
16740 #       define S_IXUSR 0100
16741 #   endif
16742 #   define S_IRGRP (S_IRUSR>>3)
16743 #   define S_IWGRP (S_IWUSR>>3)
16744 #   define S_IXGRP (S_IXUSR>>3)
16745 #   define S_IROTH (S_IRUSR>>6)
16746 #   define S_IWOTH (S_IWUSR>>6)
16747 #   define S_IXOTH (S_IXUSR>>6)
16748 #endif
16749 #ifndef S_IRWXU
16750 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16751 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16752 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16753 #endif
16754 END
16755     : see whether semctl IPC_STAT can use union semun
16756     case "$d_semctl_semun" in
16757     '')
16758       val="$undef"
16759       $cat > try.c <<END
16760 #include <sys/types.h>
16761 #include <sys/ipc.h>
16762 #include <sys/sem.h>
16763 #include <sys/stat.h>
16764 #include <stdio.h>
16765 #include <errno.h>
16766 #include "tryh.h"
16767 #ifndef errno
16768 extern int errno;
16769 #endif
16770 #$d_union_semun HAS_UNION_SEMUN
16771 int main() {
16772     union semun
16773 #ifndef HAS_UNION_SEMUN
16774     {
16775         int val;
16776         struct semid_ds *buf;
16777         unsigned short *array;
16778     }
16779 #endif
16780     arg;
16781     int sem, st;
16782
16783 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16784     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16785     if (sem > -1) {
16786         struct semid_ds argbuf;
16787         arg.buf = &argbuf;
16788 #       ifdef IPC_STAT
16789         st = semctl(sem, 0, IPC_STAT, arg);
16790         if (st == 0)
16791             printf("semun\n");
16792         else
16793 #       endif /* IPC_STAT */
16794             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16795 #       ifdef IPC_RMID
16796         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16797 #       endif /* IPC_RMID */
16798             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16799     } else
16800 #endif /* IPC_PRIVATE && ... */
16801         printf("semget failed: errno = %d\n", errno);
16802   return 0;
16803 }
16804 END
16805       set try
16806       if eval $compile; then
16807           xxx=`$run ./try`
16808           case "$xxx" in
16809           semun) val="$define" ;;
16810           esac
16811       fi
16812       $rm_try
16813       set d_semctl_semun
16814       eval $setvar
16815       ;;
16816     esac
16817     case "$d_semctl_semun" in
16818     $define)
16819         echo "You can use union semun for semctl IPC_STAT." >&4
16820         also='also'
16821         ;;
16822     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16823         also=''
16824         ;;
16825     esac
16826
16827     : see whether semctl IPC_STAT can use struct semid_ds pointer
16828     case "$d_semctl_semid_ds" in
16829     '')
16830       val="$undef"
16831       $cat > try.c <<'END'
16832 #include <sys/types.h>
16833 #include <sys/ipc.h>
16834 #include <sys/sem.h>
16835 #include <sys/stat.h>
16836 #include "tryh.h"
16837 #include <stdio.h>
16838 #include <errno.h>
16839 #ifndef errno
16840 extern int errno;
16841 #endif
16842 int main() {
16843     struct semid_ds arg;
16844     int sem, st;
16845
16846 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16847     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16848     if (sem > -1) {
16849 #       ifdef IPC_STAT
16850         st = semctl(sem, 0, IPC_STAT, &arg);
16851         if (st == 0)
16852             printf("semid_ds\n");
16853         else
16854 #       endif /* IPC_STAT */
16855             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16856 #       ifdef IPC_RMID
16857         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16858 #       endif /* IPC_RMID */
16859             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16860     } else
16861 #endif /* IPC_PRIVATE && ... */
16862         printf("semget failed: errno = %d\n", errno);
16863
16864     return 0;
16865 }
16866 END
16867       set try
16868       if eval $compile; then
16869           xxx=`$run ./try`
16870           case "$xxx" in
16871           semid_ds) val="$define" ;;
16872           esac
16873       fi
16874       $rm_try
16875       set d_semctl_semid_ds
16876       eval $setvar
16877       ;;
16878     esac
16879     case "$d_semctl_semid_ds" in
16880     $define)
16881         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16882         ;;
16883     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16884         ;;
16885     esac
16886     ;;
16887 *)  val="$undef"
16888
16889     # We do not have the full sem*(2) library, so assume we can not
16890     # use either.
16891
16892     set d_semctl_semun
16893     eval $setvar
16894
16895     set d_semctl_semid_ds
16896     eval $setvar
16897     ;;
16898 esac
16899 $rm_try tryh.h
16900
16901 : see if sendmsg exists
16902 set sendmsg d_sendmsg
16903 eval $inlibc
16904
16905 : see if setegid exists
16906 set setegid d_setegid
16907 eval $inlibc
16908
16909 : see if seteuid exists
16910 set seteuid d_seteuid
16911 eval $inlibc
16912
16913 : see if setgrent exists
16914 set setgrent d_setgrent
16915 eval $inlibc
16916
16917 : see if setgrent_r exists
16918 set setgrent_r d_setgrent_r
16919 eval $inlibc
16920 case "$d_setgrent_r" in
16921 "$define")
16922         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16923         case "$d_setgrent_r_proto:$usethreads" in
16924         ":define")      d_setgrent_r_proto=define
16925                 set d_setgrent_r_proto setgrent_r $hdrs
16926                 eval $hasproto ;;
16927         *)      ;;
16928         esac
16929         case "$d_setgrent_r_proto" in
16930         define)
16931         case "$setgrent_r_proto" in
16932         ''|0) try='int setgrent_r(FILE**);'
16933         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16934         esac
16935         case "$setgrent_r_proto" in
16936         ''|0) try='void setgrent_r(FILE**);'
16937         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16938         esac
16939         case "$setgrent_r_proto" in
16940         ''|0)   d_setgrent_r=undef
16941                 setgrent_r_proto=0
16942                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16943         * )     case "$setgrent_r_proto" in
16944                 REENTRANT_PROTO*) ;;
16945                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16946                 esac
16947                 echo "Prototype: $try" ;;
16948         esac
16949         ;;
16950         *)      case "$usethreads" in
16951                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16952                 esac
16953                 d_setgrent_r=undef
16954                 setgrent_r_proto=0
16955                 ;;
16956         esac
16957         ;;
16958 *)      setgrent_r_proto=0
16959         ;;
16960 esac
16961
16962 : see if sethostent exists
16963 set sethostent d_sethent
16964 eval $inlibc
16965
16966 : see if sethostent_r exists
16967 set sethostent_r d_sethostent_r
16968 eval $inlibc
16969 case "$d_sethostent_r" in
16970 "$define")
16971         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16972         case "$d_sethostent_r_proto:$usethreads" in
16973         ":define")      d_sethostent_r_proto=define
16974                 set d_sethostent_r_proto sethostent_r $hdrs
16975                 eval $hasproto ;;
16976         *)      ;;
16977         esac
16978         case "$d_sethostent_r_proto" in
16979         define)
16980         case "$sethostent_r_proto" in
16981         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16982         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16983         esac
16984         case "$sethostent_r_proto" in
16985         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16986         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16987         esac
16988         case "$sethostent_r_proto" in
16989         ''|0)   d_sethostent_r=undef
16990                 sethostent_r_proto=0
16991                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16992         * )     case "$sethostent_r_proto" in
16993                 REENTRANT_PROTO*) ;;
16994                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16995                 esac
16996                 echo "Prototype: $try" ;;
16997         esac
16998         ;;
16999         *)      case "$usethreads" in
17000                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17001                 esac
17002                 d_sethostent_r=undef
17003                 sethostent_r_proto=0
17004                 ;;
17005         esac
17006         ;;
17007 *)      sethostent_r_proto=0
17008         ;;
17009 esac
17010
17011 : see if setitimer exists
17012 set setitimer d_setitimer
17013 eval $inlibc
17014
17015 : see if setlinebuf exists
17016 set setlinebuf d_setlinebuf
17017 eval $inlibc
17018
17019 : see if setlocale exists
17020 set setlocale d_setlocale
17021 eval $inlibc
17022
17023 : see if locale.h is available
17024 set locale.h i_locale
17025 eval $inhdr
17026
17027 : see if setlocale_r exists
17028 set setlocale_r d_setlocale_r
17029 eval $inlibc
17030 case "$d_setlocale_r" in
17031 "$define")
17032         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17033         case "$d_setlocale_r_proto:$usethreads" in
17034         ":define")      d_setlocale_r_proto=define
17035                 set d_setlocale_r_proto setlocale_r $hdrs
17036                 eval $hasproto ;;
17037         *)      ;;
17038         esac
17039         case "$d_setlocale_r_proto" in
17040         define)
17041         case "$setlocale_r_proto" in
17042         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17043         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17044         esac
17045         case "$setlocale_r_proto" in
17046         ''|0)   d_setlocale_r=undef
17047                 setlocale_r_proto=0
17048                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17049         * )     case "$setlocale_r_proto" in
17050                 REENTRANT_PROTO*) ;;
17051                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17052                 esac
17053                 echo "Prototype: $try" ;;
17054         esac
17055         ;;
17056         *)      case "$usethreads" in
17057                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17058                 esac
17059                 d_setlocale_r=undef
17060                 setlocale_r_proto=0
17061                 ;;
17062         esac
17063         ;;
17064 *)      setlocale_r_proto=0
17065         ;;
17066 esac
17067
17068 : see if setnetent exists
17069 set setnetent d_setnent
17070 eval $inlibc
17071
17072 : see if setnetent_r exists
17073 set setnetent_r d_setnetent_r
17074 eval $inlibc
17075 case "$d_setnetent_r" in
17076 "$define")
17077         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17078         case "$d_setnetent_r_proto:$usethreads" in
17079         ":define")      d_setnetent_r_proto=define
17080                 set d_setnetent_r_proto setnetent_r $hdrs
17081                 eval $hasproto ;;
17082         *)      ;;
17083         esac
17084         case "$d_setnetent_r_proto" in
17085         define)
17086         case "$setnetent_r_proto" in
17087         ''|0) try='int setnetent_r(int, struct netent_data*);'
17088         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17089         esac
17090         case "$setnetent_r_proto" in
17091         ''|0) try='void setnetent_r(int, struct netent_data*);'
17092         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17093         esac
17094         case "$setnetent_r_proto" in
17095         ''|0)   d_setnetent_r=undef
17096                 setnetent_r_proto=0
17097                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17098         * )     case "$setnetent_r_proto" in
17099                 REENTRANT_PROTO*) ;;
17100                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17101                 esac
17102                 echo "Prototype: $try" ;;
17103         esac
17104         ;;
17105         *)      case "$usethreads" in
17106                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17107                 esac
17108                 d_setnetent_r=undef
17109                 setnetent_r_proto=0
17110                 ;;
17111         esac
17112         ;;
17113 *)      setnetent_r_proto=0
17114         ;;
17115 esac
17116
17117 : see if setprotoent exists
17118 set setprotoent d_setpent
17119 eval $inlibc
17120
17121 : see if setpgid exists
17122 set setpgid d_setpgid
17123 eval $inlibc
17124
17125 : see if setpgrp2 exists
17126 set setpgrp2 d_setpgrp2
17127 eval $inlibc
17128
17129 : see if setpriority exists
17130 set setpriority d_setprior
17131 eval $inlibc
17132
17133 : see if setproctitle exists
17134 set setproctitle d_setproctitle
17135 eval $inlibc
17136
17137 : see if setprotoent_r exists
17138 set setprotoent_r d_setprotoent_r
17139 eval $inlibc
17140 case "$d_setprotoent_r" in
17141 "$define")
17142         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17143         case "$d_setprotoent_r_proto:$usethreads" in
17144         ":define")      d_setprotoent_r_proto=define
17145                 set d_setprotoent_r_proto setprotoent_r $hdrs
17146                 eval $hasproto ;;
17147         *)      ;;
17148         esac
17149         case "$d_setprotoent_r_proto" in
17150         define)
17151         case "$setprotoent_r_proto" in
17152         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17153         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17154         esac
17155         case "$setprotoent_r_proto" in
17156         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17157         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17158         esac
17159         case "$setprotoent_r_proto" in
17160         ''|0)   d_setprotoent_r=undef
17161                 setprotoent_r_proto=0
17162                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17163         * )     case "$setprotoent_r_proto" in
17164                 REENTRANT_PROTO*) ;;
17165                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17166                 esac
17167                 echo "Prototype: $try" ;;
17168         esac
17169         ;;
17170         *)      case "$usethreads" in
17171                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17172                 esac
17173                 d_setprotoent_r=undef
17174                 setprotoent_r_proto=0
17175                 ;;
17176         esac
17177         ;;
17178 *)      setprotoent_r_proto=0
17179         ;;
17180 esac
17181
17182 : see if setpwent exists
17183 set setpwent d_setpwent
17184 eval $inlibc
17185
17186 : see if setpwent_r exists
17187 set setpwent_r d_setpwent_r
17188 eval $inlibc
17189 case "$d_setpwent_r" in
17190 "$define")
17191         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17192         case "$d_setpwent_r_proto:$usethreads" in
17193         ":define")      d_setpwent_r_proto=define
17194                 set d_setpwent_r_proto setpwent_r $hdrs
17195                 eval $hasproto ;;
17196         *)      ;;
17197         esac
17198         case "$d_setpwent_r_proto" in
17199         define)
17200         case "$setpwent_r_proto" in
17201         ''|0) try='int setpwent_r(FILE**);'
17202         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17203         esac
17204         case "$setpwent_r_proto" in
17205         ''|0) try='void setpwent_r(FILE**);'
17206         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17207         esac
17208         case "$setpwent_r_proto" in
17209         ''|0)   d_setpwent_r=undef
17210                 setpwent_r_proto=0
17211                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17212         * )     case "$setpwent_r_proto" in
17213                 REENTRANT_PROTO*) ;;
17214                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17215                 esac
17216                 echo "Prototype: $try" ;;
17217         esac
17218         ;;
17219         *)      case "$usethreads" in
17220                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17221                 esac
17222                 d_setpwent_r=undef
17223                 setpwent_r_proto=0
17224                 ;;
17225         esac
17226         ;;
17227 *)      setpwent_r_proto=0
17228         ;;
17229 esac
17230
17231 : see if setregid exists
17232 set setregid d_setregid
17233 eval $inlibc
17234 set setresgid d_setresgid
17235 eval $inlibc
17236
17237 : see if setreuid exists
17238 set setreuid d_setreuid
17239 eval $inlibc
17240 set setresuid d_setresuid
17241 eval $inlibc
17242
17243 : see if setrgid exists
17244 set setrgid d_setrgid
17245 eval $inlibc
17246
17247 : see if setruid exists
17248 set setruid d_setruid
17249 eval $inlibc
17250
17251 : see if setservent exists
17252 set setservent d_setsent
17253 eval $inlibc
17254
17255 : see if setservent_r exists
17256 set setservent_r d_setservent_r
17257 eval $inlibc
17258 case "$d_setservent_r" in
17259 "$define")
17260         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17261         case "$d_setservent_r_proto:$usethreads" in
17262         ":define")      d_setservent_r_proto=define
17263                 set d_setservent_r_proto setservent_r $hdrs
17264                 eval $hasproto ;;
17265         *)      ;;
17266         esac
17267         case "$d_setservent_r_proto" in
17268         define)
17269         case "$setservent_r_proto" in
17270         ''|0) try='int setservent_r(int, struct servent_data*);'
17271         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17272         esac
17273         case "$setservent_r_proto" in
17274         ''|0) try='void setservent_r(int, struct servent_data*);'
17275         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17276         esac
17277         case "$setservent_r_proto" in
17278         ''|0)   d_setservent_r=undef
17279                 setservent_r_proto=0
17280                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17281         * )     case "$setservent_r_proto" in
17282                 REENTRANT_PROTO*) ;;
17283                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17284                 esac
17285                 echo "Prototype: $try" ;;
17286         esac
17287         ;;
17288         *)      case "$usethreads" in
17289                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17290                 esac
17291                 d_setservent_r=undef
17292                 setservent_r_proto=0
17293                 ;;
17294         esac
17295         ;;
17296 *)      setservent_r_proto=0
17297         ;;
17298 esac
17299
17300 : see if setsid exists
17301 set setsid d_setsid
17302 eval $inlibc
17303
17304 : see if setvbuf exists
17305 set setvbuf d_setvbuf
17306 eval $inlibc
17307
17308 : see if sfio.h is available
17309 set sfio.h i_sfio
17310 eval $inhdr
17311
17312 : see if sfio library is available
17313 case "$i_sfio" in
17314 $define)
17315         val=''
17316         set sfreserve val
17317         eval $inlibc
17318         ;;
17319 *)
17320         val="$undef"
17321         ;;
17322 esac
17323 : Ok, but do we want to use it.
17324 case "$val" in
17325 $define)
17326         case "$usesfio" in
17327         true|$define|[yY]*) dflt='y';;
17328         *) dflt='n';;
17329         esac
17330         echo "$package can use the sfio library, but it is experimental."
17331         case "$useperlio" in
17332         "$undef")
17333             echo "For sfio also the PerlIO abstraction layer is needed."
17334             echo "Earlier you said you wouldn't want that."
17335             ;;
17336         esac
17337         rp="You seem to have sfio available, do you want to try using it?"
17338         . ./myread
17339         case "$ans" in
17340         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17341                 useperlio="$define"
17342                 val="$define"
17343                 ;;
17344         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17345                 val="$undef"
17346                 ;;
17347         esac
17348         ;;
17349 *)      case "$usesfio" in
17350         true|$define|[yY]*)
17351                 echo "Sorry, cannot find sfio on this machine." >&4
17352                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17353                 val="$undef"
17354                 ;;
17355         esac
17356         ;;
17357 esac
17358 set d_sfio
17359 eval $setvar
17360 case "$d_sfio" in
17361 $define) usesfio='true';;
17362 *) usesfio='false';;
17363 esac
17364 case "$d_sfio" in
17365 $define) ;;
17366 *)      : Remove sfio from list of libraries to use
17367         case "$libs" in
17368         *-lsfio*)
17369                 echo "Removing unneeded -lsfio from library list" >&4
17370                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17371                 shift
17372                 libs="$*"
17373                 echo "libs = $libs" >&4
17374                 ;;
17375         esac
17376 ;;
17377 esac
17378
17379
17380 : see if shmctl exists
17381 set shmctl d_shmctl
17382 eval $inlibc
17383
17384 : see if shmget exists
17385 set shmget d_shmget
17386 eval $inlibc
17387
17388 : see if shmat exists
17389 set shmat d_shmat
17390 eval $inlibc
17391 : see what shmat returns
17392 case "$d_shmat" in
17393 "$define")
17394         $cat >shmat.c <<'END'
17395 #include <sys/shm.h>
17396 void *shmat();
17397 END
17398         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17399                 shmattype='void *'
17400         else
17401                 shmattype='char *'
17402         fi
17403         echo "and it returns ($shmattype)." >&4
17404         : see if a prototype for shmat is available
17405         xxx=`./findhdr sys/shm.h`
17406         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17407         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17408                 val="$define"
17409         else
17410                 val="$undef"
17411         fi
17412         $rm -f shmat.[co]
17413         ;;
17414 *)
17415         val="$undef"
17416         ;;
17417 esac
17418 set d_shmatprototype
17419 eval $setvar
17420
17421 : see if shmdt exists
17422 set shmdt d_shmdt
17423 eval $inlibc
17424
17425 : see how much of the 'shm*(2)' library is present.
17426 h_shm=true
17427 echo " "
17428 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17429 *"$undef"*) h_shm=false;;
17430 esac
17431 case "$osname" in
17432 freebsd)
17433     case "`ipcs 2>&1`" in
17434     "SVID shared memory"*"not configured"*)
17435         echo "Your $osname does not have the shm*(2) configured." >&4
17436         h_shm=false
17437         val="$undef"
17438         set shmctl d_shmctl
17439         evat $setvar
17440         set shmget d_shmget
17441         evat $setvar
17442         set shmat d_shmat
17443         evat $setvar
17444         set shmdt d_shmdt
17445         evat $setvar
17446         ;;
17447     esac
17448     ;;
17449 esac
17450 : we could also check for sys/ipc.h ...
17451 if $h_shm && $test `./findhdr sys/shm.h`; then
17452         echo "You have the full shm*(2) library." >&4
17453         val="$define"
17454 else
17455         echo "You don't have the full shm*(2) library." >&4
17456         val="$undef"
17457 fi
17458 set d_shm
17459 eval $setvar
17460
17461 : see if we have sigaction
17462 echo " "
17463 if set sigaction val -f d_sigaction; eval $csym; $val; then
17464         echo 'sigaction() found.' >&4
17465         $cat > try.c <<EOP
17466 #include <stdio.h>
17467 #include <sys/types.h>
17468 #include <signal.h>
17469 #$i_stdlib I_STDLIB
17470 #ifdef I_STDLIB
17471 #include <stdlib.h>
17472 #endif
17473 int main()
17474 {
17475     struct sigaction act, oact;
17476     act.sa_flags = 0;
17477     oact.sa_handler = 0;
17478     /* so that act and oact are used */
17479     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17480 }
17481 EOP
17482         set try
17483         if eval $compile_ok; then
17484                 val="$define"
17485         else
17486                 echo "But you don't seem to have a useable struct sigaction." >&4
17487                 val="$undef"
17488         fi
17489 else
17490         echo 'sigaction NOT found.' >&4
17491         val="$undef"
17492 fi
17493 set d_sigaction; eval $setvar
17494 $rm_try
17495
17496 : see if this is a sunmath.h system
17497 set sunmath.h i_sunmath
17498 eval $inhdr
17499
17500 : see if signbit exists
17501 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17502 $cat >try.c <<EOCP
17503 #$i_math I_MATH
17504 #$i_sunmath I_SUNMATH
17505 #ifdef I_MATH
17506 #  include <math.h>
17507 #endif
17508 #ifdef I_SUNMATH  /* Solaris special math library */
17509 #  include <sunmath.h>
17510 #endif
17511 #define NV $nvtype
17512 int main(int argc, char **argv)
17513 {
17514     NV x = 0.0;
17515     NV y = -0.0;
17516     if ((signbit(x) == 0) && (signbit(y) != 0))
17517         return 0;
17518     else
17519         return 1;
17520 }
17521 EOCP
17522 val="$undef"
17523 set try
17524 if eval $compile; then
17525     if $run ./try; then
17526         $echo "Yes." >&4
17527         val="$define"
17528     else
17529         $echo "Signbit seems to be available, but doesn't work as I expected."
17530         $echo "I won't use it." >&4
17531         val="$undef"
17532     fi
17533 else
17534     $echo "Nope." >&4
17535     dflt="$undef"
17536 fi
17537 set d_signbit
17538 eval $setvar
17539 $rm_try
17540
17541 : see if sigprocmask exists
17542 set sigprocmask d_sigprocmask
17543 eval $inlibc
17544
17545 : see if sigsetjmp exists
17546 echo " "
17547 case "$d_sigsetjmp" in
17548 '')
17549         $cat >try.c <<EOP
17550 #include <setjmp.h>
17551 #$i_stdlib I_STDLIB
17552 #ifdef I_STDLIB
17553 #include <stdlib.h>
17554 #endif
17555 sigjmp_buf env;
17556 int set = 1;
17557 int main()
17558 {
17559         if (sigsetjmp(env,1))
17560                 exit(set);
17561         set = 0;
17562         siglongjmp(env, 1);
17563         exit(1);
17564 }
17565 EOP
17566         set try
17567         if eval $compile; then
17568                 if $run ./try >/dev/null 2>&1; then
17569                         echo "POSIX sigsetjmp found." >&4
17570                         val="$define"
17571                 else
17572                         $cat >&4 <<EOM
17573 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17574 I'll ignore them.
17575 EOM
17576                         val="$undef"
17577                 fi
17578         else
17579                 echo "sigsetjmp not found." >&4
17580                 val="$undef"
17581         fi
17582         ;;
17583 *) val="$d_sigsetjmp"
17584         case "$d_sigsetjmp" in
17585         $define) echo "POSIX sigsetjmp found." >&4;;
17586         $undef) echo "sigsetjmp not found." >&4;;
17587         esac
17588         ;;
17589 esac
17590 set d_sigsetjmp
17591 eval $setvar
17592 $rm_try
17593
17594 : see if snprintf exists
17595 set snprintf d_snprintf
17596 eval $inlibc
17597
17598 : see if vsnprintf exists
17599 set vsnprintf d_vsnprintf
17600 eval $inlibc
17601
17602 case "$d_snprintf-$d_vsnprintf" in
17603 "$define-$define")
17604     $cat <<EOM
17605 Checking whether your snprintf() and vsnprintf() work okay...
17606 EOM
17607     $cat >try.c <<'EOCP'
17608 /* v?snprintf testing logic courtesy of Russ Allbery.
17609  * According to C99:
17610  * - if the buffer is too short it still must be \0-terminated
17611  * - if the buffer is too short the potentially required length
17612  *   must be returned and not -1
17613  * - if the buffer is NULL the potentially required length
17614  *   must be returned and not -1 or core dump
17615  */
17616 #include <stdio.h>
17617 #include <stdarg.h>
17618
17619 char buf[2];
17620
17621 int test (char *format, ...)
17622 {
17623     va_list args;
17624     int count;
17625
17626     va_start (args, format);
17627     count = vsnprintf (buf, sizeof buf, format, args);
17628     va_end (args);
17629     return count;
17630 }
17631
17632 int main ()
17633 {
17634     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17635              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17636 }
17637 EOCP
17638     set try
17639     if eval $compile; then
17640         `$run ./try`
17641         case "$?" in
17642         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17643         *) cat <<EOM >&4
17644 Your snprintf() and snprintf() don't seem to be working okay.
17645 EOM
17646            d_snprintf="$undef"
17647            d_vsnprintf="$undef"
17648            ;;
17649         esac
17650     else
17651         echo "(I can't seem to compile the test program--assuming they don't)"
17652         d_snprintf="$undef"
17653         d_vsnprintf="$undef"
17654     fi
17655     $rm_try
17656     ;;
17657 esac
17658
17659 : see if sockatmark exists
17660 set sockatmark d_sockatmark
17661 eval $inlibc
17662
17663 : see if prototype for sockatmark is available
17664 echo " "
17665 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17666 eval $hasproto
17667
17668 : see if socks5_init exists
17669 set socks5_init d_socks5_init
17670 eval $inlibc
17671
17672 : see if sprintf returns the length of the string in the buffer as per ANSI
17673 $echo "Checking whether sprintf returns the length of the string..." >&4
17674 $cat <<EOP >try.c
17675 #include <stdio.h>
17676 #$i_stdlib I_STDLIB
17677 #ifdef I_STDLIB
17678 #include <stdlib.h>
17679 #endif
17680 #$i_string I_STRING
17681 #ifdef I_STRING
17682 #  include <string.h>
17683 #else
17684 #  include <strings.h>
17685 #endif
17686 #$i_math I_MATH
17687 #ifdef I_MATH
17688 #include <math.h>
17689 #endif
17690
17691 char buffer[256];
17692
17693 int check (size_t expect, int test) {
17694   size_t got = strlen(buffer);
17695   if (expect == got)
17696     return 0;
17697
17698   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17699        test, buffer);
17700   exit (test);
17701 }
17702
17703 int main(int argc, char **argv) {
17704   int test = 0;
17705
17706   check(sprintf(buffer, ""), ++test);
17707   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17708   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17709
17710   return 0;
17711 }
17712 EOP
17713 set try
17714
17715 if eval $compile; then
17716     xxx="`$run ./try`"
17717     case "$?" in
17718         0) cat >&4 <<EOM
17719 sprintf returns the length of the string (as ANSI says it should)
17720 EOM
17721         d_sprintf_returns_strlen="$define"
17722         ;;
17723         *) cat >&4 <<EOM
17724 sprintf does not return the length of the string (how old is this system?)
17725 EOM
17726         d_sprintf_returns_strlen="$undef"
17727         ;;
17728     esac
17729 else
17730     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17731     d_sprintf_returns_strlen="$undef"
17732 fi
17733 $rm_try
17734
17735 : see if srand48_r exists
17736 set srand48_r d_srand48_r
17737 eval $inlibc
17738 case "$d_srand48_r" in
17739 "$define")
17740         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17741         case "$d_srand48_r_proto:$usethreads" in
17742         ":define")      d_srand48_r_proto=define
17743                 set d_srand48_r_proto srand48_r $hdrs
17744                 eval $hasproto ;;
17745         *)      ;;
17746         esac
17747         case "$d_srand48_r_proto" in
17748         define)
17749         case "$srand48_r_proto" in
17750         ''|0) try='int srand48_r(long, struct drand48_data*);'
17751         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17752         esac
17753         case "$srand48_r_proto" in
17754         ''|0)   d_srand48_r=undef
17755                 srand48_r_proto=0
17756                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17757         * )     case "$srand48_r_proto" in
17758                 REENTRANT_PROTO*) ;;
17759                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17760                 esac
17761                 echo "Prototype: $try" ;;
17762         esac
17763         ;;
17764         *)      case "$usethreads" in
17765                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17766                 esac
17767                 d_srand48_r=undef
17768                 srand48_r_proto=0
17769                 ;;
17770         esac
17771         ;;
17772 *)      srand48_r_proto=0
17773         ;;
17774 esac
17775
17776 : see if srandom_r exists
17777 set srandom_r d_srandom_r
17778 eval $inlibc
17779 case "$d_srandom_r" in
17780 "$define")
17781         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17782         case "$d_srandom_r_proto:$usethreads" in
17783         ":define")      d_srandom_r_proto=define
17784                 set d_srandom_r_proto srandom_r $hdrs
17785                 eval $hasproto ;;
17786         *)      ;;
17787         esac
17788         case "$d_srandom_r_proto" in
17789         define)
17790         case "$srandom_r_proto" in
17791         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17792         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17793         esac
17794         case "$srandom_r_proto" in
17795         ''|0)   d_srandom_r=undef
17796                 srandom_r_proto=0
17797                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17798         * )     case "$srandom_r_proto" in
17799                 REENTRANT_PROTO*) ;;
17800                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17801                 esac
17802                 echo "Prototype: $try" ;;
17803         esac
17804         ;;
17805         *)      case "$usethreads" in
17806                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17807                 esac
17808                 d_srandom_r=undef
17809                 srandom_r_proto=0
17810                 ;;
17811         esac
17812         ;;
17813 *)      srandom_r_proto=0
17814         ;;
17815 esac
17816
17817 : see if prototype for setresgid is available
17818 echo " "
17819 set d_sresgproto setresgid $i_unistd unistd.h
17820 eval $hasproto
17821
17822 : see if prototype for setresuid is available
17823 echo " "
17824 set d_sresuproto setresuid $i_unistd unistd.h
17825 eval $hasproto
17826
17827 : see if sys/stat.h is available
17828 set sys/stat.h i_sysstat
17829 eval $inhdr
17830
17831 : see if stat knows about block sizes
17832 echo " "
17833 echo "Checking to see if your struct stat has st_blocks field..." >&4
17834 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17835 eval $hasfield
17836
17837 : see if this is a sys/vfs.h system
17838 set sys/vfs.h i_sysvfs
17839 eval $inhdr
17840
17841 : see if this is a sys/statfs.h system
17842 set sys/statfs.h i_sysstatfs
17843 eval $inhdr
17844
17845 : Check for statfs_s
17846 echo " "
17847 echo "Checking to see if your system supports struct statfs..." >&4
17848 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
17849 eval $hasstruct
17850 case "$d_statfs_s" in
17851 "$define")      echo "Yes, it does."   ;;
17852 *)              echo "No, it doesn't." ;;
17853 esac
17854
17855
17856 : see if struct statfs knows about f_flags
17857 case "$d_statfs_s" in
17858 define)
17859         echo " "
17860         echo "Checking to see if your struct statfs has f_flags field..." >&4
17861         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
17862         eval $hasfield
17863         ;;
17864 *)      val="$undef"
17865         set d_statfs_f_flags
17866         eval $setvar
17867         ;;
17868 esac
17869 case "$d_statfs_f_flags" in
17870 "$define")      echo "Yes, it does."   ;;
17871 *)              echo "No, it doesn't." ;;
17872 esac
17873
17874 : see what flavor, if any, of static inline is supported
17875 echo " "
17876 echo "Checking to see if your system supports static inline..."
17877 $cat > try.c <<'EOCP'
17878 #include <stdlib.h>
17879 extern int f_via_a(int x);
17880 extern int f_via_b(int x);
17881 int main(int argc, char **argv)
17882 {
17883     int y;
17884
17885     y = f_via_a(0);
17886 #ifdef USE_B
17887     y = f_via_b(0);
17888 #endif
17889     if (y == 42) {
17890         return EXIT_SUCCESS;
17891     }
17892     else {
17893         return EXIT_FAILURE;
17894     }
17895 }
17896 EOCP
17897 $cat > a.c <<'EOCP'
17898 static INLINE int f(int x) {
17899     int y;
17900     y = x + 42;
17901     return y;
17902 }
17903
17904 int f_via_a(int x)
17905 {
17906     return f(x);
17907 }
17908 EOCP
17909 $cat > b.c <<'EOCP'
17910 extern int f(int x);
17911
17912 int f_via_b(int x)
17913 {
17914     return f(x);
17915 }
17916 EOCP
17917
17918 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17919 case "$perl_static_inline" in
17920 '')     # Check the various possibilities, and break out on success.
17921         # For gcc, prefer __inline__, which will still permit 
17922         # cflags.SH to add in -ansi.
17923         case "$gccversion" in
17924                 '') xxx="inline __inline__ __inline _inline";;
17925                 *)  xxx="__inline__ inline __inline _inline";;
17926         esac
17927         for inline in $xxx; do
17928                 set try -DINLINE=$inline a.c
17929                 if eval $compile && $run ./try; then
17930                         # Now make sure there is no external linkage of static
17931                         # functions
17932                         set try -DINLINE=$inline -DUSE_B a.c b.c
17933                         if eval $compile && $run ./try; then
17934                                 $echo "Your compiler supports static $inline, " >&4
17935                                 $echo "but it also creates an external definition," >&4
17936                                 $echo "so I won't use it." >&4
17937                                 val=$undef
17938                         else
17939                                 $echo "Your compiler supports static $inline." >&4
17940                                 val=$define
17941                                 perl_static_inline="static $inline";
17942                                 break;
17943                         fi
17944                 else
17945                         $echo "Your compiler does NOT support static $inline." >&4
17946                         val="$undef"
17947                 fi
17948         done
17949         ;;
17950 *inline*) # Some variant of inline exists.
17951         echo "Keeping your $hint value of $perl_static_inline."
17952         val=$define
17953         ;;
17954 static)  # No inline capabilities
17955         echo "Keeping your $hint value of $perl_static_inline."
17956         val=$undef
17957         ;;
17958 *)  # Unrecognized previous value -- blindly trust the supplied
17959         # value and hope it makes sense.  Use old value for
17960         # d_static_inline, if there is one.
17961         echo "Keeping your $hint value of $perl_static_inline."
17962         case "$d_static_inline" in
17963                 '') val=$define ;;
17964                 *)  val=$d_static_inline ;;
17965         esac
17966         ;;
17967 esac
17968 # Fallback to plain 'static' if nothing worked.
17969 case "$perl_static_inline" in
17970 '')
17971         perl_static_inline="static"
17972         val=$undef
17973         ;;
17974 esac
17975 set d_static_inline
17976 eval $setvar
17977 $rm -f a.[co] b.[co]
17978 $rm_try
17979
17980 : Check stream access
17981 $cat >&4 <<EOM
17982 Checking how to access stdio streams by file descriptor number...
17983 EOM
17984 case "$stdio_stream_array" in
17985 '')     $cat >try.c <<EOCP
17986 #include <stdio.h>
17987 int main() {
17988   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17989     printf("yes\n");
17990 }
17991 EOCP
17992         for s in _iob __iob __sF
17993         do
17994                 set try -DSTDIO_STREAM_ARRAY=$s
17995                 if eval $compile; then
17996                         case "`$run ./try`" in
17997                         yes)    stdio_stream_array=$s; break ;;
17998                         esac
17999                 fi
18000         done
18001         $rm_try
18002 esac
18003 case "$stdio_stream_array" in
18004 '')     $cat >&4 <<EOM
18005 I can't figure out how to access stdio streams by file descriptor number.
18006 EOM
18007         d_stdio_stream_array="$undef"
18008         ;;
18009 *)      $cat >&4 <<EOM
18010 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18011 EOM
18012         d_stdio_stream_array="$define"
18013         ;;
18014 esac
18015
18016 : see if strcoll exists
18017 set strcoll d_strcoll
18018 eval $inlibc
18019
18020 : check for structure copying
18021 echo " "
18022 echo "Checking to see if your C compiler can copy structs..." >&4
18023 $cat >try.c <<'EOCP'
18024 int main()
18025 {
18026         struct blurfl {
18027                 int dyick;
18028         } foo, bar;
18029
18030         foo = bar;
18031 }
18032 EOCP
18033 if $cc -c try.c >/dev/null 2>&1 ; then
18034         val="$define"
18035         echo "Yup, it can."
18036 else
18037         val="$undef"
18038         echo "Nope, it can't."
18039 fi
18040 set d_strctcpy
18041 eval $setvar
18042 $rm_try
18043
18044 : see if strerror and/or sys_errlist[] exist
18045 echo " "
18046 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18047     if set strerror val -f d_strerror; eval $csym; $val; then
18048                 echo 'strerror() found.' >&4
18049                 d_strerror="$define"
18050                 d_strerrm='strerror(e)'
18051                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18052                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18053                         d_syserrlst="$define"
18054                 else
18055                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18056                         d_syserrlst="$undef"
18057                 fi
18058     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18059                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18060                 echo 'strerror() found in string header.' >&4
18061                 d_strerror="$define"
18062                 d_strerrm='strerror(e)'
18063                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18064                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18065                                 d_syserrlst="$define"
18066                 else
18067                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18068                         d_syserrlst="$undef"
18069                 fi
18070     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18071                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18072                 d_strerror="$undef"
18073                 d_syserrlst="$define"
18074                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18075     else
18076                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18077                 d_strerror="$undef"
18078                 d_syserrlst="$undef"
18079                 d_strerrm='"unknown"'
18080     fi
18081 fi
18082
18083 : see if strerror_r exists
18084 set strerror_r d_strerror_r
18085 eval $inlibc
18086 case "$d_strerror_r" in
18087 "$define")
18088         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18089         case "$d_strerror_r_proto:$usethreads" in
18090         ":define")      d_strerror_r_proto=define
18091                 set d_strerror_r_proto strerror_r $hdrs
18092                 eval $hasproto ;;
18093         *)      ;;
18094         esac
18095         case "$d_strerror_r_proto" in
18096         define)
18097         case "$strerror_r_proto" in
18098         ''|0) try='int strerror_r(int, char*, size_t);'
18099         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18100         esac
18101         case "$strerror_r_proto" in
18102         ''|0) try='int strerror_r(int, char*, int);'
18103         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18104         esac
18105         case "$strerror_r_proto" in
18106         ''|0) try='char* strerror_r(int, char*, size_t);'
18107         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18108         esac
18109         case "$strerror_r_proto" in
18110         ''|0)   d_strerror_r=undef
18111                 strerror_r_proto=0
18112                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18113         * )     case "$strerror_r_proto" in
18114                 REENTRANT_PROTO*) ;;
18115                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18116                 esac
18117                 echo "Prototype: $try" ;;
18118         esac
18119         ;;
18120         *)      case "$usethreads" in
18121                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18122                 esac
18123                 d_strerror_r=undef
18124                 strerror_r_proto=0
18125                 ;;
18126         esac
18127         ;;
18128 *)      strerror_r_proto=0
18129         ;;
18130 esac
18131
18132 : see if strftime exists
18133 set strftime d_strftime
18134 eval $inlibc
18135
18136 : see if strlcat exists
18137 set strlcat d_strlcat
18138 eval $inlibc
18139
18140 : see if strlcpy exists
18141 set strlcpy d_strlcpy
18142 eval $inlibc
18143
18144 : see if strtod exists
18145 set strtod d_strtod
18146 eval $inlibc
18147
18148 : see if strtol exists
18149 set strtol d_strtol
18150 eval $inlibc
18151
18152 : see if strtold exists
18153 set strtold d_strtold
18154 eval $inlibc
18155
18156 : see if strtoll exists
18157 set strtoll d_strtoll
18158 eval $inlibc
18159
18160 case "$d_longlong-$d_strtoll" in
18161 "$define-$define")
18162         $cat <<EOM
18163 Checking whether your strtoll() works okay...
18164 EOM
18165         $cat >try.c <<'EOCP'
18166 #include <errno.h>
18167 #ifdef __hpux
18168 #define strtoll __strtoll
18169 #endif
18170 #ifdef __EMX__
18171 #define strtoll _strtoll
18172 #endif
18173 #include <stdio.h>
18174 extern long long int strtoll(char *s, char **, int);
18175 static int bad = 0;
18176 int check(char *s, long long ell, int een) {
18177         long long gll;
18178         errno = 0;
18179         gll = strtoll(s, 0, 10);
18180         if (!((gll == ell) && (errno == een)))
18181                 bad++;
18182 }
18183 int main() {
18184         check(" 1",                                      1LL, 0);
18185         check(" 0",                                      0LL, 0);
18186         check("-1",                                     -1LL, 0);
18187         check("-9223372036854775808", -9223372036854775808LL, 0);
18188         check("-9223372036854775808", -9223372036854775808LL, 0);
18189         check(" 9223372036854775807",  9223372036854775807LL, 0);
18190         check("-9223372036854775808", -9223372036854775808LL, 0);
18191         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18192         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18193         if (!bad)
18194                 printf("ok\n");
18195 }
18196 EOCP
18197         set try
18198         if eval $compile; then
18199                 yyy=`$run ./try`
18200                 case "$yyy" in
18201                 ok) echo "Your strtoll() seems to be working okay." ;;
18202                 *) cat <<EOM >&4
18203 Your strtoll() doesn't seem to be working okay.
18204 EOM
18205                    d_strtoll="$undef"
18206                    ;;
18207                 esac
18208         else
18209                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18210                 d_strtoll="$undef"
18211         fi
18212         ;;
18213 esac
18214
18215 : see if strtoq exists
18216 set strtoq d_strtoq
18217 eval $inlibc
18218
18219 : see if strtoul exists
18220 set strtoul d_strtoul
18221 eval $inlibc
18222
18223 case "$d_strtoul" in
18224 "$define")
18225         $cat <<EOM
18226 Checking whether your strtoul() works okay...
18227 EOM
18228         $cat >try.c <<'EOCP'
18229 #include <errno.h>
18230 #include <stdio.h>
18231 extern unsigned long int strtoul(char *s, char **, int);
18232 static int bad = 0;
18233 void check(char *s, unsigned long eul, int een) {
18234         unsigned long gul;
18235         errno = 0;
18236         gul = strtoul(s, 0, 10);
18237         if (!((gul == eul) && (errno == een)))
18238                 bad++;
18239 }
18240 int main() {
18241         check(" 1", 1L, 0);
18242         check(" 0", 0L, 0);
18243 EOCP
18244         case "$longsize" in
18245         8)
18246             $cat >>try.c <<'EOCP'
18247         check("18446744073709551615", 18446744073709551615UL, 0);
18248         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18249 #if 0 /* strtoul() for /^-/ strings is undefined. */
18250         check("-1", 18446744073709551615UL, 0);
18251         check("-18446744073709551614", 2, 0);
18252         check("-18446744073709551615", 1, 0);
18253         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18254         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18255 #endif
18256 EOCP
18257                 ;;
18258         4)
18259                     $cat >>try.c <<'EOCP'
18260         check("4294967295", 4294967295UL, 0);
18261         check("4294967296", 4294967295UL, ERANGE);
18262 #if 0 /* strtoul() for /^-/ strings is undefined. */
18263         check("-1", 4294967295UL, 0);
18264         check("-4294967294", 2, 0);
18265         check("-4294967295", 1, 0);
18266         check("-4294967296", 4294967295UL, ERANGE);
18267         check("-4294967297", 4294967295UL, ERANGE);
18268 #endif
18269 EOCP
18270                 ;;
18271         *)
18272 : Should we write these tests to be more portable by sprintf-ing
18273 : ~0 and then manipulating that char string as input for strtol?
18274                 ;;
18275         esac
18276         $cat >>try.c <<'EOCP'
18277         if (!bad)
18278                 printf("ok\n");
18279         return 0;
18280 }
18281 EOCP
18282         set try
18283         if eval $compile; then
18284                 case "`$run ./try`" in
18285                 ok) echo "Your strtoul() seems to be working okay." ;;
18286                 *) cat <<EOM >&4
18287 Your strtoul() doesn't seem to be working okay.
18288 EOM
18289                    d_strtoul="$undef"
18290                    ;;
18291                 esac
18292         else
18293                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18294                 d_strtoul="$undef"
18295         fi
18296         ;;
18297 esac
18298
18299 : see if strtoull exists
18300 set strtoull d_strtoull
18301 eval $inlibc
18302
18303 case "$d_longlong-$d_strtoull" in
18304 "$define-$define")
18305         $cat <<EOM
18306 Checking whether your strtoull() works okay...
18307 EOM
18308         $cat >try.c <<'EOCP'
18309 #include <errno.h>
18310 #ifdef __hpux
18311 #define strtoull __strtoull
18312 #endif
18313 #include <stdio.h>
18314 extern unsigned long long int strtoull(char *s, char **, int);
18315 static int bad = 0;
18316 int check(char *s, long long eull, int een) {
18317         long long gull;
18318         errno = 0;
18319         gull = strtoull(s, 0, 10);
18320         if (!((gull == eull) && (errno == een)))
18321                 bad++;
18322 }
18323 int main() {
18324         check(" 1",                                        1LL, 0);
18325         check(" 0",                                        0LL, 0);
18326         check("18446744073709551615",  18446744073709551615ULL, 0);
18327         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18328 #if 0 /* strtoull() for /^-/ strings is undefined. */
18329         check("-1",                    18446744073709551615ULL, 0);
18330         check("-18446744073709551614",                     2LL, 0);
18331         check("-18446744073709551615",                     1LL, 0);
18332         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18333         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18334 #endif
18335         if (!bad)
18336                 printf("ok\n");
18337 }
18338 EOCP
18339         set try
18340         if eval $compile; then
18341                 case "`$run ./try`" in
18342                 ok) echo "Your strtoull() seems to be working okay." ;;
18343                 *) cat <<EOM >&4
18344 Your strtoull() doesn't seem to be working okay.
18345 EOM
18346                    d_strtoull="$undef"
18347                    ;;
18348                 esac
18349         else
18350                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18351                 d_strtoull="$undef"
18352         fi
18353         ;;
18354 esac
18355
18356 : see if strtouq exists
18357 set strtouq d_strtouq
18358 eval $inlibc
18359
18360 case "$d_strtouq" in
18361 "$define")
18362         $cat <<EOM
18363 Checking whether your strtouq() works okay...
18364 EOM
18365         $cat >try.c <<'EOCP'
18366 #include <errno.h>
18367 #include <stdio.h>
18368 extern unsigned long long int strtouq(char *s, char **, int);
18369 static int bad = 0;
18370 void check(char *s, unsigned long long eull, int een) {
18371         unsigned long long gull;
18372         errno = 0;
18373         gull = strtouq(s, 0, 10);
18374         if (!((gull == eull) && (errno == een)))
18375                 bad++;
18376 }
18377 int main() {
18378         check(" 1",                                        1LL, 0);
18379         check(" 0",                                        0LL, 0);
18380         check("18446744073709551615",  18446744073709551615ULL, 0);
18381         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18382 #if 0 /* strtouq() for /^-/ strings is undefined. */
18383         check("-1",                    18446744073709551615ULL, 0);
18384         check("-18446744073709551614",                     2LL, 0);
18385         check("-18446744073709551615",                     1LL, 0);
18386         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18387         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18388 #endif
18389         if (!bad)
18390                 printf("ok\n");
18391         return 0;
18392 }
18393 EOCP
18394         set try
18395         if eval $compile; then
18396                 case "`$run ./try`" in
18397                 ok) echo "Your strtouq() seems to be working okay." ;;
18398                 *) cat <<EOM >&4
18399 Your strtouq() doesn't seem to be working okay.
18400 EOM
18401                    d_strtouq="$undef"
18402                    ;;
18403                 esac
18404         else
18405                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18406                 d_strtouq="$undef"
18407         fi
18408         ;;
18409 esac
18410
18411 : see if strxfrm exists
18412 set strxfrm d_strxfrm
18413 eval $inlibc
18414
18415 : see if symlink exists
18416 set symlink d_symlink
18417 eval $inlibc
18418
18419 : see if syscall exists
18420 set syscall d_syscall
18421 eval $inlibc
18422
18423 : see if prototype for syscall is available
18424 echo " "
18425 set d_syscallproto syscall $i_unistd unistd.h
18426 eval $hasproto
18427
18428 : see if sysconf exists
18429 set sysconf d_sysconf
18430 eval $inlibc
18431
18432 : see if system exists
18433 set system d_system
18434 eval $inlibc
18435
18436 : see if tcgetpgrp exists
18437 set tcgetpgrp d_tcgetpgrp
18438 eval $inlibc
18439
18440 : see if tcsetpgrp exists
18441 set tcsetpgrp d_tcsetpgrp
18442 eval $inlibc
18443
18444 : see if prototype for telldir is available
18445 echo " "
18446 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18447 eval $hasproto
18448
18449 : see if time exists
18450 echo " "
18451 if test "X$d_time" = X -o X"$timetype" = X; then
18452     if set time val -f d_time; eval $csym; $val; then
18453                 echo 'time() found.' >&4
18454                 val="$define"
18455                 rp="What is the type returned by time() on this system?"
18456                 set time_t timetype long stdio.h sys/types.h
18457                 eval $typedef_ask
18458     else
18459                 echo 'time() not found, hope that will do.' >&4
18460                 val="$undef"
18461                 timetype='int';
18462     fi
18463     set d_time
18464     eval $setvar
18465 fi
18466
18467 : see if timegm exists
18468 set timegm d_timegm
18469 eval $inlibc
18470
18471 : see if this is a sys/times.h system
18472 set sys/times.h i_systimes
18473 eval $inhdr
18474
18475 : see if times exists
18476 echo " "
18477 if set times val -f d_times; eval $csym; $val; then
18478         echo 'times() found.' >&4
18479         d_times="$define"
18480         inc=''
18481         case "$i_systimes" in
18482         "$define") inc='sys/times.h';;
18483         esac
18484         rp="What is the type returned by times() on this system?"
18485         set clock_t clocktype long stdio.h sys/types.h $inc
18486         eval $typedef_ask
18487 else
18488         echo 'times() NOT found, hope that will do.' >&4
18489         d_times="$undef"
18490         clocktype='int'
18491 fi
18492
18493 : see if tmpnam_r exists
18494 set tmpnam_r d_tmpnam_r
18495 eval $inlibc
18496 case "$d_tmpnam_r" in
18497 "$define")
18498         hdrs="$i_systypes sys/types.h define stdio.h "
18499         case "$d_tmpnam_r_proto:$usethreads" in
18500         ":define")      d_tmpnam_r_proto=define
18501                 set d_tmpnam_r_proto tmpnam_r $hdrs
18502                 eval $hasproto ;;
18503         *)      ;;
18504         esac
18505         case "$d_tmpnam_r_proto" in
18506         define)
18507         case "$tmpnam_r_proto" in
18508         ''|0) try='char* tmpnam_r(char*);'
18509         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18510         esac
18511         case "$tmpnam_r_proto" in
18512         ''|0)   d_tmpnam_r=undef
18513                 tmpnam_r_proto=0
18514                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18515         * )     case "$tmpnam_r_proto" in
18516                 REENTRANT_PROTO*) ;;
18517                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18518                 esac
18519                 echo "Prototype: $try" ;;
18520         esac
18521         ;;
18522         *)      case "$usethreads" in
18523                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18524                 esac
18525                 d_tmpnam_r=undef
18526                 tmpnam_r_proto=0
18527                 ;;
18528         esac
18529         ;;
18530 *)      tmpnam_r_proto=0
18531         ;;
18532 esac
18533
18534 : see if truncate exists
18535 set truncate d_truncate
18536 eval $inlibc
18537
18538 : see if ttyname_r exists
18539 set ttyname_r d_ttyname_r
18540 eval $inlibc
18541 case "$d_ttyname_r" in
18542 "$define")
18543         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18544         case "$d_ttyname_r_proto:$usethreads" in
18545         ":define")      d_ttyname_r_proto=define
18546                 set d_ttyname_r_proto ttyname_r $hdrs
18547                 eval $hasproto ;;
18548         *)      ;;
18549         esac
18550         case "$d_ttyname_r_proto" in
18551         define)
18552         case "$ttyname_r_proto" in
18553         ''|0) try='int ttyname_r(int, char*, size_t);'
18554         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18555         esac
18556         case "$ttyname_r_proto" in
18557         ''|0) try='int ttyname_r(int, char*, int);'
18558         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18559         esac
18560         case "$ttyname_r_proto" in
18561         ''|0) try='char* ttyname_r(int, char*, int);'
18562         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18563         esac
18564         case "$ttyname_r_proto" in
18565         ''|0)   d_ttyname_r=undef
18566                 ttyname_r_proto=0
18567                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18568         * )     case "$ttyname_r_proto" in
18569                 REENTRANT_PROTO*) ;;
18570                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18571                 esac
18572                 echo "Prototype: $try" ;;
18573         esac
18574         ;;
18575         *)      case "$usethreads" in
18576                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18577                 esac
18578                 d_ttyname_r=undef
18579                 ttyname_r_proto=0
18580                 ;;
18581         esac
18582         ;;
18583 *)      ttyname_r_proto=0
18584         ;;
18585 esac
18586
18587 : see if tzname[] exists
18588 echo " "
18589 if set tzname val -a d_tzname; eval $csym; $val; then
18590         val="$define"
18591         echo 'tzname[] found.' >&4
18592 else
18593         val="$undef"
18594         echo 'tzname[] NOT found.' >&4
18595 fi
18596 set d_tzname
18597 eval $setvar
18598
18599 : Check if is a multiplatform env
18600 case "$osname" in
18601 next|rhapsody|darwin) multiarch="$define" ;;
18602 esac
18603 case "$multiarch" in
18604 ''|[nN]*) multiarch="$undef" ;;
18605 esac
18606
18607 : check for ordering of bytes in a UV
18608 echo " "
18609 case "$usecrosscompile$multiarch" in
18610 *$define*)
18611         $cat <<EOM
18612 You seem to be either cross-compiling or doing a multiarchitecture build,
18613 skipping the byteorder check.
18614
18615 EOM
18616         byteorder='ffff'
18617         ;;
18618 *)
18619         case "$byteorder" in
18620         '')
18621                 $cat <<'EOM'
18622 In the following, larger digits indicate more significance.  A big-endian
18623 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18624 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18625 machines may have weird orders like 3412.  A Cray will report 87654321,
18626 an Alpha will report 12345678. If the test program works the default is
18627 probably right.
18628 I'm now running the test program...
18629 EOM
18630                 $cat >try.c <<EOCP
18631 #include <stdio.h>
18632 #$i_stdlib I_STDLIB
18633 #ifdef I_STDLIB
18634 #include <stdlib.h>
18635 #endif
18636 #include <sys/types.h>
18637 typedef $uvtype UV;
18638 int main()
18639 {
18640         int i;
18641         union {
18642                 UV l;
18643                 char c[$uvsize];
18644         } u;
18645
18646         if ($uvsize > 4)
18647                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18648         else
18649                 u.l = (UV)0x04030201;
18650         for (i = 0; i < $uvsize; i++)
18651                 printf("%c", u.c[i]+'0');
18652         printf("\n");
18653         exit(0);
18654 }
18655 EOCP
18656                 xxx_prompt=y
18657                 set try
18658                 if eval $compile && $run ./try > /dev/null; then
18659                         dflt=`$run ./try`
18660                         case "$dflt" in
18661                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18662                                 echo "(The test program ran ok.)"
18663                                 echo "byteorder=$dflt"
18664                                 xxx_prompt=n
18665                         ;;
18666                         ????|????????) echo "(The test program ran ok.)" ;;
18667                         *) echo "(The test program didn't run right for some reason.)" ;;
18668                         esac
18669                 else
18670                         dflt='4321'
18671                         cat <<'EOM'
18672 (I can't seem to compile the test program.  Guessing big-endian...)
18673 EOM
18674                 fi
18675                 case "$xxx_prompt" in
18676                 y)
18677                         rp="What is the order of bytes in $uvtype?"
18678                         . ./myread
18679                         byteorder="$ans"
18680                         ;;
18681                 *)      byteorder=$dflt
18682                         ;;
18683                 esac
18684                 ;;
18685         esac
18686         $rm_try
18687         ;;
18688 esac
18689
18690 : Checking 32bit aligndness
18691 $cat <<EOM
18692
18693 Checking to see whether you can access character data unalignedly...
18694 EOM
18695 case "$d_u32align" in
18696 '')   $cat >try.c <<EOCP
18697 #include <stdio.h>
18698 #$i_stdlib I_STDLIB
18699 #ifdef I_STDLIB
18700 #include <stdlib.h>
18701 #endif
18702 #define U32 $u32type
18703 #define BYTEORDER 0x$byteorder
18704 #define U8 $u8type
18705 #include <signal.h>
18706 #ifdef SIGBUS
18707 $signal_t bletch(int s) { exit(4); }
18708 #endif
18709 int main() {
18710 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18711     volatile U8 buf[8];
18712     volatile U32 *up;
18713     int i;
18714
18715     if (sizeof(U32) != 4) {
18716         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18717         exit(1);
18718     }
18719
18720     fflush(stdout);
18721
18722 #ifdef SIGBUS
18723     signal(SIGBUS, bletch);
18724 #endif
18725
18726     buf[0] = 0;
18727     buf[1] = 0;
18728     buf[2] = 0;
18729     buf[3] = 1;
18730     buf[4] = 0;
18731     buf[5] = 0;
18732     buf[6] = 0;
18733     buf[7] = 1;
18734
18735     for (i = 0; i < 4; i++) {
18736         up = (U32*)(buf + i);
18737         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18738                (*up == 1 << (8*(3-i)))  /* little-endian */
18739               )
18740            )
18741         {
18742             printf("read failed (%x)\n", *up);
18743             exit(2);
18744         }
18745     }
18746
18747     /* write test */
18748     for (i = 0; i < 4; i++) {
18749         up = (U32*)(buf + i);
18750         *up = 0xBeef;
18751         if (*up != 0xBeef) {
18752             printf("write failed (%x)\n", *up);
18753             exit(3);
18754         }
18755     }
18756
18757     exit(0);
18758 #else
18759     printf("1\n");
18760     exit(1);
18761 #endif
18762     return 0;
18763 }
18764 EOCP
18765 set try
18766 if eval $compile_ok; then
18767         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18768         $run ./try 2>&1 >/dev/null
18769         case "$?" in
18770         0)      cat >&4 <<EOM
18771 You can access character data pretty unalignedly.
18772 EOM
18773                 d_u32align="$undef"
18774                 ;;
18775         *)      cat >&4 <<EOM
18776 It seems that you must access character data in an aligned manner.
18777 EOM
18778                 d_u32align="$define"
18779                 ;;
18780         esac
18781 else
18782         rp='Can you access character data at unaligned addresses?'
18783         dflt='n'
18784         . ./myread
18785         case "$ans" in
18786         [yY]*)  d_u32align="$undef"  ;;
18787         *)      d_u32align="$define" ;;
18788         esac
18789 fi
18790 $rm_try
18791 ;;
18792 esac
18793
18794 : see if ualarm exists
18795 set ualarm d_ualarm
18796 eval $inlibc
18797
18798 : see if umask exists
18799 set umask d_umask
18800 eval $inlibc
18801
18802 : see if unordered exists
18803 set unordered d_unordered
18804 eval $inlibc
18805
18806 : see if unsetenv exists
18807 set unsetenv d_unsetenv
18808 eval $inlibc
18809
18810 : see if usleep exists
18811 set usleep d_usleep
18812 eval $inlibc
18813
18814 : see if prototype for usleep is available
18815 echo " "
18816 set d_usleepproto usleep $i_unistd unistd.h
18817 eval $hasproto
18818
18819 : see if ustat exists
18820 set ustat d_ustat
18821 eval $inlibc
18822
18823 : see if closedir exists
18824 set closedir d_closedir
18825 eval $inlibc
18826
18827 case "$d_closedir" in
18828 "$define")
18829         echo " "
18830         echo "Checking whether closedir() returns a status..." >&4
18831         cat > try.c <<EOM
18832 #$i_dirent I_DIRENT             /**/
18833 #$i_sysdir I_SYS_DIR            /**/
18834 #$i_sysndir I_SYS_NDIR          /**/
18835 #$i_systypes I_SYS_TYPES        /**/
18836
18837 #if defined(I_SYS_TYPES)
18838 #include <sys/types.h>
18839 #endif
18840 #if defined(I_DIRENT)
18841 #include <dirent.h>
18842 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18843 #include <sys/dir.h>
18844 #endif
18845 #else
18846 #ifdef I_SYS_NDIR
18847 #include <sys/ndir.h>
18848 #else
18849 #ifdef I_SYS_DIR
18850 #ifdef hp9000s500
18851 #include <ndir.h>       /* may be wrong in the future */
18852 #else
18853 #include <sys/dir.h>
18854 #endif
18855 #endif
18856 #endif
18857 #endif
18858 int main() { return closedir(opendir(".")); }
18859 EOM
18860         set try
18861         if eval $compile_ok; then
18862                 if $run ./try > /dev/null 2>&1 ; then
18863                         echo "Yes, it does."
18864                         val="$undef"
18865                 else
18866                         echo "No, it doesn't."
18867                         val="$define"
18868                 fi
18869         else
18870                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18871                 val="$define"
18872         fi
18873         ;;
18874 *)
18875         val="$undef";
18876         ;;
18877 esac
18878 set d_void_closedir
18879 eval $setvar
18880 $rm_try
18881
18882 : see if there is a wait4
18883 set wait4 d_wait4
18884 eval $inlibc
18885
18886 : see if waitpid exists
18887 set waitpid d_waitpid
18888 eval $inlibc
18889
18890 : see if wcstombs exists
18891 set wcstombs d_wcstombs
18892 eval $inlibc
18893
18894 : see if wctomb exists
18895 set wctomb d_wctomb
18896 eval $inlibc
18897
18898 : see if writev exists
18899 set writev d_writev
18900 eval $inlibc
18901
18902 : preserve RCS keywords in files with variable substitution, grrr
18903 Date='$Date'
18904 Id='$Id'
18905 Log='$Log'
18906 RCSfile='$RCSfile'
18907 Revision='$Revision'
18908
18909 : check for alignment requirements
18910 echo " "
18911 case "$usecrosscompile$multiarch" in
18912 *$define*)
18913         $cat <<EOM
18914 You seem to be either cross-compiling or doing a multiarchitecture build,
18915 skipping the memory alignment check.
18916
18917 EOM
18918         case "$alignbytes" in
18919         '') alignbytes=8 ;;
18920         esac
18921         ;;
18922 *)
18923         case "$alignbytes" in
18924         '') echo "Checking alignment constraints..." >&4
18925                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18926                         $cat >try.c <<'EOCP'
18927 typedef long double NV;
18928 EOCP
18929                 else
18930                         $cat >try.c <<'EOCP'
18931 typedef double NV;
18932 EOCP
18933                 fi
18934                 $cat >>try.c <<'EOCP'
18935 #include <stdio.h>
18936 struct foobar {
18937         char foo;
18938         NV bar;
18939 } try_algn;
18940 int main()
18941 {
18942     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18943     return(0);
18944 }
18945 EOCP
18946                 set try
18947                 if eval $compile_ok; then
18948                         dflt=`$run ./try`
18949                 else
18950                         dflt='8'
18951                         echo "(I can't seem to compile the test program...)"
18952                 fi
18953                 ;;
18954         *) dflt="$alignbytes"
18955                 ;;
18956         esac
18957         rp="Doubles must be aligned on a how-many-byte boundary?"
18958         . ./myread
18959         alignbytes="$ans"
18960         $rm_try
18961         ;;
18962 esac
18963
18964
18965 : set the base revision
18966 baserev=5.0
18967
18968 : length of character in bytes. Is always 1, otherwise it isnt C
18969 : This used to be a test using sizeof
18970 charsize=1
18971
18972 : Check for the number of bits in a character
18973 case "$charbits" in
18974 '')     echo "Checking how long a character is (in bits)..." >&4
18975         $cat >try.c <<EOCP
18976 #include <stdio.h>
18977 int main ()
18978 {
18979     int n;
18980     unsigned char c;
18981     for (c = 1, n = 0; c; c <<= 1, n++) ;
18982     printf ("%d\n", n);
18983     return (0);
18984     }
18985 EOCP
18986         set try
18987         if eval $compile_ok; then
18988                 dflt=`$run ./try`
18989         else
18990                 dflt='8'
18991                 echo "(I can't seem to compile the test program.  Guessing...)"
18992         fi
18993         ;;
18994 *)
18995         dflt="$charbits"
18996         ;;
18997 esac
18998 rp="What is the length of a character (in bits)?"
18999 . ./myread
19000 charbits="$ans"
19001 $rm_try
19002 case "$charbits" in
19003 8)      ;;
19004 *)      cat >&4 << EOM
19005 Your system has an unsigned character size of $charbits bits, which
19006 is rather unusual (normally it is 8 bits).  Perl likely will not work
19007 correctly on your system, with subtle bugs in various places.
19008 EOM
19009         rp='Do you really want to continue?'
19010         dflt='n'
19011         . ./myread
19012         case "$ans" in
19013                 [yY])   echo >&4 "Okay, continuing."    ;;
19014                 *)      exit 1                          ;;
19015         esac
19016 esac
19017
19018 : how do we concatenate cpp tokens here?
19019 echo " "
19020 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19021 $cat >cpp_stuff.c <<'EOCP'
19022 #define RCAT(a,b)a/**/b
19023 #define ACAT(a,b)a ## b
19024 RCAT(Rei,ser)
19025 ACAT(Cir,cus)
19026 EOCP
19027 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19028 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19029         echo "Oh!  Smells like ANSI's been here." >&4
19030         echo "We can catify or stringify, separately or together!"
19031         cpp_stuff=42
19032 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19033         echo "Ah, yes!  The good old days!" >&4
19034         echo "However, in the good old days we don't know how to stringify and"
19035         echo "catify at the same time."
19036         cpp_stuff=1
19037 else
19038         $cat >&4 <<EOM
19039 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19040 You're going to have to edit the values of CAT[2-5] in config.h...
19041 EOM
19042         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19043 fi
19044 $rm -f cpp_stuff.*
19045
19046 : see if this is a db.h system
19047 set db.h i_db
19048 eval $inhdr
19049
19050 case "$i_db" in
19051 $define)
19052         : Check db version.
19053         echo " "
19054         echo "Checking Berkeley DB version ..." >&4
19055         $cat >try.c <<EOCP
19056 #$d_const HASCONST
19057 #ifndef HASCONST
19058 #define const
19059 #endif
19060 #include <sys/types.h>
19061 #include <stdio.h>
19062 #$i_stdlib I_STDLIB
19063 #ifdef I_STDLIB
19064 #include <stdlib.h>
19065 #endif
19066 #include <db.h>
19067 int main(int argc, char *argv[])
19068 {
19069 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19070     int Major, Minor, Patch ;
19071     unsigned long Version ;
19072     (void)db_version(&Major, &Minor, &Patch) ;
19073     if (argc == 2) {
19074         printf("%d %d %d %d %d %d\n",
19075                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19076                Major, Minor, Patch);
19077         exit(0);
19078     }
19079     printf("You have Berkeley DB Version 2 or greater.\n");
19080
19081     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19082                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19083     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19084                 Major, Minor, Patch) ;
19085
19086     /* check that db.h & libdb are compatible */
19087     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19088         printf("db.h and libdb are incompatible.\n") ;
19089         exit(3);
19090     }
19091
19092     printf("db.h and libdb are compatible.\n") ;
19093
19094     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19095                 + DB_VERSION_PATCH ;
19096
19097     /* needs to be >= 2.3.4 */
19098     if (Version < 2003004) {
19099     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19100         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19101         exit(2);
19102     }
19103
19104     exit(0);
19105 #else
19106 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19107     if (argc == 2) {
19108         printf("1 0 0\n");
19109         exit(0);
19110     }
19111     printf("You have Berkeley DB Version 1.\n");
19112     exit(0);    /* DB version < 2: the coast is clear. */
19113 #else
19114     exit(1);    /* <db.h> not Berkeley DB? */
19115 #endif
19116 #endif
19117 }
19118 EOCP
19119         set try
19120         if eval $compile_ok && $run ./try; then
19121                 echo 'Looks OK.' >&4
19122                 set `$run ./try 1`
19123                 db_version_major=$1
19124                 db_version_minor=$2
19125                 db_version_patch=$3
19126         else
19127                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19128                 i_db=$undef
19129                 case " $libs " in
19130                 *"-ldb "*)
19131                         : Remove db from list of libraries to use
19132                         echo "Removing unusable -ldb from library list" >&4
19133                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19134                         shift
19135                         libs="$*"
19136                         echo "libs = $libs" >&4
19137                         ;;
19138                 esac
19139         fi
19140         $rm_try
19141         ;;
19142 esac
19143
19144 case "$i_db" in
19145 define)
19146         : Check the return type needed for hash
19147         echo " "
19148         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19149         $cat >try.c <<EOCP
19150 #$d_const HASCONST
19151 #ifndef HASCONST
19152 #define const
19153 #endif
19154 #include <sys/types.h>
19155 #include <db.h>
19156
19157 #ifndef DB_VERSION_MAJOR
19158 u_int32_t hash_cb (ptr, size)
19159 const void *ptr;
19160 size_t size;
19161 {
19162 }
19163 HASHINFO info;
19164 int main()
19165 {
19166         info.hash = hash_cb;
19167 }
19168 #endif
19169 EOCP
19170         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19171                 if $contains warning try.out >>/dev/null 2>&1 ; then
19172                         db_hashtype='int'
19173                 else
19174                         db_hashtype='u_int32_t'
19175                 fi
19176         else
19177                 : XXX Maybe we should just give up here.
19178                 db_hashtype=u_int32_t
19179                 $cat try.out >&4
19180                 echo "Help:  I can't seem to compile the db test program." >&4
19181                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19182         fi
19183         $rm_try
19184         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19185         ;;
19186 *)      db_hashtype=u_int32_t
19187         ;;
19188 esac
19189 case "$i_db" in
19190 define)
19191         : Check the return type needed for prefix
19192         echo " "
19193         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19194         cat >try.c <<EOCP
19195 #$d_const HASCONST
19196 #ifndef HASCONST
19197 #define const
19198 #endif
19199 #include <sys/types.h>
19200 #include <db.h>
19201
19202 #ifndef DB_VERSION_MAJOR
19203 size_t prefix_cb (key1, key2)
19204 const DBT *key1;
19205 const DBT *key2;
19206 {
19207 }
19208 BTREEINFO info;
19209 int main()
19210 {
19211         info.prefix = prefix_cb;
19212 }
19213 #endif
19214 EOCP
19215         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19216                 if $contains warning try.out >>/dev/null 2>&1 ; then
19217                         db_prefixtype='int'
19218                 else
19219                         db_prefixtype='size_t'
19220                 fi
19221         else
19222                 db_prefixtype='size_t'
19223                 : XXX Maybe we should just give up here.
19224                 $cat try.out >&4
19225                 echo "Help:  I can't seem to compile the db test program." >&4
19226                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19227         fi
19228         $rm_try
19229         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19230         ;;
19231 *)      db_prefixtype='size_t'
19232         ;;
19233 esac
19234
19235 : How can we generate normalized random numbers ?
19236 echo " "
19237 echo "Looking for a random number function..." >&4
19238 case "$randfunc" in
19239 '')
19240         if set drand48 val -f; eval $csym; $val; then
19241                 dflt="drand48"
19242                 echo "Good, found drand48()." >&4
19243         elif set random val -f; eval $csym; $val; then
19244                 dflt="random"
19245                 echo "OK, found random()." >&4
19246         else
19247                 dflt="rand"
19248                 echo "Yick, looks like I have to use rand()." >&4
19249         fi
19250         echo " "
19251         ;;
19252 *)
19253         dflt="$randfunc"
19254         ;;
19255 esac
19256 cont=true
19257
19258 case "$ccflags" in
19259 *-Dmy_rand=*|*-Dmy_srand=*)
19260         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19261         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19262         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19263         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19264         ;;
19265 esac
19266
19267 while $test "$cont"; do
19268         rp="Use which function to generate random numbers?"
19269         . ./myread
19270         if $test "$ans" = "$dflt"; then
19271                 : null
19272         else
19273                 randbits=''
19274         fi
19275         randfunc="$ans"
19276         if set $ans val -f; eval $csym; $val; then
19277                 cont=''
19278         else
19279                 dflt=y
19280                 rp="I cannot find function $ans. Use that name anyway?"
19281                 . ./myread
19282                 dflt=rand
19283                 case "$ans" in
19284                         [yY]*) cont='';;
19285                 esac
19286         fi
19287         case "$cont" in
19288         '')
19289                 case "$randfunc" in
19290                 drand48)
19291                         drand01="drand48()"
19292                         seedfunc="srand48"
19293                         randbits=48
19294                         randseedtype=long
19295                         ;;
19296                 rand|random)
19297                         case "$randbits" in
19298                         '')
19299 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19300                                 $cat >try.c <<EOCP
19301 #$i_unistd I_UNISTD
19302 #$i_stdlib I_STDLIB
19303 #include <stdio.h>
19304 #ifdef I_UNISTD
19305 #  include <unistd.h>
19306 #endif
19307 #ifdef I_STDLIB
19308 #  include <stdlib.h>
19309 #endif
19310 int main()
19311 {
19312         register int i;
19313         register unsigned long tmp;
19314         register unsigned long max = 0L;
19315
19316         for (i = 1000; i; i--) {
19317                 tmp = (unsigned long) $randfunc();
19318                 if (tmp > max) max = tmp;
19319         }
19320         for (i = 0; max; i++)
19321                 max /= 2;
19322         printf("%d\n",i);
19323 }
19324 EOCP
19325                                 set try
19326                                 if eval $compile_ok; then
19327                                         dflt=`try`
19328                                 else
19329                                         dflt='?'
19330                                         echo "(I can't seem to compile the test program...)"
19331                                 fi
19332                                 ;;
19333                         *)
19334                                 dflt="$randbits"
19335                                 ;;
19336                         esac
19337                         rp="How many bits does your $randfunc() function produce?"
19338                         . ./myread
19339                         randbits="$ans"
19340                         $rm_try
19341                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19342                         seedfunc="s$randfunc"
19343                         randseedtype=unsigned
19344                         ;;
19345                 *)
19346                         dflt="31"
19347                         rp="How many bits does your $randfunc() function produce?"
19348                         . ./myread
19349                         randbits="$ans"
19350                         seedfunc="s$randfunc"
19351                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19352                         if set $seedfunc val -f; eval $csym; $val; then
19353                                 echo "(Using $seedfunc() to seed random generator)"
19354                         else
19355                                 echo "(Warning: no $seedfunc() to seed random generator)"
19356                                 seedfunc=rand
19357                         fi
19358                         randseedtype=unsigned
19359                         ;;
19360                 esac
19361                 ;;
19362         esac
19363 done
19364
19365 : Determine if this is an EBCDIC system
19366 echo " "
19367 echo "Determining whether or not we are on an EBCDIC system..." >&4
19368 $cat >try.c <<'EOM'
19369 int main()
19370 {
19371   if ('M'==0xd4) return 0;
19372   return 1;
19373 }
19374 EOM
19375
19376 val=$undef
19377 set try
19378 if eval $compile_ok; then
19379         if $run ./try; then
19380                 echo "You seem to speak EBCDIC." >&4
19381                 val="$define"
19382         else
19383                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19384         fi
19385 else
19386         echo "I'm unable to compile the test program." >&4
19387         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19388 fi
19389 $rm_try
19390 set ebcdic
19391 eval $setvar
19392
19393 : Check how to flush
19394 echo " "
19395 $cat >&4 <<EOM
19396 Checking how to flush all pending stdio output...
19397 EOM
19398 # I only know how to find the first 32 possibly open files on SunOS.
19399 # See also hints/sunos_4_1.sh and util.c  --AD
19400 case "$osname" in
19401 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19402 esac
19403 $cat >>try.c <<EOCP
19404 #include <stdio.h>
19405 #$i_stdlib I_STDLIB
19406 #ifdef I_STDLIB
19407 #include <stdlib.h>
19408 #endif
19409 #$i_unistd I_UNISTD
19410 #ifdef I_UNISTD
19411 # include <unistd.h>
19412 #endif
19413 #$d_sysconf HAS_SYSCONF
19414 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19415 #ifdef HAS_STDIO_STREAM_ARRAY
19416 # define STDIO_STREAM_ARRAY $stdio_stream_array
19417 #endif
19418 int main() {
19419   FILE* p;
19420   unlink("try.out");
19421   p = fopen("try.out", "w");
19422 #ifdef TRY_FPUTC
19423   fputc('x', p);
19424 #else
19425 # ifdef TRY_FPRINTF
19426   fprintf(p, "x");
19427 # endif
19428 #endif
19429 #ifdef TRY_FFLUSH_NULL
19430   fflush(NULL);
19431 #endif
19432 #ifdef TRY_FFLUSH_ALL
19433   {
19434     long open_max = -1;
19435 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19436     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19437 # else
19438 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19439     open_max = sysconf(_SC_OPEN_MAX);
19440 #  else
19441 #   ifdef FOPEN_MAX
19442     open_max = FOPEN_MAX;
19443 #   else
19444 #    ifdef OPEN_MAX
19445     open_max = OPEN_MAX;
19446 #    else
19447 #     ifdef _NFILE
19448     open_max = _NFILE;
19449 #     endif
19450 #    endif
19451 #   endif
19452 #  endif
19453 # endif
19454 # ifdef HAS_STDIO_STREAM_ARRAY
19455     if (open_max > 0) {
19456       long i;
19457       for (i = 0; i < open_max; i++)
19458             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19459                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19460                 STDIO_STREAM_ARRAY[i]._flag)
19461                 fflush(&STDIO_STREAM_ARRAY[i]);
19462     }
19463   }
19464 # endif
19465 #endif
19466   _exit(42);
19467 }
19468 EOCP
19469 : first we have to find out how _not_ to flush
19470 $to try.c
19471 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19472     output=''
19473     set try -DTRY_FPUTC
19474     if eval $compile; then
19475             $run ./try 2>/dev/null
19476             code="$?"
19477             $from try.out
19478             if $test ! -s try.out -a "X$code" = X42; then
19479                 output=-DTRY_FPUTC
19480             fi
19481     fi
19482     case "$output" in
19483     '')
19484             set try -DTRY_FPRINTF
19485             if eval $compile; then
19486                     $run ./try 2>/dev/null
19487                     code="$?"
19488                     $from try.out
19489                     if $test ! -s try.out -a "X$code" = X42; then
19490                         output=-DTRY_FPRINTF
19491                     fi
19492             fi
19493         ;;
19494     esac
19495 fi
19496 : check for fflush NULL behaviour
19497 case "$fflushNULL" in
19498 '')     set try -DTRY_FFLUSH_NULL $output
19499         if eval $compile; then
19500                 $run ./try 2>/dev/null
19501                 code="$?"
19502                 $from try.out
19503                 if $test -s try.out -a "X$code" = X42; then
19504                         fflushNULL="`$cat try.out`"
19505                 else
19506                         if $test "X$code" != X42; then
19507                                 $cat >&4 <<EOM
19508 (If this test failed, don't worry, we'll try another method shortly.)
19509 EOM
19510                         fi
19511                 fi
19512         fi
19513         $rm -f core try.core core.try.*
19514         case "$fflushNULL" in
19515         x)      $cat >&4 <<EOM
19516 Your fflush(NULL) works okay for output streams.
19517 Let's see if it clobbers input pipes...
19518 EOM
19519 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19520 # bug that improperly flushes the input end of pipes.  So we avoid the
19521 # autoflush on fork/system/exec support for now. :-(
19522 $cat >tryp.c <<EOCP
19523 #include <stdio.h>
19524 int
19525 main(int argc, char **argv)
19526 {
19527     char buf[1024];
19528     int i;
19529     char *bp = buf;
19530     while (1) {
19531         while ((i = getc(stdin)) != -1
19532                && (*bp++ = i) != '\n'
19533                && bp < &buf[1024])
19534         /* DO NOTHING */ ;
19535         *bp = '\0';
19536         fprintf(stdout, "%s", buf);
19537         fflush(NULL);
19538         if (i == -1)
19539             return 0;
19540         bp = buf;
19541     }
19542 }
19543 EOCP
19544                 fflushNULL="$define"
19545                 set tryp
19546                 if eval $compile; then
19547                     $rm -f tryp.out
19548                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19549                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19550                        $cat >&4 <<EOM
19551 fflush(NULL) seems to behave okay with input streams.
19552 EOM
19553                         fflushNULL="$define"
19554                     else
19555                         $cat >&4 <<EOM
19556 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19557 EOM
19558                         fflushNULL="$undef"
19559                     fi
19560                 fi
19561                 $rm -f core tryp.c tryp.core core.tryp.*
19562                 ;;
19563         '')     $cat >&4 <<EOM
19564 Your fflush(NULL) isn't working (contrary to ANSI C).
19565 EOM
19566                 fflushNULL="$undef"
19567                 ;;
19568         *)      $cat >&4 <<EOM
19569 Cannot figure out whether your fflush(NULL) works or not.
19570 I'm assuming it doesn't (contrary to ANSI C).
19571 EOM
19572                 fflushNULL="$undef"
19573                 ;;
19574         esac
19575         ;;
19576 $define|true|[yY]*)
19577         fflushNULL="$define"
19578         ;;
19579 *)
19580         fflushNULL="$undef"
19581         ;;
19582 esac
19583 : check explicit looping only if NULL did not work, and if the pipe
19584 : bug does not show up on an explicit flush too
19585 case "$fflushNULL" in
19586 "$undef")
19587         $cat >tryp.c <<EOCP
19588 #include <stdio.h>
19589 int
19590 main(int argc, char **argv)
19591 {
19592     char buf[1024];
19593     int i;
19594     char *bp = buf;
19595     while (1) {
19596         while ((i = getc(stdin)) != -1
19597                && (*bp++ = i) != '\n'
19598                && bp < &buf[1024])
19599         /* DO NOTHING */ ;
19600         *bp = '\0';
19601         fprintf(stdout, "%s", buf);
19602         fflush(stdin);
19603         if (i == -1)
19604             return 0;
19605         bp = buf;
19606     }
19607 }
19608 EOCP
19609         set tryp
19610         if eval $compile; then
19611             $rm -f tryp.out
19612             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19613             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19614                $cat >&4 <<EOM
19615 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19616 EOM
19617                 : now check for fflushall behaviour
19618                 case "$fflushall" in
19619                 '')     set try -DTRY_FFLUSH_ALL $output
19620                         if eval $compile; then
19621                                 $cat >&4 <<EOM
19622 (Now testing the other method--but note that this also may fail.)
19623 EOM
19624                                 $run ./try 2>/dev/null
19625                                 code=$?
19626                                 $from try.out
19627                                 if $test -s try.out -a "X$code" = X42; then
19628                                         fflushall="`$cat try.out`"
19629                                 fi
19630                         fi
19631                         $rm_try
19632                         case "$fflushall" in
19633                         x)      $cat >&4 <<EOM
19634 Whew. Flushing explicitly all the stdio streams works.
19635 EOM
19636                                 fflushall="$define"
19637                                 ;;
19638                         '')     $cat >&4 <<EOM
19639 Sigh. Flushing explicitly all the stdio streams doesn't work.
19640 EOM
19641                                 fflushall="$undef"
19642                                 ;;
19643                         *)      $cat >&4 <<EOM
19644 Cannot figure out whether flushing stdio streams explicitly works or not.
19645 I'm assuming it doesn't.
19646 EOM
19647                                 fflushall="$undef"
19648                                 ;;
19649                         esac
19650                         ;;
19651                 "$define"|true|[yY]*)
19652                         fflushall="$define"
19653                         ;;
19654                 *)
19655                         fflushall="$undef"
19656                         ;;
19657                 esac
19658             else
19659                 $cat >&4 <<EOM
19660 All is futile.  Even fflush(stdin) clobbers input pipes!
19661 EOM
19662                 fflushall="$undef"
19663             fi
19664         else
19665             fflushall="$undef"
19666         fi
19667         $rm -f core tryp.c tryp.core core.tryp.*
19668         ;;
19669 *)      fflushall="$undef"
19670         ;;
19671 esac
19672
19673 case "$fflushNULL$fflushall" in
19674 undefundef)
19675         $cat <<EOM
19676 OK, I give up.  I cannot figure out how to flush pending stdio output.
19677 We won't be flushing handles at all before fork/exec/popen.
19678 EOM
19679         ;;
19680 esac
19681 $rm_try tryp
19682
19683 : Store the full pathname to the ar program for use in the C program
19684 : Respect a hint or command line value for full_ar.
19685 case "$full_ar" in
19686 '') full_ar=$ar ;;
19687 esac
19688
19689 : Store the full pathname to the sed program for use in the C program
19690 full_sed=$sed
19691
19692 : see what type gids are declared as in the kernel
19693 echo " "
19694 echo "Looking for the type for group ids returned by getgid()."
19695 set gid_t gidtype xxx stdio.h sys/types.h
19696 eval $typedef
19697 case "$gidtype" in
19698 xxx)
19699         xxx=`./findhdr sys/user.h`
19700         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19701         case $1 in
19702         unsigned) dflt="$1 $2" ;;
19703         *) dflt="$1" ;;
19704         esac
19705         ;;
19706 *) dflt="$gidtype";;
19707 esac
19708 case "$gidtype" in
19709 gid_t) echo "gid_t found." ;;
19710 *)      rp="What is the type for group ids returned by getgid()?"
19711         . ./myread
19712         gidtype="$ans"
19713         ;;
19714 esac
19715
19716 : Check the size of GID
19717 echo " "
19718 case "$gidtype" in
19719 *_t) zzz="$gidtype"     ;;
19720 *)   zzz="gid"          ;;
19721 esac
19722 echo "Checking the size of $zzz..." >&4
19723 cat > try.c <<EOCP
19724 #include <sys/types.h>
19725 #include <stdio.h>
19726 #$i_stdlib I_STDLIB
19727 #ifdef I_STDLIB
19728 #include <stdlib.h>
19729 #endif
19730 int main() {
19731     printf("%d\n", (int)sizeof($gidtype));
19732     exit(0);
19733 }
19734 EOCP
19735 set try
19736 if eval $compile_ok; then
19737         yyy=`$run ./try`
19738         case "$yyy" in
19739         '')     gidsize=4
19740                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19741                 ;;
19742         *)      gidsize=$yyy
19743                 echo "Your $zzz is $gidsize bytes long."
19744                 ;;
19745         esac
19746 else
19747         gidsize=4
19748         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19749 fi
19750
19751
19752 : Check if GID is signed
19753 echo " "
19754 case "$gidtype" in
19755 *_t) zzz="$gidtype"     ;;
19756 *)   zzz="gid"          ;;
19757 esac
19758 echo "Checking the sign of $zzz..." >&4
19759 cat > try.c <<EOCP
19760 #include <sys/types.h>
19761 #include <stdio.h>
19762 int main() {
19763         $gidtype foo = -1;
19764         if (foo < 0)
19765                 printf("-1\n");
19766         else
19767                 printf("1\n");
19768 }
19769 EOCP
19770 set try
19771 if eval $compile; then
19772         yyy=`$run ./try`
19773         case "$yyy" in
19774         '')     gidsign=1
19775                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19776                 ;;
19777         *)      gidsign=$yyy
19778                 case "$gidsign" in
19779                  1) echo "Your $zzz is unsigned." ;;
19780                 -1) echo "Your $zzz is signed."   ;;
19781                 esac
19782                 ;;
19783         esac
19784 else
19785         gidsign=1
19786         echo "(I can't compile the test program--guessing unsigned.)" >&4
19787 fi
19788
19789
19790 : Check 64bit sizes
19791 echo " "
19792
19793 if $test X"$quadtype" != X; then
19794
19795 echo "Checking how to print 64-bit integers..." >&4
19796
19797 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19798         $cat >try.c <<'EOCP'
19799 #include <sys/types.h>
19800 #include <stdio.h>
19801 int main() {
19802   int q = 12345678901;
19803   printf("%ld\n", q);
19804 }
19805 EOCP
19806         set try
19807         if eval $compile; then
19808                 yyy=`$run ./try`
19809                 case "$yyy" in
19810                 12345678901)
19811                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19812                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19813                         echo "We will use %d."
19814                         ;;
19815                 esac
19816         fi
19817 fi
19818
19819 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19820         $cat >try.c <<'EOCP'
19821 #include <sys/types.h>
19822 #include <stdio.h>
19823 int main() {
19824   long q = 12345678901;
19825   printf("%ld\n", q);
19826 }
19827 EOCP
19828         set try
19829         if eval $compile; then
19830                 yyy=`$run ./try`
19831                 case "$yyy" in
19832                 12345678901)
19833                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19834                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19835                         echo "We will use %ld."
19836                         ;;
19837                 esac
19838         fi
19839 fi
19840
19841 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19842         $cat >try.c <<'EOCP'
19843 #include <sys/types.h>
19844 #include <inttypes.h>
19845 #include <stdio.h>
19846 int main() {
19847   int64_t q = 12345678901;
19848   printf("%" PRId64 "\n", q);
19849 }
19850 EOCP
19851         set try
19852         if eval $compile; then
19853                 yyy=`$run ./try`
19854                 case "$yyy" in
19855                 12345678901)
19856                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19857                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19858                         echo "We will use the C9X style."
19859                         ;;
19860                 esac
19861         fi
19862 fi
19863
19864 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19865         $cat >try.c <<EOCP
19866 #include <sys/types.h>
19867 #include <stdio.h>
19868 int main() {
19869   $quadtype q = 12345678901;
19870   printf("%Ld\n", q);
19871 }
19872 EOCP
19873         set try
19874         if eval $compile; then
19875                 yyy=`$run ./try`
19876                 case "$yyy" in
19877                 12345678901)
19878                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19879                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19880                         echo "We will use %Ld."
19881                         ;;
19882                 esac
19883         fi
19884 fi
19885
19886 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19887         $cat >try.c <<'EOCP'
19888 #include <sys/types.h>
19889 #include <stdio.h>
19890 int main() {
19891   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19892   printf("%lld\n", q);
19893 }
19894 EOCP
19895         set try
19896         if eval $compile; then
19897                 yyy=`$run ./try`
19898                 case "$yyy" in
19899                 12345678901)
19900                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19901                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19902                         echo "We will use the %lld style."
19903                         ;;
19904                 esac
19905         fi
19906 fi
19907
19908 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19909         $cat >try.c <<EOCP
19910 #include <sys/types.h>
19911 #include <stdio.h>
19912 int main() {
19913   $quadtype q = 12345678901;
19914   printf("%qd\n", q);
19915 }
19916 EOCP
19917         set try
19918         if eval $compile; then
19919                 yyy=`$run ./try`
19920                 case "$yyy" in
19921                 12345678901)
19922                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19923                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19924                         echo "We will use %qd."
19925                         ;;
19926                 esac
19927         fi
19928 fi
19929
19930 if $test X"$sPRId64" = X; then
19931         echo "Cannot figure out how to print 64-bit integers." >&4
19932 fi
19933 $rm_try
19934
19935 fi
19936
19937 case "$sPRId64" in
19938 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19939         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19940         ;;
19941 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19942         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19943         ;;
19944 esac
19945
19946 : Check format strings for internal types
19947 echo " "
19948 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19949
19950 if $test X"$ivsize" = X8; then
19951         ivdformat="$sPRId64"
19952         uvuformat="$sPRIu64"
19953         uvoformat="$sPRIo64"
19954         uvxformat="$sPRIx64"
19955         uvXUformat="$sPRIXU64"
19956 else
19957         if $test X"$ivsize" = X"$longsize"; then
19958                 ivdformat='"ld"'
19959                 uvuformat='"lu"'
19960                 uvoformat='"lo"'
19961                 uvxformat='"lx"'
19962                 uvXUformat='"lX"'
19963         else
19964                 if $test X"$ivsize" = X"$intsize"; then
19965                         ivdformat='"d"'
19966                         uvuformat='"u"'
19967                         uvoformat='"o"'
19968                         uvxformat='"x"'
19969                         uvXUformat='"X"'
19970                 else
19971                         : far out
19972                         if $test X"$ivsize" = X"$shortsize"; then
19973                                 ivdformat='"hd"'
19974                                 uvuformat='"hu"'
19975                                 uvoformat='"ho"'
19976                                 uvxformat='"hx"'
19977                                 uvXUformat='"hX"'
19978                         fi
19979                 fi
19980         fi
19981 fi
19982
19983 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19984         nveformat="$sPRIeldbl"
19985         nvfformat="$sPRIfldbl"
19986         nvgformat="$sPRIgldbl"
19987         nvEUformat="$sPRIEUldbl"
19988         nvFUformat="$sPRIFUldbl"
19989         nvGUformat="$sPRIGUldbl"
19990 else
19991         nveformat='"e"'
19992         nvfformat='"f"'
19993         nvgformat='"g"'
19994         nvEUformat='"E"'
19995         nvFUformat='"F"'
19996         nvGUformat='"G"'
19997 fi
19998
19999 case "$ivdformat" in
20000 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20001     exit 1
20002     ;;
20003 esac
20004
20005 : Check format string for GID
20006
20007 echo " "
20008 $echo "Checking the format string to be used for gids..." >&4
20009
20010 case "$gidsign" in
20011 -1)     if $test X"$gidsize" = X"$ivsize"; then
20012                 gidformat="$ivdformat"
20013         else
20014                 if $test X"$gidsize" = X"$longsize"; then
20015                         gidformat='"ld"'
20016                 else
20017                         if $test X"$gidsize" = X"$intsize"; then
20018                                 gidformat='"d"'
20019                         else
20020                                 if $test X"$gidsize" = X"$shortsize"; then
20021                                         gidformat='"hd"'
20022                                 fi
20023                         fi
20024                 fi
20025         fi
20026         ;;
20027 *)      if $test X"$gidsize" = X"$uvsize"; then
20028                 gidformat="$uvuformat"
20029         else
20030                 if $test X"$gidsize" = X"$longsize"; then
20031                         gidformat='"lu"'
20032                 else
20033                         if $test X"$gidsize" = X"$intsize"; then
20034                                 gidformat='"u"'
20035                         else
20036                                 if $test X"$gidsize" = X"$shortsize"; then
20037                                         gidformat='"hu"'
20038                                 fi
20039                         fi
20040                 fi
20041         fi
20042         ;;
20043 esac
20044
20045 : see if getgroups exists
20046 set getgroups d_getgrps
20047 eval $inlibc
20048
20049 : see if setgroups exists
20050 set setgroups d_setgrps
20051 eval $inlibc
20052
20053 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20054 echo " "
20055 case "$d_getgrps$d_setgrps" in
20056 *define*)
20057         case "$groupstype" in
20058         '') dflt="$gidtype" ;;
20059         *)  dflt="$groupstype" ;;
20060         esac
20061         $cat <<EOM
20062 What type of pointer is the second argument to getgroups() and setgroups()?
20063 Usually this is the same as group ids, $gidtype, but not always.
20064
20065 EOM
20066         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20067         . ./myread
20068         groupstype="$ans"
20069         ;;
20070 *)  groupstype="$gidtype";;
20071 esac
20072
20073 : MAD = Misc Attribute Definition
20074
20075 if $test $patchlevel -lt 9; then
20076 : MAD is not available in 5.8.x or earlier.
20077     ans=n;
20078 else
20079     case "$mad" in
20080     $define|true|[yY]*) dflt='y' ;;
20081     *)                  dflt='n' ;;
20082     esac
20083     cat <<EOM
20084
20085 Would you like to build with Misc Attribute Decoration? This is development
20086 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20087 overhead on the interpreter.
20088
20089 If this doesn't make any sense to you, just accept the default '$dflt'.
20090 EOM
20091     rp='Build Perl with MAD?'
20092     . ./myread
20093 fi
20094 case "$ans" in
20095 y|Y)    val="$define"
20096         madlyh='madly.h madly.act madly.tab'
20097         madlysrc='madly.c'
20098         madlyobj="madly$_o" ;;
20099 *)      val="$undef"
20100         madlyh=''
20101         madlysrc=''
20102         madlyobj='' ;;
20103 esac
20104 set mad
20105 eval $setvar
20106
20107 : check whether make sets MAKE
20108 echo " "
20109 echo "Checking if your $make program sets \$(MAKE)..." >&4
20110 case "$make_set_make" in
20111 '')
20112         $sed 's/^X //' > testmake.mak << 'EOF'
20113 Xall:
20114 X       @echo 'maketemp="$(MAKE)"'
20115 EOF
20116         case "`$make -f testmake.mak 2>/dev/null`" in
20117         *maketemp=*) make_set_make='#' ;;
20118         *)      make_set_make="MAKE=$make" ;;
20119         esac
20120         $rm -f testmake.mak
20121         ;;
20122 esac
20123 case "$make_set_make" in
20124 '#') echo "Yup, it does.";;
20125 *) echo "Nope, it doesn't.";;
20126 esac
20127
20128 : see what type is used for mode_t
20129 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20130 set mode_t modetype int stdio.h sys/types.h
20131 eval $typedef_ask
20132
20133 : see if we need va_copy
20134 echo " "
20135 case "$i_stdarg" in
20136 "$define")
20137         $cat >try.c <<EOCP
20138 #include <stdarg.h>
20139 #include <stdio.h>
20140 #$i_stdlib I_STDLIB
20141 #ifdef I_STDLIB
20142 #include <stdlib.h>
20143 #endif
20144 #include <signal.h>
20145
20146 int
20147 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20148 {
20149   return vfprintf(f, fmt, *valp);
20150 }
20151
20152 int
20153 myvfprintf(FILE *f, const  char *fmt, va_list val)
20154 {
20155   return ivfprintf(f, fmt, &val);
20156 }
20157
20158 int
20159 myprintf(char *fmt, ...)
20160 {
20161   va_list val;
20162   va_start(val, fmt);
20163   return myvfprintf(stdout, fmt, val);
20164 }
20165
20166 int
20167 main(int ac, char **av)
20168 {
20169   signal(SIGSEGV, exit);
20170
20171   myprintf("%s%cs all right, then\n", "that", '\'');
20172   exit(0);
20173 }
20174 EOCP
20175         set try
20176         if eval $compile && $run ./try 2>&1 >/dev/null; then
20177                 case "`$run ./try`" in
20178                 "that's all right, then")
20179                         okay=yes
20180                         ;;
20181                 esac
20182         fi
20183         case "$okay" in
20184         yes)    echo "It seems that you don't need va_copy()." >&4
20185                 need_va_copy="$undef"
20186                 ;;
20187         *)      echo "It seems that va_copy() or similar will be needed." >&4
20188                 need_va_copy="$define"
20189                 ;;
20190         esac
20191         $rm_try
20192         ;;
20193 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20194         ;;
20195 esac
20196
20197 : see what type is used for size_t
20198 rp="What is the type used for the length parameter for string functions?"
20199 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20200 eval $typedef_ask
20201
20202 : check for type of arguments to gethostbyaddr. 
20203 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20204         case "$d_gethbyaddr" in
20205         $define)
20206                 $cat <<EOM
20207
20208 Checking to see what type of arguments are accepted by gethostbyaddr().
20209 EOM
20210                 hdrs="$define sys/types.h
20211                         $d_socket sys/socket.h 
20212                         $i_niin netinet/in.h 
20213                         $i_netdb netdb.h
20214                         $i_unistd unistd.h"
20215                 : The first arg can 'char *' or 'void *'
20216                 : The second arg is some of integral type
20217                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20218                         for yyy in size_t long int; do
20219                                 case "$netdb_host_type" in
20220                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20221                                         if ./protochk "$try" $hdrs; then
20222                                                 echo "Your system accepts $xxx for the first arg."
20223                                                 echo "...and $yyy for the second arg."
20224                                                 netdb_host_type="$xxx"
20225                                                 netdb_hlen_type="$yyy"
20226                                         fi
20227                                         ;;
20228                                 esac
20229                         done
20230                 done
20231                 : In case none of those worked, prompt the user.
20232                 case "$netdb_host_type" in
20233                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20234                         dflt='char *'
20235                         . ./myread
20236                         netdb_host_type=$ans
20237                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20238                         dflt="$sizetype"
20239                         . ./myread
20240                         netdb_hlen_type=$ans
20241                         ;;
20242                 esac
20243                 ;;
20244         *)      : no gethostbyaddr, so pick harmless defaults
20245                 netdb_host_type='char *'
20246                 netdb_hlen_type="$sizetype"
20247                 ;;
20248         esac
20249         # Remove the "const" if needed. -- but then we'll have a 
20250         # prototype clash!
20251         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20252 fi
20253
20254 : check for type of argument to gethostbyname. 
20255 if test "X$netdb_name_type" = X ; then
20256         case "$d_gethbyname" in
20257         $define)
20258                 $cat <<EOM
20259
20260 Checking to see what type of argument is accepted by gethostbyname().
20261 EOM
20262                 hdrs="$define sys/types.h
20263                         $d_socket sys/socket.h 
20264                         $i_niin netinet/in.h 
20265                         $i_netdb netdb.h
20266                         $i_unistd unistd.h"
20267                 for xxx in "const char *" "char *"; do
20268                         case "$netdb_name_type" in
20269                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20270                                 if ./protochk "$try" $hdrs; then
20271                                         echo "Your system accepts $xxx."
20272                                         netdb_name_type="$xxx"
20273                                 fi
20274                                 ;;
20275                         esac
20276                 done
20277                 : In case none of those worked, prompt the user.
20278                 case "$netdb_name_type" in
20279                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20280                         dflt='char *'
20281                         . ./myread
20282                         netdb_name_type=$ans
20283                         ;;
20284                 esac
20285                 ;;
20286         *)      : no gethostbyname, so pick harmless default
20287                 netdb_name_type='char *'
20288                 ;;
20289         esac
20290 fi
20291
20292 : check for type of 1st argument to getnetbyaddr. 
20293 if test "X$netdb_net_type" = X ; then
20294         case "$d_getnbyaddr" in
20295         $define)
20296                 $cat <<EOM
20297
20298 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20299 EOM
20300                 hdrs="$define sys/types.h
20301                         $d_socket sys/socket.h 
20302                         $i_niin netinet/in.h 
20303                         $i_netdb netdb.h
20304                         $i_unistd unistd.h"
20305                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20306                         case "$netdb_net_type" in
20307                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20308                                 if ./protochk "$try" $hdrs; then
20309                                         echo "Your system accepts $xxx."
20310                                         netdb_net_type="$xxx"
20311                                 fi
20312                                 ;;
20313                         esac
20314                 done
20315                 : In case none of those worked, prompt the user.
20316                 case "$netdb_net_type" in
20317                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20318                         dflt='long'
20319                         . ./myread
20320                         netdb_net_type=$ans
20321                         ;;
20322                 esac
20323                 ;;
20324         *)      : no getnetbyaddr, so pick harmless default
20325                 netdb_net_type='long'
20326                 ;;
20327         esac
20328 fi
20329 : locate the preferred pager for this system
20330 fn=f/
20331 case "$pager" in
20332 '')
20333         dflt=''
20334         case "$pg" in
20335         /*) dflt=$pg;;
20336         [a-zA-Z]:/*) dflt=$pg;;
20337         esac
20338         case "$more" in
20339         /*) dflt=$more;;
20340         [a-zA-Z]:/*) dflt=$more;;
20341         esac
20342         case "$less" in
20343         /*) dflt=$less;;
20344         [a-zA-Z]:/*) dflt=$less;;
20345         esac
20346         case "$dflt" in
20347         '') dflt=/usr/ucb/more;;
20348         esac
20349         ;;
20350 *)      dflt="$pager"
20351         fn="f/($pager)"
20352         ;;
20353 esac
20354 echo " "
20355 rp='What pager is used on your system?'
20356 . ./getfile
20357 pager="$ans"
20358
20359 : see what type pids are declared as in the kernel
20360 rp="What is the type of process ids on this system?"
20361 set pid_t pidtype int stdio.h sys/types.h
20362 eval $typedef_ask
20363
20364 : see if ar generates random libraries by itself
20365 echo " "
20366 echo "Checking how to generate random libraries on your machine..." >&4
20367 echo 'int bar1() { return bar2(); }' > bar1.c
20368 echo 'int bar2() { return 2; }' > bar2.c
20369 $cat > foo.c <<EOP
20370 #$i_stdlib I_STDLIB
20371 #ifdef I_STDLIB
20372 #include <stdlib.h>
20373 #endif
20374 int main() { printf("%d\n", bar1()); exit(0); }
20375 EOP
20376 $cc $ccflags -c bar1.c >/dev/null 2>&1
20377 $cc $ccflags -c bar2.c >/dev/null 2>&1
20378 $cc $ccflags -c foo.c >/dev/null 2>&1
20379 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20380 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20381         $run ./foobar >/dev/null 2>&1; then
20382         echo "$ar appears to generate random libraries itself."
20383         orderlib=false
20384         if [ "X$ranlib" = "X" ]; then
20385             ranlib=":"
20386         fi
20387 elif $ar s bar$_a >/dev/null 2>&1 &&
20388         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20389         $run ./foobar >/dev/null 2>&1; then
20390                 echo "a table of contents needs to be added with '$ar s'."
20391                 orderlib=false
20392                 ranlib="$ar s"
20393 elif $ar ts bar$_a >/dev/null 2>&1 &&
20394         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20395         $run ./foobar >/dev/null 2>&1; then
20396                 echo "a table of contents needs to be added with '$ar ts'."
20397                 orderlib=false
20398                 ranlib="$ar ts"
20399 else
20400         case "$ranlib" in
20401         :) ranlib='';;
20402         '')
20403                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20404                 $test -f $ranlib || ranlib=''
20405                 ;;
20406         esac
20407         if $test -n "$ranlib"; then
20408                 echo "your system has '$ranlib'; we'll use that."
20409                 orderlib=false
20410         else
20411                 echo "your system doesn't seem to support random libraries"
20412                 echo "so we'll use lorder and tsort to order the libraries."
20413                 orderlib=true
20414                 ranlib=":"
20415         fi
20416 fi
20417 $rm -f foo* bar*
20418
20419 : see if this is a values.h system
20420 set values.h i_values
20421 eval $inhdr
20422
20423 : Check the max offset that gmtime and localtime accept
20424 echo "Checking max offsets that gmtime () accepts"
20425
20426 case $i_values in
20427     define) yyy="#include <values.h>" ;;
20428     *)      yyy="" ;;
20429     esac
20430
20431 case "$sGMTIME_min/$sGMTIME_max" in
20432     0/0|/)
20433         $cat >try.c <<EOCP
20434 #include <sys/types.h>
20435 #include <stdio.h>
20436 #include <time.h>
20437 $yyy
20438
20439 int i;
20440 struct tm *tmp;
20441 time_t pt;
20442
20443 void gm_check (time_t t, int min_year, int max_year)
20444 {
20445     tmp = gmtime (&t);
20446     if ( tmp == NULL ||
20447         /* Check tm_year overflow */
20448          tmp->tm_year < min_year || tmp->tm_year > max_year)
20449         tmp = NULL;
20450     else
20451         pt = t;
20452     } /* gm_check */
20453
20454 int check_max ()
20455 {
20456     tmp = NULL;
20457     pt  = 0;
20458 #ifdef MAXLONG
20459     gm_check (MAXLONG, 69, 0x7fffffff);
20460 #endif
20461     if (tmp == NULL || tmp->tm_year < 0) {
20462         for (i = 63; i >= 0; i--) {
20463             time_t x = pt | ((time_t)1 << i);
20464             if (x < 0 || x < pt) continue;
20465             gm_check (x, 69, 0x7fffffff);
20466             }
20467         }
20468     printf ("sGMTIME_max=%ld\n", pt);
20469     return (0);
20470     } /* check_max */
20471
20472 int check_min ()
20473 {
20474     tmp = NULL;
20475     pt  = 0;
20476 #ifdef MINLONG
20477     gm_check (MINLONG, -1900, 70);
20478 #endif
20479     if (tmp == NULL) {
20480         for (i = 36; i >= 0; i--) {
20481             time_t x = pt - ((time_t)1 << i);
20482             if (x > 0) continue;
20483             gm_check (x, -1900, 70);
20484             }
20485         }
20486     printf ("sGMTIME_min=%ld\n", pt);
20487     return (0);
20488     } /* check_min */
20489
20490 int main (int argc, char *argv[])
20491 {
20492     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20493     check_max ();
20494     check_min ();
20495     return (0);
20496     } /* main */
20497 EOCP
20498         set try
20499         if eval $compile; then
20500             eval `$run ./try`
20501         else
20502             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20503             fi
20504         $rm_try
20505         ;;
20506     esac
20507
20508 echo "Checking max offsets that localtime () accepts"
20509
20510 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20511     0/0|/)
20512         $cat >try.c <<EOCP
20513 #include <sys/types.h>
20514 #include <stdio.h>
20515 #include <time.h>
20516 $yyy
20517
20518 int i;
20519 struct tm *tmp;
20520 time_t pt;
20521
20522 void local_check (time_t t, int min_year, int max_year)
20523 {
20524     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20525         tmp = NULL;
20526     else
20527         tmp = localtime (&t);
20528     if ( tmp == NULL ||
20529         /* Check tm_year overflow */
20530          tmp->tm_year < min_year || tmp->tm_year > max_year)
20531         tmp = NULL;
20532     else
20533         pt = t;
20534     } /* local_check */
20535
20536 int check_max ()
20537 {
20538     tmp = NULL;
20539     pt  = 0;
20540 #ifdef MAXLONG
20541     local_check (MAXLONG, 69, 0x7fffffff);
20542 #endif
20543     if (tmp == NULL || tmp->tm_year < 0) {
20544         for (i = 63; i >= 0; i--) {
20545             time_t x = pt | ((time_t)1 << i);
20546             if (x < 0 || x < pt) continue;
20547             local_check (x, 69, 0x7fffffff);
20548             }
20549         }
20550     printf ("sLOCALTIME_max=%ld\n", pt);
20551     return (0);
20552    } /* check_max */
20553
20554 int check_min ()
20555 {
20556     tmp = NULL;
20557     pt  = 0;
20558 #ifdef MINLONG
20559     local_check (MINLONG, -1900, 70);
20560 #endif
20561     if (tmp == NULL) {
20562         for (i = 36; i >= 0; i--) {
20563             time_t x = pt - ((time_t)1 << i);
20564             if (x > 0) continue;
20565             local_check (x, -1900, 70);
20566             }
20567         }
20568     printf ("sLOCALTIME_min=%ld\n", pt);
20569     return (0);
20570     } /* check_min */
20571
20572 int main (int argc, char *argv[])
20573 {
20574     check_max ();
20575     check_min ();
20576     return (0);
20577     } /* main */
20578 EOCP
20579         set try
20580         if eval $compile; then
20581             eval `$run ./try`
20582         else
20583             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20584             fi
20585         $rm_try
20586         ;;
20587     esac
20588
20589 : check for type of arguments to select.
20590 case "$selecttype" in
20591 '') case "$d_select" in
20592         $define)
20593                 echo " "
20594                 $cat <<EOM
20595 Checking to see what type of arguments are accepted by select().
20596 EOM
20597                 hdrs="$define sys/types.h
20598                         $i_systime sys/time.h
20599                         $i_sysselct sys/select.h
20600                         $d_socket sys/socket.h"
20601                 : The first arg can be int, unsigned, or size_t
20602                 : The last arg may or may not be 'const'
20603                 val=''
20604                 : void pointer has been seen but using that
20605                 : breaks the selectminbits test
20606                 for xxx in 'fd_set *' 'int *'; do
20607                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20608                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20609                                         case "$val" in
20610                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20611                                                 if ./protochk "$try" $hdrs; then
20612                                                         echo "Your system accepts $xxx."
20613                                                         val="$xxx"
20614                                                 fi
20615                                                 ;;
20616                                         esac
20617                                 done
20618                         done
20619                 done
20620                 case "$val" in
20621                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20622                         case "$d_fd_set" in
20623                                 $define) dflt="fd_set *" ;;
20624                                 *)              dflt="int *" ;;
20625                         esac
20626                         . ./myread
20627                         val=$ans
20628                         ;;
20629                 esac
20630                 selecttype="$val"
20631                 ;;
20632         *)      : no select, so pick a harmless default
20633                 selecttype='int *'
20634                 ;;
20635         esac
20636         ;;
20637 esac
20638
20639 : check for the select 'width'
20640 case "$selectminbits" in
20641 '') safebits=`expr $ptrsize \* 8`
20642     case "$d_select" in
20643         $define)
20644                 $cat <<EOM
20645
20646 Checking to see on how many bits at a time your select() operates...
20647 EOM
20648                 $cat >try.c <<EOCP
20649 #include <sys/types.h>
20650 #$i_time I_TIME
20651 #$i_systime I_SYS_TIME
20652 #$i_systimek I_SYS_TIME_KERNEL
20653 #ifdef I_TIME
20654 #   include <time.h>
20655 #endif
20656 #ifdef I_SYS_TIME
20657 #   ifdef I_SYS_TIME_KERNEL
20658 #       define KERNEL
20659 #   endif
20660 #   include <sys/time.h>
20661 #   ifdef I_SYS_TIME_KERNEL
20662 #       undef KERNEL
20663 #   endif
20664 #endif
20665 #$i_sysselct I_SYS_SELECT
20666 #ifdef I_SYS_SELECT
20667 #include <sys/select.h>
20668 #endif
20669 #$d_socket HAS_SOCKET
20670 #ifdef HAS_SOCKET
20671 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20672 #endif
20673 #include <stdio.h>
20674 #$i_stdlib I_STDLIB
20675 #ifdef I_STDLIB
20676 #include <stdlib.h>
20677 #endif
20678 $selecttype b;
20679 #define S sizeof(*(b))
20680 #define MINBITS 64
20681 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20682 #define NBITS  (NBYTES * 8)
20683 int main() {
20684     char *s = (char *)malloc(NBYTES);
20685     struct timeval t;
20686     int i;
20687     FILE* fp;
20688     int fd;
20689
20690     if (!s)
20691         exit(1);
20692     fclose(stdin);
20693     fp = fopen("try.c", "r");
20694     if (fp == 0)
20695       exit(2);
20696     fd = fileno(fp);
20697     if (fd < 0)
20698       exit(3);
20699     b = ($selecttype)s;
20700     for (i = 0; i < NBITS; i++)
20701         FD_SET(i, b);
20702     t.tv_sec  = 0;
20703     t.tv_usec = 0;
20704     select(fd + 1, b, 0, 0, &t);
20705     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20706     free(s);
20707     printf("%d\n", i + 1);
20708     return 0;
20709 }
20710 EOCP
20711                 set try
20712                 if eval $compile_ok; then
20713                         selectminbits=`$run ./try`
20714                         case "$selectminbits" in
20715                         '')     cat >&4 <<EOM
20716 Cannot figure out on how many bits at a time your select() operates.
20717 I'll play safe and guess it is $safebits bits.
20718 EOM
20719                                 selectminbits=$safebits
20720                                 bits="$safebits bits"
20721                                 ;;
20722                         1)      bits="1 bit" ;;
20723                         *)      bits="$selectminbits bits" ;;
20724                         esac
20725                         echo "Your select() operates on $bits at a time." >&4
20726                 else
20727                         rp='What is the minimum number of bits your select() operates on?'
20728                         case "$byteorder" in
20729                         12345678)       dflt=64 ;;
20730                         1234)           dflt=32 ;;
20731                         *)              dflt=1  ;;
20732                         esac
20733                         . ./myread
20734                         val=$ans
20735                         selectminbits="$val"
20736                 fi
20737                 $rm_try
20738                 ;;
20739         *)      : no select, so pick a harmless default
20740                 selectminbits=$safebits
20741                 ;;
20742         esac
20743         ;;
20744 esac
20745
20746 : Trace out the files included by signal.h, then look for SIGxxx names.
20747 if [ "X$fieldn" = X ]; then
20748         : Just make some guesses.  We check them later.
20749         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20750 else
20751         xxx=`echo '#include <signal.h>' |
20752         $cppstdin $cppminus $cppflags 2>/dev/null |
20753         $grep '^[       ]*#.*include' |
20754         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20755                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20756 fi
20757 xxxfiles=''
20758 for xx in $xxx /dev/null ; do
20759         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20760 done
20761 case "$xxxfiles" in
20762 '')     xxxfiles=`./findhdr signal.h` ;;
20763 esac
20764 xxx=`awk '
20765 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20766         print substr($2, 4, 20)
20767 }
20768 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20769         print substr($3, 4, 20)
20770 }' $xxxfiles`
20771 : Append some common names just in case the awk scan failed.
20772 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20773 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20774 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20775 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20776 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20777
20778 : generate a few handy files for later
20779 $cat > signal.c <<EOCP
20780 #include <sys/types.h>
20781 #include <signal.h>
20782 #$i_stdlib I_STDLIB
20783 #ifdef I_STDLIB
20784 #include <stdlib.h>
20785 #endif
20786 #include <stdio.h>
20787 int main() {
20788
20789 /* Strange style to avoid deeply-nested #if/#else/#endif */
20790 #ifndef NSIG
20791 #  ifdef _NSIG
20792 #    define NSIG (_NSIG)
20793 #  endif
20794 #endif
20795
20796 #ifndef NSIG
20797 #  ifdef SIGMAX
20798 #    define NSIG (SIGMAX+1)
20799 #  endif
20800 #endif
20801
20802 #ifndef NSIG
20803 #  ifdef SIG_MAX
20804 #    define NSIG (SIG_MAX+1)
20805 #  endif
20806 #endif
20807
20808 #ifndef NSIG
20809 #  ifdef _SIG_MAX
20810 #    define NSIG (_SIG_MAX+1)
20811 #  endif
20812 #endif
20813
20814 #ifndef NSIG
20815 #  ifdef MAXSIG
20816 #    define NSIG (MAXSIG+1)
20817 #  endif
20818 #endif
20819
20820 #ifndef NSIG
20821 #  ifdef MAX_SIG
20822 #    define NSIG (MAX_SIG+1)
20823 #  endif
20824 #endif
20825
20826 #ifndef NSIG
20827 #  ifdef SIGARRAYSIZE
20828 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20829 #  endif
20830 #endif
20831
20832 #ifndef NSIG
20833 #  ifdef _sys_nsig
20834 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20835 #  endif
20836 #endif
20837
20838 /* Default to some arbitrary number that's big enough to get most
20839    of the common signals.
20840 */
20841 #ifndef NSIG
20842 #    define NSIG 50
20843 #endif
20844
20845 printf("NSIG %d\n", NSIG);
20846
20847 #ifndef JUST_NSIG
20848
20849 EOCP
20850
20851 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20852 {
20853         printf "#ifdef SIG"; printf $1; printf "\n"
20854         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20855         printf $1; printf ");\n"
20856         printf "#endif\n"
20857 }
20858 END {
20859         printf "#endif /* JUST_NSIG */\n";
20860         printf "exit(0);\n}\n";
20861 }
20862 ' >>signal.c
20863 $cat >signal.awk <<'EOP'
20864 BEGIN { ndups = 0 }
20865 $1 ~ /^NSIG$/ { nsig = $2 }
20866 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20867     if ($2 > maxsig) { maxsig = $2 }
20868     if (sig_name[$2]) {
20869         dup_name[ndups] = $1
20870         dup_num[ndups] = $2
20871         ndups++
20872     }
20873     else {
20874         sig_name[$2] = $1
20875         sig_num[$2] = $2
20876     }
20877 }
20878 END {
20879     if (nsig == 0) {
20880         nsig = maxsig + 1
20881     }
20882     printf("NSIG %d\n", nsig);
20883     for (n = 1; n < nsig; n++) {
20884         if (sig_name[n]) {
20885             printf("%s %d\n", sig_name[n], sig_num[n])
20886         }
20887         else {
20888             printf("NUM%d %d\n", n, n)
20889         }
20890     }
20891     for (n = 0; n < ndups; n++) {
20892         printf("%s %d\n", dup_name[n], dup_num[n])
20893     }
20894 }
20895 EOP
20896 $cat >signal_cmd <<EOS
20897 $startsh
20898 if $test -s signal.lst; then
20899     echo "Using your existing signal.lst file"
20900         exit 0
20901 fi
20902 xxx="$xxx"
20903 EOS
20904 $cat >>signal_cmd <<'EOS'
20905
20906 set signal
20907 if eval $compile_ok; then
20908         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20909                 $uniq | $awk -f signal.awk >signal.lst
20910 else
20911         echo "(I can't seem be able to compile the whole test program)" >&4
20912         echo "(I'll try it in little pieces.)" >&4
20913         set signal -DJUST_NSIG
20914         if eval $compile_ok; then
20915                 $run ./signal$_exe > signal.nsg
20916                 $cat signal.nsg
20917         else
20918                 echo "I can't seem to figure out how many signals you have." >&4
20919                 echo "Guessing 50." >&4
20920                 echo 'NSIG 50' > signal.nsg
20921         fi
20922         : Now look at all the signal names, one at a time.
20923         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20924                 $cat > signal.c <<EOCP
20925 #include <sys/types.h>
20926 #include <signal.h>
20927 #include <stdio.h>
20928 int main() {
20929 printf("$xx %d\n", SIG${xx});
20930 return 0;
20931 }
20932 EOCP
20933                 set signal
20934                 if eval $compile; then
20935                         echo "SIG${xx} found."
20936                         $run ./signal$_exe  >> signal.ls1
20937                 else
20938                         echo "SIG${xx} NOT found."
20939                 fi
20940         done
20941         if $test -s signal.ls1; then
20942                 $cat signal.nsg signal.ls1 |
20943                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20944         fi
20945
20946 fi
20947 if $test -s signal.lst; then
20948         :
20949 else
20950         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20951         echo 'kill -l' >signal
20952         set X `csh -f <signal`
20953         $rm -f signal
20954         shift
20955         case $# in
20956         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20957         esac
20958         echo $@ | $tr ' ' $trnl | \
20959             $awk '{ printf "%s %d\n", $1, ++s; }
20960                   END { printf "NSIG %d\n", ++s }' >signal.lst
20961 fi
20962 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20963 EOS
20964 chmod a+x signal_cmd
20965 $eunicefix signal_cmd
20966
20967 : generate list of signal names
20968 echo " "
20969 case "$sig_name_init" in
20970 '') doinit=yes ;;
20971 *)  case "$sig_num_init" in
20972     ''|*,*) doinit=yes ;;
20973     esac ;;
20974 esac
20975 case "$doinit" in
20976 yes)
20977         echo "Generating a list of signal names and numbers..." >&4
20978         . ./signal_cmd
20979         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20980         sig_name=`$awk 'BEGIN { printf "ZERO " }
20981                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20982         sig_num=`$awk  'BEGIN { printf "0 " }
20983                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20984         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20985                              !/^NSIG/   { printf "\"%s\", ", $1 }
20986                              END        { printf "0\n" }' signal.lst`
20987         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20988                              !/^NSIG/   { printf "%d, ", $2}
20989                              END        { printf "0\n"}' signal.lst`
20990         ;;
20991 esac
20992 echo "The following $sig_count signals are available:"
20993 echo " "
20994 echo $sig_name | $awk \
20995 'BEGIN { linelen = 0 }
20996 {
20997         for (i = 1; i <= NF; i++) {
20998                 name = "SIG" $i " "
20999                 linelen = linelen + length(name)
21000                 if (linelen > 70) {
21001                         printf "\n"
21002                         linelen = length(name)
21003                 }
21004                 printf "%s", name
21005         }
21006         printf "\n"
21007 }'
21008 sig_size=`echo $sig_name | awk '{print NF}'`
21009 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21010
21011 : Check size of size
21012 echo " "
21013 case "$sizetype" in
21014 *_t) zzz="$sizetype"    ;;
21015 *)   zzz="filesize"     ;;
21016 esac
21017 echo "Checking the size of $zzz..." >&4
21018 cat > try.c <<EOCP
21019 #include <sys/types.h>
21020 #include <stdio.h>
21021 #$i_stdlib I_STDLIB
21022 #ifdef I_STDLIB
21023 #include <stdlib.h>
21024 #endif
21025 int main() {
21026     printf("%d\n", (int)sizeof($sizetype));
21027     exit(0);
21028 }
21029 EOCP
21030 set try
21031 if eval $compile_ok; then
21032         yyy=`$run ./try`
21033         case "$yyy" in
21034         '')     sizesize=4
21035                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21036                 ;;
21037         *)      sizesize=$yyy
21038                 echo "Your $zzz size is $sizesize bytes."
21039                 ;;
21040         esac
21041 else
21042         sizesize=4
21043         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21044 fi
21045
21046
21047 : check for socklen_t
21048 echo " "
21049 echo "Checking to see if you have socklen_t..." >&4
21050 $cat >try.c <<EOCP
21051 #include <sys/types.h>
21052 #$d_socket HAS_SOCKET
21053 #ifdef HAS_SOCKET
21054 #include <sys/socket.h>
21055 #endif
21056 int main() { socklen_t x = 16; }
21057 EOCP
21058 set try
21059 if eval $compile; then
21060         val="$define"
21061         echo "You have socklen_t."
21062 else
21063         val="$undef"
21064         echo "You do not have socklen_t."
21065         case "$sizetype" in
21066         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21067         esac
21068 fi
21069 $rm_try
21070 set d_socklen_t
21071 eval $setvar
21072
21073 : see if this is a socks.h system
21074 set socks.h i_socks
21075 eval $inhdr
21076
21077 : check for type of the size argument to socket calls
21078 case "$d_socket" in
21079 "$define")
21080         $cat <<EOM
21081
21082 Checking to see what type is the last argument of accept().
21083 EOM
21084         yyy=''
21085         case "$d_socklen_t" in
21086         "$define") yyy="$yyy socklen_t"
21087         esac
21088         yyy="$yyy $sizetype int long unsigned"
21089         for xxx in $yyy; do
21090                 case "$socksizetype" in
21091                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21092                         case "$usesocks" in
21093                         "$define")
21094                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21095                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21096                                         socksizetype="$xxx"
21097                                 fi
21098                                 ;;
21099                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21100                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21101                                         socksizetype="$xxx"
21102                                 fi
21103                                 ;;
21104                         esac
21105                         ;;
21106                 esac
21107         done
21108 : In case none of those worked, prompt the user.
21109         case "$socksizetype" in
21110         '')     rp='What is the type for socket address structure sizes?'
21111                 dflt='int'
21112                 . ./myread
21113                 socksizetype=$ans
21114                 ;;
21115         esac
21116         ;;
21117 *)      : no sockets, so pick relatively harmless default
21118         socksizetype='int'
21119         ;;
21120 esac
21121
21122 : see what type is used for signed size_t
21123 set ssize_t ssizetype int stdio.h sys/types.h
21124 eval $typedef
21125 dflt="$ssizetype"
21126 $cat > try.c <<EOM
21127 #include <stdio.h>
21128 #$i_stdlib I_STDLIB
21129 #ifdef I_STDLIB
21130 #include <stdlib.h>
21131 #endif
21132 #include <sys/types.h>
21133 #define Size_t $sizetype
21134 #define SSize_t $dflt
21135 int main()
21136 {
21137         if (sizeof(Size_t) == sizeof(SSize_t))
21138                 printf("$dflt\n");
21139         else if (sizeof(Size_t) == sizeof(int))
21140                 printf("int\n");
21141         else
21142                 printf("long\n");
21143         exit(0);
21144 }
21145 EOM
21146 echo " "
21147 set try
21148 if eval $compile_ok && $run ./try > /dev/null; then
21149         ssizetype=`$run ./try`
21150         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21151 else
21152         $cat >&4 <<EOM
21153 Help! I can't compile and run the ssize_t test program: please enlighten me!
21154 (This is probably a misconfiguration in your system or libraries, and
21155 you really ought to fix it.  Still, I'll try anyway.)
21156
21157 I need a type that is the same size as $sizetype, but is guaranteed to
21158 be signed.  Common values are ssize_t, int and long.
21159
21160 EOM
21161         rp="What signed type is the same size as $sizetype?"
21162         . ./myread
21163         ssizetype="$ans"
21164 fi
21165 $rm_try
21166
21167 : see what type of char stdio uses.
21168 echo " "
21169 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21170 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21171         echo "Your stdio uses unsigned chars." >&4
21172         stdchar="unsigned char"
21173 else
21174         echo "Your stdio uses signed chars." >&4
21175         stdchar="char"
21176 fi
21177 $rm -f stdioh
21178
21179 : see what type uids are declared as in the kernel
21180 echo " "
21181 echo "Looking for the type for user ids returned by getuid()."
21182 set uid_t uidtype xxx stdio.h sys/types.h
21183 eval $typedef
21184 case "$uidtype" in
21185 xxx)
21186         xxx=`./findhdr sys/user.h`
21187         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21188         case $1 in
21189         unsigned) dflt="$1 $2" ;;
21190         *) dflt="$1" ;;
21191         esac
21192         ;;
21193 *) dflt="$uidtype";;
21194 esac
21195 case "$uidtype" in
21196 uid_t)  echo "uid_t found." ;;
21197 *)      rp="What is the type for user ids returned by getuid()?"
21198         . ./myread
21199         uidtype="$ans"
21200         ;;
21201 esac
21202
21203 : Check size of UID
21204 echo " "
21205 case "$uidtype" in
21206 *_t) zzz="$uidtype"     ;;
21207 *)   zzz="uid"          ;;
21208 esac
21209 echo "Checking the size of $zzz..." >&4
21210 cat > try.c <<EOCP
21211 #include <sys/types.h>
21212 #include <stdio.h>
21213 #$i_stdlib I_STDLIB
21214 #ifdef I_STDLIB
21215 #include <stdlib.h>
21216 #endif
21217 int main() {
21218     printf("%d\n", (int)sizeof($uidtype));
21219     exit(0);
21220 }
21221 EOCP
21222 set try
21223 if eval $compile_ok; then
21224         yyy=`$run ./try`
21225         case "$yyy" in
21226         '')     uidsize=4
21227                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21228                 ;;
21229         *)      uidsize=$yyy
21230                 echo "Your $zzz is $uidsize bytes long."
21231                 ;;
21232         esac
21233 else
21234         uidsize=4
21235         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21236 fi
21237
21238 : Check if UID is signed
21239 echo " "
21240 case "$uidtype" in
21241 *_t) zzz="$uidtype"     ;;
21242 *)   zzz="uid"          ;;
21243 esac
21244 echo "Checking the sign of $zzz..." >&4
21245 cat > try.c <<EOCP
21246 #include <sys/types.h>
21247 #include <stdio.h>
21248 int main() {
21249         $uidtype foo = -1;
21250         if (foo < 0)
21251                 printf("-1\n");
21252         else
21253                 printf("1\n");
21254 }
21255 EOCP
21256 set try
21257 if eval $compile; then
21258         yyy=`$run ./try`
21259         case "$yyy" in
21260         '')     uidsign=1
21261                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21262                 ;;
21263         *)      uidsign=$yyy
21264                 case "$uidsign" in
21265                  1) echo "Your $zzz is unsigned." ;;
21266                 -1) echo "Your $zzz is signed."   ;;
21267                 esac
21268                 ;;
21269         esac
21270 else
21271         uidsign=1
21272         echo "(I can't compile the test program--guessing unsigned.)" >&4
21273 fi
21274
21275
21276 : Check format string for UID
21277 echo " "
21278 $echo "Checking the format string to be used for uids..." >&4
21279
21280 case "$uidsign" in
21281 -1)     if $test X"$uidsize" = X"$ivsize"; then
21282                 uidformat="$ivdformat"
21283         else
21284                 if $test X"$uidsize" = X"$longsize"; then
21285                         uidformat='"ld"'
21286                 else
21287                         if $test X"$uidsize" = X"$intsize"; then
21288                                 uidformat='"d"'
21289                         else
21290                                 if $test X"$uidsize" = X"$shortsize"; then
21291                                         uidformat='"hd"'
21292                                 fi
21293                         fi
21294                 fi
21295         fi
21296         ;;
21297 *)      if $test X"$uidsize" = X"$uvsize"; then
21298                 uidformat="$uvuformat"
21299         else
21300                 if $test X"$uidsize" = X"$longsize"; then
21301                         uidformat='"lu"'
21302                 else
21303                         if $test X"$uidsize" = X"$intsize"; then
21304                                 uidformat='"u"'
21305                         else
21306                                 if $test X"$uidsize" = X"$shortsize"; then
21307                                         uidformat='"hu"'
21308                                 fi
21309                         fi
21310                 fi
21311         fi
21312         ;;
21313 esac
21314
21315 : Check if site customization support was requested
21316 case "$usesitecustomize" in
21317     $define|true|[Yy]*)
21318         usesitecustomize="$define"
21319         ;;
21320     *)
21321         usesitecustomize="$undef"
21322         ;;
21323     esac
21324
21325 : see if prototypes support variable argument declarations
21326 echo " "
21327 case "$prototype$i_stdarg" in
21328 $define$define)
21329         echo "It appears we'll be able to prototype varargs functions." >&4
21330         val="$define"
21331         ;;
21332 *)
21333         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21334         val="$undef"
21335         ;;
21336 esac
21337 set vaproto
21338 eval $setvar
21339
21340 : determine compiler compiler
21341 case "$yacc" in
21342 '')
21343         dflt=yacc;;
21344 *)
21345         dflt="$yacc";;
21346 esac
21347 echo " "
21348 comp='yacc'
21349 if $test -f "$byacc$_exe"; then
21350         dflt="$byacc"
21351         comp="byacc or $comp"
21352 fi
21353 if $test -f "$bison$_exe"; then
21354         comp="$comp or bison -y"
21355 fi
21356 rp="Which compiler compiler ($comp) shall I use?"
21357 . ./myread
21358 yacc="$ans"
21359 case "$yacc" in
21360 *bis*)
21361         case "$yacc" in
21362         *-y*) ;;
21363         *)
21364                 yacc="$yacc -y"
21365                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21366                 ;;
21367         esac
21368         ;;
21369 esac
21370
21371 : see if this is a assert.h system
21372 set assert.h i_assert
21373 eval $inhdr
21374
21375 : see if this is a fp.h system
21376 set fp.h i_fp
21377 eval $inhdr
21378
21379 : see if this is a fp_class.h system
21380 set fp_class.h i_fp_class
21381 eval $inhdr
21382
21383 : see if gdbm.h is available
21384 set gdbm.h t_gdbm
21385 eval $inhdr
21386 case "$t_gdbm" in
21387 $define)
21388         : see if gdbm_open exists
21389         set gdbm_open d_gdbm_open
21390         eval $inlibc
21391         case "$d_gdbm_open" in
21392         $undef)
21393                 t_gdbm="$undef"
21394                 echo "We won't be including <gdbm.h>"
21395                 ;;
21396         esac
21397         ;;
21398 esac
21399 val="$t_gdbm"
21400 set i_gdbm
21401 eval $setvar
21402
21403 : see if this is a ieeefp.h system
21404 case "$i_ieeefp" in
21405 '' ) set ieeefp.h i_ieeefp
21406      eval $inhdr
21407      ;;
21408 esac
21409
21410 : see if this is a libutil.h system
21411 set libutil.h i_libutil
21412 eval $inhdr
21413
21414 : see if mach cthreads are available
21415 if test "X$usethreads" = "X$define"; then
21416         set mach/cthreads.h i_machcthr
21417         eval $inhdr
21418 else
21419         i_machcthr="$undef"
21420 fi
21421
21422 : see if this is a mntent.h system
21423 set mntent.h i_mntent
21424 eval $inhdr
21425
21426 : see if net/errno.h is available
21427 val=''
21428 set net/errno.h val
21429 eval $inhdr
21430
21431 : Unfortunately, it causes problems on some systems.  Arrgh.
21432 case "$val" in
21433 $define)
21434         cat > try.c <<'EOM'
21435 #include <stdio.h>
21436 #include <errno.h>
21437 #include <net/errno.h>
21438 int func()
21439 {
21440         return ENOTSOCK;
21441 }
21442 EOM
21443         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21444                 echo "We'll be including <net/errno.h>." >&4
21445         else
21446                 echo "We won't be including <net/errno.h>." >&4
21447                 val="$undef"
21448         fi
21449         $rm_try
21450         ;;
21451 esac
21452 set i_neterrno
21453 eval $setvar
21454
21455 : see if netinet/tcp.h is available
21456 set netinet/tcp.h i_netinettcp
21457 eval $inhdr
21458
21459 : see if this is a poll.h system
21460 set poll.h i_poll
21461 eval $inhdr
21462
21463 : see if this is a prot.h system
21464 set prot.h i_prot
21465 eval $inhdr
21466
21467 : Preprocessor symbols
21468 echo " "
21469 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21470 $cat <<'EOSH' > Cppsym.know
21471 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21472 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21473 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21474 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21475 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21476 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21477 bull c cadmus clipper CMU COFF COMPILER_VERSION
21478 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21479 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21480 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21481 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21482 GLIBC GLIBC_MINOR
21483 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21484 H3050R H3050RX hbullx20 hcx host_mips
21485 hp200 hp300 hp700 HP700 hp800 hp9000
21486 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21487 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21488 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21489 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21490 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21491 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21492 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21493 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21494 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21495 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21496 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21497 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21498 MATH_HAS_NO_SIDE_EFFECTS
21499 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21500 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21501 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21502 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21503 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21504 NetBSD news1500 news1700 news1800 news1900 news3700
21505 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21506 ns32016 ns32332 ns32k nsc32000
21507 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21508 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21509 pc532 pdp11 PGC PIC plexus PORTAR posix
21510 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21511 POSIX_C_SOURCE POSIX_SOURCE POWER
21512 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21513 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21514 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21515 sony sony_news sonyrisc sparc sparclite spectrum
21516 stardent stdc STDC_EXT stratos sun sun3 sun386
21517 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21518 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21519 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21520 sysV68 sysV88 Tek4132 Tek4300 titan
21521 TM3200 TM5400 TM5600
21522 tower tower32 tower32_200 tower32_600 tower32_700
21523 tower32_800 tower32_850 tss
21524 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21525 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21526 unix UNIX95 UNIX99 unixpc unos
21527 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21528 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21529 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21530 USGr4 USGr4_2
21531 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21532 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21533 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21534 z8000
21535 EOSH
21536 # Maybe put other stuff here too.
21537 cat <<EOSH >>Cppsym.know
21538 $osname
21539 EOSH
21540 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21541 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21542 $cat Cppsym.know > Cppsym.c
21543 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21544 $rm -f Cppsym.a Cppsym.b Cppsym.c
21545 cat <<EOSH > Cppsym
21546 $startsh
21547 if $test \$# -gt 0; then
21548     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21549     if $test -s Cppsym.got; then
21550         $rm -f Cppsym.got
21551         exit 0
21552     fi
21553     $rm -f Cppsym.got
21554     exit 1
21555 else
21556     $tr " " "$trnl" | ./Cppsym.try
21557     exit 0
21558 fi
21559 EOSH
21560 chmod +x Cppsym
21561 $eunicefix Cppsym
21562 cat <<EOSH > Cppsym.try
21563 $startsh
21564 cat <<'EOCP' > try.c
21565 #include <stdio.h>
21566 #if cpp_stuff == 1
21567 #define STRINGIFY(a)    "a"
21568 #endif
21569 #if cpp_stuff == 42
21570 #define StGiFy(a)  #a
21571 #define STRINGIFY(a)    StGiFy(a)
21572 #endif
21573 #if $cpp_stuff != 1 && $cpp_stuff != 42
21574 #   include "Bletch: How does this C preprocessor stringify macros?"
21575 #endif
21576 int main() {
21577 EOCP
21578 $awk \\
21579 EOSH
21580 cat <<'EOSH' >> Cppsym.try
21581 'length($1) > 0 {
21582     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21583     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21584     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21585     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21586 }'       >> try.c
21587 echo 'return 0;}' >> try.c
21588 EOSH
21589 cat <<EOSH >> Cppsym.try
21590 ccflags="$ccflags"
21591 case "$osname-$gccversion" in
21592 irix-) ccflags="\$ccflags -woff 1178" ;;
21593 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21594 esac
21595 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21596 EOSH
21597 chmod +x Cppsym.try
21598 $eunicefix Cppsym.try
21599 ./Cppsym < Cppsym.know > Cppsym.true
21600 : Add in any linux cpp "predefined macros":
21601 case "$osname::$gccversion" in
21602   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21603     tHdrH=_tmpHdr
21604     rm -f $tHdrH'.h' $tHdrH
21605     touch $tHdrH'.h'
21606     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21607        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21608        if [ -s $tHdrH'_cppsym.real' ]; then
21609           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21610        fi
21611     fi
21612     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21613   ;;
21614 esac
21615 : now check the C compiler for additional symbols
21616 postprocess_cc_v=''
21617 case "$osname" in
21618 aix) postprocess_cc_v="|$tr , ' '" ;;
21619 esac
21620 $cat >ccsym <<EOS
21621 $startsh
21622 $cat >tmp.c <<EOF
21623 extern int foo;
21624 EOF
21625 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21626 do
21627         case "\$i" in
21628         -D*) echo "\$i" | $sed 's/^-D//';;
21629         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21630         esac
21631 done
21632 $rm_try
21633 EOS
21634 postprocess_cc_v=''
21635 chmod +x ccsym
21636 $eunicefix ccsym
21637 ./ccsym > ccsym1.raw
21638 if $test -s ccsym1.raw; then
21639        $sort ccsym1.raw | $uniq >ccsym.raw
21640 else
21641        mv ccsym1.raw ccsym.raw
21642 fi
21643
21644 $awk '/\=/ { print $0; next }
21645         { print $0"=1" }' ccsym.raw >ccsym.list
21646 $comm -13 Cppsym.true ccsym.list >ccsym.own
21647 $comm -12 Cppsym.true ccsym.list >ccsym.com
21648 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21649 also=''
21650 if $test -z ccsym.raw; then
21651         echo "Your C compiler doesn't seem to define any symbols!" >&4
21652         echo " "
21653         echo "However, your C preprocessor defines the following symbols:"
21654         $cat Cppsym.true
21655         ccsymbols=''
21656         cppsymbols=`$cat Cppsym.true`
21657         cppsymbols=`echo $cppsymbols`
21658         cppccsymbols="$cppsymbols"
21659 else
21660         if $test -s ccsym.com; then
21661                 echo "Your C compiler and pre-processor define these symbols:"
21662                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21663                 also='also '
21664                 symbols='ones'
21665                 cppccsymbols=`$cat ccsym.com`
21666                 cppccsymbols=`echo $cppccsymbols`
21667                 $test "$silent" || sleep 1
21668         fi
21669         if $test -s ccsym.cpp; then
21670                 $test "$also" && echo " "
21671                 echo "Your C pre-processor ${also}defines the following symbols:"
21672                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21673                 also='further '
21674                 cppsymbols=`$cat ccsym.cpp`
21675                 cppsymbols=`echo $cppsymbols`
21676                 $test "$silent" || sleep 1
21677         fi
21678         if $test -s ccsym.own; then
21679                 $test "$also" && echo " "
21680                 echo "Your C compiler ${also}defines the following cpp symbols:"
21681                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21682                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21683                 ccsymbols=`$cat ccsym.own`
21684                 ccsymbols=`echo $ccsymbols`
21685                 $test "$silent" || sleep 1
21686         fi
21687 fi
21688
21689 : see if this is a termio system
21690 val="$undef"
21691 val2="$undef"
21692 val3="$undef"
21693 if $test `./findhdr termios.h`; then
21694         set tcsetattr i_termios
21695         eval $inlibc
21696         val3="$i_termios"
21697 fi
21698 echo " "
21699 case "$val3" in
21700 "$define") echo "You have POSIX termios.h... good!" >&4;;
21701 *) if ./Cppsym pyr; then
21702                 case "`/bin/universe`" in
21703                 ucb) if $test `./findhdr sgtty.h`; then
21704                                 val2="$define"
21705                                 echo "<sgtty.h> found." >&4
21706                         else
21707                                 echo "System is pyramid with BSD universe."
21708                                 ./warn "<sgtty.h> not found--you could have problems."
21709                         fi;;
21710                 *) if $test `./findhdr termio.h`; then
21711                                 val="$define"
21712                                 echo "<termio.h> found." >&4
21713                         else
21714                                 echo "System is pyramid with USG universe."
21715                                 ./warn "<termio.h> not found--you could have problems."
21716                         fi;;
21717                 esac
21718         elif ./usg; then
21719                 if $test `./findhdr termio.h`; then
21720                         echo "<termio.h> found." >&4
21721                         val="$define"
21722                 elif $test `./findhdr sgtty.h`; then
21723                         echo "<sgtty.h> found." >&4
21724                         val2="$define"
21725                 else
21726                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21727                 fi
21728         else
21729                 if $test `./findhdr sgtty.h`; then
21730                         echo "<sgtty.h> found." >&4
21731                         val2="$define"
21732                 elif $test `./findhdr termio.h`; then
21733                         echo "<termio.h> found." >&4
21734                         val="$define"
21735                 else
21736                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21737                 fi
21738         fi;;
21739 esac
21740 set i_termio; eval $setvar
21741 val=$val2; set i_sgtty; eval $setvar
21742 val=$val3; set i_termios; eval $setvar
21743
21744 : see if stddef is available
21745 set stddef.h i_stddef
21746 eval $inhdr
21747
21748 : see if sys/access.h is available
21749 set sys/access.h i_sysaccess
21750 eval $inhdr
21751
21752 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21753 set sys/filio.h i_sysfilio
21754 eval $inhdr
21755 echo " "
21756 if $test `./findhdr sys/ioctl.h`; then
21757         val="$define"
21758         echo '<sys/ioctl.h> found.' >&4
21759 else
21760         val="$undef"
21761         if $test $i_sysfilio = "$define"; then
21762             echo '<sys/ioctl.h> NOT found.' >&4
21763         else
21764                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21765                 $test $i_termio = "$define" && xxx="termio.h"
21766                 $test $i_termios = "$define" && xxx="termios.h"
21767 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21768         fi
21769 fi
21770 set i_sysioctl
21771 eval $setvar
21772
21773 : see if socket ioctl defs are in sys/sockio.h
21774 echo " "
21775 xxx=`./findhdr sys/sockio.h`
21776 if $test "$xxx"; then
21777         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21778                 val="$define"
21779                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21780         else
21781                 val="$undef"
21782                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21783         fi
21784 else
21785         val="$undef"
21786         $cat <<EOM
21787 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21788 EOM
21789 fi
21790 set i_syssockio
21791 eval $setvar
21792
21793 : see if this is a syslog.h system
21794 set syslog.h i_syslog
21795 eval $inhdr
21796
21797 : see if this is a sys/mode.h system
21798 set sys/mode.h i_sysmode
21799 eval $inhdr
21800
21801 : see if there is a sys/poll.h file
21802 set sys/poll.h i_syspoll
21803 eval $inhdr
21804
21805 : see if sys/resource.h has to be included
21806 set sys/resource.h i_sysresrc
21807 eval $inhdr
21808
21809 : see if sys/security.h is available
21810 set sys/security.h i_syssecrt
21811 eval $inhdr
21812
21813 : see if this is a sys/statvfs.h system
21814 set sys/statvfs.h i_sysstatvfs
21815 eval $inhdr
21816
21817 : see if this is a sys/un.h system
21818 set sys/un.h i_sysun
21819 eval $inhdr
21820
21821 : see if this is a sys/utsname.h system
21822 set sys/utsname.h i_sysutsname
21823 eval $inhdr
21824
21825 : see if this is a syswait system
21826 set sys/wait.h i_syswait
21827 eval $inhdr
21828
21829 : see if this is a ustat.h system
21830 set ustat.h i_ustat
21831 eval $inhdr
21832
21833 : see if this is an utime system
21834 set utime.h i_utime
21835 eval $inhdr
21836
21837 : see if this is a vfork system
21838 case "$d_vfork" in
21839 "$define")
21840         set vfork.h i_vfork
21841         eval $inhdr
21842         ;;
21843 *)
21844         i_vfork="$undef"
21845         ;;
21846 esac
21847
21848 : Check extensions
21849 echo " "
21850 echo "Looking for extensions..." >&4
21851 : If we are using the old config.sh, known_extensions may contain
21852 : old or inaccurate or duplicate values.
21853 known_extensions=''
21854 nonxs_extensions=''
21855 : We do not use find because it might not be available.
21856 : We do not just use MANIFEST because the user may have dropped
21857 : some additional extensions into the source tree and expect them
21858 : to be built.
21859
21860 : Function to recursively find available extensions, ignoring DynaLoader
21861 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21862 : In 5.10.1 and later, extensions are stored in directories
21863 : like File-Glob instead of the older File/Glob/.
21864 find_extensions='
21865     for xxx in *; do
21866         case "$xxx" in
21867             DynaLoader|dynaload) ;;
21868             *)
21869             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21870             leaf=`echo $xxx | $sed -e s/.*-//`;
21871             if $test -d File; then
21872                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21873                     known_extensions="$known_extensions $1$this_ext";
21874                 elif $test -f $xxx/Makefile.PL; then
21875                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21876                 else
21877                     if $test -d $xxx -a $# -lt 10; then
21878                         set $1$xxx/ $*;
21879                         cd "$xxx";
21880                         eval $find_extensions;
21881                         cd ..;
21882                         shift;
21883                     fi;
21884                 fi;
21885             else
21886                 $ls -1 $xxx > $$.tmp;
21887                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21888                     known_extensions="$known_extensions $this_ext";
21889                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21890                     known_extensions="$known_extensions $this_ext";
21891                 elif $test -d $xxx; then
21892                     nonxs_extensions="$nonxs_extensions $this_ext";
21893                 fi;
21894                 $rm -f $$.tmp;
21895             fi
21896             ;;
21897         esac;
21898     done'
21899 tdir=`pwd`
21900 cd "$rsrc/cpan"
21901 set X
21902 shift
21903 eval $find_extensions
21904 cd "$rsrc/dist"
21905 set X
21906 shift
21907 eval $find_extensions
21908 cd "$rsrc/ext"
21909 set X
21910 shift
21911 eval $find_extensions
21912 if $test -d File-Glob; then
21913     : All ext/ flattened
21914 else
21915     # Special case:  Add in modules that nest beyond the first level.
21916     # Currently threads/shared and Hash/Util/FieldHash, since they are
21917     # not picked up by the recursive find above (and adding in general
21918     # recursive finding breaks SDBM_File/sdbm).
21919     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21920     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21921 fi
21922 set X $known_extensions
21923 shift
21924 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21925 set X $nonxs_extensions
21926 shift
21927 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21928 cd "$tdir"
21929
21930 : Now see which are supported on this system.
21931 avail_ext=''
21932 for xxx in $known_extensions ; do
21933         case "$xxx" in
21934         DB_File|db_file)
21935                 case "$i_db" in
21936                 $define) avail_ext="$avail_ext $xxx" ;;
21937                 esac
21938                 ;;
21939         GDBM_File|gdbm_fil)
21940                 case "$i_gdbm" in
21941                 $define) avail_ext="$avail_ext $xxx" ;;
21942                 esac
21943                 ;;
21944         I18N/Langinfo|i18n_lan)
21945                 case "$i_langinfo$d_nl_langinfo" in
21946                 $define$define) avail_ext="$avail_ext $xxx" ;;
21947                 esac
21948                 ;;
21949         IPC/SysV|ipc/sysv)
21950                 : XXX Do we need a useipcsysv variable here
21951                 case "${d_msg}${d_sem}${d_shm}" in
21952                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21953                 esac
21954                 ;;
21955         NDBM_File|ndbm_fil)
21956                 case "$d_ndbm" in
21957                 $define)
21958                     case "$osname-$use64bitint" in
21959                     hpux-define)
21960                         case "$libs" in
21961                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21962                         esac
21963                         ;;
21964                     *) avail_ext="$avail_ext $xxx" ;;
21965                     esac
21966                     ;;
21967                 esac
21968                 ;;
21969         ODBM_File|odbm_fil)
21970                 case "${i_dbm}${i_rpcsvcdbm}" in
21971                 *"${define}"*)
21972                     case "$d_cplusplus" in
21973                     define) ;; # delete as a function name will not work
21974                     *)  case "$osname-$use64bitint" in
21975                         hpux-define)
21976                             case "$libs" in
21977                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21978                             esac
21979                             ;;
21980                         *) avail_ext="$avail_ext $xxx" ;;
21981                         esac
21982                         ;;
21983                     esac
21984                     ;;
21985                 esac
21986                 ;;
21987         Opcode|opcode)
21988                 case "$useopcode" in
21989                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21990                 esac
21991                 ;;
21992         POSIX|posix)
21993                 case "$useposix" in
21994                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21995                 esac
21996                 ;;
21997         Socket|socket)
21998                 case "$d_socket" in
21999                 true|$define|y)
22000                     case "$osname" in
22001                     beos) ;; # not unless BONE
22002                     *) avail_ext="$avail_ext $xxx" ;;
22003                     esac
22004                     ;;
22005                 esac
22006                 ;;
22007         Sys/Syslog|sys/syslog)
22008                 : XXX syslog requires socket
22009                 case "$d_socket" in
22010                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22011                 esac
22012                 ;;
22013         Thread|thread)
22014                 case "$usethreads" in
22015                 true|$define|y)
22016                         case "$use5005threads" in
22017                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22018                         esac
22019                 esac
22020                 ;;
22021         threads|threads/shared)
22022                 # threads and threads::shared are special cases.
22023                 # To stop people from asking "Perl 5.8.0 was supposed
22024                 # to have this new fancy threads implementation but my
22025                 # perl doesn't have it" and from people trying to
22026                 # (re)install the threads module using CPAN.pm and
22027                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22028                 # the threads.pm and threads/shared.pm will always be
22029                 # there, croaking informatively ("you need to rebuild
22030                 # all of Perl with threads, sorry") when threads haven't
22031                 # been compiled in.
22032                 # --jhi
22033                 avail_ext="$avail_ext $xxx"
22034                 ;;
22035         VMS*)
22036                 ;;
22037         Win32*)
22038                 case "$osname" in
22039                 cygwin) avail_ext="$avail_ext $xxx" ;;
22040                 esac
22041                 ;;
22042         XS/APItest|xs/apitest)
22043                 # This is just for testing.  Skip it unless we have dynamic loading.
22044
22045                 case "$usedl" in
22046                 $define) avail_ext="$avail_ext $xxx" ;;
22047                 esac
22048                 ;;
22049         XS/Typemap|xs/typemap)
22050                 # This is just for testing.  Skip it unless we have dynamic loading.
22051                 case "$usedl" in
22052                 $define) avail_ext="$avail_ext $xxx" ;;
22053                 esac
22054                 ;;
22055         *)      avail_ext="$avail_ext $xxx"
22056                 ;;
22057         esac
22058 done
22059
22060 set X $avail_ext
22061 shift
22062 avail_ext="$*"
22063
22064 case "$onlyextensions" in
22065 '') ;;
22066 *)  keepextensions=''
22067     echo "You have requested that only certains extensions be included..." >&4
22068     for i in $onlyextensions; do
22069         case " $avail_ext " in
22070         *" $i "*)
22071             echo "Keeping extension $i."
22072             keepextensions="$keepextensions $i"
22073             ;;
22074         *) echo "Ignoring extension $i." ;;
22075         esac
22076     done
22077     avail_ext="$keepextensions"
22078     ;;
22079 esac
22080
22081 case "$noextensions" in
22082 '') ;;
22083 *)  keepextensions=''
22084     echo "You have requested that certain extensions be ignored..." >&4
22085     for i in $avail_ext; do
22086         case " $noextensions " in
22087         *" $i "*) echo "Ignoring extension $i." ;;
22088         *) echo "Keeping extension $i.";
22089            keepextensions="$keepextensions $i"
22090            ;;
22091         esac
22092     done
22093     avail_ext="$keepextensions"
22094     ;;
22095 esac
22096
22097 : Now see which nonxs extensions are supported on this system.
22098 : For now assume all are.
22099 nonxs_ext=''
22100 for xxx in $nonxs_extensions ; do
22101         case "$xxx" in
22102         *)      nonxs_ext="$nonxs_ext $xxx"
22103                 ;;
22104         esac
22105 done
22106
22107 set X $nonxs_ext
22108 shift
22109 nonxs_ext="$*"
22110
22111 case $usedl in
22112 $define)
22113         $cat <<EOM
22114 A number of extensions are supplied with $package.  You may choose to
22115 compile these extensions for dynamic loading (the default), compile
22116 them into the $package executable (static loading), or not include
22117 them at all.  Answer "none" to include no extensions.
22118 Note that DynaLoader is always built and need not be mentioned here.
22119
22120 EOM
22121         case "$dynamic_ext" in
22122         '')
22123                 : Exclude those listed in static_ext
22124                 dflt=''
22125                 for xxx in $avail_ext; do
22126                         case " $static_ext " in
22127                         *" $xxx "*) ;;
22128                         *) dflt="$dflt $xxx" ;;
22129                         esac
22130                 done
22131                 set X $dflt
22132                 shift
22133                 dflt="$*"
22134                 ;;
22135         *)      dflt="$dynamic_ext"
22136                 # Perhaps we are reusing an old out-of-date config.sh.
22137                 case "$hint" in
22138                 previous)
22139                         if test X"$dynamic_ext" != X"$avail_ext"; then
22140                                 $cat <<EOM
22141 NOTICE:  Your previous config.sh list may be incorrect.
22142 The extensions now available to you are
22143         ${avail_ext}
22144 but the default list from your previous config.sh is
22145         ${dynamic_ext}
22146
22147 EOM
22148                         fi
22149                         ;;
22150                 esac
22151                 ;;
22152         esac
22153         case "$dflt" in
22154         '')     dflt=none;;
22155         esac
22156         rp="What extensions do you wish to load dynamically?"
22157         . ./myread
22158         case "$ans" in
22159         none) dynamic_ext=' ' ;;
22160         *) dynamic_ext="$ans" ;;
22161         esac
22162
22163         case "$static_ext" in
22164         '')
22165                 : Exclude those already listed in dynamic linking
22166                 dflt=''
22167                 for xxx in $avail_ext; do
22168                         case " $dynamic_ext " in
22169                         *" $xxx "*) ;;
22170                         *) dflt="$dflt $xxx" ;;
22171                         esac
22172                 done
22173                 set X $dflt
22174                 shift
22175                 dflt="$*"
22176                 ;;
22177         *)  dflt="$static_ext"
22178                 ;;
22179         esac
22180
22181         case "$dflt" in
22182         '')     dflt=none;;
22183         esac
22184         rp="What extensions do you wish to load statically?"
22185         . ./myread
22186         case "$ans" in
22187         none) static_ext=' ' ;;
22188         *) static_ext="$ans" ;;
22189         esac
22190         ;;
22191 *)
22192         $cat <<EOM
22193 A number of extensions are supplied with $package.  Answer "none"
22194 to include no extensions.
22195 Note that DynaLoader is always built and need not be mentioned here.
22196
22197 EOM
22198         case "$static_ext" in
22199         '') dflt="$avail_ext" ;;
22200         *)      dflt="$static_ext"
22201                 # Perhaps we are reusing an old out-of-date config.sh.
22202                 case "$hint" in
22203                 previous)
22204                         if test X"$static_ext" != X"$avail_ext"; then
22205                                 $cat <<EOM
22206 NOTICE:  Your previous config.sh list may be incorrect.
22207 The extensions now available to you are
22208         ${avail_ext}
22209 but the default list from your previous config.sh is
22210         ${static_ext}
22211
22212 EOM
22213                         fi
22214                         ;;
22215                 esac
22216                 ;;
22217         esac
22218         : Exclude those that are not xs extensions
22219         case "$dflt" in
22220         '')     dflt=none;;
22221         esac
22222         rp="What extensions do you wish to include?"
22223         . ./myread
22224         case "$ans" in
22225         none) static_ext=' ' ;;
22226         *) static_ext="$ans" ;;
22227         esac
22228         ;;
22229 esac
22230 #
22231 # Encode is a special case.  If we are building Encode as a static
22232 # extension, we need to explicitly list its subextensions as well.
22233 # For other nested extensions, this is handled automatically by
22234 # the appropriate Makefile.PL.
22235 case " $static_ext " in
22236         *" Encode "*) # Add the subextensions of Encode
22237         cd "$rsrc/ext"
22238         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22239                 static_ext="$static_ext Encode/$xxx"
22240         done
22241         cd "$tdir"
22242         ;;
22243 esac
22244
22245 set X $dynamic_ext $static_ext $nonxs_ext
22246 shift
22247 extensions="$*"
22248
22249 # Sanity check:  We require an extension suitable for use with
22250 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22251 # should show up as failures in the test suite, but it's helpful to
22252 # catch them now.) The 'extensions' list is normally sorted
22253 # alphabetically, so we need to accept either
22254 #    DB_File ... Fcntl ... IO  ....
22255 # or something like
22256 #    Fcntl ... NDBM_File ... IO  ....
22257 case " $extensions"  in
22258 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22259 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22260 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22261 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22262    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22263    ;;
22264 esac
22265
22266 : Remove libraries needed only for extensions
22267 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22268 : The exception is SunOS 4.x, which needs them.
22269 case "${osname}X${osvers}" in
22270 sunos*X4*)
22271     perllibs="$libs"
22272     ;;
22273 *) case "$usedl" in
22274     $define|true|[yY]*)
22275             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22276             shift
22277             perllibs="$*"
22278             ;;
22279     *)  perllibs="$libs"
22280             ;;
22281     esac
22282     ;;
22283 esac
22284
22285 : Remove build directory name from cppstdin so it can be used from
22286 : either the present location or the final installed location.
22287 echo " "
22288 : Get out of the UU directory to get correct path name.
22289 cd ..
22290 case "$cppstdin" in
22291 `pwd`/cppstdin)
22292         echo "Stripping down cppstdin path name"
22293         cppstdin=cppstdin
22294         ;;
22295 esac
22296 cd UU
22297
22298 : end of configuration questions
22299 echo " "
22300 echo "End of configuration questions."
22301 echo " "
22302
22303 : back to where it started
22304 if test -d ../UU; then
22305         cd ..
22306 fi
22307
22308 : configuration may be unconditionally patched via a 'config.arch' file
22309 if $test -f config.arch; then
22310         echo "I see a config.arch file, loading it." >&4
22311         . ./config.arch
22312 fi
22313
22314 : configuration may be patched via a 'config.over' file
22315 if $test -f config.over; then
22316         echo " "
22317         dflt=y
22318         rp='I see a config.over file.  Do you wish to load it?'
22319         . UU/myread
22320         case "$ans" in
22321         n*) echo "OK, I'll ignore it.";;
22322         *)      . ./config.over
22323                 echo "Configuration override changes have been loaded."
22324                 ;;
22325         esac
22326 fi
22327
22328 : in case they want portability, strip down executable paths
22329 case "$d_portable" in
22330 "$define")
22331         echo " "
22332         echo "Stripping down executable paths..." >&4
22333         for file in $loclist $trylist; do
22334                 eval temp=\$$file
22335                 eval $file=`basename $temp`
22336         done
22337         ;;
22338 esac
22339
22340 : create config.sh file
22341 echo " "
22342 echo "Creating config.sh..." >&4
22343 $spitshell <<EOT >config.sh
22344 $startsh
22345 #
22346 # This file was produced by running the Configure script. It holds all the
22347 # definitions figured out by Configure. Should you modify one of these values,
22348 # do not forget to propagate your changes by running "Configure -der". You may
22349 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22350 #
22351
22352 # Package name      : $package
22353 # Source directory  : $src
22354 # Configuration time: $cf_time
22355 # Configured by     : $cf_by
22356 # Target system     : $myuname
22357
22358 EOT
22359 : Add in command line options if available
22360 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22361
22362 $spitshell <<EOT >>config.sh
22363
22364 Author='$Author'
22365 Date='$Date'
22366 Header='$Header'
22367 Id='$Id'
22368 Locker='$Locker'
22369 Log='$Log'
22370 RCSfile='$RCSfile'
22371 Revision='$Revision'
22372 Source='$Source'
22373 State='$State'
22374 _a='$_a'
22375 _exe='$_exe'
22376 _o='$_o'
22377 afs='$afs'
22378 afsroot='$afsroot'
22379 alignbytes='$alignbytes'
22380 ansi2knr='$ansi2knr'
22381 aphostname='$aphostname'
22382 api_revision='$api_revision'
22383 api_subversion='$api_subversion'
22384 api_version='$api_version'
22385 api_versionstring='$api_versionstring'
22386 ar='$ar'
22387 archlib='$archlib'
22388 archlibexp='$archlibexp'
22389 archname64='$archname64'
22390 archname='$archname'
22391 archobjs='$archobjs'
22392 asctime_r_proto='$asctime_r_proto'
22393 awk='$awk'
22394 baserev='$baserev'
22395 bash='$bash'
22396 bin='$bin'
22397 bin_ELF='$bin_ELF'
22398 binexp='$binexp'
22399 bison='$bison'
22400 byacc='$byacc'
22401 byteorder='$byteorder'
22402 c='$c'
22403 castflags='$castflags'
22404 cat='$cat'
22405 cc='$cc'
22406 cccdlflags='$cccdlflags'
22407 ccdlflags='$ccdlflags'
22408 ccflags='$ccflags'
22409 ccflags_uselargefiles='$ccflags_uselargefiles'
22410 ccname='$ccname'
22411 ccsymbols='$ccsymbols'
22412 ccversion='$ccversion'
22413 cf_by='$cf_by'
22414 cf_email='$cf_email'
22415 cf_time='$cf_time'
22416 charbits='$charbits'
22417 charsize='$charsize'
22418 chgrp='$chgrp'
22419 chmod='$chmod'
22420 chown='$chown'
22421 clocktype='$clocktype'
22422 comm='$comm'
22423 compress='$compress'
22424 contains='$contains'
22425 cp='$cp'
22426 cpio='$cpio'
22427 cpp='$cpp'
22428 cpp_stuff='$cpp_stuff'
22429 cppccsymbols='$cppccsymbols'
22430 cppflags='$cppflags'
22431 cpplast='$cpplast'
22432 cppminus='$cppminus'
22433 cpprun='$cpprun'
22434 cppstdin='$cppstdin'
22435 cppsymbols='$cppsymbols'
22436 crypt_r_proto='$crypt_r_proto'
22437 cryptlib='$cryptlib'
22438 csh='$csh'
22439 ctermid_r_proto='$ctermid_r_proto'
22440 ctime_r_proto='$ctime_r_proto'
22441 d_Gconvert='$d_Gconvert'
22442 d_PRIEUldbl='$d_PRIEUldbl'
22443 d_PRIFUldbl='$d_PRIFUldbl'
22444 d_PRIGUldbl='$d_PRIGUldbl'
22445 d_PRIXU64='$d_PRIXU64'
22446 d_PRId64='$d_PRId64'
22447 d_PRIeldbl='$d_PRIeldbl'
22448 d_PRIfldbl='$d_PRIfldbl'
22449 d_PRIgldbl='$d_PRIgldbl'
22450 d_PRIi64='$d_PRIi64'
22451 d_PRIo64='$d_PRIo64'
22452 d_PRIu64='$d_PRIu64'
22453 d_PRIx64='$d_PRIx64'
22454 d_SCNfldbl='$d_SCNfldbl'
22455 d__fwalk='$d__fwalk'
22456 d_access='$d_access'
22457 d_accessx='$d_accessx'
22458 d_aintl='$d_aintl'
22459 d_alarm='$d_alarm'
22460 d_archlib='$d_archlib'
22461 d_asctime64='$d_asctime64'
22462 d_asctime_r='$d_asctime_r'
22463 d_atolf='$d_atolf'
22464 d_atoll='$d_atoll'
22465 d_attribute_deprecated='$d_attribute_deprecated'
22466 d_attribute_format='$d_attribute_format'
22467 d_attribute_malloc='$d_attribute_malloc'
22468 d_attribute_nonnull='$d_attribute_nonnull'
22469 d_attribute_noreturn='$d_attribute_noreturn'
22470 d_attribute_pure='$d_attribute_pure'
22471 d_attribute_unused='$d_attribute_unused'
22472 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22473 d_bcmp='$d_bcmp'
22474 d_bcopy='$d_bcopy'
22475 d_bsd='$d_bsd'
22476 d_bsdgetpgrp='$d_bsdgetpgrp'
22477 d_bsdsetpgrp='$d_bsdsetpgrp'
22478 d_builtin_choose_expr='$d_builtin_choose_expr'
22479 d_builtin_expect='$d_builtin_expect'
22480 d_bzero='$d_bzero'
22481 d_c99_variadic_macros='$d_c99_variadic_macros'
22482 d_casti32='$d_casti32'
22483 d_castneg='$d_castneg'
22484 d_charvspr='$d_charvspr'
22485 d_chown='$d_chown'
22486 d_chroot='$d_chroot'
22487 d_chsize='$d_chsize'
22488 d_class='$d_class'
22489 d_clearenv='$d_clearenv'
22490 d_closedir='$d_closedir'
22491 d_cmsghdr_s='$d_cmsghdr_s'
22492 d_const='$d_const'
22493 d_copysignl='$d_copysignl'
22494 d_cplusplus='$d_cplusplus'
22495 d_crypt='$d_crypt'
22496 d_crypt_r='$d_crypt_r'
22497 d_csh='$d_csh'
22498 d_ctermid='$d_ctermid'
22499 d_ctermid_r='$d_ctermid_r'
22500 d_ctime64='$d_ctime64'
22501 d_ctime_r='$d_ctime_r'
22502 d_cuserid='$d_cuserid'
22503 d_dbl_dig='$d_dbl_dig'
22504 d_dbminitproto='$d_dbminitproto'
22505 d_difftime64='$d_difftime64'
22506 d_difftime='$d_difftime'
22507 d_dir_dd_fd='$d_dir_dd_fd'
22508 d_dirfd='$d_dirfd'
22509 d_dirnamlen='$d_dirnamlen'
22510 d_dlerror='$d_dlerror'
22511 d_dlopen='$d_dlopen'
22512 d_dlsymun='$d_dlsymun'
22513 d_dosuid='$d_dosuid'
22514 d_drand48_r='$d_drand48_r'
22515 d_drand48proto='$d_drand48proto'
22516 d_dup2='$d_dup2'
22517 d_eaccess='$d_eaccess'
22518 d_endgrent='$d_endgrent'
22519 d_endgrent_r='$d_endgrent_r'
22520 d_endhent='$d_endhent'
22521 d_endhostent_r='$d_endhostent_r'
22522 d_endnent='$d_endnent'
22523 d_endnetent_r='$d_endnetent_r'
22524 d_endpent='$d_endpent'
22525 d_endprotoent_r='$d_endprotoent_r'
22526 d_endpwent='$d_endpwent'
22527 d_endpwent_r='$d_endpwent_r'
22528 d_endsent='$d_endsent'
22529 d_endservent_r='$d_endservent_r'
22530 d_eofnblk='$d_eofnblk'
22531 d_eunice='$d_eunice'
22532 d_faststdio='$d_faststdio'
22533 d_fchdir='$d_fchdir'
22534 d_fchmod='$d_fchmod'
22535 d_fchown='$d_fchown'
22536 d_fcntl='$d_fcntl'
22537 d_fcntl_can_lock='$d_fcntl_can_lock'
22538 d_fd_macros='$d_fd_macros'
22539 d_fd_set='$d_fd_set'
22540 d_fds_bits='$d_fds_bits'
22541 d_fgetpos='$d_fgetpos'
22542 d_finite='$d_finite'
22543 d_finitel='$d_finitel'
22544 d_flexfnam='$d_flexfnam'
22545 d_flock='$d_flock'
22546 d_flockproto='$d_flockproto'
22547 d_fork='$d_fork'
22548 d_fp_class='$d_fp_class'
22549 d_fpathconf='$d_fpathconf'
22550 d_fpclass='$d_fpclass'
22551 d_fpclassify='$d_fpclassify'
22552 d_fpclassl='$d_fpclassl'
22553 d_fpos64_t='$d_fpos64_t'
22554 d_frexpl='$d_frexpl'
22555 d_fs_data_s='$d_fs_data_s'
22556 d_fseeko='$d_fseeko'
22557 d_fsetpos='$d_fsetpos'
22558 d_fstatfs='$d_fstatfs'
22559 d_fstatvfs='$d_fstatvfs'
22560 d_fsync='$d_fsync'
22561 d_ftello='$d_ftello'
22562 d_ftime='$d_ftime'
22563 d_futimes='$d_futimes'
22564 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22565 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22566 d_getaddrinfo='$d_getaddrinfo'
22567 d_getcwd='$d_getcwd'
22568 d_getespwnam='$d_getespwnam'
22569 d_getfsstat='$d_getfsstat'
22570 d_getgrent='$d_getgrent'
22571 d_getgrent_r='$d_getgrent_r'
22572 d_getgrgid_r='$d_getgrgid_r'
22573 d_getgrnam_r='$d_getgrnam_r'
22574 d_getgrps='$d_getgrps'
22575 d_gethbyaddr='$d_gethbyaddr'
22576 d_gethbyname='$d_gethbyname'
22577 d_gethent='$d_gethent'
22578 d_gethname='$d_gethname'
22579 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22580 d_gethostbyname_r='$d_gethostbyname_r'
22581 d_gethostent_r='$d_gethostent_r'
22582 d_gethostprotos='$d_gethostprotos'
22583 d_getitimer='$d_getitimer'
22584 d_getlogin='$d_getlogin'
22585 d_getlogin_r='$d_getlogin_r'
22586 d_getmnt='$d_getmnt'
22587 d_getmntent='$d_getmntent'
22588 d_getnameinfo='$d_getnameinfo'
22589 d_getnbyaddr='$d_getnbyaddr'
22590 d_getnbyname='$d_getnbyname'
22591 d_getnent='$d_getnent'
22592 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22593 d_getnetbyname_r='$d_getnetbyname_r'
22594 d_getnetent_r='$d_getnetent_r'
22595 d_getnetprotos='$d_getnetprotos'
22596 d_getpagsz='$d_getpagsz'
22597 d_getpbyname='$d_getpbyname'
22598 d_getpbynumber='$d_getpbynumber'
22599 d_getpent='$d_getpent'
22600 d_getpgid='$d_getpgid'
22601 d_getpgrp2='$d_getpgrp2'
22602 d_getpgrp='$d_getpgrp'
22603 d_getppid='$d_getppid'
22604 d_getprior='$d_getprior'
22605 d_getprotobyname_r='$d_getprotobyname_r'
22606 d_getprotobynumber_r='$d_getprotobynumber_r'
22607 d_getprotoent_r='$d_getprotoent_r'
22608 d_getprotoprotos='$d_getprotoprotos'
22609 d_getprpwnam='$d_getprpwnam'
22610 d_getpwent='$d_getpwent'
22611 d_getpwent_r='$d_getpwent_r'
22612 d_getpwnam_r='$d_getpwnam_r'
22613 d_getpwuid_r='$d_getpwuid_r'
22614 d_getsbyname='$d_getsbyname'
22615 d_getsbyport='$d_getsbyport'
22616 d_getsent='$d_getsent'
22617 d_getservbyname_r='$d_getservbyname_r'
22618 d_getservbyport_r='$d_getservbyport_r'
22619 d_getservent_r='$d_getservent_r'
22620 d_getservprotos='$d_getservprotos'
22621 d_getspnam='$d_getspnam'
22622 d_getspnam_r='$d_getspnam_r'
22623 d_gettimeod='$d_gettimeod'
22624 d_gmtime64='$d_gmtime64'
22625 d_gmtime_r='$d_gmtime_r'
22626 d_gnulibc='$d_gnulibc'
22627 d_grpasswd='$d_grpasswd'
22628 d_hasmntopt='$d_hasmntopt'
22629 d_htonl='$d_htonl'
22630 d_ilogbl='$d_ilogbl'
22631 d_inc_version_list='$d_inc_version_list'
22632 d_index='$d_index'
22633 d_inetaton='$d_inetaton'
22634 d_inetntop='$d_inetntop'
22635 d_inetpton='$d_inetpton'
22636 d_int64_t='$d_int64_t'
22637 d_isascii='$d_isascii'
22638 d_isfinite='$d_isfinite'
22639 d_isinf='$d_isinf'
22640 d_isnan='$d_isnan'
22641 d_isnanl='$d_isnanl'
22642 d_killpg='$d_killpg'
22643 d_lchown='$d_lchown'
22644 d_ldbl_dig='$d_ldbl_dig'
22645 d_libm_lib_version='$d_libm_lib_version'
22646 d_link='$d_link'
22647 d_localtime64='$d_localtime64'
22648 d_localtime_r='$d_localtime_r'
22649 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22650 d_locconv='$d_locconv'
22651 d_lockf='$d_lockf'
22652 d_longdbl='$d_longdbl'
22653 d_longlong='$d_longlong'
22654 d_lseekproto='$d_lseekproto'
22655 d_lstat='$d_lstat'
22656 d_madvise='$d_madvise'
22657 d_malloc_good_size='$d_malloc_good_size'
22658 d_malloc_size='$d_malloc_size'
22659 d_mblen='$d_mblen'
22660 d_mbstowcs='$d_mbstowcs'
22661 d_mbtowc='$d_mbtowc'
22662 d_memchr='$d_memchr'
22663 d_memcmp='$d_memcmp'
22664 d_memcpy='$d_memcpy'
22665 d_memmove='$d_memmove'
22666 d_memset='$d_memset'
22667 d_mkdir='$d_mkdir'
22668 d_mkdtemp='$d_mkdtemp'
22669 d_mkfifo='$d_mkfifo'
22670 d_mkstemp='$d_mkstemp'
22671 d_mkstemps='$d_mkstemps'
22672 d_mktime64='$d_mktime64'
22673 d_mktime='$d_mktime'
22674 d_mmap='$d_mmap'
22675 d_modfl='$d_modfl'
22676 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22677 d_modflproto='$d_modflproto'
22678 d_mprotect='$d_mprotect'
22679 d_msg='$d_msg'
22680 d_msg_ctrunc='$d_msg_ctrunc'
22681 d_msg_dontroute='$d_msg_dontroute'
22682 d_msg_oob='$d_msg_oob'
22683 d_msg_peek='$d_msg_peek'
22684 d_msg_proxy='$d_msg_proxy'
22685 d_msgctl='$d_msgctl'
22686 d_msgget='$d_msgget'
22687 d_msghdr_s='$d_msghdr_s'
22688 d_msgrcv='$d_msgrcv'
22689 d_msgsnd='$d_msgsnd'
22690 d_msync='$d_msync'
22691 d_munmap='$d_munmap'
22692 d_mymalloc='$d_mymalloc'
22693 d_ndbm='$d_ndbm'
22694 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22695 d_nice='$d_nice'
22696 d_nl_langinfo='$d_nl_langinfo'
22697 d_nv_preserves_uv='$d_nv_preserves_uv'
22698 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22699 d_off64_t='$d_off64_t'
22700 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22701 d_oldpthreads='$d_oldpthreads'
22702 d_oldsock='$d_oldsock'
22703 d_open3='$d_open3'
22704 d_pathconf='$d_pathconf'
22705 d_pause='$d_pause'
22706 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22707 d_phostname='$d_phostname'
22708 d_pipe='$d_pipe'
22709 d_poll='$d_poll'
22710 d_portable='$d_portable'
22711 d_prctl='$d_prctl'
22712 d_prctl_set_name='$d_prctl_set_name'
22713 d_printf_format_null='$d_printf_format_null'
22714 d_procselfexe='$d_procselfexe'
22715 d_pseudofork='$d_pseudofork'
22716 d_pthread_atfork='$d_pthread_atfork'
22717 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22718 d_pthread_yield='$d_pthread_yield'
22719 d_pwage='$d_pwage'
22720 d_pwchange='$d_pwchange'
22721 d_pwclass='$d_pwclass'
22722 d_pwcomment='$d_pwcomment'
22723 d_pwexpire='$d_pwexpire'
22724 d_pwgecos='$d_pwgecos'
22725 d_pwpasswd='$d_pwpasswd'
22726 d_pwquota='$d_pwquota'
22727 d_qgcvt='$d_qgcvt'
22728 d_quad='$d_quad'
22729 d_random_r='$d_random_r'
22730 d_readdir64_r='$d_readdir64_r'
22731 d_readdir='$d_readdir'
22732 d_readdir_r='$d_readdir_r'
22733 d_readlink='$d_readlink'
22734 d_readv='$d_readv'
22735 d_recvmsg='$d_recvmsg'
22736 d_rename='$d_rename'
22737 d_rewinddir='$d_rewinddir'
22738 d_rmdir='$d_rmdir'
22739 d_safebcpy='$d_safebcpy'
22740 d_safemcpy='$d_safemcpy'
22741 d_sanemcmp='$d_sanemcmp'
22742 d_sbrkproto='$d_sbrkproto'
22743 d_scalbnl='$d_scalbnl'
22744 d_sched_yield='$d_sched_yield'
22745 d_scm_rights='$d_scm_rights'
22746 d_seekdir='$d_seekdir'
22747 d_select='$d_select'
22748 d_sem='$d_sem'
22749 d_semctl='$d_semctl'
22750 d_semctl_semid_ds='$d_semctl_semid_ds'
22751 d_semctl_semun='$d_semctl_semun'
22752 d_semget='$d_semget'
22753 d_semop='$d_semop'
22754 d_sendmsg='$d_sendmsg'
22755 d_setegid='$d_setegid'
22756 d_seteuid='$d_seteuid'
22757 d_setgrent='$d_setgrent'
22758 d_setgrent_r='$d_setgrent_r'
22759 d_setgrps='$d_setgrps'
22760 d_sethent='$d_sethent'
22761 d_sethostent_r='$d_sethostent_r'
22762 d_setitimer='$d_setitimer'
22763 d_setlinebuf='$d_setlinebuf'
22764 d_setlocale='$d_setlocale'
22765 d_setlocale_r='$d_setlocale_r'
22766 d_setnent='$d_setnent'
22767 d_setnetent_r='$d_setnetent_r'
22768 d_setpent='$d_setpent'
22769 d_setpgid='$d_setpgid'
22770 d_setpgrp2='$d_setpgrp2'
22771 d_setpgrp='$d_setpgrp'
22772 d_setprior='$d_setprior'
22773 d_setproctitle='$d_setproctitle'
22774 d_setprotoent_r='$d_setprotoent_r'
22775 d_setpwent='$d_setpwent'
22776 d_setpwent_r='$d_setpwent_r'
22777 d_setregid='$d_setregid'
22778 d_setresgid='$d_setresgid'
22779 d_setresuid='$d_setresuid'
22780 d_setreuid='$d_setreuid'
22781 d_setrgid='$d_setrgid'
22782 d_setruid='$d_setruid'
22783 d_setsent='$d_setsent'
22784 d_setservent_r='$d_setservent_r'
22785 d_setsid='$d_setsid'
22786 d_setvbuf='$d_setvbuf'
22787 d_sfio='$d_sfio'
22788 d_shm='$d_shm'
22789 d_shmat='$d_shmat'
22790 d_shmatprototype='$d_shmatprototype'
22791 d_shmctl='$d_shmctl'
22792 d_shmdt='$d_shmdt'
22793 d_shmget='$d_shmget'
22794 d_sigaction='$d_sigaction'
22795 d_signbit='$d_signbit'
22796 d_sigprocmask='$d_sigprocmask'
22797 d_sigsetjmp='$d_sigsetjmp'
22798 d_sitearch='$d_sitearch'
22799 d_snprintf='$d_snprintf'
22800 d_sockatmark='$d_sockatmark'
22801 d_sockatmarkproto='$d_sockatmarkproto'
22802 d_socket='$d_socket'
22803 d_socklen_t='$d_socklen_t'
22804 d_sockpair='$d_sockpair'
22805 d_socks5_init='$d_socks5_init'
22806 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22807 d_sqrtl='$d_sqrtl'
22808 d_srand48_r='$d_srand48_r'
22809 d_srandom_r='$d_srandom_r'
22810 d_sresgproto='$d_sresgproto'
22811 d_sresuproto='$d_sresuproto'
22812 d_statblks='$d_statblks'
22813 d_statfs_f_flags='$d_statfs_f_flags'
22814 d_statfs_s='$d_statfs_s'
22815 d_static_inline='$d_static_inline'
22816 d_statvfs='$d_statvfs'
22817 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22818 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22819 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22820 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22821 d_stdio_stream_array='$d_stdio_stream_array'
22822 d_stdiobase='$d_stdiobase'
22823 d_stdstdio='$d_stdstdio'
22824 d_strchr='$d_strchr'
22825 d_strcoll='$d_strcoll'
22826 d_strctcpy='$d_strctcpy'
22827 d_strerrm='$d_strerrm'
22828 d_strerror='$d_strerror'
22829 d_strerror_r='$d_strerror_r'
22830 d_strftime='$d_strftime'
22831 d_strlcat='$d_strlcat'
22832 d_strlcpy='$d_strlcpy'
22833 d_strtod='$d_strtod'
22834 d_strtol='$d_strtol'
22835 d_strtold='$d_strtold'
22836 d_strtoll='$d_strtoll'
22837 d_strtoq='$d_strtoq'
22838 d_strtoul='$d_strtoul'
22839 d_strtoull='$d_strtoull'
22840 d_strtouq='$d_strtouq'
22841 d_strxfrm='$d_strxfrm'
22842 d_suidsafe='$d_suidsafe'
22843 d_symlink='$d_symlink'
22844 d_syscall='$d_syscall'
22845 d_syscallproto='$d_syscallproto'
22846 d_sysconf='$d_sysconf'
22847 d_sysernlst='$d_sysernlst'
22848 d_syserrlst='$d_syserrlst'
22849 d_system='$d_system'
22850 d_tcgetpgrp='$d_tcgetpgrp'
22851 d_tcsetpgrp='$d_tcsetpgrp'
22852 d_telldir='$d_telldir'
22853 d_telldirproto='$d_telldirproto'
22854 d_time='$d_time'
22855 d_timegm='$d_timegm'
22856 d_times='$d_times'
22857 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22858 d_tm_tm_zone='$d_tm_tm_zone'
22859 d_tmpnam_r='$d_tmpnam_r'
22860 d_truncate='$d_truncate'
22861 d_ttyname_r='$d_ttyname_r'
22862 d_tzname='$d_tzname'
22863 d_u32align='$d_u32align'
22864 d_ualarm='$d_ualarm'
22865 d_umask='$d_umask'
22866 d_uname='$d_uname'
22867 d_union_semun='$d_union_semun'
22868 d_unordered='$d_unordered'
22869 d_unsetenv='$d_unsetenv'
22870 d_usleep='$d_usleep'
22871 d_usleepproto='$d_usleepproto'
22872 d_ustat='$d_ustat'
22873 d_vendorarch='$d_vendorarch'
22874 d_vendorbin='$d_vendorbin'
22875 d_vendorlib='$d_vendorlib'
22876 d_vendorscript='$d_vendorscript'
22877 d_vfork='$d_vfork'
22878 d_void_closedir='$d_void_closedir'
22879 d_voidsig='$d_voidsig'
22880 d_voidtty='$d_voidtty'
22881 d_volatile='$d_volatile'
22882 d_vprintf='$d_vprintf'
22883 d_vsnprintf='$d_vsnprintf'
22884 d_wait4='$d_wait4'
22885 d_waitpid='$d_waitpid'
22886 d_wcstombs='$d_wcstombs'
22887 d_wctomb='$d_wctomb'
22888 d_writev='$d_writev'
22889 d_xenix='$d_xenix'
22890 date='$date'
22891 db_hashtype='$db_hashtype'
22892 db_prefixtype='$db_prefixtype'
22893 db_version_major='$db_version_major'
22894 db_version_minor='$db_version_minor'
22895 db_version_patch='$db_version_patch'
22896 defvoidused='$defvoidused'
22897 direntrytype='$direntrytype'
22898 dlext='$dlext'
22899 dlsrc='$dlsrc'
22900 doublesize='$doublesize'
22901 drand01='$drand01'
22902 drand48_r_proto='$drand48_r_proto'
22903 dtrace='$dtrace'
22904 dynamic_ext='$dynamic_ext'
22905 eagain='$eagain'
22906 ebcdic='$ebcdic'
22907 echo='$echo'
22908 egrep='$egrep'
22909 emacs='$emacs'
22910 endgrent_r_proto='$endgrent_r_proto'
22911 endhostent_r_proto='$endhostent_r_proto'
22912 endnetent_r_proto='$endnetent_r_proto'
22913 endprotoent_r_proto='$endprotoent_r_proto'
22914 endpwent_r_proto='$endpwent_r_proto'
22915 endservent_r_proto='$endservent_r_proto'
22916 eunicefix='$eunicefix'
22917 exe_ext='$exe_ext'
22918 expr='$expr'
22919 extensions='$extensions'
22920 extern_C='$extern_C'
22921 extras='$extras'
22922 fflushNULL='$fflushNULL'
22923 fflushall='$fflushall'
22924 find='$find'
22925 firstmakefile='$firstmakefile'
22926 flex='$flex'
22927 fpossize='$fpossize'
22928 fpostype='$fpostype'
22929 freetype='$freetype'
22930 from='$from'
22931 full_ar='$full_ar'
22932 full_csh='$full_csh'
22933 full_sed='$full_sed'
22934 gccansipedantic='$gccansipedantic'
22935 gccosandvers='$gccosandvers'
22936 gccversion='$gccversion'
22937 getgrent_r_proto='$getgrent_r_proto'
22938 getgrgid_r_proto='$getgrgid_r_proto'
22939 getgrnam_r_proto='$getgrnam_r_proto'
22940 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22941 gethostbyname_r_proto='$gethostbyname_r_proto'
22942 gethostent_r_proto='$gethostent_r_proto'
22943 getlogin_r_proto='$getlogin_r_proto'
22944 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22945 getnetbyname_r_proto='$getnetbyname_r_proto'
22946 getnetent_r_proto='$getnetent_r_proto'
22947 getprotobyname_r_proto='$getprotobyname_r_proto'
22948 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22949 getprotoent_r_proto='$getprotoent_r_proto'
22950 getpwent_r_proto='$getpwent_r_proto'
22951 getpwnam_r_proto='$getpwnam_r_proto'
22952 getpwuid_r_proto='$getpwuid_r_proto'
22953 getservbyname_r_proto='$getservbyname_r_proto'
22954 getservbyport_r_proto='$getservbyport_r_proto'
22955 getservent_r_proto='$getservent_r_proto'
22956 getspnam_r_proto='$getspnam_r_proto'
22957 gidformat='$gidformat'
22958 gidsign='$gidsign'
22959 gidsize='$gidsize'
22960 gidtype='$gidtype'
22961 glibpth='$glibpth'
22962 gmake='$gmake'
22963 gmtime_r_proto='$gmtime_r_proto'
22964 gnulibc_version='$gnulibc_version'
22965 grep='$grep'
22966 groupcat='$groupcat'
22967 groupstype='$groupstype'
22968 gzip='$gzip'
22969 h_fcntl='$h_fcntl'
22970 h_sysfile='$h_sysfile'
22971 hint='$hint'
22972 hostcat='$hostcat'
22973 html1dir='$html1dir'
22974 html1direxp='$html1direxp'
22975 html3dir='$html3dir'
22976 html3direxp='$html3direxp'
22977 i16size='$i16size'
22978 i16type='$i16type'
22979 i32size='$i32size'
22980 i32type='$i32type'
22981 i64size='$i64size'
22982 i64type='$i64type'
22983 i8size='$i8size'
22984 i8type='$i8type'
22985 i_arpainet='$i_arpainet'
22986 i_assert='$i_assert'
22987 i_bsdioctl='$i_bsdioctl'
22988 i_crypt='$i_crypt'
22989 i_db='$i_db'
22990 i_dbm='$i_dbm'
22991 i_dirent='$i_dirent'
22992 i_dld='$i_dld'
22993 i_dlfcn='$i_dlfcn'
22994 i_fcntl='$i_fcntl'
22995 i_float='$i_float'
22996 i_fp='$i_fp'
22997 i_fp_class='$i_fp_class'
22998 i_gdbm='$i_gdbm'
22999 i_gdbm_ndbm='$i_gdbm_ndbm'
23000 i_gdbmndbm='$i_gdbmndbm'
23001 i_grp='$i_grp'
23002 i_ieeefp='$i_ieeefp'
23003 i_inttypes='$i_inttypes'
23004 i_langinfo='$i_langinfo'
23005 i_libutil='$i_libutil'
23006 i_limits='$i_limits'
23007 i_locale='$i_locale'
23008 i_machcthr='$i_machcthr'
23009 i_malloc='$i_malloc'
23010 i_mallocmalloc='$i_mallocmalloc'
23011 i_math='$i_math'
23012 i_memory='$i_memory'
23013 i_mntent='$i_mntent'
23014 i_ndbm='$i_ndbm'
23015 i_netdb='$i_netdb'
23016 i_neterrno='$i_neterrno'
23017 i_netinettcp='$i_netinettcp'
23018 i_niin='$i_niin'
23019 i_poll='$i_poll'
23020 i_prot='$i_prot'
23021 i_pthread='$i_pthread'
23022 i_pwd='$i_pwd'
23023 i_rpcsvcdbm='$i_rpcsvcdbm'
23024 i_sfio='$i_sfio'
23025 i_sgtty='$i_sgtty'
23026 i_shadow='$i_shadow'
23027 i_socks='$i_socks'
23028 i_stdarg='$i_stdarg'
23029 i_stddef='$i_stddef'
23030 i_stdlib='$i_stdlib'
23031 i_string='$i_string'
23032 i_sunmath='$i_sunmath'
23033 i_sysaccess='$i_sysaccess'
23034 i_sysdir='$i_sysdir'
23035 i_sysfile='$i_sysfile'
23036 i_sysfilio='$i_sysfilio'
23037 i_sysin='$i_sysin'
23038 i_sysioctl='$i_sysioctl'
23039 i_syslog='$i_syslog'
23040 i_sysmman='$i_sysmman'
23041 i_sysmode='$i_sysmode'
23042 i_sysmount='$i_sysmount'
23043 i_sysndir='$i_sysndir'
23044 i_sysparam='$i_sysparam'
23045 i_syspoll='$i_syspoll'
23046 i_sysresrc='$i_sysresrc'
23047 i_syssecrt='$i_syssecrt'
23048 i_sysselct='$i_sysselct'
23049 i_syssockio='$i_syssockio'
23050 i_sysstat='$i_sysstat'
23051 i_sysstatfs='$i_sysstatfs'
23052 i_sysstatvfs='$i_sysstatvfs'
23053 i_systime='$i_systime'
23054 i_systimek='$i_systimek'
23055 i_systimes='$i_systimes'
23056 i_systypes='$i_systypes'
23057 i_sysuio='$i_sysuio'
23058 i_sysun='$i_sysun'
23059 i_sysutsname='$i_sysutsname'
23060 i_sysvfs='$i_sysvfs'
23061 i_syswait='$i_syswait'
23062 i_termio='$i_termio'
23063 i_termios='$i_termios'
23064 i_time='$i_time'
23065 i_unistd='$i_unistd'
23066 i_ustat='$i_ustat'
23067 i_utime='$i_utime'
23068 i_values='$i_values'
23069 i_varargs='$i_varargs'
23070 i_varhdr='$i_varhdr'
23071 i_vfork='$i_vfork'
23072 ignore_versioned_solibs='$ignore_versioned_solibs'
23073 inc_version_list='$inc_version_list'
23074 inc_version_list_init='$inc_version_list_init'
23075 incpath='$incpath'
23076 inews='$inews'
23077 initialinstalllocation='$initialinstalllocation'
23078 installarchlib='$installarchlib'
23079 installbin='$installbin'
23080 installhtml1dir='$installhtml1dir'
23081 installhtml3dir='$installhtml3dir'
23082 installman1dir='$installman1dir'
23083 installman3dir='$installman3dir'
23084 installprefix='$installprefix'
23085 installprefixexp='$installprefixexp'
23086 installprivlib='$installprivlib'
23087 installscript='$installscript'
23088 installsitearch='$installsitearch'
23089 installsitebin='$installsitebin'
23090 installsitehtml1dir='$installsitehtml1dir'
23091 installsitehtml3dir='$installsitehtml3dir'
23092 installsitelib='$installsitelib'
23093 installsiteman1dir='$installsiteman1dir'
23094 installsiteman3dir='$installsiteman3dir'
23095 installsitescript='$installsitescript'
23096 installstyle='$installstyle'
23097 installusrbinperl='$installusrbinperl'
23098 installvendorarch='$installvendorarch'
23099 installvendorbin='$installvendorbin'
23100 installvendorhtml1dir='$installvendorhtml1dir'
23101 installvendorhtml3dir='$installvendorhtml3dir'
23102 installvendorlib='$installvendorlib'
23103 installvendorman1dir='$installvendorman1dir'
23104 installvendorman3dir='$installvendorman3dir'
23105 installvendorscript='$installvendorscript'
23106 intsize='$intsize'
23107 issymlink='$issymlink'
23108 ivdformat='$ivdformat'
23109 ivsize='$ivsize'
23110 ivtype='$ivtype'
23111 known_extensions='$known_extensions'
23112 ksh='$ksh'
23113 ld='$ld'
23114 lddlflags='$lddlflags'
23115 ldflags='$ldflags'
23116 ldflags_uselargefiles='$ldflags_uselargefiles'
23117 ldlibpthname='$ldlibpthname'
23118 less='$less'
23119 lib_ext='$lib_ext'
23120 libc='$libc'
23121 libperl='$libperl'
23122 libpth='$libpth'
23123 libs='$libs'
23124 libsdirs='$libsdirs'
23125 libsfiles='$libsfiles'
23126 libsfound='$libsfound'
23127 libspath='$libspath'
23128 libswanted='$libswanted'
23129 libswanted_uselargefiles='$libswanted_uselargefiles'
23130 line='$line'
23131 lint='$lint'
23132 lkflags='$lkflags'
23133 ln='$ln'
23134 lns='$lns'
23135 localtime_r_proto='$localtime_r_proto'
23136 locincpth='$locincpth'
23137 loclibpth='$loclibpth'
23138 longdblsize='$longdblsize'
23139 longlongsize='$longlongsize'
23140 longsize='$longsize'
23141 lp='$lp'
23142 lpr='$lpr'
23143 ls='$ls'
23144 lseeksize='$lseeksize'
23145 lseektype='$lseektype'
23146 mad='$mad'
23147 madlyh='$madlyh'
23148 madlyobj='$madlyobj'
23149 madlysrc='$madlysrc'
23150 mail='$mail'
23151 mailx='$mailx'
23152 make='$make'
23153 make_set_make='$make_set_make'
23154 mallocobj='$mallocobj'
23155 mallocsrc='$mallocsrc'
23156 malloctype='$malloctype'
23157 man1dir='$man1dir'
23158 man1direxp='$man1direxp'
23159 man1ext='$man1ext'
23160 man3dir='$man3dir'
23161 man3direxp='$man3direxp'
23162 man3ext='$man3ext'
23163 mips_type='$mips_type'
23164 mistrustnm='$mistrustnm'
23165 mkdir='$mkdir'
23166 mmaptype='$mmaptype'
23167 modetype='$modetype'
23168 more='$more'
23169 multiarch='$multiarch'
23170 mv='$mv'
23171 myarchname='$myarchname'
23172 mydomain='$mydomain'
23173 myhostname='$myhostname'
23174 myuname='$myuname'
23175 n='$n'
23176 need_va_copy='$need_va_copy'
23177 netdb_hlen_type='$netdb_hlen_type'
23178 netdb_host_type='$netdb_host_type'
23179 netdb_name_type='$netdb_name_type'
23180 netdb_net_type='$netdb_net_type'
23181 nm='$nm'
23182 nm_opt='$nm_opt'
23183 nm_so_opt='$nm_so_opt'
23184 nonxs_ext='$nonxs_ext'
23185 nroff='$nroff'
23186 nvEUformat='$nvEUformat'
23187 nvFUformat='$nvFUformat'
23188 nvGUformat='$nvGUformat'
23189 nv_overflows_integers_at='$nv_overflows_integers_at'
23190 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23191 nveformat='$nveformat'
23192 nvfformat='$nvfformat'
23193 nvgformat='$nvgformat'
23194 nvsize='$nvsize'
23195 nvtype='$nvtype'
23196 o_nonblock='$o_nonblock'
23197 obj_ext='$obj_ext'
23198 old_pthread_create_joinable='$old_pthread_create_joinable'
23199 optimize='$optimize'
23200 orderlib='$orderlib'
23201 osname='$osname'
23202 osvers='$osvers'
23203 otherlibdirs='$otherlibdirs'
23204 package='$package'
23205 pager='$pager'
23206 passcat='$passcat'
23207 patchlevel='$patchlevel'
23208 path_sep='$path_sep'
23209 perl5='$perl5'
23210 perl='$perl'
23211 perl_patchlevel='$perl_patchlevel'
23212 perl_static_inline='$perl_static_inline'
23213 perladmin='$perladmin'
23214 perllibs='$perllibs'
23215 perlpath='$perlpath'
23216 pg='$pg'
23217 phostname='$phostname'
23218 pidtype='$pidtype'
23219 plibpth='$plibpth'
23220 pmake='$pmake'
23221 pr='$pr'
23222 prefix='$prefix'
23223 prefixexp='$prefixexp'
23224 privlib='$privlib'
23225 privlibexp='$privlibexp'
23226 procselfexe='$procselfexe'
23227 prototype='$prototype'
23228 ptrsize='$ptrsize'
23229 quadkind='$quadkind'
23230 quadtype='$quadtype'
23231 randbits='$randbits'
23232 randfunc='$randfunc'
23233 random_r_proto='$random_r_proto'
23234 randseedtype='$randseedtype'
23235 ranlib='$ranlib'
23236 rd_nodata='$rd_nodata'
23237 readdir64_r_proto='$readdir64_r_proto'
23238 readdir_r_proto='$readdir_r_proto'
23239 revision='$revision'
23240 rm='$rm'
23241 rm_try='$rm_try'
23242 rmail='$rmail'
23243 run='$run'
23244 runnm='$runnm'
23245 sGMTIME_max='$sGMTIME_max'
23246 sGMTIME_min='$sGMTIME_min'
23247 sLOCALTIME_max='$sLOCALTIME_max'
23248 sLOCALTIME_min='$sLOCALTIME_min'
23249 sPRIEUldbl='$sPRIEUldbl'
23250 sPRIFUldbl='$sPRIFUldbl'
23251 sPRIGUldbl='$sPRIGUldbl'
23252 sPRIXU64='$sPRIXU64'
23253 sPRId64='$sPRId64'
23254 sPRIeldbl='$sPRIeldbl'
23255 sPRIfldbl='$sPRIfldbl'
23256 sPRIgldbl='$sPRIgldbl'
23257 sPRIi64='$sPRIi64'
23258 sPRIo64='$sPRIo64'
23259 sPRIu64='$sPRIu64'
23260 sPRIx64='$sPRIx64'
23261 sSCNfldbl='$sSCNfldbl'
23262 sched_yield='$sched_yield'
23263 scriptdir='$scriptdir'
23264 scriptdirexp='$scriptdirexp'
23265 sed='$sed'
23266 seedfunc='$seedfunc'
23267 selectminbits='$selectminbits'
23268 selecttype='$selecttype'
23269 sendmail='$sendmail'
23270 setgrent_r_proto='$setgrent_r_proto'
23271 sethostent_r_proto='$sethostent_r_proto'
23272 setlocale_r_proto='$setlocale_r_proto'
23273 setnetent_r_proto='$setnetent_r_proto'
23274 setprotoent_r_proto='$setprotoent_r_proto'
23275 setpwent_r_proto='$setpwent_r_proto'
23276 setservent_r_proto='$setservent_r_proto'
23277 sh='$sh'
23278 shar='$shar'
23279 sharpbang='$sharpbang'
23280 shmattype='$shmattype'
23281 shortsize='$shortsize'
23282 shrpenv='$shrpenv'
23283 shsharp='$shsharp'
23284 sig_count='$sig_count'
23285 sig_name='$sig_name'
23286 sig_name_init='$sig_name_init'
23287 sig_num='$sig_num'
23288 sig_num_init='$sig_num_init'
23289 sig_size='$sig_size'
23290 signal_t='$signal_t'
23291 sitearch='$sitearch'
23292 sitearchexp='$sitearchexp'
23293 sitebin='$sitebin'
23294 sitebinexp='$sitebinexp'
23295 sitehtml1dir='$sitehtml1dir'
23296 sitehtml1direxp='$sitehtml1direxp'
23297 sitehtml3dir='$sitehtml3dir'
23298 sitehtml3direxp='$sitehtml3direxp'
23299 sitelib='$sitelib'
23300 sitelib_stem='$sitelib_stem'
23301 sitelibexp='$sitelibexp'
23302 siteman1dir='$siteman1dir'
23303 siteman1direxp='$siteman1direxp'
23304 siteman3dir='$siteman3dir'
23305 siteman3direxp='$siteman3direxp'
23306 siteprefix='$siteprefix'
23307 siteprefixexp='$siteprefixexp'
23308 sitescript='$sitescript'
23309 sitescriptexp='$sitescriptexp'
23310 sizesize='$sizesize'
23311 sizetype='$sizetype'
23312 sleep='$sleep'
23313 smail='$smail'
23314 so='$so'
23315 sockethdr='$sockethdr'
23316 socketlib='$socketlib'
23317 socksizetype='$socksizetype'
23318 sort='$sort'
23319 spackage='$spackage'
23320 spitshell='$spitshell'
23321 srand48_r_proto='$srand48_r_proto'
23322 srandom_r_proto='$srandom_r_proto'
23323 src='$src'
23324 ssizetype='$ssizetype'
23325 startperl='$startperl'
23326 startsh='$startsh'
23327 static_ext='$static_ext'
23328 stdchar='$stdchar'
23329 stdio_base='$stdio_base'
23330 stdio_bufsiz='$stdio_bufsiz'
23331 stdio_cnt='$stdio_cnt'
23332 stdio_filbuf='$stdio_filbuf'
23333 stdio_ptr='$stdio_ptr'
23334 stdio_stream_array='$stdio_stream_array'
23335 strerror_r_proto='$strerror_r_proto'
23336 strings='$strings'
23337 submit='$submit'
23338 subversion='$subversion'
23339 sysman='$sysman'
23340 tail='$tail'
23341 tar='$tar'
23342 targetarch='$targetarch'
23343 tbl='$tbl'
23344 tee='$tee'
23345 test='$test'
23346 timeincl='$timeincl'
23347 timetype='$timetype'
23348 tmpnam_r_proto='$tmpnam_r_proto'
23349 to='$to'
23350 touch='$touch'
23351 tr='$tr'
23352 trnl='$trnl'
23353 troff='$troff'
23354 ttyname_r_proto='$ttyname_r_proto'
23355 u16size='$u16size'
23356 u16type='$u16type'
23357 u32size='$u32size'
23358 u32type='$u32type'
23359 u64size='$u64size'
23360 u64type='$u64type'
23361 u8size='$u8size'
23362 u8type='$u8type'
23363 uidformat='$uidformat'
23364 uidsign='$uidsign'
23365 uidsize='$uidsize'
23366 uidtype='$uidtype'
23367 uname='$uname'
23368 uniq='$uniq'
23369 uquadtype='$uquadtype'
23370 use5005threads='$use5005threads'
23371 use64bitall='$use64bitall'
23372 use64bitint='$use64bitint'
23373 usecrosscompile='$usecrosscompile'
23374 usedevel='$usedevel'
23375 usedl='$usedl'
23376 usedtrace='$usedtrace'
23377 usefaststdio='$usefaststdio'
23378 useithreads='$useithreads'
23379 uselargefiles='$uselargefiles'
23380 uselongdouble='$uselongdouble'
23381 usemallocwrap='$usemallocwrap'
23382 usemorebits='$usemorebits'
23383 usemultiplicity='$usemultiplicity'
23384 usemymalloc='$usemymalloc'
23385 usenm='$usenm'
23386 useopcode='$useopcode'
23387 useperlio='$useperlio'
23388 useposix='$useposix'
23389 usereentrant='$usereentrant'
23390 userelocatableinc='$userelocatableinc'
23391 usesfio='$usesfio'
23392 useshrplib='$useshrplib'
23393 usesitecustomize='$usesitecustomize'
23394 usesocks='$usesocks'
23395 usethreads='$usethreads'
23396 usevendorprefix='$usevendorprefix'
23397 usevfork='$usevfork'
23398 usrinc='$usrinc'
23399 uuname='$uuname'
23400 uvXUformat='$uvXUformat'
23401 uvoformat='$uvoformat'
23402 uvsize='$uvsize'
23403 uvtype='$uvtype'
23404 uvuformat='$uvuformat'
23405 uvxformat='$uvxformat'
23406 vaproto='$vaproto'
23407 vendorarch='$vendorarch'
23408 vendorarchexp='$vendorarchexp'
23409 vendorbin='$vendorbin'
23410 vendorbinexp='$vendorbinexp'
23411 vendorhtml1dir='$vendorhtml1dir'
23412 vendorhtml1direxp='$vendorhtml1direxp'
23413 vendorhtml3dir='$vendorhtml3dir'
23414 vendorhtml3direxp='$vendorhtml3direxp'
23415 vendorlib='$vendorlib'
23416 vendorlib_stem='$vendorlib_stem'
23417 vendorlibexp='$vendorlibexp'
23418 vendorman1dir='$vendorman1dir'
23419 vendorman1direxp='$vendorman1direxp'
23420 vendorman3dir='$vendorman3dir'
23421 vendorman3direxp='$vendorman3direxp'
23422 vendorprefix='$vendorprefix'
23423 vendorprefixexp='$vendorprefixexp'
23424 vendorscript='$vendorscript'
23425 vendorscriptexp='$vendorscriptexp'
23426 version='$version'
23427 version_patchlevel_string='$version_patchlevel_string'
23428 versiononly='$versiononly'
23429 vi='$vi'
23430 voidflags='$voidflags'
23431 xlibpth='$xlibpth'
23432 yacc='$yacc'
23433 yaccflags='$yaccflags'
23434 zcat='$zcat'
23435 zip='$zip'
23436 EOT
23437
23438 : add special variables
23439 $test -f $src/patchlevel.h && \
23440 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23441 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23442 echo "PERL_CONFIG_SH=true" >>config.sh
23443
23444 : propagate old symbols
23445 if $test -f UU/config.sh; then
23446         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23447         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23448                 config.sh config.sh UU/oldconfig.sh |\
23449                 $sort | $uniq -u >UU/oldsyms
23450         set X `cat UU/oldsyms`
23451         shift
23452         case $# in
23453         0) ;;
23454         *)
23455                 cat <<EOM
23456 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23457 EOM
23458                 echo ": Variables propagated from previous config.sh file." >>config.sh
23459                 for sym in `cat UU/oldsyms`; do
23460                         echo "    Propagating $hint variable "'$'"$sym..."
23461                         eval 'tmp="$'"${sym}"'"'
23462                         echo "$tmp" | \
23463                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23464                 done
23465                 ;;
23466         esac
23467 fi
23468
23469 : Finish up by extracting the .SH files
23470 case "$alldone" in
23471 exit)
23472         $rm -rf UU
23473         echo "Extraction done."
23474         exit 0
23475         ;;
23476 cont)
23477         ;;
23478 '')
23479         dflt=''
23480         nostick=true
23481         $cat <<EOM
23482
23483 If you'd like to make any changes to the config.sh file before I begin
23484 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23485
23486 EOM
23487         rp="Press return or use a shell escape to edit config.sh:"
23488         . UU/myread
23489         nostick=''
23490         case "$ans" in
23491         '') ;;
23492         *) : in case they cannot read
23493                 sh 1>&4 -c "$ans";;
23494         esac
23495         ;;
23496 esac
23497
23498 : if this fails, just run all the .SH files by hand
23499 . ./config.sh
23500
23501 echo " "
23502 exec 1>&4
23503 pwd=`pwd`
23504 . ./UU/extract
23505 cd "$pwd"
23506
23507 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23508         dflt=y
23509         case "$silent" in
23510         true) ;;
23511         *)
23512                 $cat <<EOM
23513
23514 Now you need to generate make dependencies by running "$make depend".
23515 You might prefer to run it in background: "$make depend > makedepend.out &"
23516 It can take a while, so you might not want to run it right now.
23517
23518 EOM
23519                 ;;
23520         esac
23521         rp="Run $make depend now?"
23522         . UU/myread
23523         case "$ans" in
23524         y*)
23525                 $make depend && echo "Now you must run '$make'."
23526                 ;;
23527         *)
23528                 echo "You must run '$make depend' then '$make'."
23529                 ;;
23530         esac
23531 elif test -f [Mm]akefile; then
23532         echo " "
23533         echo "Now you must run a $make."
23534 else
23535         echo "Configure done."
23536 fi
23537
23538 if $test -f Policy.sh; then
23539     $cat <<EOM
23540
23541 If you compile $package on a different machine or from a different object
23542 directory, copy the Policy.sh file from this object directory to the
23543 new one before you run Configure -- this will help you with most of
23544 the policy defaults.
23545
23546 EOM
23547 fi
23548 if $test -f config.msg; then
23549     echo "Hmm.  I also noted the following information while running:"
23550     echo " "
23551     $cat config.msg >&4
23552     $rm -f config.msg
23553 fi
23554 $rm -f kit*isdone ark*isdone
23555 $rm -rf UU
23556
23557 : End of Configure
23558