This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add Abigail as a release manager
[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 # Generated on Mon Feb 14 23:00:18 CET 2011 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isfinite=''
569 d_isinf=''
570 d_isnan=''
571 d_isnanl=''
572 d_killpg=''
573 d_lchown=''
574 d_ldbl_dig=''
575 d_libm_lib_version=''
576 d_link=''
577 d_localtime_r=''
578 d_localtime_r_needs_tzset=''
579 localtime_r_proto=''
580 d_locconv=''
581 d_lockf=''
582 d_longdbl=''
583 longdblsize=''
584 d_longlong=''
585 longlongsize=''
586 d_lseekproto=''
587 d_lstat=''
588 d_madvise=''
589 d_malloc_good_size=''
590 d_malloc_size=''
591 d_mblen=''
592 d_mbstowcs=''
593 d_mbtowc=''
594 d_memchr=''
595 d_memcmp=''
596 d_memcpy=''
597 d_memmove=''
598 d_memset=''
599 d_mkdir=''
600 d_mkdtemp=''
601 d_mkfifo=''
602 d_mkstemp=''
603 d_mkstemps=''
604 d_mktime=''
605 d_mmap=''
606 mmaptype=''
607 d_modfl=''
608 d_modfl_pow32_bug=''
609 d_modflproto=''
610 d_mprotect=''
611 d_msg=''
612 d_msgctl=''
613 d_msgget=''
614 d_msghdr_s=''
615 d_msgrcv=''
616 d_msgsnd=''
617 d_msync=''
618 d_munmap=''
619 d_nice=''
620 d_nl_langinfo=''
621 d_off64_t=''
622 d_open3=''
623 d_fpathconf=''
624 d_pathconf=''
625 d_pause=''
626 d_pipe=''
627 d_poll=''
628 d_portable=''
629 d_prctl=''
630 d_prctl_set_name=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_sin6_scope_id=''
733 d_sockaddr_sa_len=''
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 archname=''
1312 : Possible local include directories to search.
1313 : Set locincpth to "" in a hint file to defeat local include searches.
1314 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1315 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1316 :
1317 : no include file wanted by default
1318 inclwanted=''
1319
1320 : Enable -DEBUGGING and -DDEBUGGING from the command line
1321 EBUGGING=''
1322 DEBUGGING=''
1323
1324 : set usethreads on the Configure command line to enable threads.
1325 usereentrant='undef'
1326 : Trailing extension.  Override this in a hint file, if needed.
1327 : Extra object files, if any, needed on this platform.
1328 archobjs=''
1329 libnames=''
1330 : change the next line if compiling for Xenix/286 on Xenix/386
1331 xlibpth='/usr/lib/386 /lib/386'
1332 : Possible local library directories to search.
1333 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1334 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1335
1336 : general looking path for locating libraries
1337 glibpth="/lib /usr/lib $xlibpth"
1338 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1339 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1340 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1341 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1342
1343 : Private path used by Configure to find libraries.  Its value
1344 : is prepended to libpth. This variable takes care of special
1345 : machines, like the mips.  Usually, it should be empty.
1346 plibpth=''
1347
1348 : default library list
1349 libswanted=''
1350 : some systems want to use only the non-versioned libso:s
1351 ignore_versioned_solibs=''
1352 : full support for void wanted by default
1353 defvoidused=15
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 Every time 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 perl
2377 pg
2378 test
2379 uname
2380 zip
2381 "
2382 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2383 pth="$pth /lib /usr/lib"
2384 for file in $loclist; do
2385         eval xxx=\$$file
2386         case "$xxx" in
2387         /*|?:[\\/]*)
2388                 if test -f "$xxx"; then
2389                         : ok
2390                 else
2391                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2392                         xxx=`./loc $file $file $pth`
2393                 fi
2394                 ;;
2395         '') xxx=`./loc $file $file $pth`;;
2396         *) xxx=`./loc $xxx $xxx $pth`;;
2397         esac
2398         eval $file=$xxx$_exe
2399         eval _$file=$xxx
2400         case "$xxx" in
2401         /*)
2402                 echo $file is in $xxx.
2403                 ;;
2404         ?:[\\/]*)
2405                 echo $file is in $xxx.
2406                 ;;
2407         *)
2408                 echo "I don't know where '$file' is, and my life depends on it." >&4
2409                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2410                 exit 1
2411                 ;;
2412         esac
2413 done
2414 echo " "
2415 echo "Don't worry if any of the following aren't found..."
2416 say=offhand
2417 for file in $trylist; do
2418         eval xxx=\$$file
2419         case "$xxx" in
2420         /*|?:[\\/]*)
2421                 if test -f "$xxx"; then
2422                         : ok
2423                 else
2424                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2425                         xxx=`./loc $file $file $pth`
2426                 fi
2427                 ;;
2428         '') xxx=`./loc $file $file $pth`;;
2429         *) xxx=`./loc $xxx $xxx $pth`;;
2430         esac
2431         eval $file=$xxx$_exe
2432         eval _$file=$xxx
2433         case "$xxx" in
2434         /*)
2435                 echo $file is in $xxx.
2436                 ;;
2437         ?:[\\/]*)
2438                 echo $file is in $xxx.
2439                 ;;
2440         *)
2441                 echo "I don't see $file out there, $say."
2442                 say=either
2443                 ;;
2444         esac
2445 done
2446 case "$egrep" in
2447 egrep)
2448         echo "Substituting grep for egrep."
2449         egrep=$grep
2450         _egrep=$grep
2451         ;;
2452 esac
2453 case "$less" in
2454 '')     ;;
2455 *)      if $less -R </dev/null >/dev/null; then
2456                echo "Substituting less -R for less."
2457                less="$less -R"
2458                _less=$less
2459         fi
2460         ;;
2461 esac
2462 case "$ln" in
2463 ln)
2464         echo "Substituting cp for ln."
2465         ln=$cp
2466         _ln=$cp
2467         ;;
2468 esac
2469 case "$make" in
2470 make)
2471         case "$gmake" in
2472         gmake)
2473         echo "I can't find make or gmake, and my life depends on it." >&4
2474         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2475         exit 1
2476         ;;
2477         esac
2478         ;;
2479 esac
2480 case "$gmake" in
2481 gmake)  ;;
2482 *)      # We can't have osname yet.
2483         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2484                 # Assume that gmake, if found, is definitely GNU make
2485                 # and prefer it over the system make.
2486                 echo "Substituting gmake for make."
2487                 make=$gmake
2488                 _make=$gmake
2489         fi
2490         ;;
2491 esac
2492 case "$test" in
2493 test)
2494         echo "Hopefully test is built into your sh."
2495         ;;
2496 *)
2497         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2498                 echo "Using the test built into your sh."
2499                 test=test
2500                 _test=test
2501         fi
2502         ;;
2503 esac
2504 case "$echo" in
2505 echo)
2506         echo "Hopefully echo is built into your sh."
2507         ;;
2508 '') ;;
2509 *)
2510         echo " "
2511 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2512         $echo $n "hi there$c" >foo1
2513         echo $n "hi there$c" >foo2
2514         if cmp foo1 foo2 >/dev/null 2>&1; then
2515                 echo "They are compatible.  In fact, they may be identical."
2516         else
2517                 case "$n" in
2518                 '-n') n='' c='\c';;
2519                 *) n='-n' c='';;
2520                 esac
2521                 cat <<FOO
2522 They are not compatible!  You are probably running ksh on a non-USG system.
2523 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2524 have echo built in and we may have to run some Bourne shell scripts.  That
2525 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2526
2527 FOO
2528                 $echo $n "The star should be here-->$c"
2529                 $echo "*"
2530         fi
2531         $rm -f foo1 foo2
2532         ;;
2533 esac
2534
2535 # This question was auctioned at YAPC::Europe-2007 in Vienna
2536 # I never promised you could answer it. I only auctioned the question.
2537 cat <<FOO
2538 The following message is sponsored by
2539
2540   Dresden.pm<--The stars should be here.
2541
2542 Dear Perl user, system administrator or package
2543 maintainer, the Perl community sends greetings to
2544 you. Do you (emblematical) greet back [Y/n]? n
2545
2546 FOO
2547
2548 : Check what type of C compiler we use
2549 cat <<EOS >trygcc
2550 $startsh
2551 EOS
2552 cat <<'EOSC' >>trygcc
2553 case "$cc" in
2554 '') ;;
2555 *)  $rm -f try try.*
2556     $cat >try.c <<EOM
2557 int main(int argc, char *argv[]) {
2558   return 0;
2559 }
2560 EOM
2561     if $cc -o try $ccflags $ldflags try.c; then
2562        :
2563     else
2564         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2565         despair=yes
2566         trygcc=yes
2567         case "$cc" in
2568         *gcc*) trygcc=no ;;
2569         esac
2570         # Skip this test because it gives a false match on output like:
2571         #    ./trygcc: line 23: cc: command not found
2572         # case "`$cc -v -c try.c 2>&1`" in
2573         # *gcc*) trygcc=no ;;
2574         # esac
2575         if $test X"$trygcc" = Xyes; then
2576             if gcc -o try -c try.c; then
2577                 echo " "
2578                 echo "You seem to have a working gcc, though." >&4
2579                 # Switching compilers may undo the work of hints files.
2580                 # The most common problem is -D_REENTRANT for threads.
2581                 # This heuristic catches that case, but gets false positives
2582                 # if -Dusethreads was not actually specified.  Better to
2583                 # bail out here with a useful message than fail 
2584                 # mysteriously later. Should we perhaps just try to
2585                 # re-invoke Configure -Dcc=gcc config_args ?
2586                 if $test -f usethreads.cbu; then
2587                         $cat >&4 <<EOM 
2588
2589 *** However, any setting of the C compiler flags (e.g. for thread support)
2590 *** will be lost.  It may be necessary for you to restart Configure and
2591 *** add -Dcc=gcc to your Configure command line.
2592
2593 EOM
2594                         rp="Would you like to go ahead and try gcc anyway?"
2595                         dflt=n
2596                 else
2597                         rp="Would you like to use it?"
2598                         dflt=y
2599                 fi
2600                 if $test -f myread; then
2601                     . ./myread
2602                 else
2603                     if $test -f UU/myread; then
2604                         . ./UU/myread
2605                     else
2606                         echo "Cannot find myread, sorry.  Aborting." >&2
2607                         exit 1
2608                     fi
2609                 fi  
2610                 case "$ans" in
2611                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2612                 esac
2613             fi
2614         fi
2615     fi
2616     $rm -f try try.*
2617     ;;
2618 esac
2619 EOSC
2620
2621 cat <<EOS >checkcc
2622 $startsh
2623 EOS
2624 cat <<'EOSC' >>checkcc
2625 case "$cc" in        
2626 '') ;;
2627 *)  $rm -f try try.*              
2628     $cat >try.c <<EOM
2629 int main(int argc, char *argv[]) {
2630   return 0;
2631 }
2632 EOM
2633     if $cc -o try $ccflags $ldflags try.c; then
2634        :
2635     else
2636         if $test X"$despair" = Xyes; then
2637            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2638         fi
2639         $cat >&4 <<EOM         
2640 You need to find a working C compiler.
2641 Either (purchase and) install the C compiler supplied by your OS vendor,
2642 or for a free C compiler try http://gcc.gnu.org/
2643 I cannot continue any further, aborting.
2644 EOM
2645         exit 1
2646     fi
2647     $rm -f try try.*
2648     ;;
2649 esac
2650 EOSC
2651
2652 : determine whether symbolic links are supported
2653 echo " "
2654 $touch blurfl
2655 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2656         echo "Symbolic links are supported." >&4
2657         lns="$ln -s"
2658 else
2659         echo "Symbolic links are NOT supported." >&4
2660         lns="$ln"
2661 fi
2662 $rm -f blurfl sym
2663
2664 : determine whether symbolic links are supported
2665 echo " "
2666 case "$lns" in
2667 *"ln"*" -s")
2668         echo "Checking how to test for symbolic links..." >&4
2669         $lns blurfl sym
2670         if $test "X$issymlink" = X; then
2671                 case "$newsh" in
2672                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2674                 esac
2675                 if test $? = 0; then
2676                         issymlink="test -h"
2677                 else
2678                         echo "Your builtin 'test -h' may be broken." >&4
2679                         case "$test" in
2680                         /*)     ;;
2681                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2682                                 for p in $pth
2683                                 do
2684                                         if test -f "$p/$test"; then
2685                                                 test="$p/$test"
2686                                                 break
2687                                         fi
2688                                 done
2689                                 ;;
2690                         esac
2691                         case "$test" in
2692                         /*)
2693                                 echo "Trying external '$test -h'." >&4
2694                                 issymlink="$test -h"
2695                                 if $test ! -h sym >/dev/null 2>&1; then
2696                                         echo "External '$test -h' is broken, too." >&4
2697                                         issymlink=''
2698                                 fi
2699                                 ;;
2700                         *)      issymlink='' ;;
2701                         esac
2702                 fi              
2703         fi
2704         if $test "X$issymlink" = X; then
2705                 if $test -L sym 2>/dev/null; then
2706                         issymlink="$test -L"
2707                         echo "The builtin '$test -L' worked." >&4
2708                 fi
2709         fi
2710         if $test "X$issymlink" != X; then
2711                 echo "You can test for symbolic links with '$issymlink'." >&4
2712         else
2713                 echo "I do not know how you can test for symbolic links." >&4
2714         fi
2715         $rm -f blurfl sym
2716         ;;
2717 *)      echo "No symbolic links, so not testing for their testing..." >&4
2718         ;;
2719 esac
2720 echo " "
2721
2722 : Make symlinks util
2723 case "$mksymlinks" in
2724 $define|true|[yY]*)
2725         case "$src" in
2726         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2727                 exit 1
2728                 ;;
2729         *)      case "$lns:$issymlink" in
2730                 *"ln"*" -s:"*"test -"?)
2731                         echo "Creating the symbolic links..." >&4
2732                         echo "(First creating the subdirectories...)" >&4
2733                         cd ..
2734                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2735                                 read directory
2736                                 test -z "$directory" && break
2737                                 mkdir -p $directory
2738                         done
2739                         # Sanity check 1.
2740                         if test ! -d t/base; then
2741                                 echo "Failed to create the subdirectories.  Aborting." >&4
2742                                 exit 1
2743                         fi
2744                         echo "(Then creating the symlinks...)" >&4
2745                         awk '{print $1}' $src/MANIFEST | while true; do
2746                                 read filename
2747                                 test -z "$filename" && break
2748                                 if test -f $filename; then
2749                                         if $issymlink $filename; then
2750                                                 rm -f $filename
2751                                         fi
2752                                 fi
2753                                 if test -f $filename; then
2754                                         echo "$filename already exists, not symlinking."
2755                                 else
2756                                         ln -s $src/$filename $filename
2757                                 fi
2758                         done
2759                         # Sanity check 2.
2760                         if test ! -f t/base/lex.t; then
2761                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2762                                 exit 1
2763                         fi
2764                         cd UU
2765                         ;;
2766                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2767                         ;;
2768                 esac
2769                 ;;
2770         esac
2771         ;;
2772 esac
2773
2774 : Check for Cross-Compilation
2775 case "$usecrosscompile" in
2776 $define|true|[yY]*)
2777         $echo "Cross-compiling..."
2778         croak=''
2779         case "$cc" in
2780         *-*-gcc) # A cross-compiling gcc, probably.
2781             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2782             ar=$targetarch-ar
2783             # leave out ld, choosing it is more complex
2784             nm=$targetarch-nm
2785             ranlib=$targetarch-ranlib
2786             $echo 'extern int foo;' > try.c
2787             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2788             shift
2789             if $test $# -gt 0; then
2790                 incpth="$incpth $*"
2791                 incpth="`$echo $incpth|$sed 's/^ //'`"
2792                 echo "Guessing incpth '$incpth'." >&4
2793                 for i in $*; do
2794                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2795                     if $test -d $j; then
2796                         libpth="$libpth $j"
2797                     fi
2798                 done   
2799                 libpth="`$echo $libpth|$sed 's/^ //'`"
2800                 echo "Guessing libpth '$libpth'." >&4
2801             fi
2802             $rm -f try.c
2803             ;;
2804         esac
2805         case "$targetarch" in
2806         '') echo "Targetarch not defined." >&4; croak=y ;;
2807         *)  echo "Using targetarch $targetarch." >&4 ;;
2808         esac
2809         case "$incpth" in
2810         '') echo "Incpth not defined." >&4; croak=y ;;
2811         *)  echo "Using incpth '$incpth'." >&4 ;;
2812         esac
2813         case "$libpth" in
2814         '') echo "Libpth not defined." >&4; croak=y ;;
2815         *)  echo "Using libpth '$libpth'." >&4 ;;
2816         esac
2817         case "$usrinc" in
2818         '') for i in $incpth; do
2819                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2820                     usrinc=$i
2821                     echo "Guessing usrinc $usrinc." >&4
2822                     break
2823                 fi
2824             done
2825             case "$usrinc" in
2826             '') echo "Usrinc not defined." >&4; croak=y ;;
2827             esac
2828             ;;
2829         *)  echo "Using usrinc $usrinc." >&4 ;;
2830         esac
2831         case "$targethost" in
2832         '') echo "Targethost not defined." >&4; croak=y ;;
2833         *)  echo "Using targethost $targethost." >&4
2834         esac
2835         locincpth=' '
2836         loclibpth=' '
2837         case "$croak" in
2838         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2839         esac
2840         case "$src" in
2841         /*) run=$src/Cross/run
2842             targetmkdir=$src/Cross/mkdir
2843             to=$src/Cross/to
2844             from=$src/Cross/from
2845             ;;
2846         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2847             run=$pwd/Cross/run
2848             targetmkdir=$pwd/Cross/mkdir
2849             to=$pwd/Cross/to
2850             from=$pwd/Cross/from
2851             ;;
2852         esac
2853         case "$targetrun" in
2854         '') targetrun=ssh ;;
2855         esac
2856         case "$targetto" in
2857         '') targetto=scp ;;
2858         esac
2859         case "$targetfrom" in
2860         '') targetfrom=scp ;;
2861         esac
2862         run=$run-$targetrun
2863         to=$to-$targetto
2864         from=$from-$targetfrom
2865         case "$targetdir" in
2866         '')  targetdir=/tmp
2867              echo "Guessing targetdir $targetdir." >&4
2868              ;;
2869         esac
2870         case "$targetuser" in
2871         '')  targetuser=root
2872              echo "Guessing targetuser $targetuser." >&4
2873              ;;
2874         esac
2875         case "$targetfrom" in
2876         scp)    q=-q ;;
2877         *)      q='' ;;
2878         esac
2879         case "$targetrun" in
2880         ssh|rsh)
2881             cat >$run <<EOF
2882 #!/bin/sh
2883 case "\$1" in
2884 -cwd)
2885   shift
2886   cwd=\$1
2887   shift
2888   ;;
2889 esac
2890 case "\$cwd" in
2891 '') cwd=$targetdir ;;
2892 esac
2893 exe=\$1
2894 shift
2895 if $test ! -f \$exe.xok; then
2896   $to \$exe
2897   $touch \$exe.xok
2898 fi
2899 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2900 EOF
2901             ;;
2902         *)  echo "Unknown targetrun '$targetrun'" >&4
2903             exit 1
2904             ;;
2905         esac
2906         case "$targetmkdir" in
2907         */Cross/mkdir)
2908             cat >$targetmkdir <<EOF
2909 #!/bin/sh
2910 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2911 EOF
2912             $chmod a+rx $targetmkdir
2913             ;;
2914         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2915             exit 1
2916             ;;
2917         esac
2918         case "$targetto" in
2919         scp|rcp)
2920             cat >$to <<EOF
2921 #!/bin/sh
2922 for f in \$@
2923 do
2924   case "\$f" in
2925   /*)
2926     $targetmkdir \`dirname \$f\`
2927     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2928     ;;
2929   *)
2930     $targetmkdir $targetdir/\`dirname \$f\`
2931     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2932     ;;
2933   esac
2934 done
2935 exit 0
2936 EOF
2937             ;;
2938         cp) cat >$to <<EOF
2939 #!/bin/sh
2940 for f in \$@
2941 do
2942   case "\$f" in
2943   /*)
2944     $mkdir -p $targetdir/\`dirname \$f\`
2945     $cp \$f $targetdir/\$f || exit 1
2946     ;;
2947   *)
2948     $targetmkdir $targetdir/\`dirname \$f\`
2949     $cp \$f $targetdir/\$f || exit 1
2950     ;;
2951   esac
2952 done
2953 exit 0
2954 EOF
2955             ;;
2956         *)  echo "Unknown targetto '$targetto'" >&4
2957             exit 1
2958             ;;
2959         esac
2960         case "$targetfrom" in
2961         scp|rcp)
2962           cat >$from <<EOF
2963 #!/bin/sh
2964 for f in \$@
2965 do
2966   $rm -f \$f
2967   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2968 done
2969 exit 0
2970 EOF
2971             ;;
2972         cp) cat >$from <<EOF
2973 #!/bin/sh
2974 for f in \$@
2975 do
2976   $rm -f \$f
2977   cp $targetdir/\$f . || exit 1
2978 done
2979 exit 0
2980 EOF
2981             ;;
2982         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2983             exit 1
2984             ;;
2985         esac
2986         if $test ! -f $run; then
2987             echo "Target 'run' script '$run' not found." >&4
2988         else
2989             $chmod a+rx $run
2990         fi
2991         if $test ! -f $to; then
2992             echo "Target 'to' script '$to' not found." >&4
2993         else
2994             $chmod a+rx $to
2995         fi
2996         if $test ! -f $from; then
2997             echo "Target 'from' script '$from' not found." >&4
2998         else
2999             $chmod a+rx $from
3000         fi
3001         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3002             exit 1
3003         fi
3004         cat >&4 <<EOF
3005 Using '$run' for remote execution,
3006 and '$from' and '$to'
3007 for remote file transfer.
3008 EOF
3009         ;;
3010 *)      run=''
3011         to=:
3012         from=:
3013         usecrosscompile='undef'
3014         targetarch=''
3015         ;;
3016 esac
3017
3018 : see whether [:lower:] and [:upper:] are supported character classes
3019 echo " "
3020 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3021 ABYZ)
3022         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3023         up='[:upper:]'
3024         low='[:lower:]'
3025         ;;
3026 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3027         # (0xd9 and 0xe2), therefore that is a nice testing point.
3028         if test "X$up" = X -o "X$low" = X; then
3029             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3030             rs) up='[A-Z]'
3031                 low='[a-z]'
3032                 ;;
3033             esac
3034         fi
3035         if test "X$up" = X -o "X$low" = X; then
3036             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3037             rs) up='A-Z'
3038                 low='a-z'
3039                 ;;
3040             esac
3041         fi
3042         if test "X$up" = X -o "X$low" = X; then
3043             case "`echo RS | od -x 2>/dev/null`" in
3044             *D9E2*|*d9e2*)
3045                 echo "Hey, this might be EBCDIC." >&4
3046                 if test "X$up" = X -o "X$low" = X; then
3047                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3048                     rs) up='[A-IJ-RS-Z]'
3049                         low='[a-ij-rs-z]'
3050                         ;;
3051                     esac
3052                 fi
3053                 if test "X$up" = X -o "X$low" = X; then
3054                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3055                     rs) up='A-IJ-RS-Z'
3056                         low='a-ij-rs-z'
3057                         ;;
3058                     esac
3059                 fi
3060                 ;;
3061             esac
3062         fi
3063 esac
3064 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3065 rs)
3066     echo "Using $up and $low to convert case." >&4
3067     ;;
3068 *)
3069     echo "I don't know how to translate letters from upper to lower case." >&4
3070     echo "Your tr is not acting any way I know of." >&4
3071     exit 1
3072     ;;
3073 esac
3074 : set up the translation script tr, must be called with ./tr of course
3075 cat >tr <<EOSC
3076 $startsh
3077 case "\$1\$2" in
3078 '[A-Z][a-z]') exec $tr '$up' '$low';;
3079 '[a-z][A-Z]') exec $tr '$low' '$up';;
3080 esac
3081 exec $tr "\$@"
3082 EOSC
3083 chmod +x tr
3084 $eunicefix tr
3085
3086 : Try to determine whether config.sh was made on this system
3087 case "$config_sh" in
3088 '')
3089 myuname=`$uname -a 2>/dev/null`
3090 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3091 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3092 # because the A-Z/a-z are not consecutive.
3093 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3094         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3095 newmyuname="$myuname"
3096 dflt=n
3097 case "$knowitall" in
3098 '')
3099         if test -f ../config.sh; then
3100                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3101                         eval "`grep myuname= ../config.sh`"
3102                 fi
3103                 if test "X$myuname" = "X$newmyuname"; then
3104                         dflt=y
3105                 fi
3106         fi
3107         ;;
3108 *) dflt=y;;
3109 esac
3110
3111 : Get old answers from old config file if Configure was run on the
3112 : same system, otherwise use the hints.
3113 hint=default
3114 cd ..
3115 if test -f config.sh; then
3116         echo " "
3117         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3118         . UU/myread
3119         case "$ans" in
3120         n*|N*) echo "OK, I'll ignore it."
3121                 mv config.sh config.sh.old
3122                 myuname="$newmyuname"
3123                 ;;
3124         *)  echo "Fetching default answers from your old config.sh file..." >&4
3125                 tmp_n="$n"
3126                 tmp_c="$c"
3127                 tmp_sh="$sh"
3128                 . ./config.sh
3129                 cp config.sh UU
3130                 n="$tmp_n"
3131                 c="$tmp_c"
3132                 : Older versions did not always set $sh.  Catch re-use of such
3133                 : an old config.sh.
3134                 case "$sh" in
3135                 '') sh="$tmp_sh" ;;
3136                 esac
3137                 hint=previous
3138                 ;;
3139         esac
3140 fi
3141 . ./UU/checkcc
3142 if test ! -f config.sh; then
3143         $cat <<EOM
3144
3145 First time through, eh?  I have some defaults handy for some systems
3146 that need some extra help getting the Configure answers right:
3147
3148 EOM
3149         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3150         dflt=''
3151         : Half the following guesses are probably wrong... If you have better
3152         : tests or hints, please send them to perlbug@perl.org
3153         : The metaconfig authors would also appreciate a copy...
3154         $test -f /irix && osname=irix
3155         $test -f /xenix && osname=sco_xenix
3156         $test -f /dynix && osname=dynix
3157         $test -f /dnix && osname=dnix
3158         $test -f /lynx.os && osname=lynxos
3159         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3160         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3161         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3162         $test -f /bin/mips && /bin/mips && osname=mips
3163         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3164                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3165         $test -d /usr/apollo/bin && osname=apollo
3166         $test -f /etc/saf/_sactab && osname=svr4
3167         $test -d /usr/include/minix && osname=minix
3168         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3169         if $test -d /MachTen -o -d /MachTen_Folder; then
3170                 osname=machten
3171                 if $test -x /sbin/version; then
3172                         osvers=`/sbin/version | $awk '{print $2}' |
3173                         $sed -e 's/[A-Za-z]$//'`
3174                 elif $test -x /usr/etc/version; then
3175                         osvers=`/usr/etc/version | $awk '{print $2}' |
3176                         $sed -e 's/[A-Za-z]$//'`
3177                 else
3178                         osvers="$2.$3"
3179                 fi
3180         fi
3181
3182         $test -f /sys/posix.dll &&
3183                 $test -f /usr/bin/what &&
3184                 set X `/usr/bin/what /sys/posix.dll` &&
3185                 $test "$3" = UWIN &&
3186                 osname=uwin &&
3187                 osvers="$5"
3188
3189         if $test -f $uname; then
3190                 set X $myuname
3191                 shift
3192
3193                 case "$5" in
3194                 fps*) osname=fps ;;
3195                 mips*)
3196                         case "$4" in
3197                         umips) osname=umips ;;
3198                         *) osname=mips ;;
3199                         esac;;
3200                 [23]100) osname=mips ;;
3201                 next*) osname=next ;;
3202                 i386*)
3203                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3204                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3205                                 osname='sco'
3206                                 osvers=$tmp
3207                         elif $test -f /etc/kconfig; then
3208                                 osname=isc
3209                                 if test "$lns" = "$ln -s"; then
3210                                         osvers=4
3211                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3212                                         osvers=3
3213                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3214                                         osvers=2
3215                                 fi
3216                         fi
3217                         tmp=''
3218                         ;;
3219                 pc*)
3220                         if test -n "$DJGPP"; then
3221                                 osname=dos
3222                                 osvers=djgpp
3223                         fi
3224                         ;;
3225                 esac
3226
3227                 case "$1" in
3228                 aix) osname=aix
3229                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3230                         case "$tmp" in
3231                         # oslevel can fail with:
3232                         # oslevel: Unable to acquire lock.
3233                         *not\ found) osvers="$4"."$3" ;;
3234                         '<3240'|'<>3240') osvers=3.2.0 ;;
3235                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3236                         '=3250'|'>3250') osvers=3.2.5 ;;
3237                         *) osvers=$tmp;;
3238                         esac
3239                         ;;
3240                 bsd386) osname=bsd386
3241                         osvers=`$uname -r`
3242                         ;;
3243                 cygwin*) osname=cygwin
3244                         osvers="$3"
3245                         ;;
3246                 *dc.osx) osname=dcosx
3247                         osvers="$3"
3248                         ;;
3249                 dnix) osname=dnix
3250                         osvers="$3"
3251                         ;;
3252                 domainos) osname=apollo
3253                         osvers="$3"
3254                         ;;
3255                 dgux)   osname=dgux
3256                         osvers="$3"
3257                         ;;
3258                 dragonfly) osname=dragonfly
3259                         osvers="$3"
3260                         ;;
3261                 dynixptx*) osname=dynixptx
3262                         osvers=`echo "$4"|sed 's/^v//'`
3263                         ;;
3264                 freebsd) osname=freebsd
3265                         osvers="$3" ;;
3266                 genix)  osname=genix ;;
3267                 gnu)    osname=gnu
3268                         osvers="$3" ;;
3269                 hp*)    osname=hpux
3270                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3271                         ;;
3272                 irix*)  osname=irix
3273                         case "$3" in
3274                         4*) osvers=4 ;;
3275                         5*) osvers=5 ;;
3276                         *)      osvers="$3" ;;
3277                         esac
3278                         ;;
3279                 linux)  osname=linux
3280                         case "$3" in
3281                         *)      osvers="$3" ;;
3282                         esac
3283                         ;;
3284                 MiNT)   osname=mint
3285                         ;;
3286                 netbsd*) osname=netbsd
3287                         osvers="$3"
3288                         ;;
3289                 news-os) osvers="$3"
3290                         case "$3" in
3291                         4*) osname=newsos4 ;;
3292                         *) osname=newsos ;;
3293                         esac
3294                         ;;
3295                 next*) osname=next ;;
3296                 nonstop-ux) osname=nonstopux ;;
3297                 openbsd) osname=openbsd
3298                         osvers="$3"
3299                         ;;
3300                 os2)    osname=os2
3301                         osvers="$4"
3302                         ;;
3303                 POSIX-BC | posix-bc ) osname=posix-bc
3304                         osvers="$3"
3305                         ;;
3306                 powerux | power_ux | powermax_os | powermaxos | \
3307                 powerunix | power_unix) osname=powerux
3308                         osvers="$3"
3309                         ;;
3310                 qnx) osname=qnx
3311                         osvers="$4"
3312                         ;;
3313                 solaris) osname=solaris
3314                         case "$3" in
3315                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3316                         *)      osvers="$3" ;;
3317                         esac
3318                         ;;
3319                 sunos) osname=sunos
3320                         case "$3" in
3321                         5*) osname=solaris
3322                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3323                         *)      osvers="$3" ;;
3324                         esac
3325                         ;;
3326                 titanos) osname=titanos
3327                         case "$3" in
3328                         1*) osvers=1 ;;
3329                         2*) osvers=2 ;;
3330                         3*) osvers=3 ;;
3331                         4*) osvers=4 ;;
3332                         *)      osvers="$3" ;;
3333                         esac
3334                         ;;
3335                 ultrix) osname=ultrix
3336                         osvers="$3"
3337                         ;;
3338                 osf1|mls+)      case "$5" in
3339                                 alpha)
3340                                         osname=dec_osf
3341                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3342                                         case "$osvers" in
3343                                         [1-9].[0-9]*) ;;
3344                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3345                                         esac
3346                                         ;;
3347                         hp*)    osname=hp_osf1  ;;
3348                         mips)   osname=mips_osf1 ;;
3349                         esac
3350                         ;;
3351                 # UnixWare 7.1.2 is known as Open UNIX 8
3352                 openunix|unixware) osname=svr5
3353                         osvers="$4"
3354                         ;;
3355                 uts)    osname=uts
3356                         osvers="$3"
3357                         ;;
3358                 vos) osvers="$3"
3359                         ;;
3360                 $2) case "$osname" in
3361                         *isc*) ;;
3362                         *freebsd*) ;;
3363                         svr*)
3364                                 : svr4.x or possibly later
3365                                 case "svr$3" in
3366                                 ${osname}*)
3367                                         osname=svr$3
3368                                         osvers=$4
3369                                         ;;
3370                                 esac
3371                                 case "$osname" in
3372                                 svr4.0)
3373                                         : Check for ESIX
3374                                         if test -f /stand/boot ; then
3375                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3376                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3377                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3378                                                         if test -n "$isesix"; then
3379                                                                 osname=esix4
3380                                                         fi
3381                                                 fi
3382                                         fi
3383                                         ;;
3384                                 esac
3385                                 ;;
3386                         *)      if test -f /etc/systemid; then
3387                                         osname=sco
3388                                         set `echo $3 | $sed 's/\./ /g'` $4
3389                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3390                                                 osvers=$1.$2.$3
3391                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3392                                                 osvers=$1.$2
3393                                         elif $test -f $src/hints/sco_$1.sh; then
3394                                                 osvers=$1
3395                                         fi
3396                                 else
3397                                         case "$osname" in
3398                                         '') : Still unknown.  Probably a generic Sys V.
3399                                                 osname="sysv"
3400                                                 osvers="$3"
3401                                                 ;;
3402                                         esac
3403                                 fi
3404                                 ;;
3405                         esac
3406                         ;;
3407                 *)      case "$osname" in
3408                         '') : Still unknown.  Probably a generic BSD.
3409                                 osname="$1"
3410                                 osvers="$3"
3411                                 ;;
3412                         esac
3413                         ;;
3414                 esac
3415         else
3416                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3417                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3418                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3419                                 osname=news_os
3420                         fi
3421                         $rm -f UU/kernel.what
3422                 elif test -d c:/. -o -n "$is_os2" ; then
3423                         set X $myuname
3424                         osname=os2
3425                         osvers="$5"
3426                 fi
3427         fi
3428
3429         case "$targetarch" in
3430         '') ;;
3431         *)  hostarch=$osname
3432             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3433             osvers=''
3434             ;;
3435         esac
3436
3437         : Now look for a hint file osname_osvers, unless one has been
3438         : specified already.
3439         case "$hintfile" in
3440         ''|' ')
3441                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3442                 : Also try without trailing minor version numbers.
3443                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3444                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3445                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3446                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3447                 case "$file" in
3448                 '') dflt=none ;;
3449                 *)  case "$osvers" in
3450                         '') dflt=$file
3451                                 ;;
3452                         *)  if $test -f $src/hints/$file.sh ; then
3453                                         dflt=$file
3454                                 elif $test -f $src/hints/$xfile.sh ; then
3455                                         dflt=$xfile
3456                                 elif $test -f $src/hints/$xxfile.sh ; then
3457                                         dflt=$xxfile
3458                                 elif $test -f $src/hints/$xxxfile.sh ; then
3459                                         dflt=$xxxfile
3460                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3461                                         dflt=$xxxxfile
3462                                 elif $test -f "$src/hints/${osname}.sh" ; then
3463                                         dflt="${osname}"
3464                                 else
3465                                         dflt=none
3466                                 fi
3467                                 ;;
3468                         esac
3469                         ;;
3470                 esac
3471                 if $test -f Policy.sh ; then
3472                         case "$dflt" in
3473                         *Policy*) ;;
3474                         none) dflt="Policy" ;;
3475                         *) dflt="Policy $dflt" ;;
3476                         esac
3477                 fi
3478                 ;;
3479         *)
3480                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3481                 ;;
3482         esac
3483
3484         if $test -f Policy.sh ; then
3485                 $cat <<EOM
3486
3487 There's also a Policy hint file available, which should make the
3488 site-specific (policy) questions easier to answer.
3489 EOM
3490
3491         fi
3492
3493         $cat <<EOM
3494
3495 You may give one or more space-separated answers, or "none" if appropriate.
3496 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3497 previous run of Configure, you may specify it as well as or instead of
3498 OS-specific hints.  If hints are provided for your OS, you should use them:
3499 although Perl can probably be built without hints on many platforms, using
3500 hints often improve performance and may enable features that Configure can't
3501 set up on its own. If there are no hints that match your OS, specify "none";
3502 DO NOT give a wrong version or a wrong OS.
3503
3504 EOM
3505
3506         rp="Which of these apply, if any?"
3507         . UU/myread
3508         tans=$ans
3509         for file in $tans; do
3510                 if $test X$file = XPolicy -a -f Policy.sh; then
3511                         . Policy.sh
3512                         $cat Policy.sh >> UU/config.sh
3513                 elif $test -f $src/hints/$file.sh; then
3514                         . $src/hints/$file.sh
3515                         $cat $src/hints/$file.sh >> UU/config.sh
3516                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3517                         : nothing
3518                 else
3519                         : Give one chance to correct a possible typo.
3520                         echo "$file.sh does not exist"
3521                         dflt=$file
3522                         rp="hint to use instead?"
3523                         . UU/myread
3524                         for file in $ans; do
3525                                 if $test -f "$src/hints/$file.sh"; then
3526                                         . $src/hints/$file.sh
3527                                         $cat $src/hints/$file.sh >> UU/config.sh
3528                                 elif $test X$ans = X -o X$ans = Xnone ; then
3529                                         : nothing
3530                                 else
3531                                         echo "$file.sh does not exist -- ignored."
3532                                 fi
3533                         done
3534                 fi
3535         done
3536
3537         hint=recommended
3538         : Remember our hint file for later.
3539         if $test -f "$src/hints/$file.sh" ; then
3540                 hintfile="$file"
3541         else
3542                 hintfile=''
3543         fi
3544 fi
3545 cd UU
3546 ;;
3547 *)
3548         echo " "
3549         echo "Fetching default answers from $config_sh..." >&4
3550         tmp_n="$n"
3551         tmp_c="$c"
3552         cd ..
3553         cp $config_sh config.sh 2>/dev/null
3554         chmod +w config.sh
3555         . ./config.sh
3556         cd UU
3557         cp ../config.sh .
3558         n="$tmp_n"
3559         c="$tmp_c"
3560         hint=previous
3561         ;;
3562 esac
3563 test "$override" && . ./optdef.sh
3564
3565 : Restore computed paths
3566 for file in $loclist $trylist; do
3567         eval $file="\$_$file"
3568 done
3569
3570 cat << EOM
3571
3572 Configure uses the operating system name and version to set some defaults.
3573 The default value is probably right if the name rings a bell. Otherwise,
3574 since spelling matters for me, either accept the default or answer "none"
3575 to leave it blank.
3576
3577 EOM
3578 case "$osname" in
3579         ''|' ')
3580                 case "$hintfile" in
3581                 ''|' '|none) dflt=none ;;
3582                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3583                 esac
3584                 ;;
3585         *) dflt="$osname" ;;
3586 esac
3587 rp="Operating system name?"
3588 . ./myread
3589 case "$ans" in
3590 none)  osname='' ;;
3591 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3592 esac
3593 echo " "
3594 case "$osvers" in
3595         ''|' ')
3596                 case "$hintfile" in
3597                 ''|' '|none) dflt=none ;;
3598                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3599                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3600                         case "$dflt" in
3601                         ''|' ') dflt=none ;;
3602                         esac
3603                         ;;
3604                 esac
3605                 ;;
3606         *) dflt="$osvers" ;;
3607 esac
3608 rp="Operating system version?"
3609 . ./myread
3610 case "$ans" in
3611 none)  osvers='' ;;
3612 *) osvers="$ans" ;;
3613 esac
3614
3615
3616 . ./posthint.sh
3617
3618 : who configured the system
3619 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3620 case "$cf_by" in
3621 "")
3622         cf_by=`(logname) 2>/dev/null`
3623         case "$cf_by" in
3624         "")
3625                 cf_by=`(whoami) 2>/dev/null`
3626                 case "$cf_by" in
3627                 "") cf_by=unknown ;;
3628                 esac ;;
3629         esac ;;
3630 esac
3631
3632 : decide how portable to be.  Allow command line overrides.
3633 case "$d_portable" in
3634 "$undef") ;;
3635 *)      d_portable="$define" ;;
3636 esac
3637
3638 : set up shell script to do ~ expansion
3639 cat >filexp <<EOSS
3640 $startsh
3641 : expand filename
3642 case "\$1" in
3643  \~/*|\~)
3644         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3645         ;;
3646  \~*)
3647         if $test -f /bin/csh; then
3648                 /bin/csh -f -c "glob \$1"
3649                 failed=\$?
3650                 echo ""
3651                 exit \$failed
3652         else
3653                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3654                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3655                 if $test ! -d "\$dir"; then
3656                         me=\`basename \$0\`
3657                         echo "\$me: can't locate home directory for: \$name" >&2
3658                         exit 1
3659                 fi
3660                 case "\$1" in
3661                 */*)
3662                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3663                         ;;
3664                 *)
3665                         echo \$dir
3666                         ;;
3667                 esac
3668         fi
3669         ;;
3670 *)
3671         echo \$1
3672         ;;
3673 esac
3674 EOSS
3675 chmod +x filexp
3676 $eunicefix filexp
3677
3678 : now set up to get a file name
3679 cat <<EOS >getfile
3680 $startsh
3681 EOS
3682 cat <<'EOSC' >>getfile
3683 tilde=''
3684 fullpath=''
3685 already=''
3686 skip=''
3687 none_ok=''
3688 exp_file=''
3689 nopath_ok=''
3690 orig_rp="$rp"
3691 orig_dflt="$dflt"
3692 case "$gfpth" in
3693 '') gfpth='.' ;;
3694 esac
3695
3696 case "$fn" in
3697 *\(*)
3698         : getfile will accept an answer from the comma-separated list
3699         : enclosed in parentheses even if it does not meet other criteria.
3700         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3701         fn=`echo $fn | sed 's/(.*)//'`
3702         ;;
3703 esac
3704
3705 case "$fn" in
3706 *:*)
3707         loc_file=`expr $fn : '.*:\(.*\)'`
3708         fn=`expr $fn : '\(.*\):.*'`
3709         ;;
3710 esac
3711
3712 case "$fn" in
3713 *~*) tilde=true;;
3714 esac
3715 case "$fn" in
3716 */*) fullpath=true;;
3717 esac
3718 case "$fn" in
3719 *+*) skip=true;;
3720 esac
3721 case "$fn" in
3722 *n*) none_ok=true;;
3723 esac
3724 case "$fn" in
3725 *e*) exp_file=true;;
3726 esac
3727 case "$fn" in
3728 *p*) nopath_ok=true;;
3729 esac
3730
3731 case "$fn" in
3732 *f*) type='File';;
3733 *d*) type='Directory';;
3734 *l*) type='Locate';;
3735 esac
3736
3737 what="$type"
3738 case "$what" in
3739 Locate) what='File';;
3740 esac
3741
3742 case "$exp_file" in
3743 '')
3744         case "$d_portable" in
3745         "$define") ;;
3746         *) exp_file=true;;
3747         esac
3748         ;;
3749 esac
3750
3751 cd ..
3752 while test "$type"; do
3753         redo=''
3754         rp="$orig_rp"
3755         dflt="$orig_dflt"
3756         case "$tilde" in
3757         true) rp="$rp (~name ok)";;
3758         esac
3759         . UU/myread
3760         if test -f UU/getfile.ok && \
3761                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3762         then
3763                 value="$ans"
3764                 ansexp="$ans"
3765                 break
3766         fi
3767         case "$ans" in
3768         none)
3769                 value=''
3770                 ansexp=''
3771                 case "$none_ok" in
3772                 true) type='';;
3773                 esac
3774                 ;;
3775         *)
3776                 case "$tilde" in
3777                 '') value="$ans"
3778                         ansexp="$ans";;
3779                 *)
3780                         value=`UU/filexp $ans`
3781                         case $? in
3782                         0)
3783                                 if test "$ans" != "$value"; then
3784                                         echo "(That expands to $value on this system.)"
3785                                 fi
3786                                 ;;
3787                         *) value="$ans";;
3788                         esac
3789                         ansexp="$value"
3790                         case "$exp_file" in
3791                         '') value="$ans";;
3792                         esac
3793                         ;;
3794                 esac
3795                 case "$fullpath" in
3796                 true)
3797                         case "$ansexp" in
3798                         /*) value="$ansexp" ;;
3799                         [a-zA-Z]:/*) value="$ansexp" ;;
3800                         *)
3801                                 redo=true
3802                                 case "$already" in
3803                                 true)
3804                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3805                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3806                                         ;;
3807                                 *)
3808                                 echo "Please give a full path name, starting with slash." >&4
3809                                         case "$tilde" in
3810                                         true)
3811                                 echo "Note that using ~name is ok provided it expands well." >&4
3812                                                 already=true
3813                                                 ;;
3814                                         esac
3815                                 esac
3816                                 ;;
3817                         esac
3818                         ;;
3819                 esac
3820                 case "$redo" in
3821                 '')
3822                         case "$type" in
3823                         File)
3824                                 for fp in $gfpth; do
3825                                         if test "X$fp" = X.; then
3826                                             pf="$ansexp"
3827                                         else    
3828                                             pf="$fp/$ansexp"
3829                                         fi
3830                                         if test -f "$pf"; then
3831                                                 type=''
3832                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3833                                         then
3834                                                 echo "($value is not a plain file, but that's ok.)"
3835                                                 type=''
3836                                         fi
3837                                         if test X"$type" = X; then
3838                                             value="$pf"
3839                                             break
3840                                         fi
3841                                 done
3842                                 ;;
3843                         Directory)
3844                                 for fp in $gfpth; do
3845                                         if test "X$fp" = X.; then
3846                                             dir="$ans"
3847                                             direxp="$ansexp"
3848                                         else    
3849                                             dir="$fp/$ansexp"
3850                                             direxp="$fp/$ansexp"
3851                                         fi
3852                                         if test -d "$direxp"; then
3853                                                 type=''
3854                                                 value="$dir"
3855                                                 break
3856                                         fi
3857                                 done
3858                                 ;;
3859                         Locate)
3860                                 if test -d "$ansexp"; then
3861                                         echo "(Looking for $loc_file in directory $value.)"
3862                                         value="$value/$loc_file"
3863                                         ansexp="$ansexp/$loc_file"
3864                                 fi
3865                                 if test -f "$ansexp"; then
3866                                         type=''
3867                                 fi
3868                                 case "$nopath_ok" in
3869                                 true)   case "$value" in
3870                                         */*) ;;
3871                                         *)      echo "Assuming $value will be in people's path."
3872                                                 type=''
3873                                                 ;;
3874                                         esac
3875                                         ;;
3876                                 esac
3877                                 ;;
3878                         esac
3879
3880                         case "$skip" in
3881                         true) type='';
3882                         esac
3883
3884                         case "$type" in
3885                         '') ;;
3886                         *)
3887                                 if test "$fastread" = yes; then
3888                                         dflt=y
3889                                 else
3890                                         dflt=n
3891                                 fi
3892                                 rp="$what $value doesn't exist.  Use that name anyway?"
3893                                 . UU/myread
3894                                 dflt=''
3895                                 case "$ans" in
3896                                 y*) type='';;
3897                                 *) echo " ";;
3898                                 esac
3899                                 ;;
3900                         esac
3901                         ;;
3902                 esac
3903                 ;;
3904         esac
3905 done
3906 cd UU
3907 ans="$value"
3908 rp="$orig_rp"
3909 dflt="$orig_dflt"
3910 rm -f getfile.ok
3911 test "X$gfpthkeep" != Xy && gfpth=""
3912 EOSC
3913
3914 : determine root of directory hierarchy where package will be installed.
3915 case "$prefix" in
3916 '')
3917         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3918         ;;
3919 *?/)
3920         dflt=`echo "$prefix" | sed 's/.$//'`
3921         ;;
3922 *)
3923         dflt="$prefix"
3924         ;;
3925 esac
3926 $cat <<EOM
3927
3928 By default, $package will be installed in $dflt/bin, manual pages
3929 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3930 installation directories. Typically this is something like /usr/local.
3931 If you wish to have binaries under /usr/bin but other parts of the
3932 installation under /usr/local, that's ok: you will be prompted
3933 separately for each of the installation directories, the prefix being
3934 only used to set the defaults.
3935
3936 EOM
3937 fn=d~
3938 rp='Installation prefix to use?'
3939 . ./getfile
3940 oldprefix=''
3941 case "$prefix" in
3942 '') ;;
3943 *)
3944         case "$ans" in
3945         "$prefix") ;;
3946         *) oldprefix="$prefix";;
3947         esac
3948         ;;
3949 esac
3950 prefix="$ans"
3951 prefixexp="$ansexp"
3952
3953 : allow them to override the AFS root
3954 case "$afsroot" in
3955 '')     afsroot=/afs ;;
3956 *)      afsroot=$afsroot ;;
3957 esac
3958
3959 : is AFS running?
3960 echo " "
3961 case "$afs" in
3962 $define|true)   afs=true ;;
3963 $undef|false)   afs=false ;;
3964 *)      if $test -d $afsroot; then
3965                 afs=true
3966         else
3967                 afs=false
3968         fi
3969         ;;
3970 esac
3971 if $afs; then
3972         echo "AFS may be running... I'll be extra cautious then..." >&4
3973 else
3974         echo "AFS does not seem to be running..." >&4
3975 fi
3976
3977 : determine installation prefix for where package is to be installed.
3978 if $afs; then 
3979 $cat <<EOM
3980
3981 Since you are running AFS, I need to distinguish the directory in which
3982 files will reside from the directory in which they are installed (and from
3983 which they are presumably copied to the former directory by occult means).
3984
3985 EOM
3986         case "$installprefix" in
3987         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3988         *) dflt="$installprefix";;
3989         esac
3990 else
3991 $cat <<EOM
3992
3993 In some special cases, particularly when building $package for distribution,
3994 it is convenient to distinguish the directory in which files should be
3995 installed from the directory ($prefix) in which they will
3996 eventually reside.  For most users, these two directories are the same.
3997
3998 EOM
3999         case "$installprefix" in
4000         '') dflt=$prefix ;;
4001         *) dflt=$installprefix;;
4002         esac
4003 fi
4004 fn=d~
4005 rp='What installation prefix should I use for installing files?'
4006 . ./getfile
4007 installprefix="$ans"
4008 installprefixexp="$ansexp"
4009
4010 : Perform the prefixexp/installprefixexp correction if necessary
4011 cat <<EOS >installprefix
4012 $startsh
4013 EOS
4014 cat <<'EOSC' >>installprefix
4015 : Change installation prefix, if necessary.
4016 if $test X"$prefix" != X"$installprefix"; then
4017     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4018 else
4019     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4020 fi
4021 EOSC
4022 chmod +x installprefix
4023 $eunicefix installprefix
4024
4025 : Set variables such as privlib and privlibexp from the output of ./getfile
4026 : performing the prefixexp/installprefixexp correction if necessary.
4027 cat <<EOS >setprefixvar
4028 $startsh
4029 EOS
4030 cat <<'EOSC' >>setprefixvar
4031 eval "${prefixvar}=\"\$ans\""
4032 eval "${prefixvar}exp=\"\$ansexp\""
4033 . ./installprefix
4034 EOSC
4035 chmod +x setprefixvar
4036 $eunicefix setprefixvar
4037
4038 : set up the script used to warn in case of inconsistency
4039 cat <<EOS >whoa
4040 $startsh
4041 EOS
4042 cat <<'EOSC' >>whoa
4043 dflt=y
4044 case "$hint" in
4045     recommended)
4046         case "$hintfile" in
4047         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4048                 ;;
4049         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4050                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4051                 ;;
4052         esac
4053         ;;
4054     *)  echo " "
4055         echo "*** WHOA THERE!!! ***" >&4
4056         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4057         ;;
4058 esac
4059 rp="    Keep the $hint value?"
4060 . ./myread
4061 case "$ans" in
4062 y) td=$was; tu=$was;;
4063 esac
4064 EOSC
4065
4066 : function used to set '$1' to '$val'
4067 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4068 case "$val$was" in
4069 $define$undef) . ./whoa; eval "$var=\$td";;
4070 $undef$define) . ./whoa; eval "$var=\$tu";;
4071 *) eval "$var=$val";;
4072 esac'
4073
4074 : Check is we will use socks
4075 case "$usesocks" in
4076 $define|true|[yY]*)     dflt='y';;
4077 *) dflt='n';;
4078 esac
4079 cat <<EOM
4080
4081 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4082 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4083 to use the PerlIO abstraction layer, this will be implicitly selected.
4084
4085 If this doesn't make any sense to you, just accept the default '$dflt'.
4086 EOM
4087 rp='Build Perl for SOCKS?'
4088 . ./myread
4089 case "$ans" in
4090 y|Y)    val="$define" ;;
4091 *)      val="$undef" ;;
4092 esac
4093 set usesocks
4094 eval $setvar
4095
4096 case "$usesocks" in
4097 $define|true|[yY]*) useperlio="$define";;
4098 esac
4099
4100 : Check if we want perlio
4101 case "$useperlio" in
4102 $define|true|[yY]*|'')  dflt='y';;
4103 *) dflt='n';;
4104 esac
4105 cat <<EOM
4106
4107 Previous version of $package used the standard IO mechanisms as
4108 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4109 alternate IO mechanisms via the PerlIO abstraction layer, but the
4110 stdio mechanism is still available if needed.  The abstraction layer
4111 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4112 Using PerlIO with sfio may cause problems with some extension modules.
4113
4114 If this doesn't make any sense to you, just accept the default '$dflt'.
4115 EOM
4116 rp='Use the PerlIO abstraction layer?'
4117 . ./myread
4118 case "$ans" in
4119 y|Y)
4120         val="$define"
4121         ;;
4122 *)
4123         echo "Ok, doing things the stdio way."
4124         val="$undef"
4125         ;;
4126 esac
4127 set useperlio
4128 eval $setvar
4129
4130 case "$usesocks" in
4131 $define|true|[yY]*)
4132         case "$useperlio" in
4133         $define|true|[yY]*) ;;
4134         *)      cat >&4 <<EOM
4135
4136 You are using the SOCKS proxy protocol library which means that you
4137 should also use the PerlIO layer.  You may be headed for trouble.
4138
4139 EOM
4140                 ;;
4141         esac
4142         ;;
4143 esac
4144
4145 : get the patchlevel
4146 echo " "
4147 echo "Getting the current patchlevel..." >&4
4148 if $test -r $rsrc/patchlevel.h;then
4149         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4150         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4151         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4152         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4153         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4154         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4155         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4156 else
4157         revision=0
4158         patchlevel=0
4159         subversion=0
4160         api_revision=0
4161         api_version=0
4162         api_subversion=0
4163         perl_patchlevel=0
4164         $echo "(You do not have patchlevel.h.  Eek.)"
4165 fi
4166 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4167 version_patchlevel_string="version $patchlevel subversion $subversion"
4168 case "$perl_patchlevel" in
4169 0|'') ;;
4170 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4171     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4172     ;;
4173 esac
4174
4175 $echo "(You have $package $version_patchlevel_string.)"
4176
4177 case "$osname" in
4178 dos|vms)
4179         : XXX Should be a Configure test for double-dots in filenames.
4180         version=`echo $revision $patchlevel $subversion | \
4181                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4182         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4183                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184         ;;
4185 *)
4186         version=`echo $revision $patchlevel $subversion | \
4187                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4188         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4189                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190         ;;
4191 esac
4192 : Special case the 5.005_xx maintenance series, which used 5.005
4193 : without any subversion label as a subdirectory in $sitelib
4194 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4195         api_versionstring='5.005'
4196 fi
4197
4198 : Do we want threads support and if so, what type
4199 case "$usethreads" in
4200 $define|true|[yY]*)     dflt='y';;
4201 *)     # Catch case where user specified ithreads or 5005threads but
4202        # forgot -Dusethreads (A.D. 4/2002)
4203        case "$useithreads$use5005threads" in
4204        *$define*)
4205                 case "$useperlio" in
4206                 "$define")      dflt='y' ;;
4207                 *)              dflt='n' ;;
4208                 esac
4209                 ;;
4210        *)       dflt='n';;
4211        esac
4212        ;;
4213 esac
4214 cat <<EOM
4215
4216 Perl can be built to take advantage of threads on some systems.
4217 To do so, Configure can be run with -Dusethreads.
4218
4219 Note that Perl built with threading support runs slightly slower
4220 and uses more memory than plain Perl. The current implementation
4221 is believed to be stable, but it is fairly new, and so should be
4222 treated with caution.
4223
4224 If this doesn't make any sense to you, just accept the default '$dflt'.
4225 EOM
4226 rp='Build a threading Perl?'
4227 . ./myread
4228 case "$ans" in
4229 y|Y)    val="$define" ;;
4230 *)      val="$undef" ;;
4231 esac
4232 set usethreads
4233 eval $setvar
4234
4235 if $test $patchlevel -lt 9; then
4236     case "$usethreads" in
4237     $define)
4238         $cat <<EOM
4239
4240 Since release 5.6, Perl has had two different threading implementations,
4241 the newer interpreter-based version (ithreads) with one interpreter per
4242 thread, and the older 5.005 version (5005threads).
4243 The 5005threads version is effectively unmaintained and will probably be
4244 removed in Perl 5.10, so there should be no need to build a Perl using it
4245 unless needed for backwards compatibility with some existing 5.005threads
4246 code.
4247
4248 EOM
4249         : Default to ithreads unless overridden on command line or with
4250         : old config.sh
4251         dflt='y'
4252         case "$use5005threads" in
4253                 $define|true|[yY]*) dflt='n';;
4254         esac
4255         case "$useithreads" in
4256                 $undef|false|[nN]*) dflt='n';;
4257         esac
4258         rp='Use the newer interpreter-based ithreads?'
4259         . ./myread
4260         case "$ans" in
4261         y|Y)    val="$define" ;;
4262         *)      val="$undef" ;;
4263         esac
4264         set useithreads
4265         eval $setvar
4266         : Now set use5005threads to the opposite value.
4267         case "$useithreads" in
4268         $define) val="$undef" ;;
4269         *) val="$define" ;;
4270         esac
4271         set use5005threads
4272         eval $setvar
4273         ;;
4274     *)
4275         useithreads="$undef"
4276         use5005threads="$undef"
4277         ;;
4278     esac
4279
4280     case "$useithreads$use5005threads" in
4281     "$define$define")
4282         $cat >&4 <<EOM
4283
4284 You cannot have both the ithreads and the 5.005 threads enabled
4285 at the same time.  Disabling the 5.005 threads since they are
4286 much less stable than the ithreads.
4287
4288 EOM
4289         use5005threads="$undef"
4290         ;;
4291     esac
4292
4293 else
4294 : perl-5.9.x and later
4295
4296     if test X"$usethreads" = "X$define"; then
4297         case "$use5005threads" in
4298             $define|true|[yY]*)
4299                 $cat >&4 <<EOM
4300
4301 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4302
4303 EOM
4304             ;;
4305         esac
4306     fi
4307
4308     use5005threads="$undef"
4309     useithreads="$usethreads"
4310 fi
4311
4312 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4313         cat >&4 <<EOF
4314 ***
4315 *** To build with ithreads you must also use the PerlIO layer.
4316 *** Cannot continue, aborting.
4317 ***
4318 EOF
4319         exit 1
4320 fi
4321
4322 case "$d_oldpthreads" in
4323 '')     : Configure tests would be welcome here.  For now, assume undef.
4324         val="$undef" ;;
4325 *)      val="$d_oldpthreads" ;;
4326 esac
4327 set d_oldpthreads
4328 eval $setvar
4329
4330
4331 : Look for a hint-file generated 'call-back-unit'.  If the
4332 : user has specified that a threading perl is to be built,
4333 : we may need to set or change some other defaults.
4334 if $test -f usethreads.cbu; then
4335     echo "Your platform has some specific hints regarding threaded builds, using them..."
4336     . ./usethreads.cbu
4337 else
4338     case "$usethreads" in
4339         "$define"|true|[yY]*)
4340                 $cat <<EOM
4341 (Your platform does not have any specific hints for threaded builds.
4342  Assuming POSIX threads, then.)
4343 EOM
4344         ;;
4345     esac
4346 fi
4347
4348 : Check if multiplicity is required
4349 cat <<EOM
4350
4351 Perl can be built so that multiple Perl interpreters can coexist
4352 within the same Perl executable.
4353 EOM
4354
4355 case "$useithreads" in
4356 $define)
4357         cat <<EOM
4358 This multiple interpreter support is required for interpreter-based threads.
4359 EOM
4360         val="$define"
4361         ;;
4362 *)      case "$usemultiplicity" in
4363         $define|true|[yY]*)     dflt='y';;
4364         *) dflt='n';;
4365         esac
4366         echo " "
4367         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4368         rp='Build Perl for multiplicity?'
4369         . ./myread
4370         case "$ans" in
4371         y|Y)    val="$define" ;;
4372         *)      val="$undef" ;;
4373         esac
4374         ;;
4375 esac
4376 set usemultiplicity
4377 eval $setvar
4378
4379 : Check if morebits is requested
4380 case "$usemorebits" in
4381 "$define"|true|[yY]*)
4382         use64bitint="$define"
4383         uselongdouble="$define"
4384         usemorebits="$define"
4385         ;;
4386 *)      usemorebits="$undef"
4387         ;;
4388 esac
4389
4390 : Determine the C compiler to be used
4391 echo " "
4392 case "$cc" in
4393 '') dflt=cc;;
4394 *) dflt="$cc";;
4395 esac
4396 rp="Use which C compiler?"
4397 . ./myread
4398 cc="$ans"
4399
4400 : See whether they have no cc but they do have gcc
4401 . ./trygcc
4402 if $test -f cc.cbu; then
4403     . ./cc.cbu
4404 fi
4405 . ./checkcc
4406
4407 : make some quick guesses about what we are up against
4408 echo " "
4409 $echo $n "Hmm...  $c"
4410 echo exit 1 >bsd
4411 echo exit 1 >usg
4412 echo exit 1 >v7
4413 echo exit 1 >osf1
4414 echo exit 1 >eunice
4415 echo exit 1 >xenix
4416 echo exit 1 >venix
4417 echo exit 1 >os2
4418 d_bsd="$undef"
4419 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4420 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4421 then
4422         echo "Looks kind of like an OSF/1 system, but we'll see..."
4423         echo exit 0 >osf1
4424 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4425         xxx=`./loc addbib blurfl $pth`
4426         if $test -f $xxx; then
4427         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4428                 echo exit 0 >bsd
4429                 echo exit 0 >usg
4430         else
4431                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432                         echo "Looks kind of like an extended USG system, but we'll see..."
4433                 else
4434                         echo "Looks kind of like a USG system, but we'll see..."
4435                 fi
4436                 echo exit 0 >usg
4437         fi
4438 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4439         echo "Looks kind of like a BSD system, but we'll see..."
4440         d_bsd="$define"
4441         echo exit 0 >bsd
4442 else
4443         echo "Looks kind of like a Version 7 system, but we'll see..."
4444         echo exit 0 >v7
4445 fi
4446 case "$eunicefix" in
4447 *unixtovms*)
4448         $cat <<'EOI'
4449 There is, however, a strange, musty smell in the air that reminds me of
4450 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4451 EOI
4452         echo exit 0 >eunice
4453         d_eunice="$define"
4454 : it so happens the Eunice I know will not run shell scripts in Unix format
4455         ;;
4456 *)
4457         echo " "
4458         echo "Congratulations.  You aren't running Eunice."
4459         d_eunice="$undef"
4460         ;;
4461 esac
4462 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4463 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4464 : semicolon as a patch separator
4465 case "$p_" in
4466 :) ;;
4467 *)
4468         $cat <<'EOI'
4469 I have the feeling something is not exactly right, however...don't tell me...
4470 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4471 (Or you may be running DOS with DJGPP.)
4472 EOI
4473         echo exit 0 >os2
4474         ;;
4475 esac
4476 if test -f /xenix; then
4477         echo "Actually, this looks more like a XENIX system..."
4478         echo exit 0 >xenix
4479         d_xenix="$define"
4480 else
4481         echo " "
4482         echo "It's not Xenix..."
4483         d_xenix="$undef"
4484 fi
4485 chmod +x xenix
4486 $eunicefix xenix
4487 if test -f /venix; then
4488         echo "Actually, this looks more like a VENIX system..."
4489         echo exit 0 >venix
4490 else
4491         echo " "
4492         if ./xenix; then
4493                 : null
4494         else
4495                 echo "Nor is it Venix..."
4496         fi
4497 fi
4498 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4499 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4500 $rm -f foo
4501
4502 : Check if we are using GNU gcc and what its version is
4503 echo " "
4504 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4505 $cat >try.c <<EOM
4506 #include <stdio.h>
4507 int main() {
4508 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4509 #ifdef __VERSION__
4510         printf("%s\n", __VERSION__);
4511 #else
4512         printf("%s\n", "1");
4513 #endif
4514 #endif
4515         return(0);
4516 }
4517 EOM
4518 if $cc -o try $ccflags $ldflags try.c; then
4519         gccversion=`$run ./try`
4520         case "$gccversion" in
4521         '') echo "You are not using GNU cc." ;;
4522         *)  echo "You are using GNU cc $gccversion."
4523             ccname=gcc
4524             ;;
4525         esac
4526 else
4527         echo " "
4528         echo "*** WHOA THERE!!! ***" >&4
4529         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4530         case "$knowitall" in
4531         '')
4532         echo "    You'd better start hunting for one and let me know about it." >&4
4533                 exit 1
4534                 ;;
4535         esac
4536 fi
4537 $rm -f try try.*
4538 case "$gccversion" in
4539 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4540 esac
4541 case "$gccversion" in
4542 '') gccosandvers='' ;;
4543 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4544    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4545    gccshortvers=''
4546    case "$gccosandvers" in
4547    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4548    $osname$osvers) ;; # looking good
4549    $osname*) cat <<EOM >&4
4550
4551 *** WHOA THERE!!! ***
4552
4553     Your gcc has not been compiled for the exact release of
4554     your operating system ($gccosandvers versus $osname$osvers).
4555
4556     In general it is a good idea to keep gcc synchronized with
4557     the operating system because otherwise serious problems
4558     may ensue when trying to compile software, like Perl.
4559
4560     I'm trying to be optimistic here, though, and will continue.
4561     If later during the configuration and build icky compilation
4562     problems appear (headerfile conflicts being the most common
4563     manifestation), I suggest reinstalling the gcc to match
4564     your operating system release.
4565
4566 EOM
4567       ;;
4568    *) gccosandvers='' ;; # failed to parse, better be silent
4569    esac
4570    ;;
4571 esac
4572 case "$ccname" in
4573 '') ccname="$cc" ;;
4574 esac
4575
4576 # gcc 3.* complain about adding -Idirectories that they already know about,
4577 # so we will take those off from locincpth.
4578 case "$gccversion" in
4579 3*)
4580     echo "main(){}">try.c
4581     for incdir in $locincpth; do
4582        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4583              grep '^c[cp]p*[01]: warning: changing search order '`
4584        if test "X$warn" != X; then
4585            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4586        fi
4587     done
4588     $rm -f try try.*
4589 esac
4590
4591 : What should the include directory be ?
4592 echo " "
4593 $echo $n "Hmm...  $c"
4594 dflt='/usr/include'
4595 incpath=''
4596 mips_type=''
4597 if $test -f /bin/mips && /bin/mips; then
4598         echo "Looks like a MIPS system..."
4599         $cat >usr.c <<'EOCP'
4600 #ifdef SYSTYPE_BSD43
4601 /bsd43
4602 #endif
4603 EOCP
4604         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4605                 dflt='/bsd43/usr/include'
4606                 incpath='/bsd43'
4607                 mips_type='BSD 4.3'
4608         else
4609                 mips_type='System V'
4610         fi
4611         $rm -f usr.c usr.out
4612         echo "and you're compiling with the $mips_type compiler and libraries."
4613         xxx_prompt=y
4614         echo "exit 0" >mips
4615 else
4616         echo "Doesn't look like a MIPS system."
4617         xxx_prompt=n
4618         echo "exit 1" >mips
4619 fi
4620 chmod +x mips
4621 $eunicefix mips
4622 case "$usrinc" in
4623 '') ;;
4624 *) dflt="$usrinc";;
4625 esac
4626 case "$xxx_prompt" in
4627 y)      fn=d/
4628         echo " "
4629         rp='Where are the include files you want to use?'
4630         . ./getfile
4631         usrinc="$ans"
4632         ;;
4633 *)      usrinc="$dflt"
4634         ;;
4635 esac
4636
4637 : see how we invoke the C preprocessor
4638 echo " "
4639 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4640 cat <<'EOT' >testcpp.c
4641 #define ABC abc
4642 #define XYZ xyz
4643 ABC.XYZ
4644 EOT
4645 cd ..
4646 if test ! -f cppstdin; then
4647         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4648                 # AIX cc -E doesn't show the absolute headerfile
4649                 # locations but we'll cheat by using the -M flag.
4650                 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
4651         else
4652                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4653         fi
4654 else
4655         echo "Keeping your $hint cppstdin wrapper."
4656 fi
4657 chmod 755 cppstdin
4658 wrapper=`pwd`/cppstdin
4659 ok='false'
4660 cd UU
4661
4662 if $test "X$cppstdin" != "X" && \
4663         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665 then
4666         echo "You used to use $cppstdin $cppminus so we'll use that again."
4667         case "$cpprun" in
4668         '') echo "But let's see if we can live without a wrapper..." ;;
4669         *)
4670                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4671                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672                 then
4673                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4674                         ok='true'
4675                 else
4676                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4677                 fi
4678                 ;;
4679         esac
4680 else
4681         case "$cppstdin" in
4682         '') ;;
4683         *)
4684                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4685                 ;;
4686         esac
4687 fi
4688
4689 if $ok; then
4690         : nothing
4691 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4692         $cc -E <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "Yup, it does."
4695         x_cpp="$cc -E"
4696         x_minus='';
4697 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4698         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "Yup, it does."
4701         x_cpp="$cc -E"
4702         x_minus='-';
4703 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4704         $cc -P <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         echo "Yipee, that works!"
4707         x_cpp="$cc -P"
4708         x_minus='';
4709 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4710         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         echo "At long last!"
4713         x_cpp="$cc -P"
4714         x_minus='-';
4715 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4716         $cpp <testcpp.c >testcpp.out 2>&1; \
4717         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718         echo "It works!"
4719         x_cpp="$cpp"
4720         x_minus='';
4721 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4722         $cpp - <testcpp.c >testcpp.out 2>&1; \
4723         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724         echo "Hooray, it works!  I was beginning to wonder."
4725         x_cpp="$cpp"
4726         x_minus='-';
4727 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4728         $wrapper <testcpp.c >testcpp.out 2>&1; \
4729         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4730         x_cpp="$wrapper"
4731         x_minus=''
4732         echo "Eureka!"
4733 else
4734         dflt=''
4735         rp="No dice.  I can't find a C preprocessor.  Name one:"
4736         . ./myread
4737         x_cpp="$ans"
4738         x_minus=''
4739         $x_cpp <testcpp.c >testcpp.out 2>&1
4740         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4741                 echo "OK, that will do." >&4
4742         else
4743 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4744                 exit 1
4745         fi
4746 fi
4747
4748 case "$ok" in
4749 false)
4750         cppstdin="$x_cpp"
4751         cppminus="$x_minus"
4752         cpprun="$x_cpp"
4753         cpplast="$x_minus"
4754         set X $x_cpp
4755         shift
4756         case "$1" in
4757         "$cpp")
4758                 echo "Perhaps can we force $cc -E using a wrapper..."
4759                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4760                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4761                 then
4762                         echo "Yup, we can."
4763                         cppstdin="$wrapper"
4764                         cppminus='';
4765                 else
4766                         echo "Nope, we'll have to live without it..."
4767                 fi
4768                 ;;
4769         esac
4770         case "$cpprun" in
4771         "$wrapper")
4772                 cpprun=''
4773                 cpplast=''
4774                 ;;
4775         esac
4776         ;;
4777 esac
4778
4779 case "$cppstdin" in
4780 "$wrapper"|'cppstdin') ;;
4781 *) $rm -f $wrapper;;
4782 esac
4783 $rm -f testcpp.c testcpp.out
4784
4785 : Set private lib path
4786 case "$plibpth" in
4787 '') if ./mips; then
4788                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4789         fi;;
4790 esac
4791 case "$libpth" in
4792 ' ') dlist='';;
4793 '') dlist="$loclibpth $plibpth $glibpth";;
4794 *) dlist="$libpth";;
4795 esac
4796
4797 : Now check and see which directories actually exist, avoiding duplicates
4798 libpth=''
4799 for xxx in $dlist
4800 do
4801     if $test -d $xxx; then
4802                 case " $libpth " in
4803                 *" $xxx "*) ;;
4804                 *) libpth="$libpth $xxx";;
4805                 esac
4806     fi
4807 done
4808 $cat <<'EOM'
4809
4810 Some systems have incompatible or broken versions of libraries.  Among
4811 the directories listed in the question below, please remove any you
4812 know not to be holding relevant libraries, and add any that are needed.
4813 Say "none" for none.
4814
4815 EOM
4816 case "$libpth" in
4817 '') dflt='none';;
4818 *)
4819         set X $libpth
4820         shift
4821         dflt=${1+"$@"}
4822         ;;
4823 esac
4824 rp="Directories to use for library searches?"
4825 . ./myread
4826 case "$ans" in
4827 none) libpth=' ';;
4828 *) libpth="$ans";;
4829 esac
4830
4831 : compute shared library extension
4832 case "$so" in
4833 '')
4834         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4835                 dflt='sl'
4836         else
4837                 dflt='so'
4838         fi
4839         ;;
4840 *) dflt="$so";;
4841 esac
4842 $cat <<EOM
4843
4844 On some systems, shared libraries may be available.  Answer 'none' if
4845 you want to suppress searching of shared libraries for the remainder
4846 of this configuration.
4847
4848 EOM
4849 rp='What is the file extension used for shared libraries?'
4850 . ./myread
4851 so="$ans"
4852
4853 : Define several unixisms.
4854 : Hints files or command line option can be used to override them.
4855 : The convoluted testing is in case hints files set either the old
4856 : or the new name.
4857 case "$_exe" in
4858 '')     case "$exe_ext" in
4859         '')     ;;
4860         *)      _exe="$exe_ext" ;;
4861         esac
4862         ;;
4863 esac
4864 case "$_a" in
4865 '')     case "$lib_ext" in
4866     '') _a='.a';;
4867         *)      _a="$lib_ext" ;;
4868         esac
4869         ;;
4870 esac
4871 case "$_o" in
4872 '') case "$obj_ext" in
4873         '')     _o='.o';;
4874         *)      _o="$obj_ext";;
4875         esac
4876         ;;
4877 esac
4878 case "$p_" in
4879 '') case "$path_sep" in
4880         '')     p_=':';;
4881         *)      p_="$path_sep";;
4882         esac
4883         ;;
4884 esac
4885 exe_ext=$_exe
4886 lib_ext=$_a
4887 obj_ext=$_o
4888 path_sep=$p_
4889
4890 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4891
4892 : Which makefile gets called first.  This is used by make depend.
4893 case "$firstmakefile" in
4894 '') firstmakefile='makefile';;
4895 esac
4896
4897 : Check for uselongdouble support
4898 case "$ccflags" in
4899 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4900 esac
4901
4902 case "$uselongdouble" in
4903 $define|true|[yY]*)     dflt='y';;
4904 *) dflt='n';;
4905 esac
4906 cat <<EOM
4907
4908 Perl can be built to take advantage of long doubles which
4909 (if available) may give more accuracy and range for floating point numbers.
4910
4911 If this doesn't make any sense to you, just accept the default '$dflt'.
4912 EOM
4913 rp='Try to use long doubles if available?'
4914 . ./myread
4915 case "$ans" in
4916 y|Y)    val="$define"   ;;
4917 *)      val="$undef"    ;;
4918 esac
4919 set uselongdouble
4920 eval $setvar
4921
4922 case "$uselongdouble" in
4923 true|[yY]*) uselongdouble="$define" ;;
4924 esac
4925
4926 : Look for a hint-file generated 'call-back-unit'.  If the
4927 : user has specified that long doubles should be used,
4928 : we may need to set or change some other defaults.
4929 if $test -f uselongdouble.cbu; then
4930     echo "Your platform has some specific hints regarding long doubles, using them..."
4931     . ./uselongdouble.cbu
4932 else
4933     case "$uselongdouble" in
4934         $define)
4935                 $cat <<EOM
4936 (Your platform does not have any specific hints for long doubles.)
4937 EOM
4938         ;;
4939     esac
4940 fi
4941
4942 : Looking for optional libraries
4943 echo " "
4944 echo "Checking for optional libraries..." >&4
4945 case "$libs" in
4946 ' '|'') dflt='';;
4947 *) dflt="$libs";;
4948 esac
4949 case "$libswanted" in
4950 '') libswanted='c_s';;
4951 esac
4952 case "$usesocks" in
4953 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4954 esac
4955 libsfound=''
4956 libsfiles=''
4957 libsdirs=''
4958 libspath=''
4959 for thisdir in $libpth $xlibpth; do
4960   test -d $thisdir && libspath="$libspath $thisdir"
4961 done
4962 for thislib in $libswanted; do
4963         for thisdir in $libspath; do
4964             xxx=''
4965             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4966                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4967                 $test -f "$xxx" && eval $libscheck
4968                 $test -f "$xxx" && libstyle=shared
4969             fi
4970             if test ! -f "$xxx"; then
4971                 xxx=$thisdir/lib$thislib.$so
4972                 $test -f "$xxx" && eval $libscheck
4973                 $test -f "$xxx" && libstyle=shared
4974             fi
4975             if test ! -f "$xxx"; then
4976                 xxx=$thisdir/lib$thislib$_a
4977                 $test -f "$xxx" && eval $libscheck
4978                 $test -f "$xxx" && libstyle=static
4979             fi
4980             if test ! -f "$xxx"; then
4981                 xxx=$thisdir/$thislib$_a
4982                 $test -f "$xxx" && eval $libscheck
4983                 $test -f "$xxx" && libstyle=static
4984             fi
4985             if test ! -f "$xxx"; then
4986                 xxx=$thisdir/lib${thislib}_s$_a
4987                 $test -f "$xxx" && eval $libscheck
4988                 $test -f "$xxx" && libstyle=static
4989                 $test -f "$xxx" && thislib=${thislib}_s
4990             fi
4991             if test ! -f "$xxx"; then
4992                 xxx=$thisdir/Slib$thislib$_a
4993                 $test -f "$xxx" && eval $libscheck
4994                 $test -f "$xxx" && libstyle=static
4995             fi
4996             if $test -f "$xxx"; then
4997                 case "$libstyle" in
4998                 shared) echo "Found -l$thislib (shared)." ;;
4999                 static) echo "Found -l$thislib." ;;
5000                 *)      echo "Found -l$thislib ($libstyle)." ;;
5001                 esac
5002                 case " $dflt " in
5003                 *"-l$thislib "*);;
5004                 *) dflt="$dflt -l$thislib"
5005                    libsfound="$libsfound $xxx"
5006                    yyy=`basename $xxx`
5007                    libsfiles="$libsfiles $yyy"
5008                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5009                    case " $libsdirs " in
5010                    *" $yyy "*) ;;
5011                    *) libsdirs="$libsdirs $yyy" ;;
5012                    esac
5013                    ;;
5014                 esac
5015                 break
5016             fi
5017         done
5018         if $test ! -f "$xxx"; then
5019             echo "No -l$thislib."
5020         fi
5021 done
5022 set X $dflt
5023 shift
5024 dflt="$*"
5025 case "$libs" in
5026 '') dflt="$dflt";;
5027 *) dflt="$libs";;
5028 esac
5029 case "$dflt" in
5030 ' '|'') dflt='none';;
5031 esac
5032
5033 $cat <<EOM
5034
5035 In order to compile $package on your machine, a number of libraries
5036 are usually needed.  Include any other special libraries here as well.
5037 Say "none" for none.  The default list is almost always right.
5038 EOM
5039
5040 echo " "
5041 rp="What libraries to use?"
5042 . ./myread
5043 case "$ans" in
5044 none) libs=' ';;
5045 *) libs="$ans";;
5046 esac
5047
5048 : determine optimization, if desired, or use for debug flag also
5049 case "$optimize" in
5050 ' '|$undef) dflt='none';;
5051 '') dflt='-O';;
5052 *) dflt="$optimize";;
5053 esac
5054 $cat <<EOH
5055
5056 By default, $package compiles with the -O flag to use the optimizer.
5057 Alternately, you might want to use the symbolic debugger, which uses
5058 the -g flag (on traditional Unix systems).  Either flag can be
5059 specified here.  To use neither flag, specify the word "none".
5060
5061 EOH
5062 rp="What optimizer/debugger flag should be used?"
5063 . ./myread
5064 optimize="$ans"
5065 case "$optimize" in
5066 'none') optimize=" ";;
5067 esac
5068
5069 : Check what DEBUGGING is required from the command line
5070 : -DEBUGGING      or -DDEBUGGING or
5071 : -DEBUGGING=both                       = -g + -DDEBUGGING
5072 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5073 : -DEBUGGING=none or -UDEBUGGING        =
5074 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5075 case "$EBUGGING" in
5076 '')     ;;
5077 *)      DEBUGGING=$EBUGGING ;;
5078 esac
5079
5080 case "$DEBUGGING" in
5081 -g|both|$define)
5082     case "$optimize" in
5083         *-g*) ;;
5084         *)    optimize="$optimize -g" ;;
5085     esac ;;
5086 none|$undef)
5087     case "$optimize" in
5088         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5089                 shift
5090                 optimize="$*"
5091                 ;;
5092     esac ;;
5093 esac
5094
5095 dflt=''
5096 case "$DEBUGGING" in
5097 both|$define) dflt='-DDEBUGGING'
5098 esac
5099
5100 : argument order is deliberate, as the flag will start with - which set could
5101 : think is an option
5102 checkccflag='check=$1; flag=$2; callback=$3;
5103 echo " ";
5104 echo "Checking if your compiler accepts $flag" 2>&1;
5105 echo "int main(void) { return 0; }" > gcctest.c;
5106 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5107     echo "Yes, it does." 2>&1;
5108     if $test -s gcctest.out ; then
5109         echo "But your platform does not like it:";
5110         cat gcctest.out;
5111     else
5112         case "$ccflags" in
5113         *$check*)
5114             echo "Leaving current flags $ccflags alone." 2>&1
5115             ;;
5116         *) dflt="$dflt $flag";
5117             eval $callback
5118             ;;
5119         esac
5120     fi
5121 else
5122     echo "Nope, it does not, but that is ok." 2>&1;
5123 fi
5124 '
5125
5126 : We will not override a previous value, but we might want to
5127 : augment a hint file
5128 case "$hint" in
5129 default|recommended)
5130         case "$gccversion" in
5131         1*) dflt="$dflt -fpcc-struct-return" ;;
5132         esac
5133         case "$optimize:$DEBUGGING" in
5134         *-g*:old) dflt="$dflt -DDEBUGGING";;
5135         esac
5136         case "$gccversion" in
5137         2*) if $test -d /etc/conf/kconfig.d &&
5138                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5139                 then
5140                         # Interactive Systems (ISC) POSIX mode.
5141                         dflt="$dflt -posix"
5142                 fi
5143                 ;;
5144         esac
5145         case "$gccversion" in
5146         1*) ;;
5147         2.[0-8]*) ;;
5148         ?*)     set strict-aliasing -fno-strict-aliasing
5149                 eval $checkccflag
5150                 ;;
5151         esac
5152         # For gcc, adding -pipe speeds up compilations for some, but apparently
5153         # some assemblers can't read from stdin.  (It also slows down compilations
5154         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5155         case "$gccversion" in
5156         ?*)     set pipe -pipe
5157                 eval $checkccflag
5158                 ;;
5159         esac
5160
5161         # on x86_64 (at least) we require an extra library (libssp) in the
5162         # link command line. This library is not named, so I infer that it is
5163         # an implementation detail that may change. Hence the safest approach
5164         # is to add the flag to the flags passed to the compiler at link time,
5165         # as that way the compiler can do the right implementation dependant
5166         # thing. (NWC)
5167         case "$gccversion" in
5168         ?*)     set stack-protector -fstack-protector
5169                 eval $checkccflag
5170                 ;;
5171         esac
5172         ;;
5173 esac
5174
5175 case "$mips_type" in
5176 *BSD*|'') inclwanted="$locincpth $usrinc";;
5177 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5178 esac
5179 for thisincl in $inclwanted; do
5180         if $test -d $thisincl; then
5181                 if $test x$thisincl != x$usrinc; then
5182                         case "$dflt" in
5183                         *" -I$thisincl "*);;
5184                         *) dflt="$dflt -I$thisincl ";;
5185                         esac
5186                 fi
5187         fi
5188 done
5189
5190 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5191         xxx=true;
5192 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5193         xxx=true;
5194 else
5195         xxx=false;
5196 fi;
5197 if $xxx; then
5198         case "$dflt" in
5199         *$2*);;
5200         *) dflt="$dflt -D$2";;
5201         esac;
5202 fi'
5203
5204 set signal.h LANGUAGE_C; eval $inctest
5205
5206 case "$usesocks" in
5207 $define)
5208         ccflags="$ccflags -DSOCKS"
5209         ;;
5210 esac
5211
5212 case "$hint" in
5213 default|recommended) dflt="$ccflags $dflt" ;;
5214 *) dflt="$ccflags";;
5215 esac
5216
5217 case "$dflt" in
5218 ''|' ') dflt=none;;
5219 esac
5220
5221 $cat <<EOH
5222
5223 Your C compiler may want other flags.  For this question you should include
5224 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5225 but you should NOT include libraries or ld flags like -lwhatever.  If you
5226 want $package to honor its debug switch, you should include -DDEBUGGING here.
5227 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5228
5229 To use no flags, specify the word "none".
5230
5231 EOH
5232 set X $dflt
5233 shift
5234 dflt=${1+"$@"}
5235 rp="Any additional cc flags?"
5236 . ./myread
5237 case "$ans" in
5238 none) ccflags='';;
5239 *) ccflags="$ans";;
5240 esac
5241
5242 : the following weeds options from ccflags that are of no interest to cpp
5243 case "$cppflags" in
5244 '') cppflags="$ccflags" ;;
5245 *)  cppflags="$cppflags $ccflags" ;;
5246 esac
5247 case "$gccversion" in
5248 1*) cppflags="$cppflags -D__GNUC__"
5249 esac
5250 case "$mips_type" in
5251 '');;
5252 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5253 esac
5254 case "$cppflags" in
5255 '');;
5256 *)
5257         echo " "
5258         echo "Let me guess what the preprocessor flags are..." >&4
5259         set X $cppflags
5260         shift
5261         cppflags=''
5262         $cat >cpp.c <<'EOM'
5263 #define BLURFL foo
5264
5265 BLURFL xx LFRULB
5266 EOM
5267         previous=''
5268         for flag in $*
5269         do
5270                 case "$flag" in
5271                 -*) ftry="$flag";;
5272                 *) ftry="$previous $flag";;
5273                 esac
5274                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5275                         >cpp1.out 2>/dev/null && \
5276                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5277                         >cpp2.out 2>/dev/null && \
5278                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5279                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5280                 then
5281                         cppflags="$cppflags $ftry"
5282                         previous=''
5283                 else
5284                         previous="$flag"
5285                 fi
5286         done
5287         set X $cppflags
5288         shift
5289         cppflags=${1+"$@"}
5290         case "$cppflags" in
5291         *-*)  echo "They appear to be: $cppflags";;
5292         esac
5293         $rm -f cpp.c cpp?.out
5294         ;;
5295 esac
5296
5297 : flags used in final linking phase
5298 case "$ldflags" in
5299 '') if ./venix; then
5300                 dflt='-i -z'
5301         else
5302                 dflt=''
5303         fi
5304         case "$ccflags" in
5305         *-posix*) dflt="$dflt -posix" ;;
5306         esac
5307         ;;
5308 *) dflt="$ldflags";;
5309 esac
5310 # See note above about -fstack-protector
5311 case "$ccflags" in
5312 *-fstack-protector*) 
5313         case "$dflt" in
5314         *-fstack-protector*) ;; # Don't add it again
5315         *) dflt="$dflt -fstack-protector" ;; 
5316         esac
5317         ;;
5318 esac
5319
5320 : Try to guess additional flags to pick up local libraries.
5321 for thislibdir in $libpth; do
5322         case " $loclibpth " in
5323         *" $thislibdir "*)
5324                 case "$dflt " in
5325                 *"-L$thislibdir "*) ;;
5326                 *)  dflt="$dflt -L$thislibdir" ;;
5327                 esac
5328                 ;;
5329         esac
5330 done
5331
5332 case "$dflt" in
5333 '') dflt='none' ;;
5334 esac
5335
5336 $cat <<EOH
5337
5338 Your C linker may need flags.  For this question you should
5339 include -L/whatever and any other flags used by the C linker, but you
5340 should NOT include libraries like -lwhatever.
5341
5342 Make sure you include the appropriate -L/path flags if your C linker
5343 does not normally search all of the directories you specified above,
5344 namely
5345         $libpth
5346 To use no flags, specify the word "none".
5347
5348 EOH
5349
5350 rp="Any additional ld flags (NOT including libraries)?"
5351 . ./myread
5352 case "$ans" in
5353 none) ldflags='';;
5354 *) ldflags="$ans";;
5355 esac
5356 rmlist="$rmlist pdp11"
5357
5358 : coherency check
5359 echo " "
5360 echo "Checking your choice of C compiler and flags for coherency..." >&4
5361 $cat > try.c <<'EOF'
5362 #include <stdio.h>
5363 int main() { printf("Ok\n"); return(0); }
5364 EOF
5365 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5366 shift
5367 $cat >try.msg <<'EOM'
5368 I've tried to compile and run the following simple program:
5369
5370 EOM
5371 $cat try.c >> try.msg
5372
5373 $cat >> try.msg <<EOM
5374
5375 I used the command:
5376
5377         $*
5378         $run ./try
5379
5380 and I got the following output:
5381
5382 EOM
5383 dflt=y
5384 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5385         if $sh -c "$run ./try " >>try.msg 2>&1; then
5386                 xxx=`$run ./try`
5387                 case "$xxx" in
5388                 "Ok") dflt=n ;;
5389                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5390                         case " $libs " in
5391                         *" -lsfio "*)
5392                                 cat >> try.msg <<'EOQS'
5393 If $libs contains -lsfio, and sfio is mis-configured, then it
5394 sometimes (apparently) runs and exits with a 0 status, but with no
5395 output!  It may have to do with sfio's use of _exit vs. exit.
5396
5397 EOQS
5398                                 rp="You have a big problem.  Shall I abort Configure"
5399                                 dflt=y
5400                                 ;;
5401                         esac
5402                         ;;
5403                 esac
5404         else
5405                 echo "The program compiled OK, but exited with status $?." >>try.msg
5406                 rp="You have a problem.  Shall I abort Configure"
5407                 dflt=y
5408         fi
5409 else
5410         echo "I can't compile the test program." >>try.msg
5411         rp="You have a BIG problem.  Shall I abort Configure"
5412         dflt=y
5413 fi
5414 case "$dflt" in
5415 y)
5416         $cat try.msg >&4
5417         case "$knowitall" in
5418         '')
5419                 echo "(The supplied flags or libraries might be incorrect.)"
5420                 ;;
5421         *) dflt=n;;
5422         esac
5423         echo " "
5424         . ./myread
5425         case "$ans" in
5426         n*|N*) ;;
5427         *)      echo "Ok.  Stopping Configure." >&4
5428                 exit 1
5429                 ;;
5430         esac
5431         ;;
5432 n) echo "OK, that should do.";;
5433 esac
5434 $rm_try gcctest gcctest.out
5435
5436 : define a shorthand compile call
5437 compile='
5438 mc_file=$1;
5439 shift;
5440 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5441 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5442 exit 1;
5443 fi;
5444 esac;
5445 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5446 : define a shorthand compile call for compilations that should be ok.
5447 compile_ok='
5448 mc_file=$1;
5449 shift;
5450 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5451
5452 : determine filename position in cpp output
5453 echo " "
5454 echo "Computing filename position in cpp output for #include directives..." >&4
5455 case "$osname" in
5456 vos) testaccess=-e ;;
5457 *)   testaccess=-r ;;
5458 esac
5459 echo '#include <stdio.h>' > foo.c
5460 $cat >fieldn <<EOF
5461 $startsh
5462 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5463 $grep '^[       ]*#.*stdio\.h' | \
5464 while read cline; do
5465         pos=1
5466         set \$cline
5467         while $test \$# -gt 0; do
5468                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5469                         echo "\$pos"
5470                         exit 0
5471                 fi
5472                 shift
5473                 pos=\`expr \$pos + 1\`
5474         done
5475 done
5476 EOF
5477 chmod +x fieldn
5478 fieldn=`./fieldn`
5479 $rm -f foo.c fieldn
5480 case $fieldn in
5481 '') pos='???';;
5482 1) pos=first;;
5483 2) pos=second;;
5484 3) pos=third;;
5485 *) pos="${fieldn}th";;
5486 esac
5487 echo "Your cpp writes the filename in the $pos field of the line."
5488
5489 case "$osname" in
5490 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5491 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5492 *)   cppfilter='' ;;
5493 esac
5494 : locate header file
5495 $cat >findhdr <<EOF
5496 $startsh
5497 wanted=\$1
5498 name=''
5499 for usrincdir in $usrinc
5500 do
5501         if test -f \$usrincdir/\$wanted; then
5502                 echo "\$usrincdir/\$wanted"
5503                 exit 0
5504         fi
5505 done
5506 awkprg='{ print \$$fieldn }'
5507 echo "#include <\$wanted>" > foo\$\$.c
5508 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5509 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5510 while read cline; do
5511         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5512         case "\$name" in
5513         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5514         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5515         *) exit 2;;
5516         esac;
5517 done;
5518 #
5519 # status = 0: grep returned 0 lines, case statement not executed
5520 # status = 1: headerfile found
5521 # status = 2: while loop executed, no headerfile found
5522 #
5523 status=\$?
5524 $rm -f foo\$\$.c;
5525 if test \$status -eq 1; then
5526         exit 0;
5527 fi
5528 exit 1
5529 EOF
5530 chmod +x findhdr
5531
5532 : define an alternate in-header-list? function
5533 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5534 cont=true; xxf="echo \"<\$1> found.\" >&4";
5535 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5536 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5537 esac;
5538 case $# in 4) instead=instead;; *) instead="at last";; esac;
5539 while $test "$cont"; do
5540         xxx=`./findhdr $1`
5541         var=$2; eval "was=\$$2";
5542         if $test "$xxx" && $test -r "$xxx";
5543         then eval $xxf;
5544         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5545                 cont="";
5546         else eval $xxnf;
5547         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5548         set $yyy; shift; shift; yyy=$@;
5549         case $# in 0) cont="";;
5550         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5551                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5552         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5553                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5554         esac;
5555 done;
5556 while $test "$yyy";
5557 do set $yyy; var=$2; eval "was=\$$2";
5558         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5559         set $yyy; shift; shift; yyy=$@;
5560 done'
5561
5562 : see if stdlib is available
5563 set stdlib.h i_stdlib
5564 eval $inhdr
5565
5566 : check for lengths of integral types
5567 echo " "
5568 case "$intsize" in
5569 '')
5570         echo "Checking to see how big your integers are..." >&4
5571         $cat >try.c <<EOCP
5572 #include <stdio.h>
5573 #$i_stdlib I_STDLIB
5574 #ifdef I_STDLIB
5575 #include <stdlib.h>
5576 #endif
5577 int main()
5578 {
5579         printf("intsize=%d;\n", (int)sizeof(int));
5580         printf("longsize=%d;\n", (int)sizeof(long));
5581         printf("shortsize=%d;\n", (int)sizeof(short));
5582         exit(0);
5583 }
5584 EOCP
5585         set try
5586         if eval $compile_ok && $run ./try > /dev/null; then
5587                 eval `$run ./try`
5588                 echo "Your integers are $intsize bytes long."
5589                 echo "Your long integers are $longsize bytes long."
5590                 echo "Your short integers are $shortsize bytes long."
5591         else
5592                 $cat >&4 <<EOM
5593 !
5594 Help! I can't compile and run the intsize test program: please enlighten me!
5595 (This is probably a misconfiguration in your system or libraries, and
5596 you really ought to fix it.  Still, I'll try anyway.)
5597 !
5598 EOM
5599                 dflt=4
5600                 rp="What is the size of an integer (in bytes)?"
5601                 . ./myread
5602                 intsize="$ans"
5603                 dflt=$intsize
5604                 rp="What is the size of a long integer (in bytes)?"
5605                 . ./myread
5606                 longsize="$ans"
5607                 dflt=2
5608                 rp="What is the size of a short integer (in bytes)?"
5609                 . ./myread
5610                 shortsize="$ans"
5611         fi
5612         ;;
5613 esac
5614 $rm_try
5615
5616 : check for long long
5617 echo " "
5618 echo "Checking to see if you have long long..." >&4
5619 echo 'int main() { long long x = 7; return 0; }' > try.c
5620 set try
5621 if eval $compile; then
5622         val="$define"
5623         echo "You have long long."
5624 else
5625         val="$undef"
5626         echo "You do not have long long."
5627 fi
5628 $rm_try
5629 set d_longlong
5630 eval $setvar
5631
5632 : check for length of long long
5633 case "${d_longlong}${longlongsize}" in
5634 $define)
5635         echo " "
5636         echo "Checking to see how big your long longs are..." >&4
5637         $cat >try.c <<'EOCP'
5638 #include <stdio.h>
5639 int main()
5640 {
5641     printf("%d\n", (int)sizeof(long long));
5642     return(0);
5643 }
5644 EOCP
5645         set try
5646         if eval $compile_ok; then
5647                 longlongsize=`$run ./try`
5648                 echo "Your long longs are $longlongsize bytes long."
5649         else
5650                 dflt='8'
5651                 echo " "
5652                 echo "(I can't seem to compile the test program.  Guessing...)"
5653                 rp="What is the size of a long long (in bytes)?"
5654                 . ./myread
5655                 longlongsize="$ans"
5656         fi
5657         if $test "X$longsize" = "X$longlongsize"; then
5658                 echo "(That isn't any different from an ordinary long.)"
5659         fi
5660         ;;
5661 esac
5662 $rm_try
5663
5664 : see if inttypes.h is available
5665 : we want a real compile instead of Inhdr because some systems
5666 : have an inttypes.h which includes non-existent headers
5667 echo " "
5668 $cat >try.c <<EOCP
5669 #include <inttypes.h>
5670 int main() {
5671         static int32_t foo32 = 0x12345678;
5672 }
5673 EOCP
5674 set try
5675 if eval $compile; then
5676         echo "<inttypes.h> found." >&4
5677         val="$define"
5678 else
5679         echo "<inttypes.h> NOT found." >&4
5680         val="$undef"
5681 fi
5682 $rm_try
5683 set i_inttypes
5684 eval $setvar
5685
5686 : check for int64_t
5687 echo " "
5688 echo "Checking to see if you have int64_t..." >&4
5689 $cat >try.c <<EOCP
5690 #include <sys/types.h>
5691 #$i_inttypes I_INTTYPES
5692 #ifdef I_INTTYPES
5693 #include <inttypes.h>
5694 #endif
5695 int main() { int64_t x = 7; }
5696 EOCP
5697 set try
5698 if eval $compile; then
5699         val="$define"
5700         echo "You have int64_t."
5701 else
5702         val="$undef"
5703         echo "You do not have int64_t."
5704 fi
5705 $rm_try
5706 set d_int64_t
5707 eval $setvar
5708
5709 : Check if 64bit ints have a quad type
5710 echo " "
5711 echo "Checking which 64-bit integer type we could use..." >&4
5712
5713 case "$intsize" in
5714 8) val=int
5715    set quadtype
5716    eval $setvar
5717    val='"unsigned int"'
5718    set uquadtype
5719    eval $setvar
5720    quadkind=1
5721    ;;
5722 *) case "$longsize" in
5723    8) val=long
5724       set quadtype
5725       eval $setvar
5726       val='"unsigned long"'
5727       set uquadtype
5728       eval $setvar
5729       quadkind=2
5730       ;;
5731    *) case "$d_longlong:$longlongsize" in
5732       define:8)
5733         val='"long long"'
5734         set quadtype
5735         eval $setvar
5736         val='"unsigned long long"'
5737         set uquadtype
5738         eval $setvar
5739         quadkind=3
5740         ;;
5741       *) case "$d_int64_t" in
5742          define)
5743            val=int64_t
5744            set quadtype
5745            eval $setvar
5746            val=uint64_t
5747            set uquadtype
5748            eval $setvar
5749            quadkind=4
5750            ;;
5751          esac
5752          ;;
5753       esac
5754       ;;
5755    esac
5756    ;;
5757 esac
5758
5759 case "$quadtype" in
5760 '')     echo "Alas, no 64-bit integer types in sight." >&4
5761         d_quad="$undef"
5762         ;;
5763 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5764         d_quad="$define"
5765         ;;
5766 esac
5767
5768 : Do we want 64bit support
5769 case "$uselonglong" in
5770 "$define"|true|[yY]*)
5771         cat <<EOM >&4
5772
5773 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5774 EOM
5775         use64bitint="$define"
5776         ;;
5777 esac
5778 case "$use64bits" in
5779 "$define"|true|[yY]*)
5780         cat <<EOM >&4
5781
5782 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5783 EOM
5784         use64bitint="$define"
5785         ;;
5786 esac
5787 case "$use64bitints" in
5788 "$define"|true|[yY]*)
5789         cat <<EOM >&4
5790
5791 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5792 EOM
5793         use64bitint="$define"
5794         ;;
5795 esac
5796 case "$use64bitsint" in
5797 "$define"|true|[yY]*)
5798         cat <<EOM >&4
5799
5800 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5801 EOM
5802         use64bitint="$define"
5803         ;;
5804 esac
5805 case "$uselonglongs" in
5806 "$define"|true|[yY]*)
5807         cat <<EOM >&4
5808
5809 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5810 EOM
5811         use64bitint="$define"
5812         ;;
5813 esac
5814 case "$use64bitsall" in
5815 "$define"|true|[yY]*)
5816         cat <<EOM >&4
5817
5818 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5819 EOM
5820         use64bitall="$define"
5821         ;;
5822 esac
5823
5824 case "$ccflags" in
5825 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5826 esac
5827 case "$use64bitall" in
5828 "$define"|true|[yY]*) use64bitint="$define" ;;
5829 esac
5830
5831 case "$longsize" in
5832 8) cat <<EOM
5833
5834 You have natively 64-bit long integers.
5835 EOM
5836    val="$define"
5837    ;;
5838 *) case "$use64bitint" in
5839    "$define"|true|[yY]*) dflt='y';;
5840    *) dflt='n';;
5841    esac
5842    case "$d_quad" in
5843    "$define") ;;
5844    *) dflt='n' ;;
5845    esac
5846    cat <<EOM
5847
5848 Perl can be built to take advantage of 64-bit integer types
5849 on some systems.  To do so, Configure can be run with -Duse64bitint.
5850 Choosing this option will most probably introduce binary incompatibilities.
5851
5852 If this doesn't make any sense to you, just accept the default '$dflt'.
5853 (The default has been chosen based on your configuration.)
5854 EOM
5855    rp='Try to use 64-bit integers, if available?'
5856    . ./myread
5857    case "$ans" in
5858    [yY]*) val="$define" ;;
5859    *)     val="$undef"  ;;
5860    esac
5861    ;;
5862 esac
5863 set use64bitint
5864 eval $setvar
5865
5866 case "$use64bitall" in
5867 "$define"|true|[yY]*) dflt='y' ;;
5868 *) case "$longsize" in
5869    8) dflt='y' ;;
5870    *) dflt='n' ;;
5871    esac
5872    ;;
5873 esac
5874 cat <<EOM
5875
5876 You may also choose to try maximal 64-bitness.  It means using as much
5877 64-bitness as possible on the platform.  This in turn means even more
5878 binary incompatibilities.  On the other hand, your platform may not
5879 have any more 64-bitness available than what you already have chosen.
5880
5881 If this doesn't make any sense to you, just accept the default '$dflt'.
5882 (The default has been chosen based on your configuration.)
5883 EOM
5884 rp='Try to use maximal 64-bit support, if available?'
5885 . ./myread
5886 case "$ans" in
5887 [yY]*) val="$define" ;;
5888 *)     val="$undef"  ;;
5889 esac
5890 set use64bitall
5891 eval $setvar
5892 case "$use64bitall" in
5893 "$define")
5894         case "$use64bitint" in
5895         "$undef")
5896                 cat <<EOM
5897
5898 Since you have chosen a maximally 64-bit build, I'm also turning on
5899 the use of 64-bit integers.
5900 EOM
5901                 use64bitint="$define" ;;
5902         esac
5903         ;;
5904 esac
5905
5906 : Look for a hint-file generated 'call-back-unit'.  If the
5907 : user has specified that a 64-bit perl is to be built,
5908 : we may need to set or change some other defaults.
5909 if $test -f use64bitint.cbu; then
5910         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5911         . ./use64bitint.cbu
5912 fi
5913 case "$use64bitint" in
5914 "$define"|true|[yY]*)
5915         case "$longsize" in
5916         4) case "$archname64" in
5917            '') archname64=64int ;;
5918            esac
5919            ;;
5920         esac
5921         ;;
5922 esac
5923
5924 : Look for a hint-file generated 'call-back-unit'.  If the
5925 : user has specified that a maximally 64-bit perl is to be built,
5926 : we may need to set or change some other defaults.
5927 if $test -f use64bitall.cbu; then
5928         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5929         . ./use64bitall.cbu
5930 fi
5931 case "$use64bitall" in
5932 "$define"|true|[yY]*)
5933         case "$longsize" in
5934         4) case "$archname64" in
5935            ''|64int) archname64=64all ;;
5936            esac
5937            ;;
5938         esac
5939         ;;
5940 esac
5941
5942 case "$d_quad:$use64bitint" in
5943 $undef:$define)
5944         cat >&4 <<EOF
5945
5946 *** You have chosen to use 64-bit integers,
5947 *** but none can be found.
5948 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5949 *** Cannot continue, aborting.
5950
5951 EOF
5952         exit 1
5953         ;;
5954 esac
5955
5956 : check for length of double
5957 echo " "
5958 case "$doublesize" in
5959 '')
5960         echo "Checking to see how big your double precision numbers are..." >&4
5961         $cat >try.c <<EOCP
5962 #include <stdio.h>
5963 #$i_stdlib I_STDLIB
5964 #ifdef I_STDLIB
5965 #include <stdlib.h>
5966 #endif
5967 int main()
5968 {
5969     printf("%d\n", (int)sizeof(double));
5970     exit(0);
5971 }
5972 EOCP
5973         set try
5974         if eval $compile_ok; then
5975                 doublesize=`$run ./try`
5976                 echo "Your double is $doublesize bytes long."
5977         else
5978                 dflt='8'
5979                 echo "(I can't seem to compile the test program.  Guessing...)"
5980                 rp="What is the size of a double precision number (in bytes)?"
5981                 . ./myread
5982                 doublesize="$ans"
5983         fi
5984         ;;
5985 esac
5986 $rm_try
5987
5988 : check for long doubles
5989 echo " "
5990 echo "Checking to see if you have long double..." >&4
5991 echo 'int main() { long double x = 7.0; }' > try.c
5992 set try
5993 if eval $compile; then
5994         val="$define"
5995         echo "You have long double."
5996 else
5997         val="$undef"
5998         echo "You do not have long double."
5999 fi
6000 $rm_try
6001 set d_longdbl
6002 eval $setvar
6003
6004 : check for length of long double
6005 case "${d_longdbl}${longdblsize}" in
6006 $define)
6007         echo " "
6008         echo "Checking to see how big your long doubles are..." >&4
6009         $cat >try.c <<'EOCP'
6010 #include <stdio.h>
6011 int main()
6012 {
6013         printf("%d\n", sizeof(long double));
6014 }
6015 EOCP
6016         set try
6017         set try
6018         if eval $compile; then
6019                 longdblsize=`$run ./try`
6020                 echo "Your long doubles are $longdblsize bytes long."
6021         else
6022                 dflt='8'
6023                 echo " "
6024                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6025                 rp="What is the size of a long double (in bytes)?"
6026                 . ./myread
6027                 longdblsize="$ans"
6028         fi
6029         if $test "X$doublesize" = "X$longdblsize"; then
6030                 echo "That isn't any different from an ordinary double."
6031                 echo "I'll keep your setting anyway, but you may see some"
6032                 echo "harmless compilation warnings."
6033         fi
6034         ;;
6035 esac
6036 $rm_try
6037
6038 : determine the architecture name
6039 echo " "
6040 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6041         tarch=`arch`"-$osname"
6042 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6043         if uname -m > tmparch 2>&1 ; then
6044                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6045                         -e 's/$/'"-$osname/" tmparch`
6046         else
6047                 tarch="$osname"
6048         fi
6049         $rm -f tmparch
6050 else
6051         tarch="$osname"
6052 fi
6053 case "$myarchname" in
6054 ''|"$tarch") ;;
6055 *)
6056         echo "(Your architecture name used to be $myarchname.)"
6057         archname=''
6058         ;;
6059 esac
6060 case "$targetarch" in
6061 '') ;;
6062 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6063 esac
6064 myarchname="$tarch"
6065 case "$archname" in
6066 '') dflt="$tarch";;
6067 *) dflt="$archname";;
6068 esac
6069 rp='What is your architecture name'
6070 . ./myread
6071 archname="$ans"
6072 case "$usethreads" in
6073 $define)
6074         echo "Threads selected." >&4
6075         case "$archname" in
6076         *-thread*) echo "...and architecture name already has -thread." >&4
6077                 ;;
6078         *)      archname="$archname-thread"
6079                 echo "...setting architecture name to $archname." >&4
6080                 ;;
6081         esac
6082         ;;
6083 esac
6084 case "$usemultiplicity" in
6085 $define)
6086         echo "Multiplicity selected." >&4
6087         case "$archname" in
6088         *-multi*) echo "...and architecture name already has -multi." >&4
6089                 ;;
6090         *)      archname="$archname-multi"
6091                 echo "...setting architecture name to $archname." >&4
6092                 ;;
6093         esac
6094         ;;
6095 esac
6096 case "$use64bitint$use64bitall" in
6097 *"$define"*)
6098         case "$archname64" in
6099         '')
6100                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6101                 ;;
6102         *)
6103                 case "$use64bitint" in
6104                 "$define") echo "64 bit integers selected." >&4 ;;
6105                 esac
6106                 case "$use64bitall" in
6107                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6108                 esac
6109                 case "$archname" in
6110                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6111                         ;;
6112                 *)      archname="$archname-$archname64"
6113                         echo "...setting architecture name to $archname." >&4
6114                         ;;
6115                 esac
6116                 ;;
6117         esac
6118 esac
6119 case "$uselongdouble" in
6120 $define)
6121         echo "Long doubles selected." >&4
6122         case "$longdblsize" in
6123         $doublesize)
6124                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6125                 ;;
6126         *)
6127                 case "$archname" in
6128                 *-ld*) echo "...and architecture name already has -ld." >&4
6129                         ;;
6130                 *)      archname="$archname-ld"
6131                         echo "...setting architecture name to $archname." >&4
6132                         ;;
6133                 esac
6134                 ;;
6135         esac
6136         ;;
6137 esac
6138 case "$useperlio" in
6139 $define)
6140         echo "Perlio selected." >&4
6141         ;;
6142 *)
6143         echo "Perlio not selected, using stdio." >&4
6144         case "$archname" in
6145         *-stdio*) echo "...and architecture name already has -stdio." >&4
6146                 ;;
6147         *)      archname="$archname-stdio"
6148                 echo "...setting architecture name to $archname." >&4
6149                 ;;
6150         esac
6151         ;;
6152 esac
6153 if $test -f archname.cbu; then
6154         echo "Your platform has some specific hints for architecture name, using them..."
6155         . ./archname.cbu
6156 fi
6157
6158 : set the prefixit variable, to compute a suitable default value
6159 prefixit='case "$3" in
6160 ""|none)
6161         case "$oldprefix" in
6162         "") eval "$1=\"\$$2\"";;
6163         *)
6164                 case "$3" in
6165                 "") eval "$1=";;
6166                 none)
6167                         eval "tp=\"\$$2\"";
6168                         case "$tp" in
6169                         ""|" ") eval "$1=\"\$$2\"";;
6170                         *) eval "$1=";;
6171                         esac;;
6172                 esac;;
6173         esac;;
6174 *)
6175         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6176         case "$tp" in
6177         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6178         /*-$oldprefix/*|\~*-$oldprefix/*)
6179                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6180         *) eval "$1=\"\$$2\"";;
6181         esac;;
6182 esac'
6183
6184 : determine installation style
6185 : For now, try to deduce it from prefix unless it is already set.
6186 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6187 case "$installstyle" in
6188 '')     case "$prefix" in
6189                 *perl*) dflt='lib';;
6190                 *) dflt='lib/perl5' ;;
6191         esac
6192         ;;
6193 *)      dflt="$installstyle" ;;
6194 esac
6195 : Probably not worth prompting for this since we prompt for all
6196 : the directories individually, and the prompt would be too long and
6197 : confusing anyway.
6198 installstyle=$dflt
6199
6200 : determine where public executables go
6201 echo " "
6202 set dflt bin bin
6203 eval $prefixit
6204 fn=d~
6205 rp='Pathname where the public executables will reside?'
6206 . ./getfile
6207 if $test "X$ansexp" != "X$binexp"; then
6208         installbin=''
6209 fi
6210 prefixvar=bin
6211 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6212 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6213 :     this via initialinstalllocation
6214 . ./setprefixvar
6215
6216 case "$userelocatableinc" in
6217 $define|true|[yY]*)     dflt='y' ;;
6218 *)                      dflt='n' ;;
6219 esac
6220 cat <<EOM
6221
6222 Would you like to build Perl so that the installation is relocatable, so that
6223 library paths in @INC are determined relative to the path of the perl binary?
6224 This is not advised for system Perl installs, or if you need to run setid
6225 scripts or scripts under taint mode.
6226
6227 If this doesn't make any sense to you, just accept the default '$dflt'.
6228 EOM
6229 rp='Use relocatable @INC?'
6230 . ./myread
6231 case "$ans" in
6232 y|Y)    val="$define" ;;
6233 *)      val="$undef"  ;;
6234 esac
6235 set userelocatableinc
6236 eval $setvar
6237
6238 initialinstalllocation="$binexp"
6239 : Default prefix is now "up one level from where the binaries are"
6240 case "$userelocatableinc" in
6241 $define|true|[yY]*)
6242     bin=".../"
6243     binexp=".../"
6244     prefix=".../.."
6245     prefixexp=".../.."
6246     installprefixexp=".../.."
6247     ;;
6248 esac
6249
6250 : determine where private library files go
6251 : Usual default is /usr/local/lib/perl5/$version.
6252 : Also allow things like /opt/perl/lib/$version, since
6253 : /opt/perl/lib/perl5... would be redundant.
6254 : The default "style" setting is made in installstyle.U
6255 case "$installstyle" in
6256 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6257 *)       set dflt privlib lib/$version ;;
6258 esac
6259 eval $prefixit
6260 $cat <<EOM
6261
6262 There are some auxiliary files for $package that need to be put into a
6263 private library directory that is accessible by everyone.
6264
6265 EOM
6266 fn=$binexp
6267 fn=d~+
6268 rp='Pathname where the private library files will reside?'
6269 . ./getfile
6270 prefixvar=privlib
6271 . ./setprefixvar
6272
6273 : set the prefixup variable, to restore leading tilda escape
6274 prefixup='case "$prefixexp" in
6275 "$prefix") ;;
6276 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6277 esac'
6278
6279 : determine where public architecture dependent libraries go
6280 set archlib archlib
6281 eval $prefixit
6282 : privlib default is /usr/local/lib/$package/$version
6283 : archlib default is /usr/local/lib/$package/$version/$archname
6284 : privlib may have an optional trailing /share.
6285 tdflt=`echo $privlib | $sed 's,/share$,,'`
6286 tdflt=$tdflt/$archname
6287 case "$archlib" in
6288 '')     dflt=$tdflt
6289         ;;
6290 *)      dflt="$archlib"
6291     ;;
6292 esac
6293 $cat <<EOM
6294
6295 $spackage contains architecture-dependent library files.  If you are
6296 sharing libraries in a heterogeneous environment, you might store
6297 these files in a separate location.  Otherwise, you can just include
6298 them with the rest of the public library files.
6299
6300 EOM
6301 fn=$binexp
6302 fn=d+~
6303 rp='Where do you want to put the public architecture-dependent libraries?'
6304 . ./getfile
6305 prefixvar=archlib
6306 . ./setprefixvar
6307 if $test X"$archlib" = X"$privlib"; then
6308         d_archlib="$undef"
6309 else
6310         d_archlib="$define"
6311 fi
6312
6313 : see if setuid scripts can be secure
6314 $cat <<EOM
6315
6316 Some kernels have a bug that prevents setuid #! scripts from being
6317 secure.  Some sites have disabled setuid #! scripts because of this.
6318
6319 First let's decide if your kernel supports secure setuid #! scripts.
6320 (If setuid #! scripts would be secure but have been disabled anyway,
6321 don't say that they are secure if asked.)
6322
6323 EOM
6324
6325 val="$undef"
6326 if $test -d /dev/fd; then
6327         echo "#!$ls" >reflect
6328         chmod +x,u+s reflect
6329         ./reflect >flect 2>&1
6330         if $contains "/dev/fd" flect >/dev/null; then
6331                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6332                 val="$define"
6333         else
6334                 $cat <<EOM
6335 If you are not sure if they are secure, I can check but I'll need a
6336 username and password different from the one you are using right now.
6337 If you don't have such a username or don't want me to test, simply
6338 enter 'none'.
6339
6340 EOM
6341                 rp='Other username to test security of setuid scripts with?'
6342                 dflt='none'
6343                 . ./myread
6344                 case "$ans" in
6345                 n|none)
6346                         case "$d_suidsafe" in
6347                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6348                                 dflt=n;;
6349                         "$undef")
6350                                 echo "Well, the $hint value is *not* secure." >&4
6351                                 dflt=n;;
6352                         *)      echo "Well, the $hint value *is* secure." >&4
6353                                 dflt=y;;
6354                         esac
6355                         ;;
6356                 *)
6357                         $rm -f reflect flect
6358                         echo "#!$ls" >reflect
6359                         chmod +x,u+s reflect
6360                         echo >flect
6361                         chmod a+w flect
6362                         echo '"su" will (probably) prompt you for '"$ans's password."
6363                         su $ans -c './reflect >flect'
6364                         if $contains "/dev/fd" flect >/dev/null; then
6365                                 echo "Okay, it looks like setuid scripts are secure." >&4
6366                                 dflt=y
6367                         else
6368                                 echo "I don't think setuid scripts are secure." >&4
6369                                 dflt=n
6370                         fi
6371                         ;;
6372                 esac
6373                 rp='Does your kernel have *secure* setuid scripts?'
6374                 . ./myread
6375                 case "$ans" in
6376                 [yY]*)  val="$define";;
6377                 *)      val="$undef";;
6378                 esac
6379         fi
6380 else
6381         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6382         echo "(That's for file descriptors, not floppy disks.)"
6383         val="$undef"
6384 fi
6385 set d_suidsafe
6386 eval $setvar
6387
6388 $rm -f reflect flect
6389
6390 : now see if they want to do setuid emulation
6391 if $test $patchlevel -lt 11; then
6392 echo " "
6393 val="$undef"
6394 case "$d_suidsafe" in
6395 "$define")
6396         val="$undef"
6397         echo "No need to emulate SUID scripts since they are secure here." >&4
6398         ;;
6399 *)
6400         $cat <<EOM
6401 Some systems have disabled setuid scripts, especially systems where
6402 setuid scripts cannot be secure.  On systems where setuid scripts have
6403 been disabled, the setuid/setgid bits on scripts are currently
6404 useless.  It is possible for $package to detect those bits and emulate
6405 setuid/setgid in a secure fashion.  This emulation will only work if
6406 setuid scripts have been disabled in your kernel.
6407
6408 EOM
6409         case "$d_dosuid" in
6410         "$define") dflt=y ;;
6411         *) dflt=n ;;
6412         esac
6413         rp="Do you want to do setuid/setgid emulation?"
6414         . ./myread
6415         case "$ans" in
6416         [yY]*)  val="$define";;
6417         *)      val="$undef";;
6418         esac
6419         ;;
6420 esac
6421 set d_dosuid
6422 eval $setvar
6423 else
6424     case "$d_dosuid" in
6425         "$define")
6426         cat >&4 <<EOH
6427
6428 SUID emulation has been removed for 5.12
6429 Please re-run Configure without -Dd_dosuid
6430
6431 EOH
6432         exit 1;
6433         ;;
6434     esac
6435     d_dosuid=undef
6436 fi
6437
6438 : Find perl5.005 or later.
6439 echo "Looking for a previously installed perl5.005 or later... "
6440 case "$perl5" in
6441 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6442                 : Check if this perl is recent and can load a simple module
6443                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6444                         perl5=$tdir/perl
6445                         break;
6446                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6447                         perl5=$tdir/perl5
6448                         break;
6449                 fi
6450         done
6451         ;;
6452 *)      perl5="$perl5"
6453         ;;
6454 esac
6455 case "$perl5" in
6456 '')     echo "None found.  That's ok.";;
6457 *)      echo "Using $perl5." ;;
6458 esac
6459
6460 : Set the siteprefix variables
6461 $cat <<EOM
6462
6463 After $package is installed, you may wish to install various
6464 add-on modules and utilities.  Typically, these add-ons will
6465 be installed under $prefix with the rest
6466 of this package.  However, you may wish to install such add-ons
6467 elsewhere under a different prefix.
6468
6469 If you do not wish to put everything under a single prefix, that's
6470 ok.  You will be prompted for the individual locations; this siteprefix
6471 is only used to suggest the defaults.
6472
6473 The default should be fine for most people.
6474
6475 EOM
6476 fn=d~+
6477 rp='Installation prefix to use for add-on modules and utilities?'
6478 : XXX Here might be another good place for an installstyle setting.
6479 case "$siteprefix" in
6480 '') dflt=$prefix ;;
6481 *)  dflt=$siteprefix ;;
6482 esac
6483 . ./getfile
6484 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6485 oldsiteprefix=''
6486 case "$siteprefix" in
6487 '') ;;
6488 *)      case "$ans" in
6489         "$prefix") ;;
6490         *) oldsiteprefix="$prefix";;
6491         esac
6492         ;;
6493 esac
6494 siteprefix="$ans"
6495 siteprefixexp="$ansexp"
6496
6497 : determine where site specific libraries go.
6498 : Usual default is /usr/local/lib/perl5/site_perl/$version
6499 : The default "style" setting is made in installstyle.U
6500 : XXX No longer works with Prefixit stuff.
6501 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6502 case "$sitelib" in
6503 '') case "$installstyle" in
6504         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6505         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6506         esac
6507         ;;
6508 *)      dflt="$sitelib"
6509         ;;
6510 esac
6511 $cat <<EOM
6512
6513 The installation process will create a directory for
6514 site-specific extensions and modules.  Most users find it convenient
6515 to place all site-specific files in this directory rather than in the
6516 main distribution directory.
6517
6518 EOM
6519 fn=d~+
6520 rp='Pathname for the site-specific library files?'
6521 . ./getfile
6522 prefixvar=sitelib
6523 . ./setprefixvar
6524 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6525
6526 : Determine list of previous versions to include in @INC
6527 $cat > getverlist <<EOPL
6528 #!$perl5 -w
6529 use File::Basename;
6530 \$api_versionstring = "$api_versionstring";
6531 \$version = "$version";
6532 \$stem = "$sitelib_stem";
6533 \$archname = "$archname";
6534 EOPL
6535         $cat >> getverlist <<'EOPL'
6536 # The list found is store twice for each entry: the original name, and
6537 # the binary broken down version as pack "sss", so sorting is easy and
6538 # unambiguous. This will work for all versions that have a maximum of
6539 # three digit groups, separate by '.'s or '_'s. Names are extended with
6540 # ".0.0" to ensure at least three elements for the pack.
6541 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6542
6543 # Can't have leading @ because metaconfig interprets it as a command!
6544 ;@inc_version_list=();
6545 # XXX Redo to do opendir/readdir?
6546 if (-d $stem) {
6547     chdir($stem);
6548     ;@candidates = map {
6549         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6550     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6551 }
6552 else {
6553     ;@candidates = ();
6554 }
6555
6556 ($pversion, $aversion, $vsn5005) = map {
6557     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6558 foreach $d (@candidates) {
6559     if ($d->[1] lt $pversion) {
6560         if ($d->[1] ge $aversion) {
6561             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6562         }
6563         elsif ($d->[1] ge $vsn5005) {
6564             unshift(@inc_version_list, grep { -d } $d->[0]);
6565         }
6566     }
6567     else {
6568         # Skip newer version.  I.e. don't look in
6569         # 5.7.0 if we're installing 5.6.1.
6570     }
6571 }
6572
6573 if (@inc_version_list) {
6574     print join(' ', @inc_version_list);
6575 }
6576 else {
6577     # Blank space to preserve value for next Configure run.
6578     print " ";
6579 }
6580 EOPL
6581 chmod +x getverlist
6582 case "$inc_version_list" in
6583 '')     if test -x "$perl5$exe_ext"; then
6584                 dflt=`$perl5 getverlist`
6585         else
6586                 dflt='none'
6587         fi
6588         ;;
6589 $undef) dflt='none' ;;
6590 *)  eval dflt=\"$inc_version_list\" ;;
6591 esac
6592 case "$dflt" in
6593 ''|' ') dflt=none ;;
6594 esac
6595 case "$dflt" in
6596 5.005) dflt=none ;;
6597 esac
6598 $cat <<EOM
6599
6600 In order to ease the process of upgrading, this version of perl
6601 can be configured to use modules built and installed with earlier
6602 versions of perl that were installed under $prefix.  Specify here
6603 the list of earlier versions that this version of perl should check.
6604 If Configure detected no earlier versions of perl installed under
6605 $prefix, then the list will be empty.  Answer 'none' to tell perl
6606 to not search earlier versions.
6607
6608 The default should almost always be sensible, so if you're not sure,
6609 just accept the default.
6610 EOM
6611
6612 rp='List of earlier versions to include in @INC?'
6613 . ./myread
6614 case "$ans" in
6615 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6616 *) inc_version_list="$ans" ;;
6617 esac
6618 case "$inc_version_list" in
6619 ''|' ')
6620         inc_version_list_init='0'
6621         d_inc_version_list="$undef"
6622         ;;
6623 *)      inc_version_list_init=`echo $inc_version_list |
6624                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6625         d_inc_version_list="$define"
6626         ;;
6627 esac
6628 $rm -f getverlist
6629
6630 : see if malloc/malloc.h has to be included
6631 set malloc/malloc.h i_mallocmalloc
6632 eval $inhdr
6633
6634 : see if this is a malloc.h system
6635 : we want a real compile instead of Inhdr because some systems have a
6636 : malloc.h that just gives a compile error saying to use stdlib.h instead
6637 echo " "
6638 $cat >try.c <<EOCP
6639 #include <stdlib.h>
6640 #include <malloc.h>
6641 #$i_mallocmalloc I_MALLOCMALLOC
6642 #ifdef I_MALLOCMALLOC
6643 # include <malloc/malloc.h>
6644 #endif
6645
6646 int main () { return 0; }
6647 EOCP
6648 set try
6649 if eval $compile; then
6650     echo "<malloc.h> found." >&4
6651     val="$define"
6652 else
6653     echo "<malloc.h> NOT found." >&4
6654     val="$undef"
6655 fi
6656 $rm_try
6657 set i_malloc
6658 eval $setvar
6659
6660 : check for void type
6661 echo " "
6662 echo "Checking to see how well your C compiler groks the void type..." >&4
6663 case "$voidflags" in
6664 '')
6665         $cat >try.c <<EOCP
6666 #$i_stdlib I_STDLIB
6667 #ifdef I_STDLIB
6668 #include <stdlib.h>
6669 #endif
6670 #if TRY & 1
6671 void sub() {
6672 #else
6673 sub() {
6674 #endif
6675         extern void moo();      /* function returning void */
6676         void (*goo)();          /* ptr to func returning void */
6677 #if TRY & 8
6678         void *hue;              /* generic ptr */
6679 #endif
6680 #if TRY & 2
6681         void (*foo[10])();
6682 #endif
6683
6684 #if TRY & 4
6685         if(goo == moo) {
6686                 exit(0);
6687         }
6688 #endif
6689         exit(0);
6690 }
6691 int main() { sub(); }
6692 EOCP
6693         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6694                 voidflags=$defvoidused
6695         echo "Good.  It appears to support void to the level $package wants.">&4
6696                 if $contains warning .out >/dev/null 2>&1; then
6697                         echo "However, you might get some warnings that look like this:"
6698                         $cat .out
6699                 fi
6700         else
6701 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6702                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6703                         echo "It supports 1..."
6704                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6705                                 echo "It also supports 2..."
6706                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6707                                         voidflags=7
6708                                         echo "And it supports 4 but not 8 definitely."
6709                                 else
6710                                         echo "It doesn't support 4..."
6711                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6712                                                 voidflags=11
6713                                                 echo "But it supports 8."
6714                                         else
6715                                                 voidflags=3
6716                                                 echo "Neither does it support 8."
6717                                         fi
6718                                 fi
6719                         else
6720                                 echo "It does not support 2..."
6721                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6722                                         voidflags=13
6723                                         echo "But it supports 4 and 8."
6724                                 else
6725                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6726                                                 voidflags=5
6727                                                 echo "And it supports 4 but has not heard about 8."
6728                                         else
6729                                                 echo "However it supports 8 but not 4."
6730                                         fi
6731                                 fi
6732                         fi
6733                 else
6734                         echo "There is no support at all for void."
6735                         voidflags=0
6736                 fi
6737         fi
6738 esac
6739 case "$voidflags" in
6740 "$defvoidused") ;;
6741 *)      $cat >&4 <<'EOM'
6742   Support flag bits are:
6743     1: basic void declarations.
6744     2: arrays of pointers to functions returning void.
6745     4: operations between pointers to and addresses of void functions.
6746     8: generic void pointers.
6747 EOM
6748         dflt="$voidflags";
6749         rp="Your void support flags add up to what?"
6750         . ./myread
6751         voidflags="$ans"
6752         ;;
6753 esac
6754 $rm_try
6755
6756 : check for length of pointer
6757 echo " "
6758 case "$ptrsize" in
6759 '')
6760         echo "Checking to see how big your pointers are..." >&4
6761         if test "$voidflags" -gt 7; then
6762                 echo '#define VOID_PTR char *' > try.c
6763         else
6764                 echo '#define VOID_PTR void *' > try.c
6765         fi
6766         $cat >>try.c <<EOCP
6767 #include <stdio.h>
6768 #$i_stdlib I_STDLIB
6769 #ifdef I_STDLIB
6770 #include <stdlib.h>
6771 #endif
6772 int main()
6773 {
6774     printf("%d\n", (int)sizeof(VOID_PTR));
6775     exit(0);
6776 }
6777 EOCP
6778         set try
6779         if eval $compile_ok; then
6780                 ptrsize=`$run ./try`
6781                 echo "Your pointers are $ptrsize bytes long."
6782         else
6783                 dflt='4'
6784                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6785                 rp="What is the size of a pointer (in bytes)?"
6786                 . ./myread
6787                 ptrsize="$ans"
6788         fi
6789         ;;
6790 esac
6791 $rm_try
6792 case "$use64bitall" in
6793 "$define"|true|[yY]*)
6794         case "$ptrsize" in
6795         4)      cat <<EOM >&4
6796
6797 *** You have chosen a maximally 64-bit build,
6798 *** but your pointers are only 4 bytes wide.
6799 *** Please rerun Configure without -Duse64bitall.
6800 EOM
6801                 case "$d_quad" in
6802                 define)
6803                         cat <<EOM >&4
6804 *** Since you have quads, you could possibly try with -Duse64bitint.
6805 EOM
6806                         ;;
6807                 esac
6808                 cat <<EOM >&4
6809 *** Cannot continue, aborting.
6810
6811 EOM
6812
6813                 exit 1
6814                 ;;
6815         esac
6816         ;;
6817 esac
6818
6819
6820 : determine whether to use malloc wrapping
6821 echo " "
6822 case "$usemallocwrap" in
6823 [yY]*|true|$define)     dflt='y' ;;
6824 [nN]*|false|$undef)     dflt='n' ;;
6825 *)      case "$usedevel" in
6826         [yY]*|true|$define)     dflt='y' ;;
6827         *) dflt='n' ;;
6828         esac
6829         ;;
6830 esac
6831 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6832 . ./myread
6833 usemallocwrap="$ans"
6834 case "$ans" in
6835 y*|true)
6836         usemallocwrap="$define" ;;
6837 *)
6838         usemallocwrap="$undef" ;;
6839 esac
6840
6841 : determine which malloc to compile in
6842 echo " "
6843 case "$usemymalloc" in
6844 [yY]*|true|$define)     dflt='y' ;;
6845 [nN]*|false|$undef)     dflt='n' ;;
6846 *)      case "$ptrsize" in
6847         4) dflt='y' ;;
6848         *) dflt='n' ;;
6849         esac
6850         ;;
6851 esac
6852 rp="Do you wish to attempt to use the malloc that comes with $package?"
6853 . ./myread
6854 usemymalloc="$ans"
6855 case "$ans" in
6856 y*|true)
6857         usemymalloc='y'
6858         mallocsrc='malloc.c'
6859         mallocobj="malloc$_o"
6860         d_mymalloc="$define"
6861         case "$libs" in
6862         *-lmalloc*)
6863                 : Remove malloc from list of libraries to use
6864                 echo "Removing unneeded -lmalloc from library list" >&4
6865                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6866                 shift
6867                 libs="$*"
6868                 echo "libs = $libs" >&4
6869                 ;;
6870         esac
6871         ;;
6872 *)
6873         usemymalloc='n'
6874         mallocsrc=''
6875         mallocobj=''
6876         d_mymalloc="$undef"
6877         ;;
6878 esac
6879
6880 : compute the return types of malloc and free
6881 echo " "
6882 $cat >malloc.c <<END
6883 #$i_malloc I_MALLOC
6884 #$i_stdlib I_STDLIB
6885 #include <stdio.h>
6886 #include <sys/types.h>
6887 #ifdef I_MALLOC
6888 #include <malloc.h>
6889 #endif
6890 #ifdef I_STDLIB
6891 #include <stdlib.h>
6892 #endif
6893 #ifdef TRY_MALLOC
6894 void *malloc();
6895 #endif
6896 #ifdef TRY_FREE
6897 void free();
6898 #endif
6899 END
6900 case "$malloctype" in
6901 '')
6902         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6903                 malloctype='void *'
6904         else
6905                 malloctype='char *'
6906         fi
6907         ;;
6908 esac
6909 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6910
6911 case "$freetype" in
6912 '')
6913         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6914                 freetype='void'
6915         else
6916                 freetype='int'
6917         fi
6918         ;;
6919 esac
6920 echo "Your system uses $freetype free(), it would seem." >&4
6921 $rm -f malloc.[co]
6922 : determine where site specific architecture-dependent libraries go.
6923 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6924 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6925 : sitelib may have an optional trailing /share.
6926 case "$sitearch" in
6927 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6928         dflt="$dflt/$archname"
6929         ;;
6930 *)      dflt="$sitearch"
6931         ;;
6932 esac
6933 set sitearch sitearch none
6934 eval $prefixit
6935 $cat <<EOM
6936
6937 The installation process will also create a directory for
6938 architecture-dependent site-specific extensions and modules.
6939
6940 EOM
6941 fn=d~+
6942 rp='Pathname for the site-specific architecture-dependent library files?'
6943 . ./getfile
6944 prefixvar=sitearch
6945 . ./setprefixvar
6946 if $test X"$sitearch" = X"$sitelib"; then
6947         d_sitearch="$undef"
6948 else
6949         d_sitearch="$define"
6950 fi
6951
6952 : Set the vendorprefix variables
6953 $cat <<EOM
6954
6955 The installation process will also create a directory for
6956 vendor-supplied add-ons.  Vendors who supply perl with their system
6957 may find it convenient to place all vendor-supplied files in this
6958 directory rather than in the main distribution directory.  This will
6959 ease upgrades between binary-compatible maintenance versions of perl.
6960
6961 Of course you may also use these directories in whatever way you see
6962 fit.  For example, you might use them to access modules shared over a
6963 company-wide network.
6964
6965 The default answer should be fine for most people.
6966 This causes further questions about vendor add-ons to be skipped
6967 and no vendor-specific directories will be configured for perl.
6968
6969 EOM
6970 rp='Do you want to configure vendor-specific add-on directories?'
6971 case "$usevendorprefix" in
6972 define|true|[yY]*) dflt=y ;;
6973 *)      : User may have set vendorprefix directly on Configure command line.
6974         case "$vendorprefix" in
6975         ''|' ') dflt=n ;;
6976         *)      dflt=y ;;
6977         esac
6978         ;;
6979 esac
6980 . ./myread
6981 case "$ans" in
6982 [yY]*)  fn=d~+
6983         rp='Installation prefix to use for vendor-supplied add-ons?'
6984         case "$vendorprefix" in
6985         '') dflt='' ;;
6986         *)  dflt=$vendorprefix ;;
6987         esac
6988         . ./getfile
6989         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6990         oldvendorprefix=''
6991         case "$vendorprefix" in
6992         '') ;;
6993         *)      case "$ans" in
6994                 "$prefix") ;;
6995                 *) oldvendorprefix="$prefix";;
6996                 esac
6997                 ;;
6998         esac
6999         usevendorprefix="$define"
7000         vendorprefix="$ans"
7001         vendorprefixexp="$ansexp"
7002         ;;
7003 *)      usevendorprefix="$undef"
7004         vendorprefix=''
7005         vendorprefixexp=''
7006         ;;
7007 esac
7008
7009 : Set the vendorlib variables
7010 case "$vendorprefix" in
7011 '')     d_vendorlib="$undef"
7012         vendorlib=''
7013         vendorlibexp=''
7014         ;;
7015 *)      d_vendorlib="$define"
7016         : determine where vendor-supplied modules go.
7017         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7018         case "$vendorlib" in
7019         '')
7020                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7021                 case "$installstyle" in
7022                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7023                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7024                 esac
7025                 ;;
7026         *)      dflt="$vendorlib"
7027                 ;;
7028         esac
7029         fn=d~+
7030         rp='Pathname for the vendor-supplied library files?'
7031         . ./getfile
7032         vendorlib="$ans"
7033         vendorlibexp="$ansexp"
7034         ;;
7035 esac
7036 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7037 prefixvar=vendorlib
7038 . ./installprefix
7039
7040 : Set the vendorarch variables
7041 case "$vendorprefix" in
7042 '')     d_vendorarch="$undef"
7043         vendorarch=''
7044         vendorarchexp=''
7045         ;;
7046 *)      d_vendorarch="$define"
7047         : determine where vendor-supplied architecture-dependent libraries go.
7048         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7049         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7050         : vendorlib may have an optional trailing /share.
7051         case "$vendorarch" in
7052         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7053                 dflt="$dflt/$archname"
7054                 ;;
7055         *)      dflt="$vendorarch" ;;
7056         esac
7057         fn=d~+
7058         rp='Pathname for vendor-supplied architecture-dependent files?'
7059         . ./getfile
7060         vendorarch="$ans"
7061         vendorarchexp="$ansexp"
7062         ;;
7063 esac
7064 prefixvar=vendorarch
7065 . ./installprefix
7066 if $test X"$vendorarch" = X"$vendorlib"; then
7067         d_vendorarch="$undef"
7068 else
7069         d_vendorarch="$define"
7070 fi
7071
7072 : Final catch-all directories to search
7073 $cat <<EOM
7074
7075 Lastly, you can have perl look in other directories for extensions and
7076 modules in addition to those already specified.
7077 These directories will be searched after 
7078         $sitearch 
7079         $sitelib 
7080 EOM
7081 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7082 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7083 echo ' '
7084 case "$otherlibdirs" in
7085 ''|' ') dflt='none' ;;
7086 *)      dflt="$otherlibdirs" ;;
7087 esac
7088 $cat <<EOM
7089 Enter a colon-separated set of extra paths to include in perl's @INC
7090 search path, or enter 'none' for no extra paths.
7091
7092 EOM
7093
7094 rp='Colon-separated list of additional directories for perl to search?'
7095 . ./myread
7096 case "$ans" in
7097 ' '|''|none)    otherlibdirs=' ' ;;     
7098 *)      otherlibdirs="$ans" ;;
7099 esac
7100 case "$otherlibdirs" in
7101 ' ') val=$undef ;;
7102 *)      val=$define ;;
7103 esac
7104 set d_perl_otherlibdirs
7105 eval $setvar
7106
7107 : Cruising for prototypes
7108 echo " "
7109 echo "Checking out function prototypes..." >&4
7110 $cat >prototype.c <<EOCP
7111 #$i_stdlib I_STDLIB
7112 #ifdef I_STDLIB
7113 #include <stdlib.h>
7114 #endif
7115 int main(int argc, char *argv[]) {
7116         exit(0);}
7117 EOCP
7118 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7119         echo "Your C compiler appears to support function prototypes."
7120         val="$define"
7121 else
7122         echo "Your C compiler doesn't seem to understand function prototypes."
7123         val="$undef"
7124 fi
7125 set prototype
7126 eval $setvar
7127 $rm -f prototype*
7128
7129 : Check if ansi2knr is required
7130 case "$prototype" in
7131 "$define") ;;
7132 *)      ansi2knr='ansi2knr'
7133         echo " "
7134         cat <<EOM >&4
7135
7136 $me:  FATAL ERROR:
7137 This version of $package can only be compiled by a compiler that 
7138 understands function prototypes.  Unfortunately, your C compiler 
7139         $cc $ccflags
7140 doesn't seem to understand them.  Sorry about that.
7141
7142 If GNU cc is available for your system, perhaps you could try that instead.  
7143
7144 Eventually, we hope to support building Perl with pre-ANSI compilers.
7145 If you would like to help in that effort, please contact <perlbug@perl.org>.
7146
7147 Aborting Configure now.
7148 EOM
7149         exit 2
7150         ;;
7151 esac
7152
7153 : DTrace support
7154 dflt_dtrace='/usr/sbin/dtrace'
7155 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7156
7157 cat <<EOM
7158
7159 Perl can be built to support DTrace on platforms that support it.
7160 DTrace is a diagnosis and performance analysis tool from Sun.
7161
7162 If this doesn't make any sense to you, just accept the default '$dflt'.
7163 EOM
7164
7165 while $test 1 ; do
7166         case "$usedtrace" in
7167         $define|true|[yY]*)
7168                 dflt='y'
7169                 ;;
7170         ?*)
7171                 dflt='y'
7172                 dflt_dtrace=$usedtrace
7173                 ;;
7174         *)
7175                 dflt='n'
7176                 ;;
7177         esac
7178
7179         rp='Support DTrace if available?'
7180         . ./myread
7181         case "$ans" in
7182         y|Y)    val="$define" ;;
7183         *)      val="$undef" ;;
7184         esac
7185         set usedtrace
7186         eval $setvar
7187
7188         test "X$usedtrace" != "X$define" && break
7189
7190         echo " "
7191         rp='Where is the dtrace executable?'
7192         dflt=$dflt_dtrace
7193         . ./getfile
7194         val="$ans"
7195         set dtrace
7196         eval $setvar
7197
7198         if $test -f $dtrace
7199         then
7200                 if $dtrace -h -s ../perldtrace.d \
7201                         -o perldtrace.tmp >/dev/null 2>&1 \
7202                         && rm -f perldtrace.tmp
7203                 then
7204                         echo " "
7205                         echo "Good: your $dtrace knows about the -h flag."
7206                 else
7207                         cat >&2 <<EOM
7208
7209 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7210 ***
7211 *** Your installed dtrace doesn't support the -h switch to compile a D
7212 *** program into a C header. Can't continue.
7213
7214 EOM
7215                         exit 1
7216                 fi
7217                 break;
7218         fi
7219
7220         case "$fastread" in
7221         yes)
7222                 cat >&2 <<EOM
7223
7224 *** $me:  Fatal Error:  $dtrace not found.
7225 *** Can't continue.
7226
7227 EOM
7228                 exit 1
7229                 ;;
7230         *)
7231                 echo "*** $dtrace was not found."
7232                 echo " "
7233                 ;;
7234         esac
7235 done
7236
7237 : See if we want extra modules installed
7238 echo " "
7239 case "$extras" in
7240 '') dflt='n';;
7241 *) dflt='y';;
7242 esac
7243 cat <<EOM
7244 Perl can be built with extra modules or bundles of modules which
7245 will be fetched from the CPAN and installed alongside Perl.
7246
7247 Notice that you will need access to the CPAN; either via the Internet,
7248 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7249 be asked later to configure the CPAN.pm module which will in turn do
7250 the installation of the rest of the extra modules or bundles.)
7251
7252 Notice also that if the modules require any external software such as
7253 libraries and headers (the libz library and the zlib.h header for the
7254 Compress::Zlib module, for example) you MUST have any such software
7255 already installed, this configuration process will NOT install such
7256 things for you.
7257
7258 If this doesn't make any sense to you, just accept the default '$dflt'.
7259 EOM
7260 rp='Install any extra modules (y or n)?'
7261 . ./myread
7262 case "$ans" in
7263 y|Y)
7264         cat <<EOM
7265
7266 Please list any extra modules or bundles to be installed from CPAN,
7267 with spaces between the names.  The names can be in any format the
7268 'install' command of CPAN.pm will understand.  (Answer 'none',
7269 without the quotes, to install no extra modules or bundles.)
7270 EOM
7271         rp='Extras?'
7272         dflt="$extras"
7273         . ./myread
7274         extras="$ans"
7275 esac
7276 case "$extras" in
7277 ''|'none')
7278         val=''
7279         $rm -f ../extras.lst
7280         ;;
7281 *)      echo "(Saving the list of extras for later...)"
7282         echo "$extras" > ../extras.lst
7283         val="'$extras'"
7284         ;;
7285 esac
7286 set extras
7287 eval $setvar
7288 echo " "
7289
7290 : determine where html pages for programs go
7291 set html1dir html1dir none
7292 eval $prefixit
7293 $cat <<EOM
7294
7295 If you wish to install html files for programs in $spackage, indicate
7296 the appropriate directory here.  To skip installing html files,
7297 answer "none".
7298 EOM
7299 case "$html1dir" in
7300 ''|none|$undef|' ') dflt=none ;;
7301 *) dflt=$html1dir ;;
7302 esac
7303 fn=dn+~
7304 rp="Directory for the main $spackage html pages?"
7305 . ./getfile
7306 prefixvar=html1dir
7307 . ./setprefixvar
7308 : Use ' ' for none so value is preserved next time through Configure
7309 $test X"$html1dir" = "X" && html1dir=' '
7310
7311 : determine where html pages for libraries and modules go
7312 set html3dir html3dir none
7313 eval $prefixit
7314 $cat <<EOM
7315
7316 If you wish to install html files for modules associated with $spackage,
7317 indicate the appropriate directory here.  To skip installing html files,
7318 answer "none".
7319 EOM
7320 : There is no obvious default.  If they have specified html1dir, then
7321 : try to key off that, possibly changing .../html1 into .../html3.
7322 case "$html3dir" in
7323 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7324 *) dflt=$html3dir ;;
7325 esac
7326 fn=dn+~
7327 rp="Directory for the $spackage module html pages?"
7328 . ./getfile
7329 prefixvar=html3dir
7330 . ./setprefixvar
7331 : Use ' ' for none so value is preserved next time through Configure
7332 $test X"$html3dir" = "X" && html3dir=' '
7333
7334 : determine whether to install perl also as /usr/bin/perl
7335
7336 echo " "
7337 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7338         $cat <<EOM
7339 Many scripts expect perl to be installed as /usr/bin/perl.
7340
7341 If you want to, I can install the perl you are about to compile
7342 as /usr/bin/perl (in addition to $bin/perl).
7343 EOM
7344         if test -f /usr/bin/perl; then
7345             $cat <<EOM
7346
7347 However, please note that because you already have a /usr/bin/perl,
7348 overwriting that with a new Perl would very probably cause problems.
7349 Therefore I'm assuming you don't want to do that (unless you insist).
7350
7351 EOM
7352             case "$installusrbinperl" in
7353             "$define"|[yY]*)    dflt='y';;
7354             *)                  dflt='n';;
7355             esac
7356         else
7357             $cat <<EOM
7358
7359 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7360
7361 EOM
7362             case "$installusrbinperl" in
7363             "$undef"|[nN]*)     dflt='n';;
7364             *)                  dflt='y';;
7365             esac
7366         fi
7367         rp="Do you want to install perl as /usr/bin/perl?"
7368         . ./myread
7369         case "$ans" in
7370         [yY]*)  val="$define";;
7371         *)      val="$undef" ;;
7372         esac
7373 else
7374         val="$undef"
7375 fi
7376 set installusrbinperl
7377 eval $setvar
7378
7379 : Check if we are using the GNU C library
7380 echo " "
7381 echo "Checking for GNU C Library..." >&4
7382 cat >try.c <<'EOCP'
7383 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7384    alone are insufficient to distinguish different versions, such as
7385    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7386    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7387 */
7388 #include <stdio.h>
7389 int main(void)
7390 {
7391 #ifdef __GLIBC__
7392 #   ifdef __GLIBC_MINOR__
7393 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7394 #           include <gnu/libc-version.h>
7395             printf("%s\n",  gnu_get_libc_version());
7396 #       else
7397             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7398 #       endif
7399 #   else
7400         printf("%d\n",  __GLIBC__);
7401 #   endif
7402     return 0;
7403 #else
7404     return 1;
7405 #endif
7406 }
7407 EOCP
7408 set try
7409 if eval $compile_ok && $run ./try > glibc.ver; then
7410         val="$define"
7411         gnulibc_version=`$cat glibc.ver`
7412         echo "You are using the GNU C Library version $gnulibc_version"
7413 else
7414         val="$undef"
7415         gnulibc_version=''
7416         echo "You are not using the GNU C Library"
7417 fi
7418 $rm_try glibc.ver
7419 set d_gnulibc
7420 eval $setvar
7421
7422 : see if nm is to be used to determine whether a symbol is defined or not
7423 case "$usenm" in
7424 '')
7425         dflt=''
7426         case "$d_gnulibc" in
7427         "$define")
7428                 echo " "
7429                 echo "nm probably won't work on the GNU C Library." >&4
7430                 dflt=n
7431                 ;;
7432         esac
7433         case "$dflt" in
7434         '') 
7435                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7436                         echo " "
7437                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7438                         echo "'nm' won't be sufficient on this sytem." >&4
7439                         dflt=n
7440                 fi
7441                 ;;
7442         esac
7443         case "$dflt" in
7444         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7445                 if $test $dflt -gt 20; then
7446                         dflt=y
7447                 else
7448                         dflt=n
7449                 fi
7450                 ;;
7451         esac
7452         ;;
7453 *)
7454         case "$usenm" in
7455         true|$define) dflt=y;;
7456         *) dflt=n;;
7457         esac
7458         ;;
7459 esac
7460 $cat <<EOM
7461
7462 I can use $nm to extract the symbols from your C libraries. This
7463 is a time consuming task which may generate huge output on the disk (up
7464 to 3 megabytes) but that should make the symbols extraction faster. The
7465 alternative is to skip the 'nm' extraction part and to compile a small
7466 test program instead to determine whether each symbol is present. If
7467 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7468 this may be the best solution.
7469
7470 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7471
7472 EOM
7473 rp="Shall I use $nm to extract C symbols from the libraries?"
7474 . ./myread
7475 case "$ans" in
7476 [Nn]*) usenm=false;;
7477 *) usenm=true;;
7478 esac
7479
7480 runnm=$usenm
7481 case "$reuseval" in
7482 true) runnm=false;;
7483 esac
7484
7485 : nm options which may be necessary
7486 case "$nm_opt" in
7487 '') if $test -f /mach_boot; then
7488                 nm_opt=''       # Mach
7489         elif $test -d /usr/ccs/lib; then
7490                 nm_opt='-p'     # Solaris (and SunOS?)
7491         elif $test -f /dgux; then
7492                 nm_opt='-p'     # DG-UX
7493         elif $test -f /lib64/rld; then
7494                 nm_opt='-p'     # 64-bit Irix
7495         else
7496                 nm_opt=''
7497         fi;;
7498 esac
7499
7500 : nm options which may be necessary for shared libraries but illegal
7501 : for archive libraries.  Thank you, Linux.
7502 case "$nm_so_opt" in
7503 '')     case "$myuname" in
7504         *linux*|gnu*)
7505                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7506                         nm_so_opt='--dynamic'
7507                 fi
7508                 ;;
7509         esac
7510         ;;
7511 esac
7512
7513 : Figure out where the libc is located
7514 case "$runnm" in
7515 true)
7516 : get list of predefined functions in a handy place
7517 echo " "
7518 case "$libc" in
7519 '') libc=unknown
7520         case "$libs" in
7521         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7522         esac
7523         ;;
7524 esac
7525 case "$libs" in
7526 '') ;;
7527 *)  for thislib in $libs; do
7528         case "$thislib" in
7529         -lc|-lc_s)
7530                 : Handle C library specially below.
7531                 ;;
7532         -l*)
7533                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7534                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7535                         :
7536                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7537                         :
7538                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7539                         :
7540                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7541                         :
7542                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7543                         :
7544                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7545                         :
7546                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7547                         :
7548                 else
7549                         try=''
7550                 fi
7551                 libnames="$libnames $try"
7552                 ;;
7553         *) libnames="$libnames $thislib" ;;
7554         esac
7555         done
7556         ;;
7557 esac
7558 xxx=normal
7559 case "$libc" in
7560 unknown)
7561         set /lib/libc.$so
7562         for xxx in $libpth; do
7563                 $test -r $1 || set $xxx/libc.$so
7564                 : The messy sed command sorts on library version numbers.
7565                 $test -r $1 || \
7566                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7567                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7568                                 h
7569                                 s/[0-9][0-9]*/0000&/g
7570                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7571                                 G
7572                                 s/\n/ /' | \
7573                          $sort | $sed -e 's/^.* //'`
7574                 eval set \$$#
7575         done
7576         $test -r $1 || set /usr/ccs/lib/libc.$so
7577         $test -r $1 || set /lib/libsys_s$_a
7578         ;;
7579 *)
7580         set blurfl
7581         ;;
7582 esac
7583 if $test -r "$1"; then
7584         echo "Your (shared) C library seems to be in $1."
7585         libc="$1"
7586 elif $test -r /lib/libc && $test -r /lib/clib; then
7587         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7588         xxx=apollo
7589         libc='/lib/clib /lib/libc'
7590         if $test -r /lib/syslib; then
7591                 echo "(Your math library is in /lib/syslib.)"
7592                 libc="$libc /lib/syslib"
7593         fi
7594 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7595         echo "Your C library seems to be in $libc, as you said before."
7596 elif $test -r $incpath/usr/lib/libc$_a; then
7597         libc=$incpath/usr/lib/libc$_a;
7598         echo "Your C library seems to be in $libc.  That's fine."
7599 elif $test -r /lib/libc$_a; then
7600         libc=/lib/libc$_a;
7601         echo "Your C library seems to be in $libc.  You're normal."
7602 else
7603         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7604                 :
7605         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7606                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7607         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7608                 :
7609         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7610                 :
7611         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7612                 :
7613         else
7614                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7615         fi
7616         if $test -r "$tans"; then
7617                 echo "Your C library seems to be in $tans, of all places."
7618                 libc=$tans
7619         else
7620                 libc='blurfl'
7621         fi
7622 fi
7623 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7624         dflt="$libc"
7625         cat <<EOM
7626
7627 If the guess above is wrong (which it might be if you're using a strange
7628 compiler, or your machine supports multiple models), you can override it here.
7629
7630 EOM
7631 else
7632         dflt=''
7633         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7634         cat >&4 <<EOM
7635 I can't seem to find your C library.  I've looked in the following places:
7636
7637 EOM
7638         $sed 's/^/      /' libpath
7639         cat <<EOM
7640
7641 None of these seems to contain your C library. I need to get its name...
7642
7643 EOM
7644 fi
7645 fn=f
7646 rp='Where is your C library?'
7647 . ./getfile
7648 libc="$ans"
7649
7650 echo " "
7651 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7652 set X `cat libnames`
7653 shift
7654 xxx=files
7655 case $# in 1) xxx=file; esac
7656 echo "Extracting names from the following $xxx for later perusal:" >&4
7657 echo " "
7658 $sed 's/^/      /' libnames >&4
7659 echo " "
7660 $echo $n "This may take a while...$c" >&4
7661
7662 for file in $*; do
7663         case $file in
7664         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7665         *) $nm $nm_opt $file 2>/dev/null;;
7666         esac
7667 done >libc.tmp
7668
7669 $echo $n ".$c"
7670 $grep fprintf libc.tmp > libc.ptf
7671 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7672 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7673 xxx='[ADTSIWi]'
7674 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7675         eval $xscan;\
7676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677                 eval $xrun
7678 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7699                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7700         eval $xscan;\
7701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7702                 eval $xrun
7703 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7704         eval $xscan;\
7705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706                 eval $xrun
7707 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7708         eval $xscan;\
7709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710                 eval $xrun
7711 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7712         eval $xscan;\
7713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714                 eval $xrun
7715 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7716         eval $xscan;\
7717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718                 eval $xrun
7719 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7720         eval $xscan;\
7721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722                 eval $xrun
7723 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7724         eval $xscan;\
7725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726                 eval $xrun
7727 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7728         eval $xscan;\
7729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730                 eval $xrun
7731 else
7732         $nm -p $* 2>/dev/null >libc.tmp
7733         $grep fprintf libc.tmp > libc.ptf
7734         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7735                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7736         then
7737                 nm_opt='-p'
7738                 eval $xrun
7739         else
7740                 echo " "
7741                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7742                 com=''
7743                 if $ar t $libc > libc.tmp && \
7744                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7745                 then
7746                         for thisname in $libnames $libc; do
7747                                 $ar t $thisname >>libc.tmp
7748                         done
7749                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7750                         echo "Ok." >&4
7751                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7752                         for thisname in $libnames $libc; do
7753                                 $ar tv $thisname >>libc.tmp
7754                                 emximp -o tmp.imp $thisname \
7755                                     2>/dev/null && \
7756                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7757                                     < tmp.imp >>libc.tmp
7758                                 $rm -f tmp.imp
7759                         done
7760                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7761                         echo "Ok." >&4
7762                 else
7763                         echo "$ar didn't seem to work right." >&4
7764                         echo "Maybe this is a Cray...trying bld instead..." >&4
7765                         if  bld t $libc | \
7766                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7767                                 $test -s libc.list
7768                         then
7769                                 for thisname in $libnames; do
7770                                         bld t $libnames | \
7771                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7772                                         $ar t $thisname >>libc.tmp
7773                                 done
7774                                 echo "Ok." >&4
7775                         else
7776                                 echo "That didn't work either.  Giving up." >&4
7777                                 exit 1
7778                         fi
7779                 fi
7780         fi
7781 fi
7782 nm_extract="$com"
7783 case "$PASE" in
7784 define)
7785     echo " "
7786     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7787     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7788     ;;
7789 *)  if $test -f /lib/syscalls.exp; then
7790         echo " "
7791         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7792         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7793                 /lib/syscalls.exp >>libc.list
7794     fi
7795     ;;
7796 esac
7797 ;;
7798 esac
7799 $rm -f libnames libpath
7800
7801 : see if dld is available
7802 set dld.h i_dld
7803 eval $inhdr
7804
7805 : Check if we are using C++
7806 echo " "
7807 echo "Checking for C++..." >&4
7808 $cat >try.c <<'EOCP'
7809 #include <stdio.h>
7810 int main(void)
7811 {
7812 #ifdef __cplusplus
7813     return 0;
7814 #else
7815     return 1;
7816 #endif
7817 }
7818 EOCP
7819 set try
7820 if eval $compile_ok && $run ./try; then
7821         val="$define"
7822         echo "You are using a C++ compiler."
7823 else
7824         val="$undef"
7825         echo "You are not using a C++ compiler."
7826 fi
7827 $rm_try cplusplus$$
7828 set d_cplusplus
7829 eval $setvar
7830
7831 : is a C symbol defined?
7832 csym='tlook=$1;
7833 case "$3" in
7834 -v) tf=libc.tmp; tdc="";;
7835 -a) tf=libc.tmp; tdc="[]";;
7836 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7837 esac;
7838 case "$d_cplusplus" in
7839     $define)    extern_C="extern \"C\"" ;;
7840     *)          extern_C="extern"       ;;
7841 esac;
7842 tx=yes;
7843 case "$reuseval-$4" in
7844 true-) ;;
7845 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7846 esac;
7847 case "$tx" in
7848 yes)
7849         tval=false;
7850         if $test "$runnm" = true; then
7851                 if $contains $tlook $tf >/dev/null 2>&1; then
7852                         tval=true;
7853                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7854                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7855                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7856                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7857                         $rm_try;
7858                 fi;
7859         else
7860                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7861                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7862                 $rm_try;
7863         fi;
7864         ;;
7865 *)
7866         case "$tval" in
7867         $define) tval=true;;
7868         *) tval=false;;
7869         esac;
7870         ;;
7871 esac;
7872 eval "$2=$tval"'
7873
7874 : define an is-in-libc? function
7875 inlibc='echo " "; td=$define; tu=$undef;
7876 sym=$1; var=$2; eval "was=\$$2";
7877 tx=yes;
7878 case "$reuseval$was" in
7879 true) ;;
7880 true*) tx=no;;
7881 esac;
7882 case "$tx" in
7883 yes)
7884         set $sym tres -f;
7885         eval $csym;
7886         case "$tres" in
7887         true)
7888                 echo "$sym() found." >&4;
7889                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7890         *)
7891                 echo "$sym() NOT found." >&4;
7892                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7893         esac;;
7894 *)
7895         case "$was" in
7896         $define) echo "$sym() found." >&4;;
7897         *) echo "$sym() NOT found." >&4;;
7898         esac;;
7899 esac'
7900
7901 : see if dlopen exists
7902 xxx_runnm="$runnm"
7903 xxx_ccflags="$ccflags"
7904 runnm=false
7905 : with g++ one needs -shared to get is-in-libc to work for dlopen
7906 case "$gccversion" in
7907 '')     ;;
7908 *)      case "$d_cplusplus" in
7909         "$define") ccflags="$ccflags -shared" ;;
7910         esac
7911         ;;
7912 esac
7913 set dlopen d_dlopen
7914 eval $inlibc
7915 runnm="$xxx_runnm"
7916 ccflags="$xxx_ccflags"
7917
7918 : see if this is a unistd.h system
7919 set unistd.h i_unistd
7920 eval $inhdr
7921
7922 : determine which dynamic loading, if any, to compile in
7923 echo " "
7924 dldir="ext/DynaLoader"
7925 case "$usedl" in
7926 $define|y|true)
7927         dflt='y'
7928         usedl="$define"
7929         ;;
7930 $undef|n|false)
7931         dflt='n'
7932         usedl="$undef"
7933         ;;
7934 *)
7935         dflt='n'
7936         case "$d_dlopen" in
7937             $define) dflt='y' ;;
7938         esac
7939         case "$i_dld" in
7940             $define) dflt='y' ;;
7941         esac
7942         : Does a dl_xxx.xs file exist for this operating system
7943         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7944         ;;
7945 esac
7946 rp="Do you wish to use dynamic loading?"
7947 . ./myread
7948 usedl="$ans"
7949 bin_ELF="$undef"
7950 case "$ans" in
7951 y*) usedl="$define"
7952         case "$dlsrc" in
7953         '')
7954                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7955                         dflt="$dldir/dl_${osname}.xs"
7956                 elif $test "$d_dlopen" = "$define" ; then
7957                         dflt="$dldir/dl_dlopen.xs"
7958                 elif $test "$i_dld" = "$define" ; then
7959                         dflt="$dldir/dl_dld.xs"
7960                 else
7961                         dflt=''
7962                 fi
7963                 ;;
7964         *)      dflt="$dldir/$dlsrc"
7965                 ;;
7966         esac
7967     echo "The following dynamic loading files are available:"
7968         : Can not go over to $dldir because getfile has path hard-coded in.
7969         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7970         rp="Source file to use for dynamic loading"
7971         fn="fne"
7972         gfpth="$src"
7973         . ./getfile
7974         usedl="$define"
7975         : emulate basename
7976         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7977
7978         $cat << EOM
7979
7980 Some systems may require passing special flags to $cc -c to
7981 compile modules that will be used to create a shared library.
7982 To use no flags, say "none".
7983
7984 EOM
7985     case "$cccdlflags" in
7986     '') case "$gccversion" in
7987                 '') case "$osname" in
7988                         hpux)   dflt='+z' ;;
7989                         next)   dflt='none' ;;
7990                         irix*)  dflt='-KPIC' ;;
7991                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7992                         sunos)  dflt='-pic' ;;
7993                         *)      dflt='none' ;;
7994                     esac
7995                         ;;
7996                 *)  case "$osname" in
7997                         darwin) dflt='none' ;;
7998                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7999                         *)      dflt='-fpic' ;;
8000                     esac ;;
8001             esac ;;
8002         ' ') dflt='none' ;;
8003     *)  dflt="$cccdlflags" ;;
8004     esac
8005     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8006     . ./myread
8007     case "$ans" in
8008     none) cccdlflags=' ' ;;
8009     *) cccdlflags="$ans" ;;
8010     esac
8011
8012     cat << EOM
8013
8014 Some systems use ld to create libraries that can be dynamically loaded,
8015 while other systems (such as those using ELF) use $cc.
8016
8017 EOM
8018         case "$ld" in
8019         '')     $cat >try.c <<EOM
8020 /* Test for whether ELF binaries are produced */
8021 #include <fcntl.h>
8022 #$i_stdlib I_STDLIB
8023 #ifdef I_STDLIB
8024 #include <stdlib.h>
8025 #endif
8026 #$i_unistd I_UNISTD
8027 #ifdef I_UNISTD
8028 #include <unistd.h>
8029 #endif
8030 int main() {
8031         char b[4];
8032         int i = open("a.out",O_RDONLY);
8033         if(i == -1)
8034                 exit(1); /* fail */
8035         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8036                 exit(0); /* succeed (yes, it's ELF) */
8037         else
8038                 exit(1); /* fail */
8039 }
8040 EOM
8041                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8042                         cat <<EOM
8043 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8044 EOM
8045                         dflt="$cc"
8046                         bin_ELF="$define"
8047                 else
8048                         echo "I'll use ld to build dynamic libraries."
8049                         dflt='ld'
8050                 fi
8051                 $rm_try
8052                 ;;
8053         *)      dflt="$ld"
8054                 ;;
8055         esac
8056
8057     rp="What command should be used to create dynamic libraries?"
8058     . ./myread
8059         ld="$ans"
8060
8061     cat << EOM
8062
8063 Some systems may require passing special flags to $ld to create a
8064 library that can be dynamically loaded.  If your ld flags include
8065 -L/other/path options to locate libraries outside your loader's normal
8066 search path, you may need to specify those -L options here as well.  To
8067 use no flags, say "none".
8068
8069 EOM
8070     case "$lddlflags" in
8071     '') case "$osname" in
8072                         beos) dflt='-nostart' ;;
8073                         haiku) dflt='-shared' ;;
8074                         hpux) dflt='-b';
8075                               case "$gccversion" in
8076                               '') dflt="$dflt +vnocompatwarnings" ;;
8077                               esac
8078                               ;;
8079                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8080                         next)  dflt='none' ;;
8081                         solaris) dflt='-G' ;;
8082                         sunos) dflt='-assert nodefinitions' ;;
8083                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8084                 *)     dflt='none' ;;
8085                         esac
8086                         ;;
8087     *) dflt="$lddlflags" ;;
8088     esac
8089
8090         : Try to guess additional flags to pick up local libraries.
8091         : Be careful not to append to a plain 'none'
8092         case "$dflt" in
8093         none) dflt='' ;;
8094         esac
8095         for thisflag in $ldflags; do
8096                 case "$thisflag" in
8097                 -L*|-R*|-Wl,-R*)
8098                         case " $dflt " in
8099                         *" $thisflag "*) ;;
8100                         *) dflt="$dflt $thisflag" ;;
8101                         esac
8102                         ;;
8103                 esac
8104         done
8105
8106         case "$dflt" in
8107         ''|' ') dflt='none' ;;
8108         esac
8109
8110         case "$ldflags" in
8111         *-fstack-protector*)
8112             case "$dflt" in
8113                         *-fstack-protector*) ;; # Don't add it again
8114                         *) dflt="$dflt -fstack-protector" ;; 
8115                 esac
8116                 ;;
8117         esac
8118
8119
8120     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8121     . ./myread
8122     case "$ans" in
8123     none) lddlflags=' ' ;;
8124     *) lddlflags="$ans" ;;
8125     esac
8126
8127         cat <<EOM
8128
8129 Some systems may require passing special flags to $cc to indicate that
8130 the resulting executable will use dynamic linking.  To use no flags,
8131 say "none".
8132
8133 EOM
8134     case "$ccdlflags" in
8135     '') case "$osname" in
8136             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8137             next|sunos) dflt='none' ;;
8138             *)          dflt='none' ;;
8139             esac ;;
8140     ' ')  dflt='none' ;;
8141     *)  dflt="$ccdlflags" ;;
8142     esac
8143     rp="Any special flags to pass to $cc to use dynamic linking?"
8144     . ./myread
8145     case "$ans" in
8146     none) ccdlflags=' ' ;;
8147     *) ccdlflags="$ans" ;;
8148     esac
8149     ;;
8150 *)  usedl="$undef"
8151         ld='ld'
8152     dlsrc='dl_none.xs'
8153     lddlflags=''
8154     ccdlflags=''
8155     ;;
8156 esac
8157
8158 : Do we want a shared libperl?
8159 also=''
8160 case "$usedl" in
8161 $undef)
8162         # No dynamic loading being used, so don't bother even to prompt.
8163         useshrplib='false'
8164         ;;
8165 *)      case "$useshrplib" in
8166         '')     case "$osname" in
8167                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8168                         dflt=y
8169                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8170                         ;;
8171                 next*)
8172                         case "$osvers" in
8173                         4*)     dflt=y
8174                                 also='Building a shared libperl is needed for MAB support.'
8175                                 ;;
8176                         *)      dflt=n
8177                                 ;;
8178                         esac
8179                         ;;
8180                 *)      dflt=n
8181                         ;;
8182                 esac
8183                 ;;
8184         $define|true|[Yy]*)
8185                 dflt=y
8186                 ;;
8187         *)      dflt=n
8188                 ;;
8189         esac
8190         $cat << EOM
8191
8192 The perl executable is normally obtained by linking perlmain.c with
8193 libperl${_a}, any static extensions (usually just DynaLoader), and
8194 any other libraries needed on this system (such as -lm, etc.).  Since
8195 your system supports dynamic loading, it is probably possible to build
8196 a shared libperl.$so.  If you will have more than one executable linked
8197 to libperl.$so, this will significantly reduce the size of each
8198 executable, but it may have a noticeable effect on performance.  The
8199 default is probably sensible for your system.
8200 $also
8201
8202 EOM
8203         rp="Build a shared libperl.$so (y/n)"
8204         . ./myread
8205         case "$ans" in
8206         true|$define|[Yy]*)
8207                 useshrplib='true'  ;;
8208         *)      useshrplib='false' ;;
8209         esac
8210         ;;
8211 esac
8212
8213 case "$useshrplib" in
8214 true)
8215         case "$userelocatableinc" in
8216         true|define)
8217                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8218                 echo "See INSTALL for an explanation why that won't work." >&4
8219                 exit 4
8220                 ;;
8221         esac
8222         case "$libperl" in
8223         '')
8224                 # Figure out a good name for libperl.so.  Since it gets stored in
8225                 # a version-specific architecture-dependent library, the version
8226                 # number isn't really that important, except for making cc/ld happy.
8227                 #
8228                 # A name such as libperl.so.10.1
8229                 majmin="libperl.$so.$patchlevel.$subversion"
8230                 # A name such as libperl.so.100
8231                 majonly=`echo $patchlevel $subversion |
8232                         $awk '{printf "%d%02d", $1, $2}'`
8233                 majonly=libperl.$so.$majonly
8234                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8235                 # rely on figuring it out from the naming of libc.
8236                 case "${osname}${osvers}" in
8237                 next4*)
8238                         dflt=libperl.5.$so
8239                         # XXX How handle the --version stuff for MAB?
8240                         ;;
8241                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8242                         dflt=libperl.$so
8243                         ;;
8244                 cygwin*) # ld links now against the dll directly
8245                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8246                         majonly=`echo $patchlevel $subversion |
8247                                 $awk '{printf "%03d%03d", $1, $2}'`
8248                         majonly=cygperl5.$majonly.$so
8249                         dflt=$majmin
8250                         ;;
8251                 *)      # Try to guess based on whether libc has major.minor.
8252                         case "$libc" in
8253                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8254                         *libc.$so.[0-9]*) dflt=$majonly ;;
8255                         *)      dflt=libperl.$so ;;
8256                         esac
8257                         ;;
8258                 esac
8259                 ;;
8260         *)      dflt=$libperl
8261                 ;;
8262         esac
8263         cat << EOM
8264
8265 I need to select a good name for the shared libperl.  If your system uses
8266 library names with major and minor numbers, then you might want something
8267 like $majmin.  Alternatively, if your system uses a single version
8268 number for shared libraries, then you might want to use $majonly.
8269 Or, your system might be quite happy with a simple libperl.$so.
8270
8271 Since the shared libperl will get installed into a version-specific
8272 architecture-dependent directory, the version number of the shared perl
8273 library probably isn't important, so the default should be o.k.
8274
8275 EOM
8276         rp='What name do you want to give to the shared libperl?'
8277         . ./myread
8278         libperl=$ans
8279         echo "Ok, I'll use $libperl"
8280         ;;
8281 *)
8282         libperl="libperl${_a}"
8283         ;;
8284 esac
8285
8286 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8287 case "$shrpdir" in
8288 '') ;;
8289 *)      $cat >&4 <<EOM
8290 WARNING:  Use of the shrpdir variable for the installation location of
8291 the shared $libperl is not supported.  It was never documented and
8292 will not work in this version.  Let me (perlbug@perl.org)
8293 know of any problems this may cause.
8294
8295 EOM
8296         case "$shrpdir" in
8297         "$archlibexp/CORE")
8298                 $cat >&4 <<EOM
8299 But your current setting of $shrpdir is
8300 the default anyway, so it's harmless.
8301 EOM
8302                 ;;
8303         *)
8304                 $cat >&4 <<EOM
8305 Further, your current attempted setting of $shrpdir
8306 conflicts with the value of $archlibexp/CORE
8307 that installperl will use.
8308 EOM
8309                 ;;
8310         esac
8311         ;;
8312 esac
8313
8314 # How will the perl executable find the installed shared $libperl?
8315 # Add $xxx to ccdlflags.
8316 # If we can't figure out a command-line option, use $shrpenv to
8317 # set env LD_RUN_PATH.  The main perl makefile uses this.
8318 shrpdir=$archlibexp/CORE
8319 xxx=''
8320 tmp_shrpenv=''
8321 if "$useshrplib"; then
8322     case "$osname" in
8323         aix)
8324                 # We'll set it in Makefile.SH...
8325                 ;;
8326         solaris)
8327                 xxx="-R $shrpdir"
8328                 ;;
8329         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8330                 xxx="-Wl,-R$shrpdir"
8331                 ;;
8332         bsdos|linux|irix*|dec_osf|gnu*)
8333                 xxx="-Wl,-rpath,$shrpdir"
8334                 ;;
8335         next)
8336                 # next doesn't like the default...
8337                 ;;
8338         beos)
8339                 # beos doesn't like the default, either.
8340                 ;;
8341         haiku)
8342                 # Haiku doesn't like the default, either.
8343                 ;;
8344         hpux*)
8345                 # hpux doesn't like the default, either.
8346                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8347                 ;;
8348         cygwin)
8349                 # cygwin needs only ldlibpth
8350                 ;;
8351         *)
8352                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8353                 ;;
8354         esac
8355         case "$xxx" in
8356         '') ;;
8357         *)
8358                 # Only add $xxx if it isn't already in ccdlflags.
8359                 case " $ccdlflags " in
8360                 *" $xxx "*)     ;;
8361                 *)      ccdlflags="$ccdlflags $xxx"
8362                         cat <<EOM >&4
8363
8364 Adding $xxx to the flags
8365 passed to $ld so that the perl executable will find the
8366 installed shared $libperl.
8367
8368 EOM
8369                         ;;
8370                 esac
8371                 ;;
8372         esac
8373 fi
8374 # Fix ccdlflags in AIX for building external extensions.
8375 # (For building Perl itself bare -bE:perl.exp is needed,
8376 #  Makefile.SH takes care of this.)
8377 case "$osname" in
8378 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8379 esac
8380 # Respect a hint or command-line value.
8381 case "$shrpenv" in
8382 '') shrpenv="$tmp_shrpenv" ;;
8383 esac
8384 case "$ldlibpthname" in
8385 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8386 none)   ldlibpthname='' ;;
8387 esac
8388
8389 : determine where manual pages are on this system
8390 echo " "
8391 case "$sysman" in
8392 '') 
8393         syspath='/usr/share/man/man1 /usr/man/man1'
8394         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8395         syspath="$syspath /usr/man/u_man/man1"
8396         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8397         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8398         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8399         sysman=`./loc . /usr/man/man1 $syspath`
8400         ;;
8401 esac
8402 if $test -d "$sysman"; then
8403         echo "System manual is in $sysman." >&4
8404 else
8405         echo "Could not find manual pages in source form." >&4
8406 fi
8407
8408 : determine where manual pages go
8409 set man1dir man1dir none
8410 eval $prefixit
8411 $cat <<EOM
8412
8413 $spackage has manual pages available in source form.
8414 EOM
8415 case "$nroff" in
8416 nroff)
8417         echo "However, you don't have nroff, so they're probably useless to you."
8418         case "$man1dir" in
8419         '') man1dir="none";;
8420         esac;;
8421 esac
8422 echo "If you don't want the manual sources installed, answer 'none'."
8423 case "$man1dir" in
8424 ' ') dflt=none
8425         ;;
8426 '')
8427         lookpath="$prefixexp/share/man/man1"
8428         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8429         lookpath="$lookpath $prefixexp/man/p_man/man1"
8430         lookpath="$lookpath $prefixexp/man/u_man/man1"
8431         lookpath="$lookpath $prefixexp/man/man.1"
8432         case "$sysman" in
8433         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8434         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8435         esac
8436         set dflt
8437         eval $prefixup
8438         ;;
8439 *)  dflt="$man1dir"
8440         ;;
8441 esac
8442 echo " "
8443 fn=dn+~
8444 rp="Where do the main $spackage manual pages (source) go?"
8445 . ./getfile
8446 if $test "X$man1direxp" != "X$ansexp"; then
8447         installman1dir=''
8448 fi
8449 prefixvar=man1dir
8450 . ./setprefixvar
8451
8452 case "$man1dir" in
8453 '')     man1dir=' '
8454         installman1dir='';;
8455 esac
8456
8457 : What suffix to use on installed man pages
8458
8459 case "$man1dir" in
8460 ' ')
8461         man1ext='0'
8462         ;;
8463 *)
8464         rp="What suffix should be used for the main $spackage man pages?"
8465         case "$man1ext" in
8466         '')     case "$man1dir" in
8467                 *1)  dflt=1 ;;
8468                 *1p) dflt=1p ;;
8469                 *1pm) dflt=1pm ;;
8470                 *l) dflt=l;;
8471                 *n) dflt=n;;
8472                 *o) dflt=o;;
8473                 *p) dflt=p;;
8474                 *C) dflt=C;;
8475                 *L) dflt=L;;
8476                 *L1) dflt=L1;;
8477                 *) dflt=1;;
8478                 esac
8479                 ;;
8480         *)      dflt="$man1ext";;
8481         esac
8482         . ./myread
8483         man1ext="$ans"
8484         ;;
8485 esac
8486
8487 : see if we can have long filenames
8488 echo " "
8489 first=123456789abcdef
8490 $rm -f $first
8491 if (echo hi >$first) 2>/dev/null; then
8492         if $test -f 123456789abcde; then
8493                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8494                 val="$undef"
8495         else
8496                 echo 'You can have filenames longer than 14 characters.'>&4
8497                 val="$define"
8498         fi
8499 else
8500         $cat <<'EOM'
8501 You can't have filenames longer than 14 chars.
8502 You can't even think about them!
8503 EOM
8504         val="$undef"
8505 fi
8506 set d_flexfnam
8507 eval $setvar
8508 $rm -rf 123456789abcde*
8509
8510 : determine where library module manual pages go
8511 set man3dir man3dir none
8512 eval $prefixit
8513 $cat <<EOM
8514
8515 $spackage has manual pages for many of the library modules.
8516 EOM
8517
8518 case "$nroff" in
8519 nroff)
8520         $cat <<'EOM'
8521 However, you don't have nroff, so they're probably useless to you.
8522 EOM
8523         case "$man3dir" in
8524         '') man3dir="none";;
8525         esac;;
8526 esac
8527
8528 case "$d_flexfnam" in
8529 undef)
8530         $cat <<'EOM'
8531 However, your system can't handle the long file names like File::Basename.3.
8532 EOM
8533         case "$man3dir" in
8534         '') man3dir="none";;
8535         esac;;
8536 esac
8537
8538 echo "If you don't want the manual sources installed, answer 'none'."
8539 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8540 case "$man3dir" in
8541 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8542         if $test -d "$privlib/man/man3"; then
8543                 cat <<EOM >&4
8544
8545 WARNING:  Previous versions of perl installed man3 pages into
8546 $privlib/man/man3.  This version will suggest a
8547 new default of $dflt.
8548 EOM
8549                 tdflt=$dflt
8550                 dflt='n'
8551                 rp='Do you wish to preserve the old behavior?(y/n)'
8552                 . ./myread
8553                 case "$ans" in
8554                 y*) dflt="$privlib/man/man3" ;;
8555                 *)  dflt=$tdflt ;;
8556                 esac
8557     fi
8558         ;;
8559 *)      dflt="$man3dir" ;;
8560 esac
8561 case "$dflt" in
8562 ' ') dflt=none ;;
8563 esac
8564 echo " "
8565 fn=dn+~
8566 rp="Where do the $package library man pages (source) go?"
8567 . ./getfile
8568 prefixvar=man3dir
8569 . ./setprefixvar
8570
8571 case "$man3dir" in
8572 '')     man3dir=' '
8573         installman3dir='';;
8574 esac
8575
8576 : What suffix to use on installed man pages
8577 case "$man3dir" in
8578 ' ')
8579         man3ext='0'
8580         ;;
8581 *)
8582         rp="What suffix should be used for the $package library man pages?"
8583         case "$man3ext" in
8584         '')     case "$man3dir" in
8585                 *3)  dflt=3 ;;
8586                 *3p) dflt=3p ;;
8587                 *3pm) dflt=3pm ;;
8588                 *l) dflt=l;;
8589                 *n) dflt=n;;
8590                 *o) dflt=o;;
8591                 *p) dflt=p;;
8592                 *C) dflt=C;;
8593                 *L) dflt=L;;
8594                 *L3) dflt=L3;;
8595                 *) dflt=3;;
8596                 esac
8597                 ;;
8598         *)      dflt="$man3ext";;
8599         esac
8600         . ./myread
8601         man3ext="$ans"
8602         ;;
8603 esac
8604
8605 : see if we have to deal with yellow pages, now NIS.
8606 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8607         if $test -f /usr/etc/nibindd; then
8608                 echo " "
8609                 echo "I'm fairly confident you're on a NeXT."
8610                 echo " "
8611                 rp='Do you get the hosts file via NetInfo?'
8612                 dflt=y
8613                 case "$hostcat" in
8614                 nidump*) ;;
8615                 '') ;;
8616                 *) dflt=n;;
8617                 esac
8618                 . ./myread
8619                 case "$ans" in
8620                 y*) hostcat='nidump hosts .';;
8621                 *)      case "$hostcat" in
8622                         nidump*) hostcat='';;
8623                         esac
8624                         ;;
8625                 esac
8626         fi
8627         case "$hostcat" in
8628         nidump*) ;;
8629         *)
8630                 case "$hostcat" in
8631                 *ypcat*) dflt=y;;
8632                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8633                                 dflt=y
8634                         else
8635                                 dflt=n
8636                         fi;;
8637                 *) dflt=n;;
8638                 esac
8639                 echo " "
8640                 rp='Are you getting the hosts file via yellow pages?'
8641                 . ./myread
8642                 case "$ans" in
8643                 y*) hostcat='ypcat hosts';;
8644                 *) hostcat='cat /etc/hosts';;
8645                 esac
8646                 ;;
8647         esac
8648 fi
8649 case "$hostcat" in
8650 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8651 esac
8652 case "$groupcat" in
8653 '') test -f /etc/group && groupcat='cat /etc/group';;
8654 esac
8655 case "$passcat" in
8656 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8657 esac
8658
8659 : now get the host name
8660 echo " "
8661 echo "Figuring out host name..." >&4
8662 case "$myhostname" in
8663 '') cont=true
8664         echo 'Maybe "hostname" will work...'
8665         if tans=`sh -c hostname 2>&1` ; then
8666                 myhostname=$tans
8667                 phostname=hostname
8668                 cont=''
8669         fi
8670         ;;
8671 *) cont='';;
8672 esac
8673 if $test "$cont"; then
8674         if ./xenix; then
8675                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8676                 if tans=`cat /etc/systemid 2>&1` ; then
8677                         myhostname=$tans
8678                         phostname='cat /etc/systemid'
8679                         echo "Whadyaknow.  Xenix always was a bit strange..."
8680                         cont=''
8681                 fi
8682         elif $test -r /etc/systemid; then
8683                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8684         fi
8685 fi
8686 if $test "$cont"; then
8687         echo 'No, maybe "uuname -l" will work...'
8688         if tans=`sh -c 'uuname -l' 2>&1` ; then
8689                 myhostname=$tans
8690                 phostname='uuname -l'
8691         else
8692                 echo 'Strange.  Maybe "uname -n" will work...'
8693                 if tans=`sh -c 'uname -n' 2>&1` ; then
8694                         myhostname=$tans
8695                         phostname='uname -n'
8696                 else
8697                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8698                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8699                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8700                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8701                         else
8702                                 case "$myhostname" in
8703                                 '') echo "Does this machine have an identity crisis or something?"
8704                                         phostname='';;
8705                                 *)
8706                                         echo "Well, you said $myhostname before..."
8707                                         phostname='echo $myhostname';;
8708                                 esac
8709                         fi
8710                 fi
8711         fi
8712 fi
8713 case "$myhostname" in
8714 '') myhostname=noname ;;
8715 esac
8716 : you do not want to know about this
8717 set $myhostname
8718 myhostname=$1
8719
8720 : verify guess
8721 if $test "$myhostname" ; then
8722         dflt=y
8723         rp='Your host name appears to be "'$myhostname'".'" Right?"
8724         . ./myread
8725         case "$ans" in
8726         y*) ;;
8727         *) myhostname='';;
8728         esac
8729 fi
8730
8731 : bad guess or no guess
8732 while $test "X$myhostname" = X ; do
8733         dflt=''
8734         rp="Please type the (one word) name of your host:"
8735         . ./myread
8736         myhostname="$ans"
8737 done
8738
8739 : translate upper to lower if necessary
8740 case "$myhostname" in
8741 *[A-Z]*)
8742         echo "(Normalizing case in your host name)"
8743         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8744         ;;
8745 esac
8746
8747 case "$myhostname" in
8748 *.*)
8749         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8750         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8751         echo "(Trimming domain name from host name--host name is now $myhostname)"
8752         ;;
8753 *) case "$mydomain" in
8754         '')
8755                 {
8756                         test "X$hostcat" = "Xypcat hosts" &&
8757                         ypmatch "$myhostname" hosts 2>/dev/null |\
8758                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8759                         $test -s hosts
8760                 } || {
8761                         test "X$hostcat" != "X" &&
8762                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8763                                         /[       ]$myhostname[  . ]/p" > hosts
8764                 }
8765                 tmp_re="[       . ]"
8766                 if $test -f hosts; then
8767                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8768                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8769                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8770                                 hosts | $sort | $uniq | \
8771                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8772                         case `$echo X$dflt` in
8773                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8774                                 dflt=.
8775                                 ;;
8776                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8777                                 ;;
8778                         esac
8779                 else
8780                         echo "(I cannot locate a hosts database anywhere)"
8781                         dflt=.
8782                 fi
8783                 case "$dflt" in
8784                 .)
8785                         tans=`./loc resolv.conf X /etc /usr/etc`
8786                         if $test -f "$tans"; then
8787                                 echo "(Attempting domain name extraction from $tans)"
8788                                 dflt=.`$sed -n -e 's/   / /g' \
8789                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8790                                   -e 1q 2>/dev/null`
8791                                 case "$dflt" in
8792                                 .) dflt=.`$sed -n -e 's/        / /g' \
8793                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8794                                      -e 1q 2>/dev/null`
8795                                         ;;
8796                                 esac
8797                         fi
8798                         ;;
8799                 esac
8800                 case "$dflt" in
8801                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8802                         dflt=.`sh -c domainname 2>/dev/null`
8803                         case "$dflt" in
8804                         '') dflt='.';;
8805                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8806                         esac
8807                         ;;
8808                 esac
8809                 case "$dflt$osname" in
8810                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8811                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8812                         ;;
8813                 esac
8814                 case "$dflt" in
8815                 .) echo "(Lost all hope -- silly guess then)"
8816                         dflt='.nonet'
8817                         ;;
8818                 esac
8819                 $rm -f hosts
8820                 ;;
8821         *) dflt="$mydomain";;
8822         esac;;
8823 esac
8824 echo " "
8825 rp="What is your domain name?"
8826 . ./myread
8827 tans="$ans"
8828 case "$ans" in
8829 '') ;;
8830 .*) ;;
8831 *) tans=".$tans";;
8832 esac
8833 mydomain="$tans"
8834
8835 : translate upper to lower if necessary
8836 case "$mydomain" in
8837 *[A-Z]*)
8838         echo "(Normalizing case in your domain name)"
8839         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8840         ;;
8841 esac
8842
8843 : a little sanity check here
8844 case "$phostname" in
8845 '') ;;
8846 *)
8847         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8848         $myhostname$mydomain|$myhostname) ;;
8849         *)
8850                 case "$phostname" in
8851                 sed*)
8852                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8853                         ;;
8854                 *)
8855                         echo "(That doesn't agree with your $phostname command, by the way.)"
8856                         ;;
8857                 esac
8858         ;;
8859         esac
8860         ;;
8861 esac
8862
8863 : determine the e-mail address of the user who is running us
8864 $cat <<EOM
8865
8866 I need to get your e-mail address in Internet format if possible, i.e.
8867 something like user@host.domain. Please answer accurately since I have
8868 no easy means to double check it. The default value provided below
8869 is most probably close to reality but may not be valid from outside
8870 your organization...
8871
8872 EOM
8873 cont=x
8874 while test "$cont"; do
8875         case "$cf_email" in
8876         '') dflt="$cf_by@$myhostname$mydomain";;
8877         *) dflt="$cf_email";;
8878         esac
8879         rp='What is your e-mail address?'
8880         . ./myread
8881         cf_email="$ans"
8882         case "$cf_email" in
8883         *@*.*) cont='' ;;
8884         *)
8885                 rp='Address does not look like an Internet one.  Use it anyway?'
8886                 case "$fastread" in
8887                 yes) dflt=y ;;
8888                 *) dflt=n ;;
8889                 esac
8890                 . ./myread
8891                 case "$ans" in
8892                 y*) cont='' ;;
8893                 *) echo " " ;;
8894                 esac
8895                 ;;
8896         esac
8897 done
8898
8899 : Ask e-mail of administrator
8900 $cat <<EOM
8901
8902 If you or somebody else will be maintaining perl at your site, please
8903 fill in the correct e-mail address here so that they may be contacted
8904 if necessary. Currently, the "perlbug" program included with perl
8905 will send mail to this address in addition to perlbug@perl.org. You may
8906 enter "none" for no administrator.
8907
8908 EOM
8909 case "$perladmin" in
8910 '') dflt="$cf_email";;
8911 *) dflt="$perladmin";;
8912 esac
8913 rp='Perl administrator e-mail address'
8914 . ./myread
8915 perladmin="$ans"
8916
8917 : determine whether to only install version-specific parts.
8918 echo " "
8919 $cat <<EOM
8920 Do you want to install only the version-specific parts of the perl
8921 distribution?  Usually you do *not* want to do this.
8922 EOM
8923 case "$versiononly" in
8924 "$define"|[Yy]*|true) dflt='y' ;;
8925 *) dflt='n';
8926 esac
8927 rp="Do you want to install only the version-specific parts of perl?"
8928 . ./myread
8929 case "$ans" in
8930 [yY]*)  val="$define";;
8931 *)      val="$undef" ;;
8932 esac
8933 set versiononly
8934 eval $setvar
8935
8936 case "$versiononly" in
8937 "$define") inc_version_list=''
8938            inc_version_list_init=0
8939            ;;
8940 esac
8941
8942 : figure out how to guarantee perl startup
8943 : XXX Note that this currently takes advantage of the bug that binexp ignores
8944 :     the Configure -Dinstallprefix setting, which in turn means that under
8945 :     relocatable @INC, initialinstalllocation is what binexp started as.
8946 case "$startperl" in
8947 '')
8948         case "$sharpbang" in
8949         *!)
8950                 $cat <<EOH
8951
8952 I can use the #! construct to start perl on your system. This will
8953 make startup of perl scripts faster, but may cause problems if you
8954 want to share those scripts and perl is not in a standard place
8955 ($initialinstalllocation/perl) on all your platforms. The alternative
8956 is to force a shell by starting the script with a single ':' character.
8957
8958 EOH
8959                 case "$versiononly" in
8960                 "$define")      dflt="$initialinstalllocation/perl$version";;
8961                 *)              dflt="$initialinstalllocation/perl";;
8962                 esac
8963                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8964                 . ./myread
8965                 case "$ans" in
8966                 none)   startperl=": # use perl";;
8967                 *)      startperl="#!$ans"
8968                         if $test 30 -lt `echo "$ans" | wc -c`; then
8969                                 $cat >&4 <<EOM
8970
8971 WARNING:  Some systems limit the #! command to 32 characters.
8972 If you experience difficulty running Perl scripts with #!, try
8973 installing Perl in a directory with a shorter pathname.
8974
8975 EOM
8976                         fi ;;
8977                 esac
8978                 ;;
8979         *) startperl=": # use perl"
8980                 ;;
8981         esac
8982         ;;
8983 esac
8984 echo "I'll use $startperl to start perl scripts."
8985
8986 : figure best path for perl in scripts
8987 case "$perlpath" in
8988 '')
8989         case "$versiononly" in
8990         "$define")      perlpath="$initialinstalllocation/perl$version";;
8991         *)              perlpath="$initialinstalllocation/perl";;
8992         esac
8993         case "$startperl" in
8994         *!*) ;;
8995         *)
8996                 $cat <<EOH
8997
8998 I will use the "eval 'exec'" idiom to start Perl on your system.
8999 I can use the full path of your Perl binary for this purpose, but
9000 doing so may cause problems if you want to share those scripts and
9001 Perl is not always in a standard place ($initialinstalllocation/perl).
9002
9003 EOH
9004                 dflt="$initialinstalllocation/perl"
9005                 rp="What path shall I use in \"eval 'exec'\"?"
9006                 . ./myread
9007                 perlpath="$ans"
9008                 ;;
9009         esac
9010         ;;
9011 esac
9012 case "$startperl" in
9013 *!*)    ;;
9014 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9015 esac
9016
9017 : determine where public executable scripts go
9018 set scriptdir scriptdir
9019 eval $prefixit
9020 case "$scriptdir" in
9021 '')
9022         dflt="$bin"
9023         : guess some guesses
9024         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9025         $test -d /usr/share/bin     && dflt=/usr/share/bin
9026         $test -d /usr/local/script  && dflt=/usr/local/script
9027         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9028         $test -d $prefixexp/script  && dflt=$prefixexp/script
9029         set dflt
9030         eval $prefixup
9031         ;;
9032 *)  dflt="$scriptdir"
9033         ;;
9034 esac
9035 $cat <<EOM
9036
9037 Some installations have a separate directory just for executable scripts so
9038 that they can mount it across multiple architectures but keep the scripts in
9039 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9040 Or you might just lump your scripts in with all your other executables.
9041
9042 EOM
9043 fn=d~
9044 rp='Where do you keep publicly executable scripts?'
9045 . ./getfile
9046 if $test "X$ansexp" != "X$scriptdirexp"; then
9047         installscript=''
9048 fi
9049 installscriptdir=''
9050 prefixvar=scriptdir
9051 . ./setprefixvar
9052 : A little fix up for an irregularly named variable.
9053 installscript="$installscriptdir"
9054
9055 : determine where add-on public executables go
9056 case "$sitebin" in
9057 '')     dflt=$siteprefix/bin ;;
9058 *)      dflt=$sitebin ;;
9059 esac
9060 fn=d~
9061 rp='Pathname where the add-on public executables should be installed?'
9062 . ./getfile
9063 prefixvar=sitebin
9064 . ./setprefixvar
9065
9066 : determine where add-on html pages go
9067 : There is no standard location, so try to copy the previously-selected
9068 : directory structure for the core html pages.
9069 case "$sitehtml1dir" in
9070 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9071 *)     dflt=$sitehtml1dir ;;
9072 esac
9073 case "$dflt" in
9074 ''|' ') dflt=none ;;
9075 esac
9076 fn=dn+~
9077 rp='Pathname where the site-specific html pages should be installed?'
9078 . ./getfile
9079 prefixvar=sitehtml1dir
9080 . ./setprefixvar
9081
9082 : determine where add-on library html pages go
9083 : There is no standard location, so try to copy the previously-selected
9084 : directory structure for the core html pages.
9085 case "$sitehtml3dir" in
9086 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9087 *)     dflt=$sitehtml3dir ;;
9088 esac
9089 case "$dflt" in
9090 ''|' ') dflt=none ;;
9091 esac
9092 fn=dn+~
9093 rp='Pathname where the site-specific library html pages should be installed?'
9094 . ./getfile
9095 prefixvar=sitehtml3dir
9096 . ./setprefixvar
9097
9098 : determine where add-on manual pages go
9099 case "$siteman1dir" in
9100 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9101 *)      dflt=$siteman1dir ;;
9102 esac
9103 case "$dflt" in
9104 ''|' ') dflt=none ;;
9105 esac
9106 fn=dn+~
9107 rp='Pathname where the site-specific manual pages should be installed?'
9108 . ./getfile
9109 prefixvar=siteman1dir
9110 . ./setprefixvar
9111
9112 : determine where add-on library man pages go
9113 case "$siteman3dir" in
9114 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9115 *)      dflt=$siteman3dir ;;
9116 esac
9117 case "$dflt" in
9118 ''|' ') dflt=none ;;
9119 esac
9120 fn=dn+~
9121 rp='Pathname where the site-specific library manual pages should be installed?'
9122 . ./getfile
9123 prefixvar=siteman3dir
9124 . ./setprefixvar
9125
9126 : determine where add-on public executable scripts go
9127 case "$sitescript" in
9128 '')     dflt=$siteprefix/script
9129         $test -d $dflt || dflt=$sitebin ;;
9130 *)  dflt="$sitescript" ;;
9131 esac
9132 fn=d~+
9133 rp='Pathname where add-on public executable scripts should be installed?'
9134 . ./getfile
9135 prefixvar=sitescript
9136 . ./setprefixvar
9137
9138 : Check if faststdio is requested and available
9139 case "$usefaststdio" in
9140 $define|true|[yY]*|'')
9141         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9142         case "$xversion" in
9143         [68])   dflt='y' ;;
9144         *)      dflt='n' ;;
9145         esac
9146         ;;
9147 *) dflt='n';;
9148 esac
9149 cat <<EOM
9150
9151 Perl can be built to use 'fast stdio', which means using the stdio
9152 library but also directly manipulating the stdio buffers to enable
9153 faster I/O.  Using stdio is better for backward compatibility (especially
9154 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9155 interface has been preferred instead of stdio.
9156
9157 If this doesn't make any sense to you, just accept the default '$dflt'.
9158 EOM
9159 rp='Use the "fast stdio" if available?'
9160 . ./myread
9161 case "$ans" in
9162 y|Y)    val="$define" ;;
9163 *)      val="$undef" ;;
9164 esac
9165 set usefaststdio
9166 eval $setvar
9167
9168
9169 : define an is-a-typedef? function
9170 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9171 case "$inclist" in
9172 "") inclist="sys/types.h";;
9173 esac;
9174 eval "varval=\$$var";
9175 case "$varval" in
9176 "")
9177         $rm -f temp.c;
9178         for inc in $inclist; do
9179                 echo "#include <$inc>" >>temp.c;
9180         done;
9181         echo "#ifdef $type" >> temp.c;
9182         echo "printf(\"We have $type\");" >> temp.c;
9183         echo "#endif" >> temp.c;
9184         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9185         if $contains $type temp.E >/dev/null 2>&1; then
9186                 eval "$var=\$type";
9187         else
9188                 eval "$var=\$def";
9189         fi;
9190         $rm -f temp.?;;
9191 *) eval "$var=\$varval";;
9192 esac'
9193
9194 : define an is-a-typedef? function that prompts if the type is not available.
9195 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9196 case "$inclist" in
9197 "") inclist="sys/types.h";;
9198 esac;
9199 eval "varval=\$$var";
9200 case "$varval" in
9201 "")
9202         $rm -f temp.c;
9203         for inc in $inclist; do
9204                 echo "#include <$inc>" >>temp.c;
9205         done;
9206         echo "#ifdef $type" >> temp.c;
9207         echo "printf(\"We have $type\");" >> temp.c;
9208         echo "#endif" >> temp.c;
9209         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9210         echo " " ;
9211         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9212         if $contains $type temp.E >/dev/null 2>&1; then
9213                 echo "$type found." >&4;
9214                 eval "$var=\$type";
9215         else
9216                 echo "$type NOT found." >&4;
9217                 dflt="$def";
9218                 . ./myread ;
9219                 eval "$var=\$ans";
9220         fi;
9221         $rm -f temp.?;;
9222 *) eval "$var=\$varval";;
9223 esac'
9224
9225 : see what type lseek is declared as in the kernel
9226 rp="What is the type used for lseek's offset on this system?"
9227 set off_t lseektype long stdio.h sys/types.h
9228 eval $typedef_ask
9229
9230 echo " "
9231 echo "Checking to see how big your file offsets are..." >&4
9232 $cat >try.c <<EOCP
9233 #include <sys/types.h>
9234 #include <stdio.h>
9235 int main()
9236 {
9237     printf("%d\n", (int)sizeof($lseektype));
9238     return(0);
9239 }
9240 EOCP
9241 set try
9242 if eval $compile_ok; then
9243         lseeksize=`$run ./try`
9244         echo "Your file offsets are $lseeksize bytes long."
9245 else
9246         dflt=$longsize
9247         echo " "
9248         echo "(I can't seem to compile the test program.  Guessing...)"
9249         rp="What is the size of your file offsets (in bytes)?"
9250         . ./myread
9251         lseeksize="$ans"
9252 fi
9253 $rm_try
9254
9255 : see what type file positions are declared as in the library
9256 rp="What is the type for file position used by fsetpos()?"
9257 set fpos_t fpostype long stdio.h sys/types.h
9258 eval $typedef_ask
9259
9260 : Check size for Fpos_t
9261 echo " "
9262 case "$fpostype" in
9263 *_t) zzz="$fpostype"    ;;
9264 *)   zzz="fpos_t"       ;;
9265 esac
9266 echo "Checking the size of $zzz..." >&4
9267 cat > try.c <<EOCP
9268 #include <sys/types.h>
9269 #include <stdio.h>
9270 #$i_stdlib I_STDLIB
9271 #ifdef I_STDLIB
9272 #include <stdlib.h>
9273 #endif
9274 int main() {
9275     printf("%d\n", (int)sizeof($fpostype));
9276     exit(0);
9277 }
9278 EOCP
9279 set try
9280 if eval $compile_ok; then
9281         yyy=`$run ./try`
9282         case "$yyy" in
9283         '')     fpossize=4
9284                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9285                 ;;
9286         *)      fpossize=$yyy
9287                 echo "Your $zzz is $fpossize bytes long."
9288                 ;;
9289         esac
9290 else
9291         dflt="$longsize"
9292         echo " " >&4
9293         echo "(I can't compile the test program.  Guessing...)" >&4
9294         rp="What is the size of your file positions (in bytes)?"
9295         . ./myread
9296         fpossize="$ans"
9297 fi
9298
9299 : Check for large file support
9300 # Backward compatibility (uselfs is deprecated).
9301 case "$uselfs" in
9302 "$define"|true|[yY]*)
9303         cat <<EOM >&4
9304
9305 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9306 EOM
9307         uselargefiles="$define"
9308         ;;
9309 esac
9310
9311 case "$lseeksize:$fpossize" in
9312 8:8) cat <<EOM
9313
9314 You can have files larger than 2 gigabytes.
9315 EOM
9316    val="$define" ;;
9317 *)    case "$uselargefiles" in
9318    "$undef"|false|[nN]*) dflt='n' ;;
9319    *)   dflt='y' ;;
9320    esac
9321    cat <<EOM
9322
9323 Perl can be built to understand large files (files larger than 2 gigabytes)
9324 on some systems.  To do so, Configure can be run with -Duselargefiles.
9325
9326 If this doesn't make any sense to you, just accept the default '$dflt'.
9327 EOM
9328    rp='Try to understand large files, if available?'
9329    . ./myread
9330    case "$ans" in
9331    y|Y)         val="$define" ;;
9332    *)           val="$undef"  ;;
9333    esac
9334    ;;
9335 esac
9336 set uselargefiles
9337 eval $setvar
9338 : Look for a hint-file generated 'call-back-unit'.  If the
9339 : user has specified that a large files perl is to be built,
9340 : we may need to set or change some other defaults.
9341 if $test -f uselargefiles.cbu; then
9342         echo "Your platform has some specific hints regarding large file builds, using them..."
9343         . ./uselargefiles.cbu
9344 fi
9345 case "$uselargefiles" in
9346 "$define")
9347         if $test -f uselargefiles.cbu; then
9348                 echo " "
9349                 echo "Rechecking to see how big your file offsets are..." >&4
9350                 $cat >try.c <<EOCP
9351 #include <sys/types.h>
9352 #include <stdio.h>
9353 int main()
9354 {
9355     printf("%d\n", (int)sizeof($lseektype));
9356     return(0);
9357 }
9358 EOCP
9359                 set try
9360                 if eval $compile_ok; then
9361                         lseeksize=`$run ./try`
9362                         $echo "Your file offsets are now $lseeksize bytes long."
9363                 else
9364                         dflt="$lseeksize"
9365                         echo " "
9366                         echo "(I can't seem to compile the test program.  Guessing...)"
9367                         rp="What is the size of your file offsets (in bytes)?"
9368                         . ./myread
9369                         lseeksize="$ans"
9370                 fi
9371                 case "$fpostype" in
9372                 *_t) zzz="$fpostype"    ;;
9373                 *)   zzz="fpos_t"       ;;
9374                 esac
9375                 $echo $n "Rechecking the size of $zzz...$c" >&4
9376                 $cat > try.c <<EOCP
9377 #include <sys/types.h>
9378 #include <stdio.h>
9379 #$i_stdlib I_STDLIB
9380 #ifdef I_STDLIB
9381 #include <stdlib.h>
9382 #endif
9383 int main() {
9384     printf("%d\n", (int)sizeof($fpostype));
9385     return(0);
9386 }
9387 EOCP
9388                 set try
9389                 if eval $compile_ok; then
9390                         yyy=`$run ./try`
9391                         dflt="$lseeksize"
9392                         case "$yyy" in
9393                         '')     echo " "
9394                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9395                                 ;;
9396                         *)      fpossize=$yyy
9397                                 echo " $fpossize bytes." >&4
9398                                 ;;
9399                         esac
9400                 else
9401                         dflt="$fpossize"
9402                         echo " "
9403                         echo "(I can't compile the test program.  Guessing...)" >&4
9404                         rp="What is the size of your file positions (in bytes)?"
9405                         . ./myread
9406                         fpossize="$ans"
9407                 fi
9408                 $rm_try
9409         fi
9410         ;;
9411 esac
9412
9413 : Set the vendorbin variables
9414 case "$vendorprefix" in
9415 '')     d_vendorbin="$undef"
9416         vendorbin=''
9417         vendorbinexp=''
9418         ;;
9419 *)      d_vendorbin="$define"
9420         : determine where vendor-supplied executables go.
9421         case "$vendorbin" in
9422         '') dflt=$vendorprefix/bin ;;
9423         *)      dflt="$vendorbin" ;;
9424         esac
9425         fn=d~+
9426         rp='Pathname for the vendor-supplied executables directory?'
9427         . ./getfile
9428         vendorbin="$ans"
9429         vendorbinexp="$ansexp"
9430         ;;
9431 esac
9432 prefixvar=vendorbin
9433 . ./installprefix
9434
9435 : Set the vendorhtml1dir variables
9436 case "$vendorprefix" in
9437 '')     vendorhtml1dir=''
9438         vendorhtml1direxp=''
9439         ;;
9440 *)      : determine where vendor-supplied html pages go.
9441         : There is no standard location, so try to copy the previously-selected
9442         : directory structure for the core html pages.
9443         : XXX Better default suggestions would be welcome.
9444         case "$vendorhtml1dir" in
9445         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9446         *)      dflt=$vendorhtml1dir ;;
9447         esac
9448         case "$dflt" in
9449         ''|' ') dflt=none ;;
9450         esac
9451         fn=dn+~
9452         rp='Pathname for the vendor-supplied html pages?'
9453         . ./getfile
9454         vendorhtml1dir="$ans"
9455         vendorhtml1direxp="$ansexp"
9456         ;;
9457 esac
9458 : Use ' ' for none so value is preserved next time through Configure
9459 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9460 prefixvar=vendorhtml1dir
9461 . ./installprefix
9462
9463 : Set the vendorhtml3dir variables
9464 case "$vendorprefix" in
9465 '')     vendorhtml3dir=''
9466         vendorhtml3direxp=''
9467         ;;
9468 *)      : determine where vendor-supplied module html pages go.
9469         : There is no standard location, so try to copy the previously-selected
9470         : directory structure for the core html pages.
9471         : XXX Better default suggestions would be welcome.
9472         case "$vendorhtml3dir" in
9473         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9474         *)      dflt=$vendorhtml3dir ;;
9475         esac
9476         case "$dflt" in
9477         ''|' ') dflt=none ;;
9478         esac
9479         fn=dn+~
9480         rp='Pathname for the vendor-supplied html pages?'
9481         . ./getfile
9482         vendorhtml3dir="$ans"
9483         vendorhtml3direxp="$ansexp"
9484         ;;
9485 esac
9486 : Use ' ' for none so value is preserved next time through Configure
9487 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9488 prefixvar=vendorhtml3dir
9489 . ./installprefix
9490
9491 : Set the vendorman1dir variables
9492 case "$vendorprefix" in
9493 '')     vendorman1dir=''
9494         vendorman1direxp=''
9495         ;;
9496 *)      : determine where vendor-supplied manual pages go.
9497         case "$vendorman1dir" in
9498         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9499         *)      dflt=$vendorman1dir ;;
9500         esac
9501         case "$dflt" in
9502         ''|' ') dflt=none ;;
9503         esac
9504         fn=nd~+
9505         rp='Pathname for the vendor-supplied manual section 1 pages?'
9506         . ./getfile
9507         vendorman1dir="$ans"
9508         vendorman1direxp="$ansexp"
9509         ;;
9510 esac
9511 : Use ' ' for none so value is preserved next time through Configure
9512 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9513 prefixvar=vendorman1dir
9514 . ./installprefix
9515
9516 : Set the vendorman3dir variables
9517 case "$vendorprefix" in
9518 '')     vendorman3dir=''
9519         vendorman3direxp=''
9520         ;;
9521 *)      : determine where vendor-supplied module manual pages go.
9522         case "$vendorman3dir" in
9523         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9524         *)      dflt=$vendorman3dir ;;
9525         esac
9526         case "$dflt" in
9527         ''|' ') dflt=none ;;
9528         esac
9529         fn=nd~+
9530         rp='Pathname for the vendor-supplied manual section 3 pages?'
9531         . ./getfile
9532         vendorman3dir="$ans"
9533         vendorman3direxp="$ansexp"
9534         ;;
9535 esac
9536 : Use ' ' for none so value is preserved next time through Configure
9537 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9538 prefixvar=vendorman3dir
9539 . ./installprefix
9540
9541 : Set the vendorscript variables
9542 case "$vendorprefix" in
9543 '')     d_vendorscript="$undef"
9544         vendorscript=''
9545         vendorscriptexp=''
9546         ;;
9547 *)      d_vendorscript="$define"
9548         : determine where vendor-supplied scripts go.
9549         case "$vendorscript" in
9550         '')     dflt=$vendorprefix/script
9551                 $test -d $dflt || dflt=$vendorbin ;;
9552         *)  dflt="$vendorscript" ;;
9553         esac
9554         $cat <<EOM
9555
9556 The installation process will create a directory for
9557 vendor-supplied scripts.
9558
9559 EOM
9560         fn=d~+
9561         rp='Pathname for the vendor-supplied scripts directory?'
9562         . ./getfile
9563         vendorscript="$ans"
9564         vendorscriptexp="$ansexp"
9565         ;;
9566 esac
9567 prefixvar=vendorscript
9568 . ./installprefix
9569
9570 : script used to emit important warnings
9571 cat >warn <<EOS
9572 $startsh
9573 if test \$# -gt 0; then
9574         echo "\$@" >msg
9575 else
9576         cat >msg
9577 fi
9578 echo "*** WARNING:" >&4
9579 sed -e 's/^/*** /' <msg >&4
9580 echo "*** " >&4
9581 cat msg >>config.msg
9582 echo " " >>config.msg
9583 rm -f msg
9584 EOS
9585 chmod +x warn
9586 $eunicefix warn
9587
9588 : see which of string.h or strings.h is needed
9589 echo " "
9590 strings=`./findhdr string.h`
9591 if $test "$strings" && $test -r "$strings"; then
9592         echo "Using <string.h> instead of <strings.h>." >&4
9593         val="$define"
9594 else
9595         val="$undef"
9596         strings=`./findhdr strings.h`
9597         if $test "$strings" && $test -r "$strings"; then
9598                 echo "Using <strings.h> instead of <string.h>." >&4
9599         else
9600                 ./warn "No string header found -- You'll surely have problems."
9601         fi
9602 fi
9603 set i_string
9604 eval $setvar
9605 case "$i_string" in
9606 "$undef") strings=`./findhdr strings.h`;;
9607 *)        strings=`./findhdr string.h`;;
9608 esac
9609
9610 : see if qgcvt exists
9611 set qgcvt d_qgcvt
9612 eval $inlibc
9613
9614 : Check print/scan long double stuff
9615 echo " "
9616
9617 if $test X"$d_longdbl" = X"$define"; then
9618
9619 echo "Checking how to print long doubles..." >&4
9620
9621 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9622         $cat >try.c <<'EOCP'
9623 #include <sys/types.h>
9624 #include <stdio.h>
9625 int main() {
9626   double d = 123.456;
9627   printf("%.3f\n", d);
9628 }
9629 EOCP
9630         set try
9631         if eval $compile; then
9632                 yyy=`$run ./try`
9633                 case "$yyy" in
9634                 123.456)
9635                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9636                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9637                         echo "We will use %f."
9638                         ;;
9639                 esac
9640         fi
9641 fi
9642
9643 if $test X"$sPRIfldbl" = X; then
9644         $cat >try.c <<'EOCP'
9645 #include <sys/types.h>
9646 #include <stdio.h>
9647 int main() {
9648   long double d = 123.456;
9649   printf("%.3Lf\n", d);
9650 }
9651 EOCP
9652         set try
9653         if eval $compile; then
9654                 yyy=`$run ./try`
9655                 case "$yyy" in
9656                 123.456)
9657                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9658                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9659                         echo "We will use %Lf."
9660                         ;;
9661                 esac
9662         fi
9663 fi
9664
9665 if $test X"$sPRIfldbl" = X; then
9666         $cat >try.c <<'EOCP'
9667 #include <sys/types.h>
9668 #include <stdio.h>
9669 int main() {
9670   long double d = 123.456;
9671   printf("%.3llf\n", d);
9672 }
9673 EOCP
9674         set try
9675         if eval $compile; then
9676                 yyy=`$run ./try`
9677                 case "$yyy" in
9678                 123.456)
9679                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9680                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9681                         echo "We will use %llf."
9682                         ;;
9683                 esac
9684         fi
9685 fi
9686
9687 if $test X"$sPRIfldbl" = X; then
9688         $cat >try.c <<'EOCP'
9689 #include <sys/types.h>
9690 #include <stdio.h>
9691 int main() {
9692   long double d = 123.456;
9693   printf("%.3lf\n", d);
9694 }
9695 EOCP
9696         set try
9697         if eval $compile; then
9698                 yyy=`$run ./try`
9699                 case "$yyy" in
9700                 123.456)
9701                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9702                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9703                         echo "We will use %lf."
9704                         ;;
9705                 esac
9706         fi
9707 fi
9708
9709 if $test X"$sPRIfldbl" = X; then
9710         echo "Cannot figure out how to print long doubles." >&4
9711 else
9712         sSCNfldbl=$sPRIfldbl    # expect consistency
9713 fi
9714
9715 $rm_try
9716
9717 fi # d_longdbl
9718
9719 case "$sPRIfldbl" in
9720 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9721         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9722         d_SCNfldbl="$undef";
9723         ;;
9724 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9725         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9726         d_SCNfldbl="$define";
9727         ;;
9728 esac
9729
9730 : Check how to convert floats to strings.
9731
9732 if test "X$d_Gconvert" = X; then
9733
9734 echo " "
9735 echo "Checking for an efficient way to convert floats to strings."
9736 echo " " > try.c
9737 case "$uselongdouble" in
9738 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9739 esac
9740 case "$d_longdbl" in
9741 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9742 esac
9743 case "$d_PRIgldbl" in
9744 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9745 esac
9746 $cat >>try.c <<EOP
9747 #ifdef TRY_gconvert
9748 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9749 char *myname = "gconvert";
9750 #endif
9751 #ifdef TRY_gcvt
9752 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9753 char *myname = "gcvt";
9754 #endif
9755 #ifdef TRY_qgcvt
9756 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9757 char *myname = "qgcvt";
9758 #define DOUBLETYPE long double
9759 #endif
9760 #ifdef TRY_sprintf
9761 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9762 #ifdef HAS_PRIgldbl
9763 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9764 #else
9765 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9766 #endif
9767 #else
9768 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9769 #endif
9770 char *myname = "sprintf";
9771 #endif
9772
9773 #ifndef DOUBLETYPE
9774 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9775 #define DOUBLETYPE long double
9776 #else
9777 #define DOUBLETYPE double
9778 #endif
9779 #endif
9780
9781 #include <stdio.h>
9782
9783 #$i_stdlib I_STDLIB
9784 #ifdef I_STDLIB
9785 #include <stdlib.h>
9786 #endif
9787 #$i_string I_STRING
9788 #ifdef I_STRING
9789 #  include <string.h>
9790 #else
9791 #  include <strings.h>
9792 #endif
9793
9794 int checkit(char *expect, char *got)
9795 {
9796     if (strcmp(expect, got)) {
9797                 printf("%s oddity:  Expected %s, got %s\n",
9798                         myname, expect, got);
9799                 exit(1);
9800         }
9801 }
9802
9803 int main()
9804 {
9805         char buf[64];
9806         buf[63] = '\0';
9807
9808         /* This must be 1st test on (which?) platform */
9809         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9810         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9811         checkit("0.1", buf);
9812
9813         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9814         checkit("0.01", buf);
9815
9816         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9817         checkit("0.001", buf);
9818
9819         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9820         checkit("0.0001", buf);
9821
9822         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9823         if (strlen(buf) > 5)
9824             checkit("9e-005", buf); /* for Microsoft ?? */
9825         else
9826             checkit("9e-05", buf);
9827
9828         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9829         checkit("1", buf);
9830
9831         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9832         checkit("1.1", buf);
9833
9834         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9835         checkit("1.01", buf);
9836
9837         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9838         checkit("1.001", buf);
9839
9840         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9841         checkit("1.0001", buf);
9842
9843         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9844         checkit("1.00001", buf);
9845
9846         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9847         checkit("1.000001", buf);
9848
9849         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9850         checkit("0", buf);
9851
9852         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9853         checkit("-1", buf);
9854
9855         /* Some Linux gcvt's give 1.e+5 here. */
9856         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9857         checkit("100000", buf);
9858
9859         /* Some Linux gcvt's give -1.e+5 here. */
9860         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9861         checkit("-100000", buf);
9862
9863         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9864         checkit("123.456", buf);
9865
9866         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9867         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9868         /* 34 should be enough to scare even long double
9869          * places into using the e notation. */
9870         if (strlen(buf) > 5)
9871             checkit("1e+034", buf); /* for Microsoft */
9872         else
9873             checkit("1e+34", buf);
9874
9875         /* For Perl, if you add additional tests here, also add them to
9876          * t/base/num.t for benefit of platforms not using Configure or
9877          * overriding d_Gconvert */
9878
9879         exit(0);
9880 }
9881 EOP
9882 : first add preferred functions to our list
9883 xxx_list=""
9884 for xxx_convert in $gconvert_preference; do
9885     case $xxx_convert in
9886     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9887     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9888     esac
9889 done
9890 : then add any others
9891 for xxx_convert in gconvert gcvt sprintf; do
9892     case "$xxx_list" in
9893     *$xxx_convert*) ;;
9894     *) xxx_list="$xxx_list $xxx_convert" ;;
9895     esac
9896 done
9897
9898 case "$d_longdbl$uselongdouble" in
9899 "$define$define")
9900     : again, add preferred functions to our list first
9901     xxx_ld_list=""
9902     for xxx_convert in $gconvert_ld_preference; do
9903         case $xxx_convert in
9904         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9905         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9906         esac
9907     done
9908     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9909     for xxx_convert in qgcvt sprintf $xxx_list; do
9910         case "$xxx_ld_list" in
9911         $xxx_convert*|*" $xxx_convert"*) ;;
9912         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9913         esac
9914     done
9915     : if sprintf cannot do long doubles, move it to the end
9916     if test "$d_PRIgldbl" != "$define"; then
9917         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9918     fi
9919     : if no qgcvt, remove it
9920     if test "$d_qgcvt" != "$define"; then
9921         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9922     fi
9923     : use the ld_list
9924     xxx_list="$xxx_ld_list"
9925     ;;
9926 esac
9927
9928 for xxx_convert in $xxx_list; do
9929         echo "Trying $xxx_convert..."
9930         $rm -f try try$_o core
9931         set try -DTRY_$xxx_convert
9932         if eval $compile; then
9933                 echo "$xxx_convert() found." >&4
9934                 if $run ./try; then
9935                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9936                         break;
9937                 else
9938                         echo "...But $xxx_convert didn't work as I expected."
9939                         xxx_convert=''
9940                 fi
9941         else
9942                 echo "$xxx_convert NOT found." >&4
9943         fi
9944 done
9945
9946 if test X$xxx_convert = X; then
9947     echo "*** WHOA THERE!!! ***" >&4
9948     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9949     xxx_convert=sprintf
9950 fi
9951
9952 case "$xxx_convert" in
9953 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9954 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9955 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9956 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9957    "$define$define$define")
9958       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9959    "$define$define$undef")
9960       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9961    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9962    esac
9963    ;;
9964 esac
9965
9966 fi
9967 $rm_try
9968
9969 : see if _fwalk exists
9970 set fwalk d__fwalk
9971 eval $inlibc
9972
9973 : Initialize h_fcntl
9974 h_fcntl=false
9975
9976 : Initialize h_sysfile
9977 h_sysfile=false
9978
9979 : access call always available on UNIX
9980 set access d_access
9981 eval $inlibc
9982
9983 : locate the flags for 'access()'
9984 case "$d_access" in
9985 "$define")
9986         echo " "
9987         $cat >access.c <<EOCP
9988 #include <sys/types.h>
9989 #ifdef I_FCNTL
9990 #include <fcntl.h>
9991 #endif
9992 #ifdef I_SYS_FILE
9993 #include <sys/file.h>
9994 #endif
9995 #ifdef I_UNISTD
9996 #include <unistd.h>
9997 #endif
9998 #$i_stdlib I_STDLIB
9999 #ifdef I_STDLIB
10000 #include <stdlib.h>
10001 #endif
10002 int main() {
10003         exit(R_OK);
10004 }
10005 EOCP
10006         : check sys/file.h first, no particular reason here
10007         if $test `./findhdr sys/file.h` && \
10008                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10009                 h_sysfile=true;
10010                 echo "<sys/file.h> defines the *_OK access constants." >&4
10011         elif $test `./findhdr fcntl.h` && \
10012                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10013                 h_fcntl=true;
10014                 echo "<fcntl.h> defines the *_OK access constants." >&4
10015         elif $test `./findhdr unistd.h` && \
10016                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10017                 echo "<unistd.h> defines the *_OK access constants." >&4
10018         else
10019                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10020         fi
10021         ;;
10022 esac
10023 $rm -f access*
10024
10025 : see if accessx exists
10026 set accessx d_accessx
10027 eval $inlibc
10028
10029 : see if aintl exists
10030 set aintl d_aintl
10031 eval $inlibc
10032
10033 : see if alarm exists
10034 set alarm d_alarm
10035 eval $inlibc
10036
10037 : see if 64bit time functions exists
10038
10039 set ctime64 d_ctime64
10040 eval $inlibc
10041
10042 set localtime64 d_localtime64
10043 eval $inlibc
10044
10045 set gmtime64 d_gmtime64
10046 eval $inlibc
10047
10048 set mktime64 d_mktime64
10049 eval $inlibc
10050
10051 set difftime64 d_difftime64
10052 eval $inlibc
10053
10054 set asctime64 d_asctime64
10055 eval $inlibc
10056
10057 : see if POSIX threads are available
10058 set pthread.h i_pthread
10059 eval $inhdr
10060
10061 : define a function to check prototypes
10062 $cat > protochk <<EOSH
10063 $startsh
10064 cc="$cc"
10065 optimize="$optimize"
10066 ccflags="$ccflags"
10067 prototype="$prototype"
10068 define="$define"
10069 rm_try="$rm_try"
10070 usethreads=$usethreads
10071 i_pthread=$i_pthread
10072 pthread_h_first=$pthread_h_first
10073 EOSH
10074
10075 $cat >> protochk <<'EOSH'
10076
10077 $rm_try
10078 foo="$1"
10079 shift
10080 while test $# -ge 2; do
10081         case "$1" in
10082                 $define) echo "#include <$2>" >> try.c ;;
10083                 literal) echo "$2" >> try.c ;;
10084         esac
10085     # Extra magic for the benefit of systems that need pthread.h
10086     # to be included early to correctly detect threadsafe functions.
10087     # Such functions must guarantee themselves, though, that the usethreads
10088     # and i_pthread have been defined, before calling protochk.
10089     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10090         echo "#include <pthread.h>" >> try.c
10091         pthread_h_done=yes
10092     fi
10093     shift 2
10094 done
10095 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10096 cat >> try.c <<'EOCP'
10097 #ifdef CAN_PROTOTYPE
10098 #define _(args) args
10099 #else
10100 #define _(args) ()
10101 #endif
10102 EOCP
10103 echo "$foo" >> try.c
10104 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10105 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10106 status=$?
10107 $rm_try
10108 exit $status
10109 EOSH
10110 chmod +x protochk
10111 $eunicefix protochk
10112
10113 : Define hasproto macro for Configure internal use
10114 hasproto='varname=$1; func=$2; shift; shift;
10115 while $test $# -ge 2; do
10116         case "$1" in
10117         $define) echo "#include <$2>";;
10118         esac ;
10119     shift 2;
10120 done > try.c;
10121 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10122 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10123         echo "$func() prototype found.";
10124         val="$define";
10125 else
10126         echo "$func() prototype NOT found.";
10127         val="$undef";
10128 fi;
10129 set $varname;
10130 eval $setvar;
10131 $rm_try tryout.c'
10132
10133 : see if sys/types.h has to be included
10134 set sys/types.h i_systypes
10135 eval $inhdr
10136
10137 : see if sys/select.h has to be included
10138 set sys/select.h i_sysselct
10139 eval $inhdr
10140
10141 : Define hasfield macro for Configure internal use
10142 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10143 while $test $# -ge 2; do
10144         case "$1" in
10145         $define) echo "#include <$2>";;
10146         esac ;
10147     shift 2;
10148 done > try.c;
10149 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10150 set try;
10151 if eval $compile; then
10152         val="$define";
10153 else
10154         val="$undef";
10155 fi;
10156 set $varname;
10157 eval $setvar;
10158 $rm_try'
10159
10160 : see if we should include time.h, sys/time.h, or both
10161 echo " "
10162 if test "X$timeincl" = X; then
10163         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10164         $echo $n "I'm now running the test program...$c"
10165         $cat >try.c <<EOCP
10166 #include <sys/types.h>
10167 #ifdef I_TIME
10168 #include <time.h>
10169 #endif
10170 #ifdef I_SYSTIME
10171 #ifdef SYSTIMEKERNEL
10172 #define KERNEL
10173 #endif
10174 #include <sys/time.h>
10175 #endif
10176 #ifdef I_SYSSELECT
10177 #include <sys/select.h>
10178 #endif
10179 #$i_stdlib I_STDLIB
10180 #ifdef I_STDLIB
10181 #include <stdlib.h>
10182 #endif
10183 int main()
10184 {
10185         struct tm foo;
10186 #ifdef S_TIMEVAL
10187         struct timeval bar;
10188 #endif
10189 #ifdef S_TIMEZONE
10190         struct timezone tzp;
10191 #endif
10192         if (foo.tm_sec == foo.tm_sec)
10193                 exit(0);
10194 #ifdef S_TIMEVAL
10195         if (bar.tv_sec == bar.tv_sec)
10196                 exit(0);
10197 #endif
10198         exit(1);
10199 }
10200 EOCP
10201         flags=''
10202         for s_timezone in '-DS_TIMEZONE' ''; do
10203         sysselect=''
10204         for s_timeval in '-DS_TIMEVAL' ''; do
10205         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10206         for i_time in '' '-DI_TIME'; do
10207         for i_systime in '-DI_SYSTIME' ''; do
10208                 case "$flags" in
10209                 '') $echo $n ".$c"
10210                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10211                         if eval $compile; then
10212                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10213                                 shift
10214                                 flags="$*"
10215                                 echo " "
10216                                 $echo $n "Succeeded with $flags$c"
10217                         fi
10218                         ;;
10219                 esac
10220         done
10221         done
10222         done
10223         done
10224         done
10225         timeincl=''
10226         echo " "
10227         case "$flags" in
10228         *SYSTIMEKERNEL*) i_systimek="$define"
10229                 timeincl=`./findhdr sys/time.h`
10230                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10231         *) i_systimek="$undef";;
10232         esac
10233         case "$flags" in
10234         *I_TIME*) i_time="$define"
10235                 timeincl=`./findhdr time.h`" $timeincl"
10236                 echo "We'll include <time.h>." >&4;;
10237         *) i_time="$undef";;
10238         esac
10239         case "$flags" in
10240         *I_SYSTIME*) i_systime="$define"
10241                 timeincl=`./findhdr sys/time.h`" $timeincl"
10242                 echo "We'll include <sys/time.h>." >&4;;
10243         *) i_systime="$undef";;
10244         esac
10245         $rm_try
10246 fi
10247 : see if struct tm knows about tm_zone
10248 case "$i_systime$i_time" in
10249 *$define*)
10250         echo " "
10251         echo "Checking to see if your struct tm has tm_zone field..." >&4
10252         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10253         eval $hasfield
10254         ;;
10255 *)      val="$undef"
10256         set d_tm_tm_zone
10257         eval $setvar
10258         ;;
10259 esac
10260 case "$d_tm_tm_zone" in
10261 "$define")      echo "Yes, it does."   ;;
10262 *)              echo "No, it doesn't." ;;
10263 esac
10264 : see if struct tm knows about tm_gmtoff
10265 case "$i_systime$i_time" in
10266 *$define*)
10267         echo " "
10268         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10269         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10270         eval $hasfield
10271         ;;
10272 *)      val="$undef"
10273         set d_tm_tm_gmtoff
10274         eval $setvar
10275         ;;
10276 esac
10277 case "$d_tm_tm_gmtoff" in
10278 "$define")      echo "Yes, it does."   ;;
10279 *)              echo "No, it doesn't." ;;
10280 esac
10281
10282 : see if asctime_r exists
10283 set asctime_r d_asctime_r
10284 eval $inlibc
10285 case "$d_asctime_r" in
10286 "$define")
10287         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10288         case "$d_asctime_r_proto:$usethreads" in
10289         ":define")      d_asctime_r_proto=define
10290                 set d_asctime_r_proto asctime_r $hdrs
10291                 eval $hasproto ;;
10292         *)      ;;
10293         esac
10294         case "$d_asctime_r_proto" in
10295         define)
10296         case "$asctime_r_proto" in
10297         ''|0) try='char* asctime_r(const struct tm*, char*);'
10298         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10299         esac
10300         case "$asctime_r_proto" in
10301         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10302         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10303         esac
10304         case "$asctime_r_proto" in
10305         ''|0) try='int asctime_r(const struct tm*, char*);'
10306         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10307         esac
10308         case "$asctime_r_proto" in
10309         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10310         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10311         esac
10312         case "$asctime_r_proto" in
10313         ''|0)   d_asctime_r=undef
10314                 asctime_r_proto=0
10315                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10316         * )     case "$asctime_r_proto" in
10317                 REENTRANT_PROTO*) ;;
10318                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10319                 esac
10320                 echo "Prototype: $try" ;;
10321         esac
10322         ;;
10323         *)      case "$usethreads" in
10324                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10325                 esac
10326                 d_asctime_r=undef
10327                 asctime_r_proto=0
10328                 ;;
10329         esac
10330         ;;
10331 *)      asctime_r_proto=0
10332         ;;
10333 esac
10334
10335 : see if atolf exists
10336 set atolf d_atolf
10337 eval $inlibc
10338
10339 : see if atoll exists
10340 set atoll d_atoll
10341 eval $inlibc
10342
10343 : Look for GCC-style attribute format
10344 case "$d_attribute_format" in
10345 '')
10346 echo " "
10347 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10348 $cat >attrib.c <<'EOCP'
10349 #include <stdio.h>
10350 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10351 EOCP
10352 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10353         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10354                 echo "Your C compiler doesn't support __attribute__((format))."
10355                 val="$undef"
10356         else
10357                 echo "Your C compiler supports __attribute__((format))."
10358                 val="$define"
10359         fi
10360 else
10361         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10362         val="$undef"
10363 fi
10364 ;;
10365 *) val="$d_attribute_format" ;;
10366 esac
10367 set d_attribute_format
10368 eval $setvar
10369 $rm -f attrib*
10370
10371 : Look for GCC-style attribute format with null format allowed
10372 case "$d_printf_format_null" in
10373 '') case "$d_attribute_format" in
10374     $define)
10375         echo " "
10376         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10377 $cat >attrib.c <<EOCP
10378 #include <stdio.h>
10379 #$i_stdlib I_STDLIB
10380 #ifdef I_STDLIB
10381 #include <stdlib.h>
10382 #endif
10383 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10384 int null_printf (char* pat,...) { return (int)pat; }
10385 int main () { exit(null_printf(NULL)); }
10386 EOCP
10387         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10388             : run the executable in case it produces a run-time warning
10389             if $run ./attrib >>attrib.out 2>&1; then
10390                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391                     echo "Your C compiler doesn't allow __printf__ format to be null."
10392                     val="$undef"
10393                 else
10394                     echo "Your C compiler allows __printf__ format to be null."
10395                     val="$define"
10396                 fi
10397             else
10398             echo "Your C compiler executable failed with __printf__ format null."
10399             val="$undef"
10400         fi
10401     else
10402         echo "Your C compiler fails with __printf__ format null."
10403         val="$undef"
10404     fi
10405     ;;
10406     *)  val="$undef" ;;
10407     esac
10408 ;;
10409 *)  val="$d_printf_format_null" ;;
10410 esac
10411 set d_printf_format_null
10412 eval $setvar
10413 $rm -f attrib*
10414
10415 : Look for GCC-style attribute malloc
10416 case "$d_attribute_malloc" in
10417 '')
10418 echo " "
10419 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10420 $cat >attrib.c <<'EOCP'
10421 #include <stdio.h>
10422 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10423 EOCP
10424 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10425         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10426                 echo "Your C compiler doesn't support __attribute__((malloc))."
10427                 val="$undef"
10428         else
10429                 echo "Your C compiler supports __attribute__((malloc))."
10430                 val="$define"
10431         fi
10432 else
10433         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10434         val="$undef"
10435 fi
10436 ;;
10437 *) val="$d_attribute_malloc" ;;
10438 esac
10439 set d_attribute_malloc
10440 eval $setvar
10441 $rm -f attrib*
10442
10443 : Look for GCC-style attribute nonnull
10444 case "$d_attribute_nonnull" in
10445 '')
10446 echo " "
10447 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10448 $cat >attrib.c <<'EOCP'
10449 #include <stdio.h>
10450 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10451 EOCP
10452 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10453         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10454                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10455                 val="$undef"
10456         else
10457                 echo "Your C compiler supports __attribute__((nonnull))."
10458                 val="$define"
10459         fi
10460 else
10461         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10462         val="$undef"
10463 fi
10464 ;;
10465 *) val="$d_attribute_nonnull" ;;
10466 esac
10467 set d_attribute_nonnull
10468 eval $setvar
10469 $rm -f attrib*
10470
10471 : Look for GCC-style attribute noreturn
10472 case "$d_attribute_noreturn" in
10473 '')
10474 echo " "
10475 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10476 $cat >attrib.c <<'EOCP'
10477 #include <stdio.h>
10478 void fall_over_dead( void ) __attribute__((noreturn));
10479 EOCP
10480 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10481         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10482                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10483                 val="$undef"
10484         else
10485                 echo "Your C compiler supports __attribute__((noreturn))."
10486                 val="$define"
10487         fi
10488 else
10489         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10490         val="$undef"
10491 fi
10492 ;;
10493 *) val="$d_attribute_noreturn" ;;
10494 esac
10495 set d_attribute_noreturn
10496 eval $setvar
10497 $rm -f attrib*
10498
10499 : Look for GCC-style attribute pure
10500 case "$d_attribute_pure" in
10501 '')
10502 echo " "
10503 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10504 $cat >attrib.c <<'EOCP'
10505 #include <stdio.h>
10506 int square( int n ) __attribute__((pure));
10507 EOCP
10508 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10509         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10510                 echo "Your C compiler doesn't support __attribute__((pure))."
10511                 val="$undef"
10512         else
10513                 echo "Your C compiler supports __attribute__((pure))."
10514                 val="$define"
10515         fi
10516 else
10517         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10518         val="$undef"
10519 fi
10520 ;;
10521 *) val="$d_attribute_pure" ;;
10522 esac
10523 set d_attribute_pure
10524 eval $setvar
10525 $rm -f attrib*
10526
10527 : Look for GCC-style attribute unused
10528 case "$d_attribute_unused" in
10529 '')
10530 echo " "
10531 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10532 $cat >attrib.c <<'EOCP'
10533 #include <stdio.h>
10534 int do_something( int dummy __attribute__((unused)), int n );
10535 EOCP
10536 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10537         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10538                 echo "Your C compiler doesn't support __attribute__((unused))."
10539                 val="$undef"
10540         else
10541                 echo "Your C compiler supports __attribute__((unused))."
10542                 val="$define"
10543         fi
10544 else
10545         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10546         val="$undef"
10547 fi
10548 ;;
10549 *) val="$d_attribute_unused" ;;
10550 esac
10551 set d_attribute_unused
10552 eval $setvar
10553 $rm -f attrib*
10554
10555 : Look for GCC-style attribute deprecated
10556 case "$d_attribute_deprecated" in
10557 '')
10558 echo " "
10559 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10560 $cat >attrib.c <<'EOCP'
10561 #include <stdio.h>
10562 int I_am_deprecated(void) __attribute__((deprecated));
10563 EOCP
10564 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10565         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10566                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10567                 val="$undef"
10568         else
10569                 echo "Your C compiler supports __attribute__((deprecated))."
10570                 val="$define"
10571         fi
10572 else
10573         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10574         val="$undef"
10575 fi
10576 ;;
10577 *) val="$d_attribute_deprecated" ;;
10578 esac
10579 set d_attribute_deprecated
10580 eval $setvar
10581 $rm -f attrib*
10582
10583 : Look for GCC-style attribute warn_unused_result
10584 case "$d_attribute_warn_unused_result" in
10585 '')
10586 echo " "
10587 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10588 $cat >attrib.c <<'EOCP'
10589 #include <stdio.h>
10590 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10591 EOCP
10592 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10593         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10594                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10595                 val="$undef"
10596         else
10597                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10598                 val="$define"
10599         fi
10600 else
10601         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10602         val="$undef"
10603 fi
10604 ;;
10605 *) val="$d_attribute_warn_unused_result" ;;
10606 esac
10607 set d_attribute_warn_unused_result
10608 eval $setvar
10609 $rm -f attrib*
10610
10611 : see if bcmp exists
10612 set bcmp d_bcmp
10613 eval $inlibc
10614
10615 : see if bcopy exists
10616 set bcopy d_bcopy
10617 eval $inlibc
10618
10619 : see if getpgrp exists
10620 set getpgrp d_getpgrp
10621 eval $inlibc
10622
10623 case "$d_getpgrp" in
10624 "$define")
10625         echo " "
10626         echo "Checking to see which flavor of getpgrp is in use..."
10627         $cat >try.c <<EOP
10628 #$i_unistd I_UNISTD
10629 #include <sys/types.h>
10630 #ifdef I_UNISTD
10631 #  include <unistd.h>
10632 #endif
10633 #$i_stdlib I_STDLIB
10634 #ifdef I_STDLIB
10635 #include <stdlib.h>
10636 #endif
10637 int main()
10638 {
10639         if (getuid() == 0) {
10640                 printf("(I see you are running Configure as super-user...)\n");
10641                 setuid(1);
10642         }
10643 #ifdef TRY_BSD_PGRP
10644         if (getpgrp(1) == 0)
10645                 exit(0);
10646 #else
10647         if (getpgrp() > 0)
10648                 exit(0);
10649 #endif
10650         exit(1);
10651 }
10652 EOP
10653         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10654                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10655                 val="$define"
10656         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10657                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10658                 val="$undef"
10659         else
10660                 echo "I can't seem to compile and run the test program."
10661                 if ./usg; then
10662                         xxx="a USG one, i.e. you use getpgrp()."
10663                 else
10664                         # SVR4 systems can appear rather BSD-ish.
10665                         case "$i_unistd" in
10666                         $undef)
10667                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10668                                 val="$define"
10669                                 ;;
10670                         $define)
10671                                 xxx="probably a USG one, i.e. you use getpgrp()."
10672                                 val="$undef"
10673                                 ;;
10674                         esac
10675                 fi
10676                 echo "Assuming your getpgrp is $xxx" >&4
10677         fi
10678         ;;
10679 *) val="$undef";;
10680 esac
10681 set d_bsdgetpgrp
10682 eval $setvar
10683 $rm_try
10684
10685 : see if setpgrp exists
10686 set setpgrp d_setpgrp
10687 eval $inlibc
10688
10689 case "$d_setpgrp" in
10690 "$define")
10691         echo " "
10692         echo "Checking to see which flavor of setpgrp is in use..."
10693         $cat >try.c <<EOP
10694 #$i_unistd I_UNISTD
10695 #include <sys/types.h>
10696 #ifdef I_UNISTD
10697 #  include <unistd.h>
10698 #endif
10699 #$i_stdlib I_STDLIB
10700 #ifdef I_STDLIB
10701 #include <stdlib.h>
10702 #endif
10703 int main()
10704 {
10705         if (getuid() == 0) {
10706                 printf("(I see you are running Configure as super-user...)\n");
10707                 setuid(1);
10708         }
10709 #ifdef TRY_BSD_PGRP
10710         if (-1 == setpgrp(1, 1))
10711                 exit(0);
10712 #else
10713         if (setpgrp() != -1)
10714                 exit(0);
10715 #endif
10716         exit(1);
10717 }
10718 EOP
10719         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10720                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10721                 val="$define"
10722         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10723                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10724                 val="$undef"
10725         else
10726                 echo "(I can't seem to compile and run the test program.)"
10727                 if ./usg; then
10728                         xxx="a USG one, i.e. you use setpgrp()."
10729                 else
10730                         # SVR4 systems can appear rather BSD-ish.
10731                         case "$i_unistd" in
10732                         $undef)
10733                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10734                                 val="$define"
10735                                 ;;
10736                         $define)
10737                                 xxx="probably a USG one, i.e. you use setpgrp()."
10738                                 val="$undef"
10739                                 ;;
10740                         esac
10741                 fi
10742                 echo "Assuming your setpgrp is $xxx" >&4
10743         fi
10744         ;;
10745 *) val="$undef";;
10746 esac
10747 set d_bsdsetpgrp
10748 eval $setvar
10749 $rm_try
10750
10751 : Look for GCC-style __builtin_choose_expr
10752 case "$d_builtin_choose_expr" in
10753 '')
10754     echo " "
10755     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10756     $cat >try.c <<'EOCP'
10757 #include <assert.h>
10758 #include <stdlib.h>
10759 #include <stdio.h>
10760
10761 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10762
10763 int main(void) {
10764     assert( SYRINX(1) == 2112 );
10765     assert( SYRINX(1) != 5150 );
10766     assert( SYRINX(0) == 5150 );
10767     assert( SYRINX(0) != 2112 );
10768     puts( "All good!" );
10769     exit(0);
10770 }
10771
10772 EOCP
10773     set try
10774     if eval $compile && $run ./try; then
10775         echo "Your C compiler supports __builtin_choose_expr."
10776         val="$define"
10777     else
10778         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10779         val="$undef"
10780     fi
10781 ;;
10782 *) val="$d_builtin_choose_expr" ;;
10783 esac
10784
10785 set d_builtin_choose_expr
10786 eval $setvar
10787 $rm_try
10788
10789 : Look for GCC-style __builtin_expect
10790 case "$d_builtin_expect" in
10791 '')
10792     echo " "
10793     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10794     $cat >try.c <<'EOCP'
10795 int main(void) {
10796     int n = 50;
10797     if ( __builtin_expect(n, 0) ) n = 1;
10798     /* Remember shell exit code truth is 0, C truth is non-zero */
10799     return !(n == 1);
10800 }
10801 EOCP
10802     set try
10803     if eval $compile && $run ./try; then
10804         echo "Your C compiler supports __builtin_expect."
10805         val="$define"
10806     else
10807         echo "Your C compiler doesn't seem to understand __builtin_expect."
10808         val="$undef"
10809     fi
10810     ;;
10811 *) val="$d_builtin_expect" ;;
10812 esac
10813
10814 set d_builtin_expect
10815 eval $setvar
10816 $rm_try
10817
10818 : see if bzero exists
10819 set bzero d_bzero
10820 eval $inlibc
10821
10822 : see if stdarg is available
10823 echo " "
10824 if $test `./findhdr stdarg.h`; then
10825         echo "<stdarg.h> found." >&4
10826         valstd="$define"
10827 else
10828         echo "<stdarg.h> NOT found." >&4
10829         valstd="$undef"
10830 fi
10831
10832 : see if varags is available
10833 echo " "
10834 if $test `./findhdr varargs.h`; then
10835         echo "<varargs.h> found." >&4
10836 else
10837         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10838 fi
10839
10840 : set up the varargs testing programs
10841 $cat > varargs.c <<EOP
10842 #ifdef I_STDARG
10843 #include <stdarg.h>
10844 #endif
10845 #ifdef I_VARARGS
10846 #include <varargs.h>
10847 #endif
10848
10849 #ifdef I_STDARG
10850 int f(char *p, ...)
10851 #else
10852 int f(va_alist)
10853 va_dcl
10854 #endif
10855 {
10856         va_list ap;
10857 #ifndef I_STDARG
10858         char *p;
10859 #endif
10860 #ifdef I_STDARG
10861         va_start(ap,p);
10862 #else
10863         va_start(ap);
10864         p = va_arg(ap, char *);
10865 #endif
10866         va_end(ap);
10867         return 0;
10868 }
10869 EOP
10870 $cat > varargs <<EOP
10871 $startsh
10872 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10873         echo "true"
10874 else
10875         echo "false"
10876 fi
10877 $rm -f varargs$_o
10878 EOP
10879 chmod +x varargs
10880
10881 : now check which varargs header should be included
10882 echo " "
10883 i_varhdr=''
10884 case "$valstd" in
10885 "$define")
10886         if `./varargs I_STDARG`; then
10887                 val='stdarg.h'
10888         elif `./varargs I_VARARGS`; then
10889                 val='varargs.h'
10890         fi
10891         ;;
10892 *)
10893         if `./varargs I_VARARGS`; then
10894                 val='varargs.h'
10895         fi
10896         ;;
10897 esac
10898 case "$val" in
10899 '')
10900 echo "I could not find the definition for va_dcl... You have problems..." >&4
10901         val="$undef"; set i_stdarg; eval $setvar
10902         val="$undef"; set i_varargs; eval $setvar
10903         ;;
10904 *)
10905         set i_varhdr
10906         eval $setvar
10907         case "$i_varhdr" in
10908         stdarg.h)
10909                 val="$define"; set i_stdarg; eval $setvar
10910                 val="$undef"; set i_varargs; eval $setvar
10911                 ;;
10912         varargs.h)
10913                 val="$undef"; set i_stdarg; eval $setvar
10914                 val="$define"; set i_varargs; eval $setvar
10915                 ;;
10916         esac
10917         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10918 esac
10919 $rm -f varargs*
10920
10921 : see if the Compiler supports C99 variadic macros
10922 case "$i_stdarg$i_stdlib" in
10923     "$define$define")
10924     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10925     $cat >try.c <<EOCP
10926 #include <stdio.h>
10927 #include <stdarg.h>
10928
10929 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10930
10931 int main() {
10932   char buf[20];
10933   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10934   puts(buf);
10935   return 0;
10936 }
10937 EOCP
10938     set try
10939     if eval $compile && $run ./try 2>&1 >/dev/null; then
10940         case "`$run ./try`" in
10941             "123 456 789")
10942             echo "You have C99 variadic macros." >&4
10943             d_c99_variadic_macros="$define"
10944             ;;
10945             *)
10946             echo "You don't have functional C99 variadic macros." >&4
10947             d_c99_variadic_macros="$undef"
10948             ;;
10949         esac
10950     else
10951         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10952         d_c99_variadic_macros="$undef"
10953     fi
10954     $rm_try
10955     ;;
10956     *)
10957     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10958     d_c99_variadic_macros="$undef"
10959     ;;
10960 esac
10961
10962 : see if signal is declared as pointer to function returning int or void
10963 echo " "
10964 xxx=`./findhdr signal.h`
10965 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10966 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10967         echo "You have int (*signal())() instead of void." >&4
10968         val="$undef"
10969 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10970         echo "You have void (*signal())()." >&4
10971         val="$define"
10972 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10973         echo "You have int (*signal())() instead of void." >&4
10974         val="$undef"
10975 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10976         echo "You have void (*signal())()." >&4
10977         val="$define"
10978 else
10979         case "$d_voidsig" in
10980         '')
10981         echo "I can't determine whether signal handler returns void or int..." >&4
10982                 dflt=void
10983                 rp="What type does your signal handler return?"
10984                 . ./myread
10985                 case "$ans" in
10986                 v*) val="$define";;
10987                 *) val="$undef";;
10988                 esac;;
10989         "$define")
10990                 echo "As you already told me, signal handler returns void." >&4
10991                 val="$define"
10992                 ;;
10993         *)      echo "As you already told me, signal handler returns int." >&4
10994                 val="$undef"
10995                 ;;
10996         esac
10997 fi
10998 set d_voidsig
10999 eval $setvar
11000 case "$d_voidsig" in
11001 "$define") signal_t="void";;
11002 *) signal_t="int";;
11003 esac
11004 $rm -f $$.tmp
11005
11006 : check for ability to cast large floats to 32-bit ints.
11007 echo " "
11008 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11009 if $test "$intsize" -ge 4; then
11010         xxx=int
11011 else
11012         xxx=long
11013 fi
11014 $cat >try.c <<EOCP
11015 #include <stdio.h>
11016 #$i_stdlib I_STDLIB
11017 #ifdef I_STDLIB
11018 #include <stdlib.h>
11019 #endif
11020 #include <sys/types.h>
11021 #include <signal.h>
11022 $signal_t blech(int s) { exit(3); }
11023 int main()
11024 {
11025         $xxx i32;
11026         double f, g;
11027         int result = 0;
11028         char str[16];
11029         signal(SIGFPE, blech);
11030
11031         /* Don't let compiler optimize the test away.  Store the number
11032            in a writable string for gcc to pass to sscanf under HP-UX.
11033         */
11034         sprintf(str, "2147483647");
11035         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11036         g = 10 * f;
11037         i32  = ($xxx) g;
11038
11039         /* x86 processors will probably give 0x8000 0000, which is a
11040            sign change.  We don't want that.  We want to mimic SPARC
11041            behavior here, which is to preserve the sign and give
11042            back 0x7fff ffff.
11043         */
11044         if (i32 != ($xxx) f)
11045                 result |= 1;
11046         exit(result);
11047 }
11048 EOCP
11049 set try
11050 if eval $compile_ok; then
11051         $run ./try
11052         yyy=$?
11053 else
11054         echo "(I can't seem to compile the test program--assuming it can't)"
11055         yyy=1
11056 fi
11057 case "$yyy" in
11058 0)      val="$define"
11059         echo "Yup, it can."
11060         ;;
11061 *)      val="$undef"
11062         echo "Nope, it can't."
11063         ;;
11064 esac
11065 set d_casti32
11066 eval $setvar
11067 $rm_try
11068
11069 : check for ability to cast negative floats to unsigned
11070 echo " "
11071 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11072 $cat >try.c <<EOCP
11073 #include <stdio.h>
11074 #$i_stdlib I_STDLIB
11075 #ifdef I_STDLIB
11076 #include <stdlib.h>
11077 #endif
11078 #include <sys/types.h>
11079 #include <signal.h>
11080 $signal_t blech(int s) { exit(7); }
11081 $signal_t blech_in_list(int s) { exit(4); }
11082 unsigned long dummy_long(unsigned long p) { return p; }
11083 unsigned int dummy_int(unsigned int p) { return p; }
11084 unsigned short dummy_short(unsigned short p) { return p; }
11085 int main()
11086 {
11087         double f;
11088         unsigned long along;
11089         unsigned int aint;
11090         unsigned short ashort;
11091         int result = 0;
11092         char str[16];
11093
11094         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11095            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11096            optimized the whole file away
11097         */
11098         /* Store the number in a writable string for gcc to pass to
11099            sscanf under HP-UX.
11100         */
11101         sprintf(str, "-123");
11102         sscanf(str, "%lf", &f);  /* f = -123.; */
11103
11104         signal(SIGFPE, blech);
11105         along = (unsigned long)f;
11106         aint = (unsigned int)f;
11107         ashort = (unsigned short)f;
11108         if (along != (unsigned long)-123)
11109                 result |= 1;
11110         if (aint != (unsigned int)-123)
11111                 result |= 1;
11112         if (ashort != (unsigned short)-123)
11113                 result |= 1;
11114         sprintf(str, "1073741824.");
11115         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11116         f = f + f;
11117         along = 0;
11118         along = (unsigned long)f;
11119         if (along != 0x80000000)
11120                 result |= 2;
11121         f -= 1.;
11122         along = 0;
11123         along = (unsigned long)f;
11124         if (along != 0x7fffffff)
11125                 result |= 1;
11126         f += 2.;
11127         along = 0;
11128         along = (unsigned long)f;
11129         if (along != 0x80000001)
11130                 result |= 2;
11131         if (result)
11132                 exit(result);
11133         signal(SIGFPE, blech_in_list);
11134         sprintf(str, "123.");
11135         sscanf(str, "%lf", &f);  /* f = 123.; */
11136         along = dummy_long((unsigned long)f);
11137         aint = dummy_int((unsigned int)f);
11138         ashort = dummy_short((unsigned short)f);
11139         if (along != (unsigned long)123)
11140                 result |= 4;
11141         if (aint != (unsigned int)123)
11142                 result |= 4;
11143         if (ashort != (unsigned short)123)
11144                 result |= 4;
11145         exit(result);
11146
11147 }
11148 EOCP
11149 set try
11150 if eval $compile_ok; then
11151         $run ./try
11152         castflags=$?
11153 else
11154         echo "(I can't seem to compile the test program--assuming it can't)"
11155         castflags=7
11156 fi
11157 case "$castflags" in
11158 0)      val="$define"
11159         echo "Yup, it can."
11160         ;;
11161 *)      val="$undef"
11162         echo "Nope, it can't."
11163         ;;
11164 esac
11165 set d_castneg
11166 eval $setvar
11167 $rm_try
11168
11169 : see if vprintf exists
11170 echo " "
11171 if set vprintf val -f d_vprintf; eval $csym; $val; then
11172         echo 'vprintf() found.' >&4
11173         val="$define"
11174         $cat >try.c <<EOF
11175 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11176 #$i_varargs I_VARARGS
11177
11178 #$i_stdlib I_STDLIB
11179 #$i_unistd I_UNISTD
11180
11181 #ifdef I_STDARG
11182 #  include <stdarg.h>
11183 #else /* I_VARARGS */
11184 #  include <varargs.h>
11185 #endif
11186
11187 #ifdef I_UNISTD
11188 #  include <unistd.h>
11189 #endif
11190
11191 #ifdef I_STDLIB
11192 #  include <stdlib.h>
11193 #endif
11194
11195 #include <stdio.h> /* vsprintf prototype */
11196
11197 #ifdef I_STDARG
11198 void xxx(int n, ...)
11199 {
11200     va_list args;
11201     char buf[10];
11202     va_start(args, n);
11203     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11204 }
11205 int main() { xxx(1, "foo"); }
11206
11207 #else /* I_VARARGS */
11208
11209 xxx(va_alist)
11210 va_dcl
11211 {
11212     va_list args;
11213     char buf[10];
11214     va_start(args);
11215     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11216 }
11217 int main() { xxx("foo"); }
11218
11219 #endif
11220
11221 EOF
11222         set try
11223         if eval $compile_ok; then
11224                 if $run ./try; then
11225                         echo "Your vsprintf() returns (int)." >&4
11226                         val2="$undef"
11227                 else
11228                         echo "Your vsprintf() returns (char*)." >&4
11229                         val2="$define"
11230                 fi
11231         else
11232                 echo 'I am unable to compile the vsprintf() test program.' >&4
11233                 # We shouldn't get here.  If we do, assume the standard signature,
11234                 # not the old BSD one.
11235                 echo 'Guessing that vsprintf() returns (int).' >&4
11236                 val2="$undef"
11237         fi
11238 else
11239         echo 'vprintf() NOT found.' >&4
11240         val="$undef"
11241         val2="$undef"
11242 fi
11243 $rm_try
11244 set d_vprintf
11245 eval $setvar
11246 val=$val2
11247 set d_charvspr
11248 eval $setvar
11249
11250 : see if chown exists
11251 set chown d_chown
11252 eval $inlibc
11253
11254 : see if chroot exists
11255 set chroot d_chroot
11256 eval $inlibc
11257
11258 : see if chsize exists
11259 set chsize d_chsize
11260 eval $inlibc
11261
11262 : see if class exists
11263 set class d_class
11264 eval $inlibc
11265
11266 : see if clearenv exists
11267 set clearenv d_clearenv
11268 eval $inlibc
11269
11270 : Define hasstruct macro for Configure internal use
11271 hasstruct='varname=$1; struct=$2; shift; shift;
11272 while $test $# -ge 2; do
11273         case "$1" in
11274         $define) echo "#include <$2>";;
11275         esac ;
11276     shift 2;
11277 done > try.c;
11278 echo "int main () { struct $struct foo; }" >> try.c;
11279 set try;
11280 if eval $compile; then
11281         val="$define";
11282 else
11283         val="$undef";
11284 fi;
11285 set $varname;
11286 eval $setvar;
11287 $rm_try'
11288
11289 : see whether socket exists
11290 socketlib=''
11291 sockethdr=''
11292 echo " "
11293 $echo $n "Hmm... $c" >&4
11294 if set socket val -f d_socket; eval $csym; $val; then
11295         echo "Looks like you have Berkeley networking support." >&4
11296         d_socket="$define"
11297         if set setsockopt val -f; eval $csym; $val; then
11298                 d_oldsock="$undef"
11299         else
11300                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11301                 d_oldsock="$define"
11302         fi
11303 else
11304         if $contains socklib libc.list >/dev/null 2>&1; then
11305                 echo "Looks like you have Berkeley networking support." >&4
11306                 d_socket="$define"
11307                 : we will have to assume that it supports the 4.2 BSD interface
11308                 d_oldsock="$undef"
11309         else
11310                 echo "You don't have Berkeley networking in libc$_a..." >&4
11311                 if test "X$d_socket" = "X$define"; then
11312                    echo "...but you seem to believe that you have sockets." >&4
11313                 else
11314                         for net in net socket
11315                         do
11316                                 if test -f /usr/lib/lib$net$_a; then
11317                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11318                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11319                                         if $contains socket libc.list >/dev/null 2>&1; then
11320                                                 d_socket="$define"
11321                                                 socketlib="-l$net"
11322                                                 case "$net" in
11323                                                 net)
11324                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11325                                                         sockethdr="-I/usr/netinclude"
11326                                                         ;;
11327                                                 esac
11328                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11329                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11330                                                         d_oldsock="$undef"
11331                                                 else
11332                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11333                                                         d_oldsock="$define"
11334                                                 fi
11335                                                 break
11336                                         fi
11337                                 fi
11338                         done
11339                         if test "X$d_socket" != "X$define"; then
11340                            echo "or anywhere else I see." >&4
11341                            d_socket="$undef"
11342                            d_oldsock="$undef"
11343                         fi
11344                 fi
11345         fi
11346 fi
11347
11348 : see if socketpair exists
11349 set socketpair d_sockpair
11350 eval $inlibc
11351
11352
11353 echo " "
11354 echo "Checking the availability sa_len in the sock struct ..." >&4
11355 $cat >try.c <<EOF
11356 #include <sys/types.h>
11357 #include <sys/socket.h>
11358 int main() {
11359 struct sockaddr sa;
11360 return (sa.sa_len);
11361 }
11362 EOF
11363 val="$undef"
11364 set try; if eval $compile; then
11365         val="$define"
11366 fi
11367 set d_sockaddr_sa_len; eval $setvar
11368 $rm_try
11369
11370 echo " "
11371 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11372 $cat >try.c <<EOF
11373 #include <sys/types.h>
11374 #include <sys/socket.h>
11375 #include <netinet/in.h>
11376 int main() {
11377 struct sockaddr_in6 sin6;
11378 return (sin6.sin6_scope_id);
11379 }
11380 EOF
11381 val="$undef"
11382 set try; if eval $compile; then
11383         val="$define"
11384 fi
11385 set d_sin6_scope_id; eval $setvar
11386 $rm_try
11387
11388 echo " "
11389 echo "Checking the availability of certain socket constants..." >&4
11390 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11391         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11392         $cat >try.c <<EOF
11393 #include <sys/types.h>
11394 #include <sys/socket.h>
11395 int main() {
11396     int i = $ENUM;
11397 }
11398 EOF
11399         val="$undef"
11400         set try; if eval $compile; then
11401                 val="$define"
11402         fi
11403         set d_${enum}; eval $setvar
11404         $rm_try
11405 done
11406
11407 : see if this is a sys/uio.h system
11408 set sys/uio.h i_sysuio
11409 eval $inhdr
11410
11411 : Check for cmsghdr support
11412 echo " "
11413 echo "Checking to see if your system supports struct cmsghdr..." >&4
11414 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11415 eval $hasstruct
11416 case "$d_cmsghdr_s" in
11417 "$define")      echo "Yes, it does."   ;;
11418 *)              echo "No, it doesn't." ;;
11419 esac
11420
11421
11422 : check for const keyword
11423 echo " "
11424 echo 'Checking to see if your C compiler knows about "const"...' >&4
11425 $cat >const.c <<'EOCP'
11426 typedef struct spug { int drokk; } spug;
11427 int main()
11428 {
11429         const char *foo;
11430         const spug y = { 0 };
11431 }
11432 EOCP
11433 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11434         val="$define"
11435         echo "Yup, it does."
11436 else
11437         val="$undef"
11438         echo "Nope, it doesn't."
11439 fi
11440 set d_const
11441 eval $setvar
11442
11443 : see if copysignl exists
11444 set copysignl d_copysignl
11445 eval $inlibc
11446
11447 : see if crypt exists
11448 echo " "
11449 set crypt d_crypt
11450 eval $inlibc
11451 case "$d_crypt" in
11452 $define) cryptlib='' ;;
11453 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11454                 echo 'crypt() found.' >&4
11455                 val="$define"
11456                 cryptlib=''
11457         else
11458                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11459                 if $test -z "$cryptlib"; then
11460                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11461                 else
11462                         cryptlib=-lcrypt
11463                 fi
11464                 if $test -z "$cryptlib"; then
11465                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11466                 else
11467                         cryptlib=-lcrypt
11468                 fi
11469                 if $test -z "$cryptlib"; then
11470                         cryptlib=`./loc libcrypt$_a "" $libpth`
11471                 else
11472                         cryptlib=-lcrypt
11473                 fi
11474                 if $test -z "$cryptlib"; then
11475                         echo 'crypt() NOT found.' >&4
11476                         val="$undef"
11477                 else
11478                         val="$define"
11479                 fi
11480         fi
11481         set d_crypt
11482         eval $setvar
11483         ;;
11484 esac
11485
11486 : see if this is a crypt.h system
11487 set crypt.h i_crypt
11488 eval $inhdr
11489
11490 : see if crypt_r exists
11491 set crypt_r d_crypt_r
11492 eval $inlibc
11493 case "$d_crypt_r" in
11494 "$define")
11495         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11496         case "$d_crypt_r_proto:$usethreads" in
11497         ":define")      d_crypt_r_proto=define
11498                 set d_crypt_r_proto crypt_r $hdrs
11499                 eval $hasproto ;;
11500         *)      ;;
11501         esac
11502         case "$d_crypt_r_proto" in
11503         define)
11504         case "$crypt_r_proto" in
11505         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11506         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11507         esac
11508         case "$crypt_r_proto" in
11509         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11510         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11511         esac
11512         case "$crypt_r_proto" in
11513         ''|0)   d_crypt_r=undef
11514                 crypt_r_proto=0
11515                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11516         * )     case "$crypt_r_proto" in
11517                 REENTRANT_PROTO*) ;;
11518                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11519                 esac
11520                 echo "Prototype: $try" ;;
11521         esac
11522         ;;
11523         *)      case "$usethreads" in
11524                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11525                 esac
11526                 d_crypt_r=undef
11527                 crypt_r_proto=0
11528                 ;;
11529         esac
11530         ;;
11531 *)      crypt_r_proto=0
11532         ;;
11533 esac
11534
11535 : get csh whereabouts
11536 case "$csh" in
11537 'csh') val="$undef" ;;
11538 *) val="$define" ;;
11539 esac
11540 set d_csh
11541 eval $setvar
11542 : Respect a hint or command line value for full_csh.
11543 case "$full_csh" in
11544 '') full_csh=$csh ;;
11545 esac
11546
11547 : see if ctermid exists
11548 set ctermid d_ctermid
11549 eval $inlibc
11550
11551 : see if ctermid_r exists
11552 set ctermid_r d_ctermid_r
11553 eval $inlibc
11554 case "$d_ctermid_r" in
11555 "$define")
11556         hdrs="$i_systypes sys/types.h define stdio.h "
11557         case "$d_ctermid_r_proto:$usethreads" in
11558         ":define")      d_ctermid_r_proto=define
11559                 set d_ctermid_r_proto ctermid_r $hdrs
11560                 eval $hasproto ;;
11561         *)      ;;
11562         esac
11563         case "$d_ctermid_r_proto" in
11564         define)
11565         case "$ctermid_r_proto" in
11566         ''|0) try='char* ctermid_r(char*);'
11567         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11568         esac
11569         case "$ctermid_r_proto" in
11570         ''|0)   d_ctermid_r=undef
11571                 ctermid_r_proto=0
11572                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11573         * )     case "$ctermid_r_proto" in
11574                 REENTRANT_PROTO*) ;;
11575                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11576                 esac
11577                 echo "Prototype: $try" ;;
11578         esac
11579         ;;
11580         *)      case "$usethreads" in
11581                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11582                 esac
11583                 d_ctermid_r=undef
11584                 ctermid_r_proto=0
11585                 ;;
11586         esac
11587         ;;
11588 *)      ctermid_r_proto=0
11589         ;;
11590 esac
11591
11592 : see if ctime_r exists
11593 set ctime_r d_ctime_r
11594 eval $inlibc
11595 case "$d_ctime_r" in
11596 "$define")
11597         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11598         case "$d_ctime_r_proto:$usethreads" in
11599         ":define")      d_ctime_r_proto=define
11600                 set d_ctime_r_proto ctime_r $hdrs
11601                 eval $hasproto ;;
11602         *)      ;;
11603         esac
11604         case "$d_ctime_r_proto" in
11605         define)
11606         case "$ctime_r_proto" in
11607         ''|0) try='char* ctime_r(const time_t*, char*);'
11608         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11609         esac
11610         case "$ctime_r_proto" in
11611         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11612         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11613         esac
11614         case "$ctime_r_proto" in
11615         ''|0) try='int ctime_r(const time_t*, char*);'
11616         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11617         esac
11618         case "$ctime_r_proto" in
11619         ''|0) try='int ctime_r(const time_t*, char*, int);'
11620         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11621         esac
11622         case "$ctime_r_proto" in
11623         ''|0)   d_ctime_r=undef
11624                 ctime_r_proto=0
11625                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11626         * )     case "$ctime_r_proto" in
11627                 REENTRANT_PROTO*) ;;
11628                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11629                 esac
11630                 echo "Prototype: $try" ;;
11631         esac
11632         ;;
11633         *)      case "$usethreads" in
11634                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11635                 esac
11636                 d_ctime_r=undef
11637                 ctime_r_proto=0
11638                 ;;
11639         esac
11640         ;;
11641 *)      ctime_r_proto=0
11642         ;;
11643 esac
11644
11645 : see if cuserid exists
11646 set cuserid d_cuserid
11647 eval $inlibc
11648
11649 : see if this is a limits.h system
11650 set limits.h i_limits
11651 eval $inhdr
11652
11653 : see if this is a float.h system
11654 set float.h i_float
11655 eval $inhdr
11656
11657 : See if number of significant digits in a double precision number is known
11658 echo " "
11659 $cat >dbl_dig.c <<EOM
11660 #$i_limits I_LIMITS
11661 #$i_float I_FLOAT
11662 #ifdef I_LIMITS
11663 #include <limits.h>
11664 #endif
11665 #ifdef I_FLOAT
11666 #include <float.h>
11667 #endif
11668 #ifdef DBL_DIG
11669 printf("Contains DBL_DIG");
11670 #endif
11671 EOM
11672 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11673 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11674         echo "DBL_DIG found." >&4
11675         val="$define"
11676 else
11677         echo "DBL_DIG NOT found." >&4
11678         val="$undef"
11679 fi
11680 $rm -f dbl_dig.?
11681 set d_dbl_dig
11682 eval $setvar
11683
11684 : see if dbm.h is available
11685 : see if dbmclose exists
11686 set dbmclose d_dbmclose
11687 eval $inlibc
11688
11689 case "$d_dbmclose" in
11690 $define)
11691         set dbm.h i_dbm
11692         eval $inhdr
11693         case "$i_dbm" in
11694         $define)
11695                 val="$undef"
11696                 set i_rpcsvcdbm
11697                 eval $setvar
11698                 ;;
11699         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11700                 eval $inhdr
11701                 ;;
11702         esac
11703         ;;
11704 *)      echo "We won't be including <dbm.h>"
11705         val="$undef"
11706         set i_dbm
11707         eval $setvar
11708         val="$undef"
11709         set i_rpcsvcdbm
11710         eval $setvar
11711         ;;
11712 esac
11713
11714 : see if prototype for dbminit is available
11715 echo " "
11716 set d_dbminitproto dbminit $i_dbm dbm.h
11717 eval $hasproto
11718
11719 : see if difftime exists
11720 set difftime d_difftime
11721 eval $inlibc
11722
11723 : see if this is a dirent system
11724 echo " "
11725 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11726         val="$define"
11727         echo "<dirent.h> found." >&4
11728 else
11729         val="$undef"
11730         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11731                 echo "<sys/dir.h> found." >&4
11732                 echo " "
11733         else
11734                 xinc=`./findhdr sys/ndir.h`
11735         fi
11736         echo "<dirent.h> NOT found." >&4
11737 fi
11738 set i_dirent
11739 eval $setvar
11740
11741 : Look for type of directory structure.
11742 echo " "
11743 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11744
11745 case "$direntrytype" in
11746 ''|' ')
11747         case "$i_dirent" in
11748         $define) guess1='struct dirent' ;;
11749         *) guess1='struct direct'  ;;
11750         esac
11751         ;;
11752 *)      guess1="$direntrytype"
11753         ;;
11754 esac
11755
11756 case "$guess1" in
11757 'struct dirent') guess2='struct direct' ;;
11758 *) guess2='struct dirent' ;;
11759 esac
11760
11761 if $contains "$guess1" try.c >/dev/null 2>&1; then
11762         direntrytype="$guess1"
11763         echo "Your directory entries are $direntrytype." >&4
11764 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11765         direntrytype="$guess2"
11766         echo "Your directory entries seem to be $direntrytype." >&4
11767 else
11768         echo "I don't recognize your system's directory entries." >&4
11769         rp="What type is used for directory entries on this system?"
11770         dflt="$guess1"
11771         . ./myread
11772         direntrytype="$ans"
11773 fi
11774 $rm_try
11775
11776 : see if the directory entry stores field length
11777 echo " "
11778 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11779 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11780         echo "Good, your directory entry keeps length information in d_namlen." >&4
11781         val="$define"
11782 else
11783         echo "Your directory entry does not know about the d_namlen field." >&4
11784         val="$undef"
11785 fi
11786 set d_dirnamlen
11787 eval $setvar
11788 $rm_try
11789
11790 : Look for DIR.dd_fd
11791 case "$i_dirent" in
11792 "$define")
11793     echo "Checking to see if DIR has a dd_fd member variable" >&4
11794     $cat >try.c <<EOCP
11795 #$i_stdlib I_STDLIB
11796 #ifdef I_STDLIB
11797 #include <stdlib.h>
11798 #endif
11799 #include <dirent.h>
11800
11801 int main() {
11802     DIR dir;
11803     dir.dd_fd = 1;
11804     return 0;
11805 }
11806 EOCP
11807     val=$undef
11808     set try
11809     if eval $compile; then
11810         echo "Yes, it does."
11811         val="$define"
11812     else
11813         echo "No, it does not."
11814         val="$undef"
11815     fi
11816     ;;
11817 *)
11818     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11819     val="$undef"
11820     ;;
11821 esac
11822 set d_dir_dd_fd
11823 eval $setvar
11824 $rm_try
11825
11826 : see if this is an sysdir system
11827 set sys/dir.h i_sysdir
11828 eval $inhdr
11829
11830 : see if this is an sysndir system
11831 set sys/ndir.h i_sysndir
11832 eval $inhdr
11833
11834 : Look for dirfd
11835 echo " "
11836 $cat >dirfd.c <<EOM
11837 #include <stdio.h>
11838 #$i_stdlib I_STDLIB
11839 #ifdef I_STDLIB
11840 #include <stdlib.h>
11841 #endif
11842 #$i_dirent I_DIRENT             /**/
11843 #$i_sysdir I_SYS_DIR            /**/
11844 #$i_sysndir I_SYS_NDIR          /**/
11845 #$i_systypes I_SYS_TYPES        /**/
11846 #if defined(I_SYS_TYPES)
11847 #include <sys/types.h>
11848 #endif
11849 #if defined(I_DIRENT)
11850 #include <dirent.h>
11851 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11852 #include <sys/dir.h>
11853 #endif
11854 #else
11855 #ifdef I_SYS_NDIR
11856 #include <sys/ndir.h>
11857 #else
11858 #ifdef I_SYS_DIR
11859 #ifdef hp9000s500
11860 #include <ndir.h>       /* may be wrong in the future */
11861 #else
11862 #include <sys/dir.h>
11863 #endif
11864 #endif
11865 #endif
11866 #endif 
11867 int main() {
11868         DIR *dirp = opendir(".");
11869         if (dirfd(dirp) >= 0)
11870                 exit(0);
11871         else
11872                 exit(1);
11873 }
11874 EOM
11875 val=$undef
11876 set dirfd
11877 if eval $compile; then
11878         val="$define"
11879 fi
11880 case "$val" in
11881 $define)        echo "dirfd() found." >&4       ;;
11882 *)              echo "dirfd() NOT found." >&4   ;;
11883 esac
11884 set d_dirfd
11885 eval $setvar
11886 $rm -f dirfd*
11887
11888 : see if dlerror exists
11889 xxx_runnm="$runnm"
11890 runnm=false
11891 set dlerror d_dlerror
11892 eval $inlibc
11893 runnm="$xxx_runnm"
11894
11895 : see if dlfcn is available
11896 set dlfcn.h i_dlfcn
11897 eval $inhdr
11898
11899 : Check what extension to use for shared libs
11900 case "$usedl" in
11901 $define|y|true)
11902         $cat << EOM
11903
11904 On a few systems, the dynamically loaded modules that perl generates and uses
11905 will need a different extension than shared libs. The default will probably
11906 be appropriate.
11907
11908 EOM
11909         case "$dlext" in
11910         '')     dflt="$so" ;;
11911         *)      dflt="$dlext" ;;
11912         esac
11913         rp='What is the extension of dynamically loaded modules'
11914         . ./myread
11915         dlext="$ans"
11916         ;;
11917 *)
11918         dlext="none"
11919         ;;
11920 esac
11921
11922 : Check if dlsym need a leading underscore
11923 echo " "
11924 val="$undef"
11925
11926 case "$dlsrc" in
11927 dl_dlopen.xs)
11928         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11929         $cat >dyna.c <<'EOM'
11930 fred () { }
11931 EOM
11932
11933 $cat >fred.c<<EOM
11934
11935 #include <stdio.h>
11936 #$i_stdlib I_STDLIB
11937 #ifdef I_STDLIB
11938 #include <stdlib.h>
11939 #endif
11940 #$i_dlfcn I_DLFCN
11941 #ifdef I_DLFCN
11942 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11943 #else
11944 #include <sys/types.h>
11945 #include <nlist.h>
11946 #include <link.h>
11947 #endif
11948
11949 extern int fred() ;
11950
11951 int main()
11952 {
11953     void * handle ;
11954     void * symbol ;
11955 #ifndef RTLD_LAZY
11956     int mode = 1 ;
11957 #else
11958     int mode = RTLD_LAZY ;
11959 #endif
11960     handle = dlopen("./dyna.$dlext", mode) ;
11961     if (handle == NULL) {
11962         printf ("1\n") ;
11963         fflush (stdout) ;
11964         exit(0);
11965     }
11966     symbol = dlsym(handle, "fred") ;
11967     if (symbol == NULL) {
11968         /* try putting a leading underscore */
11969         symbol = dlsym(handle, "_fred") ;
11970         if (symbol == NULL) {
11971             printf ("2\n") ;
11972             fflush (stdout) ;
11973             exit(0);
11974         }
11975         printf ("3\n") ;
11976     }
11977     else
11978         printf ("4\n") ;
11979     fflush (stdout) ;
11980     exit(0);
11981 }
11982 EOM
11983         : Call the object file tmp-dyna.o in case dlext=o.
11984         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11985                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11986                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11987                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11988                 xxx=`$run ./fred`
11989                 case $xxx in
11990                 1)      echo "Test program failed using dlopen." >&4
11991                         echo "Perhaps you should not use dynamic loading." >&4;;
11992                 2)      echo "Test program failed using dlsym." >&4
11993                         echo "Perhaps you should not use dynamic loading." >&4;;
11994                 3)      echo "dlsym needs a leading underscore" >&4
11995                         val="$define" ;;
11996                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11997                 esac
11998         else
11999                 echo "I can't compile and run the test program." >&4
12000                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12001         fi
12002         ;;
12003 esac
12004
12005 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12006
12007 set d_dlsymun
12008 eval $setvar
12009
12010 : see if drand48_r exists
12011 set drand48_r d_drand48_r
12012 eval $inlibc
12013 case "$d_drand48_r" in
12014 "$define")
12015         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12016         case "$d_drand48_r_proto:$usethreads" in
12017         ":define")      d_drand48_r_proto=define
12018                 set d_drand48_r_proto drand48_r $hdrs
12019                 eval $hasproto ;;
12020         *)      ;;
12021         esac
12022         case "$d_drand48_r_proto" in
12023         define)
12024         case "$drand48_r_proto" in
12025         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12026         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12027         esac
12028         case "$drand48_r_proto" in
12029         ''|0)   d_drand48_r=undef
12030                 drand48_r_proto=0
12031                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12032         * )     case "$drand48_r_proto" in
12033                 REENTRANT_PROTO*) ;;
12034                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12035                 esac
12036                 echo "Prototype: $try" ;;
12037         esac
12038         ;;
12039         *)      case "$usethreads" in
12040                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12041                 esac
12042                 d_drand48_r=undef
12043                 drand48_r_proto=0
12044                 ;;
12045         esac
12046         ;;
12047 *)      drand48_r_proto=0
12048         ;;
12049 esac
12050
12051 : see if prototype for drand48 is available
12052 echo " "
12053 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12054 eval $hasproto
12055
12056 : see if dup2 exists
12057 set dup2 d_dup2
12058 eval $inlibc
12059
12060 : see if eaccess exists
12061 set eaccess d_eaccess
12062 eval $inlibc
12063
12064 : see if endgrent exists
12065 set endgrent d_endgrent
12066 eval $inlibc
12067
12068 : see if this is an grp system
12069 set grp.h i_grp
12070 eval $inhdr
12071
12072 case "$i_grp" in
12073 $define)
12074         xxx=`./findhdr grp.h`
12075         $cppstdin $cppflags $cppminus < $xxx >$$.h
12076
12077         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12078                 val="$define"
12079         else
12080                 val="$undef"
12081         fi
12082         set d_grpasswd
12083         eval $setvar
12084
12085         $rm -f $$.h
12086         ;;
12087 *)
12088         val="$undef";
12089         set d_grpasswd; eval $setvar
12090         ;;
12091 esac
12092
12093 : see if endgrent_r exists
12094 set endgrent_r d_endgrent_r
12095 eval $inlibc
12096 case "$d_endgrent_r" in
12097 "$define")
12098         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12099         case "$d_endgrent_r_proto:$usethreads" in
12100         ":define")      d_endgrent_r_proto=define
12101                 set d_endgrent_r_proto endgrent_r $hdrs
12102                 eval $hasproto ;;
12103         *)      ;;
12104         esac
12105         case "$d_endgrent_r_proto" in
12106         define)
12107         case "$endgrent_r_proto" in
12108         ''|0) try='int endgrent_r(FILE**);'
12109         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12110         esac
12111         case "$endgrent_r_proto" in
12112         ''|0) try='void endgrent_r(FILE**);'
12113         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12114         esac
12115         case "$endgrent_r_proto" in
12116         ''|0)   d_endgrent_r=undef
12117                 endgrent_r_proto=0
12118                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12119         * )     case "$endgrent_r_proto" in
12120                 REENTRANT_PROTO*) ;;
12121                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12122                 esac
12123                 echo "Prototype: $try" ;;
12124         esac
12125         ;;
12126         *)      case "$usethreads" in
12127                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12128                 esac
12129                 d_endgrent_r=undef
12130                 endgrent_r_proto=0
12131                 ;;
12132         esac
12133         ;;
12134 *)      endgrent_r_proto=0
12135         ;;
12136 esac
12137
12138 : see if endhostent exists
12139 set endhostent d_endhent
12140 eval $inlibc
12141
12142 : see if this is a netdb.h system
12143 set netdb.h i_netdb
12144 eval $inhdr
12145
12146 : see if endhostent_r exists
12147 set endhostent_r d_endhostent_r
12148 eval $inlibc
12149 case "$d_endhostent_r" in
12150 "$define")
12151         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12152         case "$d_endhostent_r_proto:$usethreads" in
12153         ":define")      d_endhostent_r_proto=define
12154                 set d_endhostent_r_proto endhostent_r $hdrs
12155                 eval $hasproto ;;
12156         *)      ;;
12157         esac
12158         case "$d_endhostent_r_proto" in
12159         define)
12160         case "$endhostent_r_proto" in
12161         ''|0) try='int endhostent_r(struct hostent_data*);'
12162         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12163         esac
12164         case "$endhostent_r_proto" in
12165         ''|0) try='void endhostent_r(struct hostent_data*);'
12166         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12167         esac
12168         case "$endhostent_r_proto" in
12169         ''|0)   d_endhostent_r=undef
12170                 endhostent_r_proto=0
12171                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12172         * )     case "$endhostent_r_proto" in
12173                 REENTRANT_PROTO*) ;;
12174                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12175                 esac
12176                 echo "Prototype: $try" ;;
12177         esac
12178         ;;
12179         *)      case "$usethreads" in
12180                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12181                 esac
12182                 d_endhostent_r=undef
12183                 endhostent_r_proto=0
12184                 ;;
12185         esac
12186         ;;
12187 *)      endhostent_r_proto=0
12188         ;;
12189 esac
12190
12191 : see if endnetent exists
12192 set endnetent d_endnent
12193 eval $inlibc
12194
12195 : see if endnetent_r exists
12196 set endnetent_r d_endnetent_r
12197 eval $inlibc
12198 case "$d_endnetent_r" in
12199 "$define")
12200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12201         case "$d_endnetent_r_proto:$usethreads" in
12202         ":define")      d_endnetent_r_proto=define
12203                 set d_endnetent_r_proto endnetent_r $hdrs
12204                 eval $hasproto ;;
12205         *)      ;;
12206         esac
12207         case "$d_endnetent_r_proto" in
12208         define)
12209         case "$endnetent_r_proto" in
12210         ''|0) try='int endnetent_r(struct netent_data*);'
12211         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12212         esac
12213         case "$endnetent_r_proto" in
12214         ''|0) try='void endnetent_r(struct netent_data*);'
12215         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12216         esac
12217         case "$endnetent_r_proto" in
12218         ''|0)   d_endnetent_r=undef
12219                 endnetent_r_proto=0
12220                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12221         * )     case "$endnetent_r_proto" in
12222                 REENTRANT_PROTO*) ;;
12223                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12224                 esac
12225                 echo "Prototype: $try" ;;
12226         esac
12227         ;;
12228         *)      case "$usethreads" in
12229                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12230                 esac
12231                 d_endnetent_r=undef
12232                 endnetent_r_proto=0
12233                 ;;
12234         esac
12235         ;;
12236 *)      endnetent_r_proto=0
12237         ;;
12238 esac
12239
12240 : see if endprotoent exists
12241 set endprotoent d_endpent
12242 eval $inlibc
12243
12244 : see if endprotoent_r exists
12245 set endprotoent_r d_endprotoent_r
12246 eval $inlibc
12247 case "$d_endprotoent_r" in
12248 "$define")
12249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12250         case "$d_endprotoent_r_proto:$usethreads" in
12251         ":define")      d_endprotoent_r_proto=define
12252                 set d_endprotoent_r_proto endprotoent_r $hdrs
12253                 eval $hasproto ;;
12254         *)      ;;
12255         esac
12256         case "$d_endprotoent_r_proto" in
12257         define)
12258         case "$endprotoent_r_proto" in
12259         ''|0) try='int endprotoent_r(struct protoent_data*);'
12260         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12261         esac
12262         case "$endprotoent_r_proto" in
12263         ''|0) try='void endprotoent_r(struct protoent_data*);'
12264         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12265         esac
12266         case "$endprotoent_r_proto" in
12267         ''|0)   d_endprotoent_r=undef
12268                 endprotoent_r_proto=0
12269                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12270         * )     case "$endprotoent_r_proto" in
12271                 REENTRANT_PROTO*) ;;
12272                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12273                 esac
12274                 echo "Prototype: $try" ;;
12275         esac
12276         ;;
12277         *)      case "$usethreads" in
12278                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12279                 esac
12280                 d_endprotoent_r=undef
12281                 endprotoent_r_proto=0
12282                 ;;
12283         esac
12284         ;;
12285 *)      endprotoent_r_proto=0
12286         ;;
12287 esac
12288
12289 : see if endpwent exists
12290 set endpwent d_endpwent
12291 eval $inlibc
12292
12293 : see if this is a pwd.h system
12294 set pwd.h i_pwd
12295 eval $inhdr
12296
12297 case "$i_pwd" in
12298 $define)
12299         xxx=`./findhdr pwd.h`
12300         $cppstdin $cppflags $cppminus < $xxx >$$.h
12301
12302         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12303                 val="$define"
12304         else
12305                 val="$undef"
12306         fi
12307         set d_pwquota
12308         eval $setvar
12309
12310         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12311                 val="$define"
12312         else
12313                 val="$undef"
12314         fi
12315         set d_pwage
12316         eval $setvar
12317
12318         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12319                 val="$define"
12320         else
12321                 val="$undef"
12322         fi
12323         set d_pwchange
12324         eval $setvar
12325
12326         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12327                 val="$define"
12328         else
12329                 val="$undef"
12330         fi
12331         set d_pwclass
12332         eval $setvar
12333
12334         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12335                 val="$define"
12336         else
12337                 val="$undef"
12338         fi
12339         set d_pwexpire
12340         eval $setvar
12341
12342         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12343                 val="$define"
12344         else
12345                 val="$undef"
12346         fi
12347         set d_pwcomment
12348         eval $setvar
12349
12350         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12351                 val="$define"
12352         else
12353                 val="$undef"
12354         fi
12355         set d_pwgecos
12356         eval $setvar
12357
12358         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12359                 val="$define"
12360         else
12361                 val="$undef"
12362         fi
12363         set d_pwpasswd
12364         eval $setvar
12365
12366         $rm -f $$.h
12367         ;;
12368 *)
12369         val="$undef"; 
12370         set d_pwquota; eval $setvar
12371         set d_pwage; eval $setvar
12372         set d_pwchange; eval $setvar
12373         set d_pwclass; eval $setvar
12374         set d_pwexpire; eval $setvar
12375         set d_pwcomment; eval $setvar
12376         set d_pwgecos; eval $setvar
12377         set d_pwpasswd; eval $setvar
12378         ;;
12379 esac
12380
12381 : see if endpwent_r exists
12382 set endpwent_r d_endpwent_r
12383 eval $inlibc
12384 case "$d_endpwent_r" in
12385 "$define")
12386         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12387         case "$d_endpwent_r_proto:$usethreads" in
12388         ":define")      d_endpwent_r_proto=define
12389                 set d_endpwent_r_proto endpwent_r $hdrs
12390                 eval $hasproto ;;
12391         *)      ;;
12392         esac
12393         case "$d_endpwent_r_proto" in
12394         define)
12395         case "$endpwent_r_proto" in
12396         ''|0) try='int endpwent_r(FILE**);'
12397         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12398         esac
12399         case "$endpwent_r_proto" in
12400         ''|0) try='void endpwent_r(FILE**);'
12401         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12402         esac
12403         case "$endpwent_r_proto" in
12404         ''|0)   d_endpwent_r=undef
12405                 endpwent_r_proto=0
12406                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12407         * )     case "$endpwent_r_proto" in
12408                 REENTRANT_PROTO*) ;;
12409                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12410                 esac
12411                 echo "Prototype: $try" ;;
12412         esac
12413         ;;
12414         *)      case "$usethreads" in
12415                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12416                 esac
12417                 d_endpwent_r=undef
12418                 endpwent_r_proto=0
12419                 ;;
12420         esac
12421         ;;
12422 *)      endpwent_r_proto=0
12423         ;;
12424 esac
12425
12426 : see if endservent exists
12427 set endservent d_endsent
12428 eval $inlibc
12429
12430 : see if endservent_r exists
12431 set endservent_r d_endservent_r
12432 eval $inlibc
12433 case "$d_endservent_r" in
12434 "$define")
12435         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12436         case "$d_endservent_r_proto:$usethreads" in
12437         ":define")      d_endservent_r_proto=define
12438                 set d_endservent_r_proto endservent_r $hdrs
12439                 eval $hasproto ;;
12440         *)      ;;
12441         esac
12442         case "$d_endservent_r_proto" in
12443         define)
12444         case "$endservent_r_proto" in
12445         ''|0) try='int endservent_r(struct servent_data*);'
12446         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12447         esac
12448         case "$endservent_r_proto" in
12449         ''|0) try='void endservent_r(struct servent_data*);'
12450         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12451         esac
12452         case "$endservent_r_proto" in
12453         ''|0)   d_endservent_r=undef
12454                 endservent_r_proto=0
12455                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12456         * )     case "$endservent_r_proto" in
12457                 REENTRANT_PROTO*) ;;
12458                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12459                 esac
12460                 echo "Prototype: $try" ;;
12461         esac
12462         ;;
12463         *)      case "$usethreads" in
12464                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12465                 esac
12466                 d_endservent_r=undef
12467                 endservent_r_proto=0
12468                 ;;
12469         esac
12470         ;;
12471 *)      endservent_r_proto=0
12472         ;;
12473 esac
12474
12475 : Locate the flags for 'open()'
12476 echo " "
12477 $cat >try.c <<EOCP
12478 #include <sys/types.h>
12479 #ifdef I_FCNTL
12480 #include <fcntl.h>
12481 #endif
12482 #ifdef I_SYS_FILE
12483 #include <sys/file.h>
12484 #endif
12485 #$i_stdlib I_STDLIB
12486 #ifdef I_STDLIB
12487 #include <stdlib.h>
12488 #endif
12489 int main() {
12490         if(O_RDONLY);
12491 #ifdef O_TRUNC
12492         exit(0);
12493 #else
12494         exit(1);
12495 #endif
12496 }
12497 EOCP
12498 : check sys/file.h first to get FREAD on Sun
12499 if $test `./findhdr sys/file.h` && \
12500                 set try -DI_SYS_FILE && eval $compile; then
12501         h_sysfile=true;
12502         echo "<sys/file.h> defines the O_* constants..." >&4
12503         if $run ./try; then
12504                 echo "and you have the 3 argument form of open()." >&4
12505                 val="$define"
12506         else
12507                 echo "but not the 3 argument form of open().  Oh, well." >&4
12508                 val="$undef"
12509         fi
12510 elif $test `./findhdr fcntl.h` && \
12511                 set try -DI_FCNTL && eval $compile; then
12512         h_fcntl=true;
12513         echo "<fcntl.h> defines the O_* constants..." >&4
12514         if $run ./try; then
12515                 echo "and you have the 3 argument form of open()." >&4
12516                 val="$define"
12517         else
12518                 echo "but not the 3 argument form of open().  Oh, well." >&4
12519                 val="$undef"
12520         fi
12521 else
12522         val="$undef"
12523         echo "I can't find the O_* constant definitions!  You got problems." >&4
12524 fi
12525 set d_open3
12526 eval $setvar
12527 $rm_try
12528
12529 : see if this is a sys/file.h system
12530 val=''
12531 set sys/file.h val
12532 eval $inhdr
12533
12534 : do we need to include sys/file.h ?
12535 case "$val" in
12536 "$define")
12537         echo " "
12538         if $h_sysfile; then
12539                 val="$define"
12540                 echo "We'll be including <sys/file.h>." >&4
12541         else
12542                 val="$undef"
12543                 echo "We won't be including <sys/file.h>." >&4
12544         fi
12545         ;;
12546 *)
12547         h_sysfile=false
12548         ;;
12549 esac
12550 set i_sysfile
12551 eval $setvar
12552
12553 : see if fcntl.h is there
12554 val=''
12555 set fcntl.h val
12556 eval $inhdr
12557
12558 : see if we can include fcntl.h
12559 case "$val" in
12560 "$define")
12561         echo " "
12562         if $h_fcntl; then
12563                 val="$define"
12564                 echo "We'll be including <fcntl.h>." >&4
12565         else
12566                 val="$undef"
12567                 if $h_sysfile; then
12568         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12569                 else
12570                         echo "We won't be including <fcntl.h>." >&4
12571                 fi
12572         fi
12573         ;;
12574 *)
12575         h_fcntl=false
12576         val="$undef"
12577         ;;
12578 esac
12579 set i_fcntl
12580 eval $setvar
12581
12582 : see if fork exists
12583 set fork d_fork
12584 eval $inlibc
12585
12586 : see if pipe exists
12587 set pipe d_pipe
12588 eval $inlibc
12589
12590 : check for non-blocking I/O stuff
12591 case "$h_sysfile" in
12592 true) echo "#include <sys/file.h>" > head.c;;
12593 *)
12594        case "$h_fcntl" in
12595        true) echo "#include <fcntl.h>" > head.c;;
12596        *) echo "#include <sys/fcntl.h>" > head.c;;
12597        esac
12598        ;;
12599 esac
12600 echo " "
12601 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12602 case "$o_nonblock" in
12603 '')
12604         $cat head.c > try.c
12605         $cat >>try.c <<EOCP
12606 #include <stdio.h>
12607 #$i_stdlib I_STDLIB
12608 #ifdef I_STDLIB
12609 #include <stdlib.h>
12610 #endif
12611 #$i_fcntl I_FCNTL
12612 #ifdef I_FCNTL
12613 #include <fcntl.h>
12614 #endif
12615 int main() {
12616 #ifdef O_NONBLOCK
12617         printf("O_NONBLOCK\n");
12618         exit(0);
12619 #endif
12620 #ifdef O_NDELAY
12621         printf("O_NDELAY\n");
12622         exit(0);
12623 #endif
12624 #ifdef FNDELAY
12625         printf("FNDELAY\n");
12626         exit(0);
12627 #endif
12628         exit(0);
12629 }
12630 EOCP
12631         set try
12632         if eval $compile_ok; then
12633                 o_nonblock=`$run ./try`
12634                 case "$o_nonblock" in
12635                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12636                 *) echo "Seems like we can use $o_nonblock.";;
12637                 esac
12638         else
12639                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12640         fi
12641         ;;
12642 *) echo "Using $hint value $o_nonblock.";;
12643 esac
12644 $rm_try
12645
12646 echo " "
12647 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12648 case "$eagain" in
12649 '')
12650         case "$d_fork:$d_pipe" in
12651         define:define)
12652         $cat head.c > try.c
12653         $cat >>try.c <<EOCP
12654 #include <errno.h>
12655 #include <sys/types.h>
12656 #include <signal.h>
12657 #include <stdio.h>
12658 #$i_stdlib I_STDLIB
12659 #ifdef I_STDLIB
12660 #include <stdlib.h>
12661 #endif
12662 #$i_fcntl I_FCNTL
12663 #ifdef I_FCNTL
12664 #include <fcntl.h>
12665 #endif
12666 #define MY_O_NONBLOCK $o_nonblock
12667 #ifndef errno  /* XXX need better Configure test */
12668 extern int errno;
12669 #endif
12670 #$i_unistd I_UNISTD
12671 #ifdef I_UNISTD
12672 #include <unistd.h>
12673 #endif
12674 #$i_string I_STRING
12675 #ifdef I_STRING
12676 #include <string.h>
12677 #else
12678 #include <strings.h>
12679 #endif
12680 $signal_t blech(int x) { exit(3); }
12681 EOCP
12682         $cat >> try.c <<'EOCP'
12683 int main()
12684 {
12685         int pd[2];
12686         int pu[2];
12687         char buf[1];
12688         char string[100];
12689
12690         pipe(pd);       /* Down: child -> parent */
12691         pipe(pu);       /* Up: parent -> child */
12692         if (0 != fork()) {
12693                 int ret;
12694                 close(pd[1]);   /* Parent reads from pd[0] */
12695                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12696 #ifdef F_SETFL
12697                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12698                         exit(1);
12699 #else
12700                 exit(4);
12701 #endif
12702                 signal(SIGALRM, blech);
12703                 alarm(5);
12704                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12705                         exit(2);
12706                 sprintf(string, "%d\n", ret);
12707                 write(2, string, strlen(string));
12708                 alarm(0);
12709 #ifdef EAGAIN
12710                 if (errno == EAGAIN) {
12711                         printf("EAGAIN\n");
12712                         goto ok;
12713                 }
12714 #endif
12715 #ifdef EWOULDBLOCK
12716                 if (errno == EWOULDBLOCK)
12717                         printf("EWOULDBLOCK\n");
12718 #endif
12719         ok:
12720                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12721                 sleep(2);                               /* Give it time to close our pipe */
12722                 alarm(5);
12723                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12724                 alarm(0);
12725                 sprintf(string, "%d\n", ret);
12726                 write(4, string, strlen(string));
12727                 exit(0);
12728         }
12729
12730         close(pd[0]);                   /* We write to pd[1] */
12731         close(pu[1]);                   /* We read from pu[0] */
12732         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12733         close(pd[1]);                   /* Pipe pd is now fully closed! */
12734         exit(0);                                /* Bye bye, thank you for playing! */
12735 }
12736 EOCP
12737         set try
12738         if eval $compile_ok; then
12739                 echo "$startsh" >mtry
12740                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12741                 chmod +x mtry
12742                 ./mtry >/dev/null 2>&1
12743                 case $? in
12744                 0) eagain=`$cat try.out`;;
12745                 1) echo "Could not perform non-blocking setting!";;
12746                 2) echo "I did a successful read() for something that was not there!";;
12747                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12748                 4) echo "Could not find F_SETFL!";;
12749                 *) echo "Something terribly wrong happened during testing.";;
12750                 esac
12751                 rd_nodata=`$cat try.ret`
12752                 echo "A read() system call with no data present returns $rd_nodata."
12753                 case "$rd_nodata" in
12754                 0|-1) ;;
12755                 *)
12756                         echo "(That's peculiar, fixing that to be -1.)"
12757                         rd_nodata=-1
12758                         ;;
12759                 esac
12760                 case "$eagain" in
12761                 '')
12762                         echo "Forcing errno EAGAIN on read() with no data available."
12763                         eagain=EAGAIN
12764                         ;;
12765                 *)
12766                         echo "Your read() sets errno to $eagain when no data is available."
12767                         ;;
12768                 esac
12769                 status=`$cat try.err`
12770                 case "$status" in
12771                 0) echo "And it correctly returns 0 to signal EOF.";;
12772                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12773                 *) echo "However, your read() returns '$status' on EOF??";;
12774                 esac
12775                 val="$define"
12776                 if test "$status" = "$rd_nodata"; then
12777                         echo "WARNING: you can't distinguish between EOF and no data!"
12778                         val="$undef"
12779                 fi
12780         else
12781                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12782                 eagain=EAGAIN
12783         fi
12784         ;;
12785         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12786                 eagain=EAGAIN
12787                 val="$define"
12788                 ;;
12789         esac
12790         set d_eofnblk
12791         eval $setvar
12792         ;;
12793 *)
12794         echo "Using $hint value $eagain."
12795         echo "Your read() returns $rd_nodata when no data is present."
12796         case "$d_eofnblk" in
12797         "$define") echo "And you can see EOF because read() returns 0.";;
12798         "$undef") echo "But you can't see EOF status from read() returned value.";;
12799         *)
12800                 echo "(Assuming you can't see EOF status from read anyway.)"
12801                 d_eofnblk=$undef
12802                 ;;
12803         esac
12804         ;;
12805 esac
12806 $rm_try head.c mtry
12807
12808 : see if _ptr and _cnt from stdio act std
12809 echo " "
12810
12811 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12812         echo "(Looks like you have stdio.h from BSD.)"
12813         case "$stdio_ptr" in
12814         '') stdio_ptr='((fp)->_p)'
12815                 ptr_lval=$define
12816                 ;;
12817         *)      ptr_lval=$d_stdio_ptr_lval;;
12818         esac
12819         case "$stdio_cnt" in
12820         '') stdio_cnt='((fp)->_r)'
12821                 cnt_lval=$define
12822                 ;;
12823         *)      cnt_lval=$d_stdio_cnt_lval;;
12824         esac
12825         case "$stdio_base" in
12826         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12827         esac
12828         case "$stdio_bufsiz" in
12829         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12830         esac
12831 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12832         echo "(Looks like you have stdio.h from Linux.)"
12833         case "$stdio_ptr" in
12834         '') stdio_ptr='((fp)->_IO_read_ptr)'
12835                 ptr_lval=$define
12836                 ;;
12837         *)      ptr_lval=$d_stdio_ptr_lval;;
12838         esac
12839         case "$stdio_cnt" in
12840         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12841                 cnt_lval=$undef
12842                 ;;
12843         *)      cnt_lval=$d_stdio_cnt_lval;;
12844         esac
12845         case "$stdio_base" in
12846         '') stdio_base='((fp)->_IO_read_base)';;
12847         esac
12848         case "$stdio_bufsiz" in
12849         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12850         esac
12851 else
12852         case "$stdio_ptr" in
12853         '') stdio_ptr='((fp)->_ptr)'
12854                 ptr_lval=$define
12855                 ;;
12856         *)      ptr_lval=$d_stdio_ptr_lval;;
12857         esac
12858         case "$stdio_cnt" in
12859         '') stdio_cnt='((fp)->_cnt)'
12860                 cnt_lval=$define
12861                 ;;
12862         *)      cnt_lval=$d_stdio_cnt_lval;;
12863         esac
12864         case "$stdio_base" in
12865         '') stdio_base='((fp)->_base)';;
12866         esac
12867         case "$stdio_bufsiz" in
12868         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12869         esac
12870 fi
12871
12872 : test whether _ptr and _cnt really work
12873 echo "Checking how std your stdio is..." >&4
12874 $cat >try.c <<EOP
12875 #include <stdio.h>
12876 #$i_stdlib I_STDLIB
12877 #ifdef I_STDLIB
12878 #include <stdlib.h>
12879 #endif
12880 #define FILE_ptr(fp)    $stdio_ptr
12881 #define FILE_cnt(fp)    $stdio_cnt
12882 int main() {
12883         FILE *fp = fopen("try.c", "r");
12884         char c = getc(fp);
12885         if (
12886                 18 <= FILE_cnt(fp) &&
12887                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12888         )
12889                 exit(0);
12890         exit(1);
12891 }
12892 EOP
12893 val="$undef"
12894 set try
12895 if eval $compile && $to try.c; then
12896         if $run ./try; then
12897                 echo "Your stdio acts pretty std."
12898                 val="$define"
12899         else
12900                 echo "Your stdio isn't very std."
12901         fi
12902 else
12903         echo "Your stdio doesn't appear very std."
12904 fi
12905 $rm_try
12906
12907 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12908 # direct buffer manipulation no longer works.  The Configure tests
12909 # should be changed to correctly detect this, but until then,
12910 # the following check should at least let perl compile and run.
12911 # (This quick fix should be updated before 5.8.1.)
12912 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12913 # A. Dougherty, June 3, 2002.
12914 case "$d_gnulibc" in
12915 $define)
12916         case "$gnulibc_version" in
12917         2.[01]*)  ;;
12918         2.2) ;;
12919         2.2.[0-9]) ;;
12920         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12921                 val="$undef"
12922                 ;;
12923         esac
12924         ;;
12925 esac
12926 set d_stdstdio
12927 eval $setvar
12928
12929 : Can _ptr be used as an lvalue?
12930 case "$d_stdstdio$ptr_lval" in
12931 $define$define) val=$define ;;
12932 *) val=$undef ;;
12933 esac
12934 set d_stdio_ptr_lval
12935 eval $setvar
12936
12937 : Can _cnt be used as an lvalue?
12938 case "$d_stdstdio$cnt_lval" in
12939 $define$define) val=$define ;;
12940 *) val=$undef ;;
12941 esac
12942 set d_stdio_cnt_lval
12943 eval $setvar
12944
12945
12946 : test whether setting _ptr sets _cnt as a side effect
12947 d_stdio_ptr_lval_sets_cnt="$undef"
12948 d_stdio_ptr_lval_nochange_cnt="$undef"
12949 case "$d_stdio_ptr_lval$d_stdstdio" in
12950 $define$define)
12951         echo "Checking to see what happens if we set the stdio ptr..." >&4
12952 $cat >try.c <<EOP
12953 #include <stdio.h>
12954 /* Can we scream? */
12955 /* Eat dust sed :-) */
12956 /* In the buffer space, no one can hear you scream. */
12957 #$i_stdlib I_STDLIB
12958 #ifdef I_STDLIB
12959 #include <stdlib.h>
12960 #endif
12961 #define FILE_ptr(fp)    $stdio_ptr
12962 #define FILE_cnt(fp)    $stdio_cnt
12963 #include <sys/types.h>
12964 int main() {
12965         FILE *fp = fopen("try.c", "r");
12966         int c;
12967         char *ptr;
12968         size_t cnt;
12969         if (!fp) {
12970             puts("Fail even to read");
12971             exit(1);
12972         }
12973         c = getc(fp); /* Read away the first # */
12974         if (c == EOF) {
12975             puts("Fail even to read");
12976             exit(1);
12977         }
12978         if (!(
12979                 18 <= FILE_cnt(fp) &&
12980                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12981         )) {
12982                 puts("Fail even to read");
12983                 exit (1);
12984         }
12985         ptr = (char*) FILE_ptr(fp);
12986         cnt = (size_t)FILE_cnt(fp);
12987
12988         FILE_ptr(fp) += 42;
12989
12990         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12991                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12992                 exit (1);
12993         }
12994         if (FILE_cnt(fp) <= 20) {
12995                 printf ("Fail (<20 chars to test)");
12996                 exit (1);
12997         }
12998         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12999                 puts("Fail compare");
13000                 exit (1);
13001         }
13002         if (cnt == FILE_cnt(fp)) {
13003                 puts("Pass_unchanged");
13004                 exit (0);
13005         }
13006         if (FILE_cnt(fp) == (cnt - 42)) {
13007                 puts("Pass_changed");
13008                 exit (0);
13009         }
13010         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13011         return 1;
13012
13013 }
13014 EOP
13015         set try
13016         if eval $compile && $to try.c; then
13017                 case `$run ./try` in
13018                 Pass_changed)
13019                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13020                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13021                 Pass_unchanged)
13022                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13023                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13024                 Fail*)
13025                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13026                 *)
13027                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13028         esac
13029         else
13030                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13031         fi
13032         $rm_try
13033         ;;
13034 esac
13035
13036 : see if _base is also standard
13037 val="$undef"
13038 case "$d_stdstdio" in
13039 $define)
13040         $cat >try.c <<EOP
13041 #include <stdio.h>
13042 #$i_stdlib I_STDLIB
13043 #ifdef I_STDLIB
13044 #include <stdlib.h>
13045 #endif
13046 #define FILE_base(fp)   $stdio_base
13047 #define FILE_bufsiz(fp) $stdio_bufsiz
13048 int main() {
13049         FILE *fp = fopen("try.c", "r");
13050         char c = getc(fp);
13051         if (
13052                 19 <= FILE_bufsiz(fp) &&
13053                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13054         )
13055                 exit(0);
13056         exit(1);
13057 }
13058 EOP
13059         set try
13060         if eval $compile && $to try.c; then
13061                 if $run ./try; then
13062                         echo "And its _base field acts std."
13063                         val="$define"
13064                 else
13065                         echo "But its _base field isn't std."
13066                 fi
13067         else
13068                 echo "However, it seems to be lacking the _base field."
13069         fi
13070         $rm_try
13071         ;;
13072 esac
13073 set d_stdiobase
13074 eval $setvar
13075
13076 : see if fast_stdio exists
13077 val="$undef"
13078 case "$d_stdstdio:$d_stdio_ptr_lval" in
13079 "$define:$define")
13080         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13081         *$define*)
13082                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13083                 val="$define"
13084                 ;;
13085         esac
13086         ;;
13087 esac
13088 set d_faststdio
13089 eval $setvar
13090
13091
13092
13093 : see if fchdir exists
13094 set fchdir d_fchdir
13095 eval $inlibc
13096
13097 : see if fchmod exists
13098 set fchmod d_fchmod
13099 eval $inlibc
13100
13101 : see if fchown exists
13102 set fchown d_fchown
13103 eval $inlibc
13104
13105 : see if this is an fcntl system
13106 set fcntl d_fcntl
13107 eval $inlibc
13108
13109 : See if fcntl-based locking works.
13110 echo " "
13111 $cat >try.c <<EOCP
13112 #$i_stdlib I_STDLIB
13113 #ifdef I_STDLIB
13114 #include <stdlib.h>
13115 #endif
13116 #include <unistd.h>
13117 #include <fcntl.h>
13118 #include <signal.h>
13119 $signal_t blech(int x) { exit(3); }
13120 int main() {
13121 #if defined(F_SETLK) && defined(F_SETLKW)
13122      struct flock flock;
13123      int retval, fd;
13124      fd = open("try.c", O_RDONLY);
13125      flock.l_type = F_RDLCK;
13126      flock.l_whence = SEEK_SET;
13127      flock.l_start = flock.l_len = 0;
13128      signal(SIGALRM, blech);
13129      alarm(10);
13130      retval = fcntl(fd, F_SETLK, &flock);
13131      close(fd);
13132      (retval < 0 ? exit(2) : exit(0));
13133 #else
13134      exit(2);
13135 #endif
13136 }
13137 EOCP
13138 echo "Checking if fcntl-based file locking works... "
13139 case "$d_fcntl" in
13140 "$define")
13141         set try
13142         if eval $compile_ok; then
13143                 if $run ./try; then
13144                         echo "Yes, it seems to work."
13145                         val="$define"
13146                 else
13147                         echo "Nope, it didn't work."
13148                         val="$undef"
13149                         case "$?" in
13150                         3) $cat >&4 <<EOM
13151 ***
13152 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13153 *** This is (almost) impossible.
13154 *** If your NFS lock daemons are not feeling well, something like
13155 *** this may happen, please investigate.  Cannot continue, aborting.
13156 ***
13157 EOM
13158                                 exit 1
13159                                 ;;
13160                         esac
13161                 fi
13162         else
13163                 echo "I'm unable to compile the test program, so I'll assume not."
13164                 val="$undef"
13165         fi
13166         ;;
13167 *) val="$undef";
13168         echo "Nope, since you don't even have fcntl()."
13169         ;;
13170 esac
13171 set d_fcntl_can_lock
13172 eval $setvar
13173 $rm_try
13174
13175 : check for fd_set items
13176 $cat <<EOM
13177
13178 Checking to see how well your C compiler handles fd_set and friends ...
13179 EOM
13180 $cat >try.c <<EOCP
13181 #$i_stdlib I_STDLIB
13182 #ifdef I_STDLIB
13183 #include <stdlib.h>
13184 #endif
13185 #$i_systime I_SYS_TIME
13186 #$i_sysselct I_SYS_SELECT
13187 #$d_socket HAS_SOCKET
13188 #include <sys/types.h>
13189 #ifdef HAS_SOCKET
13190 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13191 #endif
13192 #ifdef I_SYS_TIME
13193 #include <sys/time.h>
13194 #endif
13195 #ifdef I_SYS_SELECT
13196 #include <sys/select.h>
13197 #endif
13198 int main() {
13199         fd_set fds;
13200
13201 #ifdef TRYBITS
13202         if(fds.fds_bits);
13203 #endif
13204
13205 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13206         exit(0);
13207 #else
13208         exit(1);
13209 #endif
13210 }
13211 EOCP
13212 set try -DTRYBITS
13213 if eval $compile; then
13214         d_fds_bits="$define"
13215         d_fd_set="$define"
13216         echo "Well, your system knows about the normal fd_set typedef..." >&4
13217         if $run ./try; then
13218                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13219                 d_fd_macros="$define"
13220         else
13221                 $cat >&4 <<'EOM'
13222 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13223 EOM
13224                 d_fd_macros="$undef"
13225         fi
13226 else
13227         $cat <<'EOM'
13228 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13229 EOM
13230         set try
13231         if eval $compile; then
13232                 d_fds_bits="$undef"
13233                 d_fd_set="$define"
13234                 echo "Well, your system has some sort of fd_set available..." >&4
13235                 if $run ./try; then
13236                         echo "and you have the normal fd_set macros." >&4
13237                         d_fd_macros="$define"
13238                 else
13239                         $cat <<'EOM'
13240 but not the normal fd_set macros!  Gross!  More work for me...
13241 EOM
13242                         d_fd_macros="$undef"
13243                 fi
13244         else
13245         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13246                 d_fd_set="$undef"
13247                 d_fds_bits="$undef"
13248                 d_fd_macros="$undef"
13249         fi
13250 fi
13251 $rm_try
13252
13253 : see if fgetpos exists
13254 set fgetpos d_fgetpos
13255 eval $inlibc
13256
13257 : see if finite exists
13258 set finite d_finite
13259 eval $inlibc
13260
13261 : see if finitel exists
13262 set finitel d_finitel
13263 eval $inlibc
13264
13265 : see if flock exists
13266 set flock d_flock
13267 eval $inlibc
13268
13269 : see if prototype for flock is available
13270 echo " "
13271 set d_flockproto flock $i_sysfile sys/file.h
13272 eval $hasproto
13273
13274 : see if fp_class exists
13275 set fp_class d_fp_class
13276 eval $inlibc
13277
13278 : see if pathconf exists
13279 set pathconf d_pathconf
13280 eval $inlibc
13281
13282 : see if fpathconf exists
13283 set fpathconf d_fpathconf
13284 eval $inlibc
13285
13286 : see if fpclass exists
13287 set fpclass d_fpclass
13288 eval $inlibc
13289
13290 : see if fpclassify exists
13291 set fpclassify d_fpclassify
13292 eval $inlibc
13293
13294 : see if fpclassl exists
13295 set fpclassl d_fpclassl
13296 eval $inlibc
13297
13298 : check for fpos64_t
13299 echo " "
13300 echo "Checking to see if you have fpos64_t..." >&4
13301 $cat >try.c <<EOCP
13302 #include <stdio.h>
13303 int main() { fpos64_t x = 7; }
13304 EOCP
13305 set try
13306 if eval $compile; then
13307         val="$define"
13308         echo "You have fpos64_t."
13309 else
13310         val="$undef"
13311         echo "You do not have fpos64_t."
13312         case "$fpossize" in
13313         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13314         esac
13315 fi
13316 $rm_try
13317 set d_fpos64_t
13318 eval $setvar
13319
13320 : see if frexpl exists
13321 set frexpl d_frexpl
13322 eval $inlibc
13323
13324 : see if this is a sys/param system
13325 set sys/param.h i_sysparam
13326 eval $inhdr
13327
13328 : see if this is a sys/mount.h system
13329 set sys/mount.h i_sysmount
13330 eval $inhdr
13331
13332 : Check for fs_data_s
13333 echo " "
13334 echo "Checking to see if your system supports struct fs_data..." >&4
13335 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13336 eval $hasstruct
13337 case "$d_fs_data_s" in
13338 "$define")      echo "Yes, it does."   ;;
13339 *)              echo "No, it doesn't." ;;
13340 esac
13341
13342 : see if fseeko exists
13343 set fseeko d_fseeko
13344 eval $inlibc
13345 case "$longsize" in
13346 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13347 esac
13348
13349 : see if fsetpos exists
13350 set fsetpos d_fsetpos
13351 eval $inlibc
13352
13353 : see if fstatfs exists
13354 set fstatfs d_fstatfs
13355 eval $inlibc
13356
13357 : see if statvfs exists
13358 set statvfs d_statvfs
13359 eval $inlibc
13360
13361 : see if fstatvfs exists
13362 set fstatvfs d_fstatvfs
13363 eval $inlibc
13364
13365
13366 : see if fsync exists
13367 set fsync d_fsync
13368 eval $inlibc
13369
13370 : see if ftello exists
13371 set ftello d_ftello
13372 eval $inlibc
13373 case "$longsize" in
13374 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13375 esac
13376
13377 : check for a working futimes
13378 d_futimes="$undef"
13379 echo " "
13380 echo "Checking if you have a working futimes()" >&4
13381 $cat >try.c <<EOCP
13382 #include <stdio.h>
13383 #include <sys/time.h>
13384 #include <errno.h>
13385 #include <fcntl.h>
13386
13387 int main ()
13388 {
13389     int fd, rv;
13390     fd = open ("try.c", O_RDWR);
13391     if (-1 == fd) exit (1);
13392     rv = futimes (fd, NULL);
13393     exit (rv == -1 ? errno : 0);
13394 }
13395 EOCP
13396 set try
13397 if eval $compile; then
13398     `$run ./try`
13399     rc=$?
13400     case "$rc" in
13401         0)  echo "Yes, you have" >&4
13402             d_futimes="$define"
13403             ;;
13404         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13405             ;;
13406     esac
13407 else
13408     echo "No, it does not (probably harmless)" >&4
13409 fi
13410 $rm_try
13411
13412 : see if ndbm.h is available
13413 set ndbm.h i_ndbm
13414 eval $inhdr
13415 : Compatibility location for RedHat 7.1
13416 set gdbm/ndbm.h i_gdbmndbm
13417 eval $inhdr
13418 : Compatibility location for Debian 4.0
13419 set gdbm-ndbm.h i_gdbm_ndbm
13420 eval $inhdr
13421
13422 val="$undef"
13423 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13424         : see if dbm_open exists
13425         set dbm_open d_dbm_open
13426         eval $inlibc
13427         case "$d_dbm_open" in
13428         $undef)
13429                 i_ndbm="$undef"
13430                 i_gdbmndbm="$undef"
13431                 i_gdbm_ndbm="$undef"
13432                 echo "We won't be including <ndbm.h>"
13433                 val="$undef"
13434                 ;;
13435         *) val="$define"
13436            ;;
13437         esac
13438 fi
13439 set d_ndbm
13440 eval $setvar
13441
13442 ndbm_hdr_protochk='name=$1; hdr=$2;
13443 eval "ihdr=\$""i_$name";
13444 val="$undef";
13445 if $test "$ihdr" = "$define"; then
13446         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13447         case "$d_cplusplus" in
13448         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13449         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13450         esac;
13451         case "$val" in
13452         $define) $echo "Your <$hdr> seems to have prototypes";;
13453         *) $echo "Your <$hdr> does not seem to have prototypes";;
13454         esac;
13455 fi;
13456 set "d_${name}_h_uses_prototypes";
13457 eval $setvar'
13458
13459 set ndbm ndbm.h
13460 eval $ndbm_hdr_protochk
13461 set gdbmndbm gdbm/ndbm.h
13462 eval $ndbm_hdr_protochk
13463 set gdbm_ndbm gdbm-ndbm.h
13464 eval $ndbm_hdr_protochk
13465
13466 : see if getaddrinfo exists
13467 set getaddrinfo d_getaddrinfo
13468 eval $inlibc
13469
13470 : see if getcwd exists
13471 set getcwd d_getcwd
13472 eval $inlibc
13473
13474 : see if getespwnam exists
13475 set getespwnam d_getespwnam
13476 eval $inlibc
13477
13478 : see if getfsstat exists
13479 set getfsstat d_getfsstat
13480 eval $inlibc
13481
13482 : see if getgrent exists
13483 set getgrent d_getgrent
13484 eval $inlibc
13485
13486 : see if getgrent_r exists
13487 set getgrent_r d_getgrent_r
13488 eval $inlibc
13489 case "$d_getgrent_r" in
13490 "$define")
13491         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13492         case "$d_getgrent_r_proto:$usethreads" in
13493         ":define")      d_getgrent_r_proto=define
13494                 set d_getgrent_r_proto getgrent_r $hdrs
13495                 eval $hasproto ;;
13496         *)      ;;
13497         esac
13498         case "$d_getgrent_r_proto" in
13499         define)
13500         case "$getgrent_r_proto" in
13501         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13502         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13503         esac
13504         case "$getgrent_r_proto" in
13505         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13506         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13507         esac
13508         case "$getgrent_r_proto" in
13509         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13510         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13511         esac
13512         case "$getgrent_r_proto" in
13513         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13514         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13515         esac
13516         case "$getgrent_r_proto" in
13517         ''|0) try='int getgrent_r(struct group*, char*, int);'
13518         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13519         esac
13520         case "$getgrent_r_proto" in
13521         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13522         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13523         esac
13524         case "$getgrent_r_proto" in
13525         ''|0)   d_getgrent_r=undef
13526                 getgrent_r_proto=0
13527                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13528         * )     case "$getgrent_r_proto" in
13529                 REENTRANT_PROTO*) ;;
13530                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13531                 esac
13532                 echo "Prototype: $try" ;;
13533         esac
13534         ;;
13535         *)      case "$usethreads" in
13536                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13537                 esac
13538                 d_getgrent_r=undef
13539                 getgrent_r_proto=0
13540                 ;;
13541         esac
13542         ;;
13543 *)      getgrent_r_proto=0
13544         ;;
13545 esac
13546
13547 : see if getgrgid_r exists
13548 set getgrgid_r d_getgrgid_r
13549 eval $inlibc
13550 case "$d_getgrgid_r" in
13551 "$define")
13552         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13553         case "$d_getgrgid_r_proto:$usethreads" in
13554         ":define")      d_getgrgid_r_proto=define
13555                 set d_getgrgid_r_proto getgrgid_r $hdrs
13556                 eval $hasproto ;;
13557         *)      ;;
13558         esac
13559         case "$d_getgrgid_r_proto" in
13560         define)
13561         case "$getgrgid_r_proto" in
13562         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13563         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13564         esac
13565         case "$getgrgid_r_proto" in
13566         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13567         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13568         esac
13569         case "$getgrgid_r_proto" in
13570         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13571         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13572         esac
13573         case "$getgrgid_r_proto" in
13574         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13575         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13576         esac
13577         case "$getgrgid_r_proto" in
13578         ''|0)   d_getgrgid_r=undef
13579                 getgrgid_r_proto=0
13580                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13581         * )     case "$getgrgid_r_proto" in
13582                 REENTRANT_PROTO*) ;;
13583                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13584                 esac
13585                 echo "Prototype: $try" ;;
13586         esac
13587         ;;
13588         *)      case "$usethreads" in
13589                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13590                 esac
13591                 d_getgrgid_r=undef
13592                 getgrgid_r_proto=0
13593                 ;;
13594         esac
13595         ;;
13596 *)      getgrgid_r_proto=0
13597         ;;
13598 esac
13599
13600 : see if getgrnam_r exists
13601 set getgrnam_r d_getgrnam_r
13602 eval $inlibc
13603 case "$d_getgrnam_r" in
13604 "$define")
13605         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13606         case "$d_getgrnam_r_proto:$usethreads" in
13607         ":define")      d_getgrnam_r_proto=define
13608                 set d_getgrnam_r_proto getgrnam_r $hdrs
13609                 eval $hasproto ;;
13610         *)      ;;
13611         esac
13612         case "$d_getgrnam_r_proto" in
13613         define)
13614         case "$getgrnam_r_proto" in
13615         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13616         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13617         esac
13618         case "$getgrnam_r_proto" in
13619         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13620         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13621         esac
13622         case "$getgrnam_r_proto" in
13623         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13624         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13625         esac
13626         case "$getgrnam_r_proto" in
13627         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13628         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13629         esac
13630         case "$getgrnam_r_proto" in
13631         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13632         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13633         esac
13634         case "$getgrnam_r_proto" in
13635         ''|0)   d_getgrnam_r=undef
13636                 getgrnam_r_proto=0
13637                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13638         * )     case "$getgrnam_r_proto" in
13639                 REENTRANT_PROTO*) ;;
13640                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13641                 esac
13642                 echo "Prototype: $try" ;;
13643         esac
13644         ;;
13645         *)      case "$usethreads" in
13646                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13647                 esac
13648                 d_getgrnam_r=undef
13649                 getgrnam_r_proto=0
13650                 ;;
13651         esac
13652         ;;
13653 *)      getgrnam_r_proto=0
13654         ;;
13655 esac
13656
13657 : see if gethostbyaddr exists
13658 set gethostbyaddr d_gethbyaddr
13659 eval $inlibc
13660
13661 : see if gethostbyname exists
13662 set gethostbyname d_gethbyname
13663 eval $inlibc
13664
13665 : see if gethostent exists
13666 set gethostent d_gethent
13667 eval $inlibc
13668
13669 : see how we will look up host name
13670 echo " "
13671 call=''
13672 if set gethostname val -f d_gethname; eval $csym; $val; then
13673         echo 'gethostname() found.' >&4
13674         d_gethname="$define"
13675         call=gethostname
13676 fi
13677 if set uname val -f d_uname; eval $csym; $val; then
13678         if ./xenix; then
13679                 $cat <<'EOM'
13680 uname() was found, but you're running xenix, and older versions of xenix
13681 have a broken uname(). If you don't really know whether your xenix is old
13682 enough to have a broken system call, use the default answer.
13683
13684 EOM
13685                 dflt=y
13686                 case "$d_uname" in
13687                 "$define") dflt=n;;
13688                 esac
13689                 rp='Is your uname() broken?'
13690                 . ./myread
13691                 case "$ans" in
13692                 n*) d_uname="$define"; call=uname;;
13693                 esac
13694         else
13695                 echo 'uname() found.' >&4
13696                 d_uname="$define"
13697                 case "$call" in
13698                 '') call=uname ;;
13699                 esac
13700         fi
13701 fi
13702 case "$d_gethname" in
13703 '') d_gethname="$undef";;
13704 esac
13705 case "$d_uname" in
13706 '') d_uname="$undef";;
13707 esac
13708 case "$d_uname$d_gethname" in
13709 *define*)
13710         dflt=n
13711         cat <<EOM
13712
13713 Every now and then someone has a $call() that lies about the hostname
13714 but can't be fixed for political or economic reasons.  If you wish, I can
13715 pretend $call() isn't there and maybe compute hostname at run-time
13716 thanks to the '$phostname' command.
13717
13718 EOM
13719         rp="Shall I ignore $call() from now on?"
13720         . ./myread
13721         case "$ans" in
13722         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13723         esac;;
13724 esac
13725 case "$phostname" in
13726 '') aphostname='';;
13727 *) case "$aphostname" in
13728         /*) ;;
13729         *) set X $phostname
13730                 shift
13731                 file=$1
13732                 shift
13733                 file=`./loc $file $file $pth`
13734                 aphostname=`echo $file $*`
13735                 ;;
13736         esac
13737         ;;
13738 esac
13739 case "$d_uname$d_gethname" in
13740 *define*) ;;
13741 *)
13742         case "$phostname" in
13743         '')
13744                 echo "There will be no way for $package to get your hostname." >&4;;
13745         *)
13746         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13747                 ;;
13748         esac;;
13749 esac
13750 case "$d_phostname" in
13751 '') d_phostname="$undef";;
13752 esac
13753
13754 : see if gethostbyaddr_r exists
13755 set gethostbyaddr_r d_gethostbyaddr_r
13756 eval $inlibc
13757 case "$d_gethostbyaddr_r" in
13758 "$define")
13759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13760         case "$d_gethostbyaddr_r_proto:$usethreads" in
13761         ":define")      d_gethostbyaddr_r_proto=define
13762                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13763                 eval $hasproto ;;
13764         *)      ;;
13765         esac
13766         case "$d_gethostbyaddr_r_proto" in
13767         define)
13768         case "$gethostbyaddr_r_proto" in
13769         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13770         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13771         esac
13772         case "$gethostbyaddr_r_proto" in
13773         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13774         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13775         esac
13776         case "$gethostbyaddr_r_proto" in
13777         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13778         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13779         esac
13780         case "$gethostbyaddr_r_proto" in
13781         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13782         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13783         esac
13784         case "$gethostbyaddr_r_proto" in
13785         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13786         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13787         esac
13788         case "$gethostbyaddr_r_proto" in
13789         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13790         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13791         esac
13792         case "$gethostbyaddr_r_proto" in
13793         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13794         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13795         esac
13796         case "$gethostbyaddr_r_proto" in
13797         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13798         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13799         esac
13800         case "$gethostbyaddr_r_proto" in
13801         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13802         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13803         esac
13804         case "$gethostbyaddr_r_proto" in
13805         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13806         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13807         esac
13808         case "$gethostbyaddr_r_proto" in
13809         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13810         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13811         esac
13812         case "$gethostbyaddr_r_proto" in
13813         ''|0)   d_gethostbyaddr_r=undef
13814                 gethostbyaddr_r_proto=0
13815                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13816         * )     case "$gethostbyaddr_r_proto" in
13817                 REENTRANT_PROTO*) ;;
13818                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13819                 esac
13820                 echo "Prototype: $try" ;;
13821         esac
13822         ;;
13823         *)      case "$usethreads" in
13824                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13825                 esac
13826                 d_gethostbyaddr_r=undef
13827                 gethostbyaddr_r_proto=0
13828                 ;;
13829         esac
13830         ;;
13831 *)      gethostbyaddr_r_proto=0
13832         ;;
13833 esac
13834
13835 : see if gethostbyname_r exists
13836 set gethostbyname_r d_gethostbyname_r
13837 eval $inlibc
13838 case "$d_gethostbyname_r" in
13839 "$define")
13840         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13841         case "$d_gethostbyname_r_proto:$usethreads" in
13842         ":define")      d_gethostbyname_r_proto=define
13843                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13844                 eval $hasproto ;;
13845         *)      ;;
13846         esac
13847         case "$d_gethostbyname_r_proto" in
13848         define)
13849         case "$gethostbyname_r_proto" in
13850         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13851         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13852         esac
13853         case "$gethostbyname_r_proto" in
13854         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13855         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13856         esac
13857         case "$gethostbyname_r_proto" in
13858         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13859         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13860         esac
13861         case "$gethostbyname_r_proto" in
13862         ''|0)   d_gethostbyname_r=undef
13863                 gethostbyname_r_proto=0
13864                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13865         * )     case "$gethostbyname_r_proto" in
13866                 REENTRANT_PROTO*) ;;
13867                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13868                 esac
13869                 echo "Prototype: $try" ;;
13870         esac
13871         ;;
13872         *)      case "$usethreads" in
13873                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13874                 esac
13875                 d_gethostbyname_r=undef
13876                 gethostbyname_r_proto=0
13877                 ;;
13878         esac
13879         ;;
13880 *)      gethostbyname_r_proto=0
13881         ;;
13882 esac
13883
13884 : see if gethostent_r exists
13885 set gethostent_r d_gethostent_r
13886 eval $inlibc
13887 case "$d_gethostent_r" in
13888 "$define")
13889         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13890         case "$d_gethostent_r_proto:$usethreads" in
13891         ":define")      d_gethostent_r_proto=define
13892                 set d_gethostent_r_proto gethostent_r $hdrs
13893                 eval $hasproto ;;
13894         *)      ;;
13895         esac
13896         case "$d_gethostent_r_proto" in
13897         define)
13898         case "$gethostent_r_proto" in
13899         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13900         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13901         esac
13902         case "$gethostent_r_proto" in
13903         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13904         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13905         esac
13906         case "$gethostent_r_proto" in
13907         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13908         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13909         esac
13910         case "$gethostent_r_proto" in
13911         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13912         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13913         esac
13914         case "$gethostent_r_proto" in
13915         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13916         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13917         esac
13918         case "$gethostent_r_proto" in
13919         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13920         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13921         esac
13922         case "$gethostent_r_proto" in
13923         ''|0)   d_gethostent_r=undef
13924                 gethostent_r_proto=0
13925                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13926         * )     case "$gethostent_r_proto" in
13927                 REENTRANT_PROTO*) ;;
13928                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13929                 esac
13930                 echo "Prototype: $try" ;;
13931         esac
13932         ;;
13933         *)      case "$usethreads" in
13934                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13935                 esac
13936                 d_gethostent_r=undef
13937                 gethostent_r_proto=0
13938                 ;;
13939         esac
13940         ;;
13941 *)      gethostent_r_proto=0
13942         ;;
13943 esac
13944
13945 : see if prototypes for various gethostxxx netdb.h functions are available
13946 echo " "
13947 set d_gethostprotos gethostent $i_netdb netdb.h
13948 eval $hasproto
13949
13950 : see if getitimer exists
13951 set getitimer d_getitimer
13952 eval $inlibc
13953
13954 : see if getlogin exists
13955 set getlogin d_getlogin
13956 eval $inlibc
13957
13958 : see if getlogin_r exists
13959 set getlogin_r d_getlogin_r
13960 eval $inlibc
13961 case "$d_getlogin_r" in
13962 "$define")
13963         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13964         case "$d_getlogin_r_proto:$usethreads" in
13965         ":define")      d_getlogin_r_proto=define
13966                 set d_getlogin_r_proto getlogin_r $hdrs
13967                 eval $hasproto ;;
13968         *)      ;;
13969         esac
13970         case "$d_getlogin_r_proto" in
13971         define)
13972         case "$getlogin_r_proto" in
13973         ''|0) try='int getlogin_r(char*, size_t);'
13974         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13975         esac
13976         case "$getlogin_r_proto" in
13977         ''|0) try='int getlogin_r(char*, int);'
13978         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13979         esac
13980         case "$getlogin_r_proto" in
13981         ''|0) try='char* getlogin_r(char*, size_t);'
13982         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13983         esac
13984         case "$getlogin_r_proto" in
13985         ''|0) try='char* getlogin_r(char*, int);'
13986         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13987         esac
13988         case "$getlogin_r_proto" in
13989         ''|0)   d_getlogin_r=undef
13990                 getlogin_r_proto=0
13991                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13992         * )     case "$getlogin_r_proto" in
13993                 REENTRANT_PROTO*) ;;
13994                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13995                 esac
13996                 echo "Prototype: $try" ;;
13997         esac
13998         ;;
13999         *)      case "$usethreads" in
14000                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14001                 esac
14002                 d_getlogin_r=undef
14003                 getlogin_r_proto=0
14004                 ;;
14005         esac
14006         ;;
14007 *)      getlogin_r_proto=0
14008         ;;
14009 esac
14010
14011 : see if getmnt exists
14012 set getmnt d_getmnt
14013 eval $inlibc
14014
14015 : see if getmntent exists
14016 set getmntent d_getmntent
14017 eval $inlibc
14018
14019 : see if getnameinfo exists
14020 set getnameinfo d_getnameinfo
14021 eval $inlibc
14022
14023 : see if getnetbyaddr exists
14024 set getnetbyaddr d_getnbyaddr
14025 eval $inlibc
14026
14027 : see if getnetbyname exists
14028 set getnetbyname d_getnbyname
14029 eval $inlibc
14030
14031 : see if getnetent exists
14032 set getnetent d_getnent
14033 eval $inlibc
14034
14035 : see if getnetbyaddr_r exists
14036 set getnetbyaddr_r d_getnetbyaddr_r
14037 eval $inlibc
14038 case "$d_getnetbyaddr_r" in
14039 "$define")
14040         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14041         case "$d_getnetbyaddr_r_proto:$usethreads" in
14042         ":define")      d_getnetbyaddr_r_proto=define
14043                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14044                 eval $hasproto ;;
14045         *)      ;;
14046         esac
14047         case "$d_getnetbyaddr_r_proto" in
14048         define)
14049         case "$getnetbyaddr_r_proto" in
14050         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14051         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14052         esac
14053         case "$getnetbyaddr_r_proto" in
14054         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14055         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14056         esac
14057         case "$getnetbyaddr_r_proto" in
14058         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14059         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14060         esac
14061         case "$getnetbyaddr_r_proto" in
14062         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14063         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14064         esac
14065         case "$getnetbyaddr_r_proto" in
14066         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14067         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14068         esac
14069         case "$getnetbyaddr_r_proto" in
14070         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14071         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14072         esac
14073         case "$getnetbyaddr_r_proto" in
14074         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14075         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14076         esac
14077         case "$getnetbyaddr_r_proto" in
14078         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14079         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14080         esac
14081         case "$getnetbyaddr_r_proto" in
14082         ''|0)   d_getnetbyaddr_r=undef
14083                 getnetbyaddr_r_proto=0
14084                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14085         * )     case "$getnetbyaddr_r_proto" in
14086                 REENTRANT_PROTO*) ;;
14087                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14088                 esac
14089                 echo "Prototype: $try" ;;
14090         esac
14091         ;;
14092         *)      case "$usethreads" in
14093                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14094                 esac
14095                 d_getnetbyaddr_r=undef
14096                 getnetbyaddr_r_proto=0
14097                 ;;
14098         esac
14099         ;;
14100 *)      getnetbyaddr_r_proto=0
14101         ;;
14102 esac
14103
14104 : see if getnetbyname_r exists
14105 set getnetbyname_r d_getnetbyname_r
14106 eval $inlibc
14107 case "$d_getnetbyname_r" in
14108 "$define")
14109         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14110         case "$d_getnetbyname_r_proto:$usethreads" in
14111         ":define")      d_getnetbyname_r_proto=define
14112                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14113                 eval $hasproto ;;
14114         *)      ;;
14115         esac
14116         case "$d_getnetbyname_r_proto" in
14117         define)
14118         case "$getnetbyname_r_proto" in
14119         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14120         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14121         esac
14122         case "$getnetbyname_r_proto" in
14123         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14124         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14125         esac
14126         case "$getnetbyname_r_proto" in
14127         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14128         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14129         esac
14130         case "$getnetbyname_r_proto" in
14131         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14132         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14133         esac
14134         case "$getnetbyname_r_proto" in
14135         ''|0)   d_getnetbyname_r=undef
14136                 getnetbyname_r_proto=0
14137                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14138         * )     case "$getnetbyname_r_proto" in
14139                 REENTRANT_PROTO*) ;;
14140                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14141                 esac
14142                 echo "Prototype: $try" ;;
14143         esac
14144         ;;
14145         *)      case "$usethreads" in
14146                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14147                 esac
14148                 d_getnetbyname_r=undef
14149                 getnetbyname_r_proto=0
14150                 ;;
14151         esac
14152         ;;
14153 *)      getnetbyname_r_proto=0
14154         ;;
14155 esac
14156
14157 : see if getnetent_r exists
14158 set getnetent_r d_getnetent_r
14159 eval $inlibc
14160 case "$d_getnetent_r" in
14161 "$define")
14162         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14163         case "$d_getnetent_r_proto:$usethreads" in
14164         ":define")      d_getnetent_r_proto=define
14165                 set d_getnetent_r_proto getnetent_r $hdrs
14166                 eval $hasproto ;;
14167         *)      ;;
14168         esac
14169         case "$d_getnetent_r_proto" in
14170         define)
14171         case "$getnetent_r_proto" in
14172         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14173         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14174         esac
14175         case "$getnetent_r_proto" in
14176         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14177         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14178         esac
14179         case "$getnetent_r_proto" in
14180         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14181         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14182         esac
14183         case "$getnetent_r_proto" in
14184         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14185         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14186         esac
14187         case "$getnetent_r_proto" in
14188         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14189         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14190         esac
14191         case "$getnetent_r_proto" in
14192         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14193         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14194         esac
14195         case "$getnetent_r_proto" in
14196         ''|0)   d_getnetent_r=undef
14197                 getnetent_r_proto=0
14198                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14199         * )     case "$getnetent_r_proto" in
14200                 REENTRANT_PROTO*) ;;
14201                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14202                 esac
14203                 echo "Prototype: $try" ;;
14204         esac
14205         ;;
14206         *)      case "$usethreads" in
14207                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14208                 esac
14209                 d_getnetent_r=undef
14210                 getnetent_r_proto=0
14211                 ;;
14212         esac
14213         ;;
14214 *)      getnetent_r_proto=0
14215         ;;
14216 esac
14217
14218 : see if prototypes for various getnetxxx netdb.h functions are available
14219 echo " "
14220 set d_getnetprotos getnetent $i_netdb netdb.h
14221 eval $hasproto
14222
14223 : see if getpagesize exists
14224 set getpagesize d_getpagsz
14225 eval $inlibc
14226
14227 : Optional checks for getprotobyname and getprotobynumber
14228
14229 : see if getprotobyname exists
14230 set getprotobyname d_getpbyname
14231 eval $inlibc
14232
14233 : see if getprotobynumber exists
14234 set getprotobynumber d_getpbynumber
14235 eval $inlibc
14236
14237 : see if getprotoent exists
14238 set getprotoent d_getpent
14239 eval $inlibc
14240
14241 : see if getpgid exists
14242 set getpgid d_getpgid
14243 eval $inlibc
14244
14245 : see if getpgrp2 exists
14246 set getpgrp2 d_getpgrp2
14247 eval $inlibc
14248
14249 : see if getppid exists
14250 set getppid d_getppid
14251 eval $inlibc
14252
14253 : see if getpriority exists
14254 set getpriority d_getprior
14255 eval $inlibc
14256
14257 : see if getprotobyname_r exists
14258 set getprotobyname_r d_getprotobyname_r
14259 eval $inlibc
14260 case "$d_getprotobyname_r" in
14261 "$define")
14262         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14263         case "$d_getprotobyname_r_proto:$usethreads" in
14264         ":define")      d_getprotobyname_r_proto=define
14265                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14266                 eval $hasproto ;;
14267         *)      ;;
14268         esac
14269         case "$d_getprotobyname_r_proto" in
14270         define)
14271         case "$getprotobyname_r_proto" in
14272         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14273         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14274         esac
14275         case "$getprotobyname_r_proto" in
14276         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14277         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14278         esac
14279         case "$getprotobyname_r_proto" in
14280         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14281         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14282         esac
14283         case "$getprotobyname_r_proto" in
14284         ''|0)   d_getprotobyname_r=undef
14285                 getprotobyname_r_proto=0
14286                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14287         * )     case "$getprotobyname_r_proto" in
14288                 REENTRANT_PROTO*) ;;
14289                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14290                 esac
14291                 echo "Prototype: $try" ;;
14292         esac
14293         ;;
14294         *)      case "$usethreads" in
14295                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14296                 esac
14297                 d_getprotobyname_r=undef
14298                 getprotobyname_r_proto=0
14299                 ;;
14300         esac
14301         ;;
14302 *)      getprotobyname_r_proto=0
14303         ;;
14304 esac
14305
14306 : see if getprotobynumber_r exists
14307 set getprotobynumber_r d_getprotobynumber_r
14308 eval $inlibc
14309 case "$d_getprotobynumber_r" in
14310 "$define")
14311         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14312         case "$d_getprotobynumber_r_proto:$usethreads" in
14313         ":define")      d_getprotobynumber_r_proto=define
14314                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14315                 eval $hasproto ;;
14316         *)      ;;
14317         esac
14318         case "$d_getprotobynumber_r_proto" in
14319         define)
14320         case "$getprotobynumber_r_proto" in
14321         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14322         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14323         esac
14324         case "$getprotobynumber_r_proto" in
14325         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14326         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14327         esac
14328         case "$getprotobynumber_r_proto" in
14329         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14330         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14331         esac
14332         case "$getprotobynumber_r_proto" in
14333         ''|0)   d_getprotobynumber_r=undef
14334                 getprotobynumber_r_proto=0
14335                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14336         * )     case "$getprotobynumber_r_proto" in
14337                 REENTRANT_PROTO*) ;;
14338                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14339                 esac
14340                 echo "Prototype: $try" ;;
14341         esac
14342         ;;
14343         *)      case "$usethreads" in
14344                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14345                 esac
14346                 d_getprotobynumber_r=undef
14347                 getprotobynumber_r_proto=0
14348                 ;;
14349         esac
14350         ;;
14351 *)      getprotobynumber_r_proto=0
14352         ;;
14353 esac
14354
14355 : see if getprotoent_r exists
14356 set getprotoent_r d_getprotoent_r
14357 eval $inlibc
14358 case "$d_getprotoent_r" in
14359 "$define")
14360         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14361         case "$d_getprotoent_r_proto:$usethreads" in
14362         ":define")      d_getprotoent_r_proto=define
14363                 set d_getprotoent_r_proto getprotoent_r $hdrs
14364                 eval $hasproto ;;
14365         *)      ;;
14366         esac
14367         case "$d_getprotoent_r_proto" in
14368         define)
14369         case "$getprotoent_r_proto" in
14370         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14371         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14372         esac
14373         case "$getprotoent_r_proto" in
14374         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14376         esac
14377         case "$getprotoent_r_proto" in
14378         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14380         esac
14381         case "$getprotoent_r_proto" in
14382         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14383         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14384         esac
14385         case "$getprotoent_r_proto" in
14386         ''|0)   d_getprotoent_r=undef
14387                 getprotoent_r_proto=0
14388                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14389         * )     case "$getprotoent_r_proto" in
14390                 REENTRANT_PROTO*) ;;
14391                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14392                 esac
14393                 echo "Prototype: $try" ;;
14394         esac
14395         ;;
14396         *)      case "$usethreads" in
14397                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14398                 esac
14399                 d_getprotoent_r=undef
14400                 getprotoent_r_proto=0
14401                 ;;
14402         esac
14403         ;;
14404 *)      getprotoent_r_proto=0
14405         ;;
14406 esac
14407
14408 : see if prototypes for various getprotoxxx netdb.h functions are available
14409 echo " "
14410 set d_getprotoprotos getprotoent $i_netdb netdb.h
14411 eval $hasproto
14412
14413 : see if getprpwnam exists
14414 set getprpwnam d_getprpwnam
14415 eval $inlibc
14416
14417 : see if getpwent exists
14418 set getpwent d_getpwent
14419 eval $inlibc
14420
14421 : see if getpwent_r exists
14422 set getpwent_r d_getpwent_r
14423 eval $inlibc
14424 case "$d_getpwent_r" in
14425 "$define")
14426         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14427         case "$d_getpwent_r_proto:$usethreads" in
14428         ":define")      d_getpwent_r_proto=define
14429                 set d_getpwent_r_proto getpwent_r $hdrs
14430                 eval $hasproto ;;
14431         *)      ;;
14432         esac
14433         case "$d_getpwent_r_proto" in
14434         define)
14435         case "$getpwent_r_proto" in
14436         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14437         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14438         esac
14439         case "$getpwent_r_proto" in
14440         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14441         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14442         esac
14443         case "$getpwent_r_proto" in
14444         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14445         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14446         esac
14447         case "$getpwent_r_proto" in
14448         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14449         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14450         esac
14451         case "$getpwent_r_proto" in
14452         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14453         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14454         esac
14455         case "$getpwent_r_proto" in
14456         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14457         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14458         esac
14459         case "$getpwent_r_proto" in
14460         ''|0)   d_getpwent_r=undef
14461                 getpwent_r_proto=0
14462                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14463         * )     case "$getpwent_r_proto" in
14464                 REENTRANT_PROTO*) ;;
14465                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14466                 esac
14467                 echo "Prototype: $try" ;;
14468         esac
14469         ;;
14470         *)      case "$usethreads" in
14471                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14472                 esac
14473                 d_getpwent_r=undef
14474                 getpwent_r_proto=0
14475                 ;;
14476         esac
14477         ;;
14478 *)      getpwent_r_proto=0
14479         ;;
14480 esac
14481
14482 : see if getpwnam_r exists
14483 set getpwnam_r d_getpwnam_r
14484 eval $inlibc
14485 case "$d_getpwnam_r" in
14486 "$define")
14487         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14488         case "$d_getpwnam_r_proto:$usethreads" in
14489         ":define")      d_getpwnam_r_proto=define
14490                 set d_getpwnam_r_proto getpwnam_r $hdrs
14491                 eval $hasproto ;;
14492         *)      ;;
14493         esac
14494         case "$d_getpwnam_r_proto" in
14495         define)
14496         case "$getpwnam_r_proto" in
14497         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14498         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14499         esac
14500         case "$getpwnam_r_proto" in
14501         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14502         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14503         esac
14504         case "$getpwnam_r_proto" in
14505         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14506         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14507         esac
14508         case "$getpwnam_r_proto" in
14509         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14510         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14511         esac
14512         case "$getpwnam_r_proto" in
14513         ''|0)   d_getpwnam_r=undef
14514                 getpwnam_r_proto=0
14515                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14516         * )     case "$getpwnam_r_proto" in
14517                 REENTRANT_PROTO*) ;;
14518                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14519                 esac
14520                 echo "Prototype: $try" ;;
14521         esac
14522         ;;
14523         *)      case "$usethreads" in
14524                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14525                 esac
14526                 d_getpwnam_r=undef
14527                 getpwnam_r_proto=0
14528                 ;;
14529         esac
14530         ;;
14531 *)      getpwnam_r_proto=0
14532         ;;
14533 esac
14534
14535 : see if getpwuid_r exists
14536 set getpwuid_r d_getpwuid_r
14537 eval $inlibc
14538 case "$d_getpwuid_r" in
14539 "$define")
14540         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14541         case "$d_getpwuid_r_proto:$usethreads" in
14542         ":define")      d_getpwuid_r_proto=define
14543                 set d_getpwuid_r_proto getpwuid_r $hdrs
14544                 eval $hasproto ;;
14545         *)      ;;
14546         esac
14547         case "$d_getpwuid_r_proto" in
14548         define)
14549         case "$getpwuid_r_proto" in
14550         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14551         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14552         esac
14553         case "$getpwuid_r_proto" in
14554         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14555         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14556         esac
14557         case "$getpwuid_r_proto" in
14558         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14559         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14560         esac
14561         case "$getpwuid_r_proto" in
14562         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14563         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14564         esac
14565         case "$getpwuid_r_proto" in
14566         ''|0)   d_getpwuid_r=undef
14567                 getpwuid_r_proto=0
14568                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14569         * )     case "$getpwuid_r_proto" in
14570                 REENTRANT_PROTO*) ;;
14571                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14572                 esac
14573                 echo "Prototype: $try" ;;
14574         esac
14575         ;;
14576         *)      case "$usethreads" in
14577                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14578                 esac
14579                 d_getpwuid_r=undef
14580                 getpwuid_r_proto=0
14581                 ;;
14582         esac
14583         ;;
14584 *)      getpwuid_r_proto=0
14585         ;;
14586 esac
14587
14588 : Optional checks for getsbyname and getsbyport
14589
14590 : see if getservbyname exists
14591 set getservbyname d_getsbyname
14592 eval $inlibc
14593
14594 : see if getservbyport exists
14595 set getservbyport d_getsbyport
14596 eval $inlibc
14597
14598 : see if getservent exists
14599 set getservent d_getsent
14600 eval $inlibc
14601
14602 : see if getservbyname_r exists
14603 set getservbyname_r d_getservbyname_r
14604 eval $inlibc
14605 case "$d_getservbyname_r" in
14606 "$define")
14607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14608         case "$d_getservbyname_r_proto:$usethreads" in
14609         ":define")      d_getservbyname_r_proto=define
14610                 set d_getservbyname_r_proto getservbyname_r $hdrs
14611                 eval $hasproto ;;
14612         *)      ;;
14613         esac
14614         case "$d_getservbyname_r_proto" in
14615         define)
14616         case "$getservbyname_r_proto" in
14617         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14618         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14619         esac
14620         case "$getservbyname_r_proto" in
14621         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14622         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14623         esac
14624         case "$getservbyname_r_proto" in
14625         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14626         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14627         esac
14628         case "$getservbyname_r_proto" in
14629         ''|0)   d_getservbyname_r=undef
14630                 getservbyname_r_proto=0
14631                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14632         * )     case "$getservbyname_r_proto" in
14633                 REENTRANT_PROTO*) ;;
14634                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14635                 esac
14636                 echo "Prototype: $try" ;;
14637         esac
14638         ;;
14639         *)      case "$usethreads" in
14640                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14641                 esac
14642                 d_getservbyname_r=undef
14643                 getservbyname_r_proto=0
14644                 ;;
14645         esac
14646         ;;
14647 *)      getservbyname_r_proto=0
14648         ;;
14649 esac
14650
14651 : see if getservbyport_r exists
14652 set getservbyport_r d_getservbyport_r
14653 eval $inlibc
14654 case "$d_getservbyport_r" in
14655 "$define")
14656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14657         case "$d_getservbyport_r_proto:$usethreads" in
14658         ":define")      d_getservbyport_r_proto=define
14659                 set d_getservbyport_r_proto getservbyport_r $hdrs
14660                 eval $hasproto ;;
14661         *)      ;;
14662         esac
14663         case "$d_getservbyport_r_proto" in
14664         define)
14665         case "$getservbyport_r_proto" in
14666         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14667         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14668         esac
14669         case "$getservbyport_r_proto" in
14670         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14671         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14672         esac
14673         case "$getservbyport_r_proto" in
14674         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14675         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14676         esac
14677         case "$getservbyport_r_proto" in
14678         ''|0)   d_getservbyport_r=undef
14679                 getservbyport_r_proto=0
14680                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14681         * )     case "$getservbyport_r_proto" in
14682                 REENTRANT_PROTO*) ;;
14683                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14684                 esac
14685                 echo "Prototype: $try" ;;
14686         esac
14687         ;;
14688         *)      case "$usethreads" in
14689                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14690                 esac
14691                 d_getservbyport_r=undef
14692                 getservbyport_r_proto=0
14693                 ;;
14694         esac
14695         ;;
14696 *)      getservbyport_r_proto=0
14697         ;;
14698 esac
14699
14700 : see if getservent_r exists
14701 set getservent_r d_getservent_r
14702 eval $inlibc
14703 case "$d_getservent_r" in
14704 "$define")
14705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14706         case "$d_getservent_r_proto:$usethreads" in
14707         ":define")      d_getservent_r_proto=define
14708                 set d_getservent_r_proto getservent_r $hdrs
14709                 eval $hasproto ;;
14710         *)      ;;
14711         esac
14712         case "$d_getservent_r_proto" in
14713         define)
14714         case "$getservent_r_proto" in
14715         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14716         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14717         esac
14718         case "$getservent_r_proto" in
14719         ''|0) try='int getservent_r(struct servent*, char*, int);'
14720         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14721         esac
14722         case "$getservent_r_proto" in
14723         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14724         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14725         esac
14726         case "$getservent_r_proto" in
14727         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14728         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14729         esac
14730         case "$getservent_r_proto" in
14731         ''|0)   d_getservent_r=undef
14732                 getservent_r_proto=0
14733                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14734         * )     case "$getservent_r_proto" in
14735                 REENTRANT_PROTO*) ;;
14736                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14737                 esac
14738                 echo "Prototype: $try" ;;
14739         esac
14740         ;;
14741         *)      case "$usethreads" in
14742                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14743                 esac
14744                 d_getservent_r=undef
14745                 getservent_r_proto=0
14746                 ;;
14747         esac
14748         ;;
14749 *)      getservent_r_proto=0
14750         ;;
14751 esac
14752
14753 : see if prototypes for various getservxxx netdb.h functions are available
14754 echo " "
14755 set d_getservprotos getservent $i_netdb netdb.h
14756 eval $hasproto
14757
14758 : see if getspnam exists
14759 set getspnam d_getspnam
14760 eval $inlibc
14761
14762 : see if this is a shadow.h system
14763 set shadow.h i_shadow
14764 eval $inhdr
14765
14766 : see if getspnam_r exists
14767 set getspnam_r d_getspnam_r
14768 eval $inlibc
14769 case "$d_getspnam_r" in
14770 "$define")
14771         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14772         case "$d_getspnam_r_proto:$usethreads" in
14773         ":define")      d_getspnam_r_proto=define
14774                 set d_getspnam_r_proto getspnam_r $hdrs
14775                 eval $hasproto ;;
14776         *)      ;;
14777         esac
14778         case "$d_getspnam_r_proto" in
14779         define)
14780         case "$getspnam_r_proto" in
14781         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14782         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14783         esac
14784         case "$getspnam_r_proto" in
14785         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14786         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14787         esac
14788         case "$getspnam_r_proto" in
14789         ''|0)   d_getspnam_r=undef
14790                 getspnam_r_proto=0
14791                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14792         * )     case "$getspnam_r_proto" in
14793                 REENTRANT_PROTO*) ;;
14794                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14795                 esac
14796                 echo "Prototype: $try" ;;
14797         esac
14798         ;;
14799         *)      case "$usethreads" in
14800                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14801                 esac
14802                 d_getspnam_r=undef
14803                 getspnam_r_proto=0
14804                 ;;
14805         esac
14806         ;;
14807 *)      getspnam_r_proto=0
14808         ;;
14809 esac
14810
14811 : see if gettimeofday or ftime exists
14812 set gettimeofday d_gettimeod
14813 eval $inlibc
14814 case "$d_gettimeod" in
14815 "$undef")
14816         set ftime d_ftime 
14817         eval $inlibc
14818         ;;
14819 *)
14820         val="$undef"; set d_ftime; eval $setvar
14821         ;;
14822 esac
14823 case "$d_gettimeod$d_ftime" in
14824 "$undef$undef")
14825         echo " "
14826         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14827         ;;
14828 esac
14829
14830 : see if gmtime_r exists
14831 set gmtime_r d_gmtime_r
14832 eval $inlibc
14833 case "$d_gmtime_r" in
14834 "$define")
14835         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14836         case "$d_gmtime_r_proto:$usethreads" in
14837         ":define")      d_gmtime_r_proto=define
14838                 set d_gmtime_r_proto gmtime_r $hdrs
14839                 eval $hasproto ;;
14840         *)      ;;
14841         esac
14842         case "$d_gmtime_r_proto" in
14843         define)
14844         case "$gmtime_r_proto" in
14845         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14846         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14847         esac
14848         case "$gmtime_r_proto" in
14849         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14850         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14851         esac
14852         case "$gmtime_r_proto" in
14853         ''|0)   d_gmtime_r=undef
14854                 gmtime_r_proto=0
14855                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14856         * )     case "$gmtime_r_proto" in
14857                 REENTRANT_PROTO*) ;;
14858                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14859                 esac
14860                 echo "Prototype: $try" ;;
14861         esac
14862         ;;
14863         *)      case "$usethreads" in
14864                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14865                 esac
14866                 d_gmtime_r=undef
14867                 gmtime_r_proto=0
14868                 ;;
14869         esac
14870         ;;
14871 *)      gmtime_r_proto=0
14872         ;;
14873 esac
14874
14875 : see if hasmntopt exists
14876 set hasmntopt d_hasmntopt
14877 eval $inlibc
14878
14879 : see if this is a netinet/in.h or sys/in.h system
14880 set netinet/in.h i_niin sys/in.h i_sysin
14881 eval $inhdr
14882
14883 : see if arpa/inet.h has to be included
14884 set arpa/inet.h i_arpainet
14885 eval $inhdr
14886
14887 : see if htonl --and friends-- exists
14888 val=''
14889 set htonl val
14890 eval $inlibc
14891
14892 : Maybe they are macros.
14893 case "$val" in
14894 $undef)
14895         $cat >htonl.c <<EOM
14896 #include <stdio.h>
14897 #include <sys/types.h>
14898 #$i_niin I_NETINET_IN
14899 #$i_sysin I_SYS_IN
14900 #$i_arpainet I_ARPA_INET
14901 #ifdef I_NETINET_IN
14902 #include <netinet/in.h>
14903 #endif
14904 #ifdef I_SYS_IN
14905 #include <sys/in.h>
14906 #endif
14907 #ifdef I_ARPA_INET
14908 #include <arpa/inet.h>
14909 #endif
14910 #ifdef htonl
14911 printf("Defined as a macro.");
14912 #endif
14913 EOM
14914         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14915         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14916                 val="$define"
14917                 echo "But it seems to be defined as a macro." >&4
14918         fi
14919         $rm -f htonl.?
14920         ;;
14921 esac
14922 set d_htonl
14923 eval $setvar
14924
14925 : see if ilogbl exists
14926 set ilogbl d_ilogbl
14927 eval $inlibc
14928
14929 : index or strchr
14930 echo " "
14931 if set index val -f; eval $csym; $val; then
14932         if set strchr val -f d_strchr; eval $csym; $val; then
14933                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14934                         val="$define"
14935                         vali="$undef"
14936                         echo "strchr() found." >&4
14937                 else
14938                         val="$undef"
14939                         vali="$define"
14940                         echo "index() found." >&4
14941                 fi
14942         else
14943                 val="$undef"
14944                 vali="$define"
14945                 echo "index() found." >&4
14946         fi
14947 else
14948         if set strchr val -f d_strchr; eval $csym; $val; then
14949                 val="$define"
14950                 vali="$undef"
14951                 echo "strchr() found." >&4
14952         else
14953                 echo "No index() or strchr() found!" >&4
14954                 val="$undef"
14955                 vali="$undef"
14956         fi
14957 fi
14958 set d_strchr; eval $setvar
14959 val="$vali"
14960 set d_index; eval $setvar
14961
14962 : check whether inet_aton exists
14963 set inet_aton d_inetaton
14964 eval $inlibc
14965
14966 : see if inet_ntop exists
14967 set inet_ntop d_inetntop
14968 eval $inlibc
14969
14970 : see if inet_pton exists
14971 set inet_pton d_inetpton
14972 eval $inlibc
14973
14974 : Look for isascii
14975 echo " "
14976 $cat >isascii.c <<EOCP
14977 #include <stdio.h>
14978 #include <ctype.h>
14979 #$i_stdlib I_STDLIB
14980 #ifdef I_STDLIB
14981 #include <stdlib.h>
14982 #endif
14983 int main() {
14984         int c = 'A';
14985         if (isascii(c))
14986                 exit(0);
14987         else
14988                 exit(1);
14989 }
14990 EOCP
14991 set isascii
14992 if eval $compile; then
14993         echo "isascii() found." >&4
14994         val="$define"
14995 else
14996         echo "isascii() NOT found." >&4
14997         val="$undef"
14998 fi
14999 set d_isascii
15000 eval $setvar
15001 $rm -f isascii*
15002
15003 : see if isfinite exists
15004 set isfinite d_isfinite
15005 eval $inlibc
15006
15007 : see if isinf exists
15008 set isinf d_isinf
15009 eval $inlibc
15010
15011 : see if isnan exists
15012 set isnan d_isnan
15013 eval $inlibc
15014
15015 : see if isnanl exists
15016 set isnanl d_isnanl
15017 eval $inlibc
15018
15019 : see if killpg exists
15020 set killpg d_killpg
15021 eval $inlibc
15022
15023 : see if lchown exists
15024 echo " "
15025 $cat > try.c <<'EOCP'
15026 /* System header to define __stub macros and hopefully few prototypes,
15027     which can conflict with char lchown(); below.  */
15028 #include <assert.h>
15029 /* Override any gcc2 internal prototype to avoid an error.  */
15030 /* We use char because int might match the return type of a gcc2
15031    builtin and then its argument prototype would still apply.  */
15032 char lchown();
15033 int main() {
15034     /*  The GNU C library defines this for functions which it implements
15035         to always fail with ENOSYS.  Some functions are actually named
15036         something starting with __ and the normal name is an alias.  */
15037 #if defined (__stub_lchown) || defined (__stub___lchown)
15038 choke me
15039 #else
15040 lchown();
15041 #endif
15042 ; return 0; }
15043 EOCP
15044 set try
15045 if eval $compile; then
15046     $echo "lchown() found." >&4
15047     val="$define"
15048 else
15049     $echo "lchown() NOT found." >&4
15050     val="$undef"
15051 fi
15052 set d_lchown
15053 eval $setvar
15054
15055 : See if number of significant digits in a double precision number is known
15056 echo " "
15057 $cat >ldbl_dig.c <<EOM
15058 #$i_limits I_LIMITS
15059 #$i_float I_FLOAT
15060 #ifdef I_LIMITS
15061 #include <limits.h>
15062 #endif
15063 #ifdef I_FLOAT
15064 #include <float.h>
15065 #endif
15066 #ifdef LDBL_DIG
15067 printf("Contains LDBL_DIG");
15068 #endif
15069 EOM
15070 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15071 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15072         echo "LDBL_DIG found." >&4
15073         val="$define"
15074 else
15075         echo "LDBL_DIG NOT found." >&4
15076         val="$undef"
15077 fi
15078 $rm -f ldbl_dig.?
15079 set d_ldbl_dig
15080 eval $setvar
15081
15082 : see if this is a math.h system
15083 set math.h i_math
15084 eval $inhdr
15085
15086 : check to see if math.h defines _LIB_VERSION
15087 d_libm_lib_version="$undef"
15088 case $i_math in
15089     $define)
15090         echo " "
15091         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15092         $cat >try.c <<EOCP
15093 #include <unistd.h>
15094 #include <math.h>
15095 int main (int argc, char *argv[])
15096 {
15097     printf ("%d\n", _LIB_VERSION);
15098     return (0);
15099     } /* main */
15100 EOCP
15101         set try
15102         if eval $compile; then
15103             foo=`$run ./try`
15104             echo "Yes, it does ($foo)" >&4
15105             d_libm_lib_version="$define"
15106         else
15107             echo "No, it does not (probably harmless)" >&4
15108             fi
15109         $rm_try
15110         ;;
15111
15112     esac
15113
15114 : see if link exists
15115 set link d_link
15116 eval $inlibc
15117
15118 : see if localtime_r exists
15119 set localtime_r d_localtime_r
15120 eval $inlibc
15121 case "$d_localtime_r" in
15122 "$define")
15123         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15124         case "$d_localtime_r_proto:$usethreads" in
15125         ":define")      d_localtime_r_proto=define
15126                 set d_localtime_r_proto localtime_r $hdrs
15127                 eval $hasproto ;;
15128         *)      ;;
15129         esac
15130         case "$d_localtime_r_proto" in
15131         define)
15132         case "$localtime_r_proto" in
15133         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15134         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15135         esac
15136         case "$localtime_r_proto" in
15137         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15138         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15139         esac
15140         case "$localtime_r_proto" in
15141         ''|0)   d_localtime_r=undef
15142                 localtime_r_proto=0
15143                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15144         * )     case "$localtime_r_proto" in
15145                 REENTRANT_PROTO*) ;;
15146                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15147                 esac
15148                 echo "Prototype: $try" ;;
15149         esac
15150         ;;
15151         *)      case "$usethreads" in
15152                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15153                 esac
15154                 d_localtime_r=undef
15155                 localtime_r_proto=0
15156                 ;;
15157         esac
15158         ;;
15159 *)      localtime_r_proto=0
15160         ;;
15161 esac
15162
15163 : see if localtime_r calls tzset
15164 case "$localtime_r_proto" in
15165 REENTRANT_PROTO*)
15166         $cat >try.c <<EOCP
15167 /*  Does our libc's localtime_r call tzset ?
15168  *  return 0 if so, 1 otherwise.
15169  */
15170 #$i_systypes    I_SYS_TYPES
15171 #$i_unistd      I_UNISTD
15172 #$i_time        I_TIME
15173 #$i_stdlib      I_STDLIB
15174 #$i_string      I_STRING
15175 #$i_malloc      I_MALLOC
15176 #ifdef I_SYS_TYPES
15177 #  include <sys/types.h>
15178 #endif
15179 #ifdef I_UNISTD
15180 #  include <unistd.h>
15181 #endif
15182 #ifdef I_TIME
15183 #  include <time.h>
15184 #endif
15185 #ifdef I_STDLIB
15186 #include <stdlib.h>
15187 #endif
15188 #ifdef I_STRING
15189 #  include <string.h>
15190 #else
15191 #  include <strings.h>
15192 #endif
15193 #ifdef I_MALLOC
15194 #  include <malloc.h>
15195 #endif
15196 int main()
15197 {
15198     time_t t = time(0L);
15199     char w_tz[]="TZ" "=GMT+5",
15200          e_tz[]="TZ" "=GMT-5",
15201         *tz_e = (char*)malloc(16),
15202         *tz_w = (char*)malloc(16);
15203     struct tm tm_e, tm_w;
15204     memset(&tm_e,'\0',sizeof(struct tm));
15205     memset(&tm_w,'\0',sizeof(struct tm));
15206     strcpy(tz_e,e_tz);
15207     strcpy(tz_w,w_tz);
15208
15209     putenv(tz_e);
15210     localtime_r(&t, &tm_e);
15211
15212     putenv(tz_w);
15213     localtime_r(&t, &tm_w);
15214
15215     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15216         return 1;
15217     return 0;
15218 }
15219 EOCP
15220         set try
15221         if eval $compile; then
15222             if $run ./try; then
15223                 d_localtime_r_needs_tzset=undef;
15224             else
15225                 d_localtime_r_needs_tzset=define;
15226             fi;
15227         else
15228             d_localtime_r_needs_tzset=undef;
15229         fi;
15230      ;;
15231   *)
15232      d_localtime_r_needs_tzset=undef;
15233      ;;
15234 esac
15235 $rm_try
15236
15237 : see if localeconv exists
15238 set localeconv d_locconv
15239 eval $inlibc
15240
15241 : see if lockf exists
15242 set lockf d_lockf
15243 eval $inlibc
15244
15245 : see if prototype for lseek is available
15246 echo " "
15247 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15248 eval $hasproto
15249
15250 : see if lstat exists
15251 set lstat d_lstat
15252 eval $inlibc
15253
15254 : see if madvise exists
15255 set madvise d_madvise
15256 eval $inlibc
15257
15258 : see if malloc_size exists
15259 set malloc_size d_malloc_size
15260 eval $inlibc
15261
15262 : see if malloc_size_good exists
15263 set malloc_good_size d_malloc_good_size
15264 eval $inlibc
15265
15266 : see if mblen exists
15267 set mblen d_mblen
15268 eval $inlibc
15269
15270 : see if mbstowcs exists
15271 set mbstowcs d_mbstowcs
15272 eval $inlibc
15273
15274 : see if mbtowc exists
15275 set mbtowc d_mbtowc
15276 eval $inlibc
15277
15278 : see if memchr exists
15279 set memchr d_memchr
15280 eval $inlibc
15281
15282 : see if memcmp exists
15283 set memcmp d_memcmp
15284 eval $inlibc
15285
15286 : see if memcpy exists
15287 set memcpy d_memcpy
15288 eval $inlibc
15289
15290 : see if memmove exists
15291 set memmove d_memmove
15292 eval $inlibc
15293
15294 : see if memset exists
15295 set memset d_memset
15296 eval $inlibc
15297
15298 : see if mkdir exists
15299 set mkdir d_mkdir
15300 eval $inlibc
15301
15302 : see if mkdtemp exists
15303 set mkdtemp d_mkdtemp
15304 eval $inlibc
15305
15306 : see if mkfifo exists
15307 set mkfifo d_mkfifo
15308 eval $inlibc
15309
15310 : see if mkstemp exists
15311 set mkstemp d_mkstemp
15312 eval $inlibc
15313
15314 : see if mkstemps exists
15315 set mkstemps d_mkstemps
15316 eval $inlibc
15317
15318 : see if mktime exists
15319 set mktime d_mktime
15320 eval $inlibc
15321
15322 : see if this is a sys/mman.h system
15323 set sys/mman.h i_sysmman
15324 eval $inhdr
15325
15326 : see if mmap exists
15327 set mmap d_mmap
15328 eval $inlibc
15329 : see what shmat returns
15330 : default to something harmless
15331 mmaptype='void *'
15332 case "$i_sysmman$d_mmap" in
15333 "$define$define")
15334         $cat >mmap.c <<'END'
15335 #include <sys/mman.h>
15336 void *mmap();
15337 END
15338         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15339                 mmaptype='void *'
15340         else
15341                 mmaptype='caddr_t'
15342         fi
15343         echo "and it returns ($mmaptype)." >&4
15344         ;;
15345 esac
15346
15347
15348
15349 : see if sqrtl exists
15350 set sqrtl d_sqrtl
15351 eval $inlibc
15352
15353 : see if scalbnl exists
15354 set scalbnl d_scalbnl
15355 eval $inlibc
15356
15357 : see if modfl exists
15358 set modfl d_modfl
15359 eval $inlibc
15360
15361 : see if prototype for modfl is available
15362 echo " "
15363 set d_modflproto modfl $i_math math.h
15364 eval $hasproto
15365
15366 d_modfl_pow32_bug="$undef"
15367
15368 case "$d_longdbl$d_modfl" in
15369 $define$define)
15370         $cat <<EOM
15371 Checking to see whether your modfl() is okay for large values...
15372 EOM
15373 $cat >try.c <<EOCP
15374 #include <math.h>
15375 #include <stdio.h>
15376 EOCP
15377 if $test "X$d_modflproto" != "X$define"; then
15378         $cat >>try.c <<EOCP
15379 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15380 long double modfl (long double, long double *);
15381 EOCP
15382 fi
15383 $cat >>try.c <<EOCP
15384 int main() {
15385     long double nv = 4294967303.15;
15386     long double v, w;
15387     v = modfl(nv, &w);
15388 #ifdef __GLIBC__
15389     printf("glibc");
15390 #endif
15391     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15392     return 0;
15393 }
15394 EOCP
15395         case "$osname:$gccversion" in
15396         aix:)   saveccflags="$ccflags"
15397                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15398         esac
15399         set try
15400         if eval $compile; then
15401                 foo=`$run ./try`
15402                 case "$foo" in
15403                 *" 4294967303.150000 1.150000 4294967302.000000")
15404                         echo >&4 "Your modfl() is broken for large values."
15405                         d_modfl_pow32_bug="$define"
15406                         case "$foo" in
15407                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15408                         ;;
15409                         esac
15410                         ;;
15411                 *" 4294967303.150000 0.150000 4294967303.000000")
15412                         echo >&4 "Your modfl() seems okay for large values."
15413                         ;;
15414                 *)      echo >&4 "I don't understand your modfl() at all."
15415                         d_modfl="$undef"
15416                         ;;
15417                 esac
15418                 $rm_try
15419         else
15420                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15421                 d_modfl="$undef"
15422         fi
15423         case "$osname:$gccversion" in
15424         aix:)   ccflags="$saveccflags" ;; # restore
15425         esac
15426         ;;
15427 esac
15428
15429 if $test "$uselongdouble" = "$define"; then
15430     message=""
15431     if $test "$d_sqrtl" != "$define"; then
15432         message="$message sqrtl"
15433     fi
15434     if $test "$d_modfl" != "$define"; then
15435         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15436             echo "You have both aintl and copysignl, so I can emulate modfl."
15437         else
15438             message="$message modfl"
15439         fi
15440     fi
15441     if $test "$d_frexpl" != "$define"; then
15442         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15443             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15444         else
15445             message="$message frexpl"
15446         fi
15447     fi
15448
15449     if $test "$message" != ""; then
15450         $cat <<EOM >&4
15451
15452 *** You requested the use of long doubles but you do not seem to have
15453 *** the following mathematical functions needed for long double support:
15454 ***    $message
15455 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15456 *** Cannot continue, aborting.
15457
15458 EOM
15459
15460         exit 1
15461     fi
15462 fi
15463
15464 : see if mprotect exists
15465 set mprotect d_mprotect
15466 eval $inlibc
15467
15468 : see if msgctl exists
15469 set msgctl d_msgctl
15470 eval $inlibc
15471
15472 : see if msgget exists
15473 set msgget d_msgget
15474 eval $inlibc
15475
15476 : see if msgsnd exists
15477 set msgsnd d_msgsnd
15478 eval $inlibc
15479
15480 : see if msgrcv exists
15481 set msgrcv d_msgrcv
15482 eval $inlibc
15483
15484 : see how much of the 'msg*(2)' library is present.
15485 h_msg=true
15486 echo " "
15487 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15488 *"$undef"*) h_msg=false;;
15489 esac
15490 case "$osname" in
15491 freebsd)
15492     case "`ipcs 2>&1`" in
15493     "SVID messages"*"not configured"*)
15494         echo "Your $osname does not have the msg*(2) configured." >&4
15495         h_msg=false
15496         val="$undef"
15497         set msgctl d_msgctl
15498         eval $setvar
15499         set msgget d_msgget
15500         eval $setvar
15501         set msgsnd d_msgsnd
15502         eval $setvar
15503         set msgrcv d_msgrcv
15504         eval $setvar
15505         ;;
15506     esac
15507     ;;
15508 esac
15509 : we could also check for sys/ipc.h ...
15510 if $h_msg && $test `./findhdr sys/msg.h`; then
15511         echo "You have the full msg*(2) library." >&4
15512         val="$define"
15513 else
15514         echo "You don't have the full msg*(2) library." >&4
15515         val="$undef"
15516 fi
15517 set d_msg
15518 eval $setvar
15519
15520 : Check for msghdr_s
15521 echo " "
15522 echo "Checking to see if your system supports struct msghdr..." >&4
15523 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15524 eval $hasstruct
15525 case "$d_msghdr_s" in
15526 "$define")      echo "Yes, it does."   ;;
15527 *)              echo "No, it doesn't." ;;
15528 esac
15529
15530
15531 : see if msync exists
15532 set msync d_msync
15533 eval $inlibc
15534
15535 : see if munmap exists
15536 set munmap d_munmap
15537 eval $inlibc
15538
15539 : see if nice exists
15540 set nice d_nice
15541 eval $inlibc
15542
15543 : see if this is a langinfo.h system
15544 set langinfo.h i_langinfo
15545 eval $inhdr
15546
15547 : see if nl_langinfo exists
15548 set nl_langinfo d_nl_langinfo
15549 eval $inlibc
15550
15551 : check for volatile keyword
15552 echo " "
15553 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15554 $cat >try.c <<'EOCP'
15555 int main()
15556 {
15557         typedef struct _goo_struct goo_struct;
15558         goo_struct * volatile goo = ((goo_struct *)0);
15559         struct _goo_struct {
15560                 long long_int;
15561                 int reg_int;
15562                 char char_var;
15563         };
15564         typedef unsigned short foo_t;
15565         char *volatile foo;
15566         volatile int bar;
15567         volatile foo_t blech;
15568         foo = foo;
15569 }
15570 EOCP
15571 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15572         val="$define"
15573         echo "Yup, it does."
15574 else
15575         val="$undef"
15576         echo "Nope, it doesn't."
15577 fi
15578 set d_volatile
15579 eval $setvar
15580 $rm_try
15581
15582 : Check basic sizes
15583 echo " "
15584 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15585
15586 case "$use64bitint:$d_quad:$quadtype" in
15587 define:define:?*)
15588         ivtype="$quadtype"
15589         uvtype="$uquadtype"
15590         ivsize=8
15591         uvsize=8
15592         ;;
15593 *)      ivtype="long"
15594         uvtype="unsigned long"
15595         ivsize=$longsize
15596         uvsize=$longsize
15597         ;;
15598 esac
15599
15600 case "$uselongdouble:$d_longdbl" in
15601 define:define)
15602         nvtype="long double"
15603         nvsize=$longdblsize
15604         ;;
15605 *)      nvtype=double
15606         nvsize=$doublesize
15607         ;;
15608 esac
15609
15610 $echo "(IV will be "$ivtype", $ivsize bytes)"
15611 $echo "(UV will be "$uvtype", $uvsize bytes)"
15612 $echo "(NV will be "$nvtype", $nvsize bytes)"
15613
15614 $cat >try.c <<EOCP
15615 #$i_inttypes I_INTTYPES
15616 #ifdef I_INTTYPES
15617 #include <inttypes.h>
15618 #endif
15619 #include <stdio.h>
15620 int main() {
15621 #ifdef INT8
15622    int8_t i =  INT8_MAX;
15623   uint8_t u = UINT8_MAX;
15624   printf("int8_t\n");
15625 #endif
15626 #ifdef INT16
15627    int16_t i =  INT16_MAX;
15628   uint16_t i = UINT16_MAX;
15629   printf("int16_t\n");
15630 #endif
15631 #ifdef INT32
15632    int32_t i =  INT32_MAX;
15633   uint32_t u = UINT32_MAX;
15634   printf("int32_t\n");
15635 #endif
15636 }
15637 EOCP
15638
15639 i8type="signed char"
15640 u8type="unsigned char"
15641 i8size=1
15642 u8size=1
15643
15644 case "$i16type" in
15645 '')     case "$shortsize" in
15646         2)      i16type=short
15647                 u16type="unsigned short"
15648                 i16size=$shortsize
15649                 u16size=$shortsize
15650                 ;;
15651         esac
15652         ;;
15653 esac
15654 case "$i16type" in
15655 '')     set try -DINT16
15656         if eval $compile; then
15657                 case "`$run ./try`" in
15658                 int16_t)
15659                         i16type=int16_t
15660                         u16type=uint16_t
15661                         i16size=2
15662                         u16size=2
15663                         ;;
15664                 esac
15665         fi
15666         ;;
15667 esac
15668 case "$i16type" in
15669 '')     if $test $shortsize -ge 2; then
15670                 i16type=short
15671                 u16type="unsigned short"
15672                 i16size=$shortsize
15673                 u16size=$shortsize
15674         fi
15675         ;;
15676 esac
15677
15678 case "$i32type" in
15679 '')     case "$longsize" in
15680         4)      i32type=long
15681                 u32type="unsigned long"
15682                 i32size=$longsize
15683                 u32size=$longsize
15684                 ;;
15685         *)      case "$intsize" in
15686                 4)      i32type=int
15687                         u32type="unsigned int"
15688                         i32size=$intsize
15689                         u32size=$intsize
15690                         ;;
15691                 esac
15692                 ;;
15693         esac
15694         ;;
15695 esac
15696 case "$i32type" in
15697 '')     set try -DINT32
15698         if eval $compile; then
15699                 case "`$run ./try`" in
15700                 int32_t)
15701                         i32type=int32_t
15702                         u32type=uint32_t
15703                         i32size=4
15704                         u32size=4
15705                         ;;
15706                 esac
15707         fi
15708         ;;
15709 esac
15710 case "$i32type" in
15711 '')     if $test $intsize -ge 4; then
15712                 i32type=int
15713                 u32type="unsigned int"
15714                 i32size=$intsize
15715                 u32size=$intsize
15716         fi
15717         ;;
15718 esac
15719
15720 case "$i64type" in
15721 '')     case "$d_quad:$quadtype" in
15722         define:?*)
15723                 i64type="$quadtype"
15724                 u64type="$uquadtype"
15725                 i64size=8
15726                 u64size=8
15727                 ;;
15728         esac
15729         ;;
15730 esac
15731
15732 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15733 : volatile so that the compiler has to store it out to memory.
15734 if test X"$d_volatile" = X"$define"; then
15735         volatile=volatile
15736 fi
15737 $cat <<EOP >try.c
15738 #include <stdio.h>
15739 #$i_stdlib I_STDLIB
15740 #ifdef I_STDLIB
15741 #include <stdlib.h>
15742 #endif
15743 #include <sys/types.h>
15744 #include <signal.h>
15745 #ifdef SIGFPE
15746 $volatile int bletched = 0;
15747 $signal_t blech(int s) { bletched = 1; }
15748 #endif
15749 int main() {
15750     $uvtype u = 0;
15751     $nvtype d;
15752     int     n = 8 * $uvsize;
15753     int     i;
15754 #ifdef SIGFPE
15755     signal(SIGFPE, blech);
15756 #endif
15757
15758     for (i = 0; i < n; i++) {
15759       u = u << 1 | ($uvtype)1;
15760       d = ($nvtype)u;
15761       if (($uvtype)d != u)
15762         break;
15763       if (d <= 0)
15764         break;
15765       d = ($nvtype)(u - 1);
15766       if (($uvtype)d != (u - 1))
15767         break;
15768 #ifdef SIGFPE
15769       if (bletched)
15770         break;
15771 #endif
15772     }
15773     printf("%d\n", ((i == n) ? -n : i));
15774     exit(0);
15775 }
15776 EOP
15777 set try
15778
15779 d_nv_preserves_uv="$undef"
15780 if eval $compile; then
15781         nv_preserves_uv_bits="`$run ./try`"
15782 fi
15783 case "$nv_preserves_uv_bits" in
15784 \-[1-9]*)
15785         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15786         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15787         d_nv_preserves_uv="$define"
15788         ;;
15789 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15790         d_nv_preserves_uv="$undef" ;;
15791 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15792         nv_preserves_uv_bits="0" ;;
15793 esac
15794 $rm_try
15795
15796 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15797 : volatile so that the compiler has to store it out to memory.
15798 if test X"$d_volatile" = X"$define"; then
15799         volatile=volatile
15800 fi
15801 $cat <<EOP >try.c
15802 #include <stdio.h>
15803
15804 typedef $nvtype NV;
15805
15806 int
15807 main() {
15808   NV value = 2;
15809   int count = 1;
15810
15811   while(count < 256) {
15812     $volatile NV up = value + 1.0;
15813     $volatile NV negated = -value;
15814     $volatile NV down = negated - 1.0;
15815     $volatile NV got_up = up - value;
15816     int up_good = got_up == 1.0;
15817     int got_down = down - negated;
15818     int down_good = got_down == -1.0;
15819
15820     if (down_good != up_good) {
15821       fprintf(stderr,
15822               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15823               up_good, (double) got_up, down_good, (double) got_down,
15824               count, (double) value);
15825       return 1;
15826     }
15827     if (!up_good) {
15828       while (1) {
15829         if (count > 8) {
15830           count -= 8;
15831           fputs("256.0", stdout);
15832         } else {
15833           count--;
15834           fputs("2.0", stdout);
15835         }
15836         if (!count) {
15837           puts("");
15838           return 0;
15839         }
15840         fputs("*", stdout);
15841       }
15842     }
15843     value *= 2;
15844     ++count;
15845   }
15846   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15847           count, (double) value);
15848   return 1;
15849 }
15850 EOP
15851 set try
15852
15853 nv_overflows_integers_at='0'
15854 if eval $compile; then
15855     xxx="`$run ./try`"
15856     case "$?" in
15857         0)
15858             case "$xxx" in
15859                 2*)  cat >&4 <<EOM
15860 The largest integer your NVs can preserve is equal to $xxx
15861 EOM
15862                     nv_overflows_integers_at="$xxx"
15863                     ;;
15864                 *)  cat >&4 <<EOM
15865 Cannot determine the largest integer value your NVs can hold, unexpected output
15866 '$xxx'
15867 EOM
15868                     ;;
15869             esac
15870             ;;
15871         *)  cat >&4 <<EOM
15872 Cannot determine the largest integer value your NVs can hold
15873 EOM
15874             ;;
15875     esac
15876 fi
15877 $rm_try
15878
15879 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15880 : volatile so that the compiler has to store it out to memory.
15881 if test X"$d_volatile" = X"$define"; then
15882         volatile=volatile
15883 fi
15884 $cat <<EOP >try.c
15885 #include <stdio.h>
15886 #$i_stdlib I_STDLIB
15887 #ifdef I_STDLIB
15888 #include <stdlib.h>
15889 #endif
15890 #$i_string I_STRING
15891 #ifdef I_STRING
15892 #  include <string.h>
15893 #else
15894 #  include <strings.h>
15895 #endif
15896 #include <sys/types.h>
15897 #include <signal.h>
15898 #ifdef SIGFPE
15899 $volatile int bletched = 0;
15900 $signal_t blech(int s) { bletched = 1; }
15901 #endif
15902
15903 int checkit($nvtype d, char *where) {
15904     unsigned char *p = (char *)&d;
15905     unsigned char *end = p + sizeof(d);
15906     int fail = 0;
15907
15908     while (p < end)
15909         fail += *p++;
15910
15911     if (!fail)
15912         return 0;
15913
15914     p = (char *)&d;
15915     printf("No - %s: 0x", where);
15916     while (p < end)
15917         printf ("%02X", *p++);
15918     printf("\n");
15919     return 1;
15920 }
15921
15922 int main(int argc, char **argv) {
15923     $nvtype d = 0.0;
15924     int fail = 0;
15925     fail += checkit(d, "0.0");
15926
15927     /* The compiler shouldn't be assuming that bletched is 0  */
15928     d = bletched;
15929
15930     fail += checkit(d, "bleched");
15931
15932 #ifdef SIGFPE
15933     signal(SIGFPE, blech);
15934 #endif
15935
15936     /* Paranoia - the compiler should have no way of knowing that ANSI says
15937        that argv[argc] will always be NULL.  Actually, if it did assume this it
15938        would be buggy, as this is C and main() can be called from elsewhere in
15939        the program.  */
15940     d = argv[argc] ? 1 : 0;
15941
15942     if (d) {
15943         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15944     }
15945
15946     fail += checkit(d, "ternary");
15947
15948     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15949
15950     if (d != 0.0) {
15951         printf("No - memset doesn't give 0.0\n");
15952         /* This might just blow up:  */
15953         printf("(gives %g)\n", d);
15954         return 1;
15955     }
15956
15957 #ifdef SIGFPE
15958     if (bletched) {
15959         printf("No - something bleched\n");
15960         return 1;
15961     }
15962 #endif
15963     if (fail) {
15964       printf("No - %d fail(s)\n", fail);
15965       return 1;
15966     }
15967     printf("Yes\n");
15968     return 0;
15969 }
15970 EOP
15971 set try
15972
15973 d_nv_zero_is_allbits_zero="$undef"
15974 if eval $compile; then
15975     xxx="`$run ./try`"
15976     case "$?" in
15977         0)
15978             case "$xxx" in
15979                 Yes)  cat >&4 <<EOM
15980 0.0 is represented as all bits zero in memory
15981 EOM
15982                     d_nv_zero_is_allbits_zero="$define"
15983                     ;;
15984                 *)  cat >&4 <<EOM
15985 0.0 is not represented as all bits zero in memory
15986 EOM
15987                     d_nv_zero_is_allbits_zero="$undef"
15988                     ;;
15989             esac
15990             ;;
15991         *)  cat >&4 <<EOM
15992 0.0 is not represented as all bits zero in memory
15993 EOM
15994             d_nv_zero_is_allbits_zero="$undef"
15995             ;;
15996     esac
15997 fi
15998 $rm_try
15999
16000 : check for off64_t
16001 echo " "
16002 echo "Checking to see if you have off64_t..." >&4
16003 $cat >try.c <<EOCP
16004 #include <sys/types.h>
16005 #include <unistd.h>
16006 int main() { off64_t x = 7; }
16007 EOCP
16008 set try
16009 if eval $compile; then
16010         val="$define"
16011         echo "You have off64_t."
16012 else
16013         val="$undef"
16014         echo "You do not have off64_t."
16015         case "$lseeksize" in
16016         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16017         esac
16018 fi
16019 $rm_try
16020 set d_off64_t
16021 eval $setvar
16022
16023 : how to create joinable pthreads
16024 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16025         echo " "
16026         echo "Checking what constant to use for creating joinable pthreads..." >&4
16027         $cat >try.c <<'EOCP'
16028 #include <pthread.h>
16029 int main() {
16030     int detachstate = JOINABLE;
16031 }
16032 EOCP
16033         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16034         if eval $compile; then
16035                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16036                 val="$undef" # Yes, undef.
16037                 set d_old_pthread_create_joinable
16038                 eval $setvar
16039                 val=""
16040                 set old_pthread_create_joinable
16041                 eval $setvar
16042         else
16043                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16044                 if eval $compile; then
16045                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16046                         val="$define"
16047                         set d_old_pthread_create_joinable
16048                         eval $setvar
16049                         val=PTHREAD_CREATE_UNDETACHED
16050                         set old_pthread_create_joinable
16051                         eval $setvar
16052                 else
16053                         set try -DJOINABLE=__UNDETACHED
16054                         if eval $compile; then
16055                                 echo "You seem to use __UNDETACHED." >&4
16056                                 val="$define"
16057                                 set d_old_pthread_create_joinable
16058                                 eval $setvar
16059                                 val=__UNDETACHED
16060                                 set old_pthread_create_joinable
16061                                 eval $setvar
16062                         else
16063                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16064                                 val="$define"
16065                                 set d_old_pthread_create_joinable
16066                                 eval $setvar
16067                                 val=0
16068                                 set old_pthread_create_joinable
16069                                 eval $setvar
16070                         fi
16071                 fi
16072         fi
16073         $rm_try
16074 else
16075     d_old_pthread_create_joinable="$undef"
16076     old_pthread_create_joinable=""
16077 fi
16078
16079 : see if pause exists
16080 set pause d_pause
16081 eval $inlibc
16082
16083 : see if poll exists
16084 set poll d_poll
16085 eval $inlibc
16086
16087 : see if prctl exists
16088 set prctl d_prctl
16089 eval $inlibc
16090
16091 : see if prctl supports PR_SET_NAME
16092 d_prctl_set_name=$undef
16093 case $d_prctl in
16094     $define)
16095         $cat >try.c <<EOM
16096 #include <sys/prctl.h>
16097
16098 int main (int argc, char *argv[])
16099 {
16100     return (prctl (PR_SET_NAME, "Test"));
16101     } /* main */
16102 EOM
16103         set try
16104         if eval $compile_ok && $run ./try; then
16105             echo "Your prctl (PR_SET_NAME, ...) works"
16106             d_prctl_set_name=$define
16107             fi
16108         $rm_try
16109         ;;
16110     esac
16111
16112 : see if readlink exists
16113 set readlink d_readlink
16114 eval $inlibc
16115
16116 : Check if exe is symlink to abs path of executing program
16117 echo " "
16118 procselfexe=''
16119 val="$undef"
16120 case "$d_readlink" in
16121 "$define")
16122         if $issymlink /proc/self/exe ; then
16123                 $ls -l /proc/self/exe > reflect
16124                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16125                         echo "You have Linux-like /proc/self/exe."
16126                         procselfexe='"/proc/self/exe"'
16127                         val="$define"
16128                 fi
16129         fi
16130         if $issymlink /proc/curproc/file ; then
16131                 $ls -l /proc/curproc/file > reflect
16132                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16133                         echo "You have BSD-like /proc/curproc/file."
16134                         procselfexe='"/proc/curproc/file"'
16135                         val="$define"
16136                 fi
16137         fi
16138         ;;
16139 esac
16140 $rm -f reflect
16141 set d_procselfexe
16142 eval $setvar
16143
16144 : backward compatibility for d_hvfork
16145 if test X$d_hvfork != X; then
16146         d_vfork="$d_hvfork"
16147         d_hvfork=''
16148 fi
16149 : see if there is a vfork
16150 val=''
16151 set vfork val
16152 eval $inlibc
16153
16154 d_pseudofork=$undef
16155
16156 : Ok, but do we want to use it. vfork is reportedly unreliable in
16157 : perl on Solaris 2.x, and probably elsewhere.
16158 case "$val" in
16159 $define)
16160         echo " "
16161         case "$usevfork" in
16162         false) dflt='n';;
16163         *) dflt='y';;
16164         esac
16165         cat <<'EOM'
16166
16167 Perl can only use a vfork() that doesn't suffer from strict
16168 restrictions on calling functions or modifying global data in
16169 the child.  For example, glibc-2.1 contains such a vfork()
16170 that is unsuitable.  If your system provides a proper fork()
16171 call, chances are that you do NOT want perl to use vfork().
16172
16173 EOM
16174         rp="Do you still want to use vfork()?"
16175         . ./myread
16176         case "$ans" in
16177         y|Y) ;;
16178         *)
16179                 echo "Ok, we won't use vfork()."
16180                 val="$undef"
16181                 ;;
16182         esac
16183         ;;
16184 esac
16185 set d_vfork
16186 eval $setvar
16187 case "$d_vfork" in
16188 $define) usevfork='true';;
16189 *) usevfork='false';;
16190 esac
16191
16192 : see whether the pthread_atfork exists
16193 $cat >try.c <<EOP
16194 #include <pthread.h>
16195 #include <stdio.h>
16196 int main() {
16197 #ifdef  PTHREAD_ATFORK
16198         pthread_atfork(NULL,NULL,NULL);
16199 #endif
16200 }
16201 EOP
16202
16203 : see if pthread_atfork exists
16204 set try -DPTHREAD_ATFORK
16205 if eval $compile; then
16206     val="$define"
16207 else
16208     val="$undef"
16209 fi
16210 case "$usethreads" in
16211 $define)
16212         case "$val" in
16213         $define) echo 'pthread_atfork found.' >&4        ;;
16214         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16215         esac
16216 esac
16217 set d_pthread_atfork
16218 eval $setvar
16219
16220 : see if pthread_attr_setscope exists
16221 set pthread_attr_setscope d_pthread_attr_setscope
16222 eval $inlibc
16223
16224 : see whether the various POSIXish _yields exist
16225 $cat >try.c <<EOP
16226 #include <pthread.h>
16227 #include <stdio.h>
16228 int main() {
16229 #ifdef SCHED_YIELD
16230         sched_yield();
16231 #else
16232 #ifdef PTHREAD_YIELD
16233         pthread_yield();
16234 #else
16235 #ifdef PTHREAD_YIELD_NULL
16236         pthread_yield(NULL);
16237 #endif
16238 #endif
16239 #endif
16240 }
16241 EOP
16242 : see if sched_yield exists
16243 set try -DSCHED_YIELD
16244 if eval $compile; then
16245     val="$define"
16246     sched_yield='sched_yield()'
16247 else
16248     val="$undef"
16249 fi
16250 case "$usethreads" in
16251 $define)
16252         case "$val" in
16253         $define) echo 'sched_yield() found.' >&4        ;;
16254         *)       echo 'sched_yield() NOT found.' >&4    ;;
16255         esac
16256 esac
16257 set d_sched_yield
16258 eval $setvar
16259
16260 : see if pthread_yield exists
16261 set try -DPTHREAD_YIELD
16262 if eval $compile; then
16263     val="$define"
16264     case "$sched_yield" in
16265     '') sched_yield='pthread_yield()' ;;
16266     esac
16267 else
16268     set try -DPTHREAD_YIELD_NULL
16269     if eval $compile; then
16270         val="$define"
16271         case "$sched_yield" in
16272         '') sched_yield='pthread_yield(NULL)' ;;
16273         esac
16274     else
16275         val="$undef"
16276     fi
16277 fi
16278 case "$usethreads" in
16279 $define)
16280         case "$val" in
16281         $define) echo 'pthread_yield() found.' >&4      ;;
16282         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16283         esac
16284         ;;
16285 esac
16286 set d_pthread_yield
16287 eval $setvar
16288 case "$sched_yield" in
16289 '') sched_yield=undef ;;
16290 esac
16291 $rm_try
16292
16293 : see if random_r exists
16294 set random_r d_random_r
16295 eval $inlibc
16296 case "$d_random_r" in
16297 "$define")
16298         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16299         case "$d_random_r_proto:$usethreads" in
16300         ":define")      d_random_r_proto=define
16301                 set d_random_r_proto random_r $hdrs
16302                 eval $hasproto ;;
16303         *)      ;;
16304         esac
16305         case "$d_random_r_proto" in
16306         define)
16307         case "$random_r_proto" in
16308         ''|0) try='int random_r(int*, struct random_data*);'
16309         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16310         esac
16311         case "$random_r_proto" in
16312         ''|0) try='int random_r(long*, struct random_data*);'
16313         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16314         esac
16315         case "$random_r_proto" in
16316         ''|0) try='int random_r(struct random_data*, int32_t*);'
16317         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16318         esac
16319         case "$random_r_proto" in
16320         ''|0)   d_random_r=undef
16321                 random_r_proto=0
16322                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16323         * )     case "$random_r_proto" in
16324                 REENTRANT_PROTO*) ;;
16325                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16326                 esac
16327                 echo "Prototype: $try" ;;
16328         esac
16329         ;;
16330         *)      case "$usethreads" in
16331                 define) echo "random_r has no prototype, not using it." >&4 ;;
16332                 esac
16333                 d_random_r=undef
16334                 random_r_proto=0
16335                 ;;
16336         esac
16337         ;;
16338 *)      random_r_proto=0
16339         ;;
16340 esac
16341
16342 : see if readdir and friends exist
16343 set readdir d_readdir
16344 eval $inlibc
16345 set seekdir d_seekdir
16346 eval $inlibc
16347 set telldir d_telldir
16348 eval $inlibc
16349 set rewinddir d_rewinddir
16350 eval $inlibc
16351
16352 : see if readdir64_r exists
16353 set readdir64_r d_readdir64_r
16354 eval $inlibc
16355 case "$d_readdir64_r" in
16356 "$define")
16357         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16358         case "$d_readdir64_r_proto:$usethreads" in
16359         ":define")      d_readdir64_r_proto=define
16360                 set d_readdir64_r_proto readdir64_r $hdrs
16361                 eval $hasproto ;;
16362         *)      ;;
16363         esac
16364         case "$d_readdir64_r_proto" in
16365         define)
16366         case "$readdir64_r_proto" in
16367         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16368         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16369         esac
16370         case "$readdir64_r_proto" in
16371         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16372         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16373         esac
16374         case "$readdir64_r_proto" in
16375         ''|0)   d_readdir64_r=undef
16376                 readdir64_r_proto=0
16377                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16378         * )     case "$readdir64_r_proto" in
16379                 REENTRANT_PROTO*) ;;
16380                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16381                 esac
16382                 echo "Prototype: $try" ;;
16383         esac
16384         ;;
16385         *)      case "$usethreads" in
16386                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16387                 esac
16388                 d_readdir64_r=undef
16389                 readdir64_r_proto=0
16390                 ;;
16391         esac
16392         ;;
16393 *)      readdir64_r_proto=0
16394         ;;
16395 esac
16396
16397 : see if readdir_r exists
16398 set readdir_r d_readdir_r
16399 eval $inlibc
16400 case "$d_readdir_r" in
16401 "$define")
16402         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16403         case "$d_readdir_r_proto:$usethreads" in
16404         ":define")      d_readdir_r_proto=define
16405                 set d_readdir_r_proto readdir_r $hdrs
16406                 eval $hasproto ;;
16407         *)      ;;
16408         esac
16409         case "$d_readdir_r_proto" in
16410         define)
16411         case "$readdir_r_proto" in
16412         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16413         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16414         esac
16415         case "$readdir_r_proto" in
16416         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16417         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16418         esac
16419         case "$readdir_r_proto" in
16420         ''|0)   d_readdir_r=undef
16421                 readdir_r_proto=0
16422                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16423         * )     case "$readdir_r_proto" in
16424                 REENTRANT_PROTO*) ;;
16425                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16426                 esac
16427                 echo "Prototype: $try" ;;
16428         esac
16429         ;;
16430         *)      case "$usethreads" in
16431                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16432                 esac
16433                 d_readdir_r=undef
16434                 readdir_r_proto=0
16435                 ;;
16436         esac
16437         ;;
16438 *)      readdir_r_proto=0
16439         ;;
16440 esac
16441
16442 : see if readv exists
16443 set readv d_readv
16444 eval $inlibc
16445
16446 : see if recvmsg exists
16447 set recvmsg d_recvmsg
16448 eval $inlibc
16449
16450 : see if rename exists
16451 set rename d_rename
16452 eval $inlibc
16453
16454 : see if rmdir exists
16455 set rmdir d_rmdir
16456 eval $inlibc
16457
16458 : see if memory.h is available.
16459 val=''
16460 set memory.h val
16461 eval $inhdr
16462
16463 : See if it conflicts with string.h
16464 case "$val" in
16465 $define)
16466         case "$strings" in
16467         '') ;;
16468         *)
16469                 $cppstdin $cppflags $cppminus < $strings > mem.h
16470                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16471                         echo " "
16472                         echo "We won't be including <memory.h>."
16473                         val="$undef"
16474                 fi
16475                 $rm -f mem.h
16476                 ;;
16477         esac
16478 esac
16479 set i_memory
16480 eval $setvar
16481
16482 : can bcopy handle overlapping blocks?
16483 echo " "
16484 val="$undef"
16485 case "$d_memmove" in
16486 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16487 *)      case "$d_bcopy" in
16488         "$define")
16489                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16490                 $cat >try.c <<EOCP
16491 #$i_memory I_MEMORY
16492 #$i_stdlib I_STDLIB
16493 #$i_string I_STRING
16494 #$i_unistd I_UNISTD
16495 EOCP
16496         $cat >>try.c <<'EOCP'
16497 #include <stdio.h>
16498 #ifdef I_MEMORY
16499 #  include <memory.h>
16500 #endif
16501 #ifdef I_STDLIB
16502 #  include <stdlib.h>
16503 #endif
16504 #ifdef I_STRING
16505 #  include <string.h>
16506 #else
16507 #  include <strings.h>
16508 #endif
16509 #ifdef I_UNISTD
16510 #  include <unistd.h>  /* Needed for NetBSD */
16511 #endif
16512 int main()
16513 {
16514 char buf[128], abc[128];
16515 char *b;
16516 int len;
16517 int off;
16518 int align;
16519
16520 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16521    try to store the string in read-only memory. */
16522 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16523
16524 for (align = 7; align >= 0; align--) {
16525         for (len = 36; len; len--) {
16526                 b = buf+align;
16527                 bcopy(abc, b, len);
16528                 for (off = 1; off <= len; off++) {
16529                         bcopy(b, b+off, len);
16530                         bcopy(b+off, b, len);
16531                         if (bcmp(b, abc, len))
16532                                 exit(1);
16533                 }
16534         }
16535 }
16536 exit(0);
16537 }
16538 EOCP
16539                 set try
16540                 if eval $compile_ok; then
16541                         if $run ./try 2>/dev/null; then
16542                                 echo "Yes, it can."
16543                                 val="$define"
16544                         else
16545                                 echo "It can't, sorry."
16546                         fi
16547                 else
16548                         echo "(I can't compile the test program, so we'll assume not...)"
16549                 fi
16550                 ;;
16551         esac
16552         $rm_try
16553         ;;
16554 esac
16555 set d_safebcpy
16556 eval $setvar
16557
16558 : can memcpy handle overlapping blocks?
16559 echo " "
16560 val="$undef"
16561 case "$d_memmove" in
16562 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16563 *)      case "$d_memcpy" in
16564         "$define")
16565                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16566                 $cat >try.c <<EOCP
16567 #$i_memory I_MEMORY
16568 #$i_stdlib I_STDLIB
16569 #$i_string I_STRING
16570 #$i_unistd I_UNISTD
16571 EOCP
16572         $cat >>try.c <<'EOCP'
16573 #include <stdio.h>
16574 #ifdef I_MEMORY
16575 #  include <memory.h>
16576 #endif
16577 #ifdef I_STDLIB
16578 #  include <stdlib.h>
16579 #endif
16580 #ifdef I_STRING
16581 #  include <string.h>
16582 #else
16583 #  include <strings.h>
16584 #endif
16585 #ifdef I_UNISTD
16586 #  include <unistd.h>  /* Needed for NetBSD */
16587 #endif
16588 int main()
16589 {
16590 char buf[128], abc[128];
16591 char *b;
16592 int len;
16593 int off;
16594 int align;
16595
16596 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16597    try to store the string in read-only memory. */
16598 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16599
16600 for (align = 7; align >= 0; align--) {
16601         for (len = 36; len; len--) {
16602                 b = buf+align;
16603                 memcpy(b, abc, len);
16604                 for (off = 1; off <= len; off++) {
16605                         memcpy(b+off, b, len);
16606                         memcpy(b, b+off, len);
16607                         if (memcmp(b, abc, len))
16608                                 exit(1);
16609                 }
16610         }
16611 }
16612 exit(0);
16613 }
16614 EOCP
16615                 set try
16616                 if eval $compile_ok; then
16617                         if $run ./try 2>/dev/null; then
16618                                 echo "Yes, it can."
16619                                 val="$define"
16620                         else
16621                                 echo "It can't, sorry."
16622                         fi
16623                 else
16624                         echo "(I can't compile the test program, so we'll assume not...)"
16625                 fi
16626                 ;;
16627         esac
16628         $rm_try
16629         ;;
16630 esac
16631 set d_safemcpy
16632 eval $setvar
16633
16634 : can memcmp be trusted to compare relative magnitude?
16635 val="$undef"
16636 case "$d_memcmp" in
16637 "$define")
16638         echo " "
16639         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16640         $cat >try.c <<EOCP
16641 #$i_memory I_MEMORY
16642 #$i_stdlib I_STDLIB
16643 #$i_string I_STRING
16644 #$i_unistd I_UNISTD
16645 EOCP
16646         $cat >>try.c <<'EOCP'
16647 #include <stdio.h>
16648 #ifdef I_MEMORY
16649 #  include <memory.h>
16650 #endif
16651 #ifdef I_STDLIB
16652 #  include <stdlib.h>
16653 #endif
16654 #ifdef I_STRING
16655 #  include <string.h>
16656 #else
16657 #  include <strings.h>
16658 #endif
16659 #ifdef I_UNISTD
16660 #  include <unistd.h>  /* Needed for NetBSD */
16661 #endif
16662 int main()
16663 {
16664 char a = -1;
16665 char b = 0;
16666 if ((a < b) && memcmp(&a, &b, 1) < 0)
16667         exit(1);
16668 exit(0);
16669 }
16670 EOCP
16671         set try
16672         if eval $compile_ok; then
16673                 if $run ./try 2>/dev/null; then
16674                         echo "Yes, it can."
16675                         val="$define"
16676                 else
16677                         echo "No, it can't (it uses signed chars)."
16678                 fi
16679         else
16680                 echo "(I can't compile the test program, so we'll assume not...)"
16681         fi
16682         ;;
16683 esac
16684 $rm_try
16685 set d_sanemcmp
16686 eval $setvar
16687
16688 : see if prototype for sbrk is available
16689 echo " "
16690 set d_sbrkproto sbrk $i_unistd unistd.h
16691 eval $hasproto
16692
16693 : see if select exists
16694 set select d_select
16695 eval $inlibc
16696
16697 : see if semctl exists
16698 set semctl d_semctl
16699 eval $inlibc
16700
16701 : see if semget exists
16702 set semget d_semget
16703 eval $inlibc
16704
16705 : see if semop exists
16706 set semop d_semop
16707 eval $inlibc
16708
16709 : see how much of the 'sem*(2)' library is present.
16710 h_sem=true
16711 echo " "
16712 case "$d_semctl$d_semget$d_semop" in
16713 *"$undef"*) h_sem=false;;
16714 esac
16715 case "$osname" in
16716 freebsd)
16717     case "`ipcs 2>&1`" in
16718     "SVID messages"*"not configured"*)
16719         echo "Your $osname does not have the sem*(2) configured." >&4
16720         h_sem=false
16721         val="$undef"
16722         set semctl d_semctl
16723         eval $setvar
16724         set semget d_semget
16725         eval $setvar
16726         set semop d_semop
16727         eval $setvar
16728         ;;
16729     esac
16730     ;;
16731 esac
16732 : we could also check for sys/ipc.h ...
16733 if $h_sem && $test `./findhdr sys/sem.h`; then
16734         echo "You have the full sem*(2) library." >&4
16735         val="$define"
16736 else
16737         echo "You don't have the full sem*(2) library." >&4
16738         val="$undef"
16739 fi
16740 set d_sem
16741 eval $setvar
16742
16743 : see whether sys/sem.h defines union semun
16744 echo " "
16745 $cat > try.c <<'END'
16746 #include <sys/types.h>
16747 #include <sys/ipc.h>
16748 #include <sys/sem.h>
16749 int main () { union semun semun; semun.buf = 0; }
16750 END
16751 set try
16752 if eval $compile; then
16753     echo "You have union semun in <sys/sem.h>." >&4
16754     val="$define"
16755 else
16756     echo "You do not have union semun in <sys/sem.h>." >&4
16757     val="$undef"
16758 fi
16759 $rm_try
16760 set d_union_semun
16761 eval $setvar
16762
16763 : see how to do semctl IPC_STAT
16764 case "$d_sem" in
16765 $define)
16766     echo " "
16767     $cat > tryh.h <<END
16768 #ifndef S_IRUSR
16769 #   ifdef S_IREAD
16770 #       define S_IRUSR S_IREAD
16771 #       define S_IWUSR S_IWRITE
16772 #       define S_IXUSR S_IEXEC
16773 #   else
16774 #       define S_IRUSR 0400
16775 #       define S_IWUSR 0200
16776 #       define S_IXUSR 0100
16777 #   endif
16778 #   define S_IRGRP (S_IRUSR>>3)
16779 #   define S_IWGRP (S_IWUSR>>3)
16780 #   define S_IXGRP (S_IXUSR>>3)
16781 #   define S_IROTH (S_IRUSR>>6)
16782 #   define S_IWOTH (S_IWUSR>>6)
16783 #   define S_IXOTH (S_IXUSR>>6)
16784 #endif
16785 #ifndef S_IRWXU
16786 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16787 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16788 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16789 #endif
16790 END
16791     : see whether semctl IPC_STAT can use union semun
16792     case "$d_semctl_semun" in
16793     '')
16794       val="$undef"
16795       $cat > try.c <<END
16796 #include <sys/types.h>
16797 #include <sys/ipc.h>
16798 #include <sys/sem.h>
16799 #include <sys/stat.h>
16800 #include <stdio.h>
16801 #include <errno.h>
16802 #include "tryh.h"
16803 #ifndef errno
16804 extern int errno;
16805 #endif
16806 #$d_union_semun HAS_UNION_SEMUN
16807 int main() {
16808     union semun
16809 #ifndef HAS_UNION_SEMUN
16810     {
16811         int val;
16812         struct semid_ds *buf;
16813         unsigned short *array;
16814     }
16815 #endif
16816     arg;
16817     int sem, st;
16818
16819 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16820     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16821     if (sem > -1) {
16822         struct semid_ds argbuf;
16823         arg.buf = &argbuf;
16824 #       ifdef IPC_STAT
16825         st = semctl(sem, 0, IPC_STAT, arg);
16826         if (st == 0)
16827             printf("semun\n");
16828         else
16829 #       endif /* IPC_STAT */
16830             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16831 #       ifdef IPC_RMID
16832         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16833 #       endif /* IPC_RMID */
16834             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16835     } else
16836 #endif /* IPC_PRIVATE && ... */
16837         printf("semget failed: errno = %d\n", errno);
16838   return 0;
16839 }
16840 END
16841       set try
16842       if eval $compile; then
16843           xxx=`$run ./try`
16844           case "$xxx" in
16845           semun) val="$define" ;;
16846           esac
16847       fi
16848       $rm_try
16849       set d_semctl_semun
16850       eval $setvar
16851       ;;
16852     esac
16853     case "$d_semctl_semun" in
16854     $define)
16855         echo "You can use union semun for semctl IPC_STAT." >&4
16856         also='also'
16857         ;;
16858     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16859         also=''
16860         ;;
16861     esac
16862
16863     : see whether semctl IPC_STAT can use struct semid_ds pointer
16864     case "$d_semctl_semid_ds" in
16865     '')
16866       val="$undef"
16867       $cat > try.c <<'END'
16868 #include <sys/types.h>
16869 #include <sys/ipc.h>
16870 #include <sys/sem.h>
16871 #include <sys/stat.h>
16872 #include "tryh.h"
16873 #include <stdio.h>
16874 #include <errno.h>
16875 #ifndef errno
16876 extern int errno;
16877 #endif
16878 int main() {
16879     struct semid_ds arg;
16880     int sem, st;
16881
16882 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16883     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16884     if (sem > -1) {
16885 #       ifdef IPC_STAT
16886         st = semctl(sem, 0, IPC_STAT, &arg);
16887         if (st == 0)
16888             printf("semid_ds\n");
16889         else
16890 #       endif /* IPC_STAT */
16891             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16892 #       ifdef IPC_RMID
16893         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16894 #       endif /* IPC_RMID */
16895             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16896     } else
16897 #endif /* IPC_PRIVATE && ... */
16898         printf("semget failed: errno = %d\n", errno);
16899
16900     return 0;
16901 }
16902 END
16903       set try
16904       if eval $compile; then
16905           xxx=`$run ./try`
16906           case "$xxx" in
16907           semid_ds) val="$define" ;;
16908           esac
16909       fi
16910       $rm_try
16911       set d_semctl_semid_ds
16912       eval $setvar
16913       ;;
16914     esac
16915     case "$d_semctl_semid_ds" in
16916     $define)
16917         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16918         ;;
16919     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16920         ;;
16921     esac
16922     ;;
16923 *)  val="$undef"
16924
16925     # We do not have the full sem*(2) library, so assume we can not
16926     # use either.
16927
16928     set d_semctl_semun
16929     eval $setvar
16930
16931     set d_semctl_semid_ds
16932     eval $setvar
16933     ;;
16934 esac
16935 $rm_try tryh.h
16936
16937 : see if sendmsg exists
16938 set sendmsg d_sendmsg
16939 eval $inlibc
16940
16941 : see if setegid exists
16942 set setegid d_setegid
16943 eval $inlibc
16944
16945 : see if seteuid exists
16946 set seteuid d_seteuid
16947 eval $inlibc
16948
16949 : see if setgrent exists
16950 set setgrent d_setgrent
16951 eval $inlibc
16952
16953 : see if setgrent_r exists
16954 set setgrent_r d_setgrent_r
16955 eval $inlibc
16956 case "$d_setgrent_r" in
16957 "$define")
16958         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16959         case "$d_setgrent_r_proto:$usethreads" in
16960         ":define")      d_setgrent_r_proto=define
16961                 set d_setgrent_r_proto setgrent_r $hdrs
16962                 eval $hasproto ;;
16963         *)      ;;
16964         esac
16965         case "$d_setgrent_r_proto" in
16966         define)
16967         case "$setgrent_r_proto" in
16968         ''|0) try='int setgrent_r(FILE**);'
16969         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16970         esac
16971         case "$setgrent_r_proto" in
16972         ''|0) try='void setgrent_r(FILE**);'
16973         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16974         esac
16975         case "$setgrent_r_proto" in
16976         ''|0)   d_setgrent_r=undef
16977                 setgrent_r_proto=0
16978                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16979         * )     case "$setgrent_r_proto" in
16980                 REENTRANT_PROTO*) ;;
16981                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16982                 esac
16983                 echo "Prototype: $try" ;;
16984         esac
16985         ;;
16986         *)      case "$usethreads" in
16987                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16988                 esac
16989                 d_setgrent_r=undef
16990                 setgrent_r_proto=0
16991                 ;;
16992         esac
16993         ;;
16994 *)      setgrent_r_proto=0
16995         ;;
16996 esac
16997
16998 : see if sethostent exists
16999 set sethostent d_sethent
17000 eval $inlibc
17001
17002 : see if sethostent_r exists
17003 set sethostent_r d_sethostent_r
17004 eval $inlibc
17005 case "$d_sethostent_r" in
17006 "$define")
17007         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17008         case "$d_sethostent_r_proto:$usethreads" in
17009         ":define")      d_sethostent_r_proto=define
17010                 set d_sethostent_r_proto sethostent_r $hdrs
17011                 eval $hasproto ;;
17012         *)      ;;
17013         esac
17014         case "$d_sethostent_r_proto" in
17015         define)
17016         case "$sethostent_r_proto" in
17017         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17018         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17019         esac
17020         case "$sethostent_r_proto" in
17021         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17022         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17023         esac
17024         case "$sethostent_r_proto" in
17025         ''|0)   d_sethostent_r=undef
17026                 sethostent_r_proto=0
17027                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17028         * )     case "$sethostent_r_proto" in
17029                 REENTRANT_PROTO*) ;;
17030                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17031                 esac
17032                 echo "Prototype: $try" ;;
17033         esac
17034         ;;
17035         *)      case "$usethreads" in
17036                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17037                 esac
17038                 d_sethostent_r=undef
17039                 sethostent_r_proto=0
17040                 ;;
17041         esac
17042         ;;
17043 *)      sethostent_r_proto=0
17044         ;;
17045 esac
17046
17047 : see if setitimer exists
17048 set setitimer d_setitimer
17049 eval $inlibc
17050
17051 : see if setlinebuf exists
17052 set setlinebuf d_setlinebuf
17053 eval $inlibc
17054
17055 : see if setlocale exists
17056 set setlocale d_setlocale
17057 eval $inlibc
17058
17059 : see if locale.h is available
17060 set locale.h i_locale
17061 eval $inhdr
17062
17063 : see if setlocale_r exists
17064 set setlocale_r d_setlocale_r
17065 eval $inlibc
17066 case "$d_setlocale_r" in
17067 "$define")
17068         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17069         case "$d_setlocale_r_proto:$usethreads" in
17070         ":define")      d_setlocale_r_proto=define
17071                 set d_setlocale_r_proto setlocale_r $hdrs
17072                 eval $hasproto ;;
17073         *)      ;;
17074         esac
17075         case "$d_setlocale_r_proto" in
17076         define)
17077         case "$setlocale_r_proto" in
17078         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17079         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17080         esac
17081         case "$setlocale_r_proto" in
17082         ''|0)   d_setlocale_r=undef
17083                 setlocale_r_proto=0
17084                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17085         * )     case "$setlocale_r_proto" in
17086                 REENTRANT_PROTO*) ;;
17087                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17088                 esac
17089                 echo "Prototype: $try" ;;
17090         esac
17091         ;;
17092         *)      case "$usethreads" in
17093                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17094                 esac
17095                 d_setlocale_r=undef
17096                 setlocale_r_proto=0
17097                 ;;
17098         esac
17099         ;;
17100 *)      setlocale_r_proto=0
17101         ;;
17102 esac
17103
17104 : see if setnetent exists
17105 set setnetent d_setnent
17106 eval $inlibc
17107
17108 : see if setnetent_r exists
17109 set setnetent_r d_setnetent_r
17110 eval $inlibc
17111 case "$d_setnetent_r" in
17112 "$define")
17113         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17114         case "$d_setnetent_r_proto:$usethreads" in
17115         ":define")      d_setnetent_r_proto=define
17116                 set d_setnetent_r_proto setnetent_r $hdrs
17117                 eval $hasproto ;;
17118         *)      ;;
17119         esac
17120         case "$d_setnetent_r_proto" in
17121         define)
17122         case "$setnetent_r_proto" in
17123         ''|0) try='int setnetent_r(int, struct netent_data*);'
17124         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17125         esac
17126         case "$setnetent_r_proto" in
17127         ''|0) try='void setnetent_r(int, struct netent_data*);'
17128         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17129         esac
17130         case "$setnetent_r_proto" in
17131         ''|0)   d_setnetent_r=undef
17132                 setnetent_r_proto=0
17133                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17134         * )     case "$setnetent_r_proto" in
17135                 REENTRANT_PROTO*) ;;
17136                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17137                 esac
17138                 echo "Prototype: $try" ;;
17139         esac
17140         ;;
17141         *)      case "$usethreads" in
17142                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17143                 esac
17144                 d_setnetent_r=undef
17145                 setnetent_r_proto=0
17146                 ;;
17147         esac
17148         ;;
17149 *)      setnetent_r_proto=0
17150         ;;
17151 esac
17152
17153 : see if setprotoent exists
17154 set setprotoent d_setpent
17155 eval $inlibc
17156
17157 : see if setpgid exists
17158 set setpgid d_setpgid
17159 eval $inlibc
17160
17161 : see if setpgrp2 exists
17162 set setpgrp2 d_setpgrp2
17163 eval $inlibc
17164
17165 : see if setpriority exists
17166 set setpriority d_setprior
17167 eval $inlibc
17168
17169 : see if setproctitle exists
17170 set setproctitle d_setproctitle
17171 eval $inlibc
17172
17173 : see if setprotoent_r exists
17174 set setprotoent_r d_setprotoent_r
17175 eval $inlibc
17176 case "$d_setprotoent_r" in
17177 "$define")
17178         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17179         case "$d_setprotoent_r_proto:$usethreads" in
17180         ":define")      d_setprotoent_r_proto=define
17181                 set d_setprotoent_r_proto setprotoent_r $hdrs
17182                 eval $hasproto ;;
17183         *)      ;;
17184         esac
17185         case "$d_setprotoent_r_proto" in
17186         define)
17187         case "$setprotoent_r_proto" in
17188         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17189         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17190         esac
17191         case "$setprotoent_r_proto" in
17192         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17193         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17194         esac
17195         case "$setprotoent_r_proto" in
17196         ''|0)   d_setprotoent_r=undef
17197                 setprotoent_r_proto=0
17198                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17199         * )     case "$setprotoent_r_proto" in
17200                 REENTRANT_PROTO*) ;;
17201                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17202                 esac
17203                 echo "Prototype: $try" ;;
17204         esac
17205         ;;
17206         *)      case "$usethreads" in
17207                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17208                 esac
17209                 d_setprotoent_r=undef
17210                 setprotoent_r_proto=0
17211                 ;;
17212         esac
17213         ;;
17214 *)      setprotoent_r_proto=0
17215         ;;
17216 esac
17217
17218 : see if setpwent exists
17219 set setpwent d_setpwent
17220 eval $inlibc
17221
17222 : see if setpwent_r exists
17223 set setpwent_r d_setpwent_r
17224 eval $inlibc
17225 case "$d_setpwent_r" in
17226 "$define")
17227         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17228         case "$d_setpwent_r_proto:$usethreads" in
17229         ":define")      d_setpwent_r_proto=define
17230                 set d_setpwent_r_proto setpwent_r $hdrs
17231                 eval $hasproto ;;
17232         *)      ;;
17233         esac
17234         case "$d_setpwent_r_proto" in
17235         define)
17236         case "$setpwent_r_proto" in
17237         ''|0) try='int setpwent_r(FILE**);'
17238         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17239         esac
17240         case "$setpwent_r_proto" in
17241         ''|0) try='void setpwent_r(FILE**);'
17242         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17243         esac
17244         case "$setpwent_r_proto" in
17245         ''|0)   d_setpwent_r=undef
17246                 setpwent_r_proto=0
17247                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17248         * )     case "$setpwent_r_proto" in
17249                 REENTRANT_PROTO*) ;;
17250                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17251                 esac
17252                 echo "Prototype: $try" ;;
17253         esac
17254         ;;
17255         *)      case "$usethreads" in
17256                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17257                 esac
17258                 d_setpwent_r=undef
17259                 setpwent_r_proto=0
17260                 ;;
17261         esac
17262         ;;
17263 *)      setpwent_r_proto=0
17264         ;;
17265 esac
17266
17267 : see if setregid exists
17268 set setregid d_setregid
17269 eval $inlibc
17270 set setresgid d_setresgid
17271 eval $inlibc
17272
17273 : see if setreuid exists
17274 set setreuid d_setreuid
17275 eval $inlibc
17276 set setresuid d_setresuid
17277 eval $inlibc
17278
17279 : see if setrgid exists
17280 set setrgid d_setrgid
17281 eval $inlibc
17282
17283 : see if setruid exists
17284 set setruid d_setruid
17285 eval $inlibc
17286
17287 : see if setservent exists
17288 set setservent d_setsent
17289 eval $inlibc
17290
17291 : see if setservent_r exists
17292 set setservent_r d_setservent_r
17293 eval $inlibc
17294 case "$d_setservent_r" in
17295 "$define")
17296         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17297         case "$d_setservent_r_proto:$usethreads" in
17298         ":define")      d_setservent_r_proto=define
17299                 set d_setservent_r_proto setservent_r $hdrs
17300                 eval $hasproto ;;
17301         *)      ;;
17302         esac
17303         case "$d_setservent_r_proto" in
17304         define)
17305         case "$setservent_r_proto" in
17306         ''|0) try='int setservent_r(int, struct servent_data*);'
17307         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17308         esac
17309         case "$setservent_r_proto" in
17310         ''|0) try='void setservent_r(int, struct servent_data*);'
17311         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17312         esac
17313         case "$setservent_r_proto" in
17314         ''|0)   d_setservent_r=undef
17315                 setservent_r_proto=0
17316                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17317         * )     case "$setservent_r_proto" in
17318                 REENTRANT_PROTO*) ;;
17319                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17320                 esac
17321                 echo "Prototype: $try" ;;
17322         esac
17323         ;;
17324         *)      case "$usethreads" in
17325                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17326                 esac
17327                 d_setservent_r=undef
17328                 setservent_r_proto=0
17329                 ;;
17330         esac
17331         ;;
17332 *)      setservent_r_proto=0
17333         ;;
17334 esac
17335
17336 : see if setsid exists
17337 set setsid d_setsid
17338 eval $inlibc
17339
17340 : see if setvbuf exists
17341 set setvbuf d_setvbuf
17342 eval $inlibc
17343
17344 : see if sfio.h is available
17345 set sfio.h i_sfio
17346 eval $inhdr
17347
17348 : see if sfio library is available
17349 case "$i_sfio" in
17350 $define)
17351         val=''
17352         set sfreserve val
17353         eval $inlibc
17354         ;;
17355 *)
17356         val="$undef"
17357         ;;
17358 esac
17359 : Ok, but do we want to use it.
17360 case "$val" in
17361 $define)
17362         case "$usesfio" in
17363         true|$define|[yY]*) dflt='y';;
17364         *) dflt='n';;
17365         esac
17366         echo "$package can use the sfio library, but it is experimental."
17367         case "$useperlio" in
17368         "$undef")
17369             echo "For sfio also the PerlIO abstraction layer is needed."
17370             echo "Earlier you said you wouldn't want that."
17371             ;;
17372         esac
17373         rp="You seem to have sfio available, do you want to try using it?"
17374         . ./myread
17375         case "$ans" in
17376         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17377                 useperlio="$define"
17378                 val="$define"
17379                 ;;
17380         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17381                 val="$undef"
17382                 ;;
17383         esac
17384         ;;
17385 *)      case "$usesfio" in
17386         true|$define|[yY]*)
17387                 echo "Sorry, cannot find sfio on this machine." >&4
17388                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17389                 val="$undef"
17390                 ;;
17391         esac
17392         ;;
17393 esac
17394 set d_sfio
17395 eval $setvar
17396 case "$d_sfio" in
17397 $define) usesfio='true';;
17398 *) usesfio='false';;
17399 esac
17400 case "$d_sfio" in
17401 $define) ;;
17402 *)      : Remove sfio from list of libraries to use
17403         case "$libs" in
17404         *-lsfio*)
17405                 echo "Removing unneeded -lsfio from library list" >&4
17406                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17407                 shift
17408                 libs="$*"
17409                 echo "libs = $libs" >&4
17410                 ;;
17411         esac
17412 ;;
17413 esac
17414
17415
17416 : see if shmctl exists
17417 set shmctl d_shmctl
17418 eval $inlibc
17419
17420 : see if shmget exists
17421 set shmget d_shmget
17422 eval $inlibc
17423
17424 : see if shmat exists
17425 set shmat d_shmat
17426 eval $inlibc
17427 : see what shmat returns
17428 case "$d_shmat" in
17429 "$define")
17430         $cat >shmat.c <<'END'
17431 #include <sys/shm.h>
17432 void *shmat();
17433 END
17434         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17435                 shmattype='void *'
17436         else
17437                 shmattype='char *'
17438         fi
17439         echo "and it returns ($shmattype)." >&4
17440         : see if a prototype for shmat is available
17441         xxx=`./findhdr sys/shm.h`
17442         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17443         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17444                 val="$define"
17445         else
17446                 val="$undef"
17447         fi
17448         $rm -f shmat.[co]
17449         ;;
17450 *)
17451         val="$undef"
17452         ;;
17453 esac
17454 set d_shmatprototype
17455 eval $setvar
17456
17457 : see if shmdt exists
17458 set shmdt d_shmdt
17459 eval $inlibc
17460
17461 : see how much of the 'shm*(2)' library is present.
17462 h_shm=true
17463 echo " "
17464 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17465 *"$undef"*) h_shm=false;;
17466 esac
17467 case "$osname" in
17468 freebsd)
17469     case "`ipcs 2>&1`" in
17470     "SVID shared memory"*"not configured"*)
17471         echo "Your $osname does not have the shm*(2) configured." >&4
17472         h_shm=false
17473         val="$undef"
17474         set shmctl d_shmctl
17475         evat $setvar
17476         set shmget d_shmget
17477         evat $setvar
17478         set shmat d_shmat
17479         evat $setvar
17480         set shmdt d_shmdt
17481         evat $setvar
17482         ;;
17483     esac
17484     ;;
17485 esac
17486 : we could also check for sys/ipc.h ...
17487 if $h_shm && $test `./findhdr sys/shm.h`; then
17488         echo "You have the full shm*(2) library." >&4
17489         val="$define"
17490 else
17491         echo "You don't have the full shm*(2) library." >&4
17492         val="$undef"
17493 fi
17494 set d_shm
17495 eval $setvar
17496
17497 : see if we have sigaction
17498 echo " "
17499 if set sigaction val -f d_sigaction; eval $csym; $val; then
17500         echo 'sigaction() found.' >&4
17501         $cat > try.c <<EOP
17502 #include <stdio.h>
17503 #include <sys/types.h>
17504 #include <signal.h>
17505 #$i_stdlib I_STDLIB
17506 #ifdef I_STDLIB
17507 #include <stdlib.h>
17508 #endif
17509 int main()
17510 {
17511     struct sigaction act, oact;
17512     act.sa_flags = 0;
17513     oact.sa_handler = 0;
17514     /* so that act and oact are used */
17515     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17516 }
17517 EOP
17518         set try
17519         if eval $compile_ok; then
17520                 val="$define"
17521         else
17522                 echo "But you don't seem to have a useable struct sigaction." >&4
17523                 val="$undef"
17524         fi
17525 else
17526         echo 'sigaction NOT found.' >&4
17527         val="$undef"
17528 fi
17529 set d_sigaction; eval $setvar
17530 $rm_try
17531
17532 : see if this is a sunmath.h system
17533 set sunmath.h i_sunmath
17534 eval $inhdr
17535
17536 : see if signbit exists
17537 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17538 $cat >try.c <<EOCP
17539 #$i_math I_MATH
17540 #$i_sunmath I_SUNMATH
17541 #ifdef I_MATH
17542 #  include <math.h>
17543 #endif
17544 #ifdef I_SUNMATH  /* Solaris special math library */
17545 #  include <sunmath.h>
17546 #endif
17547 #define NV $nvtype
17548 int main(int argc, char **argv)
17549 {
17550     NV x = 0.0;
17551     NV y = -0.0;
17552     if ((signbit(x) == 0) && (signbit(y) != 0))
17553         return 0;
17554     else
17555         return 1;
17556 }
17557 EOCP
17558 val="$undef"
17559 set try
17560 if eval $compile; then
17561     if $run ./try; then
17562         $echo "Yes." >&4
17563         val="$define"
17564     else
17565         $echo "Signbit seems to be available, but doesn't work as I expected."
17566         $echo "I won't use it." >&4
17567         val="$undef"
17568     fi
17569 else
17570     $echo "Nope." >&4
17571     dflt="$undef"
17572 fi
17573 set d_signbit
17574 eval $setvar
17575 $rm_try
17576
17577 : see if sigprocmask exists
17578 set sigprocmask d_sigprocmask
17579 eval $inlibc
17580
17581 : see if sigsetjmp exists
17582 echo " "
17583 case "$d_sigsetjmp" in
17584 '')
17585         $cat >try.c <<EOP
17586 #include <setjmp.h>
17587 #$i_stdlib I_STDLIB
17588 #ifdef I_STDLIB
17589 #include <stdlib.h>
17590 #endif
17591 sigjmp_buf env;
17592 int set = 1;
17593 int main()
17594 {
17595         if (sigsetjmp(env,1))
17596                 exit(set);
17597         set = 0;
17598         siglongjmp(env, 1);
17599         exit(1);
17600 }
17601 EOP
17602         set try
17603         if eval $compile; then
17604                 if $run ./try >/dev/null 2>&1; then
17605                         echo "POSIX sigsetjmp found." >&4
17606                         val="$define"
17607                 else
17608                         $cat >&4 <<EOM
17609 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17610 I'll ignore them.
17611 EOM
17612                         val="$undef"
17613                 fi
17614         else
17615                 echo "sigsetjmp not found." >&4
17616                 val="$undef"
17617         fi
17618         ;;
17619 *) val="$d_sigsetjmp"
17620         case "$d_sigsetjmp" in
17621         $define) echo "POSIX sigsetjmp found." >&4;;
17622         $undef) echo "sigsetjmp not found." >&4;;
17623         esac
17624         ;;
17625 esac
17626 set d_sigsetjmp
17627 eval $setvar
17628 $rm_try
17629
17630 : see if snprintf exists
17631 set snprintf d_snprintf
17632 eval $inlibc
17633
17634 : see if vsnprintf exists
17635 set vsnprintf d_vsnprintf
17636 eval $inlibc
17637
17638 case "$d_snprintf-$d_vsnprintf" in
17639 "$define-$define")
17640     $cat <<EOM
17641 Checking whether your snprintf() and vsnprintf() work okay...
17642 EOM
17643     $cat >try.c <<'EOCP'
17644 /* v?snprintf testing logic courtesy of Russ Allbery.
17645  * According to C99:
17646  * - if the buffer is too short it still must be \0-terminated
17647  * - if the buffer is too short the potentially required length
17648  *   must be returned and not -1
17649  * - if the buffer is NULL the potentially required length
17650  *   must be returned and not -1 or core dump
17651  */
17652 #include <stdio.h>
17653 #include <stdarg.h>
17654
17655 char buf[2];
17656
17657 int test (char *format, ...)
17658 {
17659     va_list args;
17660     int count;
17661
17662     va_start (args, format);
17663     count = vsnprintf (buf, sizeof buf, format, args);
17664     va_end (args);
17665     return count;
17666 }
17667
17668 int main ()
17669 {
17670     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17671              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17672 }
17673 EOCP
17674     set try
17675     if eval $compile; then
17676         `$run ./try`
17677         case "$?" in
17678         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17679         *) cat <<EOM >&4
17680 Your snprintf() and snprintf() don't seem to be working okay.
17681 EOM
17682            d_snprintf="$undef"
17683            d_vsnprintf="$undef"
17684            ;;
17685         esac
17686     else
17687         echo "(I can't seem to compile the test program--assuming they don't)"
17688         d_snprintf="$undef"
17689         d_vsnprintf="$undef"
17690     fi
17691     $rm_try
17692     ;;
17693 esac
17694
17695 : see if sockatmark exists
17696 set sockatmark d_sockatmark
17697 eval $inlibc
17698
17699 : see if prototype for sockatmark is available
17700 echo " "
17701 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17702 eval $hasproto
17703
17704 : see if socks5_init exists
17705 set socks5_init d_socks5_init
17706 eval $inlibc
17707
17708 : see if sprintf returns the length of the string in the buffer as per ANSI
17709 $echo "Checking whether sprintf returns the length of the string..." >&4
17710 $cat <<EOP >try.c
17711 #include <stdio.h>
17712 #$i_stdlib I_STDLIB
17713 #ifdef I_STDLIB
17714 #include <stdlib.h>
17715 #endif
17716 #$i_string I_STRING
17717 #ifdef I_STRING
17718 #  include <string.h>
17719 #else
17720 #  include <strings.h>
17721 #endif
17722 #$i_math I_MATH
17723 #ifdef I_MATH
17724 #include <math.h>
17725 #endif
17726
17727 char buffer[256];
17728
17729 int check (size_t expect, int test) {
17730   size_t got = strlen(buffer);
17731   if (expect == got)
17732     return 0;
17733
17734   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17735        test, buffer);
17736   exit (test);
17737 }
17738
17739 int main(int argc, char **argv) {
17740   int test = 0;
17741
17742   check(sprintf(buffer, ""), ++test);
17743   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17744   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17745
17746   return 0;
17747 }
17748 EOP
17749 set try
17750
17751 if eval $compile; then
17752     xxx="`$run ./try`"
17753     case "$?" in
17754         0) cat >&4 <<EOM
17755 sprintf returns the length of the string (as ANSI says it should)
17756 EOM
17757         d_sprintf_returns_strlen="$define"
17758         ;;
17759         *) cat >&4 <<EOM
17760 sprintf does not return the length of the string (how old is this system?)
17761 EOM
17762         d_sprintf_returns_strlen="$undef"
17763         ;;
17764     esac
17765 else
17766     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17767     d_sprintf_returns_strlen="$undef"
17768 fi
17769 $rm_try
17770
17771 : see if srand48_r exists
17772 set srand48_r d_srand48_r
17773 eval $inlibc
17774 case "$d_srand48_r" in
17775 "$define")
17776         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17777         case "$d_srand48_r_proto:$usethreads" in
17778         ":define")      d_srand48_r_proto=define
17779                 set d_srand48_r_proto srand48_r $hdrs
17780                 eval $hasproto ;;
17781         *)      ;;
17782         esac
17783         case "$d_srand48_r_proto" in
17784         define)
17785         case "$srand48_r_proto" in
17786         ''|0) try='int srand48_r(long, struct drand48_data*);'
17787         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17788         esac
17789         case "$srand48_r_proto" in
17790         ''|0)   d_srand48_r=undef
17791                 srand48_r_proto=0
17792                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17793         * )     case "$srand48_r_proto" in
17794                 REENTRANT_PROTO*) ;;
17795                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17796                 esac
17797                 echo "Prototype: $try" ;;
17798         esac
17799         ;;
17800         *)      case "$usethreads" in
17801                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17802                 esac
17803                 d_srand48_r=undef
17804                 srand48_r_proto=0
17805                 ;;
17806         esac
17807         ;;
17808 *)      srand48_r_proto=0
17809         ;;
17810 esac
17811
17812 : see if srandom_r exists
17813 set srandom_r d_srandom_r
17814 eval $inlibc
17815 case "$d_srandom_r" in
17816 "$define")
17817         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17818         case "$d_srandom_r_proto:$usethreads" in
17819         ":define")      d_srandom_r_proto=define
17820                 set d_srandom_r_proto srandom_r $hdrs
17821                 eval $hasproto ;;
17822         *)      ;;
17823         esac
17824         case "$d_srandom_r_proto" in
17825         define)
17826         case "$srandom_r_proto" in
17827         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17828         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17829         esac
17830         case "$srandom_r_proto" in
17831         ''|0)   d_srandom_r=undef
17832                 srandom_r_proto=0
17833                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17834         * )     case "$srandom_r_proto" in
17835                 REENTRANT_PROTO*) ;;
17836                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17837                 esac
17838                 echo "Prototype: $try" ;;
17839         esac
17840         ;;
17841         *)      case "$usethreads" in
17842                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17843                 esac
17844                 d_srandom_r=undef
17845                 srandom_r_proto=0
17846                 ;;
17847         esac
17848         ;;
17849 *)      srandom_r_proto=0
17850         ;;
17851 esac
17852
17853 : see if prototype for setresgid is available
17854 echo " "
17855 set d_sresgproto setresgid $i_unistd unistd.h
17856 eval $hasproto
17857
17858 : see if prototype for setresuid is available
17859 echo " "
17860 set d_sresuproto setresuid $i_unistd unistd.h
17861 eval $hasproto
17862
17863 : see if sys/stat.h is available
17864 set sys/stat.h i_sysstat
17865 eval $inhdr
17866
17867 : see if stat knows about block sizes
17868 echo " "
17869 echo "Checking to see if your struct stat has st_blocks field..." >&4
17870 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17871 eval $hasfield
17872
17873 : see if this is a sys/vfs.h system
17874 set sys/vfs.h i_sysvfs
17875 eval $inhdr
17876
17877 : see if this is a sys/statfs.h system
17878 set sys/statfs.h i_sysstatfs
17879 eval $inhdr
17880
17881 : Check for statfs_s
17882 echo " "
17883 echo "Checking to see if your system supports struct statfs..." >&4
17884 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
17885 eval $hasstruct
17886 case "$d_statfs_s" in
17887 "$define")      echo "Yes, it does."   ;;
17888 *)              echo "No, it doesn't." ;;
17889 esac
17890
17891
17892 : see if struct statfs knows about f_flags
17893 case "$d_statfs_s" in
17894 define)
17895         echo " "
17896         echo "Checking to see if your struct statfs has f_flags field..." >&4
17897         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
17898         eval $hasfield
17899         ;;
17900 *)      val="$undef"
17901         set d_statfs_f_flags
17902         eval $setvar
17903         ;;
17904 esac
17905 case "$d_statfs_f_flags" in
17906 "$define")      echo "Yes, it does."   ;;
17907 *)              echo "No, it doesn't." ;;
17908 esac
17909
17910 : see what flavor, if any, of static inline is supported
17911 echo " "
17912 echo "Checking to see if your system supports static inline..."
17913 $cat > try.c <<'EOCP'
17914 #include <stdlib.h>
17915 extern int f_via_a(int x);
17916 extern int f_via_b(int x);
17917 int main(int argc, char **argv)
17918 {
17919     int y;
17920
17921     y = f_via_a(0);
17922 #ifdef USE_B
17923     y = f_via_b(0);
17924 #endif
17925     if (y == 42) {
17926         return EXIT_SUCCESS;
17927     }
17928     else {
17929         return EXIT_FAILURE;
17930     }
17931 }
17932 EOCP
17933 $cat > a.c <<'EOCP'
17934 static INLINE int f(int x) {
17935     int y;
17936     y = x + 42;
17937     return y;
17938 }
17939
17940 int f_via_a(int x)
17941 {
17942     return f(x);
17943 }
17944 EOCP
17945 $cat > b.c <<'EOCP'
17946 extern int f(int x);
17947
17948 int f_via_b(int x)
17949 {
17950     return f(x);
17951 }
17952 EOCP
17953
17954 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17955 case "$perl_static_inline" in
17956 '')     # Check the various possibilities, and break out on success.
17957         # For gcc, prefer __inline__, which will still permit 
17958         # cflags.SH to add in -ansi.
17959         case "$gccversion" in
17960                 '') xxx="inline __inline__ __inline _inline";;
17961                 *)  xxx="__inline__ inline __inline _inline";;
17962         esac
17963         for inline in $xxx; do
17964                 set try -DINLINE=$inline a.c
17965                 if eval $compile && $run ./try; then
17966                         # Now make sure there is no external linkage of static
17967                         # functions
17968                         set try -DINLINE=$inline -DUSE_B a.c b.c
17969                         if eval $compile && $run ./try; then
17970                                 $echo "Your compiler supports static $inline, " >&4
17971                                 $echo "but it also creates an external definition," >&4
17972                                 $echo "so I won't use it." >&4
17973                                 val=$undef
17974                         else
17975                                 $echo "Your compiler supports static $inline." >&4
17976                                 val=$define
17977                                 perl_static_inline="static $inline";
17978                                 break;
17979                         fi
17980                 else
17981                         $echo "Your compiler does NOT support static $inline." >&4
17982                         val="$undef"
17983                 fi
17984         done
17985         ;;
17986 *inline*) # Some variant of inline exists.
17987         echo "Keeping your $hint value of $perl_static_inline."
17988         val=$define
17989         ;;
17990 static)  # No inline capabilities
17991         echo "Keeping your $hint value of $perl_static_inline."
17992         val=$undef
17993         ;;
17994 *)  # Unrecognized previous value -- blindly trust the supplied
17995         # value and hope it makes sense.  Use old value for
17996         # d_static_inline, if there is one.
17997         echo "Keeping your $hint value of $perl_static_inline."
17998         case "$d_static_inline" in
17999                 '') val=$define ;;
18000                 *)  val=$d_static_inline ;;
18001         esac
18002         ;;
18003 esac
18004 # Fallback to plain 'static' if nothing worked.
18005 case "$perl_static_inline" in
18006 '')
18007         perl_static_inline="static"
18008         val=$undef
18009         ;;
18010 esac
18011 set d_static_inline
18012 eval $setvar
18013 $rm -f a.[co] b.[co]
18014 $rm_try
18015
18016 : Check stream access
18017 $cat >&4 <<EOM
18018 Checking how to access stdio streams by file descriptor number...
18019 EOM
18020 case "$stdio_stream_array" in
18021 '')     $cat >try.c <<EOCP
18022 #include <stdio.h>
18023 int main() {
18024   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18025     printf("yes\n");
18026 }
18027 EOCP
18028         for s in _iob __iob __sF
18029         do
18030                 set try -DSTDIO_STREAM_ARRAY=$s
18031                 if eval $compile; then
18032                         case "`$run ./try`" in
18033                         yes)    stdio_stream_array=$s; break ;;
18034                         esac
18035                 fi
18036         done
18037         $rm_try
18038 esac
18039 case "$stdio_stream_array" in
18040 '')     $cat >&4 <<EOM
18041 I can't figure out how to access stdio streams by file descriptor number.
18042 EOM
18043         d_stdio_stream_array="$undef"
18044         ;;
18045 *)      $cat >&4 <<EOM
18046 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18047 EOM
18048         d_stdio_stream_array="$define"
18049         ;;
18050 esac
18051
18052 : see if strcoll exists
18053 set strcoll d_strcoll
18054 eval $inlibc
18055
18056 : check for structure copying
18057 echo " "
18058 echo "Checking to see if your C compiler can copy structs..." >&4
18059 $cat >try.c <<'EOCP'
18060 int main()
18061 {
18062         struct blurfl {
18063                 int dyick;
18064         } foo, bar;
18065
18066         foo = bar;
18067 }
18068 EOCP
18069 if $cc -c try.c >/dev/null 2>&1 ; then
18070         val="$define"
18071         echo "Yup, it can."
18072 else
18073         val="$undef"
18074         echo "Nope, it can't."
18075 fi
18076 set d_strctcpy
18077 eval $setvar
18078 $rm_try
18079
18080 : see if strerror and/or sys_errlist[] exist
18081 echo " "
18082 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18083     if set strerror val -f d_strerror; eval $csym; $val; then
18084                 echo 'strerror() found.' >&4
18085                 d_strerror="$define"
18086                 d_strerrm='strerror(e)'
18087                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18088                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18089                         d_syserrlst="$define"
18090                 else
18091                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18092                         d_syserrlst="$undef"
18093                 fi
18094     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18095                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18096                 echo 'strerror() found in string header.' >&4
18097                 d_strerror="$define"
18098                 d_strerrm='strerror(e)'
18099                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18100                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18101                                 d_syserrlst="$define"
18102                 else
18103                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18104                         d_syserrlst="$undef"
18105                 fi
18106     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18107                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18108                 d_strerror="$undef"
18109                 d_syserrlst="$define"
18110                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18111     else
18112                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18113                 d_strerror="$undef"
18114                 d_syserrlst="$undef"
18115                 d_strerrm='"unknown"'
18116     fi
18117 fi
18118
18119 : see if strerror_r exists
18120 set strerror_r d_strerror_r
18121 eval $inlibc
18122 case "$d_strerror_r" in
18123 "$define")
18124         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18125         case "$d_strerror_r_proto:$usethreads" in
18126         ":define")      d_strerror_r_proto=define
18127                 set d_strerror_r_proto strerror_r $hdrs
18128                 eval $hasproto ;;
18129         *)      ;;
18130         esac
18131         case "$d_strerror_r_proto" in
18132         define)
18133         case "$strerror_r_proto" in
18134         ''|0) try='int strerror_r(int, char*, size_t);'
18135         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18136         esac
18137         case "$strerror_r_proto" in
18138         ''|0) try='int strerror_r(int, char*, int);'
18139         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18140         esac
18141         case "$strerror_r_proto" in
18142         ''|0) try='char* strerror_r(int, char*, size_t);'
18143         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18144         esac
18145         case "$strerror_r_proto" in
18146         ''|0)   d_strerror_r=undef
18147                 strerror_r_proto=0
18148                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18149         * )     case "$strerror_r_proto" in
18150                 REENTRANT_PROTO*) ;;
18151                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18152                 esac
18153                 echo "Prototype: $try" ;;
18154         esac
18155         ;;
18156         *)      case "$usethreads" in
18157                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18158                 esac
18159                 d_strerror_r=undef
18160                 strerror_r_proto=0
18161                 ;;
18162         esac
18163         ;;
18164 *)      strerror_r_proto=0
18165         ;;
18166 esac
18167
18168 : see if strftime exists
18169 set strftime d_strftime
18170 eval $inlibc
18171
18172 : see if strlcat exists
18173 set strlcat d_strlcat
18174 eval $inlibc
18175
18176 : see if strlcpy exists
18177 set strlcpy d_strlcpy
18178 eval $inlibc
18179
18180 : see if strtod exists
18181 set strtod d_strtod
18182 eval $inlibc
18183
18184 : see if strtol exists
18185 set strtol d_strtol
18186 eval $inlibc
18187
18188 : see if strtold exists
18189 set strtold d_strtold
18190 eval $inlibc
18191
18192 : see if strtoll exists
18193 set strtoll d_strtoll
18194 eval $inlibc
18195
18196 case "$d_longlong-$d_strtoll" in
18197 "$define-$define")
18198         $cat <<EOM
18199 Checking whether your strtoll() works okay...
18200 EOM
18201         $cat >try.c <<'EOCP'
18202 #include <errno.h>
18203 #ifdef __hpux
18204 #define strtoll __strtoll
18205 #endif
18206 #ifdef __EMX__
18207 #define strtoll _strtoll
18208 #endif
18209 #include <stdio.h>
18210 extern long long int strtoll(char *s, char **, int);
18211 static int bad = 0;
18212 int check(char *s, long long ell, int een) {
18213         long long gll;
18214         errno = 0;
18215         gll = strtoll(s, 0, 10);
18216         if (!((gll == ell) && (errno == een)))
18217                 bad++;
18218 }
18219 int main() {
18220         check(" 1",                                      1LL, 0);
18221         check(" 0",                                      0LL, 0);
18222         check("-1",                                     -1LL, 0);
18223         check("-9223372036854775808", -9223372036854775808LL, 0);
18224         check("-9223372036854775808", -9223372036854775808LL, 0);
18225         check(" 9223372036854775807",  9223372036854775807LL, 0);
18226         check("-9223372036854775808", -9223372036854775808LL, 0);
18227         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18228         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18229         if (!bad)
18230                 printf("ok\n");
18231 }
18232 EOCP
18233         set try
18234         if eval $compile; then
18235                 yyy=`$run ./try`
18236                 case "$yyy" in
18237                 ok) echo "Your strtoll() seems to be working okay." ;;
18238                 *) cat <<EOM >&4
18239 Your strtoll() doesn't seem to be working okay.
18240 EOM
18241                    d_strtoll="$undef"
18242                    ;;
18243                 esac
18244         else
18245                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18246                 d_strtoll="$undef"
18247         fi
18248         ;;
18249 esac
18250
18251 : see if strtoq exists
18252 set strtoq d_strtoq
18253 eval $inlibc
18254
18255 : see if strtoul exists
18256 set strtoul d_strtoul
18257 eval $inlibc
18258
18259 case "$d_strtoul" in
18260 "$define")
18261         $cat <<EOM
18262 Checking whether your strtoul() works okay...
18263 EOM
18264         $cat >try.c <<'EOCP'
18265 #include <errno.h>
18266 #include <stdio.h>
18267 extern unsigned long int strtoul(char *s, char **, int);
18268 static int bad = 0;
18269 void check(char *s, unsigned long eul, int een) {
18270         unsigned long gul;
18271         errno = 0;
18272         gul = strtoul(s, 0, 10);
18273         if (!((gul == eul) && (errno == een)))
18274                 bad++;
18275 }
18276 int main() {
18277         check(" 1", 1L, 0);
18278         check(" 0", 0L, 0);
18279 EOCP
18280         case "$longsize" in
18281         8)
18282             $cat >>try.c <<'EOCP'
18283         check("18446744073709551615", 18446744073709551615UL, 0);
18284         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18285 #if 0 /* strtoul() for /^-/ strings is undefined. */
18286         check("-1", 18446744073709551615UL, 0);
18287         check("-18446744073709551614", 2, 0);
18288         check("-18446744073709551615", 1, 0);
18289         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18290         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18291 #endif
18292 EOCP
18293                 ;;
18294         4)
18295                     $cat >>try.c <<'EOCP'
18296         check("4294967295", 4294967295UL, 0);
18297         check("4294967296", 4294967295UL, ERANGE);
18298 #if 0 /* strtoul() for /^-/ strings is undefined. */
18299         check("-1", 4294967295UL, 0);
18300         check("-4294967294", 2, 0);
18301         check("-4294967295", 1, 0);
18302         check("-4294967296", 4294967295UL, ERANGE);
18303         check("-4294967297", 4294967295UL, ERANGE);
18304 #endif
18305 EOCP
18306                 ;;
18307         *)
18308 : Should we write these tests to be more portable by sprintf-ing
18309 : ~0 and then manipulating that char string as input for strtol?
18310                 ;;
18311         esac
18312         $cat >>try.c <<'EOCP'
18313         if (!bad)
18314                 printf("ok\n");
18315         return 0;
18316 }
18317 EOCP
18318         set try
18319         if eval $compile; then
18320                 case "`$run ./try`" in
18321                 ok) echo "Your strtoul() seems to be working okay." ;;
18322                 *) cat <<EOM >&4
18323 Your strtoul() doesn't seem to be working okay.
18324 EOM
18325                    d_strtoul="$undef"
18326                    ;;
18327                 esac
18328         else
18329                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18330                 d_strtoul="$undef"
18331         fi
18332         ;;
18333 esac
18334
18335 : see if strtoull exists
18336 set strtoull d_strtoull
18337 eval $inlibc
18338
18339 case "$d_longlong-$d_strtoull" in
18340 "$define-$define")
18341         $cat <<EOM
18342 Checking whether your strtoull() works okay...
18343 EOM
18344         $cat >try.c <<'EOCP'
18345 #include <errno.h>
18346 #ifdef __hpux
18347 #define strtoull __strtoull
18348 #endif
18349 #include <stdio.h>
18350 extern unsigned long long int strtoull(char *s, char **, int);
18351 static int bad = 0;
18352 int check(char *s, long long eull, int een) {
18353         long long gull;
18354         errno = 0;
18355         gull = strtoull(s, 0, 10);
18356         if (!((gull == eull) && (errno == een)))
18357                 bad++;
18358 }
18359 int main() {
18360         check(" 1",                                        1LL, 0);
18361         check(" 0",                                        0LL, 0);
18362         check("18446744073709551615",  18446744073709551615ULL, 0);
18363         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18364 #if 0 /* strtoull() for /^-/ strings is undefined. */
18365         check("-1",                    18446744073709551615ULL, 0);
18366         check("-18446744073709551614",                     2LL, 0);
18367         check("-18446744073709551615",                     1LL, 0);
18368         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18369         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18370 #endif
18371         if (!bad)
18372                 printf("ok\n");
18373 }
18374 EOCP
18375         set try
18376         if eval $compile; then
18377                 case "`$run ./try`" in
18378                 ok) echo "Your strtoull() seems to be working okay." ;;
18379                 *) cat <<EOM >&4
18380 Your strtoull() doesn't seem to be working okay.
18381 EOM
18382                    d_strtoull="$undef"
18383                    ;;
18384                 esac
18385         else
18386                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18387                 d_strtoull="$undef"
18388         fi
18389         ;;
18390 esac
18391
18392 : see if strtouq exists
18393 set strtouq d_strtouq
18394 eval $inlibc
18395
18396 case "$d_strtouq" in
18397 "$define")
18398         $cat <<EOM
18399 Checking whether your strtouq() works okay...
18400 EOM
18401         $cat >try.c <<'EOCP'
18402 #include <errno.h>
18403 #include <stdio.h>
18404 extern unsigned long long int strtouq(char *s, char **, int);
18405 static int bad = 0;
18406 void check(char *s, unsigned long long eull, int een) {
18407         unsigned long long gull;
18408         errno = 0;
18409         gull = strtouq(s, 0, 10);
18410         if (!((gull == eull) && (errno == een)))
18411                 bad++;
18412 }
18413 int main() {
18414         check(" 1",                                        1LL, 0);
18415         check(" 0",                                        0LL, 0);
18416         check("18446744073709551615",  18446744073709551615ULL, 0);
18417         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18418 #if 0 /* strtouq() for /^-/ strings is undefined. */
18419         check("-1",                    18446744073709551615ULL, 0);
18420         check("-18446744073709551614",                     2LL, 0);
18421         check("-18446744073709551615",                     1LL, 0);
18422         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18423         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18424 #endif
18425         if (!bad)
18426                 printf("ok\n");
18427         return 0;
18428 }
18429 EOCP
18430         set try
18431         if eval $compile; then
18432                 case "`$run ./try`" in
18433                 ok) echo "Your strtouq() seems to be working okay." ;;
18434                 *) cat <<EOM >&4
18435 Your strtouq() doesn't seem to be working okay.
18436 EOM
18437                    d_strtouq="$undef"
18438                    ;;
18439                 esac
18440         else
18441                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18442                 d_strtouq="$undef"
18443         fi
18444         ;;
18445 esac
18446
18447 : see if strxfrm exists
18448 set strxfrm d_strxfrm
18449 eval $inlibc
18450
18451 : see if symlink exists
18452 set symlink d_symlink
18453 eval $inlibc
18454
18455 : see if syscall exists
18456 set syscall d_syscall
18457 eval $inlibc
18458
18459 : see if prototype for syscall is available
18460 echo " "
18461 set d_syscallproto syscall $i_unistd unistd.h
18462 eval $hasproto
18463
18464 : see if sysconf exists
18465 set sysconf d_sysconf
18466 eval $inlibc
18467
18468 : see if system exists
18469 set system d_system
18470 eval $inlibc
18471
18472 : see if tcgetpgrp exists
18473 set tcgetpgrp d_tcgetpgrp
18474 eval $inlibc
18475
18476 : see if tcsetpgrp exists
18477 set tcsetpgrp d_tcsetpgrp
18478 eval $inlibc
18479
18480 : see if prototype for telldir is available
18481 echo " "
18482 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18483 eval $hasproto
18484
18485 : see if time exists
18486 echo " "
18487 if test "X$d_time" = X -o X"$timetype" = X; then
18488     if set time val -f d_time; eval $csym; $val; then
18489                 echo 'time() found.' >&4
18490                 val="$define"
18491                 rp="What is the type returned by time() on this system?"
18492                 set time_t timetype long stdio.h sys/types.h
18493                 eval $typedef_ask
18494     else
18495                 echo 'time() not found, hope that will do.' >&4
18496                 val="$undef"
18497                 timetype='int';
18498     fi
18499     set d_time
18500     eval $setvar
18501 fi
18502
18503 : see if timegm exists
18504 set timegm d_timegm
18505 eval $inlibc
18506
18507 : see if this is a sys/times.h system
18508 set sys/times.h i_systimes
18509 eval $inhdr
18510
18511 : see if times exists
18512 echo " "
18513 if set times val -f d_times; eval $csym; $val; then
18514         echo 'times() found.' >&4
18515         d_times="$define"
18516         inc=''
18517         case "$i_systimes" in
18518         "$define") inc='sys/times.h';;
18519         esac
18520         rp="What is the type returned by times() on this system?"
18521         set clock_t clocktype long stdio.h sys/types.h $inc
18522         eval $typedef_ask
18523 else
18524         echo 'times() NOT found, hope that will do.' >&4
18525         d_times="$undef"
18526         clocktype='int'
18527 fi
18528
18529 : see if tmpnam_r exists
18530 set tmpnam_r d_tmpnam_r
18531 eval $inlibc
18532 case "$d_tmpnam_r" in
18533 "$define")
18534         hdrs="$i_systypes sys/types.h define stdio.h "
18535         case "$d_tmpnam_r_proto:$usethreads" in
18536         ":define")      d_tmpnam_r_proto=define
18537                 set d_tmpnam_r_proto tmpnam_r $hdrs
18538                 eval $hasproto ;;
18539         *)      ;;
18540         esac
18541         case "$d_tmpnam_r_proto" in
18542         define)
18543         case "$tmpnam_r_proto" in
18544         ''|0) try='char* tmpnam_r(char*);'
18545         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18546         esac
18547         case "$tmpnam_r_proto" in
18548         ''|0)   d_tmpnam_r=undef
18549                 tmpnam_r_proto=0
18550                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18551         * )     case "$tmpnam_r_proto" in
18552                 REENTRANT_PROTO*) ;;
18553                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18554                 esac
18555                 echo "Prototype: $try" ;;
18556         esac
18557         ;;
18558         *)      case "$usethreads" in
18559                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18560                 esac
18561                 d_tmpnam_r=undef
18562                 tmpnam_r_proto=0
18563                 ;;
18564         esac
18565         ;;
18566 *)      tmpnam_r_proto=0
18567         ;;
18568 esac
18569
18570 : see if truncate exists
18571 set truncate d_truncate
18572 eval $inlibc
18573
18574 : see if ttyname_r exists
18575 set ttyname_r d_ttyname_r
18576 eval $inlibc
18577 case "$d_ttyname_r" in
18578 "$define")
18579         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18580         case "$d_ttyname_r_proto:$usethreads" in
18581         ":define")      d_ttyname_r_proto=define
18582                 set d_ttyname_r_proto ttyname_r $hdrs
18583                 eval $hasproto ;;
18584         *)      ;;
18585         esac
18586         case "$d_ttyname_r_proto" in
18587         define)
18588         case "$ttyname_r_proto" in
18589         ''|0) try='int ttyname_r(int, char*, size_t);'
18590         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18591         esac
18592         case "$ttyname_r_proto" in
18593         ''|0) try='int ttyname_r(int, char*, int);'
18594         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18595         esac
18596         case "$ttyname_r_proto" in
18597         ''|0) try='char* ttyname_r(int, char*, int);'
18598         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18599         esac
18600         case "$ttyname_r_proto" in
18601         ''|0)   d_ttyname_r=undef
18602                 ttyname_r_proto=0
18603                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18604         * )     case "$ttyname_r_proto" in
18605                 REENTRANT_PROTO*) ;;
18606                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18607                 esac
18608                 echo "Prototype: $try" ;;
18609         esac
18610         ;;
18611         *)      case "$usethreads" in
18612                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18613                 esac
18614                 d_ttyname_r=undef
18615                 ttyname_r_proto=0
18616                 ;;
18617         esac
18618         ;;
18619 *)      ttyname_r_proto=0
18620         ;;
18621 esac
18622
18623 : see if tzname[] exists
18624 echo " "
18625 if set tzname val -a d_tzname; eval $csym; $val; then
18626         val="$define"
18627         echo 'tzname[] found.' >&4
18628 else
18629         val="$undef"
18630         echo 'tzname[] NOT found.' >&4
18631 fi
18632 set d_tzname
18633 eval $setvar
18634
18635 : Check if is a multiplatform env
18636 case "$osname" in
18637 next|rhapsody|darwin) multiarch="$define" ;;
18638 esac
18639 case "$multiarch" in
18640 ''|[nN]*) multiarch="$undef" ;;
18641 esac
18642
18643 : check for ordering of bytes in a UV
18644 echo " "
18645 case "$usecrosscompile$multiarch" in
18646 *$define*)
18647         $cat <<EOM
18648 You seem to be either cross-compiling or doing a multiarchitecture build,
18649 skipping the byteorder check.
18650
18651 EOM
18652         byteorder='ffff'
18653         ;;
18654 *)
18655         case "$byteorder" in
18656         '')
18657                 $cat <<'EOM'
18658 In the following, larger digits indicate more significance.  A big-endian
18659 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18660 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18661 machines may have weird orders like 3412.  A Cray will report 87654321,
18662 an Alpha will report 12345678. If the test program works the default is
18663 probably right.
18664 I'm now running the test program...
18665 EOM
18666                 $cat >try.c <<EOCP
18667 #include <stdio.h>
18668 #$i_stdlib I_STDLIB
18669 #ifdef I_STDLIB
18670 #include <stdlib.h>
18671 #endif
18672 #include <sys/types.h>
18673 typedef $uvtype UV;
18674 int main()
18675 {
18676         int i;
18677         union {
18678                 UV l;
18679                 char c[$uvsize];
18680         } u;
18681
18682         if ($uvsize > 4)
18683                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18684         else
18685                 u.l = (UV)0x04030201;
18686         for (i = 0; i < $uvsize; i++)
18687                 printf("%c", u.c[i]+'0');
18688         printf("\n");
18689         exit(0);
18690 }
18691 EOCP
18692                 xxx_prompt=y
18693                 set try
18694                 if eval $compile && $run ./try > /dev/null; then
18695                         dflt=`$run ./try`
18696                         case "$dflt" in
18697                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18698                                 echo "(The test program ran ok.)"
18699                                 echo "byteorder=$dflt"
18700                                 xxx_prompt=n
18701                         ;;
18702                         ????|????????) echo "(The test program ran ok.)" ;;
18703                         *) echo "(The test program didn't run right for some reason.)" ;;
18704                         esac
18705                 else
18706                         dflt='4321'
18707                         cat <<'EOM'
18708 (I can't seem to compile the test program.  Guessing big-endian...)
18709 EOM
18710                 fi
18711                 case "$xxx_prompt" in
18712                 y)
18713                         rp="What is the order of bytes in $uvtype?"
18714                         . ./myread
18715                         byteorder="$ans"
18716                         ;;
18717                 *)      byteorder=$dflt
18718                         ;;
18719                 esac
18720                 ;;
18721         esac
18722         $rm_try
18723         ;;
18724 esac
18725
18726 : Checking 32bit alignedness
18727 $cat <<EOM
18728
18729 Checking to see whether you can access character data unalignedly...
18730 EOM
18731 case "$d_u32align" in
18732 '')   $cat >try.c <<EOCP
18733 #include <stdio.h>
18734 #$i_stdlib I_STDLIB
18735 #ifdef I_STDLIB
18736 #include <stdlib.h>
18737 #endif
18738 #define U32 $u32type
18739 #define BYTEORDER 0x$byteorder
18740 #define U8 $u8type
18741 #include <signal.h>
18742 #ifdef SIGBUS
18743 $signal_t bletch(int s) { exit(4); }
18744 #endif
18745 int main() {
18746 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18747     volatile U8 buf[8];
18748     volatile U32 *up;
18749     int i;
18750
18751     if (sizeof(U32) != 4) {
18752         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18753         exit(1);
18754     }
18755
18756     fflush(stdout);
18757
18758 #ifdef SIGBUS
18759     signal(SIGBUS, bletch);
18760 #endif
18761
18762     buf[0] = 0;
18763     buf[1] = 0;
18764     buf[2] = 0;
18765     buf[3] = 1;
18766     buf[4] = 0;
18767     buf[5] = 0;
18768     buf[6] = 0;
18769     buf[7] = 1;
18770
18771     for (i = 0; i < 4; i++) {
18772         up = (U32*)(buf + i);
18773         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18774                (*up == 1 << (8*(3-i)))  /* little-endian */
18775               )
18776            )
18777         {
18778             printf("read failed (%x)\n", *up);
18779             exit(2);
18780         }
18781     }
18782
18783     /* write test */
18784     for (i = 0; i < 4; i++) {
18785         up = (U32*)(buf + i);
18786         *up = 0xBeef;
18787         if (*up != 0xBeef) {
18788             printf("write failed (%x)\n", *up);
18789             exit(3);
18790         }
18791     }
18792
18793     exit(0);
18794 #else
18795     printf("1\n");
18796     exit(1);
18797 #endif
18798     return 0;
18799 }
18800 EOCP
18801 set try
18802 if eval $compile_ok; then
18803         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18804         $run ./try 2>&1 >/dev/null
18805         case "$?" in
18806         0)      cat >&4 <<EOM
18807 You can access character data pretty unalignedly.
18808 EOM
18809                 d_u32align="$undef"
18810                 ;;
18811         *)      cat >&4 <<EOM
18812 It seems that you must access character data in an aligned manner.
18813 EOM
18814                 d_u32align="$define"
18815                 ;;
18816         esac
18817 else
18818         rp='Can you access character data at unaligned addresses?'
18819         dflt='n'
18820         . ./myread
18821         case "$ans" in
18822         [yY]*)  d_u32align="$undef"  ;;
18823         *)      d_u32align="$define" ;;
18824         esac
18825 fi
18826 $rm_try
18827 ;;
18828 esac
18829
18830 : see if ualarm exists
18831 set ualarm d_ualarm
18832 eval $inlibc
18833
18834 : see if umask exists
18835 set umask d_umask
18836 eval $inlibc
18837
18838 : see if unordered exists
18839 set unordered d_unordered
18840 eval $inlibc
18841
18842 : see if unsetenv exists
18843 set unsetenv d_unsetenv
18844 eval $inlibc
18845
18846 : see if usleep exists
18847 set usleep d_usleep
18848 eval $inlibc
18849
18850 : see if prototype for usleep is available
18851 echo " "
18852 set d_usleepproto usleep $i_unistd unistd.h
18853 eval $hasproto
18854
18855 : see if ustat exists
18856 set ustat d_ustat
18857 eval $inlibc
18858
18859 : see if closedir exists
18860 set closedir d_closedir
18861 eval $inlibc
18862
18863 case "$d_closedir" in
18864 "$define")
18865         echo " "
18866         echo "Checking whether closedir() returns a status..." >&4
18867         cat > try.c <<EOM
18868 #$i_dirent I_DIRENT             /**/
18869 #$i_sysdir I_SYS_DIR            /**/
18870 #$i_sysndir I_SYS_NDIR          /**/
18871 #$i_systypes I_SYS_TYPES        /**/
18872
18873 #if defined(I_SYS_TYPES)
18874 #include <sys/types.h>
18875 #endif
18876 #if defined(I_DIRENT)
18877 #include <dirent.h>
18878 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18879 #include <sys/dir.h>
18880 #endif
18881 #else
18882 #ifdef I_SYS_NDIR
18883 #include <sys/ndir.h>
18884 #else
18885 #ifdef I_SYS_DIR
18886 #ifdef hp9000s500
18887 #include <ndir.h>       /* may be wrong in the future */
18888 #else
18889 #include <sys/dir.h>
18890 #endif
18891 #endif
18892 #endif
18893 #endif
18894 int main() { return closedir(opendir(".")); }
18895 EOM
18896         set try
18897         if eval $compile_ok; then
18898                 if $run ./try > /dev/null 2>&1 ; then
18899                         echo "Yes, it does."
18900                         val="$undef"
18901                 else
18902                         echo "No, it doesn't."
18903                         val="$define"
18904                 fi
18905         else
18906                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18907                 val="$define"
18908         fi
18909         ;;
18910 *)
18911         val="$undef";
18912         ;;
18913 esac
18914 set d_void_closedir
18915 eval $setvar
18916 $rm_try
18917
18918 : see if there is a wait4
18919 set wait4 d_wait4
18920 eval $inlibc
18921
18922 : see if waitpid exists
18923 set waitpid d_waitpid
18924 eval $inlibc
18925
18926 : see if wcstombs exists
18927 set wcstombs d_wcstombs
18928 eval $inlibc
18929
18930 : see if wctomb exists
18931 set wctomb d_wctomb
18932 eval $inlibc
18933
18934 : see if writev exists
18935 set writev d_writev
18936 eval $inlibc
18937
18938 : preserve RCS keywords in files with variable substitution, grrr
18939 Date='$Date'
18940 Id='$Id'
18941 Log='$Log'
18942 RCSfile='$RCSfile'
18943 Revision='$Revision'
18944
18945 : check for alignment requirements
18946 echo " "
18947 case "$usecrosscompile$multiarch" in
18948 *$define*)
18949         $cat <<EOM
18950 You seem to be either cross-compiling or doing a multiarchitecture build,
18951 skipping the memory alignment check.
18952
18953 EOM
18954         case "$alignbytes" in
18955         '') alignbytes=8 ;;
18956         esac
18957         ;;
18958 *)
18959         case "$alignbytes" in
18960         '') echo "Checking alignment constraints..." >&4
18961                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18962                         $cat >try.c <<'EOCP'
18963 typedef long double NV;
18964 EOCP
18965                 else
18966                         $cat >try.c <<'EOCP'
18967 typedef double NV;
18968 EOCP
18969                 fi
18970                 $cat >>try.c <<'EOCP'
18971 #include <stdio.h>
18972 struct foobar {
18973         char foo;
18974         NV bar;
18975 } try_algn;
18976 int main()
18977 {
18978     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18979     return(0);
18980 }
18981 EOCP
18982                 set try
18983                 if eval $compile_ok; then
18984                         dflt=`$run ./try`
18985                 else
18986                         dflt='8'
18987                         echo "(I can't seem to compile the test program...)"
18988                 fi
18989                 ;;
18990         *) dflt="$alignbytes"
18991                 ;;
18992         esac
18993         rp="Doubles must be aligned on a how-many-byte boundary?"
18994         . ./myread
18995         alignbytes="$ans"
18996         $rm_try
18997         ;;
18998 esac
18999
19000
19001 : set the base revision
19002 baserev=5.0
19003
19004 : length of character in bytes. Is always 1, otherwise it isnt C
19005 : This used to be a test using sizeof
19006 charsize=1
19007
19008 : Check for the number of bits in a character
19009 case "$charbits" in
19010 '')     echo "Checking how long a character is (in bits)..." >&4
19011         $cat >try.c <<EOCP
19012 #include <stdio.h>
19013 int main ()
19014 {
19015     int n;
19016     unsigned char c;
19017     for (c = 1, n = 0; c; c <<= 1, n++) ;
19018     printf ("%d\n", n);
19019     return (0);
19020     }
19021 EOCP
19022         set try
19023         if eval $compile_ok; then
19024                 dflt=`$run ./try`
19025         else
19026                 dflt='8'
19027                 echo "(I can't seem to compile the test program.  Guessing...)"
19028         fi
19029         ;;
19030 *)
19031         dflt="$charbits"
19032         ;;
19033 esac
19034 rp="What is the length of a character (in bits)?"
19035 . ./myread
19036 charbits="$ans"
19037 $rm_try
19038 case "$charbits" in
19039 8)      ;;
19040 *)      cat >&4 << EOM
19041 Your system has an unsigned character size of $charbits bits, which
19042 is rather unusual (normally it is 8 bits).  Perl likely will not work
19043 correctly on your system, with subtle bugs in various places.
19044 EOM
19045         rp='Do you really want to continue?'
19046         dflt='n'
19047         . ./myread
19048         case "$ans" in
19049                 [yY])   echo >&4 "Okay, continuing."    ;;
19050                 *)      exit 1                          ;;
19051         esac
19052 esac
19053
19054 : how do we concatenate cpp tokens here?
19055 echo " "
19056 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19057 $cat >cpp_stuff.c <<'EOCP'
19058 #define RCAT(a,b)a/**/b
19059 #define ACAT(a,b)a ## b
19060 RCAT(Rei,ser)
19061 ACAT(Cir,cus)
19062 EOCP
19063 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19064 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19065         echo "Oh!  Smells like ANSI's been here." >&4
19066         echo "We can catify or stringify, separately or together!"
19067         cpp_stuff=42
19068 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19069         echo "Ah, yes!  The good old days!" >&4
19070         echo "However, in the good old days we don't know how to stringify and"
19071         echo "catify at the same time."
19072         cpp_stuff=1
19073 else
19074         $cat >&4 <<EOM
19075 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19076 You're going to have to edit the values of CAT[2-5] in config.h...
19077 EOM
19078         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19079 fi
19080 $rm -f cpp_stuff.*
19081
19082 : see if this is a db.h system
19083 set db.h i_db
19084 eval $inhdr
19085
19086 case "$i_db" in
19087 $define)
19088         : Check db version.
19089         echo " "
19090         echo "Checking Berkeley DB version ..." >&4
19091         $cat >try.c <<EOCP
19092 #$d_const HASCONST
19093 #ifndef HASCONST
19094 #define const
19095 #endif
19096 #include <sys/types.h>
19097 #include <stdio.h>
19098 #$i_stdlib I_STDLIB
19099 #ifdef I_STDLIB
19100 #include <stdlib.h>
19101 #endif
19102 #include <db.h>
19103 int main(int argc, char *argv[])
19104 {
19105 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19106     int Major, Minor, Patch ;
19107     unsigned long Version ;
19108     (void)db_version(&Major, &Minor, &Patch) ;
19109     if (argc == 2) {
19110         printf("%d %d %d %d %d %d\n",
19111                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19112                Major, Minor, Patch);
19113         exit(0);
19114     }
19115     printf("You have Berkeley DB Version 2 or greater.\n");
19116
19117     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19118                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19119     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19120                 Major, Minor, Patch) ;
19121
19122     /* check that db.h & libdb are compatible */
19123     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19124         printf("db.h and libdb are incompatible.\n") ;
19125         exit(3);
19126     }
19127
19128     printf("db.h and libdb are compatible.\n") ;
19129
19130     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19131                 + DB_VERSION_PATCH ;
19132
19133     /* needs to be >= 2.3.4 */
19134     if (Version < 2003004) {
19135     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19136         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19137         exit(2);
19138     }
19139
19140     exit(0);
19141 #else
19142 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19143     if (argc == 2) {
19144         printf("1 0 0\n");
19145         exit(0);
19146     }
19147     printf("You have Berkeley DB Version 1.\n");
19148     exit(0);    /* DB version < 2: the coast is clear. */
19149 #else
19150     exit(1);    /* <db.h> not Berkeley DB? */
19151 #endif
19152 #endif
19153 }
19154 EOCP
19155         set try
19156         if eval $compile_ok && $run ./try; then
19157                 echo 'Looks OK.' >&4
19158                 set `$run ./try 1`
19159                 db_version_major=$1
19160                 db_version_minor=$2
19161                 db_version_patch=$3
19162         else
19163                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19164                 i_db=$undef
19165                 case " $libs " in
19166                 *"-ldb "*)
19167                         : Remove db from list of libraries to use
19168                         echo "Removing unusable -ldb from library list" >&4
19169                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19170                         shift
19171                         libs="$*"
19172                         echo "libs = $libs" >&4
19173                         ;;
19174                 esac
19175         fi
19176         $rm_try
19177         ;;
19178 esac
19179
19180 case "$i_db" in
19181 define)
19182         : Check the return type needed for hash
19183         echo " "
19184         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19185         $cat >try.c <<EOCP
19186 #$d_const HASCONST
19187 #ifndef HASCONST
19188 #define const
19189 #endif
19190 #include <sys/types.h>
19191 #include <db.h>
19192
19193 #ifndef DB_VERSION_MAJOR
19194 u_int32_t hash_cb (ptr, size)
19195 const void *ptr;
19196 size_t size;
19197 {
19198 }
19199 HASHINFO info;
19200 int main()
19201 {
19202         info.hash = hash_cb;
19203 }
19204 #endif
19205 EOCP
19206         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19207                 if $contains warning try.out >>/dev/null 2>&1 ; then
19208                         db_hashtype='int'
19209                 else
19210                         db_hashtype='u_int32_t'
19211                 fi
19212         else
19213                 : XXX Maybe we should just give up here.
19214                 db_hashtype=u_int32_t
19215                 $cat try.out >&4
19216                 echo "Help:  I can't seem to compile the db test program." >&4
19217                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19218         fi
19219         $rm_try
19220         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19221         ;;
19222 *)      db_hashtype=u_int32_t
19223         ;;
19224 esac
19225 case "$i_db" in
19226 define)
19227         : Check the return type needed for prefix
19228         echo " "
19229         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19230         cat >try.c <<EOCP
19231 #$d_const HASCONST
19232 #ifndef HASCONST
19233 #define const
19234 #endif
19235 #include <sys/types.h>
19236 #include <db.h>
19237
19238 #ifndef DB_VERSION_MAJOR
19239 size_t prefix_cb (key1, key2)
19240 const DBT *key1;
19241 const DBT *key2;
19242 {
19243 }
19244 BTREEINFO info;
19245 int main()
19246 {
19247         info.prefix = prefix_cb;
19248 }
19249 #endif
19250 EOCP
19251         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19252                 if $contains warning try.out >>/dev/null 2>&1 ; then
19253                         db_prefixtype='int'
19254                 else
19255                         db_prefixtype='size_t'
19256                 fi
19257         else
19258                 db_prefixtype='size_t'
19259                 : XXX Maybe we should just give up here.
19260                 $cat try.out >&4
19261                 echo "Help:  I can't seem to compile the db test program." >&4
19262                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19263         fi
19264         $rm_try
19265         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19266         ;;
19267 *)      db_prefixtype='size_t'
19268         ;;
19269 esac
19270
19271 : How can we generate normalized random numbers ?
19272 echo " "
19273 echo "Looking for a random number function..." >&4
19274 case "$randfunc" in
19275 '')
19276         if set drand48 val -f; eval $csym; $val; then
19277                 dflt="drand48"
19278                 echo "Good, found drand48()." >&4
19279         elif set random val -f; eval $csym; $val; then
19280                 dflt="random"
19281                 echo "OK, found random()." >&4
19282         else
19283                 dflt="rand"
19284                 echo "Yick, looks like I have to use rand()." >&4
19285         fi
19286         echo " "
19287         ;;
19288 *)
19289         dflt="$randfunc"
19290         ;;
19291 esac
19292 cont=true
19293
19294 case "$ccflags" in
19295 *-Dmy_rand=*|*-Dmy_srand=*)
19296         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19297         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19298         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19299         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19300         ;;
19301 esac
19302
19303 while $test "$cont"; do
19304         rp="Use which function to generate random numbers?"
19305         . ./myread
19306         if $test "$ans" = "$dflt"; then
19307                 : null
19308         else
19309                 randbits=''
19310         fi
19311         randfunc="$ans"
19312         if set $ans val -f; eval $csym; $val; then
19313                 cont=''
19314         else
19315                 dflt=y
19316                 rp="I cannot find function $ans. Use that name anyway?"
19317                 . ./myread
19318                 dflt=rand
19319                 case "$ans" in
19320                         [yY]*) cont='';;
19321                 esac
19322         fi
19323         case "$cont" in
19324         '')
19325                 case "$randfunc" in
19326                 drand48)
19327                         drand01="drand48()"
19328                         seedfunc="srand48"
19329                         randbits=48
19330                         randseedtype=long
19331                         ;;
19332                 rand|random)
19333                         case "$randbits" in
19334                         '')
19335 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19336                                 $cat >try.c <<EOCP
19337 #$i_unistd I_UNISTD
19338 #$i_stdlib I_STDLIB
19339 #include <stdio.h>
19340 #ifdef I_UNISTD
19341 #  include <unistd.h>
19342 #endif
19343 #ifdef I_STDLIB
19344 #  include <stdlib.h>
19345 #endif
19346 int main()
19347 {
19348         register int i;
19349         register unsigned long tmp;
19350         register unsigned long max = 0L;
19351
19352         for (i = 1000; i; i--) {
19353                 tmp = (unsigned long) $randfunc();
19354                 if (tmp > max) max = tmp;
19355         }
19356         for (i = 0; max; i++)
19357                 max /= 2;
19358         printf("%d\n",i);
19359 }
19360 EOCP
19361                                 set try
19362                                 if eval $compile_ok; then
19363                                         dflt=`try`
19364                                 else
19365                                         dflt='?'
19366                                         echo "(I can't seem to compile the test program...)"
19367                                 fi
19368                                 ;;
19369                         *)
19370                                 dflt="$randbits"
19371                                 ;;
19372                         esac
19373                         rp="How many bits does your $randfunc() function produce?"
19374                         . ./myread
19375                         randbits="$ans"
19376                         $rm_try
19377                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19378                         seedfunc="s$randfunc"
19379                         randseedtype=unsigned
19380                         ;;
19381                 *)
19382                         dflt="31"
19383                         rp="How many bits does your $randfunc() function produce?"
19384                         . ./myread
19385                         randbits="$ans"
19386                         seedfunc="s$randfunc"
19387                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19388                         if set $seedfunc val -f; eval $csym; $val; then
19389                                 echo "(Using $seedfunc() to seed random generator)"
19390                         else
19391                                 echo "(Warning: no $seedfunc() to seed random generator)"
19392                                 seedfunc=rand
19393                         fi
19394                         randseedtype=unsigned
19395                         ;;
19396                 esac
19397                 ;;
19398         esac
19399 done
19400
19401 : Determine if this is an EBCDIC system
19402 echo " "
19403 echo "Determining whether or not we are on an EBCDIC system..." >&4
19404 $cat >try.c <<'EOM'
19405 int main()
19406 {
19407   if ('M'==0xd4) return 0;
19408   return 1;
19409 }
19410 EOM
19411
19412 val=$undef
19413 set try
19414 if eval $compile_ok; then
19415         if $run ./try; then
19416                 echo "You seem to speak EBCDIC." >&4
19417                 val="$define"
19418         else
19419                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19420         fi
19421 else
19422         echo "I'm unable to compile the test program." >&4
19423         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19424 fi
19425 $rm_try
19426 set ebcdic
19427 eval $setvar
19428
19429 : Check how to flush
19430 echo " "
19431 $cat >&4 <<EOM
19432 Checking how to flush all pending stdio output...
19433 EOM
19434 # I only know how to find the first 32 possibly open files on SunOS.
19435 # See also hints/sunos_4_1.sh and util.c  --AD
19436 case "$osname" in
19437 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19438 esac
19439 $cat >>try.c <<EOCP
19440 #include <stdio.h>
19441 #$i_stdlib I_STDLIB
19442 #ifdef I_STDLIB
19443 #include <stdlib.h>
19444 #endif
19445 #$i_unistd I_UNISTD
19446 #ifdef I_UNISTD
19447 # include <unistd.h>
19448 #endif
19449 #$d_sysconf HAS_SYSCONF
19450 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19451 #ifdef HAS_STDIO_STREAM_ARRAY
19452 # define STDIO_STREAM_ARRAY $stdio_stream_array
19453 #endif
19454 int main() {
19455   FILE* p;
19456   unlink("try.out");
19457   p = fopen("try.out", "w");
19458 #ifdef TRY_FPUTC
19459   fputc('x', p);
19460 #else
19461 # ifdef TRY_FPRINTF
19462   fprintf(p, "x");
19463 # endif
19464 #endif
19465 #ifdef TRY_FFLUSH_NULL
19466   fflush(NULL);
19467 #endif
19468 #ifdef TRY_FFLUSH_ALL
19469   {
19470     long open_max = -1;
19471 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19472     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19473 # else
19474 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19475     open_max = sysconf(_SC_OPEN_MAX);
19476 #  else
19477 #   ifdef FOPEN_MAX
19478     open_max = FOPEN_MAX;
19479 #   else
19480 #    ifdef OPEN_MAX
19481     open_max = OPEN_MAX;
19482 #    else
19483 #     ifdef _NFILE
19484     open_max = _NFILE;
19485 #     endif
19486 #    endif
19487 #   endif
19488 #  endif
19489 # endif
19490 # ifdef HAS_STDIO_STREAM_ARRAY
19491     if (open_max > 0) {
19492       long i;
19493       for (i = 0; i < open_max; i++)
19494             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19495                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19496                 STDIO_STREAM_ARRAY[i]._flag)
19497                 fflush(&STDIO_STREAM_ARRAY[i]);
19498     }
19499   }
19500 # endif
19501 #endif
19502   _exit(42);
19503 }
19504 EOCP
19505 : first we have to find out how _not_ to flush
19506 $to try.c
19507 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19508     output=''
19509     set try -DTRY_FPUTC
19510     if eval $compile; then
19511             $run ./try 2>/dev/null
19512             code="$?"
19513             $from try.out
19514             if $test ! -s try.out -a "X$code" = X42; then
19515                 output=-DTRY_FPUTC
19516             fi
19517     fi
19518     case "$output" in
19519     '')
19520             set try -DTRY_FPRINTF
19521             if eval $compile; then
19522                     $run ./try 2>/dev/null
19523                     code="$?"
19524                     $from try.out
19525                     if $test ! -s try.out -a "X$code" = X42; then
19526                         output=-DTRY_FPRINTF
19527                     fi
19528             fi
19529         ;;
19530     esac
19531 fi
19532 : check for fflush NULL behaviour
19533 case "$fflushNULL" in
19534 '')     set try -DTRY_FFLUSH_NULL $output
19535         if eval $compile; then
19536                 $run ./try 2>/dev/null
19537                 code="$?"
19538                 $from try.out
19539                 if $test -s try.out -a "X$code" = X42; then
19540                         fflushNULL="`$cat try.out`"
19541                 else
19542                         if $test "X$code" != X42; then
19543                                 $cat >&4 <<EOM
19544 (If this test failed, don't worry, we'll try another method shortly.)
19545 EOM
19546                         fi
19547                 fi
19548         fi
19549         $rm -f core try.core core.try.*
19550         case "$fflushNULL" in
19551         x)      $cat >&4 <<EOM
19552 Your fflush(NULL) works okay for output streams.
19553 Let's see if it clobbers input pipes...
19554 EOM
19555 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19556 # bug that improperly flushes the input end of pipes.  So we avoid the
19557 # autoflush on fork/system/exec support for now. :-(
19558 $cat >tryp.c <<EOCP
19559 #include <stdio.h>
19560 int
19561 main(int argc, char **argv)
19562 {
19563     char buf[1024];
19564     int i;
19565     char *bp = buf;
19566     while (1) {
19567         while ((i = getc(stdin)) != -1
19568                && (*bp++ = i) != '\n'
19569                && bp < &buf[1024])
19570         /* DO NOTHING */ ;
19571         *bp = '\0';
19572         fprintf(stdout, "%s", buf);
19573         fflush(NULL);
19574         if (i == -1)
19575             return 0;
19576         bp = buf;
19577     }
19578 }
19579 EOCP
19580                 fflushNULL="$define"
19581                 set tryp
19582                 if eval $compile; then
19583                     $rm -f tryp.out
19584                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19585                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19586                        $cat >&4 <<EOM
19587 fflush(NULL) seems to behave okay with input streams.
19588 EOM
19589                         fflushNULL="$define"
19590                     else
19591                         $cat >&4 <<EOM
19592 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19593 EOM
19594                         fflushNULL="$undef"
19595                     fi
19596                 fi
19597                 $rm -f core tryp.c tryp.core core.tryp.*
19598                 ;;
19599         '')     $cat >&4 <<EOM
19600 Your fflush(NULL) isn't working (contrary to ANSI C).
19601 EOM
19602                 fflushNULL="$undef"
19603                 ;;
19604         *)      $cat >&4 <<EOM
19605 Cannot figure out whether your fflush(NULL) works or not.
19606 I'm assuming it doesn't (contrary to ANSI C).
19607 EOM
19608                 fflushNULL="$undef"
19609                 ;;
19610         esac
19611         ;;
19612 $define|true|[yY]*)
19613         fflushNULL="$define"
19614         ;;
19615 *)
19616         fflushNULL="$undef"
19617         ;;
19618 esac
19619 : check explicit looping only if NULL did not work, and if the pipe
19620 : bug does not show up on an explicit flush too
19621 case "$fflushNULL" in
19622 "$undef")
19623         $cat >tryp.c <<EOCP
19624 #include <stdio.h>
19625 int
19626 main(int argc, char **argv)
19627 {
19628     char buf[1024];
19629     int i;
19630     char *bp = buf;
19631     while (1) {
19632         while ((i = getc(stdin)) != -1
19633                && (*bp++ = i) != '\n'
19634                && bp < &buf[1024])
19635         /* DO NOTHING */ ;
19636         *bp = '\0';
19637         fprintf(stdout, "%s", buf);
19638         fflush(stdin);
19639         if (i == -1)
19640             return 0;
19641         bp = buf;
19642     }
19643 }
19644 EOCP
19645         set tryp
19646         if eval $compile; then
19647             $rm -f tryp.out
19648             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19649             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19650                $cat >&4 <<EOM
19651 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19652 EOM
19653                 : now check for fflushall behaviour
19654                 case "$fflushall" in
19655                 '')     set try -DTRY_FFLUSH_ALL $output
19656                         if eval $compile; then
19657                                 $cat >&4 <<EOM
19658 (Now testing the other method--but note that this also may fail.)
19659 EOM
19660                                 $run ./try 2>/dev/null
19661                                 code=$?
19662                                 $from try.out
19663                                 if $test -s try.out -a "X$code" = X42; then
19664                                         fflushall="`$cat try.out`"
19665                                 fi
19666                         fi
19667                         $rm_try
19668                         case "$fflushall" in
19669                         x)      $cat >&4 <<EOM
19670 Whew. Flushing explicitly all the stdio streams works.
19671 EOM
19672                                 fflushall="$define"
19673                                 ;;
19674                         '')     $cat >&4 <<EOM
19675 Sigh. Flushing explicitly all the stdio streams doesn't work.
19676 EOM
19677                                 fflushall="$undef"
19678                                 ;;
19679                         *)      $cat >&4 <<EOM
19680 Cannot figure out whether flushing stdio streams explicitly works or not.
19681 I'm assuming it doesn't.
19682 EOM
19683                                 fflushall="$undef"
19684                                 ;;
19685                         esac
19686                         ;;
19687                 "$define"|true|[yY]*)
19688                         fflushall="$define"
19689                         ;;
19690                 *)
19691                         fflushall="$undef"
19692                         ;;
19693                 esac
19694             else
19695                 $cat >&4 <<EOM
19696 All is futile.  Even fflush(stdin) clobbers input pipes!
19697 EOM
19698                 fflushall="$undef"
19699             fi
19700         else
19701             fflushall="$undef"
19702         fi
19703         $rm -f core tryp.c tryp.core core.tryp.*
19704         ;;
19705 *)      fflushall="$undef"
19706         ;;
19707 esac
19708
19709 case "$fflushNULL$fflushall" in
19710 undefundef)
19711         $cat <<EOM
19712 OK, I give up.  I cannot figure out how to flush pending stdio output.
19713 We won't be flushing handles at all before fork/exec/popen.
19714 EOM
19715         ;;
19716 esac
19717 $rm_try tryp
19718
19719 : Store the full pathname to the ar program for use in the C program
19720 : Respect a hint or command line value for full_ar.
19721 case "$full_ar" in
19722 '') full_ar=$ar ;;
19723 esac
19724
19725 : Store the full pathname to the sed program for use in the C program
19726 full_sed=$sed
19727
19728 : see what type gids are declared as in the kernel
19729 echo " "
19730 echo "Looking for the type for group ids returned by getgid()."
19731 set gid_t gidtype xxx stdio.h sys/types.h
19732 eval $typedef
19733 case "$gidtype" in
19734 xxx)
19735         xxx=`./findhdr sys/user.h`
19736         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19737         case $1 in
19738         unsigned) dflt="$1 $2" ;;
19739         *) dflt="$1" ;;
19740         esac
19741         ;;
19742 *) dflt="$gidtype";;
19743 esac
19744 case "$gidtype" in
19745 gid_t) echo "gid_t found." ;;
19746 *)      rp="What is the type for group ids returned by getgid()?"
19747         . ./myread
19748         gidtype="$ans"
19749         ;;
19750 esac
19751
19752 : Check the size of GID
19753 echo " "
19754 case "$gidtype" in
19755 *_t) zzz="$gidtype"     ;;
19756 *)   zzz="gid"          ;;
19757 esac
19758 echo "Checking the size of $zzz..." >&4
19759 cat > try.c <<EOCP
19760 #include <sys/types.h>
19761 #include <stdio.h>
19762 #$i_stdlib I_STDLIB
19763 #ifdef I_STDLIB
19764 #include <stdlib.h>
19765 #endif
19766 int main() {
19767     printf("%d\n", (int)sizeof($gidtype));
19768     exit(0);
19769 }
19770 EOCP
19771 set try
19772 if eval $compile_ok; then
19773         yyy=`$run ./try`
19774         case "$yyy" in
19775         '')     gidsize=4
19776                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19777                 ;;
19778         *)      gidsize=$yyy
19779                 echo "Your $zzz is $gidsize bytes long."
19780                 ;;
19781         esac
19782 else
19783         gidsize=4
19784         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19785 fi
19786
19787
19788 : Check if GID is signed
19789 echo " "
19790 case "$gidtype" in
19791 *_t) zzz="$gidtype"     ;;
19792 *)   zzz="gid"          ;;
19793 esac
19794 echo "Checking the sign of $zzz..." >&4
19795 cat > try.c <<EOCP
19796 #include <sys/types.h>
19797 #include <stdio.h>
19798 int main() {
19799         $gidtype foo = -1;
19800         if (foo < 0)
19801                 printf("-1\n");
19802         else
19803                 printf("1\n");
19804 }
19805 EOCP
19806 set try
19807 if eval $compile; then
19808         yyy=`$run ./try`
19809         case "$yyy" in
19810         '')     gidsign=1
19811                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19812                 ;;
19813         *)      gidsign=$yyy
19814                 case "$gidsign" in
19815                  1) echo "Your $zzz is unsigned." ;;
19816                 -1) echo "Your $zzz is signed."   ;;
19817                 esac
19818                 ;;
19819         esac
19820 else
19821         gidsign=1
19822         echo "(I can't compile the test program--guessing unsigned.)" >&4
19823 fi
19824
19825
19826 : Check 64bit sizes
19827 echo " "
19828
19829 if $test X"$quadtype" != X; then
19830
19831 echo "Checking how to print 64-bit integers..." >&4
19832
19833 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19834         $cat >try.c <<'EOCP'
19835 #include <sys/types.h>
19836 #include <stdio.h>
19837 int main() {
19838   int q = 12345678901;
19839   printf("%ld\n", q);
19840 }
19841 EOCP
19842         set try
19843         if eval $compile; then
19844                 yyy=`$run ./try`
19845                 case "$yyy" in
19846                 12345678901)
19847                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19848                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19849                         echo "We will use %d."
19850                         ;;
19851                 esac
19852         fi
19853 fi
19854
19855 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19856         $cat >try.c <<'EOCP'
19857 #include <sys/types.h>
19858 #include <stdio.h>
19859 int main() {
19860   long q = 12345678901;
19861   printf("%ld\n", q);
19862 }
19863 EOCP
19864         set try
19865         if eval $compile; then
19866                 yyy=`$run ./try`
19867                 case "$yyy" in
19868                 12345678901)
19869                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19870                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19871                         echo "We will use %ld."
19872                         ;;
19873                 esac
19874         fi
19875 fi
19876
19877 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19878         $cat >try.c <<'EOCP'
19879 #include <sys/types.h>
19880 #include <inttypes.h>
19881 #include <stdio.h>
19882 int main() {
19883   int64_t q = 12345678901;
19884   printf("%" PRId64 "\n", q);
19885 }
19886 EOCP
19887         set try
19888         if eval $compile; then
19889                 yyy=`$run ./try`
19890                 case "$yyy" in
19891                 12345678901)
19892                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19893                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19894                         echo "We will use the C9X style."
19895                         ;;
19896                 esac
19897         fi
19898 fi
19899
19900 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19901         $cat >try.c <<EOCP
19902 #include <sys/types.h>
19903 #include <stdio.h>
19904 int main() {
19905   $quadtype q = 12345678901;
19906   printf("%Ld\n", q);
19907 }
19908 EOCP
19909         set try
19910         if eval $compile; then
19911                 yyy=`$run ./try`
19912                 case "$yyy" in
19913                 12345678901)
19914                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19915                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19916                         echo "We will use %Ld."
19917                         ;;
19918                 esac
19919         fi
19920 fi
19921
19922 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19923         $cat >try.c <<'EOCP'
19924 #include <sys/types.h>
19925 #include <stdio.h>
19926 int main() {
19927   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19928   printf("%lld\n", q);
19929 }
19930 EOCP
19931         set try
19932         if eval $compile; then
19933                 yyy=`$run ./try`
19934                 case "$yyy" in
19935                 12345678901)
19936                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19937                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19938                         echo "We will use the %lld style."
19939                         ;;
19940                 esac
19941         fi
19942 fi
19943
19944 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19945         $cat >try.c <<EOCP
19946 #include <sys/types.h>
19947 #include <stdio.h>
19948 int main() {
19949   $quadtype q = 12345678901;
19950   printf("%qd\n", q);
19951 }
19952 EOCP
19953         set try
19954         if eval $compile; then
19955                 yyy=`$run ./try`
19956                 case "$yyy" in
19957                 12345678901)
19958                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19959                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19960                         echo "We will use %qd."
19961                         ;;
19962                 esac
19963         fi
19964 fi
19965
19966 if $test X"$sPRId64" = X; then
19967         echo "Cannot figure out how to print 64-bit integers." >&4
19968 fi
19969 $rm_try
19970
19971 fi
19972
19973 case "$sPRId64" in
19974 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19975         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19976         ;;
19977 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19978         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19979         ;;
19980 esac
19981
19982 : Check format strings for internal types
19983 echo " "
19984 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19985
19986 if $test X"$ivsize" = X8; then
19987         ivdformat="$sPRId64"
19988         uvuformat="$sPRIu64"
19989         uvoformat="$sPRIo64"
19990         uvxformat="$sPRIx64"
19991         uvXUformat="$sPRIXU64"
19992 else
19993         if $test X"$ivsize" = X"$longsize"; then
19994                 ivdformat='"ld"'
19995                 uvuformat='"lu"'
19996                 uvoformat='"lo"'
19997                 uvxformat='"lx"'
19998                 uvXUformat='"lX"'
19999         else
20000                 if $test X"$ivsize" = X"$intsize"; then
20001                         ivdformat='"d"'
20002                         uvuformat='"u"'
20003                         uvoformat='"o"'
20004                         uvxformat='"x"'
20005                         uvXUformat='"X"'
20006                 else
20007                         : far out
20008                         if $test X"$ivsize" = X"$shortsize"; then
20009                                 ivdformat='"hd"'
20010                                 uvuformat='"hu"'
20011                                 uvoformat='"ho"'
20012                                 uvxformat='"hx"'
20013                                 uvXUformat='"hX"'
20014                         fi
20015                 fi
20016         fi
20017 fi
20018
20019 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20020         nveformat="$sPRIeldbl"
20021         nvfformat="$sPRIfldbl"
20022         nvgformat="$sPRIgldbl"
20023         nvEUformat="$sPRIEUldbl"
20024         nvFUformat="$sPRIFUldbl"
20025         nvGUformat="$sPRIGUldbl"
20026 else
20027         nveformat='"e"'
20028         nvfformat='"f"'
20029         nvgformat='"g"'
20030         nvEUformat='"E"'
20031         nvFUformat='"F"'
20032         nvGUformat='"G"'
20033 fi
20034
20035 case "$ivdformat" in
20036 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20037     exit 1
20038     ;;
20039 esac
20040
20041 : Check format string for GID
20042
20043 echo " "
20044 $echo "Checking the format string to be used for gids..." >&4
20045
20046 case "$gidsign" in
20047 -1)     if $test X"$gidsize" = X"$ivsize"; then
20048                 gidformat="$ivdformat"
20049         else
20050                 if $test X"$gidsize" = X"$longsize"; then
20051                         gidformat='"ld"'
20052                 else
20053                         if $test X"$gidsize" = X"$intsize"; then
20054                                 gidformat='"d"'
20055                         else
20056                                 if $test X"$gidsize" = X"$shortsize"; then
20057                                         gidformat='"hd"'
20058                                 fi
20059                         fi
20060                 fi
20061         fi
20062         ;;
20063 *)      if $test X"$gidsize" = X"$uvsize"; then
20064                 gidformat="$uvuformat"
20065         else
20066                 if $test X"$gidsize" = X"$longsize"; then
20067                         gidformat='"lu"'
20068                 else
20069                         if $test X"$gidsize" = X"$intsize"; then
20070                                 gidformat='"u"'
20071                         else
20072                                 if $test X"$gidsize" = X"$shortsize"; then
20073                                         gidformat='"hu"'
20074                                 fi
20075                         fi
20076                 fi
20077         fi
20078         ;;
20079 esac
20080
20081 : see if getgroups exists
20082 set getgroups d_getgrps
20083 eval $inlibc
20084
20085 : see if setgroups exists
20086 set setgroups d_setgrps
20087 eval $inlibc
20088
20089 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20090 echo " "
20091 case "$d_getgrps$d_setgrps" in
20092 *define*)
20093         case "$groupstype" in
20094         '') dflt="$gidtype" ;;
20095         *)  dflt="$groupstype" ;;
20096         esac
20097         $cat <<EOM
20098 What type of pointer is the second argument to getgroups() and setgroups()?
20099 Usually this is the same as group ids, $gidtype, but not always.
20100
20101 EOM
20102         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20103         . ./myread
20104         groupstype="$ans"
20105         ;;
20106 *)  groupstype="$gidtype";;
20107 esac
20108
20109 : MAD = Misc Attribute Definition
20110
20111 if $test $patchlevel -lt 9; then
20112 : MAD is not available in 5.8.x or earlier.
20113     ans=n;
20114 else
20115     case "$mad" in
20116     $define|true|[yY]*) dflt='y' ;;
20117     *)                  dflt='n' ;;
20118     esac
20119     cat <<EOM
20120
20121 Would you like to build with Misc Attribute Decoration? This is development
20122 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20123 overhead on the interpreter.
20124
20125 If this doesn't make any sense to you, just accept the default '$dflt'.
20126 EOM
20127     rp='Build Perl with MAD?'
20128     . ./myread
20129 fi
20130 case "$ans" in
20131 y|Y)    val="$define"
20132         madlyh='madly.h madly.act madly.tab'
20133         madlysrc='madly.c'
20134         madlyobj="madly$_o" ;;
20135 *)      val="$undef"
20136         madlyh=''
20137         madlysrc=''
20138         madlyobj='' ;;
20139 esac
20140 set mad
20141 eval $setvar
20142
20143 : check whether make sets MAKE
20144 echo " "
20145 echo "Checking if your $make program sets \$(MAKE)..." >&4
20146 case "$make_set_make" in
20147 '')
20148         $sed 's/^X //' > testmake.mak << 'EOF'
20149 Xall:
20150 X       @echo 'maketemp="$(MAKE)"'
20151 EOF
20152         case "`$make -f testmake.mak 2>/dev/null`" in
20153         *maketemp=*) make_set_make='#' ;;
20154         *)      make_set_make="MAKE=$make" ;;
20155         esac
20156         $rm -f testmake.mak
20157         ;;
20158 esac
20159 case "$make_set_make" in
20160 '#') echo "Yup, it does.";;
20161 *) echo "Nope, it doesn't.";;
20162 esac
20163
20164 : see what type is used for mode_t
20165 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20166 set mode_t modetype int stdio.h sys/types.h
20167 eval $typedef_ask
20168
20169 : see if we need va_copy
20170 echo " "
20171 case "$i_stdarg" in
20172 "$define")
20173         $cat >try.c <<EOCP
20174 #include <stdarg.h>
20175 #include <stdio.h>
20176 #$i_stdlib I_STDLIB
20177 #ifdef I_STDLIB
20178 #include <stdlib.h>
20179 #endif
20180 #include <signal.h>
20181
20182 int
20183 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20184 {
20185   return vfprintf(f, fmt, *valp);
20186 }
20187
20188 int
20189 myvfprintf(FILE *f, const  char *fmt, va_list val)
20190 {
20191   return ivfprintf(f, fmt, &val);
20192 }
20193
20194 int
20195 myprintf(char *fmt, ...)
20196 {
20197   va_list val;
20198   va_start(val, fmt);
20199   return myvfprintf(stdout, fmt, val);
20200 }
20201
20202 int
20203 main(int ac, char **av)
20204 {
20205   signal(SIGSEGV, exit);
20206
20207   myprintf("%s%cs all right, then\n", "that", '\'');
20208   exit(0);
20209 }
20210 EOCP
20211         set try
20212         if eval $compile && $run ./try 2>&1 >/dev/null; then
20213                 case "`$run ./try`" in
20214                 "that's all right, then")
20215                         okay=yes
20216                         ;;
20217                 esac
20218         fi
20219         case "$okay" in
20220         yes)    echo "It seems that you don't need va_copy()." >&4
20221                 need_va_copy="$undef"
20222                 ;;
20223         *)      echo "It seems that va_copy() or similar will be needed." >&4
20224                 need_va_copy="$define"
20225                 ;;
20226         esac
20227         $rm_try
20228         ;;
20229 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20230         ;;
20231 esac
20232
20233 : see what type is used for size_t
20234 rp="What is the type used for the length parameter for string functions?"
20235 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20236 eval $typedef_ask
20237
20238 : check for type of arguments to gethostbyaddr. 
20239 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20240         case "$d_gethbyaddr" in
20241         $define)
20242                 $cat <<EOM
20243
20244 Checking to see what type of arguments are accepted by gethostbyaddr().
20245 EOM
20246                 hdrs="$define sys/types.h
20247                         $d_socket sys/socket.h 
20248                         $i_niin netinet/in.h 
20249                         $i_netdb netdb.h
20250                         $i_unistd unistd.h"
20251                 : The first arg can 'char *' or 'void *'
20252                 : The second arg is some of integral type
20253                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20254                         for yyy in size_t long int; do
20255                                 case "$netdb_host_type" in
20256                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20257                                         if ./protochk "$try" $hdrs; then
20258                                                 echo "Your system accepts $xxx for the first arg."
20259                                                 echo "...and $yyy for the second arg."
20260                                                 netdb_host_type="$xxx"
20261                                                 netdb_hlen_type="$yyy"
20262                                         fi
20263                                         ;;
20264                                 esac
20265                         done
20266                 done
20267                 : In case none of those worked, prompt the user.
20268                 case "$netdb_host_type" in
20269                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20270                         dflt='char *'
20271                         . ./myread
20272                         netdb_host_type=$ans
20273                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20274                         dflt="$sizetype"
20275                         . ./myread
20276                         netdb_hlen_type=$ans
20277                         ;;
20278                 esac
20279                 ;;
20280         *)      : no gethostbyaddr, so pick harmless defaults
20281                 netdb_host_type='char *'
20282                 netdb_hlen_type="$sizetype"
20283                 ;;
20284         esac
20285         # Remove the "const" if needed. -- but then we'll have a 
20286         # prototype clash!
20287         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20288 fi
20289
20290 : check for type of argument to gethostbyname. 
20291 if test "X$netdb_name_type" = X ; then
20292         case "$d_gethbyname" in
20293         $define)
20294                 $cat <<EOM
20295
20296 Checking to see what type of argument is accepted by gethostbyname().
20297 EOM
20298                 hdrs="$define sys/types.h
20299                         $d_socket sys/socket.h 
20300                         $i_niin netinet/in.h 
20301                         $i_netdb netdb.h
20302                         $i_unistd unistd.h"
20303                 for xxx in "const char *" "char *"; do
20304                         case "$netdb_name_type" in
20305                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20306                                 if ./protochk "$try" $hdrs; then
20307                                         echo "Your system accepts $xxx."
20308                                         netdb_name_type="$xxx"
20309                                 fi
20310                                 ;;
20311                         esac
20312                 done
20313                 : In case none of those worked, prompt the user.
20314                 case "$netdb_name_type" in
20315                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20316                         dflt='char *'
20317                         . ./myread
20318                         netdb_name_type=$ans
20319                         ;;
20320                 esac
20321                 ;;
20322         *)      : no gethostbyname, so pick harmless default
20323                 netdb_name_type='char *'
20324                 ;;
20325         esac
20326 fi
20327
20328 : check for type of 1st argument to getnetbyaddr. 
20329 if test "X$netdb_net_type" = X ; then
20330         case "$d_getnbyaddr" in
20331         $define)
20332                 $cat <<EOM
20333
20334 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20335 EOM
20336                 hdrs="$define sys/types.h
20337                         $d_socket sys/socket.h 
20338                         $i_niin netinet/in.h 
20339                         $i_netdb netdb.h
20340                         $i_unistd unistd.h"
20341                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20342                         case "$netdb_net_type" in
20343                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20344                                 if ./protochk "$try" $hdrs; then
20345                                         echo "Your system accepts $xxx."
20346                                         netdb_net_type="$xxx"
20347                                 fi
20348                                 ;;
20349                         esac
20350                 done
20351                 : In case none of those worked, prompt the user.
20352                 case "$netdb_net_type" in
20353                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20354                         dflt='long'
20355                         . ./myread
20356                         netdb_net_type=$ans
20357                         ;;
20358                 esac
20359                 ;;
20360         *)      : no getnetbyaddr, so pick harmless default
20361                 netdb_net_type='long'
20362                 ;;
20363         esac
20364 fi
20365 : locate the preferred pager for this system
20366 fn=f/
20367 case "$pager" in
20368 '')
20369         dflt=''
20370         case "$pg" in
20371         /*) dflt=$pg;;
20372         [a-zA-Z]:/*) dflt=$pg;;
20373         esac
20374         case "$more" in
20375         /*) dflt=$more;;
20376         [a-zA-Z]:/*) dflt=$more;;
20377         esac
20378         case "$less" in
20379         /*) dflt=$less;;
20380         [a-zA-Z]:/*) dflt=$less;;
20381         esac
20382         case "$dflt" in
20383         '') dflt=/usr/ucb/more;;
20384         esac
20385         ;;
20386 *)      dflt="$pager"
20387         fn="f/($pager)"
20388         ;;
20389 esac
20390 echo " "
20391 rp='What pager is used on your system?'
20392 . ./getfile
20393 pager="$ans"
20394
20395 : see what type pids are declared as in the kernel
20396 rp="What is the type of process ids on this system?"
20397 set pid_t pidtype int stdio.h sys/types.h
20398 eval $typedef_ask
20399
20400 : see if ar generates random libraries by itself
20401 echo " "
20402 echo "Checking how to generate random libraries on your machine..." >&4
20403 echo 'int bar1() { return bar2(); }' > bar1.c
20404 echo 'int bar2() { return 2; }' > bar2.c
20405 $cat > foo.c <<EOP
20406 #$i_stdlib I_STDLIB
20407 #ifdef I_STDLIB
20408 #include <stdlib.h>
20409 #endif
20410 int main() { printf("%d\n", bar1()); exit(0); }
20411 EOP
20412 $cc $ccflags -c bar1.c >/dev/null 2>&1
20413 $cc $ccflags -c bar2.c >/dev/null 2>&1
20414 $cc $ccflags -c foo.c >/dev/null 2>&1
20415 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20416 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20417         $run ./foobar >/dev/null 2>&1; then
20418         echo "$ar appears to generate random libraries itself."
20419         orderlib=false
20420         if [ "X$ranlib" = "X" ]; then
20421             ranlib=":"
20422         fi
20423 elif $ar s bar$_a >/dev/null 2>&1 &&
20424         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20425         $run ./foobar >/dev/null 2>&1; then
20426                 echo "a table of contents needs to be added with '$ar s'."
20427                 orderlib=false
20428                 ranlib="$ar s"
20429 elif $ar ts bar$_a >/dev/null 2>&1 &&
20430         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20431         $run ./foobar >/dev/null 2>&1; then
20432                 echo "a table of contents needs to be added with '$ar ts'."
20433                 orderlib=false
20434                 ranlib="$ar ts"
20435 else
20436         case "$ranlib" in
20437         :) ranlib='';;
20438         '')
20439                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20440                 $test -f $ranlib || ranlib=''
20441                 ;;
20442         esac
20443         if $test -n "$ranlib"; then
20444                 echo "your system has '$ranlib'; we'll use that."
20445                 orderlib=false
20446         else
20447                 echo "your system doesn't seem to support random libraries"
20448                 echo "so we'll use lorder and tsort to order the libraries."
20449                 orderlib=true
20450                 ranlib=":"
20451         fi
20452 fi
20453 $rm -f foo* bar*
20454
20455 : see if this is a values.h system
20456 set values.h i_values
20457 eval $inhdr
20458
20459 : Check the max offset that gmtime and localtime accept
20460 echo "Checking max offsets that gmtime () accepts"
20461
20462 case $i_values in
20463     define) yyy="#include <values.h>" ;;
20464     *)      yyy="" ;;
20465     esac
20466
20467 case "$sGMTIME_min/$sGMTIME_max" in
20468     0/0|/)
20469         $cat >try.c <<EOCP
20470 #include <sys/types.h>
20471 #include <stdio.h>
20472 #include <time.h>
20473 $yyy
20474
20475 int i;
20476 struct tm *tmp;
20477 time_t pt;
20478
20479 void gm_check (time_t t, int min_year, int max_year)
20480 {
20481     tmp = gmtime (&t);
20482     if ( tmp == NULL ||
20483         /* Check tm_year overflow */
20484          tmp->tm_year < min_year || tmp->tm_year > max_year)
20485         tmp = NULL;
20486     else
20487         pt = t;
20488     } /* gm_check */
20489
20490 int check_max ()
20491 {
20492     tmp = NULL;
20493     pt  = 0;
20494 #ifdef MAXLONG
20495     gm_check (MAXLONG, 69, 0x7fffffff);
20496 #endif
20497     if (tmp == NULL || tmp->tm_year < 0) {
20498         for (i = 63; i >= 0; i--) {
20499             time_t x = pt | ((time_t)1 << i);
20500             if (x < 0 || x < pt) continue;
20501             gm_check (x, 69, 0x7fffffff);
20502             }
20503         }
20504     printf ("sGMTIME_max=%ld\n", pt);
20505     return (0);
20506     } /* check_max */
20507
20508 int check_min ()
20509 {
20510     tmp = NULL;
20511     pt  = 0;
20512 #ifdef MINLONG
20513     gm_check (MINLONG, -1900, 70);
20514 #endif
20515     if (tmp == NULL) {
20516         for (i = 36; i >= 0; i--) {
20517             time_t x = pt - ((time_t)1 << i);
20518             if (x > 0) continue;
20519             gm_check (x, -1900, 70);
20520             }
20521         }
20522     printf ("sGMTIME_min=%ld\n", pt);
20523     return (0);
20524     } /* check_min */
20525
20526 int main (int argc, char *argv[])
20527 {
20528     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20529     check_max ();
20530     check_min ();
20531     return (0);
20532     } /* main */
20533 EOCP
20534         set try
20535         if eval $compile; then
20536             eval `$run ./try`
20537         else
20538             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20539             fi
20540         $rm_try
20541         ;;
20542     esac
20543
20544 echo "Checking max offsets that localtime () accepts"
20545
20546 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20547     0/0|/)
20548         $cat >try.c <<EOCP
20549 #include <sys/types.h>
20550 #include <stdio.h>
20551 #include <time.h>
20552 $yyy
20553
20554 int i;
20555 struct tm *tmp;
20556 time_t pt;
20557
20558 void local_check (time_t t, int min_year, int max_year)
20559 {
20560     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20561         tmp = NULL;
20562     else
20563         tmp = localtime (&t);
20564     if ( tmp == NULL ||
20565         /* Check tm_year overflow */
20566          tmp->tm_year < min_year || tmp->tm_year > max_year)
20567         tmp = NULL;
20568     else
20569         pt = t;
20570     } /* local_check */
20571
20572 int check_max ()
20573 {
20574     tmp = NULL;
20575     pt  = 0;
20576 #ifdef MAXLONG
20577     local_check (MAXLONG, 69, 0x7fffffff);
20578 #endif
20579     if (tmp == NULL || tmp->tm_year < 0) {
20580         for (i = 63; i >= 0; i--) {
20581             time_t x = pt | ((time_t)1 << i);
20582             if (x < 0 || x < pt) continue;
20583             local_check (x, 69, 0x7fffffff);
20584             }
20585         }
20586     printf ("sLOCALTIME_max=%ld\n", pt);
20587     return (0);
20588    } /* check_max */
20589
20590 int check_min ()
20591 {
20592     tmp = NULL;
20593     pt  = 0;
20594 #ifdef MINLONG
20595     local_check (MINLONG, -1900, 70);
20596 #endif
20597     if (tmp == NULL) {
20598         for (i = 36; i >= 0; i--) {
20599             time_t x = pt - ((time_t)1 << i);
20600             if (x > 0) continue;
20601             local_check (x, -1900, 70);
20602             }
20603         }
20604     printf ("sLOCALTIME_min=%ld\n", pt);
20605     return (0);
20606     } /* check_min */
20607
20608 int main (int argc, char *argv[])
20609 {
20610     check_max ();
20611     check_min ();
20612     return (0);
20613     } /* main */
20614 EOCP
20615         set try
20616         if eval $compile; then
20617             eval `$run ./try`
20618         else
20619             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20620             fi
20621         $rm_try
20622         ;;
20623     esac
20624
20625 : check for type of arguments to select.
20626 case "$selecttype" in
20627 '') case "$d_select" in
20628         $define)
20629                 echo " "
20630                 $cat <<EOM
20631 Checking to see what type of arguments are accepted by select().
20632 EOM
20633                 hdrs="$define sys/types.h
20634                         $i_systime sys/time.h
20635                         $i_sysselct sys/select.h
20636                         $d_socket sys/socket.h"
20637                 : The first arg can be int, unsigned, or size_t
20638                 : The last arg may or may not be 'const'
20639                 val=''
20640                 : void pointer has been seen but using that
20641                 : breaks the selectminbits test
20642                 for xxx in 'fd_set *' 'int *'; do
20643                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20644                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20645                                         case "$val" in
20646                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20647                                                 if ./protochk "$try" $hdrs; then
20648                                                         echo "Your system accepts $xxx."
20649                                                         val="$xxx"
20650                                                 fi
20651                                                 ;;
20652                                         esac
20653                                 done
20654                         done
20655                 done
20656                 case "$val" in
20657                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20658                         case "$d_fd_set" in
20659                                 $define) dflt="fd_set *" ;;
20660                                 *)              dflt="int *" ;;
20661                         esac
20662                         . ./myread
20663                         val=$ans
20664                         ;;
20665                 esac
20666                 selecttype="$val"
20667                 ;;
20668         *)      : no select, so pick a harmless default
20669                 selecttype='int *'
20670                 ;;
20671         esac
20672         ;;
20673 esac
20674
20675 : check for the select 'width'
20676 case "$selectminbits" in
20677 '') safebits=`expr $ptrsize \* 8`
20678     case "$d_select" in
20679         $define)
20680                 $cat <<EOM
20681
20682 Checking to see on how many bits at a time your select() operates...
20683 EOM
20684                 $cat >try.c <<EOCP
20685 #include <sys/types.h>
20686 #$i_time I_TIME
20687 #$i_systime I_SYS_TIME
20688 #$i_systimek I_SYS_TIME_KERNEL
20689 #ifdef I_TIME
20690 #   include <time.h>
20691 #endif
20692 #ifdef I_SYS_TIME
20693 #   ifdef I_SYS_TIME_KERNEL
20694 #       define KERNEL
20695 #   endif
20696 #   include <sys/time.h>
20697 #   ifdef I_SYS_TIME_KERNEL
20698 #       undef KERNEL
20699 #   endif
20700 #endif
20701 #$i_sysselct I_SYS_SELECT
20702 #ifdef I_SYS_SELECT
20703 #include <sys/select.h>
20704 #endif
20705 #$d_socket HAS_SOCKET
20706 #ifdef HAS_SOCKET
20707 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20708 #endif
20709 #include <stdio.h>
20710 #$i_stdlib I_STDLIB
20711 #ifdef I_STDLIB
20712 #include <stdlib.h>
20713 #endif
20714 $selecttype b;
20715 #define S sizeof(*(b))
20716 #define MINBITS 64
20717 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20718 #define NBITS  (NBYTES * 8)
20719 int main() {
20720     char *s = (char *)malloc(NBYTES);
20721     struct timeval t;
20722     int i;
20723     FILE* fp;
20724     int fd;
20725
20726     if (!s)
20727         exit(1);
20728     fclose(stdin);
20729     fp = fopen("try.c", "r");
20730     if (fp == 0)
20731       exit(2);
20732     fd = fileno(fp);
20733     if (fd < 0)
20734       exit(3);
20735     b = ($selecttype)s;
20736     for (i = 0; i < NBITS; i++)
20737         FD_SET(i, b);
20738     t.tv_sec  = 0;
20739     t.tv_usec = 0;
20740     select(fd + 1, b, 0, 0, &t);
20741     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20742     free(s);
20743     printf("%d\n", i + 1);
20744     return 0;
20745 }
20746 EOCP
20747                 set try
20748                 if eval $compile_ok; then
20749                         selectminbits=`$run ./try`
20750                         case "$selectminbits" in
20751                         '')     cat >&4 <<EOM
20752 Cannot figure out on how many bits at a time your select() operates.
20753 I'll play safe and guess it is $safebits bits.
20754 EOM
20755                                 selectminbits=$safebits
20756                                 bits="$safebits bits"
20757                                 ;;
20758                         1)      bits="1 bit" ;;
20759                         *)      bits="$selectminbits bits" ;;
20760                         esac
20761                         echo "Your select() operates on $bits at a time." >&4
20762                 else
20763                         rp='What is the minimum number of bits your select() operates on?'
20764                         case "$byteorder" in
20765                         12345678)       dflt=64 ;;
20766                         1234)           dflt=32 ;;
20767                         *)              dflt=1  ;;
20768                         esac
20769                         . ./myread
20770                         val=$ans
20771                         selectminbits="$val"
20772                 fi
20773                 $rm_try
20774                 ;;
20775         *)      : no select, so pick a harmless default
20776                 selectminbits=$safebits
20777                 ;;
20778         esac
20779         ;;
20780 esac
20781
20782 : Trace out the files included by signal.h, then look for SIGxxx names.
20783 if [ "X$fieldn" = X ]; then
20784         : Just make some guesses.  We check them later.
20785         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20786 else
20787         xxx=`echo '#include <signal.h>' |
20788         $cppstdin $cppminus $cppflags 2>/dev/null |
20789         $grep '^[       ]*#.*include' |
20790         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20791                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20792 fi
20793 xxxfiles=''
20794 for xx in $xxx /dev/null ; do
20795         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20796 done
20797 case "$xxxfiles" in
20798 '')     xxxfiles=`./findhdr signal.h` ;;
20799 esac
20800 xxx=`awk '
20801 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20802         print substr($2, 4, 20)
20803 }
20804 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20805         print substr($3, 4, 20)
20806 }' $xxxfiles`
20807 : Append some common names just in case the awk scan failed.
20808 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20809 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20810 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20811 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20812 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20813
20814 : generate a few handy files for later
20815 $cat > signal.c <<EOCP
20816 #include <sys/types.h>
20817 #include <signal.h>
20818 #$i_stdlib I_STDLIB
20819 #ifdef I_STDLIB
20820 #include <stdlib.h>
20821 #endif
20822 #include <stdio.h>
20823 int main() {
20824
20825 /* Strange style to avoid deeply-nested #if/#else/#endif */
20826 #ifndef NSIG
20827 #  ifdef _NSIG
20828 #    define NSIG (_NSIG)
20829 #  endif
20830 #endif
20831
20832 #ifndef NSIG
20833 #  ifdef SIGMAX
20834 #    define NSIG (SIGMAX+1)
20835 #  endif
20836 #endif
20837
20838 #ifndef NSIG
20839 #  ifdef SIG_MAX
20840 #    define NSIG (SIG_MAX+1)
20841 #  endif
20842 #endif
20843
20844 #ifndef NSIG
20845 #  ifdef _SIG_MAX
20846 #    define NSIG (_SIG_MAX+1)
20847 #  endif
20848 #endif
20849
20850 #ifndef NSIG
20851 #  ifdef MAXSIG
20852 #    define NSIG (MAXSIG+1)
20853 #  endif
20854 #endif
20855
20856 #ifndef NSIG
20857 #  ifdef MAX_SIG
20858 #    define NSIG (MAX_SIG+1)
20859 #  endif
20860 #endif
20861
20862 #ifndef NSIG
20863 #  ifdef SIGARRAYSIZE
20864 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20865 #  endif
20866 #endif
20867
20868 #ifndef NSIG
20869 #  ifdef _sys_nsig
20870 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20871 #  endif
20872 #endif
20873
20874 /* Default to some arbitrary number that's big enough to get most
20875    of the common signals.
20876 */
20877 #ifndef NSIG
20878 #    define NSIG 50
20879 #endif
20880
20881 printf("NSIG %d\n", NSIG);
20882
20883 #ifndef JUST_NSIG
20884
20885 EOCP
20886
20887 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20888 {
20889         printf "#ifdef SIG"; printf $1; printf "\n"
20890         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20891         printf $1; printf ");\n"
20892         printf "#endif\n"
20893 }
20894 END {
20895         printf "#endif /* JUST_NSIG */\n";
20896         printf "exit(0);\n}\n";
20897 }
20898 ' >>signal.c
20899 $cat >signal.awk <<'EOP'
20900 BEGIN { ndups = 0 }
20901 $1 ~ /^NSIG$/ { nsig = $2 }
20902 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20903     if ($2 > maxsig) { maxsig = $2 }
20904     if (sig_name[$2]) {
20905         dup_name[ndups] = $1
20906         dup_num[ndups] = $2
20907         ndups++
20908     }
20909     else {
20910         sig_name[$2] = $1
20911         sig_num[$2] = $2
20912     }
20913 }
20914 END {
20915     if (nsig == 0) {
20916         nsig = maxsig + 1
20917     }
20918     printf("NSIG %d\n", nsig);
20919     for (n = 1; n < nsig; n++) {
20920         if (sig_name[n]) {
20921             printf("%s %d\n", sig_name[n], sig_num[n])
20922         }
20923         else {
20924             printf("NUM%d %d\n", n, n)
20925         }
20926     }
20927     for (n = 0; n < ndups; n++) {
20928         printf("%s %d\n", dup_name[n], dup_num[n])
20929     }
20930 }
20931 EOP
20932 $cat >signal_cmd <<EOS
20933 $startsh
20934 if $test -s signal.lst; then
20935     echo "Using your existing signal.lst file"
20936         exit 0
20937 fi
20938 xxx="$xxx"
20939 EOS
20940 $cat >>signal_cmd <<'EOS'
20941
20942 set signal
20943 if eval $compile_ok; then
20944         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20945                 $uniq | $awk -f signal.awk >signal.lst
20946 else
20947         echo "(I can't seem be able to compile the whole test program)" >&4
20948         echo "(I'll try it in little pieces.)" >&4
20949         set signal -DJUST_NSIG
20950         if eval $compile_ok; then
20951                 $run ./signal$_exe > signal.nsg
20952                 $cat signal.nsg
20953         else
20954                 echo "I can't seem to figure out how many signals you have." >&4
20955                 echo "Guessing 50." >&4
20956                 echo 'NSIG 50' > signal.nsg
20957         fi
20958         : Now look at all the signal names, one at a time.
20959         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20960                 $cat > signal.c <<EOCP
20961 #include <sys/types.h>
20962 #include <signal.h>
20963 #include <stdio.h>
20964 int main() {
20965 printf("$xx %d\n", SIG${xx});
20966 return 0;
20967 }
20968 EOCP
20969                 set signal
20970                 if eval $compile; then
20971                         echo "SIG${xx} found."
20972                         $run ./signal$_exe  >> signal.ls1
20973                 else
20974                         echo "SIG${xx} NOT found."
20975                 fi
20976         done
20977         if $test -s signal.ls1; then
20978                 $cat signal.nsg signal.ls1 |
20979                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20980         fi
20981
20982 fi
20983 if $test -s signal.lst; then
20984         :
20985 else
20986         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20987         echo 'kill -l' >signal
20988         set X `csh -f <signal`
20989         $rm -f signal
20990         shift
20991         case $# in
20992         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20993         esac
20994         echo $@ | $tr ' ' $trnl | \
20995             $awk '{ printf "%s %d\n", $1, ++s; }
20996                   END { printf "NSIG %d\n", ++s }' >signal.lst
20997 fi
20998 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20999 EOS
21000 chmod a+x signal_cmd
21001 $eunicefix signal_cmd
21002
21003 : generate list of signal names
21004 echo " "
21005 case "$sig_name_init" in
21006 '') doinit=yes ;;
21007 *)  case "$sig_num_init" in
21008     ''|*,*) doinit=yes ;;
21009     esac ;;
21010 esac
21011 case "$doinit" in
21012 yes)
21013         echo "Generating a list of signal names and numbers..." >&4
21014         . ./signal_cmd
21015         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21016         sig_name=`$awk 'BEGIN { printf "ZERO " }
21017                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21018         sig_num=`$awk  'BEGIN { printf "0 " }
21019                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21020         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21021                              !/^NSIG/   { printf "\"%s\", ", $1 }
21022                              END        { printf "0\n" }' signal.lst`
21023         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21024                              !/^NSIG/   { printf "%d, ", $2}
21025                              END        { printf "0\n"}' signal.lst`
21026         ;;
21027 esac
21028 echo "The following $sig_count signals are available:"
21029 echo " "
21030 echo $sig_name | $awk \
21031 'BEGIN { linelen = 0 }
21032 {
21033         for (i = 1; i <= NF; i++) {
21034                 name = "SIG" $i " "
21035                 linelen = linelen + length(name)
21036                 if (linelen > 70) {
21037                         printf "\n"
21038                         linelen = length(name)
21039                 }
21040                 printf "%s", name
21041         }
21042         printf "\n"
21043 }'
21044 sig_size=`echo $sig_name | awk '{print NF}'`
21045 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21046
21047 : Check size of size
21048 echo " "
21049 case "$sizetype" in
21050 *_t) zzz="$sizetype"    ;;
21051 *)   zzz="filesize"     ;;
21052 esac
21053 echo "Checking the size of $zzz..." >&4
21054 cat > try.c <<EOCP
21055 #include <sys/types.h>
21056 #include <stdio.h>
21057 #$i_stdlib I_STDLIB
21058 #ifdef I_STDLIB
21059 #include <stdlib.h>
21060 #endif
21061 int main() {
21062     printf("%d\n", (int)sizeof($sizetype));
21063     exit(0);
21064 }
21065 EOCP
21066 set try
21067 if eval $compile_ok; then
21068         yyy=`$run ./try`
21069         case "$yyy" in
21070         '')     sizesize=4
21071                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21072                 ;;
21073         *)      sizesize=$yyy
21074                 echo "Your $zzz size is $sizesize bytes."
21075                 ;;
21076         esac
21077 else
21078         sizesize=4
21079         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21080 fi
21081
21082
21083 : check for socklen_t
21084 echo " "
21085 echo "Checking to see if you have socklen_t..." >&4
21086 $cat >try.c <<EOCP
21087 #include <sys/types.h>
21088 #$d_socket HAS_SOCKET
21089 #ifdef HAS_SOCKET
21090 #include <sys/socket.h>
21091 #endif
21092 int main() { socklen_t x = 16; }
21093 EOCP
21094 set try
21095 if eval $compile; then
21096         val="$define"
21097         echo "You have socklen_t."
21098 else
21099         val="$undef"
21100         echo "You do not have socklen_t."
21101         case "$sizetype" in
21102         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21103         esac
21104 fi
21105 $rm_try
21106 set d_socklen_t
21107 eval $setvar
21108
21109 : see if this is a socks.h system
21110 set socks.h i_socks
21111 eval $inhdr
21112
21113 : check for type of the size argument to socket calls
21114 case "$d_socket" in
21115 "$define")
21116         $cat <<EOM
21117
21118 Checking to see what type is the last argument of accept().
21119 EOM
21120         yyy=''
21121         case "$d_socklen_t" in
21122         "$define") yyy="$yyy socklen_t"
21123         esac
21124         yyy="$yyy $sizetype int long unsigned"
21125         for xxx in $yyy; do
21126                 case "$socksizetype" in
21127                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21128                         case "$usesocks" in
21129                         "$define")
21130                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21131                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21132                                         socksizetype="$xxx"
21133                                 fi
21134                                 ;;
21135                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21136                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21137                                         socksizetype="$xxx"
21138                                 fi
21139                                 ;;
21140                         esac
21141                         ;;
21142                 esac
21143         done
21144 : In case none of those worked, prompt the user.
21145         case "$socksizetype" in
21146         '')     rp='What is the type for socket address structure sizes?'
21147                 dflt='int'
21148                 . ./myread
21149                 socksizetype=$ans
21150                 ;;
21151         esac
21152         ;;
21153 *)      : no sockets, so pick relatively harmless default
21154         socksizetype='int'
21155         ;;
21156 esac
21157
21158 : see what type is used for signed size_t
21159 set ssize_t ssizetype int stdio.h sys/types.h
21160 eval $typedef
21161 dflt="$ssizetype"
21162 $cat > try.c <<EOM
21163 #include <stdio.h>
21164 #$i_stdlib I_STDLIB
21165 #ifdef I_STDLIB
21166 #include <stdlib.h>
21167 #endif
21168 #include <sys/types.h>
21169 #define Size_t $sizetype
21170 #define SSize_t $dflt
21171 int main()
21172 {
21173         if (sizeof(Size_t) == sizeof(SSize_t))
21174                 printf("$dflt\n");
21175         else if (sizeof(Size_t) == sizeof(int))
21176                 printf("int\n");
21177         else
21178                 printf("long\n");
21179         exit(0);
21180 }
21181 EOM
21182 echo " "
21183 set try
21184 if eval $compile_ok && $run ./try > /dev/null; then
21185         ssizetype=`$run ./try`
21186         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21187 else
21188         $cat >&4 <<EOM
21189 Help! I can't compile and run the ssize_t test program: please enlighten me!
21190 (This is probably a misconfiguration in your system or libraries, and
21191 you really ought to fix it.  Still, I'll try anyway.)
21192
21193 I need a type that is the same size as $sizetype, but is guaranteed to
21194 be signed.  Common values are ssize_t, int and long.
21195
21196 EOM
21197         rp="What signed type is the same size as $sizetype?"
21198         . ./myread
21199         ssizetype="$ans"
21200 fi
21201 $rm_try
21202
21203 : see what type of char stdio uses.
21204 echo " "
21205 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21206 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21207         echo "Your stdio uses unsigned chars." >&4
21208         stdchar="unsigned char"
21209 else
21210         echo "Your stdio uses signed chars." >&4
21211         stdchar="char"
21212 fi
21213 $rm -f stdioh
21214
21215 : see what type uids are declared as in the kernel
21216 echo " "
21217 echo "Looking for the type for user ids returned by getuid()."
21218 set uid_t uidtype xxx stdio.h sys/types.h
21219 eval $typedef
21220 case "$uidtype" in
21221 xxx)
21222         xxx=`./findhdr sys/user.h`
21223         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21224         case $1 in
21225         unsigned) dflt="$1 $2" ;;
21226         *) dflt="$1" ;;
21227         esac
21228         ;;
21229 *) dflt="$uidtype";;
21230 esac
21231 case "$uidtype" in
21232 uid_t)  echo "uid_t found." ;;
21233 *)      rp="What is the type for user ids returned by getuid()?"
21234         . ./myread
21235         uidtype="$ans"
21236         ;;
21237 esac
21238
21239 : Check size of UID
21240 echo " "
21241 case "$uidtype" in
21242 *_t) zzz="$uidtype"     ;;
21243 *)   zzz="uid"          ;;
21244 esac
21245 echo "Checking the size of $zzz..." >&4
21246 cat > try.c <<EOCP
21247 #include <sys/types.h>
21248 #include <stdio.h>
21249 #$i_stdlib I_STDLIB
21250 #ifdef I_STDLIB
21251 #include <stdlib.h>
21252 #endif
21253 int main() {
21254     printf("%d\n", (int)sizeof($uidtype));
21255     exit(0);
21256 }
21257 EOCP
21258 set try
21259 if eval $compile_ok; then
21260         yyy=`$run ./try`
21261         case "$yyy" in
21262         '')     uidsize=4
21263                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21264                 ;;
21265         *)      uidsize=$yyy
21266                 echo "Your $zzz is $uidsize bytes long."
21267                 ;;
21268         esac
21269 else
21270         uidsize=4
21271         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21272 fi
21273
21274 : Check if UID is signed
21275 echo " "
21276 case "$uidtype" in
21277 *_t) zzz="$uidtype"     ;;
21278 *)   zzz="uid"          ;;
21279 esac
21280 echo "Checking the sign of $zzz..." >&4
21281 cat > try.c <<EOCP
21282 #include <sys/types.h>
21283 #include <stdio.h>
21284 int main() {
21285         $uidtype foo = -1;
21286         if (foo < 0)
21287                 printf("-1\n");
21288         else
21289                 printf("1\n");
21290 }
21291 EOCP
21292 set try
21293 if eval $compile; then
21294         yyy=`$run ./try`
21295         case "$yyy" in
21296         '')     uidsign=1
21297                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21298                 ;;
21299         *)      uidsign=$yyy
21300                 case "$uidsign" in
21301                  1) echo "Your $zzz is unsigned." ;;
21302                 -1) echo "Your $zzz is signed."   ;;
21303                 esac
21304                 ;;
21305         esac
21306 else
21307         uidsign=1
21308         echo "(I can't compile the test program--guessing unsigned.)" >&4
21309 fi
21310
21311
21312 : Check format string for UID
21313 echo " "
21314 $echo "Checking the format string to be used for uids..." >&4
21315
21316 case "$uidsign" in
21317 -1)     if $test X"$uidsize" = X"$ivsize"; then
21318                 uidformat="$ivdformat"
21319         else
21320                 if $test X"$uidsize" = X"$longsize"; then
21321                         uidformat='"ld"'
21322                 else
21323                         if $test X"$uidsize" = X"$intsize"; then
21324                                 uidformat='"d"'
21325                         else
21326                                 if $test X"$uidsize" = X"$shortsize"; then
21327                                         uidformat='"hd"'
21328                                 fi
21329                         fi
21330                 fi
21331         fi
21332         ;;
21333 *)      if $test X"$uidsize" = X"$uvsize"; then
21334                 uidformat="$uvuformat"
21335         else
21336                 if $test X"$uidsize" = X"$longsize"; then
21337                         uidformat='"lu"'
21338                 else
21339                         if $test X"$uidsize" = X"$intsize"; then
21340                                 uidformat='"u"'
21341                         else
21342                                 if $test X"$uidsize" = X"$shortsize"; then
21343                                         uidformat='"hu"'
21344                                 fi
21345                         fi
21346                 fi
21347         fi
21348         ;;
21349 esac
21350
21351 : Check if site customization support was requested
21352 case "$usesitecustomize" in
21353     $define|true|[Yy]*)
21354         usesitecustomize="$define"
21355         ;;
21356     *)
21357         usesitecustomize="$undef"
21358         ;;
21359     esac
21360
21361 : see if prototypes support variable argument declarations
21362 echo " "
21363 case "$prototype$i_stdarg" in
21364 $define$define)
21365         echo "It appears we'll be able to prototype varargs functions." >&4
21366         val="$define"
21367         ;;
21368 *)
21369         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21370         val="$undef"
21371         ;;
21372 esac
21373 set vaproto
21374 eval $setvar
21375
21376 : determine compiler compiler
21377 case "$yacc" in
21378 '')
21379         dflt=yacc;;
21380 *)
21381         dflt="$yacc";;
21382 esac
21383 echo " "
21384 comp='yacc'
21385 if $test -f "$byacc$_exe"; then
21386         dflt="$byacc"
21387         comp="byacc or $comp"
21388 fi
21389 if $test -f "$bison$_exe"; then
21390         comp="$comp or bison -y"
21391 fi
21392 rp="Which compiler compiler ($comp) shall I use?"
21393 . ./myread
21394 yacc="$ans"
21395 case "$yacc" in
21396 *bis*)
21397         case "$yacc" in
21398         *-y*) ;;
21399         *)
21400                 yacc="$yacc -y"
21401                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21402                 ;;
21403         esac
21404         ;;
21405 esac
21406
21407 : see if this is a assert.h system
21408 set assert.h i_assert
21409 eval $inhdr
21410
21411 : see if this is a fp.h system
21412 set fp.h i_fp
21413 eval $inhdr
21414
21415 : see if this is a fp_class.h system
21416 set fp_class.h i_fp_class
21417 eval $inhdr
21418
21419 : see if gdbm.h is available
21420 set gdbm.h t_gdbm
21421 eval $inhdr
21422 case "$t_gdbm" in
21423 $define)
21424         : see if gdbm_open exists
21425         set gdbm_open d_gdbm_open
21426         eval $inlibc
21427         case "$d_gdbm_open" in
21428         $undef)
21429                 t_gdbm="$undef"
21430                 echo "We won't be including <gdbm.h>"
21431                 ;;
21432         esac
21433         ;;
21434 esac
21435 val="$t_gdbm"
21436 set i_gdbm
21437 eval $setvar
21438
21439 : see if this is a ieeefp.h system
21440 case "$i_ieeefp" in
21441 '' ) set ieeefp.h i_ieeefp
21442      eval $inhdr
21443      ;;
21444 esac
21445
21446 : see if this is a libutil.h system
21447 set libutil.h i_libutil
21448 eval $inhdr
21449
21450 : see if mach cthreads are available
21451 if test "X$usethreads" = "X$define"; then
21452         set mach/cthreads.h i_machcthr
21453         eval $inhdr
21454 else
21455         i_machcthr="$undef"
21456 fi
21457
21458 : see if this is a mntent.h system
21459 set mntent.h i_mntent
21460 eval $inhdr
21461
21462 : see if net/errno.h is available
21463 val=''
21464 set net/errno.h val
21465 eval $inhdr
21466
21467 : Unfortunately, it causes problems on some systems.  Arrgh.
21468 case "$val" in
21469 $define)
21470         cat > try.c <<'EOM'
21471 #include <stdio.h>
21472 #include <errno.h>
21473 #include <net/errno.h>
21474 int func()
21475 {
21476         return ENOTSOCK;
21477 }
21478 EOM
21479         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21480                 echo "We'll be including <net/errno.h>." >&4
21481         else
21482                 echo "We won't be including <net/errno.h>." >&4
21483                 val="$undef"
21484         fi
21485         $rm_try
21486         ;;
21487 esac
21488 set i_neterrno
21489 eval $setvar
21490
21491 : see if netinet/tcp.h is available
21492 set netinet/tcp.h i_netinettcp
21493 eval $inhdr
21494
21495 : see if this is a poll.h system
21496 set poll.h i_poll
21497 eval $inhdr
21498
21499 : see if this is a prot.h system
21500 set prot.h i_prot
21501 eval $inhdr
21502
21503 : Preprocessor symbols
21504 echo " "
21505 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21506 $cat <<'EOSH' > Cppsym.know
21507 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21508 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21509 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21510 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21511 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21512 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21513 bull c cadmus clipper CMU COFF COMPILER_VERSION
21514 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21515 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21516 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21517 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21518 GLIBC GLIBC_MINOR
21519 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21520 H3050R H3050RX hbullx20 hcx host_mips
21521 hp200 hp300 hp700 HP700 hp800 hp9000
21522 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21523 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21524 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21525 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21526 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21527 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21528 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21529 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21530 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21531 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21532 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21533 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21534 MATH_HAS_NO_SIDE_EFFECTS
21535 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21536 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21537 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21538 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21539 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21540 NetBSD news1500 news1700 news1800 news1900 news3700
21541 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21542 ns32016 ns32332 ns32k nsc32000
21543 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21544 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21545 pc532 pdp11 PGC PIC plexus PORTAR posix
21546 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21547 POSIX_C_SOURCE POSIX_SOURCE POWER
21548 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21549 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21550 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21551 sony sony_news sonyrisc sparc sparclite spectrum
21552 stardent stdc STDC_EXT stratos sun sun3 sun386
21553 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21554 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21555 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21556 sysV68 sysV88 Tek4132 Tek4300 titan
21557 TM3200 TM5400 TM5600
21558 tower tower32 tower32_200 tower32_600 tower32_700
21559 tower32_800 tower32_850 tss
21560 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21561 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21562 unix UNIX95 UNIX99 unixpc unos
21563 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21564 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21565 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21566 USGr4 USGr4_2
21567 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21568 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21569 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21570 z8000
21571 EOSH
21572 # Maybe put other stuff here too.
21573 cat <<EOSH >>Cppsym.know
21574 $osname
21575 EOSH
21576 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21577 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21578 $cat Cppsym.know > Cppsym.c
21579 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21580 $rm -f Cppsym.a Cppsym.b Cppsym.c
21581 cat <<EOSH > Cppsym
21582 $startsh
21583 if $test \$# -gt 0; then
21584     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21585     if $test -s Cppsym.got; then
21586         $rm -f Cppsym.got
21587         exit 0
21588     fi
21589     $rm -f Cppsym.got
21590     exit 1
21591 else
21592     $tr " " "$trnl" | ./Cppsym.try
21593     exit 0
21594 fi
21595 EOSH
21596 chmod +x Cppsym
21597 $eunicefix Cppsym
21598 cat <<EOSH > Cppsym.try
21599 $startsh
21600 cat <<'EOCP' > try.c
21601 #include <stdio.h>
21602 #if cpp_stuff == 1
21603 #define STRINGIFY(a)    "a"
21604 #endif
21605 #if cpp_stuff == 42
21606 #define StGiFy(a)  #a
21607 #define STRINGIFY(a)    StGiFy(a)
21608 #endif
21609 #if $cpp_stuff != 1 && $cpp_stuff != 42
21610 #   include "Bletch: How does this C preprocessor stringify macros?"
21611 #endif
21612 int main() {
21613 EOCP
21614 $awk \\
21615 EOSH
21616 cat <<'EOSH' >> Cppsym.try
21617 'length($1) > 0 {
21618     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21619     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21620     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21621     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21622 }'       >> try.c
21623 echo 'return 0;}' >> try.c
21624 EOSH
21625 cat <<EOSH >> Cppsym.try
21626 ccflags="$ccflags"
21627 case "$osname-$gccversion" in
21628 irix-) ccflags="\$ccflags -woff 1178" ;;
21629 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21630 esac
21631 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21632 EOSH
21633 chmod +x Cppsym.try
21634 $eunicefix Cppsym.try
21635 ./Cppsym < Cppsym.know > Cppsym.true
21636 : Add in any linux cpp "predefined macros":
21637 case "$osname::$gccversion" in
21638   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21639     tHdrH=_tmpHdr
21640     rm -f $tHdrH'.h' $tHdrH
21641     touch $tHdrH'.h'
21642     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21643        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21644        if [ -s $tHdrH'_cppsym.real' ]; then
21645           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21646        fi
21647     fi
21648     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21649   ;;
21650 esac
21651 : now check the C compiler for additional symbols
21652 postprocess_cc_v=''
21653 case "$osname" in
21654 aix) postprocess_cc_v="|$tr , ' '" ;;
21655 esac
21656 $cat >ccsym <<EOS
21657 $startsh
21658 $cat >tmp.c <<EOF
21659 extern int foo;
21660 EOF
21661 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21662 do
21663         case "\$i" in
21664         -D*) echo "\$i" | $sed 's/^-D//';;
21665         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21666         esac
21667 done
21668 $rm_try
21669 EOS
21670 postprocess_cc_v=''
21671 chmod +x ccsym
21672 $eunicefix ccsym
21673 ./ccsym > ccsym1.raw
21674 if $test -s ccsym1.raw; then
21675        $sort ccsym1.raw | $uniq >ccsym.raw
21676 else
21677        mv ccsym1.raw ccsym.raw
21678 fi
21679
21680 $awk '/\=/ { print $0; next }
21681         { print $0"=1" }' ccsym.raw >ccsym.list
21682 $comm -13 Cppsym.true ccsym.list >ccsym.own
21683 $comm -12 Cppsym.true ccsym.list >ccsym.com
21684 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21685 also=''
21686 if $test -z ccsym.raw; then
21687         echo "Your C compiler doesn't seem to define any symbols!" >&4
21688         echo " "
21689         echo "However, your C preprocessor defines the following symbols:"
21690         $cat Cppsym.true
21691         ccsymbols=''
21692         cppsymbols=`$cat Cppsym.true`
21693         cppsymbols=`echo $cppsymbols`
21694         cppccsymbols="$cppsymbols"
21695 else
21696         if $test -s ccsym.com; then
21697                 echo "Your C compiler and pre-processor define these symbols:"
21698                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21699                 also='also '
21700                 symbols='ones'
21701                 cppccsymbols=`$cat ccsym.com`
21702                 cppccsymbols=`echo $cppccsymbols`
21703                 $test "$silent" || sleep 1
21704         fi
21705         if $test -s ccsym.cpp; then
21706                 $test "$also" && echo " "
21707                 echo "Your C pre-processor ${also}defines the following symbols:"
21708                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21709                 also='further '
21710                 cppsymbols=`$cat ccsym.cpp`
21711                 cppsymbols=`echo $cppsymbols`
21712                 $test "$silent" || sleep 1
21713         fi
21714         if $test -s ccsym.own; then
21715                 $test "$also" && echo " "
21716                 echo "Your C compiler ${also}defines the following cpp symbols:"
21717                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21718                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21719                 ccsymbols=`$cat ccsym.own`
21720                 ccsymbols=`echo $ccsymbols`
21721                 $test "$silent" || sleep 1
21722         fi
21723 fi
21724
21725 : see if this is a termio system
21726 val="$undef"
21727 val2="$undef"
21728 val3="$undef"
21729 if $test `./findhdr termios.h`; then
21730         set tcsetattr i_termios
21731         eval $inlibc
21732         val3="$i_termios"
21733 fi
21734 echo " "
21735 case "$val3" in
21736 "$define") echo "You have POSIX termios.h... good!" >&4;;
21737 *) if ./Cppsym pyr; then
21738                 case "`/bin/universe`" in
21739                 ucb) if $test `./findhdr sgtty.h`; then
21740                                 val2="$define"
21741                                 echo "<sgtty.h> found." >&4
21742                         else
21743                                 echo "System is pyramid with BSD universe."
21744                                 ./warn "<sgtty.h> not found--you could have problems."
21745                         fi;;
21746                 *) if $test `./findhdr termio.h`; then
21747                                 val="$define"
21748                                 echo "<termio.h> found." >&4
21749                         else
21750                                 echo "System is pyramid with USG universe."
21751                                 ./warn "<termio.h> not found--you could have problems."
21752                         fi;;
21753                 esac
21754         elif ./usg; then
21755                 if $test `./findhdr termio.h`; then
21756                         echo "<termio.h> found." >&4
21757                         val="$define"
21758                 elif $test `./findhdr sgtty.h`; then
21759                         echo "<sgtty.h> found." >&4
21760                         val2="$define"
21761                 else
21762                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21763                 fi
21764         else
21765                 if $test `./findhdr sgtty.h`; then
21766                         echo "<sgtty.h> found." >&4
21767                         val2="$define"
21768                 elif $test `./findhdr termio.h`; then
21769                         echo "<termio.h> found." >&4
21770                         val="$define"
21771                 else
21772                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21773                 fi
21774         fi;;
21775 esac
21776 set i_termio; eval $setvar
21777 val=$val2; set i_sgtty; eval $setvar
21778 val=$val3; set i_termios; eval $setvar
21779
21780 : see if stddef is available
21781 set stddef.h i_stddef
21782 eval $inhdr
21783
21784 : see if sys/access.h is available
21785 set sys/access.h i_sysaccess
21786 eval $inhdr
21787
21788 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21789 set sys/filio.h i_sysfilio
21790 eval $inhdr
21791 echo " "
21792 if $test `./findhdr sys/ioctl.h`; then
21793         val="$define"
21794         echo '<sys/ioctl.h> found.' >&4
21795 else
21796         val="$undef"
21797         if $test $i_sysfilio = "$define"; then
21798             echo '<sys/ioctl.h> NOT found.' >&4
21799         else
21800                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21801                 $test $i_termio = "$define" && xxx="termio.h"
21802                 $test $i_termios = "$define" && xxx="termios.h"
21803 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21804         fi
21805 fi
21806 set i_sysioctl
21807 eval $setvar
21808
21809 : see if socket ioctl defs are in sys/sockio.h
21810 echo " "
21811 xxx=`./findhdr sys/sockio.h`
21812 if $test "$xxx"; then
21813         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21814                 val="$define"
21815                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21816         else
21817                 val="$undef"
21818                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21819         fi
21820 else
21821         val="$undef"
21822         $cat <<EOM
21823 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21824 EOM
21825 fi
21826 set i_syssockio
21827 eval $setvar
21828
21829 : see if this is a syslog.h system
21830 set syslog.h i_syslog
21831 eval $inhdr
21832
21833 : see if this is a sys/mode.h system
21834 set sys/mode.h i_sysmode
21835 eval $inhdr
21836
21837 : see if there is a sys/poll.h file
21838 set sys/poll.h i_syspoll
21839 eval $inhdr
21840
21841 : see if sys/resource.h has to be included
21842 set sys/resource.h i_sysresrc
21843 eval $inhdr
21844
21845 : see if sys/security.h is available
21846 set sys/security.h i_syssecrt
21847 eval $inhdr
21848
21849 : see if this is a sys/statvfs.h system
21850 set sys/statvfs.h i_sysstatvfs
21851 eval $inhdr
21852
21853 : see if this is a sys/un.h system
21854 set sys/un.h i_sysun
21855 eval $inhdr
21856
21857 : see if this is a sys/utsname.h system
21858 set sys/utsname.h i_sysutsname
21859 eval $inhdr
21860
21861 : see if this is a syswait system
21862 set sys/wait.h i_syswait
21863 eval $inhdr
21864
21865 : see if this is a ustat.h system
21866 set ustat.h i_ustat
21867 eval $inhdr
21868
21869 : see if this is an utime system
21870 set utime.h i_utime
21871 eval $inhdr
21872
21873 : see if this is a vfork system
21874 case "$d_vfork" in
21875 "$define")
21876         set vfork.h i_vfork
21877         eval $inhdr
21878         ;;
21879 *)
21880         i_vfork="$undef"
21881         ;;
21882 esac
21883
21884 : Check extensions
21885 echo " "
21886 echo "Looking for extensions..." >&4
21887 : If we are using the old config.sh, known_extensions may contain
21888 : old or inaccurate or duplicate values.
21889 known_extensions=''
21890 nonxs_extensions=''
21891 : We do not use find because it might not be available.
21892 : We do not just use MANIFEST because the user may have dropped
21893 : some additional extensions into the source tree and expect them
21894 : to be built.
21895
21896 : Function to recursively find available extensions, ignoring DynaLoader
21897 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21898 : In 5.10.1 and later, extensions are stored in directories
21899 : like File-Glob instead of the older File/Glob/.
21900 find_extensions='
21901     for xxx in *; do
21902         case "$xxx" in
21903             DynaLoader|dynaload) ;;
21904             *)
21905             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21906             leaf=`echo $xxx | $sed -e s/.*-//`;
21907             if $test -d File; then
21908                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21909                     known_extensions="$known_extensions $1$this_ext";
21910                 elif $test -f $xxx/Makefile.PL; then
21911                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21912                 else
21913                     if $test -d $xxx -a $# -lt 10; then
21914                         set $1$xxx/ $*;
21915                         cd "$xxx";
21916                         eval $find_extensions;
21917                         cd ..;
21918                         shift;
21919                     fi;
21920                 fi;
21921             else
21922                 $ls -1 $xxx > $$.tmp;
21923                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21924                     known_extensions="$known_extensions $this_ext";
21925                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21926                     known_extensions="$known_extensions $this_ext";
21927                 elif $test -d $xxx; then
21928                     nonxs_extensions="$nonxs_extensions $this_ext";
21929                 fi;
21930                 $rm -f $$.tmp;
21931             fi
21932             ;;
21933         esac;
21934     done'
21935 tdir=`pwd`
21936 cd "$rsrc/cpan"
21937 set X
21938 shift
21939 eval $find_extensions
21940 cd "$rsrc/dist"
21941 set X
21942 shift
21943 eval $find_extensions
21944 cd "$rsrc/ext"
21945 set X
21946 shift
21947 eval $find_extensions
21948 if $test -d File-Glob; then
21949     : All ext/ flattened
21950 else
21951     # Special case:  Add in modules that nest beyond the first level.
21952     # Currently threads/shared and Hash/Util/FieldHash, since they are
21953     # not picked up by the recursive find above (and adding in general
21954     # recursive finding breaks SDBM_File/sdbm).
21955     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21956     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21957 fi
21958 set X $known_extensions
21959 shift
21960 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21961 set X $nonxs_extensions
21962 shift
21963 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21964 cd "$tdir"
21965
21966 : Now see which are supported on this system.
21967 avail_ext=''
21968 for xxx in $known_extensions ; do
21969         case "$xxx" in
21970         DB_File|db_file)
21971                 case "$i_db" in
21972                 $define) avail_ext="$avail_ext $xxx" ;;
21973                 esac
21974                 ;;
21975         GDBM_File|gdbm_fil)
21976                 case "$i_gdbm" in
21977                 $define) avail_ext="$avail_ext $xxx" ;;
21978                 esac
21979                 ;;
21980         I18N/Langinfo|i18n_lan)
21981                 case "$i_langinfo$d_nl_langinfo" in
21982                 $define$define) avail_ext="$avail_ext $xxx" ;;
21983                 esac
21984                 ;;
21985         IPC/SysV|ipc/sysv)
21986                 : XXX Do we need a useipcsysv variable here
21987                 case "${d_msg}${d_sem}${d_shm}" in
21988                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21989                 esac
21990                 ;;
21991         NDBM_File|ndbm_fil)
21992                 case "$d_ndbm" in
21993                 $define)
21994                     case "$osname-$use64bitint" in
21995                     hpux-define)
21996                         case "$libs" in
21997                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21998                         esac
21999                         ;;
22000                     *) avail_ext="$avail_ext $xxx" ;;
22001                     esac
22002                     ;;
22003                 esac
22004                 ;;
22005         ODBM_File|odbm_fil)
22006                 case "${i_dbm}${i_rpcsvcdbm}" in
22007                 *"${define}"*)
22008                     case "$d_cplusplus" in
22009                     define) ;; # delete as a function name will not work
22010                     *)  case "$osname-$use64bitint" in
22011                         hpux-define)
22012                             case "$libs" in
22013                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22014                             esac
22015                             ;;
22016                         *) avail_ext="$avail_ext $xxx" ;;
22017                         esac
22018                         ;;
22019                     esac
22020                     ;;
22021                 esac
22022                 ;;
22023         Opcode|opcode)
22024                 case "$useopcode" in
22025                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22026                 esac
22027                 ;;
22028         POSIX|posix)
22029                 case "$useposix" in
22030                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22031                 esac
22032                 ;;
22033         Socket|socket)
22034                 case "$d_socket" in
22035                 true|$define|y)
22036                     case "$osname" in
22037                     beos) ;; # not unless BONE
22038                     *) avail_ext="$avail_ext $xxx" ;;
22039                     esac
22040                     ;;
22041                 esac
22042                 ;;
22043         Sys/Syslog|sys/syslog)
22044                 : XXX syslog requires socket
22045                 case "$d_socket" in
22046                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22047                 esac
22048                 ;;
22049         Thread|thread)
22050                 case "$usethreads" in
22051                 true|$define|y)
22052                         case "$use5005threads" in
22053                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22054                         esac
22055                 esac
22056                 ;;
22057         threads|threads/shared)
22058                 # threads and threads::shared are special cases.
22059                 # To stop people from asking "Perl 5.8.0 was supposed
22060                 # to have this new fancy threads implementation but my
22061                 # perl doesn't have it" and from people trying to
22062                 # (re)install the threads module using CPAN.pm and
22063                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22064                 # the threads.pm and threads/shared.pm will always be
22065                 # there, croaking informatively ("you need to rebuild
22066                 # all of Perl with threads, sorry") when threads haven't
22067                 # been compiled in.
22068                 # --jhi
22069                 avail_ext="$avail_ext $xxx"
22070                 ;;
22071         VMS*)
22072                 ;;
22073         Win32*)
22074                 case "$osname" in
22075                 cygwin) avail_ext="$avail_ext $xxx" ;;
22076                 esac
22077                 ;;
22078         XS/APItest|xs/apitest)
22079                 # This is just for testing.  Skip it unless we have dynamic loading.
22080
22081                 case "$usedl" in
22082                 $define) avail_ext="$avail_ext $xxx" ;;
22083                 esac
22084                 ;;
22085         XS/Typemap|xs/typemap)
22086                 # This is just for testing.  Skip it unless we have dynamic loading.
22087                 case "$usedl" in
22088                 $define) avail_ext="$avail_ext $xxx" ;;
22089                 esac
22090                 ;;
22091         *)      avail_ext="$avail_ext $xxx"
22092                 ;;
22093         esac
22094 done
22095
22096 set X $avail_ext
22097 shift
22098 avail_ext="$*"
22099
22100 case "$onlyextensions" in
22101 '') ;;
22102 *)  keepextensions=''
22103     echo "You have requested that only certain extensions be included..." >&4
22104     for i in $onlyextensions; do
22105         case " $avail_ext " in
22106         *" $i "*)
22107             echo "Keeping extension $i."
22108             keepextensions="$keepextensions $i"
22109             ;;
22110         *) echo "Ignoring extension $i." ;;
22111         esac
22112     done
22113     avail_ext="$keepextensions"
22114     ;;
22115 esac
22116
22117 case "$noextensions" in
22118 '') ;;
22119 *)  keepextensions=''
22120     echo "You have requested that certain extensions be ignored..." >&4
22121     for i in $avail_ext; do
22122         case " $noextensions " in
22123         *" $i "*) echo "Ignoring extension $i." ;;
22124         *) echo "Keeping extension $i.";
22125            keepextensions="$keepextensions $i"
22126            ;;
22127         esac
22128     done
22129     avail_ext="$keepextensions"
22130     ;;
22131 esac
22132
22133 : Now see which nonxs extensions are supported on this system.
22134 : For now assume all are.
22135 nonxs_ext=''
22136 for xxx in $nonxs_extensions ; do
22137         case "$xxx" in
22138         *)      nonxs_ext="$nonxs_ext $xxx"
22139                 ;;
22140         esac
22141 done
22142
22143 set X $nonxs_ext
22144 shift
22145 nonxs_ext="$*"
22146
22147 case $usedl in
22148 $define)
22149         $cat <<EOM
22150 A number of extensions are supplied with $package.  You may choose to
22151 compile these extensions for dynamic loading (the default), compile
22152 them into the $package executable (static loading), or not include
22153 them at all.  Answer "none" to include no extensions.
22154 Note that DynaLoader is always built and need not be mentioned here.
22155
22156 EOM
22157         case "$dynamic_ext" in
22158         '')
22159                 : Exclude those listed in static_ext
22160                 dflt=''
22161                 for xxx in $avail_ext; do
22162                         case " $static_ext " in
22163                         *" $xxx "*) ;;
22164                         *) dflt="$dflt $xxx" ;;
22165                         esac
22166                 done
22167                 set X $dflt
22168                 shift
22169                 dflt="$*"
22170                 ;;
22171         *)      dflt="$dynamic_ext"
22172                 # Perhaps we are reusing an old out-of-date config.sh.
22173                 case "$hint" in
22174                 previous)
22175                         if test X"$dynamic_ext" != X"$avail_ext"; then
22176                                 $cat <<EOM
22177 NOTICE:  Your previous config.sh list may be incorrect.
22178 The extensions now available to you are
22179         ${avail_ext}
22180 but the default list from your previous config.sh is
22181         ${dynamic_ext}
22182
22183 EOM
22184                         fi
22185                         ;;
22186                 esac
22187                 ;;
22188         esac
22189         case "$dflt" in
22190         '')     dflt=none;;
22191         esac
22192         rp="What extensions do you wish to load dynamically?"
22193         . ./myread
22194         case "$ans" in
22195         none) dynamic_ext=' ' ;;
22196         *) dynamic_ext="$ans" ;;
22197         esac
22198
22199         case "$static_ext" in
22200         '')
22201                 : Exclude those already listed in dynamic linking
22202                 dflt=''
22203                 for xxx in $avail_ext; do
22204                         case " $dynamic_ext " in
22205                         *" $xxx "*) ;;
22206                         *) dflt="$dflt $xxx" ;;
22207                         esac
22208                 done
22209                 set X $dflt
22210                 shift
22211                 dflt="$*"
22212                 ;;
22213         *)  dflt="$static_ext"
22214                 ;;
22215         esac
22216
22217         case "$dflt" in
22218         '')     dflt=none;;
22219         esac
22220         rp="What extensions do you wish to load statically?"
22221         . ./myread
22222         case "$ans" in
22223         none) static_ext=' ' ;;
22224         *) static_ext="$ans" ;;
22225         esac
22226         ;;
22227 *)
22228         $cat <<EOM
22229 A number of extensions are supplied with $package.  Answer "none"
22230 to include no extensions.
22231 Note that DynaLoader is always built and need not be mentioned here.
22232
22233 EOM
22234         case "$static_ext" in
22235         '') dflt="$avail_ext" ;;
22236         *)      dflt="$static_ext"
22237                 # Perhaps we are reusing an old out-of-date config.sh.
22238                 case "$hint" in
22239                 previous)
22240                         if test X"$static_ext" != X"$avail_ext"; then
22241                                 $cat <<EOM
22242 NOTICE:  Your previous config.sh list may be incorrect.
22243 The extensions now available to you are
22244         ${avail_ext}
22245 but the default list from your previous config.sh is
22246         ${static_ext}
22247
22248 EOM
22249                         fi
22250                         ;;
22251                 esac
22252                 ;;
22253         esac
22254         : Exclude those that are not xs extensions
22255         case "$dflt" in
22256         '')     dflt=none;;
22257         esac
22258         rp="What extensions do you wish to include?"
22259         . ./myread
22260         case "$ans" in
22261         none) static_ext=' ' ;;
22262         *) static_ext="$ans" ;;
22263         esac
22264         ;;
22265 esac
22266 #
22267 # Encode is a special case.  If we are building Encode as a static
22268 # extension, we need to explicitly list its subextensions as well.
22269 # For other nested extensions, this is handled automatically by
22270 # the appropriate Makefile.PL.
22271 case " $static_ext " in
22272         *" Encode "*) # Add the subextensions of Encode
22273         cd "$rsrc/cpan"
22274         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22275                 static_ext="$static_ext Encode/$xxx"
22276         done
22277         cd "$tdir"
22278         ;;
22279 esac
22280
22281 set X $dynamic_ext $static_ext $nonxs_ext
22282 shift
22283 extensions="$*"
22284
22285 # Sanity check:  We require an extension suitable for use with
22286 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22287 # should show up as failures in the test suite, but it's helpful to
22288 # catch them now.) The 'extensions' list is normally sorted
22289 # alphabetically, so we need to accept either
22290 #    DB_File ... Fcntl ... IO  ....
22291 # or something like
22292 #    Fcntl ... NDBM_File ... IO  ....
22293 case " $extensions"  in
22294 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22295 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22296 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22297 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22298    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22299    ;;
22300 esac
22301
22302 : Remove libraries needed only for extensions
22303 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22304 : The exception is SunOS 4.x, which needs them.
22305 case "${osname}X${osvers}" in
22306 sunos*X4*)
22307     perllibs="$libs"
22308     ;;
22309 *) case "$usedl" in
22310     $define|true|[yY]*)
22311             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22312             shift
22313             perllibs="$*"
22314             ;;
22315     *)  perllibs="$libs"
22316             ;;
22317     esac
22318     ;;
22319 esac
22320
22321 : Remove build directory name from cppstdin so it can be used from
22322 : either the present location or the final installed location.
22323 echo " "
22324 : Get out of the UU directory to get correct path name.
22325 cd ..
22326 case "$cppstdin" in
22327 `pwd`/cppstdin)
22328         echo "Stripping down cppstdin path name"
22329         cppstdin=cppstdin
22330         ;;
22331 esac
22332 cd UU
22333
22334 : end of configuration questions
22335 echo " "
22336 echo "End of configuration questions."
22337 echo " "
22338
22339 : back to where it started
22340 if test -d ../UU; then
22341         cd ..
22342 fi
22343
22344 : configuration may be unconditionally patched via a 'config.arch' file
22345 if $test -f config.arch; then
22346         echo "I see a config.arch file, loading it." >&4
22347         . ./config.arch
22348 fi
22349
22350 : configuration may be patched via a 'config.over' file
22351 if $test -f config.over; then
22352         echo " "
22353         dflt=y
22354         rp='I see a config.over file.  Do you wish to load it?'
22355         . UU/myread
22356         case "$ans" in
22357         n*) echo "OK, I'll ignore it.";;
22358         *)      . ./config.over
22359                 echo "Configuration override changes have been loaded."
22360                 ;;
22361         esac
22362 fi
22363
22364 : in case they want portability, strip down executable paths
22365 case "$d_portable" in
22366 "$define")
22367         echo " "
22368         echo "Stripping down executable paths..." >&4
22369         for file in $loclist $trylist; do
22370                 eval temp=\$$file
22371                 eval $file=`basename $temp`
22372         done
22373         ;;
22374 esac
22375
22376 : create config.sh file
22377 echo " "
22378 echo "Creating config.sh..." >&4
22379 $spitshell <<EOT >config.sh
22380 $startsh
22381 #
22382 # This file was produced by running the Configure script. It holds all the
22383 # definitions figured out by Configure. Should you modify one of these values,
22384 # do not forget to propagate your changes by running "Configure -der". You may
22385 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22386 #
22387
22388 # Package name      : $package
22389 # Source directory  : $src
22390 # Configuration time: $cf_time
22391 # Configured by     : $cf_by
22392 # Target system     : $myuname
22393
22394 EOT
22395 : Add in command line options if available
22396 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22397
22398 $spitshell <<EOT >>config.sh
22399
22400 Author='$Author'
22401 Date='$Date'
22402 Header='$Header'
22403 Id='$Id'
22404 Locker='$Locker'
22405 Log='$Log'
22406 RCSfile='$RCSfile'
22407 Revision='$Revision'
22408 Source='$Source'
22409 State='$State'
22410 _a='$_a'
22411 _exe='$_exe'
22412 _o='$_o'
22413 afs='$afs'
22414 afsroot='$afsroot'
22415 alignbytes='$alignbytes'
22416 ansi2knr='$ansi2knr'
22417 aphostname='$aphostname'
22418 api_revision='$api_revision'
22419 api_subversion='$api_subversion'
22420 api_version='$api_version'
22421 api_versionstring='$api_versionstring'
22422 ar='$ar'
22423 archlib='$archlib'
22424 archlibexp='$archlibexp'
22425 archname64='$archname64'
22426 archname='$archname'
22427 archobjs='$archobjs'
22428 asctime_r_proto='$asctime_r_proto'
22429 awk='$awk'
22430 baserev='$baserev'
22431 bash='$bash'
22432 bin='$bin'
22433 bin_ELF='$bin_ELF'
22434 binexp='$binexp'
22435 bison='$bison'
22436 byacc='$byacc'
22437 byteorder='$byteorder'
22438 c='$c'
22439 castflags='$castflags'
22440 cat='$cat'
22441 cc='$cc'
22442 cccdlflags='$cccdlflags'
22443 ccdlflags='$ccdlflags'
22444 ccflags='$ccflags'
22445 ccflags_uselargefiles='$ccflags_uselargefiles'
22446 ccname='$ccname'
22447 ccsymbols='$ccsymbols'
22448 ccversion='$ccversion'
22449 cf_by='$cf_by'
22450 cf_email='$cf_email'
22451 cf_time='$cf_time'
22452 charbits='$charbits'
22453 charsize='$charsize'
22454 chgrp='$chgrp'
22455 chmod='$chmod'
22456 chown='$chown'
22457 clocktype='$clocktype'
22458 comm='$comm'
22459 compress='$compress'
22460 contains='$contains'
22461 cp='$cp'
22462 cpio='$cpio'
22463 cpp='$cpp'
22464 cpp_stuff='$cpp_stuff'
22465 cppccsymbols='$cppccsymbols'
22466 cppflags='$cppflags'
22467 cpplast='$cpplast'
22468 cppminus='$cppminus'
22469 cpprun='$cpprun'
22470 cppstdin='$cppstdin'
22471 cppsymbols='$cppsymbols'
22472 crypt_r_proto='$crypt_r_proto'
22473 cryptlib='$cryptlib'
22474 csh='$csh'
22475 ctermid_r_proto='$ctermid_r_proto'
22476 ctime_r_proto='$ctime_r_proto'
22477 d_Gconvert='$d_Gconvert'
22478 d_PRIEUldbl='$d_PRIEUldbl'
22479 d_PRIFUldbl='$d_PRIFUldbl'
22480 d_PRIGUldbl='$d_PRIGUldbl'
22481 d_PRIXU64='$d_PRIXU64'
22482 d_PRId64='$d_PRId64'
22483 d_PRIeldbl='$d_PRIeldbl'
22484 d_PRIfldbl='$d_PRIfldbl'
22485 d_PRIgldbl='$d_PRIgldbl'
22486 d_PRIi64='$d_PRIi64'
22487 d_PRIo64='$d_PRIo64'
22488 d_PRIu64='$d_PRIu64'
22489 d_PRIx64='$d_PRIx64'
22490 d_SCNfldbl='$d_SCNfldbl'
22491 d__fwalk='$d__fwalk'
22492 d_access='$d_access'
22493 d_accessx='$d_accessx'
22494 d_aintl='$d_aintl'
22495 d_alarm='$d_alarm'
22496 d_archlib='$d_archlib'
22497 d_asctime64='$d_asctime64'
22498 d_asctime_r='$d_asctime_r'
22499 d_atolf='$d_atolf'
22500 d_atoll='$d_atoll'
22501 d_attribute_deprecated='$d_attribute_deprecated'
22502 d_attribute_format='$d_attribute_format'
22503 d_attribute_malloc='$d_attribute_malloc'
22504 d_attribute_nonnull='$d_attribute_nonnull'
22505 d_attribute_noreturn='$d_attribute_noreturn'
22506 d_attribute_pure='$d_attribute_pure'
22507 d_attribute_unused='$d_attribute_unused'
22508 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22509 d_bcmp='$d_bcmp'
22510 d_bcopy='$d_bcopy'
22511 d_bsd='$d_bsd'
22512 d_bsdgetpgrp='$d_bsdgetpgrp'
22513 d_bsdsetpgrp='$d_bsdsetpgrp'
22514 d_builtin_choose_expr='$d_builtin_choose_expr'
22515 d_builtin_expect='$d_builtin_expect'
22516 d_bzero='$d_bzero'
22517 d_c99_variadic_macros='$d_c99_variadic_macros'
22518 d_casti32='$d_casti32'
22519 d_castneg='$d_castneg'
22520 d_charvspr='$d_charvspr'
22521 d_chown='$d_chown'
22522 d_chroot='$d_chroot'
22523 d_chsize='$d_chsize'
22524 d_class='$d_class'
22525 d_clearenv='$d_clearenv'
22526 d_closedir='$d_closedir'
22527 d_cmsghdr_s='$d_cmsghdr_s'
22528 d_const='$d_const'
22529 d_copysignl='$d_copysignl'
22530 d_cplusplus='$d_cplusplus'
22531 d_crypt='$d_crypt'
22532 d_crypt_r='$d_crypt_r'
22533 d_csh='$d_csh'
22534 d_ctermid='$d_ctermid'
22535 d_ctermid_r='$d_ctermid_r'
22536 d_ctime64='$d_ctime64'
22537 d_ctime_r='$d_ctime_r'
22538 d_cuserid='$d_cuserid'
22539 d_dbl_dig='$d_dbl_dig'
22540 d_dbminitproto='$d_dbminitproto'
22541 d_difftime64='$d_difftime64'
22542 d_difftime='$d_difftime'
22543 d_dir_dd_fd='$d_dir_dd_fd'
22544 d_dirfd='$d_dirfd'
22545 d_dirnamlen='$d_dirnamlen'
22546 d_dlerror='$d_dlerror'
22547 d_dlopen='$d_dlopen'
22548 d_dlsymun='$d_dlsymun'
22549 d_dosuid='$d_dosuid'
22550 d_drand48_r='$d_drand48_r'
22551 d_drand48proto='$d_drand48proto'
22552 d_dup2='$d_dup2'
22553 d_eaccess='$d_eaccess'
22554 d_endgrent='$d_endgrent'
22555 d_endgrent_r='$d_endgrent_r'
22556 d_endhent='$d_endhent'
22557 d_endhostent_r='$d_endhostent_r'
22558 d_endnent='$d_endnent'
22559 d_endnetent_r='$d_endnetent_r'
22560 d_endpent='$d_endpent'
22561 d_endprotoent_r='$d_endprotoent_r'
22562 d_endpwent='$d_endpwent'
22563 d_endpwent_r='$d_endpwent_r'
22564 d_endsent='$d_endsent'
22565 d_endservent_r='$d_endservent_r'
22566 d_eofnblk='$d_eofnblk'
22567 d_eunice='$d_eunice'
22568 d_faststdio='$d_faststdio'
22569 d_fchdir='$d_fchdir'
22570 d_fchmod='$d_fchmod'
22571 d_fchown='$d_fchown'
22572 d_fcntl='$d_fcntl'
22573 d_fcntl_can_lock='$d_fcntl_can_lock'
22574 d_fd_macros='$d_fd_macros'
22575 d_fd_set='$d_fd_set'
22576 d_fds_bits='$d_fds_bits'
22577 d_fgetpos='$d_fgetpos'
22578 d_finite='$d_finite'
22579 d_finitel='$d_finitel'
22580 d_flexfnam='$d_flexfnam'
22581 d_flock='$d_flock'
22582 d_flockproto='$d_flockproto'
22583 d_fork='$d_fork'
22584 d_fp_class='$d_fp_class'
22585 d_fpathconf='$d_fpathconf'
22586 d_fpclass='$d_fpclass'
22587 d_fpclassify='$d_fpclassify'
22588 d_fpclassl='$d_fpclassl'
22589 d_fpos64_t='$d_fpos64_t'
22590 d_frexpl='$d_frexpl'
22591 d_fs_data_s='$d_fs_data_s'
22592 d_fseeko='$d_fseeko'
22593 d_fsetpos='$d_fsetpos'
22594 d_fstatfs='$d_fstatfs'
22595 d_fstatvfs='$d_fstatvfs'
22596 d_fsync='$d_fsync'
22597 d_ftello='$d_ftello'
22598 d_ftime='$d_ftime'
22599 d_futimes='$d_futimes'
22600 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22601 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22602 d_getaddrinfo='$d_getaddrinfo'
22603 d_getcwd='$d_getcwd'
22604 d_getespwnam='$d_getespwnam'
22605 d_getfsstat='$d_getfsstat'
22606 d_getgrent='$d_getgrent'
22607 d_getgrent_r='$d_getgrent_r'
22608 d_getgrgid_r='$d_getgrgid_r'
22609 d_getgrnam_r='$d_getgrnam_r'
22610 d_getgrps='$d_getgrps'
22611 d_gethbyaddr='$d_gethbyaddr'
22612 d_gethbyname='$d_gethbyname'
22613 d_gethent='$d_gethent'
22614 d_gethname='$d_gethname'
22615 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22616 d_gethostbyname_r='$d_gethostbyname_r'
22617 d_gethostent_r='$d_gethostent_r'
22618 d_gethostprotos='$d_gethostprotos'
22619 d_getitimer='$d_getitimer'
22620 d_getlogin='$d_getlogin'
22621 d_getlogin_r='$d_getlogin_r'
22622 d_getmnt='$d_getmnt'
22623 d_getmntent='$d_getmntent'
22624 d_getnameinfo='$d_getnameinfo'
22625 d_getnbyaddr='$d_getnbyaddr'
22626 d_getnbyname='$d_getnbyname'
22627 d_getnent='$d_getnent'
22628 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22629 d_getnetbyname_r='$d_getnetbyname_r'
22630 d_getnetent_r='$d_getnetent_r'
22631 d_getnetprotos='$d_getnetprotos'
22632 d_getpagsz='$d_getpagsz'
22633 d_getpbyname='$d_getpbyname'
22634 d_getpbynumber='$d_getpbynumber'
22635 d_getpent='$d_getpent'
22636 d_getpgid='$d_getpgid'
22637 d_getpgrp2='$d_getpgrp2'
22638 d_getpgrp='$d_getpgrp'
22639 d_getppid='$d_getppid'
22640 d_getprior='$d_getprior'
22641 d_getprotobyname_r='$d_getprotobyname_r'
22642 d_getprotobynumber_r='$d_getprotobynumber_r'
22643 d_getprotoent_r='$d_getprotoent_r'
22644 d_getprotoprotos='$d_getprotoprotos'
22645 d_getprpwnam='$d_getprpwnam'
22646 d_getpwent='$d_getpwent'
22647 d_getpwent_r='$d_getpwent_r'
22648 d_getpwnam_r='$d_getpwnam_r'
22649 d_getpwuid_r='$d_getpwuid_r'
22650 d_getsbyname='$d_getsbyname'
22651 d_getsbyport='$d_getsbyport'
22652 d_getsent='$d_getsent'
22653 d_getservbyname_r='$d_getservbyname_r'
22654 d_getservbyport_r='$d_getservbyport_r'
22655 d_getservent_r='$d_getservent_r'
22656 d_getservprotos='$d_getservprotos'
22657 d_getspnam='$d_getspnam'
22658 d_getspnam_r='$d_getspnam_r'
22659 d_gettimeod='$d_gettimeod'
22660 d_gmtime64='$d_gmtime64'
22661 d_gmtime_r='$d_gmtime_r'
22662 d_gnulibc='$d_gnulibc'
22663 d_grpasswd='$d_grpasswd'
22664 d_hasmntopt='$d_hasmntopt'
22665 d_htonl='$d_htonl'
22666 d_ilogbl='$d_ilogbl'
22667 d_inc_version_list='$d_inc_version_list'
22668 d_index='$d_index'
22669 d_inetaton='$d_inetaton'
22670 d_inetntop='$d_inetntop'
22671 d_inetpton='$d_inetpton'
22672 d_int64_t='$d_int64_t'
22673 d_isascii='$d_isascii'
22674 d_isfinite='$d_isfinite'
22675 d_isinf='$d_isinf'
22676 d_isnan='$d_isnan'
22677 d_isnanl='$d_isnanl'
22678 d_killpg='$d_killpg'
22679 d_lchown='$d_lchown'
22680 d_ldbl_dig='$d_ldbl_dig'
22681 d_libm_lib_version='$d_libm_lib_version'
22682 d_link='$d_link'
22683 d_localtime64='$d_localtime64'
22684 d_localtime_r='$d_localtime_r'
22685 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22686 d_locconv='$d_locconv'
22687 d_lockf='$d_lockf'
22688 d_longdbl='$d_longdbl'
22689 d_longlong='$d_longlong'
22690 d_lseekproto='$d_lseekproto'
22691 d_lstat='$d_lstat'
22692 d_madvise='$d_madvise'
22693 d_malloc_good_size='$d_malloc_good_size'
22694 d_malloc_size='$d_malloc_size'
22695 d_mblen='$d_mblen'
22696 d_mbstowcs='$d_mbstowcs'
22697 d_mbtowc='$d_mbtowc'
22698 d_memchr='$d_memchr'
22699 d_memcmp='$d_memcmp'
22700 d_memcpy='$d_memcpy'
22701 d_memmove='$d_memmove'
22702 d_memset='$d_memset'
22703 d_mkdir='$d_mkdir'
22704 d_mkdtemp='$d_mkdtemp'
22705 d_mkfifo='$d_mkfifo'
22706 d_mkstemp='$d_mkstemp'
22707 d_mkstemps='$d_mkstemps'
22708 d_mktime64='$d_mktime64'
22709 d_mktime='$d_mktime'
22710 d_mmap='$d_mmap'
22711 d_modfl='$d_modfl'
22712 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22713 d_modflproto='$d_modflproto'
22714 d_mprotect='$d_mprotect'
22715 d_msg='$d_msg'
22716 d_msg_ctrunc='$d_msg_ctrunc'
22717 d_msg_dontroute='$d_msg_dontroute'
22718 d_msg_oob='$d_msg_oob'
22719 d_msg_peek='$d_msg_peek'
22720 d_msg_proxy='$d_msg_proxy'
22721 d_msgctl='$d_msgctl'
22722 d_msgget='$d_msgget'
22723 d_msghdr_s='$d_msghdr_s'
22724 d_msgrcv='$d_msgrcv'
22725 d_msgsnd='$d_msgsnd'
22726 d_msync='$d_msync'
22727 d_munmap='$d_munmap'
22728 d_mymalloc='$d_mymalloc'
22729 d_ndbm='$d_ndbm'
22730 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22731 d_nice='$d_nice'
22732 d_nl_langinfo='$d_nl_langinfo'
22733 d_nv_preserves_uv='$d_nv_preserves_uv'
22734 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22735 d_off64_t='$d_off64_t'
22736 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22737 d_oldpthreads='$d_oldpthreads'
22738 d_oldsock='$d_oldsock'
22739 d_open3='$d_open3'
22740 d_pathconf='$d_pathconf'
22741 d_pause='$d_pause'
22742 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22743 d_phostname='$d_phostname'
22744 d_pipe='$d_pipe'
22745 d_poll='$d_poll'
22746 d_portable='$d_portable'
22747 d_prctl='$d_prctl'
22748 d_prctl_set_name='$d_prctl_set_name'
22749 d_printf_format_null='$d_printf_format_null'
22750 d_procselfexe='$d_procselfexe'
22751 d_pseudofork='$d_pseudofork'
22752 d_pthread_atfork='$d_pthread_atfork'
22753 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22754 d_pthread_yield='$d_pthread_yield'
22755 d_pwage='$d_pwage'
22756 d_pwchange='$d_pwchange'
22757 d_pwclass='$d_pwclass'
22758 d_pwcomment='$d_pwcomment'
22759 d_pwexpire='$d_pwexpire'
22760 d_pwgecos='$d_pwgecos'
22761 d_pwpasswd='$d_pwpasswd'
22762 d_pwquota='$d_pwquota'
22763 d_qgcvt='$d_qgcvt'
22764 d_quad='$d_quad'
22765 d_random_r='$d_random_r'
22766 d_readdir64_r='$d_readdir64_r'
22767 d_readdir='$d_readdir'
22768 d_readdir_r='$d_readdir_r'
22769 d_readlink='$d_readlink'
22770 d_readv='$d_readv'
22771 d_recvmsg='$d_recvmsg'
22772 d_rename='$d_rename'
22773 d_rewinddir='$d_rewinddir'
22774 d_rmdir='$d_rmdir'
22775 d_safebcpy='$d_safebcpy'
22776 d_safemcpy='$d_safemcpy'
22777 d_sanemcmp='$d_sanemcmp'
22778 d_sbrkproto='$d_sbrkproto'
22779 d_scalbnl='$d_scalbnl'
22780 d_sched_yield='$d_sched_yield'
22781 d_scm_rights='$d_scm_rights'
22782 d_seekdir='$d_seekdir'
22783 d_select='$d_select'
22784 d_sem='$d_sem'
22785 d_semctl='$d_semctl'
22786 d_semctl_semid_ds='$d_semctl_semid_ds'
22787 d_semctl_semun='$d_semctl_semun'
22788 d_semget='$d_semget'
22789 d_semop='$d_semop'
22790 d_sendmsg='$d_sendmsg'
22791 d_setegid='$d_setegid'
22792 d_seteuid='$d_seteuid'
22793 d_setgrent='$d_setgrent'
22794 d_setgrent_r='$d_setgrent_r'
22795 d_setgrps='$d_setgrps'
22796 d_sethent='$d_sethent'
22797 d_sethostent_r='$d_sethostent_r'
22798 d_setitimer='$d_setitimer'
22799 d_setlinebuf='$d_setlinebuf'
22800 d_setlocale='$d_setlocale'
22801 d_setlocale_r='$d_setlocale_r'
22802 d_setnent='$d_setnent'
22803 d_setnetent_r='$d_setnetent_r'
22804 d_setpent='$d_setpent'
22805 d_setpgid='$d_setpgid'
22806 d_setpgrp2='$d_setpgrp2'
22807 d_setpgrp='$d_setpgrp'
22808 d_setprior='$d_setprior'
22809 d_setproctitle='$d_setproctitle'
22810 d_setprotoent_r='$d_setprotoent_r'
22811 d_setpwent='$d_setpwent'
22812 d_setpwent_r='$d_setpwent_r'
22813 d_setregid='$d_setregid'
22814 d_setresgid='$d_setresgid'
22815 d_setresuid='$d_setresuid'
22816 d_setreuid='$d_setreuid'
22817 d_setrgid='$d_setrgid'
22818 d_setruid='$d_setruid'
22819 d_setsent='$d_setsent'
22820 d_setservent_r='$d_setservent_r'
22821 d_setsid='$d_setsid'
22822 d_setvbuf='$d_setvbuf'
22823 d_sfio='$d_sfio'
22824 d_shm='$d_shm'
22825 d_shmat='$d_shmat'
22826 d_shmatprototype='$d_shmatprototype'
22827 d_shmctl='$d_shmctl'
22828 d_shmdt='$d_shmdt'
22829 d_shmget='$d_shmget'
22830 d_sigaction='$d_sigaction'
22831 d_signbit='$d_signbit'
22832 d_sigprocmask='$d_sigprocmask'
22833 d_sigsetjmp='$d_sigsetjmp'
22834 d_sin6_scope_id='$d_sin6_scope_id'
22835 d_sitearch='$d_sitearch'
22836 d_snprintf='$d_snprintf'
22837 d_sockaddr_sa_len='$d_sockaddr_sa_len'
22838 d_sockatmark='$d_sockatmark'
22839 d_sockatmarkproto='$d_sockatmarkproto'
22840 d_socket='$d_socket'
22841 d_socklen_t='$d_socklen_t'
22842 d_sockpair='$d_sockpair'
22843 d_socks5_init='$d_socks5_init'
22844 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22845 d_sqrtl='$d_sqrtl'
22846 d_srand48_r='$d_srand48_r'
22847 d_srandom_r='$d_srandom_r'
22848 d_sresgproto='$d_sresgproto'
22849 d_sresuproto='$d_sresuproto'
22850 d_statblks='$d_statblks'
22851 d_statfs_f_flags='$d_statfs_f_flags'
22852 d_statfs_s='$d_statfs_s'
22853 d_static_inline='$d_static_inline'
22854 d_statvfs='$d_statvfs'
22855 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22856 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22857 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22858 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22859 d_stdio_stream_array='$d_stdio_stream_array'
22860 d_stdiobase='$d_stdiobase'
22861 d_stdstdio='$d_stdstdio'
22862 d_strchr='$d_strchr'
22863 d_strcoll='$d_strcoll'
22864 d_strctcpy='$d_strctcpy'
22865 d_strerrm='$d_strerrm'
22866 d_strerror='$d_strerror'
22867 d_strerror_r='$d_strerror_r'
22868 d_strftime='$d_strftime'
22869 d_strlcat='$d_strlcat'
22870 d_strlcpy='$d_strlcpy'
22871 d_strtod='$d_strtod'
22872 d_strtol='$d_strtol'
22873 d_strtold='$d_strtold'
22874 d_strtoll='$d_strtoll'
22875 d_strtoq='$d_strtoq'
22876 d_strtoul='$d_strtoul'
22877 d_strtoull='$d_strtoull'
22878 d_strtouq='$d_strtouq'
22879 d_strxfrm='$d_strxfrm'
22880 d_suidsafe='$d_suidsafe'
22881 d_symlink='$d_symlink'
22882 d_syscall='$d_syscall'
22883 d_syscallproto='$d_syscallproto'
22884 d_sysconf='$d_sysconf'
22885 d_sysernlst='$d_sysernlst'
22886 d_syserrlst='$d_syserrlst'
22887 d_system='$d_system'
22888 d_tcgetpgrp='$d_tcgetpgrp'
22889 d_tcsetpgrp='$d_tcsetpgrp'
22890 d_telldir='$d_telldir'
22891 d_telldirproto='$d_telldirproto'
22892 d_time='$d_time'
22893 d_timegm='$d_timegm'
22894 d_times='$d_times'
22895 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22896 d_tm_tm_zone='$d_tm_tm_zone'
22897 d_tmpnam_r='$d_tmpnam_r'
22898 d_truncate='$d_truncate'
22899 d_ttyname_r='$d_ttyname_r'
22900 d_tzname='$d_tzname'
22901 d_u32align='$d_u32align'
22902 d_ualarm='$d_ualarm'
22903 d_umask='$d_umask'
22904 d_uname='$d_uname'
22905 d_union_semun='$d_union_semun'
22906 d_unordered='$d_unordered'
22907 d_unsetenv='$d_unsetenv'
22908 d_usleep='$d_usleep'
22909 d_usleepproto='$d_usleepproto'
22910 d_ustat='$d_ustat'
22911 d_vendorarch='$d_vendorarch'
22912 d_vendorbin='$d_vendorbin'
22913 d_vendorlib='$d_vendorlib'
22914 d_vendorscript='$d_vendorscript'
22915 d_vfork='$d_vfork'
22916 d_void_closedir='$d_void_closedir'
22917 d_voidsig='$d_voidsig'
22918 d_voidtty='$d_voidtty'
22919 d_volatile='$d_volatile'
22920 d_vprintf='$d_vprintf'
22921 d_vsnprintf='$d_vsnprintf'
22922 d_wait4='$d_wait4'
22923 d_waitpid='$d_waitpid'
22924 d_wcstombs='$d_wcstombs'
22925 d_wctomb='$d_wctomb'
22926 d_writev='$d_writev'
22927 d_xenix='$d_xenix'
22928 date='$date'
22929 db_hashtype='$db_hashtype'
22930 db_prefixtype='$db_prefixtype'
22931 db_version_major='$db_version_major'
22932 db_version_minor='$db_version_minor'
22933 db_version_patch='$db_version_patch'
22934 defvoidused='$defvoidused'
22935 direntrytype='$direntrytype'
22936 dlext='$dlext'
22937 dlsrc='$dlsrc'
22938 doublesize='$doublesize'
22939 drand01='$drand01'
22940 drand48_r_proto='$drand48_r_proto'
22941 dtrace='$dtrace'
22942 dynamic_ext='$dynamic_ext'
22943 eagain='$eagain'
22944 ebcdic='$ebcdic'
22945 echo='$echo'
22946 egrep='$egrep'
22947 emacs='$emacs'
22948 endgrent_r_proto='$endgrent_r_proto'
22949 endhostent_r_proto='$endhostent_r_proto'
22950 endnetent_r_proto='$endnetent_r_proto'
22951 endprotoent_r_proto='$endprotoent_r_proto'
22952 endpwent_r_proto='$endpwent_r_proto'
22953 endservent_r_proto='$endservent_r_proto'
22954 eunicefix='$eunicefix'
22955 exe_ext='$exe_ext'
22956 expr='$expr'
22957 extensions='$extensions'
22958 extern_C='$extern_C'
22959 extras='$extras'
22960 fflushNULL='$fflushNULL'
22961 fflushall='$fflushall'
22962 find='$find'
22963 firstmakefile='$firstmakefile'
22964 flex='$flex'
22965 fpossize='$fpossize'
22966 fpostype='$fpostype'
22967 freetype='$freetype'
22968 from='$from'
22969 full_ar='$full_ar'
22970 full_csh='$full_csh'
22971 full_sed='$full_sed'
22972 gccansipedantic='$gccansipedantic'
22973 gccosandvers='$gccosandvers'
22974 gccversion='$gccversion'
22975 getgrent_r_proto='$getgrent_r_proto'
22976 getgrgid_r_proto='$getgrgid_r_proto'
22977 getgrnam_r_proto='$getgrnam_r_proto'
22978 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22979 gethostbyname_r_proto='$gethostbyname_r_proto'
22980 gethostent_r_proto='$gethostent_r_proto'
22981 getlogin_r_proto='$getlogin_r_proto'
22982 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22983 getnetbyname_r_proto='$getnetbyname_r_proto'
22984 getnetent_r_proto='$getnetent_r_proto'
22985 getprotobyname_r_proto='$getprotobyname_r_proto'
22986 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22987 getprotoent_r_proto='$getprotoent_r_proto'
22988 getpwent_r_proto='$getpwent_r_proto'
22989 getpwnam_r_proto='$getpwnam_r_proto'
22990 getpwuid_r_proto='$getpwuid_r_proto'
22991 getservbyname_r_proto='$getservbyname_r_proto'
22992 getservbyport_r_proto='$getservbyport_r_proto'
22993 getservent_r_proto='$getservent_r_proto'
22994 getspnam_r_proto='$getspnam_r_proto'
22995 gidformat='$gidformat'
22996 gidsign='$gidsign'
22997 gidsize='$gidsize'
22998 gidtype='$gidtype'
22999 glibpth='$glibpth'
23000 gmake='$gmake'
23001 gmtime_r_proto='$gmtime_r_proto'
23002 gnulibc_version='$gnulibc_version'
23003 grep='$grep'
23004 groupcat='$groupcat'
23005 groupstype='$groupstype'
23006 gzip='$gzip'
23007 h_fcntl='$h_fcntl'
23008 h_sysfile='$h_sysfile'
23009 hint='$hint'
23010 hostcat='$hostcat'
23011 html1dir='$html1dir'
23012 html1direxp='$html1direxp'
23013 html3dir='$html3dir'
23014 html3direxp='$html3direxp'
23015 i16size='$i16size'
23016 i16type='$i16type'
23017 i32size='$i32size'
23018 i32type='$i32type'
23019 i64size='$i64size'
23020 i64type='$i64type'
23021 i8size='$i8size'
23022 i8type='$i8type'
23023 i_arpainet='$i_arpainet'
23024 i_assert='$i_assert'
23025 i_bsdioctl='$i_bsdioctl'
23026 i_crypt='$i_crypt'
23027 i_db='$i_db'
23028 i_dbm='$i_dbm'
23029 i_dirent='$i_dirent'
23030 i_dld='$i_dld'
23031 i_dlfcn='$i_dlfcn'
23032 i_fcntl='$i_fcntl'
23033 i_float='$i_float'
23034 i_fp='$i_fp'
23035 i_fp_class='$i_fp_class'
23036 i_gdbm='$i_gdbm'
23037 i_gdbm_ndbm='$i_gdbm_ndbm'
23038 i_gdbmndbm='$i_gdbmndbm'
23039 i_grp='$i_grp'
23040 i_ieeefp='$i_ieeefp'
23041 i_inttypes='$i_inttypes'
23042 i_langinfo='$i_langinfo'
23043 i_libutil='$i_libutil'
23044 i_limits='$i_limits'
23045 i_locale='$i_locale'
23046 i_machcthr='$i_machcthr'
23047 i_malloc='$i_malloc'
23048 i_mallocmalloc='$i_mallocmalloc'
23049 i_math='$i_math'
23050 i_memory='$i_memory'
23051 i_mntent='$i_mntent'
23052 i_ndbm='$i_ndbm'
23053 i_netdb='$i_netdb'
23054 i_neterrno='$i_neterrno'
23055 i_netinettcp='$i_netinettcp'
23056 i_niin='$i_niin'
23057 i_poll='$i_poll'
23058 i_prot='$i_prot'
23059 i_pthread='$i_pthread'
23060 i_pwd='$i_pwd'
23061 i_rpcsvcdbm='$i_rpcsvcdbm'
23062 i_sfio='$i_sfio'
23063 i_sgtty='$i_sgtty'
23064 i_shadow='$i_shadow'
23065 i_socks='$i_socks'
23066 i_stdarg='$i_stdarg'
23067 i_stddef='$i_stddef'
23068 i_stdlib='$i_stdlib'
23069 i_string='$i_string'
23070 i_sunmath='$i_sunmath'
23071 i_sysaccess='$i_sysaccess'
23072 i_sysdir='$i_sysdir'
23073 i_sysfile='$i_sysfile'
23074 i_sysfilio='$i_sysfilio'
23075 i_sysin='$i_sysin'
23076 i_sysioctl='$i_sysioctl'
23077 i_syslog='$i_syslog'
23078 i_sysmman='$i_sysmman'
23079 i_sysmode='$i_sysmode'
23080 i_sysmount='$i_sysmount'
23081 i_sysndir='$i_sysndir'
23082 i_sysparam='$i_sysparam'
23083 i_syspoll='$i_syspoll'
23084 i_sysresrc='$i_sysresrc'
23085 i_syssecrt='$i_syssecrt'
23086 i_sysselct='$i_sysselct'
23087 i_syssockio='$i_syssockio'
23088 i_sysstat='$i_sysstat'
23089 i_sysstatfs='$i_sysstatfs'
23090 i_sysstatvfs='$i_sysstatvfs'
23091 i_systime='$i_systime'
23092 i_systimek='$i_systimek'
23093 i_systimes='$i_systimes'
23094 i_systypes='$i_systypes'
23095 i_sysuio='$i_sysuio'
23096 i_sysun='$i_sysun'
23097 i_sysutsname='$i_sysutsname'
23098 i_sysvfs='$i_sysvfs'
23099 i_syswait='$i_syswait'
23100 i_termio='$i_termio'
23101 i_termios='$i_termios'
23102 i_time='$i_time'
23103 i_unistd='$i_unistd'
23104 i_ustat='$i_ustat'
23105 i_utime='$i_utime'
23106 i_values='$i_values'
23107 i_varargs='$i_varargs'
23108 i_varhdr='$i_varhdr'
23109 i_vfork='$i_vfork'
23110 ignore_versioned_solibs='$ignore_versioned_solibs'
23111 inc_version_list='$inc_version_list'
23112 inc_version_list_init='$inc_version_list_init'
23113 incpath='$incpath'
23114 inews='$inews'
23115 initialinstalllocation='$initialinstalllocation'
23116 installarchlib='$installarchlib'
23117 installbin='$installbin'
23118 installhtml1dir='$installhtml1dir'
23119 installhtml3dir='$installhtml3dir'
23120 installman1dir='$installman1dir'
23121 installman3dir='$installman3dir'
23122 installprefix='$installprefix'
23123 installprefixexp='$installprefixexp'
23124 installprivlib='$installprivlib'
23125 installscript='$installscript'
23126 installsitearch='$installsitearch'
23127 installsitebin='$installsitebin'
23128 installsitehtml1dir='$installsitehtml1dir'
23129 installsitehtml3dir='$installsitehtml3dir'
23130 installsitelib='$installsitelib'
23131 installsiteman1dir='$installsiteman1dir'
23132 installsiteman3dir='$installsiteman3dir'
23133 installsitescript='$installsitescript'
23134 installstyle='$installstyle'
23135 installusrbinperl='$installusrbinperl'
23136 installvendorarch='$installvendorarch'
23137 installvendorbin='$installvendorbin'
23138 installvendorhtml1dir='$installvendorhtml1dir'
23139 installvendorhtml3dir='$installvendorhtml3dir'
23140 installvendorlib='$installvendorlib'
23141 installvendorman1dir='$installvendorman1dir'
23142 installvendorman3dir='$installvendorman3dir'
23143 installvendorscript='$installvendorscript'
23144 intsize='$intsize'
23145 issymlink='$issymlink'
23146 ivdformat='$ivdformat'
23147 ivsize='$ivsize'
23148 ivtype='$ivtype'
23149 known_extensions='$known_extensions'
23150 ksh='$ksh'
23151 ld='$ld'
23152 lddlflags='$lddlflags'
23153 ldflags='$ldflags'
23154 ldflags_uselargefiles='$ldflags_uselargefiles'
23155 ldlibpthname='$ldlibpthname'
23156 less='$less'
23157 lib_ext='$lib_ext'
23158 libc='$libc'
23159 libperl='$libperl'
23160 libpth='$libpth'
23161 libs='$libs'
23162 libsdirs='$libsdirs'
23163 libsfiles='$libsfiles'
23164 libsfound='$libsfound'
23165 libspath='$libspath'
23166 libswanted='$libswanted'
23167 libswanted_uselargefiles='$libswanted_uselargefiles'
23168 line='$line'
23169 lint='$lint'
23170 lkflags='$lkflags'
23171 ln='$ln'
23172 lns='$lns'
23173 localtime_r_proto='$localtime_r_proto'
23174 locincpth='$locincpth'
23175 loclibpth='$loclibpth'
23176 longdblsize='$longdblsize'
23177 longlongsize='$longlongsize'
23178 longsize='$longsize'
23179 lp='$lp'
23180 lpr='$lpr'
23181 ls='$ls'
23182 lseeksize='$lseeksize'
23183 lseektype='$lseektype'
23184 mad='$mad'
23185 madlyh='$madlyh'
23186 madlyobj='$madlyobj'
23187 madlysrc='$madlysrc'
23188 mail='$mail'
23189 mailx='$mailx'
23190 make='$make'
23191 make_set_make='$make_set_make'
23192 mallocobj='$mallocobj'
23193 mallocsrc='$mallocsrc'
23194 malloctype='$malloctype'
23195 man1dir='$man1dir'
23196 man1direxp='$man1direxp'
23197 man1ext='$man1ext'
23198 man3dir='$man3dir'
23199 man3direxp='$man3direxp'
23200 man3ext='$man3ext'
23201 mips_type='$mips_type'
23202 mistrustnm='$mistrustnm'
23203 mkdir='$mkdir'
23204 mmaptype='$mmaptype'
23205 modetype='$modetype'
23206 more='$more'
23207 multiarch='$multiarch'
23208 mv='$mv'
23209 myarchname='$myarchname'
23210 mydomain='$mydomain'
23211 myhostname='$myhostname'
23212 myuname='$myuname'
23213 n='$n'
23214 need_va_copy='$need_va_copy'
23215 netdb_hlen_type='$netdb_hlen_type'
23216 netdb_host_type='$netdb_host_type'
23217 netdb_name_type='$netdb_name_type'
23218 netdb_net_type='$netdb_net_type'
23219 nm='$nm'
23220 nm_opt='$nm_opt'
23221 nm_so_opt='$nm_so_opt'
23222 nonxs_ext='$nonxs_ext'
23223 nroff='$nroff'
23224 nvEUformat='$nvEUformat'
23225 nvFUformat='$nvFUformat'
23226 nvGUformat='$nvGUformat'
23227 nv_overflows_integers_at='$nv_overflows_integers_at'
23228 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23229 nveformat='$nveformat'
23230 nvfformat='$nvfformat'
23231 nvgformat='$nvgformat'
23232 nvsize='$nvsize'
23233 nvtype='$nvtype'
23234 o_nonblock='$o_nonblock'
23235 obj_ext='$obj_ext'
23236 old_pthread_create_joinable='$old_pthread_create_joinable'
23237 optimize='$optimize'
23238 orderlib='$orderlib'
23239 osname='$osname'
23240 osvers='$osvers'
23241 otherlibdirs='$otherlibdirs'
23242 package='$package'
23243 pager='$pager'
23244 passcat='$passcat'
23245 patchlevel='$patchlevel'
23246 path_sep='$path_sep'
23247 perl5='$perl5'
23248 perl='$perl'
23249 perl_patchlevel='$perl_patchlevel'
23250 perl_static_inline='$perl_static_inline'
23251 perladmin='$perladmin'
23252 perllibs='$perllibs'
23253 perlpath='$perlpath'
23254 pg='$pg'
23255 phostname='$phostname'
23256 pidtype='$pidtype'
23257 plibpth='$plibpth'
23258 pmake='$pmake'
23259 pr='$pr'
23260 prefix='$prefix'
23261 prefixexp='$prefixexp'
23262 privlib='$privlib'
23263 privlibexp='$privlibexp'
23264 procselfexe='$procselfexe'
23265 prototype='$prototype'
23266 ptrsize='$ptrsize'
23267 quadkind='$quadkind'
23268 quadtype='$quadtype'
23269 randbits='$randbits'
23270 randfunc='$randfunc'
23271 random_r_proto='$random_r_proto'
23272 randseedtype='$randseedtype'
23273 ranlib='$ranlib'
23274 rd_nodata='$rd_nodata'
23275 readdir64_r_proto='$readdir64_r_proto'
23276 readdir_r_proto='$readdir_r_proto'
23277 revision='$revision'
23278 rm='$rm'
23279 rm_try='$rm_try'
23280 rmail='$rmail'
23281 run='$run'
23282 runnm='$runnm'
23283 sGMTIME_max='$sGMTIME_max'
23284 sGMTIME_min='$sGMTIME_min'
23285 sLOCALTIME_max='$sLOCALTIME_max'
23286 sLOCALTIME_min='$sLOCALTIME_min'
23287 sPRIEUldbl='$sPRIEUldbl'
23288 sPRIFUldbl='$sPRIFUldbl'
23289 sPRIGUldbl='$sPRIGUldbl'
23290 sPRIXU64='$sPRIXU64'
23291 sPRId64='$sPRId64'
23292 sPRIeldbl='$sPRIeldbl'
23293 sPRIfldbl='$sPRIfldbl'
23294 sPRIgldbl='$sPRIgldbl'
23295 sPRIi64='$sPRIi64'
23296 sPRIo64='$sPRIo64'
23297 sPRIu64='$sPRIu64'
23298 sPRIx64='$sPRIx64'
23299 sSCNfldbl='$sSCNfldbl'
23300 sched_yield='$sched_yield'
23301 scriptdir='$scriptdir'
23302 scriptdirexp='$scriptdirexp'
23303 sed='$sed'
23304 seedfunc='$seedfunc'
23305 selectminbits='$selectminbits'
23306 selecttype='$selecttype'
23307 sendmail='$sendmail'
23308 setgrent_r_proto='$setgrent_r_proto'
23309 sethostent_r_proto='$sethostent_r_proto'
23310 setlocale_r_proto='$setlocale_r_proto'
23311 setnetent_r_proto='$setnetent_r_proto'
23312 setprotoent_r_proto='$setprotoent_r_proto'
23313 setpwent_r_proto='$setpwent_r_proto'
23314 setservent_r_proto='$setservent_r_proto'
23315 sh='$sh'
23316 shar='$shar'
23317 sharpbang='$sharpbang'
23318 shmattype='$shmattype'
23319 shortsize='$shortsize'
23320 shrpenv='$shrpenv'
23321 shsharp='$shsharp'
23322 sig_count='$sig_count'
23323 sig_name='$sig_name'
23324 sig_name_init='$sig_name_init'
23325 sig_num='$sig_num'
23326 sig_num_init='$sig_num_init'
23327 sig_size='$sig_size'
23328 signal_t='$signal_t'
23329 sitearch='$sitearch'
23330 sitearchexp='$sitearchexp'
23331 sitebin='$sitebin'
23332 sitebinexp='$sitebinexp'
23333 sitehtml1dir='$sitehtml1dir'
23334 sitehtml1direxp='$sitehtml1direxp'
23335 sitehtml3dir='$sitehtml3dir'
23336 sitehtml3direxp='$sitehtml3direxp'
23337 sitelib='$sitelib'
23338 sitelib_stem='$sitelib_stem'
23339 sitelibexp='$sitelibexp'
23340 siteman1dir='$siteman1dir'
23341 siteman1direxp='$siteman1direxp'
23342 siteman3dir='$siteman3dir'
23343 siteman3direxp='$siteman3direxp'
23344 siteprefix='$siteprefix'
23345 siteprefixexp='$siteprefixexp'
23346 sitescript='$sitescript'
23347 sitescriptexp='$sitescriptexp'
23348 sizesize='$sizesize'
23349 sizetype='$sizetype'
23350 sleep='$sleep'
23351 smail='$smail'
23352 so='$so'
23353 sockethdr='$sockethdr'
23354 socketlib='$socketlib'
23355 socksizetype='$socksizetype'
23356 sort='$sort'
23357 spackage='$spackage'
23358 spitshell='$spitshell'
23359 srand48_r_proto='$srand48_r_proto'
23360 srandom_r_proto='$srandom_r_proto'
23361 src='$src'
23362 ssizetype='$ssizetype'
23363 startperl='$startperl'
23364 startsh='$startsh'
23365 static_ext='$static_ext'
23366 stdchar='$stdchar'
23367 stdio_base='$stdio_base'
23368 stdio_bufsiz='$stdio_bufsiz'
23369 stdio_cnt='$stdio_cnt'
23370 stdio_filbuf='$stdio_filbuf'
23371 stdio_ptr='$stdio_ptr'
23372 stdio_stream_array='$stdio_stream_array'
23373 strerror_r_proto='$strerror_r_proto'
23374 strings='$strings'
23375 submit='$submit'
23376 subversion='$subversion'
23377 sysman='$sysman'
23378 tail='$tail'
23379 tar='$tar'
23380 targetarch='$targetarch'
23381 tbl='$tbl'
23382 tee='$tee'
23383 test='$test'
23384 timeincl='$timeincl'
23385 timetype='$timetype'
23386 tmpnam_r_proto='$tmpnam_r_proto'
23387 to='$to'
23388 touch='$touch'
23389 tr='$tr'
23390 trnl='$trnl'
23391 troff='$troff'
23392 ttyname_r_proto='$ttyname_r_proto'
23393 u16size='$u16size'
23394 u16type='$u16type'
23395 u32size='$u32size'
23396 u32type='$u32type'
23397 u64size='$u64size'
23398 u64type='$u64type'
23399 u8size='$u8size'
23400 u8type='$u8type'
23401 uidformat='$uidformat'
23402 uidsign='$uidsign'
23403 uidsize='$uidsize'
23404 uidtype='$uidtype'
23405 uname='$uname'
23406 uniq='$uniq'
23407 uquadtype='$uquadtype'
23408 use5005threads='$use5005threads'
23409 use64bitall='$use64bitall'
23410 use64bitint='$use64bitint'
23411 usecrosscompile='$usecrosscompile'
23412 usedevel='$usedevel'
23413 usedl='$usedl'
23414 usedtrace='$usedtrace'
23415 usefaststdio='$usefaststdio'
23416 useithreads='$useithreads'
23417 uselargefiles='$uselargefiles'
23418 uselongdouble='$uselongdouble'
23419 usemallocwrap='$usemallocwrap'
23420 usemorebits='$usemorebits'
23421 usemultiplicity='$usemultiplicity'
23422 usemymalloc='$usemymalloc'
23423 usenm='$usenm'
23424 useopcode='$useopcode'
23425 useperlio='$useperlio'
23426 useposix='$useposix'
23427 usereentrant='$usereentrant'
23428 userelocatableinc='$userelocatableinc'
23429 usesfio='$usesfio'
23430 useshrplib='$useshrplib'
23431 usesitecustomize='$usesitecustomize'
23432 usesocks='$usesocks'
23433 usethreads='$usethreads'
23434 usevendorprefix='$usevendorprefix'
23435 usevfork='$usevfork'
23436 usrinc='$usrinc'
23437 uuname='$uuname'
23438 uvXUformat='$uvXUformat'
23439 uvoformat='$uvoformat'
23440 uvsize='$uvsize'
23441 uvtype='$uvtype'
23442 uvuformat='$uvuformat'
23443 uvxformat='$uvxformat'
23444 vaproto='$vaproto'
23445 vendorarch='$vendorarch'
23446 vendorarchexp='$vendorarchexp'
23447 vendorbin='$vendorbin'
23448 vendorbinexp='$vendorbinexp'
23449 vendorhtml1dir='$vendorhtml1dir'
23450 vendorhtml1direxp='$vendorhtml1direxp'
23451 vendorhtml3dir='$vendorhtml3dir'
23452 vendorhtml3direxp='$vendorhtml3direxp'
23453 vendorlib='$vendorlib'
23454 vendorlib_stem='$vendorlib_stem'
23455 vendorlibexp='$vendorlibexp'
23456 vendorman1dir='$vendorman1dir'
23457 vendorman1direxp='$vendorman1direxp'
23458 vendorman3dir='$vendorman3dir'
23459 vendorman3direxp='$vendorman3direxp'
23460 vendorprefix='$vendorprefix'
23461 vendorprefixexp='$vendorprefixexp'
23462 vendorscript='$vendorscript'
23463 vendorscriptexp='$vendorscriptexp'
23464 version='$version'
23465 version_patchlevel_string='$version_patchlevel_string'
23466 versiononly='$versiononly'
23467 vi='$vi'
23468 voidflags='$voidflags'
23469 xlibpth='$xlibpth'
23470 yacc='$yacc'
23471 yaccflags='$yaccflags'
23472 zcat='$zcat'
23473 zip='$zip'
23474 EOT
23475
23476 : add special variables
23477 $test -f $src/patchlevel.h && \
23478 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23479 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23480 echo "PERL_CONFIG_SH=true" >>config.sh
23481
23482 : propagate old symbols
23483 if $test -f UU/config.sh; then
23484         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23485         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23486                 config.sh config.sh UU/oldconfig.sh |\
23487                 $sort | $uniq -u >UU/oldsyms
23488         set X `cat UU/oldsyms`
23489         shift
23490         case $# in
23491         0) ;;
23492         *)
23493                 cat <<EOM
23494 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23495 EOM
23496                 echo ": Variables propagated from previous config.sh file." >>config.sh
23497                 for sym in `cat UU/oldsyms`; do
23498                         echo "    Propagating $hint variable "'$'"$sym..."
23499                         eval 'tmp="$'"${sym}"'"'
23500                         echo "$tmp" | \
23501                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23502                 done
23503                 ;;
23504         esac
23505 fi
23506
23507 : Finish up by extracting the .SH files
23508 case "$alldone" in
23509 exit)
23510         $rm -rf UU
23511         echo "Extraction done."
23512         exit 0
23513         ;;
23514 cont)
23515         ;;
23516 '')
23517         dflt=''
23518         nostick=true
23519         $cat <<EOM
23520
23521 If you'd like to make any changes to the config.sh file before I begin
23522 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23523
23524 EOM
23525         rp="Press return or use a shell escape to edit config.sh:"
23526         . UU/myread
23527         nostick=''
23528         case "$ans" in
23529         '') ;;
23530         *) : in case they cannot read
23531                 sh 1>&4 -c "$ans";;
23532         esac
23533         ;;
23534 esac
23535
23536 : if this fails, just run all the .SH files by hand
23537 . ./config.sh
23538
23539 echo " "
23540 exec 1>&4
23541 pwd=`pwd`
23542 . ./UU/extract
23543 cd "$pwd"
23544
23545 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23546         dflt=y
23547         case "$silent" in
23548         true) ;;
23549         *)
23550                 $cat <<EOM
23551
23552 Now you need to generate make dependencies by running "$make depend".
23553 You might prefer to run it in background: "$make depend > makedepend.out &"
23554 It can take a while, so you might not want to run it right now.
23555
23556 EOM
23557                 ;;
23558         esac
23559         rp="Run $make depend now?"
23560         . UU/myread
23561         case "$ans" in
23562         y*)
23563                 $make depend && echo "Now you must run '$make'."
23564                 ;;
23565         *)
23566                 echo "You must run '$make depend' then '$make'."
23567                 ;;
23568         esac
23569 elif test -f [Mm]akefile; then
23570         echo " "
23571         echo "Now you must run a $make."
23572 else
23573         echo "Configure done."
23574 fi
23575
23576 if $test -f Policy.sh; then
23577     $cat <<EOM
23578
23579 If you compile $package on a different machine or from a different object
23580 directory, copy the Policy.sh file from this object directory to the
23581 new one before you run Configure -- this will help you with most of
23582 the policy defaults.
23583
23584 EOM
23585 fi
23586 if $test -f config.msg; then
23587     echo "Hmm.  I also noted the following information while running:"
23588     echo " "
23589     $cat config.msg >&4
23590     $rm -f config.msg
23591 fi
23592 $rm -f kit*isdone ark*isdone
23593 $rm -rf UU
23594
23595 : End of Configure
23596