This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8_heavy: Allow to be called from regcomp.c
[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 Jan  9 18:25:32 CET 2012 [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_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_msg_ctrunc=''
727 d_msg_dontroute=''
728 d_msg_oob=''
729 d_msg_peek=''
730 d_msg_proxy=''
731 d_oldsock=''
732 d_scm_rights=''
733 d_sin6_scope_id=''
734 d_sockaddr_sa_len=''
735 d_socket=''
736 d_sockpair=''
737 sockethdr=''
738 socketlib=''
739 d_socklen_t=''
740 d_socks5_init=''
741 d_sprintf_returns_strlen=''
742 d_sqrtl=''
743 d_srand48_r=''
744 srand48_r_proto=''
745 d_srandom_r=''
746 srandom_r_proto=''
747 d_sresgproto=''
748 d_sresuproto=''
749 d_statblks=''
750 d_statfs_f_flags=''
751 d_statfs_s=''
752 d_static_inline=''
753 perl_static_inline=''
754 d_fstatvfs=''
755 d_statvfs=''
756 d_stdio_cnt_lval=''
757 d_stdio_ptr_lval=''
758 d_stdio_ptr_lval_nochange_cnt=''
759 d_stdio_ptr_lval_sets_cnt=''
760 d_stdiobase=''
761 d_stdstdio=''
762 stdio_base=''
763 stdio_bufsiz=''
764 stdio_cnt=''
765 stdio_filbuf=''
766 stdio_ptr=''
767 d_index=''
768 d_strchr=''
769 d_strcoll=''
770 d_strctcpy=''
771 d_strerrm=''
772 d_strerror=''
773 d_sysernlst=''
774 d_syserrlst=''
775 d_strerror_r=''
776 strerror_r_proto=''
777 d_strftime=''
778 d_strlcat=''
779 d_strlcpy=''
780 d_strtod=''
781 d_strtol=''
782 d_strtold=''
783 d_strtoll=''
784 d_strtoq=''
785 d_strtoul=''
786 d_strtoull=''
787 d_strtouq=''
788 d_strxfrm=''
789 d_symlink=''
790 d_syscall=''
791 d_syscallproto=''
792 d_sysconf=''
793 d_system=''
794 d_tcgetpgrp=''
795 d_tcsetpgrp=''
796 d_telldirproto=''
797 d_time=''
798 timetype=''
799 d_asctime64=''
800 d_ctime64=''
801 d_difftime64=''
802 d_gmtime64=''
803 d_localtime64=''
804 d_mktime64=''
805 d_timegm=''
806 clocktype=''
807 d_times=''
808 d_tmpnam_r=''
809 tmpnam_r_proto=''
810 d_truncate=''
811 d_ttyname_r=''
812 ttyname_r_proto=''
813 d_tzname=''
814 d_u32align=''
815 d_ualarm=''
816 d_umask=''
817 d_semctl_semid_ds=''
818 d_semctl_semun=''
819 d_union_semun=''
820 d_unordered=''
821 d_unsetenv=''
822 d_usleep=''
823 d_usleepproto=''
824 d_ustat=''
825 d_pseudofork=''
826 d_vfork=''
827 usevfork=''
828 d_voidsig=''
829 signal_t=''
830 d_volatile=''
831 d_charvspr=''
832 d_vprintf=''
833 d_wait4=''
834 d_waitpid=''
835 d_wcstombs=''
836 d_wctomb=''
837 d_writev=''
838 dlext=''
839 bin_ELF=''
840 cccdlflags=''
841 ccdlflags=''
842 dlsrc=''
843 ld=''
844 lddlflags=''
845 usedl=''
846 doublesize=''
847 ebcdic=''
848 fflushNULL=''
849 fflushall=''
850 fpossize=''
851 fpostype=''
852 gccansipedantic=''
853 gccosandvers=''
854 gccversion=''
855 gidformat=''
856 gidsign=''
857 gidsize=''
858 gidtype=''
859 groupstype=''
860 h_fcntl=''
861 h_sysfile=''
862 html1dir=''
863 html1direxp=''
864 installhtml1dir=''
865 html3dir=''
866 html3direxp=''
867 installhtml3dir=''
868 i_arpainet=''
869 i_assert=''
870 i_crypt=''
871 db_hashtype=''
872 db_prefixtype=''
873 db_version_major=''
874 db_version_minor=''
875 db_version_patch=''
876 i_db=''
877 i_dbm=''
878 i_rpcsvcdbm=''
879 d_dirnamlen=''
880 direntrytype=''
881 i_dirent=''
882 i_dld=''
883 i_dlfcn=''
884 i_fcntl=''
885 i_float=''
886 i_fp=''
887 i_fp_class=''
888 i_gdbm=''
889 d_grpasswd=''
890 i_grp=''
891 i_ieeefp=''
892 i_inttypes=''
893 i_langinfo=''
894 i_libutil=''
895 i_limits=''
896 i_locale=''
897 i_machcthr=''
898 i_malloc=''
899 i_mallocmalloc=''
900 i_math=''
901 i_memory=''
902 i_mntent=''
903 d_gdbm_ndbm_h_uses_prototypes=''
904 d_gdbmndbm_h_uses_prototypes=''
905 d_ndbm=''
906 d_ndbm_h_uses_prototypes=''
907 i_gdbm_ndbm=''
908 i_gdbmndbm=''
909 i_ndbm=''
910 i_netdb=''
911 i_neterrno=''
912 i_netinettcp=''
913 i_niin=''
914 i_sysin=''
915 i_poll=''
916 i_prot=''
917 i_pthread=''
918 d_pwage=''
919 d_pwchange=''
920 d_pwclass=''
921 d_pwcomment=''
922 d_pwexpire=''
923 d_pwgecos=''
924 d_pwpasswd=''
925 d_pwquota=''
926 i_pwd=''
927 i_sfio=''
928 i_shadow=''
929 i_socks=''
930 i_stdbool=''
931 i_stddef=''
932 i_stdlib=''
933 i_string=''
934 strings=''
935 i_sunmath=''
936 i_sysaccess=''
937 i_sysdir=''
938 i_sysfile=''
939 d_voidtty=''
940 i_bsdioctl=''
941 i_sysfilio=''
942 i_sysioctl=''
943 i_syssockio=''
944 i_syslog=''
945 i_sysmman=''
946 i_sysmode=''
947 i_sysmount=''
948 i_sysndir=''
949 i_sysparam=''
950 i_syspoll=''
951 i_sysresrc=''
952 i_syssecrt=''
953 i_sysselct=''
954 i_sysstat=''
955 i_sysstatfs=''
956 i_sysstatvfs=''
957 i_systimes=''
958 i_systypes=''
959 i_sysuio=''
960 i_sysun=''
961 i_sysutsname=''
962 i_sysvfs=''
963 i_syswait=''
964 i_sgtty=''
965 i_termio=''
966 i_termios=''
967 d_tm_tm_gmtoff=''
968 d_tm_tm_zone=''
969 i_systime=''
970 i_systimek=''
971 i_time=''
972 timeincl=''
973 i_unistd=''
974 i_ustat=''
975 i_utime=''
976 i_values=''
977 i_stdarg=''
978 i_varargs=''
979 i_varhdr=''
980 i_vfork=''
981 d_inc_version_list=''
982 inc_version_list=''
983 inc_version_list_init=''
984 installprefix=''
985 installprefixexp=''
986 installstyle=''
987 installusrbinperl=''
988 intsize=''
989 longsize=''
990 shortsize=''
991 issymlink=''
992 libc=''
993 ldlibpthname=''
994 libperl=''
995 shrpenv=''
996 useshrplib=''
997 glibpth=''
998 libpth=''
999 loclibpth=''
1000 plibpth=''
1001 xlibpth=''
1002 ignore_versioned_solibs=''
1003 libs=''
1004 libsdirs=''
1005 libsfiles=''
1006 libsfound=''
1007 libspath=''
1008 lns=''
1009 d_PRIEUldbl=''
1010 d_PRIFUldbl=''
1011 d_PRIGUldbl=''
1012 d_PRIeldbl=''
1013 d_PRIfldbl=''
1014 d_PRIgldbl=''
1015 d_SCNfldbl=''
1016 sPRIEUldbl=''
1017 sPRIFUldbl=''
1018 sPRIGUldbl=''
1019 sPRIeldbl=''
1020 sPRIfldbl=''
1021 sPRIgldbl=''
1022 sSCNfldbl=''
1023 lseeksize=''
1024 lseektype=''
1025 mad=''
1026 madlyh=''
1027 madlyobj=''
1028 madlysrc=''
1029 make_set_make=''
1030 d_mymalloc=''
1031 freetype=''
1032 mallocobj=''
1033 mallocsrc=''
1034 malloctype=''
1035 usemallocwrap=''
1036 usemymalloc=''
1037 installman1dir=''
1038 man1dir=''
1039 man1direxp=''
1040 man1ext=''
1041 installman3dir=''
1042 man3dir=''
1043 man3direxp=''
1044 man3ext=''
1045 modetype=''
1046 multiarch=''
1047 mydomain=''
1048 myhostname=''
1049 phostname=''
1050 c=''
1051 n=''
1052 d_eofnblk=''
1053 eagain=''
1054 o_nonblock=''
1055 rd_nodata=''
1056 need_va_copy=''
1057 netdb_hlen_type=''
1058 netdb_host_type=''
1059 netdb_name_type=''
1060 netdb_net_type=''
1061 groupcat=''
1062 hostcat=''
1063 passcat=''
1064 orderlib=''
1065 ranlib=''
1066 d_perl_otherlibdirs=''
1067 otherlibdirs=''
1068 package=''
1069 spackage=''
1070 pager=''
1071 api_revision=''
1072 api_subversion=''
1073 api_version=''
1074 api_versionstring=''
1075 patchlevel=''
1076 perl_patchlevel=''
1077 revision=''
1078 subversion=''
1079 version=''
1080 version_patchlevel_string=''
1081 perl5=''
1082 perladmin=''
1083 perlpath=''
1084 d_nv_preserves_uv=''
1085 d_nv_zero_is_allbits_zero=''
1086 i16size=''
1087 i16type=''
1088 i32size=''
1089 i32type=''
1090 i64size=''
1091 i64type=''
1092 i8size=''
1093 i8type=''
1094 ivsize=''
1095 ivtype=''
1096 nv_overflows_integers_at=''
1097 nv_preserves_uv_bits=''
1098 nvsize=''
1099 nvtype=''
1100 u16size=''
1101 u16type=''
1102 u32size=''
1103 u32type=''
1104 u64size=''
1105 u64type=''
1106 u8size=''
1107 u8type=''
1108 uvsize=''
1109 uvtype=''
1110 ivdformat=''
1111 nvEUformat=''
1112 nvFUformat=''
1113 nvGUformat=''
1114 nveformat=''
1115 nvfformat=''
1116 nvgformat=''
1117 uvXUformat=''
1118 uvoformat=''
1119 uvuformat=''
1120 uvxformat=''
1121 pidtype=''
1122 prefix=''
1123 prefixexp=''
1124 installprivlib=''
1125 privlib=''
1126 privlibexp=''
1127 prototype=''
1128 ptrsize=''
1129 d_PRIXU64=''
1130 d_PRId64=''
1131 d_PRIi64=''
1132 d_PRIo64=''
1133 d_PRIu64=''
1134 d_PRIx64=''
1135 sPRIXU64=''
1136 sPRId64=''
1137 sPRIi64=''
1138 sPRIo64=''
1139 sPRIu64=''
1140 sPRIx64=''
1141 d_quad=''
1142 quadkind=''
1143 quadtype=''
1144 uquadtype=''
1145 drand01=''
1146 randbits=''
1147 randfunc=''
1148 randseedtype=''
1149 seedfunc=''
1150 installscript=''
1151 scriptdir=''
1152 scriptdirexp=''
1153 selectminbits=''
1154 selecttype=''
1155 sh=''
1156 sig_count=''
1157 sig_name=''
1158 sig_name_init=''
1159 sig_num=''
1160 sig_num_init=''
1161 sig_size=''
1162 d_sitearch=''
1163 installsitearch=''
1164 sitearch=''
1165 sitearchexp=''
1166 installsitebin=''
1167 sitebin=''
1168 sitebinexp=''
1169 installsitehtml1dir=''
1170 sitehtml1dir=''
1171 sitehtml1direxp=''
1172 installsitehtml3dir=''
1173 sitehtml3dir=''
1174 sitehtml3direxp=''
1175 installsitelib=''
1176 sitelib=''
1177 sitelib_stem=''
1178 sitelibexp=''
1179 installsiteman1dir=''
1180 siteman1dir=''
1181 siteman1direxp=''
1182 installsiteman3dir=''
1183 siteman3dir=''
1184 siteman3direxp=''
1185 siteprefix=''
1186 siteprefixexp=''
1187 installsitescript=''
1188 sitescript=''
1189 sitescriptexp=''
1190 sizesize=''
1191 sizetype=''
1192 so=''
1193 socksizetype=''
1194 sharpbang=''
1195 shsharp=''
1196 spitshell=''
1197 src=''
1198 ssizetype=''
1199 st_ino_sign=''
1200 st_ino_size=''
1201 startperl=''
1202 startsh=''
1203 stdchar=''
1204 d_stdio_stream_array=''
1205 stdio_stream_array=''
1206 sysman=''
1207 sGMTIME_max=''
1208 sGMTIME_min=''
1209 sLOCALTIME_max=''
1210 sLOCALTIME_min=''
1211 trnl=''
1212 uidformat=''
1213 uidsign=''
1214 uidsize=''
1215 uidtype=''
1216 archname64=''
1217 use64bitall=''
1218 use64bitint=''
1219 dtrace=''
1220 usedtrace=''
1221 usefaststdio=''
1222 usekernprocpathname=''
1223 ccflags_uselargefiles=''
1224 ldflags_uselargefiles=''
1225 libswanted_uselargefiles=''
1226 uselargefiles=''
1227 uselongdouble=''
1228 usemorebits=''
1229 usemultiplicity=''
1230 nm_opt=''
1231 nm_so_opt=''
1232 runnm=''
1233 usenm=''
1234 usensgetexecutablepath=''
1235 useperlio=''
1236 usesocks=''
1237 d_oldpthreads=''
1238 use5005threads=''
1239 useithreads=''
1240 usereentrant=''
1241 usethreads=''
1242 incpath=''
1243 mips_type=''
1244 usrinc=''
1245 vaproto=''
1246 d_vendorarch=''
1247 installvendorarch=''
1248 vendorarch=''
1249 vendorarchexp=''
1250 d_vendorbin=''
1251 installvendorbin=''
1252 vendorbin=''
1253 vendorbinexp=''
1254 installvendorhtml1dir=''
1255 vendorhtml1dir=''
1256 vendorhtml1direxp=''
1257 installvendorhtml3dir=''
1258 vendorhtml3dir=''
1259 vendorhtml3direxp=''
1260 d_vendorlib=''
1261 installvendorlib=''
1262 vendorlib=''
1263 vendorlib_stem=''
1264 vendorlibexp=''
1265 installvendorman1dir=''
1266 vendorman1dir=''
1267 vendorman1direxp=''
1268 installvendorman3dir=''
1269 vendorman3dir=''
1270 vendorman3direxp=''
1271 usevendorprefix=''
1272 vendorprefix=''
1273 vendorprefixexp=''
1274 d_vendorscript=''
1275 installvendorscript=''
1276 vendorscript=''
1277 vendorscriptexp=''
1278 versiononly=''
1279 defvoidused=''
1280 voidflags=''
1281 yacc=''
1282 yaccflags=''
1283 CONFIG=''
1284
1285 : Detect odd OSs
1286 define='define'
1287 undef='undef'
1288 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1289 rmlist=''
1290
1291 : We must find out about Eunice early
1292 eunicefix=':'
1293 if test -f /etc/unixtovms; then
1294         eunicefix=/etc/unixtovms
1295 fi
1296 if test -f /etc/unixtovms.exe; then
1297         eunicefix=/etc/unixtovms.exe
1298 fi
1299
1300 : Set executable suffix now -- needed before hints available
1301 if test -f "/libs/version.library"; then
1302 : Amiga OS
1303     _exe=""
1304 elif test -f "/system/gnu_library/bin/ar.pm"; then
1305 : Stratus VOS
1306     _exe=".pm"
1307 elif test -n "$DJGPP"; then
1308 : DOS DJGPP
1309     _exe=".exe"
1310 elif test -d c:/. -o -n "$is_os2" ; then
1311 : OS/2 or cygwin
1312     _exe=".exe"
1313 fi
1314
1315 groupstype=''
1316 i_whoami=''
1317 : Trailing extension.  Override this in a hint file, if needed.
1318 : Extra object files, if any, needed on this platform.
1319 archobjs=''
1320 archname=''
1321 : Possible local include directories to search.
1322 : Set locincpth to "" in a hint file to defeat local include searches.
1323 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1324 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1325 :
1326 : no include file wanted by default
1327 inclwanted=''
1328
1329 : Enable -DEBUGGING and -DDEBUGGING from the command line
1330 EBUGGING=''
1331 DEBUGGING=''
1332
1333 libnames=''
1334 : change the next line if compiling for Xenix/286 on Xenix/386
1335 xlibpth='/usr/lib/386 /lib/386'
1336 : Possible local library directories to search.
1337 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1338 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1339
1340 : general looking path for locating libraries
1341 glibpth="/lib /usr/lib $xlibpth"
1342 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1343 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1344 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1345 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1346
1347 : Private path used by Configure to find libraries.  Its value
1348 : is prepended to libpth. This variable takes care of special
1349 : machines, like the mips.  Usually, it should be empty.
1350 plibpth=''
1351
1352 : default library list
1353 libswanted=''
1354 : some systems want to use only the non-versioned libso:s
1355 ignore_versioned_solibs=''
1356 : set usethreads on the Configure command line to enable threads.
1357 usereentrant='undef'
1358 : full support for void wanted by default
1359 defvoidused=15
1360
1361 ccname=''
1362 ccversion=''
1363 perllibs=''
1364 : set useposix=false in your hint file to disable the POSIX extension.
1365 useposix=true
1366 : set useopcode=false in your hint file to disable the Opcode extension.
1367 useopcode=true
1368 archname64=''
1369 ccflags_uselargefiles=''
1370 ldflags_uselargefiles=''
1371 libswanted_uselargefiles=''
1372 : set usemultiplicity on the Configure command line to enable multiplicity.
1373 : set usesocks on the Configure command line to enable socks.
1374 : List of libraries we want.
1375 : If anyone needs extra -lxxx, put those in a hint file.
1376 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1377 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1378 : We probably want to search /usr/shlib before most other libraries.
1379 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1380 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1381 glibpth="/usr/shlib $glibpth"
1382 : Do not use vfork unless overridden by a hint file.
1383 usevfork=false
1384
1385 : Find the basic shell for Bourne shell scripts
1386 case "$sh" in
1387 '')
1388         case "$SYSTYPE" in
1389         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1390         *) xxx='/bin/sh';;
1391         esac
1392         if test -f "$xxx"; then
1393                 sh="$xxx"
1394         else
1395                 : Build up a list and do a single loop so we can 'break' out.
1396                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1397                 for xxx in sh bash ksh pdksh ash; do
1398                         for p in $pth; do
1399                                 try="$try ${p}/${xxx}"
1400                         done
1401                 done
1402                 for xxx in $try; do
1403                         if test -f "$xxx"; then
1404                                 sh="$xxx";
1405                                 break
1406                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1407                                 sh="$xxx";
1408                                 break
1409                         elif test -f "$xxx.exe"; then
1410                                 sh="$xxx";
1411                                 break
1412                         fi
1413                 done
1414         fi
1415         ;;
1416 esac
1417
1418 case "$sh" in
1419 '')     cat >&2 <<EOM
1420 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1421
1422 Usually it's in /bin/sh.  How did you even get this far?
1423 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1424 we'll try to straighten this all out.
1425 EOM
1426         exit 1
1427         ;;
1428 esac
1429
1430 : see if sh knows # comments
1431 if `$sh -c '#' >/dev/null 2>&1`; then
1432         shsharp=true
1433         spitshell=cat
1434         xcat=/bin/cat
1435         test -f $xcat$_exe || xcat=/usr/bin/cat
1436         if test ! -f $xcat$_exe; then
1437                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1438                         if test -f $p/cat$_exe; then
1439                                 xcat=$p/cat
1440                                 break
1441                         fi
1442                 done
1443                 if test ! -f $xcat$_exe; then
1444                         echo "Can't find cat anywhere!"
1445                         exit 1
1446                 fi
1447         fi
1448         echo "#!$xcat" >sharp
1449         $eunicefix sharp
1450         chmod +x sharp
1451         ./sharp > today 2>/dev/null
1452         if test -s today; then
1453                 sharpbang='#!'
1454         else
1455                 echo "#! $xcat" > sharp
1456                 $eunicefix sharp
1457                 chmod +x sharp
1458                 ./sharp > today 2>/dev/null
1459                 if test -s today; then
1460                         sharpbang='#! '
1461                 else
1462                         sharpbang=': use '
1463                 fi
1464         fi
1465 else
1466         echo " "
1467         echo "Your $sh doesn't grok # comments--I will strip them later on."
1468         shsharp=false
1469         cd ..
1470         echo "exec grep -v '^[  ]*#'" >spitshell
1471         chmod +x spitshell
1472         $eunicefix spitshell
1473         spitshell=`pwd`/spitshell
1474         cd UU
1475         echo "I presume that if # doesn't work, #! won't work either!"
1476         sharpbang=': use '
1477 fi
1478 rm -f sharp today
1479
1480 : figure out how to guarantee sh startup
1481 case "$startsh" in
1482 '') startsh=${sharpbang}${sh} ;;
1483 *)
1484 esac
1485 cat >sharp <<EOSS
1486 $startsh
1487 set abc
1488 test "$?abc" != 1
1489 EOSS
1490
1491 chmod +x sharp
1492 $eunicefix sharp
1493 if ./sharp; then
1494         : echo "Yup, it does."
1495 else
1496         echo "Hmm... '$startsh' does not guarantee sh startup..."
1497         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1498 fi
1499 rm -f sharp
1500
1501 : Save command line options in file UU/cmdline.opt for later use in
1502 : generating config.sh.
1503 cat > cmdline.opt <<EOSH
1504 : Configure command line arguments.
1505 config_arg0='$0'
1506 config_args='$*'
1507 config_argc=$#
1508 EOSH
1509 argn=1
1510 args_exp=''
1511 args_sep=''
1512 for arg in "$@"; do
1513         cat >>cmdline.opt <<EOSH
1514 config_arg$argn='$arg'
1515 EOSH
1516         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1517 $arg
1518 EOC
1519         arg_exp=`cat cmdl.opt`
1520         args_exp="$args_exp$args_sep'$arg_exp'"
1521         argn=`expr $argn + 1`
1522         args_sep=' '
1523 done
1524 rm -f cmdl.opt
1525
1526 : produce awk script to parse command line options
1527 cat >options.awk <<'EOF'
1528 BEGIN {
1529         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1530
1531         len = length(optstr);
1532         for (i = 1; i <= len; i++) {
1533                 c = substr(optstr, i, 1);
1534                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1535                 if (a == ":") {
1536                         arg[c] = 1;
1537                         i++;
1538                 }
1539                 opt[c] = 1;
1540         }
1541 }
1542 {
1543         expect = 0;
1544         str = $0;
1545         if (substr(str, 1, 1) != "-") {
1546                 printf("'%s'\n", str);
1547                 next;
1548         }
1549         len = length($0);
1550         for (i = 2; i <= len; i++) {
1551                 c = substr(str, i, 1);
1552                 if (!opt[c]) {
1553                         printf("-%s\n", substr(str, i));
1554                         next;
1555                 }
1556                 printf("-%s\n", c);
1557                 if (arg[c]) {
1558                         if (i < len)
1559                                 printf("'%s'\n", substr(str, i + 1));
1560                         else
1561                                 expect = 1;
1562                         next;
1563                 }
1564         }
1565 }
1566 END {
1567         if (expect)
1568                 print "?";
1569 }
1570 EOF
1571
1572 : process the command line options
1573 set X `for arg in "$@"; do echo "X$arg"; done |
1574         sed -e s/X// | awk -f options.awk`
1575 eval "set $*"
1576 shift
1577 rm -f options.awk
1578
1579 : set up default values
1580 fastread=''
1581 reuseval=false
1582 config_sh=''
1583 alldone=''
1584 error=''
1585 silent=''
1586 extractsh=''
1587 override=''
1588 knowitall=''
1589 rm -f optdef.sh posthint.sh
1590 cat >optdef.sh <<EOS
1591 $startsh
1592 EOS
1593
1594
1595 : option parsing
1596 while test $# -gt 0; do
1597         case "$1" in
1598         -d) shift; fastread=yes;;
1599         -e) shift; alldone=cont;;
1600         -f)
1601                 shift
1602                 cd ..
1603                 if test -r "$1"; then
1604                         config_sh="$1"
1605                 else
1606                         echo "$me: cannot read config file $1." >&2
1607                         error=true
1608                 fi
1609                 cd UU
1610                 shift;;
1611         --help|\
1612         -h) shift; error=true;;
1613         -r) shift; reuseval=true;;
1614         -s) shift; silent=true; realsilent=true;;
1615         -E) shift; alldone=exit;;
1616         -K) shift; knowitall=true;;
1617         -O) shift; override=true;;
1618         -S) shift; silent=true; extractsh=true;;
1619         -D)
1620                 shift
1621                 case "$1" in
1622                 *=)
1623                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1624                         echo "$me: ignoring -D $1" >&2
1625                         ;;
1626                 *=*) echo "$1" | \
1627                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1628                 *) echo "$1='define'" >> optdef.sh;;
1629                 esac
1630                 shift
1631                 ;;
1632         -U)
1633                 shift
1634                 case "$1" in
1635                 *=) echo "$1" >> optdef.sh;;
1636                 *=*)
1637                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1638                         echo "$me: ignoring -U $1" >&2
1639                         ;;
1640                 *) echo "$1='undef'" >> optdef.sh;;
1641                 esac
1642                 shift
1643                 ;;
1644         -A)
1645             shift
1646             xxx=''
1647             yyy="$1"
1648             zzz=''
1649             uuu=undef
1650             case "$yyy" in
1651             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1652                  case "$zzz" in
1653                  *:*) zzz='' ;;
1654                  *)   xxx=append
1655                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1656                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1657                  esac
1658                  ;;
1659             esac
1660             case "$xxx" in
1661             '')  case "$yyy" in
1662                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1663                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1664                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1665                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1666                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1667                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1668                  esac
1669                  ;;
1670             esac
1671             case "$xxx" in
1672             append)
1673                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1674             clear)
1675                 echo "$yyy=''"                  >> posthint.sh ;;
1676             define)
1677                 case "$zzz" in
1678                 '') zzz=define ;;
1679                 esac
1680                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1681             eval)
1682                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1683             prepend)
1684                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1685             undef)
1686                 case "$zzz" in
1687                 '') zzz="$uuu" ;;
1688                 esac
1689                 echo "$yyy=$zzz"                >> posthint.sh ;;
1690             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1691             esac
1692             shift
1693             ;;
1694         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1695             exit 0;;
1696         --) break;;
1697         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1698         *) break;;
1699         esac
1700 done
1701
1702 case "$error" in
1703 true)
1704         cat >&2 <<EOM
1705 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1706                  [-U symbol] [-U symbol=] [-A command:symbol...]
1707   -d : use defaults for all answers.
1708   -e : go on without questioning past the production of config.sh.
1709   -f : specify an alternate default configuration file.
1710   -h : print this help message and exit (with an error status).
1711   -r : reuse C symbols value if possible (skips costly nm extraction).
1712   -s : silent mode, only echoes questions and essential information.
1713   -D : define symbol to have some value:
1714          -D symbol         symbol gets the value 'define'
1715          -D symbol=value   symbol gets the value 'value'
1716        common used examples (see INSTALL for more info):
1717          -Duse64bitint            use 64bit integers
1718          -Duse64bitall            use 64bit integers and pointers
1719          -Dusethreads             use thread support
1720          -Dinc_version_list=none  do not include older perl trees in @INC
1721          -DEBUGGING=none          DEBUGGING options
1722          -Dcc=gcc                 choose your compiler
1723          -Dprefix=/opt/perl5      choose your destination
1724   -E : stop at the end of questions, after having produced config.sh.
1725   -K : do not use unless you know what you are doing.
1726   -O : let -D and -U override definitions from loaded configuration file.
1727   -S : perform variable substitutions on all .SH files (can mix with -f)
1728   -U : undefine symbol:
1729          -U symbol    symbol gets the value 'undef'
1730          -U symbol=   symbol gets completely empty
1731        e.g.:  -Uversiononly
1732   -A : manipulate symbol after the platform specific hints have been applied:
1733          -A append:symbol=value   append value to symbol
1734          -A symbol=value          like append:, but with a separating space
1735          -A define:symbol=value   define symbol to have value
1736          -A clear:symbol          define symbol to be ''
1737          -A define:symbol         define symbol to be 'define'
1738          -A eval:symbol=value     define symbol to be eval of value
1739          -A prepend:symbol=value  prepend value to symbol
1740          -A undef:symbol          define symbol to be 'undef'
1741          -A undef:symbol=         define symbol to be ''
1742        e.g.:  -A prepend:libswanted='cl pthread '
1743               -A ccflags=-DSOME_MACRO
1744   -V : print version number and exit (with a zero status).
1745 EOM
1746         exit 1
1747         ;;
1748 esac
1749
1750 : Sanity checks
1751 case "$fastread$alldone" in
1752 yescont|yesexit) ;;
1753 *)
1754         case "$extractsh" in
1755         true) ;;
1756         *)
1757                 if test ! -t 0; then
1758                         echo "Say 'sh Configure', not 'sh <Configure'"
1759                         exit 1
1760                 fi
1761                 ;;
1762         esac
1763         ;;
1764 esac
1765
1766 exec 4>&1
1767 case "$silent" in
1768 true) exec 1>/dev/null;;
1769 esac
1770
1771 : run the defines and the undefines, if any, but leave the file out there...
1772 touch optdef.sh
1773 . ./optdef.sh
1774 : create the posthint manipulation script and leave the file out there...
1775 touch posthint.sh
1776
1777 : set package name
1778 package='perl5'
1779 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1780 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1781 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1782 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1783 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1784 esac
1785
1786 : Some greps do not return status, grrr.
1787 echo "grimblepritz" >grimble
1788 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1789         contains=contains
1790 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1791         contains=grep
1792 else
1793         contains=contains
1794 fi
1795 rm -f grimble
1796 : the following should work in any shell
1797 case "$contains" in
1798 contains*)
1799         echo " "
1800         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1801         cat >contains <<'EOSS'
1802 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1803 EOSS
1804 chmod +x contains
1805 esac
1806
1807 : Find the path to the source tree
1808 case "$src" in
1809 '') case "$0" in
1810     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1811          case "$src" in
1812          /*)    ;;
1813          .)     ;;
1814          *)     src=`cd ../$src && pwd` ;;
1815          esac
1816          ;;
1817     *)   src='.';;
1818     esac;;
1819 esac
1820 case "$src" in
1821 '')     src=/
1822         rsrc=/
1823         ;;
1824 /*)     rsrc="$src";;
1825 *)      rsrc="../$src";;
1826 esac
1827 if test -f $rsrc/Configure && \
1828         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1829 then
1830    : found it, so we are ok.
1831 else
1832         rsrc=''
1833         for src in . .. ../.. ../../.. ../../../..; do
1834                 if test -f ../$src/Configure && \
1835                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1836                 then
1837                         rsrc=../$src
1838                         break
1839                 fi
1840         done
1841 fi
1842 case "$rsrc" in
1843 '')
1844         cat <<EOM >&4
1845
1846 Sorry, I can't seem to locate the source dir for $package.  Please start
1847 Configure with an explicit path -- i.e. /some/path/Configure.
1848
1849 EOM
1850         exit 1
1851         ;;
1852 ../.)   rsrc='..';;
1853 *)
1854         echo " "
1855         echo "Sources for $package found in \"$src\"." >&4
1856         ;;
1857 esac
1858
1859 : script used to extract .SH files with variable substitutions
1860 cat >extract <<'EOS'
1861 PERL_CONFIG_SH=true
1862 echo "Doing variable substitutions on .SH files..."
1863 if test -f MANIFEST; then
1864         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1865 else
1866         echo "(Looking for .SH files under the source directory.)"
1867         set x `(cd "$src"; find . -name "*.SH" -print)`
1868 fi
1869 shift
1870 case $# in
1871 0) set x `(cd "$src"; echo *.SH)`; shift;;
1872 esac
1873 if test ! -f "$src/$1"; then
1874         shift
1875 fi
1876 mkdir_p='
1877 name=$1;
1878 create="";
1879 while test $name; do
1880         if test ! -d "$name"; then
1881                 create="$name $create";
1882                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1883                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1884         else
1885                 name="";
1886         fi;
1887 done;
1888 for file in $create; do
1889         mkdir $file;
1890 done
1891 '
1892 for file in $*; do
1893         case "$src" in
1894         ".")
1895                 case "$file" in
1896                 */*)
1897                         dir=`expr X$file : 'X\(.*\)/'`
1898                         file=`expr X$file : 'X.*/\(.*\)'`
1899                         (cd "$dir" && . ./$file)
1900                         ;;
1901                 *)
1902                         . ./$file
1903                         ;;
1904                 esac
1905                 ;;
1906         *)
1907                 case "$file" in
1908                 */*)
1909                         dir=`expr X$file : 'X\(.*\)/'`
1910                         file=`expr X$file : 'X.*/\(.*\)'`
1911                         (set x $dir; shift; eval $mkdir_p)
1912                         sh <"$src/$dir/$file"
1913                         ;;
1914                 *)
1915                         sh <"$src/$file"
1916                         ;;
1917                 esac
1918                 ;;
1919         esac
1920 done
1921 if test -f "$src/config_h.SH"; then
1922         if test ! -f config.h; then
1923         : oops, they left it out of MANIFEST, probably, so do it anyway.
1924         . "$src/config_h.SH"
1925         fi
1926 fi
1927 EOS
1928
1929 : extract files and exit if asked to do so
1930 case "$extractsh" in
1931 true)
1932         case "$realsilent" in
1933         true) ;;
1934         *) exec 1>&4;;
1935         esac
1936         case "$config_sh" in
1937         '') config_sh='config.sh';;
1938         esac
1939         echo " "
1940         echo "Fetching answers from $config_sh..."
1941         cd ..
1942         . $config_sh
1943         test "$override" && . ./optdef.sh
1944         echo " "
1945         . UU/extract
1946         rm -rf UU
1947         echo "Extraction done."
1948         exit 0
1949         ;;
1950 esac
1951
1952 : Eunice requires " " instead of "", can you believe it
1953 echo " "
1954 : Here we go...
1955 echo "Beginning of configuration questions for $package."
1956
1957 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1958
1959 : first determine how to suppress newline on echo command
1960 echo " "
1961 echo "Checking echo to see how to suppress newlines..."
1962 (echo "hi there\c" ; echo " ") >.echotmp
1963 if $contains c .echotmp >/dev/null 2>&1 ; then
1964         echo "...using -n."
1965         n='-n'
1966         c=''
1967 else
1968         cat <<'EOM'
1969 ...using \c
1970 EOM
1971         n=''
1972         c='\c'
1973 fi
1974 echo $n "The star should be here-->$c"
1975 echo '*'
1976 rm -f .echotmp
1977
1978 : Now test for existence of everything in MANIFEST
1979 echo " "
1980 if test -f "$rsrc/MANIFEST"; then
1981         echo "First let's make sure your kit is complete.  Checking..." >&4
1982         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1983                 (split -l 50 2>/dev/null || split -50)
1984         rm -f missing
1985         tmppwd=`pwd`
1986         for filelist in x??; do
1987                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1988                         >/dev/null 2>>"$tmppwd/missing")
1989         done
1990         if test -s missing; then
1991                 cat missing >&4
1992                 cat >&4 <<'EOM'
1993
1994 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1995
1996 You have the option of continuing the configuration process, despite the
1997 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1998 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1999 and contact the author (perlbug@perl.org).
2000
2001 EOM
2002                 echo $n "Continue? [n] $c" >&4
2003                 read ans
2004                 case "$ans" in
2005                 y*)
2006                         echo "Continuing..." >&4
2007                         rm -f missing
2008                         ;;
2009                 *)
2010                         echo "ABORTING..." >&4
2011                         kill $$
2012                         ;;
2013                 esac
2014         else
2015                 echo "Looks good..."
2016         fi
2017 else
2018         echo "There is no MANIFEST file.  I hope your kit is complete !"
2019 fi
2020 rm -f missing x??
2021
2022 : Find the appropriate value for a newline for tr
2023 echo " "
2024 if test -n "$DJGPP"; then
2025        trnl='\012'
2026 fi
2027 if test X"$trnl" = X; then
2028         case "`echo foo|tr '\n' x 2>/dev/null`" in
2029         foox) trnl='\n' ;;
2030         esac
2031 fi
2032 if test X"$trnl" = X; then
2033         case "`echo foo|tr '\012' x 2>/dev/null`" in
2034         foox) trnl='\012' ;;
2035         esac
2036 fi
2037 if test X"$trnl" = X; then
2038        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2039        fooxy) trnl='\n\r' ;;
2040        esac
2041 fi
2042 if test X"$trnl" = X; then
2043         cat <<EOM >&2
2044
2045 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2046
2047 EOM
2048         exit 1
2049 fi
2050
2051 : compute the number of columns on the terminal for proper question formatting
2052 case "$COLUMNS" in
2053 '') COLUMNS='80';;
2054 esac
2055
2056 : set up the echo used in my read
2057 myecho="case \"\$xxxm\" in
2058 '') echo $n \"\$rp $c\" >&4;;
2059 *) case \"\$rp\" in
2060         '') echo $n \"[\$xxxm] $c\";;
2061         *)
2062                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2063                         echo \"\$rp\" >&4
2064                         echo $n \"[\$xxxm] $c\" >&4
2065                 else
2066                         echo $n \"\$rp [\$xxxm] $c\" >&4
2067                 fi
2068                 ;;
2069         esac;;
2070 esac"
2071
2072 : now set up to do reads with possible shell escape and default assignment
2073 cat <<EOSC >myread
2074 $startsh
2075 xxxm=\$dflt
2076 $myecho
2077 ans='!'
2078 case "\$fastread" in
2079 yes) case "\$dflt" in
2080         '') ;;
2081         *) ans='';
2082                 case "\$silent-\$rp" in
2083                 true-) ;;
2084                 *) echo " " >&4;;
2085                 esac;;
2086         esac;;
2087 *) case "\$silent" in
2088         true) case "\$rp" in
2089                 '') ans='';;
2090                 esac;;
2091         esac;;
2092 esac
2093 while expr "X\$ans" : "X!" >/dev/null; do
2094         read answ
2095         set x \$xxxm
2096         shift
2097         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2098         case  "\$answ" in
2099         "!")
2100                 sh 1>&4
2101                 echo " "
2102                 $myecho
2103                 ;;
2104         !*)
2105                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2106                 shift
2107                 sh 1>&4 -c "\$*"
2108                 echo " "
2109                 $myecho
2110                 ;;
2111         "\$ans")
2112                 case "\$ans" in
2113                 \\&*)
2114                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2115                         shift
2116                         case "\$1" in
2117                         -d)
2118                                 fastread=yes
2119                                 echo "(OK, I'll run with -d after this question.)" >&4
2120                                 ;;
2121                         -*)
2122                                 echo "*** Sorry, \$1 not supported yet." >&4
2123                                 ;;
2124                         esac
2125                         $myecho
2126                         ans=!
2127                         ;;
2128                 esac;;
2129         *)
2130                 case "\$aok" in
2131                 y)
2132                         echo "*** Substitution done -- please confirm."
2133                         xxxm="\$ans"
2134                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2135                         xxxm="\$ans"
2136                         ans=!
2137                         ;;
2138                 *)
2139                         echo "*** Error -- try again."
2140                         ans=!
2141                         ;;
2142                 esac
2143                 $myecho
2144                 ;;
2145         esac
2146         case "\$ans\$xxxm\$nostick" in
2147         '')
2148                 ans=!
2149                 $myecho
2150                 ;;
2151         esac
2152 done
2153 case "\$ans" in
2154 '') ans="\$xxxm";;
2155 esac
2156 EOSC
2157
2158 : create .config dir to save info across Configure sessions
2159 test -d ../.config || mkdir ../.config
2160 cat >../.config/README <<EOF
2161 This directory created by Configure to save information that should
2162 persist across sessions for $package.
2163
2164 You may safely delete it if you wish.
2165 EOF
2166
2167 : See if we are using a devel version and want that
2168 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2169 case "$usedevel" in
2170 $define|true|[yY]*)
2171     usedevel="$define" ;;
2172 *) case "$xversion" in
2173    *[13579])
2174         cat >&4 <<EOH
2175 *** WHOA THERE!!! ***
2176
2177     This is an UNSTABLE DEVELOPMENT release.
2178     The version of this $package distribution is $xversion, that is, odd,
2179     (as opposed to even) and that signifies a development release.
2180     If you want a maintenance release, you want an even-numbered version.
2181
2182     Do ***NOT*** install this into production use.
2183     Data corruption and crashes are possible.
2184
2185     It is most seriously suggested that you do not continue any further
2186     unless you want to help in developing and debugging Perl.
2187
2188     If you *still* want to build perl, you can answer 'y' now,
2189     or pass -Dusedevel to Configure.
2190
2191 EOH
2192         rp='Do you really want to continue?'
2193         dflt='n'
2194         . ./myread
2195         case "$ans" in
2196         [yY]) echo >&4 "Okay, continuing."
2197               usedevel="$define" ;;
2198         *) echo >&4 "Okay, bye."
2199            exit 1
2200            ;;
2201         esac
2202         ;;
2203     esac
2204     usedevel="$undef"
2205     ;;
2206 esac
2207 case "$usedevel" in
2208 $define|true|[yY]*)
2209         case "$versiononly" in
2210         '') versiononly="$define" ;;
2211         esac
2212         case "$installusrbinperl" in
2213         '') installusrbinperl="$undef" ;;
2214         esac
2215         ;;
2216 esac
2217
2218 : general instructions
2219 needman=true
2220 firsttime=true
2221 user=`(logname) 2>/dev/null`
2222 case "$user" in
2223 '') user=`whoami 2>&1`;;
2224 esac
2225 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2226         firsttime=false
2227         echo " "
2228         rp='Would you like to see the instructions?'
2229         dflt=n
2230         . ./myread
2231         case "$ans" in
2232         [yY]*) ;;
2233         *) needman=false;;
2234         esac
2235 fi
2236 if $needman; then
2237         cat <<EOH
2238
2239 This installation shell script will examine your system and ask you questions
2240 to determine how the perl5 package should be installed. If you get
2241 stuck on a question, you may use a ! shell escape to start a subshell or
2242 execute a command.  Many of the questions will have default answers in square
2243 brackets; typing carriage return will give you the default.
2244
2245 On some of the questions which ask for file or directory names you are allowed
2246 to use the ~name construct to specify the login directory belonging to "name",
2247 even if you don't have a shell which knows about that.  Questions where this is
2248 allowed will be marked "(~name ok)".
2249
2250 EOH
2251         rp=''
2252         dflt='Type carriage return to continue'
2253         . ./myread
2254         cat <<'EOH'
2255
2256 The prompter used in this script allows you to use shell variables and
2257 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2258 in the default answer, as if the default line was a set of arguments given to a
2259 script shell.  This means you may also use $* to repeat the whole default line,
2260 so you do not have to re-type everything to add something to the default.
2261
2262 Every time there is a substitution, you will have to confirm.  If there is an
2263 error (e.g. an unmatched backtick), the default answer will remain unchanged
2264 and you will be prompted again.
2265
2266 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2267 the questions and use the computed defaults (or the previous answers if there
2268 was already a config.sh file). Type 'Configure -h' for a list of options.
2269 You may also start interactively and then answer '& -d' at any prompt to turn
2270 on the non-interactive behaviour for the remainder of the execution.
2271
2272 EOH
2273         . ./myread
2274         cat <<EOH
2275
2276 Much effort has been expended to ensure that this shell script will run on any
2277 Unix system.  If despite that it blows up on yours, your best bet is to edit
2278 Configure and run it again.  If you can't run Configure for some reason,
2279 you'll have to generate a config.sh file by hand.  Whatever problems you
2280 have, let me (perlbug@perl.org) know how I blew it.
2281
2282 This installation script affects things in two ways:
2283
2284 1) it may do direct variable substitutions on some of the files included
2285    in this kit.
2286 2) it builds a config.h file for inclusion in C programs.  You may edit
2287    any of these files as the need arises after running this script.
2288
2289 If you make a mistake on a question, there is no easy way to back up to it
2290 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2291 files.  Configure will offer to let you do this before it runs the SH files.
2292
2293 EOH
2294         dflt='Type carriage return to continue'
2295         . ./myread
2296         case "$firsttime" in
2297         true) echo $user >>../.config/instruct;;
2298         esac
2299 fi
2300
2301 : find out where common programs are
2302 echo " "
2303 echo "Locating common programs..." >&4
2304 cat <<EOSC >loc
2305 $startsh
2306 case \$# in
2307 0) exit 1;;
2308 esac
2309 thing=\$1
2310 shift
2311 dflt=\$1
2312 shift
2313 for dir in \$*; do
2314         case "\$thing" in
2315         .)
2316         if test -d \$dir/\$thing; then
2317                 echo \$dir
2318                 exit 0
2319         fi
2320         ;;
2321         *)
2322         for thisthing in \$dir/\$thing; do
2323                 : just loop through to pick last item
2324         done
2325         if test -f \$thisthing; then
2326                 echo \$thisthing
2327                 exit 0
2328         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2329                 echo \$thisthing
2330                 exit 0
2331         elif test -f \$dir/\$thing.exe; then
2332                 if test -n "$DJGPP"; then
2333                         echo \$dir/\$thing.exe
2334                 elif test "$eunicefix" != ":"; then
2335                         : on Eunice apparently
2336                         echo \$dir/\$thing
2337                 fi
2338                 exit 0
2339         fi
2340         ;;
2341         esac
2342 done
2343 echo \$dflt
2344 exit 1
2345 EOSC
2346 chmod +x loc
2347 $eunicefix loc
2348 loclist="
2349 awk
2350 cat
2351 chmod
2352 comm
2353 cp
2354 echo
2355 expr
2356 grep
2357 ls
2358 mkdir
2359 rm
2360 sed
2361 sort
2362 touch
2363 tr
2364 uniq
2365 "
2366 trylist="
2367 ar
2368 bison
2369 byacc
2370 cpp
2371 csh
2372 date
2373 egrep
2374 gmake
2375 gzip
2376 less
2377 ln
2378 make
2379 more
2380 nm
2381 nroff
2382 perl
2383 pg
2384 test
2385 uname
2386 zip
2387 "
2388 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2389 pth="$pth /lib /usr/lib"
2390 for file in $loclist; do
2391         eval xxx=\$$file
2392         case "$xxx" in
2393         /*|?:[\\/]*)
2394                 if test -f "$xxx"; then
2395                         : ok
2396                 else
2397                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2398                         xxx=`./loc $file $file $pth`
2399                 fi
2400                 ;;
2401         '') xxx=`./loc $file $file $pth`;;
2402         *) xxx=`./loc $xxx $xxx $pth`;;
2403         esac
2404         eval $file=$xxx$_exe
2405         eval _$file=$xxx
2406         case "$xxx" in
2407         /*)
2408                 echo $file is in $xxx.
2409                 ;;
2410         ?:[\\/]*)
2411                 echo $file is in $xxx.
2412                 ;;
2413         *)
2414                 echo "I don't know where '$file' is, and my life depends on it." >&4
2415                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2416                 exit 1
2417                 ;;
2418         esac
2419 done
2420 echo " "
2421 echo "Don't worry if any of the following aren't found..."
2422 say=offhand
2423 for file in $trylist; do
2424         eval xxx=\$$file
2425         case "$xxx" in
2426         /*|?:[\\/]*)
2427                 if test -f "$xxx"; then
2428                         : ok
2429                 else
2430                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2431                         xxx=`./loc $file $file $pth`
2432                 fi
2433                 ;;
2434         '') xxx=`./loc $file $file $pth`;;
2435         *) xxx=`./loc $xxx $xxx $pth`;;
2436         esac
2437         eval $file=$xxx$_exe
2438         eval _$file=$xxx
2439         case "$xxx" in
2440         /*)
2441                 echo $file is in $xxx.
2442                 ;;
2443         ?:[\\/]*)
2444                 echo $file is in $xxx.
2445                 ;;
2446         *)
2447                 echo "I don't see $file out there, $say."
2448                 say=either
2449                 ;;
2450         esac
2451 done
2452 case "$egrep" in
2453 egrep)
2454         echo "Substituting grep for egrep."
2455         egrep=$grep
2456         _egrep=$grep
2457         ;;
2458 esac
2459 case "$less" in
2460 '')     ;;
2461 *)      if $less -R </dev/null >/dev/null; then
2462                echo "Substituting less -R for less."
2463                less="$less -R"
2464                _less=$less
2465         fi
2466         ;;
2467 esac
2468 case "$ln" in
2469 ln)
2470         echo "Substituting cp for ln."
2471         ln=$cp
2472         _ln=$cp
2473         ;;
2474 esac
2475 case "$make" in
2476 make)
2477         case "$gmake" in
2478         gmake)
2479         echo "I can't find make or gmake, and my life depends on it." >&4
2480         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2481         exit 1
2482         ;;
2483         esac
2484         ;;
2485 esac
2486 case "$gmake" in
2487 gmake)  ;;
2488 *)      # We can't have osname yet.
2489         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2490                 # Assume that gmake, if found, is definitely GNU make
2491                 # and prefer it over the system make.
2492                 echo "Substituting gmake for make."
2493                 make=$gmake
2494                 _make=$gmake
2495         fi
2496         ;;
2497 esac
2498 case "$test" in
2499 test)
2500         echo "Hopefully test is built into your sh."
2501         ;;
2502 *)
2503         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2504                 echo "Using the test built into your sh."
2505                 test=test
2506                 _test=test
2507         fi
2508         ;;
2509 esac
2510 case "$echo" in
2511 echo)
2512         echo "Hopefully echo is built into your sh."
2513         ;;
2514 '') ;;
2515 *)
2516         echo " "
2517 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2518         $echo $n "hi there$c" >foo1
2519         echo $n "hi there$c" >foo2
2520         if cmp foo1 foo2 >/dev/null 2>&1; then
2521                 echo "They are compatible.  In fact, they may be identical."
2522         else
2523                 case "$n" in
2524                 '-n') n='' c='\c';;
2525                 *) n='-n' c='';;
2526                 esac
2527                 cat <<FOO
2528 They are not compatible!  You are probably running ksh on a non-USG system.
2529 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2530 have echo built in and we may have to run some Bourne shell scripts.  That
2531 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2532
2533 FOO
2534                 $echo $n "The star should be here-->$c"
2535                 $echo "*"
2536         fi
2537         $rm -f foo1 foo2
2538         ;;
2539 esac
2540
2541 # This question was auctioned at YAPC::Europe-2007 in Vienna
2542 # I never promised you could answer it. I only auctioned the question.
2543 cat <<FOO
2544 The following message is sponsored by
2545
2546   Dresden.pm<--The stars should be here.
2547
2548 Dear Perl user, system administrator or package
2549 maintainer, the Perl community sends greetings to
2550 you. Do you (emblematical) greet back [Y/n]? n
2551
2552 FOO
2553
2554 : Check what type of C compiler we use
2555 cat <<EOS >trygcc
2556 $startsh
2557 EOS
2558 cat <<'EOSC' >>trygcc
2559 case "$cc" in
2560 '') ;;
2561 *)  $rm -f try try.*
2562     $cat >try.c <<EOM
2563 int main(int argc, char *argv[]) {
2564   return 0;
2565 }
2566 EOM
2567     if $cc -o try $ccflags $ldflags try.c; then
2568        :
2569     else
2570         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2571         despair=yes
2572         trygcc=yes
2573         case "$cc" in
2574         *gcc*) trygcc=no ;;
2575         esac
2576         # Skip this test because it gives a false match on output like:
2577         #    ./trygcc: line 23: cc: command not found
2578         # case "`$cc -v -c try.c 2>&1`" in
2579         # *gcc*) trygcc=no ;;
2580         # esac
2581         if $test X"$trygcc" = Xyes; then
2582             if gcc -o try -c try.c; then
2583                 echo " "
2584                 echo "You seem to have a working gcc, though." >&4
2585                 # Switching compilers may undo the work of hints files.
2586                 # The most common problem is -D_REENTRANT for threads.
2587                 # This heuristic catches that case, but gets false positives
2588                 # if -Dusethreads was not actually specified.  Better to
2589                 # bail out here with a useful message than fail 
2590                 # mysteriously later. Should we perhaps just try to
2591                 # re-invoke Configure -Dcc=gcc config_args ?
2592                 if $test -f usethreads.cbu; then
2593                         $cat >&4 <<EOM 
2594
2595 *** However, any setting of the C compiler flags (e.g. for thread support)
2596 *** will be lost.  It may be necessary for you to restart Configure and
2597 *** add -Dcc=gcc to your Configure command line.
2598
2599 EOM
2600                         rp="Would you like to go ahead and try gcc anyway?"
2601                         dflt=n
2602                 else
2603                         rp="Would you like to use it?"
2604                         dflt=y
2605                 fi
2606                 if $test -f myread; then
2607                     . ./myread
2608                 else
2609                     if $test -f UU/myread; then
2610                         . ./UU/myread
2611                     else
2612                         echo "Cannot find myread, sorry.  Aborting." >&2
2613                         exit 1
2614                     fi
2615                 fi  
2616                 case "$ans" in
2617                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2618                 esac
2619             fi
2620         fi
2621     fi
2622     $rm -f try try.*
2623     ;;
2624 esac
2625 EOSC
2626
2627 cat <<EOS >checkcc
2628 $startsh
2629 EOS
2630 cat <<'EOSC' >>checkcc
2631 case "$cc" in        
2632 '') ;;
2633 *)  $rm -f try try.*              
2634     $cat >try.c <<EOM
2635 int main(int argc, char *argv[]) {
2636   return 0;
2637 }
2638 EOM
2639     if $cc -o try $ccflags $ldflags try.c; then
2640        :
2641     else
2642         if $test X"$despair" = Xyes; then
2643            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2644         fi
2645         $cat >&4 <<EOM         
2646 You need to find a working C compiler.
2647 Either (purchase and) install the C compiler supplied by your OS vendor,
2648 or for a free C compiler try http://gcc.gnu.org/
2649 I cannot continue any further, aborting.
2650 EOM
2651         exit 1
2652     fi
2653     $rm -f try try.*
2654     ;;
2655 esac
2656 EOSC
2657
2658 : determine whether symbolic links are supported
2659 echo " "
2660 $touch blurfl
2661 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2662         echo "Symbolic links are supported." >&4
2663         lns="$ln -s"
2664 else
2665         echo "Symbolic links are NOT supported." >&4
2666         lns="$ln"
2667 fi
2668 $rm -f blurfl sym
2669
2670 : determine whether symbolic links are supported
2671 echo " "
2672 case "$lns" in
2673 *"ln"*" -s")
2674         echo "Checking how to test for symbolic links..." >&4
2675         $lns blurfl sym
2676         if $test "X$issymlink" = X; then
2677                 case "$newsh" in
2678                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2679                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2680                 esac
2681                 if test $? = 0; then
2682                         issymlink="test -h"
2683                 else
2684                         echo "Your builtin 'test -h' may be broken." >&4
2685                         case "$test" in
2686                         /*)     ;;
2687                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2688                                 for p in $pth
2689                                 do
2690                                         if test -f "$p/$test"; then
2691                                                 test="$p/$test"
2692                                                 break
2693                                         fi
2694                                 done
2695                                 ;;
2696                         esac
2697                         case "$test" in
2698                         /*)
2699                                 echo "Trying external '$test -h'." >&4
2700                                 issymlink="$test -h"
2701                                 if $test ! -h sym >/dev/null 2>&1; then
2702                                         echo "External '$test -h' is broken, too." >&4
2703                                         issymlink=''
2704                                 fi
2705                                 ;;
2706                         *)      issymlink='' ;;
2707                         esac
2708                 fi              
2709         fi
2710         if $test "X$issymlink" = X; then
2711                 if $test -L sym 2>/dev/null; then
2712                         issymlink="$test -L"
2713                         echo "The builtin '$test -L' worked." >&4
2714                 fi
2715         fi
2716         if $test "X$issymlink" != X; then
2717                 echo "You can test for symbolic links with '$issymlink'." >&4
2718         else
2719                 echo "I do not know how you can test for symbolic links." >&4
2720         fi
2721         $rm -f blurfl sym
2722         ;;
2723 *)      echo "No symbolic links, so not testing for their testing..." >&4
2724         ;;
2725 esac
2726 echo " "
2727
2728 : Make symlinks util
2729 case "$mksymlinks" in
2730 $define|true|[yY]*)
2731         case "$src" in
2732         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2733                 exit 1
2734                 ;;
2735         *)      case "$lns:$issymlink" in
2736                 *"ln"*" -s:"*"test -"?)
2737                         echo "Creating the symbolic links..." >&4
2738                         echo "(First creating the subdirectories...)" >&4
2739                         cd ..
2740                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2741                                 read directory
2742                                 test -z "$directory" && break
2743                                 mkdir -p $directory
2744                         done
2745                         # Sanity check 1.
2746                         if test ! -d t/base; then
2747                                 echo "Failed to create the subdirectories.  Aborting." >&4
2748                                 exit 1
2749                         fi
2750                         echo "(Then creating the symlinks...)" >&4
2751                         awk '{print $1}' $src/MANIFEST | while true; do
2752                                 read filename
2753                                 test -z "$filename" && break
2754                                 if test -f $filename; then
2755                                         if $issymlink $filename; then
2756                                                 rm -f $filename
2757                                         fi
2758                                 fi
2759                                 if test -f $filename; then
2760                                         echo "$filename already exists, not symlinking."
2761                                 else
2762                                         ln -s $src/$filename $filename
2763                                 fi
2764                         done
2765                         # Sanity check 2.
2766                         if test ! -f t/base/lex.t; then
2767                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2768                                 exit 1
2769                         fi
2770                         cd UU
2771                         ;;
2772                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2773                         ;;
2774                 esac
2775                 ;;
2776         esac
2777         ;;
2778 esac
2779
2780 : Check for Cross-Compilation
2781 case "$usecrosscompile" in
2782 $define|true|[yY]*)
2783         $echo "Cross-compiling..."
2784         croak=''
2785         case "$cc" in
2786         *-*-gcc) # A cross-compiling gcc, probably.
2787             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2788             ar=$targetarch-ar
2789             # leave out ld, choosing it is more complex
2790             nm=$targetarch-nm
2791             ranlib=$targetarch-ranlib
2792             $echo 'extern int foo;' > try.c
2793             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2794             shift
2795             if $test $# -gt 0; then
2796                 incpth="$incpth $*"
2797                 incpth="`$echo $incpth|$sed 's/^ //'`"
2798                 echo "Guessing incpth '$incpth'." >&4
2799                 for i in $*; do
2800                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2801                     if $test -d $j; then
2802                         libpth="$libpth $j"
2803                     fi
2804                 done   
2805                 libpth="`$echo $libpth|$sed 's/^ //'`"
2806                 echo "Guessing libpth '$libpth'." >&4
2807             fi
2808             $rm -f try.c
2809             ;;
2810         esac
2811         case "$targetarch" in
2812         '') echo "Targetarch not defined." >&4; croak=y ;;
2813         *)  echo "Using targetarch $targetarch." >&4 ;;
2814         esac
2815         case "$incpth" in
2816         '') echo "Incpth not defined." >&4; croak=y ;;
2817         *)  echo "Using incpth '$incpth'." >&4 ;;
2818         esac
2819         case "$libpth" in
2820         '') echo "Libpth not defined." >&4; croak=y ;;
2821         *)  echo "Using libpth '$libpth'." >&4 ;;
2822         esac
2823         case "$usrinc" in
2824         '') for i in $incpth; do
2825                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2826                     usrinc=$i
2827                     echo "Guessing usrinc $usrinc." >&4
2828                     break
2829                 fi
2830             done
2831             case "$usrinc" in
2832             '') echo "Usrinc not defined." >&4; croak=y ;;
2833             esac
2834             ;;
2835         *)  echo "Using usrinc $usrinc." >&4 ;;
2836         esac
2837         case "$targethost" in
2838         '') echo "Targethost not defined." >&4; croak=y ;;
2839         *)  echo "Using targethost $targethost." >&4
2840         esac
2841         locincpth=' '
2842         loclibpth=' '
2843         case "$croak" in
2844         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2845         esac
2846         case "$src" in
2847         /*) run=$src/Cross/run
2848             targetmkdir=$src/Cross/mkdir
2849             to=$src/Cross/to
2850             from=$src/Cross/from
2851             ;;
2852         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2853             run=$pwd/Cross/run
2854             targetmkdir=$pwd/Cross/mkdir
2855             to=$pwd/Cross/to
2856             from=$pwd/Cross/from
2857             ;;
2858         esac
2859         case "$targetrun" in
2860         '') targetrun=ssh ;;
2861         esac
2862         case "$targetto" in
2863         '') targetto=scp ;;
2864         esac
2865         case "$targetfrom" in
2866         '') targetfrom=scp ;;
2867         esac
2868         run=$run-$targetrun
2869         to=$to-$targetto
2870         from=$from-$targetfrom
2871         case "$targetdir" in
2872         '')  targetdir=/tmp
2873              echo "Guessing targetdir $targetdir." >&4
2874              ;;
2875         esac
2876         case "$targetuser" in
2877         '')  targetuser=root
2878              echo "Guessing targetuser $targetuser." >&4
2879              ;;
2880         esac
2881         case "$targetfrom" in
2882         scp)    q=-q ;;
2883         *)      q='' ;;
2884         esac
2885         case "$targetrun" in
2886         ssh|rsh)
2887             cat >$run <<EOF
2888 #!/bin/sh
2889 case "\$1" in
2890 -cwd)
2891   shift
2892   cwd=\$1
2893   shift
2894   ;;
2895 esac
2896 case "\$cwd" in
2897 '') cwd=$targetdir ;;
2898 esac
2899 exe=\$1
2900 shift
2901 if $test ! -f \$exe.xok; then
2902   $to \$exe
2903   $touch \$exe.xok
2904 fi
2905 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2906 EOF
2907             ;;
2908         *)  echo "Unknown targetrun '$targetrun'" >&4
2909             exit 1
2910             ;;
2911         esac
2912         case "$targetmkdir" in
2913         */Cross/mkdir)
2914             cat >$targetmkdir <<EOF
2915 #!/bin/sh
2916 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2917 EOF
2918             $chmod a+rx $targetmkdir
2919             ;;
2920         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2921             exit 1
2922             ;;
2923         esac
2924         case "$targetto" in
2925         scp|rcp)
2926             cat >$to <<EOF
2927 #!/bin/sh
2928 for f in \$@
2929 do
2930   case "\$f" in
2931   /*)
2932     $targetmkdir \`dirname \$f\`
2933     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2934     ;;
2935   *)
2936     $targetmkdir $targetdir/\`dirname \$f\`
2937     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2938     ;;
2939   esac
2940 done
2941 exit 0
2942 EOF
2943             ;;
2944         cp) cat >$to <<EOF
2945 #!/bin/sh
2946 for f in \$@
2947 do
2948   case "\$f" in
2949   /*)
2950     $mkdir -p $targetdir/\`dirname \$f\`
2951     $cp \$f $targetdir/\$f || exit 1
2952     ;;
2953   *)
2954     $targetmkdir $targetdir/\`dirname \$f\`
2955     $cp \$f $targetdir/\$f || exit 1
2956     ;;
2957   esac
2958 done
2959 exit 0
2960 EOF
2961             ;;
2962         *)  echo "Unknown targetto '$targetto'" >&4
2963             exit 1
2964             ;;
2965         esac
2966         case "$targetfrom" in
2967         scp|rcp)
2968           cat >$from <<EOF
2969 #!/bin/sh
2970 for f in \$@
2971 do
2972   $rm -f \$f
2973   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2974 done
2975 exit 0
2976 EOF
2977             ;;
2978         cp) cat >$from <<EOF
2979 #!/bin/sh
2980 for f in \$@
2981 do
2982   $rm -f \$f
2983   cp $targetdir/\$f . || exit 1
2984 done
2985 exit 0
2986 EOF
2987             ;;
2988         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2989             exit 1
2990             ;;
2991         esac
2992         if $test ! -f $run; then
2993             echo "Target 'run' script '$run' not found." >&4
2994         else
2995             $chmod a+rx $run
2996         fi
2997         if $test ! -f $to; then
2998             echo "Target 'to' script '$to' not found." >&4
2999         else
3000             $chmod a+rx $to
3001         fi
3002         if $test ! -f $from; then
3003             echo "Target 'from' script '$from' not found." >&4
3004         else
3005             $chmod a+rx $from
3006         fi
3007         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3008             exit 1
3009         fi
3010         cat >&4 <<EOF
3011 Using '$run' for remote execution,
3012 and '$from' and '$to'
3013 for remote file transfer.
3014 EOF
3015         ;;
3016 *)      run=''
3017         to=:
3018         from=:
3019         usecrosscompile='undef'
3020         targetarch=''
3021         ;;
3022 esac
3023
3024 : see whether [:lower:] and [:upper:] are supported character classes
3025 echo " "
3026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3027 ABYZ)
3028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3029         up='[:upper:]'
3030         low='[:lower:]'
3031         ;;
3032 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3033         # (0xd9 and 0xe2), therefore that is a nice testing point.
3034         if test "X$up" = X -o "X$low" = X; then
3035             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3036             rs) up='[A-Z]'
3037                 low='[a-z]'
3038                 ;;
3039             esac
3040         fi
3041         if test "X$up" = X -o "X$low" = X; then
3042             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3043             rs) up='A-Z'
3044                 low='a-z'
3045                 ;;
3046             esac
3047         fi
3048         if test "X$up" = X -o "X$low" = X; then
3049             case "`echo RS | od -x 2>/dev/null`" in
3050             *D9E2*|*d9e2*)
3051                 echo "Hey, this might be EBCDIC." >&4
3052                 if test "X$up" = X -o "X$low" = X; then
3053                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3054                     rs) up='[A-IJ-RS-Z]'
3055                         low='[a-ij-rs-z]'
3056                         ;;
3057                     esac
3058                 fi
3059                 if test "X$up" = X -o "X$low" = X; then
3060                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3061                     rs) up='A-IJ-RS-Z'
3062                         low='a-ij-rs-z'
3063                         ;;
3064                     esac
3065                 fi
3066                 ;;
3067             esac
3068         fi
3069 esac
3070 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3071 rs)
3072     echo "Using $up and $low to convert case." >&4
3073     ;;
3074 *)
3075     echo "I don't know how to translate letters from upper to lower case." >&4
3076     echo "Your tr is not acting any way I know of." >&4
3077     exit 1
3078     ;;
3079 esac
3080 : set up the translation script tr, must be called with ./tr of course
3081 cat >tr <<EOSC
3082 $startsh
3083 case "\$1\$2" in
3084 '[A-Z][a-z]') exec $tr '$up' '$low';;
3085 '[a-z][A-Z]') exec $tr '$low' '$up';;
3086 esac
3087 exec $tr "\$@"
3088 EOSC
3089 chmod +x tr
3090 $eunicefix tr
3091
3092 : Try to determine whether config.sh was made on this system
3093 case "$config_sh" in
3094 '')
3095 myuname=`$uname -a 2>/dev/null`
3096 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3098 # because the A-Z/a-z are not consecutive.
3099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3101 newmyuname="$myuname"
3102 dflt=n
3103 case "$knowitall" in
3104 '')
3105         if test -f ../config.sh; then
3106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3107                         eval "`grep myuname= ../config.sh`"
3108                 fi
3109                 if test "X$myuname" = "X$newmyuname"; then
3110                         dflt=y
3111                 fi
3112         fi
3113         ;;
3114 *) dflt=y;;
3115 esac
3116
3117 : Get old answers from old config file if Configure was run on the
3118 : same system, otherwise use the hints.
3119 hint=default
3120 cd ..
3121 if test -f config.sh; then
3122         echo " "
3123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3124         . UU/myread
3125         case "$ans" in
3126         n*|N*) echo "OK, I'll ignore it."
3127                 mv config.sh config.sh.old
3128                 myuname="$newmyuname"
3129                 ;;
3130         *)  echo "Fetching default answers from your old config.sh file..." >&4
3131                 tmp_n="$n"
3132                 tmp_c="$c"
3133                 tmp_sh="$sh"
3134                 . ./config.sh
3135                 cp config.sh UU
3136                 n="$tmp_n"
3137                 c="$tmp_c"
3138                 : Older versions did not always set $sh.  Catch re-use of such
3139                 : an old config.sh.
3140                 case "$sh" in
3141                 '') sh="$tmp_sh" ;;
3142                 esac
3143                 hint=previous
3144                 ;;
3145         esac
3146 fi
3147 . ./UU/checkcc
3148 if test ! -f config.sh; then
3149         $cat <<EOM
3150
3151 First time through, eh?  I have some defaults handy for some systems
3152 that need some extra help getting the Configure answers right:
3153
3154 EOM
3155         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3156         dflt=''
3157         : Half the following guesses are probably wrong... If you have better
3158         : tests or hints, please send them to perlbug@perl.org
3159         : The metaconfig authors would also appreciate a copy...
3160         $test -f /irix && osname=irix
3161         $test -f /xenix && osname=sco_xenix
3162         $test -f /dynix && osname=dynix
3163         $test -f /dnix && osname=dnix
3164         $test -f /lynx.os && osname=lynxos
3165         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3166         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3167         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3168         $test -f /bin/mips && /bin/mips && osname=mips
3169         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3170                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3171         $test -d /usr/apollo/bin && osname=apollo
3172         $test -f /etc/saf/_sactab && osname=svr4
3173         $test -d /usr/include/minix && osname=minix
3174         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3175         if $test -d /MachTen -o -d /MachTen_Folder; then
3176                 osname=machten
3177                 if $test -x /sbin/version; then
3178                         osvers=`/sbin/version | $awk '{print $2}' |
3179                         $sed -e 's/[A-Za-z]$//'`
3180                 elif $test -x /usr/etc/version; then
3181                         osvers=`/usr/etc/version | $awk '{print $2}' |
3182                         $sed -e 's/[A-Za-z]$//'`
3183                 else
3184                         osvers="$2.$3"
3185                 fi
3186         fi
3187
3188         $test -f /sys/posix.dll &&
3189                 $test -f /usr/bin/what &&
3190                 set X `/usr/bin/what /sys/posix.dll` &&
3191                 $test "$3" = UWIN &&
3192                 osname=uwin &&
3193                 osvers="$5"
3194
3195         if $test -f $uname; then
3196                 set X $myuname
3197                 shift
3198
3199                 case "$5" in
3200                 fps*) osname=fps ;;
3201                 mips*)
3202                         case "$4" in
3203                         umips) osname=umips ;;
3204                         *) osname=mips ;;
3205                         esac;;
3206                 [23]100) osname=mips ;;
3207                 next*) osname=next ;;
3208                 i386*)
3209                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3210                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3211                                 osname='sco'
3212                                 osvers=$tmp
3213                         elif $test -f /etc/kconfig; then
3214                                 osname=isc
3215                                 if test "$lns" = "$ln -s"; then
3216                                         osvers=4
3217                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3218                                         osvers=3
3219                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3220                                         osvers=2
3221                                 fi
3222                         fi
3223                         tmp=''
3224                         ;;
3225                 pc*)
3226                         if test -n "$DJGPP"; then
3227                                 osname=dos
3228                                 osvers=djgpp
3229                         fi
3230                         ;;
3231                 esac
3232
3233                 case "$1" in
3234                 aix) osname=aix
3235                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3236                         case "$tmp" in
3237                         # oslevel can fail with:
3238                         # oslevel: Unable to acquire lock.
3239                         *not\ found) osvers="$4"."$3" ;;
3240                         '<3240'|'<>3240') osvers=3.2.0 ;;
3241                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3242                         '=3250'|'>3250') osvers=3.2.5 ;;
3243                         *) osvers=$tmp;;
3244                         esac
3245                         ;;
3246                 bsd386) osname=bsd386
3247                         osvers=`$uname -r`
3248                         ;;
3249                 cygwin*) osname=cygwin
3250                         osvers="$3"
3251                         ;;
3252                 *dc.osx) osname=dcosx
3253                         osvers="$3"
3254                         ;;
3255                 dnix) osname=dnix
3256                         osvers="$3"
3257                         ;;
3258                 domainos) osname=apollo
3259                         osvers="$3"
3260                         ;;
3261                 dgux)   osname=dgux
3262                         osvers="$3"
3263                         ;;
3264                 dragonfly) osname=dragonfly
3265                         osvers="$3"
3266                         ;;
3267                 dynixptx*) osname=dynixptx
3268                         osvers=`echo "$4"|sed 's/^v//'`
3269                         ;;
3270                 freebsd) osname=freebsd
3271                         osvers="$3" ;;
3272                 genix)  osname=genix ;;
3273                 gnu)    osname=gnu
3274                         osvers="$3" ;;
3275                 hp*)    osname=hpux
3276                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3277                         ;;
3278                 irix*)  osname=irix
3279                         case "$3" in
3280                         4*) osvers=4 ;;
3281                         5*) osvers=5 ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 linux)  osname=linux
3286                         case "$3" in
3287                         *)      osvers="$3" ;;
3288                         esac
3289                         ;;
3290                 MiNT)   osname=mint
3291                         ;;
3292                 netbsd*) osname=netbsd
3293                         osvers="$3"
3294                         ;;
3295                 news-os) osvers="$3"
3296                         case "$3" in
3297                         4*) osname=newsos4 ;;
3298                         *) osname=newsos ;;
3299                         esac
3300                         ;;
3301                 next*) osname=next ;;
3302                 nonstop-ux) osname=nonstopux ;;
3303                 openbsd) osname=openbsd
3304                         osvers="$3"
3305                         ;;
3306                 os2)    osname=os2
3307                         osvers="$4"
3308                         ;;
3309                 POSIX-BC | posix-bc ) osname=posix-bc
3310                         osvers="$3"
3311                         ;;
3312                 powerux | power_ux | powermax_os | powermaxos | \
3313                 powerunix | power_unix) osname=powerux
3314                         osvers="$3"
3315                         ;;
3316                 qnx) osname=qnx
3317                         osvers="$4"
3318                         ;;
3319                 solaris) osname=solaris
3320                         case "$3" in
3321                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3322                         *)      osvers="$3" ;;
3323                         esac
3324                         ;;
3325                 sunos) osname=sunos
3326                         case "$3" in
3327                         5*) osname=solaris
3328                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3329                         *)      osvers="$3" ;;
3330                         esac
3331                         ;;
3332                 titanos) osname=titanos
3333                         case "$3" in
3334                         1*) osvers=1 ;;
3335                         2*) osvers=2 ;;
3336                         3*) osvers=3 ;;
3337                         4*) osvers=4 ;;
3338                         *)      osvers="$3" ;;
3339                         esac
3340                         ;;
3341                 ultrix) osname=ultrix
3342                         osvers="$3"
3343                         ;;
3344                 osf1|mls+)      case "$5" in
3345                                 alpha)
3346                                         osname=dec_osf
3347                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3348                                         case "$osvers" in
3349                                         [1-9].[0-9]*) ;;
3350                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3351                                         esac
3352                                         ;;
3353                         hp*)    osname=hp_osf1  ;;
3354                         mips)   osname=mips_osf1 ;;
3355                         esac
3356                         ;;
3357                 # UnixWare 7.1.2 is known as Open UNIX 8
3358                 openunix|unixware) osname=svr5
3359                         osvers="$4"
3360                         ;;
3361                 uts)    osname=uts
3362                         osvers="$3"
3363                         ;;
3364                 vos) osvers="$3"
3365                         ;;
3366                 $2) case "$osname" in
3367                         *isc*) ;;
3368                         *freebsd*) ;;
3369                         svr*)
3370                                 : svr4.x or possibly later
3371                                 case "svr$3" in
3372                                 ${osname}*)
3373                                         osname=svr$3
3374                                         osvers=$4
3375                                         ;;
3376                                 esac
3377                                 case "$osname" in
3378                                 svr4.0)
3379                                         : Check for ESIX
3380                                         if test -f /stand/boot ; then
3381                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3382                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3383                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3384                                                         if test -n "$isesix"; then
3385                                                                 osname=esix4
3386                                                         fi
3387                                                 fi
3388                                         fi
3389                                         ;;
3390                                 esac
3391                                 ;;
3392                         *)      if test -f /etc/systemid; then
3393                                         osname=sco
3394                                         set `echo $3 | $sed 's/\./ /g'` $4
3395                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3396                                                 osvers=$1.$2.$3
3397                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3398                                                 osvers=$1.$2
3399                                         elif $test -f $src/hints/sco_$1.sh; then
3400                                                 osvers=$1
3401                                         fi
3402                                 else
3403                                         case "$osname" in
3404                                         '') : Still unknown.  Probably a generic Sys V.
3405                                                 osname="sysv"
3406                                                 osvers="$3"
3407                                                 ;;
3408                                         esac
3409                                 fi
3410                                 ;;
3411                         esac
3412                         ;;
3413                 *)      case "$osname" in
3414                         '') : Still unknown.  Probably a generic BSD.
3415                                 osname="$1"
3416                                 osvers="$3"
3417                                 ;;
3418                         esac
3419                         ;;
3420                 esac
3421         else
3422                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3423                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3424                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3425                                 osname=news_os
3426                         fi
3427                         $rm -f UU/kernel.what
3428                 elif test -d c:/. -o -n "$is_os2" ; then
3429                         set X $myuname
3430                         osname=os2
3431                         osvers="$5"
3432                 fi
3433         fi
3434
3435         case "$targetarch" in
3436         '') ;;
3437         *)  hostarch=$osname
3438             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3439             osvers=''
3440             ;;
3441         esac
3442
3443         : Now look for a hint file osname_osvers, unless one has been
3444         : specified already.
3445         case "$hintfile" in
3446         ''|' ')
3447                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3448                 : Also try without trailing minor version numbers.
3449                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3450                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3451                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3452                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3453                 case "$file" in
3454                 '') dflt=none ;;
3455                 *)  case "$osvers" in
3456                         '') dflt=$file
3457                                 ;;
3458                         *)  if $test -f $src/hints/$file.sh ; then
3459                                         dflt=$file
3460                                 elif $test -f $src/hints/$xfile.sh ; then
3461                                         dflt=$xfile
3462                                 elif $test -f $src/hints/$xxfile.sh ; then
3463                                         dflt=$xxfile
3464                                 elif $test -f $src/hints/$xxxfile.sh ; then
3465                                         dflt=$xxxfile
3466                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3467                                         dflt=$xxxxfile
3468                                 elif $test -f "$src/hints/${osname}.sh" ; then
3469                                         dflt="${osname}"
3470                                 else
3471                                         dflt=none
3472                                 fi
3473                                 ;;
3474                         esac
3475                         ;;
3476                 esac
3477                 if $test -f Policy.sh ; then
3478                         case "$dflt" in
3479                         *Policy*) ;;
3480                         none) dflt="Policy" ;;
3481                         *) dflt="Policy $dflt" ;;
3482                         esac
3483                 fi
3484                 ;;
3485         *)
3486                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3487                 ;;
3488         esac
3489
3490         if $test -f Policy.sh ; then
3491                 $cat <<EOM
3492
3493 There's also a Policy hint file available, which should make the
3494 site-specific (policy) questions easier to answer.
3495 EOM
3496
3497         fi
3498
3499         $cat <<EOM
3500
3501 You may give one or more space-separated answers, or "none" if appropriate.
3502 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3503 previous run of Configure, you may specify it as well as or instead of
3504 OS-specific hints.  If hints are provided for your OS, you should use them:
3505 although Perl can probably be built without hints on many platforms, using
3506 hints often improve performance and may enable features that Configure can't
3507 set up on its own. If there are no hints that match your OS, specify "none";
3508 DO NOT give a wrong version or a wrong OS.
3509
3510 EOM
3511
3512         rp="Which of these apply, if any?"
3513         . UU/myread
3514         tans=$ans
3515         for file in $tans; do
3516                 if $test X$file = XPolicy -a -f Policy.sh; then
3517                         . Policy.sh
3518                         $cat Policy.sh >> UU/config.sh
3519                 elif $test -f $src/hints/$file.sh; then
3520                         . $src/hints/$file.sh
3521                         $cat $src/hints/$file.sh >> UU/config.sh
3522                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3523                         : nothing
3524                 else
3525                         : Give one chance to correct a possible typo.
3526                         echo "$file.sh does not exist"
3527                         dflt=$file
3528                         rp="hint to use instead?"
3529                         . UU/myread
3530                         for file in $ans; do
3531                                 if $test -f "$src/hints/$file.sh"; then
3532                                         . $src/hints/$file.sh
3533                                         $cat $src/hints/$file.sh >> UU/config.sh
3534                                 elif $test X$ans = X -o X$ans = Xnone ; then
3535                                         : nothing
3536                                 else
3537                                         echo "$file.sh does not exist -- ignored."
3538                                 fi
3539                         done
3540                 fi
3541         done
3542
3543         hint=recommended
3544         : Remember our hint file for later.
3545         if $test -f "$src/hints/$file.sh" ; then
3546                 hintfile="$file"
3547         else
3548                 hintfile=''
3549         fi
3550 fi
3551 cd UU
3552 ;;
3553 *)
3554         echo " "
3555         echo "Fetching default answers from $config_sh..." >&4
3556         tmp_n="$n"
3557         tmp_c="$c"
3558         cd ..
3559         cp $config_sh config.sh 2>/dev/null
3560         chmod +w config.sh
3561         . ./config.sh
3562         cd UU
3563         cp ../config.sh .
3564         n="$tmp_n"
3565         c="$tmp_c"
3566         hint=previous
3567         ;;
3568 esac
3569 test "$override" && . ./optdef.sh
3570
3571 : Restore computed paths
3572 for file in $loclist $trylist; do
3573         eval $file="\$_$file"
3574 done
3575
3576 cat << EOM
3577
3578 Configure uses the operating system name and version to set some defaults.
3579 The default value is probably right if the name rings a bell. Otherwise,
3580 since spelling matters for me, either accept the default or answer "none"
3581 to leave it blank.
3582
3583 EOM
3584 case "$osname" in
3585         ''|' ')
3586                 case "$hintfile" in
3587                 ''|' '|none) dflt=none ;;
3588                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3589                 esac
3590                 ;;
3591         *) dflt="$osname" ;;
3592 esac
3593 rp="Operating system name?"
3594 . ./myread
3595 case "$ans" in
3596 none)  osname='' ;;
3597 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3598 esac
3599 echo " "
3600 case "$osvers" in
3601         ''|' ')
3602                 case "$hintfile" in
3603                 ''|' '|none) dflt=none ;;
3604                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3605                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3606                         case "$dflt" in
3607                         ''|' ') dflt=none ;;
3608                         esac
3609                         ;;
3610                 esac
3611                 ;;
3612         *) dflt="$osvers" ;;
3613 esac
3614 rp="Operating system version?"
3615 . ./myread
3616 case "$ans" in
3617 none)  osvers='' ;;
3618 *) osvers="$ans" ;;
3619 esac
3620
3621
3622 . ./posthint.sh
3623
3624 : who configured the system
3625 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3626 case "$cf_by" in
3627 "")
3628         cf_by=`(logname) 2>/dev/null`
3629         case "$cf_by" in
3630         "")
3631                 cf_by=`(whoami) 2>/dev/null`
3632                 case "$cf_by" in
3633                 "") cf_by=unknown ;;
3634                 esac ;;
3635         esac ;;
3636 esac
3637
3638 : decide how portable to be.  Allow command line overrides.
3639 case "$d_portable" in
3640 "$undef") ;;
3641 *)      d_portable="$define" ;;
3642 esac
3643
3644 : set up shell script to do ~ expansion
3645 cat >filexp <<EOSS
3646 $startsh
3647 : expand filename
3648 case "\$1" in
3649  \~/*|\~)
3650         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3651         ;;
3652  \~*)
3653         if $test -f /bin/csh; then
3654                 /bin/csh -f -c "glob \$1"
3655                 failed=\$?
3656                 echo ""
3657                 exit \$failed
3658         else
3659                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3660                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3661                 if $test ! -d "\$dir"; then
3662                         me=\`basename \$0\`
3663                         echo "\$me: can't locate home directory for: \$name" >&2
3664                         exit 1
3665                 fi
3666                 case "\$1" in
3667                 */*)
3668                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3669                         ;;
3670                 *)
3671                         echo \$dir
3672                         ;;
3673                 esac
3674         fi
3675         ;;
3676 *)
3677         echo \$1
3678         ;;
3679 esac
3680 EOSS
3681 chmod +x filexp
3682 $eunicefix filexp
3683
3684 : now set up to get a file name
3685 cat <<EOS >getfile
3686 $startsh
3687 EOS
3688 cat <<'EOSC' >>getfile
3689 tilde=''
3690 fullpath=''
3691 already=''
3692 skip=''
3693 none_ok=''
3694 exp_file=''
3695 nopath_ok=''
3696 orig_rp="$rp"
3697 orig_dflt="$dflt"
3698 case "$gfpth" in
3699 '') gfpth='.' ;;
3700 esac
3701
3702 case "$fn" in
3703 *\(*)
3704         : getfile will accept an answer from the comma-separated list
3705         : enclosed in parentheses even if it does not meet other criteria.
3706         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3707         fn=`echo $fn | sed 's/(.*)//'`
3708         ;;
3709 esac
3710
3711 case "$fn" in
3712 *:*)
3713         loc_file=`expr $fn : '.*:\(.*\)'`
3714         fn=`expr $fn : '\(.*\):.*'`
3715         ;;
3716 esac
3717
3718 case "$fn" in
3719 *~*) tilde=true;;
3720 esac
3721 case "$fn" in
3722 */*) fullpath=true;;
3723 esac
3724 case "$fn" in
3725 *+*) skip=true;;
3726 esac
3727 case "$fn" in
3728 *n*) none_ok=true;;
3729 esac
3730 case "$fn" in
3731 *e*) exp_file=true;;
3732 esac
3733 case "$fn" in
3734 *p*) nopath_ok=true;;
3735 esac
3736
3737 case "$fn" in
3738 *f*) type='File';;
3739 *d*) type='Directory';;
3740 *l*) type='Locate';;
3741 esac
3742
3743 what="$type"
3744 case "$what" in
3745 Locate) what='File';;
3746 esac
3747
3748 case "$exp_file" in
3749 '')
3750         case "$d_portable" in
3751         "$define") ;;
3752         *) exp_file=true;;
3753         esac
3754         ;;
3755 esac
3756
3757 cd ..
3758 while test "$type"; do
3759         redo=''
3760         rp="$orig_rp"
3761         dflt="$orig_dflt"
3762         case "$tilde" in
3763         true) rp="$rp (~name ok)";;
3764         esac
3765         . UU/myread
3766         if test -f UU/getfile.ok && \
3767                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3768         then
3769                 value="$ans"
3770                 ansexp="$ans"
3771                 break
3772         fi
3773         case "$ans" in
3774         none)
3775                 value=''
3776                 ansexp=''
3777                 case "$none_ok" in
3778                 true) type='';;
3779                 esac
3780                 ;;
3781         *)
3782                 case "$tilde" in
3783                 '') value="$ans"
3784                         ansexp="$ans";;
3785                 *)
3786                         value=`UU/filexp $ans`
3787                         case $? in
3788                         0)
3789                                 if test "$ans" != "$value"; then
3790                                         echo "(That expands to $value on this system.)"
3791                                 fi
3792                                 ;;
3793                         *) value="$ans";;
3794                         esac
3795                         ansexp="$value"
3796                         case "$exp_file" in
3797                         '') value="$ans";;
3798                         esac
3799                         ;;
3800                 esac
3801                 case "$fullpath" in
3802                 true)
3803                         case "$ansexp" in
3804                         /*) value="$ansexp" ;;
3805                         [a-zA-Z]:/*) value="$ansexp" ;;
3806                         *)
3807                                 redo=true
3808                                 case "$already" in
3809                                 true)
3810                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3811                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3812                                         ;;
3813                                 *)
3814                                 echo "Please give a full path name, starting with slash." >&4
3815                                         case "$tilde" in
3816                                         true)
3817                                 echo "Note that using ~name is ok provided it expands well." >&4
3818                                                 already=true
3819                                                 ;;
3820                                         esac
3821                                 esac
3822                                 ;;
3823                         esac
3824                         ;;
3825                 esac
3826                 case "$redo" in
3827                 '')
3828                         case "$type" in
3829                         File)
3830                                 for fp in $gfpth; do
3831                                         if test "X$fp" = X.; then
3832                                             pf="$ansexp"
3833                                         else    
3834                                             pf="$fp/$ansexp"
3835                                         fi
3836                                         if test -f "$pf"; then
3837                                                 type=''
3838                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3839                                         then
3840                                                 echo "($value is not a plain file, but that's ok.)"
3841                                                 type=''
3842                                         fi
3843                                         if test X"$type" = X; then
3844                                             value="$pf"
3845                                             break
3846                                         fi
3847                                 done
3848                                 ;;
3849                         Directory)
3850                                 for fp in $gfpth; do
3851                                         if test "X$fp" = X.; then
3852                                             dir="$ans"
3853                                             direxp="$ansexp"
3854                                         else    
3855                                             dir="$fp/$ansexp"
3856                                             direxp="$fp/$ansexp"
3857                                         fi
3858                                         if test -d "$direxp"; then
3859                                                 type=''
3860                                                 value="$dir"
3861                                                 break
3862                                         fi
3863                                 done
3864                                 ;;
3865                         Locate)
3866                                 if test -d "$ansexp"; then
3867                                         echo "(Looking for $loc_file in directory $value.)"
3868                                         value="$value/$loc_file"
3869                                         ansexp="$ansexp/$loc_file"
3870                                 fi
3871                                 if test -f "$ansexp"; then
3872                                         type=''
3873                                 fi
3874                                 case "$nopath_ok" in
3875                                 true)   case "$value" in
3876                                         */*) ;;
3877                                         *)      echo "Assuming $value will be in people's path."
3878                                                 type=''
3879                                                 ;;
3880                                         esac
3881                                         ;;
3882                                 esac
3883                                 ;;
3884                         esac
3885
3886                         case "$skip" in
3887                         true) type='';
3888                         esac
3889
3890                         case "$type" in
3891                         '') ;;
3892                         *)
3893                                 if test "$fastread" = yes; then
3894                                         dflt=y
3895                                 else
3896                                         dflt=n
3897                                 fi
3898                                 rp="$what $value doesn't exist.  Use that name anyway?"
3899                                 . UU/myread
3900                                 dflt=''
3901                                 case "$ans" in
3902                                 y*) type='';;
3903                                 *) echo " ";;
3904                                 esac
3905                                 ;;
3906                         esac
3907                         ;;
3908                 esac
3909                 ;;
3910         esac
3911 done
3912 cd UU
3913 ans="$value"
3914 rp="$orig_rp"
3915 dflt="$orig_dflt"
3916 rm -f getfile.ok
3917 test "X$gfpthkeep" != Xy && gfpth=""
3918 EOSC
3919
3920 : determine root of directory hierarchy where package will be installed.
3921 case "$prefix" in
3922 '')
3923         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3924         ;;
3925 *?/)
3926         dflt=`echo "$prefix" | sed 's/.$//'`
3927         ;;
3928 *)
3929         dflt="$prefix"
3930         ;;
3931 esac
3932 $cat <<EOM
3933
3934 By default, $package will be installed in $dflt/bin, manual pages
3935 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3936 installation directories. Typically this is something like /usr/local.
3937 If you wish to have binaries under /usr/bin but other parts of the
3938 installation under /usr/local, that's ok: you will be prompted
3939 separately for each of the installation directories, the prefix being
3940 only used to set the defaults.
3941
3942 EOM
3943 fn=d~
3944 rp='Installation prefix to use?'
3945 . ./getfile
3946 oldprefix=''
3947 case "$prefix" in
3948 '') ;;
3949 *)
3950         case "$ans" in
3951         "$prefix") ;;
3952         *) oldprefix="$prefix";;
3953         esac
3954         ;;
3955 esac
3956 prefix="$ans"
3957 prefixexp="$ansexp"
3958
3959 : allow them to override the AFS root
3960 case "$afsroot" in
3961 '')     afsroot=/afs ;;
3962 *)      afsroot=$afsroot ;;
3963 esac
3964
3965 : is AFS running?
3966 echo " "
3967 case "$afs" in
3968 $define|true)   afs=true ;;
3969 $undef|false)   afs=false ;;
3970 *)      if $test -d $afsroot; then
3971                 afs=true
3972         else
3973                 afs=false
3974         fi
3975         ;;
3976 esac
3977 if $afs; then
3978         echo "AFS may be running... I'll be extra cautious then..." >&4
3979 else
3980         echo "AFS does not seem to be running..." >&4
3981 fi
3982
3983 : determine installation prefix for where package is to be installed.
3984 if $afs; then 
3985 $cat <<EOM
3986
3987 Since you are running AFS, I need to distinguish the directory in which
3988 files will reside from the directory in which they are installed (and from
3989 which they are presumably copied to the former directory by occult means).
3990
3991 EOM
3992         case "$installprefix" in
3993         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3994         *) dflt="$installprefix";;
3995         esac
3996 else
3997 $cat <<EOM
3998
3999 In some special cases, particularly when building $package for distribution,
4000 it is convenient to distinguish the directory in which files should be
4001 installed from the directory ($prefix) in which they will
4002 eventually reside.  For most users, these two directories are the same.
4003
4004 EOM
4005         case "$installprefix" in
4006         '') dflt=$prefix ;;
4007         *) dflt=$installprefix;;
4008         esac
4009 fi
4010 fn=d~
4011 rp='What installation prefix should I use for installing files?'
4012 . ./getfile
4013 installprefix="$ans"
4014 installprefixexp="$ansexp"
4015
4016 : Perform the prefixexp/installprefixexp correction if necessary
4017 cat <<EOS >installprefix
4018 $startsh
4019 EOS
4020 cat <<'EOSC' >>installprefix
4021 : Change installation prefix, if necessary.
4022 if $test X"$prefix" != X"$installprefix"; then
4023     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4024 else
4025     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4026 fi
4027 EOSC
4028 chmod +x installprefix
4029 $eunicefix installprefix
4030
4031 : Set variables such as privlib and privlibexp from the output of ./getfile
4032 : performing the prefixexp/installprefixexp correction if necessary.
4033 cat <<EOS >setprefixvar
4034 $startsh
4035 EOS
4036 cat <<'EOSC' >>setprefixvar
4037 eval "${prefixvar}=\"\$ans\""
4038 eval "${prefixvar}exp=\"\$ansexp\""
4039 . ./installprefix
4040 EOSC
4041 chmod +x setprefixvar
4042 $eunicefix setprefixvar
4043
4044 : set up the script used to warn in case of inconsistency
4045 cat <<EOS >whoa
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>whoa
4049 dflt=y
4050 case "$hint" in
4051     recommended)
4052         case "$hintfile" in
4053         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4054                 ;;
4055         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4056                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4057                 ;;
4058         esac
4059         ;;
4060     *)  echo " "
4061         echo "*** WHOA THERE!!! ***" >&4
4062         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4063         ;;
4064 esac
4065 rp="    Keep the $hint value?"
4066 . ./myread
4067 case "$ans" in
4068 y) td=$was; tu=$was;;
4069 esac
4070 EOSC
4071
4072 : function used to set '$1' to '$val'
4073 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4074 case "$val$was" in
4075 $define$undef) . ./whoa; eval "$var=\$td";;
4076 $undef$define) . ./whoa; eval "$var=\$tu";;
4077 *) eval "$var=$val";;
4078 esac'
4079
4080 : get the patchlevel
4081 echo " "
4082 echo "Getting the current patchlevel..." >&4
4083 if $test -r $rsrc/patchlevel.h;then
4084         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4090         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4091 else
4092         revision=0
4093         patchlevel=0
4094         subversion=0
4095         api_revision=0
4096         api_version=0
4097         api_subversion=0
4098         perl_patchlevel=0
4099         $echo "(You do not have patchlevel.h.  Eek.)"
4100 fi
4101 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4102 version_patchlevel_string="version $patchlevel subversion $subversion"
4103 case "$perl_patchlevel" in
4104 0|'') ;;
4105 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4106     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4107     ;;
4108 esac
4109
4110 $echo "(You have $package $version_patchlevel_string.)"
4111
4112 case "$osname" in
4113 dos|vms)
4114         : XXX Should be a Configure test for double-dots in filenames.
4115         version=`echo $revision $patchlevel $subversion | \
4116                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4117         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4118                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119         ;;
4120 *)
4121         version=`echo $revision $patchlevel $subversion | \
4122                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4123         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4124                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4125         ;;
4126 esac
4127 : Special case the 5.005_xx maintenance series, which used 5.005
4128 : without any subversion label as a subdirectory in $sitelib
4129 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4130         api_versionstring='5.005'
4131 fi
4132
4133 : Do we want threads support and if so, what type
4134 case "$usethreads" in
4135 $define|true|[yY]*)     dflt='y';;
4136 *)     # Catch case where user specified ithreads or 5005threads but
4137        # forgot -Dusethreads (A.D. 4/2002)
4138        case "$useithreads$use5005threads" in
4139        *$define*)       dflt='y';;
4140        *)               dflt='n';;
4141        esac
4142        ;;
4143 esac
4144 cat <<EOM
4145
4146 Perl can be built to take advantage of threads on some systems.
4147 To do so, Configure can be run with -Dusethreads.
4148
4149 Note that Perl built with threading support runs slightly slower
4150 and uses more memory than plain Perl. The current implementation
4151 is believed to be stable, but it is fairly new, and so should be
4152 treated with caution.
4153
4154 If this doesn't make any sense to you, just accept the default '$dflt'.
4155 EOM
4156 rp='Build a threading Perl?'
4157 . ./myread
4158 case "$ans" in
4159 y|Y)    val="$define" ;;
4160 *)      val="$undef" ;;
4161 esac
4162 set usethreads
4163 eval $setvar
4164
4165 if $test $patchlevel -lt 9; then
4166     case "$usethreads" in
4167     $define)
4168         $cat <<EOM
4169
4170 Since release 5.6, Perl has had two different threading implementations,
4171 the newer interpreter-based version (ithreads) with one interpreter per
4172 thread, and the older 5.005 version (5005threads).
4173 The 5005threads version is effectively unmaintained and will probably be
4174 removed in Perl 5.10, so there should be no need to build a Perl using it
4175 unless needed for backwards compatibility with some existing 5.005threads
4176 code.
4177
4178 EOM
4179         : Default to ithreads unless overridden on command line or with
4180         : old config.sh
4181         dflt='y'
4182         case "$use5005threads" in
4183                 $define|true|[yY]*) dflt='n';;
4184         esac
4185         case "$useithreads" in
4186                 $undef|false|[nN]*) dflt='n';;
4187         esac
4188         rp='Use the newer interpreter-based ithreads?'
4189         . ./myread
4190         case "$ans" in
4191         y|Y)    val="$define" ;;
4192         *)      val="$undef" ;;
4193         esac
4194         set useithreads
4195         eval $setvar
4196         : Now set use5005threads to the opposite value.
4197         case "$useithreads" in
4198         $define) val="$undef" ;;
4199         *) val="$define" ;;
4200         esac
4201         set use5005threads
4202         eval $setvar
4203         ;;
4204     *)
4205         useithreads="$undef"
4206         use5005threads="$undef"
4207         ;;
4208     esac
4209
4210     case "$useithreads$use5005threads" in
4211     "$define$define")
4212         $cat >&4 <<EOM
4213
4214 You cannot have both the ithreads and the 5.005 threads enabled
4215 at the same time.  Disabling the 5.005 threads since they are
4216 much less stable than the ithreads.
4217
4218 EOM
4219         use5005threads="$undef"
4220         ;;
4221     esac
4222
4223 else
4224 : perl-5.9.x and later
4225
4226     if test X"$usethreads" = "X$define"; then
4227         case "$use5005threads" in
4228             $define|true|[yY]*)
4229                 $cat >&4 <<EOM
4230
4231 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4232
4233 EOM
4234             ;;
4235         esac
4236     fi
4237
4238     use5005threads="$undef"
4239     useithreads="$usethreads"
4240 fi
4241
4242 case "$d_oldpthreads" in
4243 '')     : Configure tests would be welcome here.  For now, assume undef.
4244         val="$undef" ;;
4245 *)      val="$d_oldpthreads" ;;
4246 esac
4247 set d_oldpthreads
4248 eval $setvar
4249
4250
4251 : Look for a hint-file generated 'call-back-unit'.  If the
4252 : user has specified that a threading perl is to be built,
4253 : we may need to set or change some other defaults.
4254 if $test -f usethreads.cbu; then
4255     echo "Your platform has some specific hints regarding threaded builds, using them..."
4256     . ./usethreads.cbu
4257 else
4258     case "$usethreads" in
4259         "$define"|true|[yY]*)
4260                 $cat <<EOM
4261 (Your platform does not have any specific hints for threaded builds.
4262  Assuming POSIX threads, then.)
4263 EOM
4264         ;;
4265     esac
4266 fi
4267
4268 : Check if multiplicity is required
4269 cat <<EOM
4270
4271 Perl can be built so that multiple Perl interpreters can coexist
4272 within the same Perl executable.
4273 EOM
4274
4275 case "$useithreads" in
4276 $define)
4277         cat <<EOM
4278 This multiple interpreter support is required for interpreter-based threads.
4279 EOM
4280         val="$define"
4281         ;;
4282 *)      case "$usemultiplicity" in
4283         $define|true|[yY]*)     dflt='y';;
4284         *) dflt='n';;
4285         esac
4286         echo " "
4287         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288         rp='Build Perl for multiplicity?'
4289         . ./myread
4290         case "$ans" in
4291         y|Y)    val="$define" ;;
4292         *)      val="$undef" ;;
4293         esac
4294         ;;
4295 esac
4296 set usemultiplicity
4297 eval $setvar
4298
4299 : Check if morebits is requested
4300 case "$usemorebits" in
4301 "$define"|true|[yY]*)
4302         use64bitint="$define"
4303         uselongdouble="$define"
4304         usemorebits="$define"
4305         ;;
4306 *)      usemorebits="$undef"
4307         ;;
4308 esac
4309
4310 : Determine the C compiler to be used
4311 echo " "
4312 case "$cc" in
4313 '') dflt=cc;;
4314 *) dflt="$cc";;
4315 esac
4316 rp="Use which C compiler?"
4317 . ./myread
4318 cc="$ans"
4319
4320 : See whether they have no cc but they do have gcc
4321 . ./trygcc
4322 if $test -f cc.cbu; then
4323     . ./cc.cbu
4324 fi
4325 . ./checkcc
4326
4327 : make some quick guesses about what we are up against
4328 echo " "
4329 $echo $n "Hmm...  $c"
4330 echo exit 1 >bsd
4331 echo exit 1 >usg
4332 echo exit 1 >v7
4333 echo exit 1 >osf1
4334 echo exit 1 >eunice
4335 echo exit 1 >xenix
4336 echo exit 1 >venix
4337 echo exit 1 >os2
4338 d_bsd="$undef"
4339 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4340 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4341 then
4342         echo "Looks kind of like an OSF/1 system, but we'll see..."
4343         echo exit 0 >osf1
4344 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4345         xxx=`./loc addbib blurfl $pth`
4346         if $test -f $xxx; then
4347         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4348                 echo exit 0 >bsd
4349                 echo exit 0 >usg
4350         else
4351                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4352                         echo "Looks kind of like an extended USG system, but we'll see..."
4353                 else
4354                         echo "Looks kind of like a USG system, but we'll see..."
4355                 fi
4356                 echo exit 0 >usg
4357         fi
4358 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359         echo "Looks kind of like a BSD system, but we'll see..."
4360         d_bsd="$define"
4361         echo exit 0 >bsd
4362 else
4363         echo "Looks kind of like a Version 7 system, but we'll see..."
4364         echo exit 0 >v7
4365 fi
4366 case "$eunicefix" in
4367 *unixtovms*)
4368         $cat <<'EOI'
4369 There is, however, a strange, musty smell in the air that reminds me of
4370 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4371 EOI
4372         echo exit 0 >eunice
4373         d_eunice="$define"
4374 : it so happens the Eunice I know will not run shell scripts in Unix format
4375         ;;
4376 *)
4377         echo " "
4378         echo "Congratulations.  You aren't running Eunice."
4379         d_eunice="$undef"
4380         ;;
4381 esac
4382 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4383 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4384 : semicolon as a patch separator
4385 case "$p_" in
4386 :) ;;
4387 *)
4388         $cat <<'EOI'
4389 I have the feeling something is not exactly right, however...don't tell me...
4390 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4391 (Or you may be running DOS with DJGPP.)
4392 EOI
4393         echo exit 0 >os2
4394         ;;
4395 esac
4396 if test -f /xenix; then
4397         echo "Actually, this looks more like a XENIX system..."
4398         echo exit 0 >xenix
4399         d_xenix="$define"
4400 else
4401         echo " "
4402         echo "It's not Xenix..."
4403         d_xenix="$undef"
4404 fi
4405 chmod +x xenix
4406 $eunicefix xenix
4407 if test -f /venix; then
4408         echo "Actually, this looks more like a VENIX system..."
4409         echo exit 0 >venix
4410 else
4411         echo " "
4412         if ./xenix; then
4413                 : null
4414         else
4415                 echo "Nor is it Venix..."
4416         fi
4417 fi
4418 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4419 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4420 $rm -f foo
4421
4422 : Check if we are using GNU gcc and what its version is
4423 echo " "
4424 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4425 $cat >try.c <<EOM
4426 #include <stdio.h>
4427 int main() {
4428 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4429 #ifdef __VERSION__
4430         printf("%s\n", __VERSION__);
4431 #else
4432         printf("%s\n", "1");
4433 #endif
4434 #endif
4435         return(0);
4436 }
4437 EOM
4438 if $cc -o try $ccflags $ldflags try.c; then
4439         gccversion=`$run ./try`
4440         case "$gccversion" in
4441         '') echo "You are not using GNU cc." ;;
4442         *)  echo "You are using GNU cc $gccversion."
4443             ccname=gcc
4444             ;;
4445         esac
4446 else
4447         echo " "
4448         echo "*** WHOA THERE!!! ***" >&4
4449         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450         case "$knowitall" in
4451         '')
4452         echo "    You'd better start hunting for one and let me know about it." >&4
4453                 exit 1
4454                 ;;
4455         esac
4456 fi
4457 $rm -f try try.*
4458 case "$gccversion" in
4459 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460 esac
4461 case "$gccversion" in
4462 '') gccosandvers='' ;;
4463 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465    gccshortvers=''
4466    case "$gccosandvers" in
4467    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468    $osname$osvers) ;; # looking good
4469    $osname*) cat <<EOM >&4
4470
4471 *** WHOA THERE!!! ***
4472
4473     Your gcc has not been compiled for the exact release of
4474     your operating system ($gccosandvers versus $osname$osvers).
4475
4476     In general it is a good idea to keep gcc synchronized with
4477     the operating system because otherwise serious problems
4478     may ensue when trying to compile software, like Perl.
4479
4480     I'm trying to be optimistic here, though, and will continue.
4481     If later during the configuration and build icky compilation
4482     problems appear (headerfile conflicts being the most common
4483     manifestation), I suggest reinstalling the gcc to match
4484     your operating system release.
4485
4486 EOM
4487       ;;
4488    *) gccosandvers='' ;; # failed to parse, better be silent
4489    esac
4490    ;;
4491 esac
4492 case "$ccname" in
4493 '') ccname="$cc" ;;
4494 esac
4495
4496 # gcc 3.* complain about adding -Idirectories that they already know about,
4497 # so we will take those off from locincpth.
4498 case "$gccversion" in
4499 3*)
4500     echo "main(){}">try.c
4501     for incdir in $locincpth; do
4502        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503              grep '^c[cp]p*[01]: warning: changing search order '`
4504        if test "X$warn" != X; then
4505            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506        fi
4507     done
4508     $rm -f try try.*
4509 esac
4510
4511 : What should the include directory be ?
4512 echo " "
4513 $echo $n "Hmm...  $c"
4514 dflt='/usr/include'
4515 incpath=''
4516 mips_type=''
4517 if $test -f /bin/mips && /bin/mips; then
4518         echo "Looks like a MIPS system..."
4519         $cat >usr.c <<'EOCP'
4520 #ifdef SYSTYPE_BSD43
4521 /bsd43
4522 #endif
4523 EOCP
4524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4525                 dflt='/bsd43/usr/include'
4526                 incpath='/bsd43'
4527                 mips_type='BSD 4.3'
4528         else
4529                 mips_type='System V'
4530         fi
4531         $rm -f usr.c usr.out
4532         echo "and you're compiling with the $mips_type compiler and libraries."
4533         xxx_prompt=y
4534         echo "exit 0" >mips
4535 else
4536         echo "Doesn't look like a MIPS system."
4537         xxx_prompt=n
4538         echo "exit 1" >mips
4539 fi
4540 chmod +x mips
4541 $eunicefix mips
4542 case "$usrinc" in
4543 '') ;;
4544 *) dflt="$usrinc";;
4545 esac
4546 case "$xxx_prompt" in
4547 y)      fn=d/
4548         echo " "
4549         rp='Where are the include files you want to use?'
4550         . ./getfile
4551         usrinc="$ans"
4552         ;;
4553 *)      usrinc="$dflt"
4554         ;;
4555 esac
4556
4557 : see how we invoke the C preprocessor
4558 echo " "
4559 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560 cat <<'EOT' >testcpp.c
4561 #define ABC abc
4562 #define XYZ xyz
4563 ABC.XYZ
4564 EOT
4565 cd ..
4566 if test ! -f cppstdin; then
4567         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568                 # AIX cc -E doesn't show the absolute headerfile
4569                 # locations but we'll cheat by using the -M flag.
4570                 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
4571         else
4572                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573         fi
4574 else
4575         echo "Keeping your $hint cppstdin wrapper."
4576 fi
4577 chmod 755 cppstdin
4578 wrapper=`pwd`/cppstdin
4579 ok='false'
4580 cd UU
4581
4582 if $test "X$cppstdin" != "X" && \
4583         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585 then
4586         echo "You used to use $cppstdin $cppminus so we'll use that again."
4587         case "$cpprun" in
4588         '') echo "But let's see if we can live without a wrapper..." ;;
4589         *)
4590                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592                 then
4593                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594                         ok='true'
4595                 else
4596                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4597                 fi
4598                 ;;
4599         esac
4600 else
4601         case "$cppstdin" in
4602         '') ;;
4603         *)
4604                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605                 ;;
4606         esac
4607 fi
4608
4609 if $ok; then
4610         : nothing
4611 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612         $cc -E <testcpp.c >testcpp.out 2>&1; \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614         echo "Yup, it does."
4615         x_cpp="$cc -E"
4616         x_minus='';
4617 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='-';
4623 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624         $cc -P <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yipee, that works!"
4627         x_cpp="$cc -P"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "At long last!"
4633         x_cpp="$cc -P"
4634         x_minus='-';
4635 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636         $cpp <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "It works!"
4639         x_cpp="$cpp"
4640         x_minus='';
4641 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642         $cpp - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Hooray, it works!  I was beginning to wonder."
4645         x_cpp="$cpp"
4646         x_minus='-';
4647 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4648         $wrapper <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         x_cpp="$wrapper"
4651         x_minus=''
4652         echo "Eureka!"
4653 else
4654         dflt=''
4655         rp="No dice.  I can't find a C preprocessor.  Name one:"
4656         . ./myread
4657         x_cpp="$ans"
4658         x_minus=''
4659         $x_cpp <testcpp.c >testcpp.out 2>&1
4660         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661                 echo "OK, that will do." >&4
4662         else
4663 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4664                 exit 1
4665         fi
4666 fi
4667
4668 case "$ok" in
4669 false)
4670         cppstdin="$x_cpp"
4671         cppminus="$x_minus"
4672         cpprun="$x_cpp"
4673         cpplast="$x_minus"
4674         set X $x_cpp
4675         shift
4676         case "$1" in
4677         "$cpp")
4678                 echo "Perhaps can we force $cc -E using a wrapper..."
4679                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681                 then
4682                         echo "Yup, we can."
4683                         cppstdin="$wrapper"
4684                         cppminus='';
4685                 else
4686                         echo "Nope, we'll have to live without it..."
4687                 fi
4688                 ;;
4689         esac
4690         case "$cpprun" in
4691         "$wrapper")
4692                 cpprun=''
4693                 cpplast=''
4694                 ;;
4695         esac
4696         ;;
4697 esac
4698
4699 case "$cppstdin" in
4700 "$wrapper"|'cppstdin') ;;
4701 *) $rm -f $wrapper;;
4702 esac
4703 $rm -f testcpp.c testcpp.out
4704
4705 : Set private lib path
4706 case "$plibpth" in
4707 '') if ./mips; then
4708                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709         fi;;
4710 esac
4711 case "$libpth" in
4712 ' ') dlist='';;
4713 '') dlist="$loclibpth $plibpth $glibpth";;
4714 *) dlist="$libpth";;
4715 esac
4716
4717 : Now check and see which directories actually exist, avoiding duplicates
4718 libpth=''
4719 for xxx in $dlist
4720 do
4721     if $test -d $xxx; then
4722                 case " $libpth " in
4723                 *" $xxx "*) ;;
4724                 *) libpth="$libpth $xxx";;
4725                 esac
4726     fi
4727 done
4728 $cat <<'EOM'
4729
4730 Some systems have incompatible or broken versions of libraries.  Among
4731 the directories listed in the question below, please remove any you
4732 know not to be holding relevant libraries, and add any that are needed.
4733 Say "none" for none.
4734
4735 EOM
4736 case "$libpth" in
4737 '') dflt='none';;
4738 *)
4739         set X $libpth
4740         shift
4741         dflt=${1+"$@"}
4742         ;;
4743 esac
4744 rp="Directories to use for library searches?"
4745 . ./myread
4746 case "$ans" in
4747 none) libpth=' ';;
4748 *) libpth="$ans";;
4749 esac
4750
4751 : compute shared library extension
4752 case "$so" in
4753 '')
4754         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755                 dflt='sl'
4756         else
4757                 dflt='so'
4758         fi
4759         ;;
4760 *) dflt="$so";;
4761 esac
4762 $cat <<EOM
4763
4764 On some systems, shared libraries may be available.  Answer 'none' if
4765 you want to suppress searching of shared libraries for the remainder
4766 of this configuration.
4767
4768 EOM
4769 rp='What is the file extension used for shared libraries?'
4770 . ./myread
4771 so="$ans"
4772
4773 : Define several unixisms.
4774 : Hints files or command line option can be used to override them.
4775 : The convoluted testing is in case hints files set either the old
4776 : or the new name.
4777 case "$_exe" in
4778 '')     case "$exe_ext" in
4779         '')     ;;
4780         *)      _exe="$exe_ext" ;;
4781         esac
4782         ;;
4783 esac
4784 case "$_a" in
4785 '')     case "$lib_ext" in
4786     '') _a='.a';;
4787         *)      _a="$lib_ext" ;;
4788         esac
4789         ;;
4790 esac
4791 case "$_o" in
4792 '') case "$obj_ext" in
4793         '')     _o='.o';;
4794         *)      _o="$obj_ext";;
4795         esac
4796         ;;
4797 esac
4798 case "$p_" in
4799 '') case "$path_sep" in
4800         '')     p_=':';;
4801         *)      p_="$path_sep";;
4802         esac
4803         ;;
4804 esac
4805 exe_ext=$_exe
4806 lib_ext=$_a
4807 obj_ext=$_o
4808 path_sep=$p_
4809
4810 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4811
4812 : Which makefile gets called first.  This is used by make depend.
4813 case "$firstmakefile" in
4814 '') firstmakefile='makefile';;
4815 esac
4816
4817 : Check is we will use socks
4818 case "$usesocks" in
4819 $define|true|[yY]*)     dflt='y';;
4820 *) dflt='n';;
4821 esac
4822 cat <<EOM
4823
4824 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4825 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4826 to use the PerlIO abstraction layer, this will be implicitly selected.
4827
4828 If this doesn't make any sense to you, just accept the default '$dflt'.
4829 EOM
4830 rp='Build Perl for SOCKS?'
4831 . ./myread
4832 case "$ans" in
4833 y|Y)    val="$define" ;;
4834 *)      val="$undef" ;;
4835 esac
4836 set usesocks
4837 eval $setvar
4838
4839 : Check for uselongdouble support
4840 case "$ccflags" in
4841 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4842 esac
4843
4844 case "$uselongdouble" in
4845 $define|true|[yY]*)     dflt='y';;
4846 *) dflt='n';;
4847 esac
4848 cat <<EOM
4849
4850 Perl can be built to take advantage of long doubles which
4851 (if available) may give more accuracy and range for floating point numbers.
4852
4853 If this doesn't make any sense to you, just accept the default '$dflt'.
4854 EOM
4855 rp='Try to use long doubles if available?'
4856 . ./myread
4857 case "$ans" in
4858 y|Y)    val="$define"   ;;
4859 *)      val="$undef"    ;;
4860 esac
4861 set uselongdouble
4862 eval $setvar
4863
4864 case "$uselongdouble" in
4865 true|[yY]*) uselongdouble="$define" ;;
4866 esac
4867
4868 : Look for a hint-file generated 'call-back-unit'.  If the
4869 : user has specified that long doubles should be used,
4870 : we may need to set or change some other defaults.
4871 if $test -f uselongdouble.cbu; then
4872     echo "Your platform has some specific hints regarding long doubles, using them..."
4873     . ./uselongdouble.cbu
4874 else
4875     case "$uselongdouble" in
4876         $define)
4877                 $cat <<EOM
4878 (Your platform does not have any specific hints for long doubles.)
4879 EOM
4880         ;;
4881     esac
4882 fi
4883
4884 : Looking for optional libraries
4885 echo " "
4886 echo "Checking for optional libraries..." >&4
4887 case "$libs" in
4888 ' '|'') dflt='';;
4889 *) dflt="$libs";;
4890 esac
4891 case "$libswanted" in
4892 '') libswanted='c_s';;
4893 esac
4894 case "$usesocks" in
4895 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4896 esac
4897 libsfound=''
4898 libsfiles=''
4899 libsdirs=''
4900 libspath=''
4901 for thisdir in $libpth $xlibpth; do
4902   test -d $thisdir && libspath="$libspath $thisdir"
4903 done
4904 for thislib in $libswanted; do
4905         for thisdir in $libspath; do
4906             xxx=''
4907             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4908                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4909                 $test -f "$xxx" && eval $libscheck
4910                 $test -f "$xxx" && libstyle=shared
4911             fi
4912             if test ! -f "$xxx"; then
4913                 xxx=$thisdir/lib$thislib.$so
4914                 $test -f "$xxx" && eval $libscheck
4915                 $test -f "$xxx" && libstyle=shared
4916             fi
4917             if test ! -f "$xxx"; then
4918                 xxx=$thisdir/lib$thislib$_a
4919                 $test -f "$xxx" && eval $libscheck
4920                 $test -f "$xxx" && libstyle=static
4921             fi
4922             if test ! -f "$xxx"; then
4923                 xxx=$thisdir/$thislib$_a
4924                 $test -f "$xxx" && eval $libscheck
4925                 $test -f "$xxx" && libstyle=static
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/lib${thislib}_s$_a
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=static
4931                 $test -f "$xxx" && thislib=${thislib}_s
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/Slib$thislib$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937             fi
4938             if $test -f "$xxx"; then
4939                 case "$libstyle" in
4940                 shared) echo "Found -l$thislib (shared)." ;;
4941                 static) echo "Found -l$thislib." ;;
4942                 *)      echo "Found -l$thislib ($libstyle)." ;;
4943                 esac
4944                 case " $dflt " in
4945                 *"-l$thislib "*);;
4946                 *) dflt="$dflt -l$thislib"
4947                    libsfound="$libsfound $xxx"
4948                    yyy=`basename $xxx`
4949                    libsfiles="$libsfiles $yyy"
4950                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4951                    case " $libsdirs " in
4952                    *" $yyy "*) ;;
4953                    *) libsdirs="$libsdirs $yyy" ;;
4954                    esac
4955                    ;;
4956                 esac
4957                 break
4958             fi
4959         done
4960         if $test ! -f "$xxx"; then
4961             echo "No -l$thislib."
4962         fi
4963 done
4964 set X $dflt
4965 shift
4966 dflt="$*"
4967 case "$libs" in
4968 '') dflt="$dflt";;
4969 *) dflt="$libs";;
4970 esac
4971 case "$dflt" in
4972 ' '|'') dflt='none';;
4973 esac
4974
4975 $cat <<EOM
4976
4977 In order to compile $package on your machine, a number of libraries
4978 are usually needed.  Include any other special libraries here as well.
4979 Say "none" for none.  The default list is almost always right.
4980 EOM
4981
4982 echo " "
4983 rp="What libraries to use?"
4984 . ./myread
4985 case "$ans" in
4986 none) libs=' ';;
4987 *) libs="$ans";;
4988 esac
4989
4990 : determine optimization, if desired, or use for debug flag also
4991 case "$optimize" in
4992 ' '|$undef) dflt='none';;
4993 '') dflt='-O';;
4994 *) dflt="$optimize";;
4995 esac
4996 $cat <<EOH
4997
4998 By default, $package compiles with the -O flag to use the optimizer.
4999 Alternately, you might want to use the symbolic debugger, which uses
5000 the -g flag (on traditional Unix systems).  Either flag can be
5001 specified here.  To use neither flag, specify the word "none".
5002
5003 EOH
5004 rp="What optimizer/debugger flag should be used?"
5005 . ./myread
5006 optimize="$ans"
5007 case "$optimize" in
5008 'none') optimize=" ";;
5009 esac
5010
5011 : Check what DEBUGGING is required from the command line
5012 : -DEBUGGING      or -DDEBUGGING or
5013 : -DEBUGGING=both                       = -g + -DDEBUGGING
5014 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5015 : -DEBUGGING=none or -UDEBUGGING        =
5016 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5017 case "$EBUGGING" in
5018 '')     ;;
5019 *)      DEBUGGING=$EBUGGING ;;
5020 esac
5021
5022 case "$DEBUGGING" in
5023 -g|both|$define)
5024     case "$optimize" in
5025         *-g*) ;;
5026         *)    optimize="$optimize -g" ;;
5027     esac ;;
5028 none|$undef)
5029     case "$optimize" in
5030         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5031                 shift
5032                 optimize="$*"
5033                 ;;
5034     esac ;;
5035 esac
5036
5037 dflt=''
5038 case "$DEBUGGING" in
5039 both|$define) dflt='-DDEBUGGING'
5040 esac
5041
5042 : argument order is deliberate, as the flag will start with - which set could
5043 : think is an option
5044 checkccflag='check=$1; flag=$2; callback=$3;
5045 echo " ";
5046 echo "Checking if your compiler accepts $flag" 2>&1;
5047 echo "int main(void) { return 0; }" > gcctest.c;
5048 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5049     echo "Yes, it does." 2>&1;
5050     if $test -s gcctest.out ; then
5051         echo "But your platform does not like it:";
5052         cat gcctest.out;
5053     else
5054         case "$ccflags" in
5055         *$check*)
5056             echo "Leaving current flags $ccflags alone." 2>&1
5057             ;;
5058         *) dflt="$dflt $flag";
5059             eval $callback
5060             ;;
5061         esac
5062     fi
5063 else
5064     echo "Nope, it does not, but that is ok." 2>&1;
5065 fi
5066 '
5067
5068 : We will not override a previous value, but we might want to
5069 : augment a hint file
5070 case "$hint" in
5071 default|recommended)
5072         case "$gccversion" in
5073         1*) dflt="$dflt -fpcc-struct-return" ;;
5074         esac
5075         case "$optimize:$DEBUGGING" in
5076         *-g*:old) dflt="$dflt -DDEBUGGING";;
5077         esac
5078         case "$gccversion" in
5079         2*) if $test -d /etc/conf/kconfig.d &&
5080                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5081                 then
5082                         # Interactive Systems (ISC) POSIX mode.
5083                         dflt="$dflt -posix"
5084                 fi
5085                 ;;
5086         esac
5087         case "$gccversion" in
5088         1*) ;;
5089         2.[0-8]*) ;;
5090         ?*)     set strict-aliasing -fno-strict-aliasing
5091                 eval $checkccflag
5092                 ;;
5093         esac
5094         # For gcc, adding -pipe speeds up compilations for some, but apparently
5095         # some assemblers can't read from stdin.  (It also slows down compilations
5096         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5097         case "$gccversion" in
5098         ?*)     set pipe -pipe
5099                 eval $checkccflag
5100                 ;;
5101         esac
5102
5103         # on x86_64 (at least) we require an extra library (libssp) in the
5104         # link command line. This library is not named, so I infer that it is
5105         # an implementation detail that may change. Hence the safest approach
5106         # is to add the flag to the flags passed to the compiler at link time,
5107         # as that way the compiler can do the right implementation dependant
5108         # thing. (NWC)
5109         case "$gccversion" in
5110         ?*)     set stack-protector -fstack-protector
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114         ;;
5115 esac
5116
5117 case "$mips_type" in
5118 *BSD*|'') inclwanted="$locincpth $usrinc";;
5119 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5120 esac
5121 for thisincl in $inclwanted; do
5122         if $test -d $thisincl; then
5123                 if $test x$thisincl != x$usrinc; then
5124                         case "$dflt" in
5125                         *" -I$thisincl "*);;
5126                         *) dflt="$dflt -I$thisincl ";;
5127                         esac
5128                 fi
5129         fi
5130 done
5131
5132 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5133         xxx=true;
5134 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5135         xxx=true;
5136 else
5137         xxx=false;
5138 fi;
5139 if $xxx; then
5140         case "$dflt" in
5141         *$2*);;
5142         *) dflt="$dflt -D$2";;
5143         esac;
5144 fi'
5145
5146 set signal.h LANGUAGE_C; eval $inctest
5147
5148 case "$usesocks" in
5149 $define)
5150         ccflags="$ccflags -DSOCKS"
5151         ;;
5152 esac
5153
5154 case "$hint" in
5155 default|recommended) dflt="$ccflags $dflt" ;;
5156 *) dflt="$ccflags";;
5157 esac
5158
5159 case "$dflt" in
5160 ''|' ') dflt=none;;
5161 esac
5162
5163 $cat <<EOH
5164
5165 Your C compiler may want other flags.  For this question you should include
5166 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5167 but you should NOT include libraries or ld flags like -lwhatever.  If you
5168 want $package to honor its debug switch, you should include -DDEBUGGING here.
5169 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5170
5171 To use no flags, specify the word "none".
5172
5173 EOH
5174 set X $dflt
5175 shift
5176 dflt=${1+"$@"}
5177 rp="Any additional cc flags?"
5178 . ./myread
5179 case "$ans" in
5180 none) ccflags='';;
5181 *) ccflags="$ans";;
5182 esac
5183
5184 : the following weeds options from ccflags that are of no interest to cpp
5185 case "$cppflags" in
5186 '') cppflags="$ccflags" ;;
5187 *)  cppflags="$cppflags $ccflags" ;;
5188 esac
5189 case "$gccversion" in
5190 1*) cppflags="$cppflags -D__GNUC__"
5191 esac
5192 case "$mips_type" in
5193 '');;
5194 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5195 esac
5196 case "$cppflags" in
5197 '');;
5198 *)
5199         echo " "
5200         echo "Let me guess what the preprocessor flags are..." >&4
5201         set X $cppflags
5202         shift
5203         cppflags=''
5204         $cat >cpp.c <<'EOM'
5205 #define BLURFL foo
5206
5207 BLURFL xx LFRULB
5208 EOM
5209         previous=''
5210         for flag in $*
5211         do
5212                 case "$flag" in
5213                 -*) ftry="$flag";;
5214                 *) ftry="$previous $flag";;
5215                 esac
5216                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5217                         >cpp1.out 2>/dev/null && \
5218                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5219                         >cpp2.out 2>/dev/null && \
5220                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5221                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5222                 then
5223                         cppflags="$cppflags $ftry"
5224                         previous=''
5225                 else
5226                         previous="$flag"
5227                 fi
5228         done
5229         set X $cppflags
5230         shift
5231         cppflags=${1+"$@"}
5232         case "$cppflags" in
5233         *-*)  echo "They appear to be: $cppflags";;
5234         esac
5235         $rm -f cpp.c cpp?.out
5236         ;;
5237 esac
5238
5239 : flags used in final linking phase
5240 case "$ldflags" in
5241 '') if ./venix; then
5242                 dflt='-i -z'
5243         else
5244                 dflt=''
5245         fi
5246         case "$ccflags" in
5247         *-posix*) dflt="$dflt -posix" ;;
5248         esac
5249         ;;
5250 *) dflt="$ldflags";;
5251 esac
5252 # See note above about -fstack-protector
5253 case "$ccflags" in
5254 *-fstack-protector*) 
5255         case "$dflt" in
5256         *-fstack-protector*) ;; # Don't add it again
5257         *) dflt="$dflt -fstack-protector" ;; 
5258         esac
5259         ;;
5260 esac
5261
5262 : Try to guess additional flags to pick up local libraries.
5263 for thislibdir in $libpth; do
5264         case " $loclibpth " in
5265         *" $thislibdir "*)
5266                 case "$dflt " in
5267                 *"-L$thislibdir "*) ;;
5268                 *)  dflt="$dflt -L$thislibdir" ;;
5269                 esac
5270                 ;;
5271         esac
5272 done
5273
5274 case "$dflt" in
5275 '') dflt='none' ;;
5276 esac
5277
5278 $cat <<EOH
5279
5280 Your C linker may need flags.  For this question you should
5281 include -L/whatever and any other flags used by the C linker, but you
5282 should NOT include libraries like -lwhatever.
5283
5284 Make sure you include the appropriate -L/path flags if your C linker
5285 does not normally search all of the directories you specified above,
5286 namely
5287         $libpth
5288 To use no flags, specify the word "none".
5289
5290 EOH
5291
5292 rp="Any additional ld flags (NOT including libraries)?"
5293 . ./myread
5294 case "$ans" in
5295 none) ldflags='';;
5296 *) ldflags="$ans";;
5297 esac
5298 rmlist="$rmlist pdp11"
5299
5300 : coherency check
5301 echo " "
5302 echo "Checking your choice of C compiler and flags for coherency..." >&4
5303 $cat > try.c <<'EOF'
5304 #include <stdio.h>
5305 int main() { printf("Ok\n"); return(0); }
5306 EOF
5307 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5308 shift
5309 $cat >try.msg <<'EOM'
5310 I've tried to compile and run the following simple program:
5311
5312 EOM
5313 $cat try.c >> try.msg
5314
5315 $cat >> try.msg <<EOM
5316
5317 I used the command:
5318
5319         $*
5320         $run ./try
5321
5322 and I got the following output:
5323
5324 EOM
5325 dflt=y
5326 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5327         if $sh -c "$run ./try " >>try.msg 2>&1; then
5328                 xxx=`$run ./try`
5329                 case "$xxx" in
5330                 "Ok") dflt=n ;;
5331                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5332                         case " $libs " in
5333                         *" -lsfio "*)
5334                                 cat >> try.msg <<'EOQS'
5335 If $libs contains -lsfio, and sfio is mis-configured, then it
5336 sometimes (apparently) runs and exits with a 0 status, but with no
5337 output!  It may have to do with sfio's use of _exit vs. exit.
5338
5339 EOQS
5340                                 rp="You have a big problem.  Shall I abort Configure"
5341                                 dflt=y
5342                                 ;;
5343                         esac
5344                         ;;
5345                 esac
5346         else
5347                 echo "The program compiled OK, but exited with status $?." >>try.msg
5348                 rp="You have a problem.  Shall I abort Configure"
5349                 dflt=y
5350         fi
5351 else
5352         echo "I can't compile the test program." >>try.msg
5353         rp="You have a BIG problem.  Shall I abort Configure"
5354         dflt=y
5355 fi
5356 case "$dflt" in
5357 y)
5358         $cat try.msg >&4
5359         case "$knowitall" in
5360         '')
5361                 echo "(The supplied flags or libraries might be incorrect.)"
5362                 ;;
5363         *) dflt=n;;
5364         esac
5365         echo " "
5366         . ./myread
5367         case "$ans" in
5368         n*|N*) ;;
5369         *)      echo "Ok.  Stopping Configure." >&4
5370                 exit 1
5371                 ;;
5372         esac
5373         ;;
5374 n) echo "OK, that should do.";;
5375 esac
5376 $rm_try gcctest gcctest.out
5377
5378 : define a shorthand compile call
5379 compile='
5380 mc_file=$1;
5381 shift;
5382 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5383 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5384 exit 1;
5385 fi;
5386 esac;
5387 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5388 : define a shorthand compile call for compilations that should be ok.
5389 compile_ok='
5390 mc_file=$1;
5391 shift;
5392 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5393
5394 : determine filename position in cpp output
5395 echo " "
5396 echo "Computing filename position in cpp output for #include directives..." >&4
5397 case "$osname" in
5398 vos) testaccess=-e ;;
5399 *)   testaccess=-r ;;
5400 esac
5401 echo '#include <stdio.h>' > foo.c
5402 $cat >fieldn <<EOF
5403 $startsh
5404 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5405 $grep '^[       ]*#.*stdio\.h' | \
5406 while read cline; do
5407         pos=1
5408         set \$cline
5409         while $test \$# -gt 0; do
5410                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5411                         echo "\$pos"
5412                         exit 0
5413                 fi
5414                 shift
5415                 pos=\`expr \$pos + 1\`
5416         done
5417 done
5418 EOF
5419 chmod +x fieldn
5420 fieldn=`./fieldn`
5421 $rm -f foo.c fieldn
5422 case $fieldn in
5423 '') pos='???';;
5424 1) pos=first;;
5425 2) pos=second;;
5426 3) pos=third;;
5427 *) pos="${fieldn}th";;
5428 esac
5429 echo "Your cpp writes the filename in the $pos field of the line."
5430
5431 case "$osname" in
5432 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5433 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5434 *)   cppfilter='' ;;
5435 esac
5436 : locate header file
5437 $cat >findhdr <<EOF
5438 $startsh
5439 wanted=\$1
5440 name=''
5441 for usrincdir in $usrinc
5442 do
5443         if test -f \$usrincdir/\$wanted; then
5444                 echo "\$usrincdir/\$wanted"
5445                 exit 0
5446         fi
5447 done
5448 awkprg='{ print \$$fieldn }'
5449 echo "#include <\$wanted>" > foo\$\$.c
5450 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5451 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5452 while read cline; do
5453         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5454         case "\$name" in
5455         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5456         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5457         *) exit 2;;
5458         esac;
5459 done;
5460 #
5461 # status = 0: grep returned 0 lines, case statement not executed
5462 # status = 1: headerfile found
5463 # status = 2: while loop executed, no headerfile found
5464 #
5465 status=\$?
5466 $rm -f foo\$\$.c;
5467 if test \$status -eq 1; then
5468         exit 0;
5469 fi
5470 exit 1
5471 EOF
5472 chmod +x findhdr
5473
5474 : define an alternate in-header-list? function
5475 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5476 cont=true; xxf="echo \"<\$1> found.\" >&4";
5477 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5478 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5479 esac;
5480 case $# in 4) instead=instead;; *) instead="at last";; esac;
5481 while $test "$cont"; do
5482         xxx=`./findhdr $1`
5483         var=$2; eval "was=\$$2";
5484         if $test "$xxx" && $test -r "$xxx";
5485         then eval $xxf;
5486         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5487                 cont="";
5488         else eval $xxnf;
5489         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5490         set $yyy; shift; shift; yyy=$@;
5491         case $# in 0) cont="";;
5492         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5493                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5494         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5495                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5496         esac;
5497 done;
5498 while $test "$yyy";
5499 do set $yyy; var=$2; eval "was=\$$2";
5500         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5501         set $yyy; shift; shift; yyy=$@;
5502 done'
5503
5504 : see if stdlib is available
5505 set stdlib.h i_stdlib
5506 eval $inhdr
5507
5508 : check for lengths of integral types
5509 echo " "
5510 case "$intsize" in
5511 '')
5512         echo "Checking to see how big your integers are..." >&4
5513         $cat >try.c <<EOCP
5514 #include <stdio.h>
5515 #$i_stdlib I_STDLIB
5516 #ifdef I_STDLIB
5517 #include <stdlib.h>
5518 #endif
5519 int main()
5520 {
5521         printf("intsize=%d;\n", (int)sizeof(int));
5522         printf("longsize=%d;\n", (int)sizeof(long));
5523         printf("shortsize=%d;\n", (int)sizeof(short));
5524         exit(0);
5525 }
5526 EOCP
5527         set try
5528         if eval $compile_ok && $run ./try > /dev/null; then
5529                 eval `$run ./try`
5530                 echo "Your integers are $intsize bytes long."
5531                 echo "Your long integers are $longsize bytes long."
5532                 echo "Your short integers are $shortsize bytes long."
5533         else
5534                 $cat >&4 <<EOM
5535 !
5536 Help! I can't compile and run the intsize test program: please enlighten me!
5537 (This is probably a misconfiguration in your system or libraries, and
5538 you really ought to fix it.  Still, I'll try anyway.)
5539 !
5540 EOM
5541                 dflt=4
5542                 rp="What is the size of an integer (in bytes)?"
5543                 . ./myread
5544                 intsize="$ans"
5545                 dflt=$intsize
5546                 rp="What is the size of a long integer (in bytes)?"
5547                 . ./myread
5548                 longsize="$ans"
5549                 dflt=2
5550                 rp="What is the size of a short integer (in bytes)?"
5551                 . ./myread
5552                 shortsize="$ans"
5553         fi
5554         ;;
5555 esac
5556 $rm_try
5557
5558 : check for long long
5559 echo " "
5560 echo "Checking to see if you have long long..." >&4
5561 echo 'int main() { long long x = 7; return 0; }' > try.c
5562 set try
5563 if eval $compile; then
5564         val="$define"
5565         echo "You have long long."
5566 else
5567         val="$undef"
5568         echo "You do not have long long."
5569 fi
5570 $rm_try
5571 set d_longlong
5572 eval $setvar
5573
5574 : check for length of long long
5575 case "${d_longlong}${longlongsize}" in
5576 $define)
5577         echo " "
5578         echo "Checking to see how big your long longs are..." >&4
5579         $cat >try.c <<'EOCP'
5580 #include <stdio.h>
5581 int main()
5582 {
5583     printf("%d\n", (int)sizeof(long long));
5584     return(0);
5585 }
5586 EOCP
5587         set try
5588         if eval $compile_ok; then
5589                 longlongsize=`$run ./try`
5590                 echo "Your long longs are $longlongsize bytes long."
5591         else
5592                 dflt='8'
5593                 echo " "
5594                 echo "(I can't seem to compile the test program.  Guessing...)"
5595                 rp="What is the size of a long long (in bytes)?"
5596                 . ./myread
5597                 longlongsize="$ans"
5598         fi
5599         if $test "X$longsize" = "X$longlongsize"; then
5600                 echo "(That isn't any different from an ordinary long.)"
5601         fi
5602         ;;
5603 esac
5604 $rm_try
5605
5606 : see if inttypes.h is available
5607 : we want a real compile instead of Inhdr because some systems
5608 : have an inttypes.h which includes non-existent headers
5609 echo " "
5610 $cat >try.c <<EOCP
5611 #include <inttypes.h>
5612 int main() {
5613         static int32_t foo32 = 0x12345678;
5614 }
5615 EOCP
5616 set try
5617 if eval $compile; then
5618         echo "<inttypes.h> found." >&4
5619         val="$define"
5620 else
5621         echo "<inttypes.h> NOT found." >&4
5622         val="$undef"
5623 fi
5624 $rm_try
5625 set i_inttypes
5626 eval $setvar
5627
5628 : check for int64_t
5629 echo " "
5630 echo "Checking to see if you have int64_t..." >&4
5631 $cat >try.c <<EOCP
5632 #include <sys/types.h>
5633 #$i_inttypes I_INTTYPES
5634 #ifdef I_INTTYPES
5635 #include <inttypes.h>
5636 #endif
5637 int main() { int64_t x = 7; }
5638 EOCP
5639 set try
5640 if eval $compile; then
5641         val="$define"
5642         echo "You have int64_t."
5643 else
5644         val="$undef"
5645         echo "You do not have int64_t."
5646 fi
5647 $rm_try
5648 set d_int64_t
5649 eval $setvar
5650
5651 : Check if 64bit ints have a quad type
5652 echo " "
5653 echo "Checking which 64-bit integer type we could use..." >&4
5654
5655 case "$intsize" in
5656 8) val=int
5657    set quadtype
5658    eval $setvar
5659    val='"unsigned int"'
5660    set uquadtype
5661    eval $setvar
5662    quadkind=1
5663    ;;
5664 *) case "$longsize" in
5665    8) val=long
5666       set quadtype
5667       eval $setvar
5668       val='"unsigned long"'
5669       set uquadtype
5670       eval $setvar
5671       quadkind=2
5672       ;;
5673    *) case "$d_longlong:$longlongsize" in
5674       define:8)
5675         val='"long long"'
5676         set quadtype
5677         eval $setvar
5678         val='"unsigned long long"'
5679         set uquadtype
5680         eval $setvar
5681         quadkind=3
5682         ;;
5683       *) case "$d_int64_t" in
5684          define)
5685            val=int64_t
5686            set quadtype
5687            eval $setvar
5688            val=uint64_t
5689            set uquadtype
5690            eval $setvar
5691            quadkind=4
5692            ;;
5693          esac
5694          ;;
5695       esac
5696       ;;
5697    esac
5698    ;;
5699 esac
5700
5701 case "$quadtype" in
5702 '')     echo "Alas, no 64-bit integer types in sight." >&4
5703         d_quad="$undef"
5704         ;;
5705 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5706         d_quad="$define"
5707         ;;
5708 esac
5709
5710 : Do we want 64bit support
5711 case "$uselonglong" in
5712 "$define"|true|[yY]*)
5713         cat <<EOM >&4
5714
5715 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5716 EOM
5717         use64bitint="$define"
5718         ;;
5719 esac
5720 case "$use64bits" in
5721 "$define"|true|[yY]*)
5722         cat <<EOM >&4
5723
5724 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5725 EOM
5726         use64bitint="$define"
5727         ;;
5728 esac
5729 case "$use64bitints" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5734 EOM
5735         use64bitint="$define"
5736         ;;
5737 esac
5738 case "$use64bitsint" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$uselonglongs" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitsall" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5761 EOM
5762         use64bitall="$define"
5763         ;;
5764 esac
5765
5766 case "$ccflags" in
5767 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5768 esac
5769 case "$use64bitall" in
5770 "$define"|true|[yY]*) use64bitint="$define" ;;
5771 esac
5772
5773 case "$longsize" in
5774 8) cat <<EOM
5775
5776 You have natively 64-bit long integers.
5777 EOM
5778    val="$define"
5779    ;;
5780 *) case "$use64bitint" in
5781    "$define"|true|[yY]*) dflt='y';;
5782    *) dflt='n';;
5783    esac
5784    case "$d_quad" in
5785    "$define") ;;
5786    *) dflt='n' ;;
5787    esac
5788    cat <<EOM
5789
5790 Perl can be built to take advantage of 64-bit integer types
5791 on some systems.  To do so, Configure can be run with -Duse64bitint.
5792 Choosing this option will most probably introduce binary incompatibilities.
5793
5794 If this doesn't make any sense to you, just accept the default '$dflt'.
5795 (The default has been chosen based on your configuration.)
5796 EOM
5797    rp='Try to use 64-bit integers, if available?'
5798    . ./myread
5799    case "$ans" in
5800    [yY]*) val="$define" ;;
5801    *)     val="$undef"  ;;
5802    esac
5803    ;;
5804 esac
5805 set use64bitint
5806 eval $setvar
5807
5808 case "$use64bitall" in
5809 "$define"|true|[yY]*) dflt='y' ;;
5810 *) case "$longsize" in
5811    8) dflt='y' ;;
5812    *) dflt='n' ;;
5813    esac
5814    ;;
5815 esac
5816 cat <<EOM
5817
5818 You may also choose to try maximal 64-bitness.  It means using as much
5819 64-bitness as possible on the platform.  This in turn means even more
5820 binary incompatibilities.  On the other hand, your platform may not
5821 have any more 64-bitness available than what you already have chosen.
5822
5823 If this doesn't make any sense to you, just accept the default '$dflt'.
5824 (The default has been chosen based on your configuration.)
5825 EOM
5826 rp='Try to use maximal 64-bit support, if available?'
5827 . ./myread
5828 case "$ans" in
5829 [yY]*) val="$define" ;;
5830 *)     val="$undef"  ;;
5831 esac
5832 set use64bitall
5833 eval $setvar
5834 case "$use64bitall" in
5835 "$define")
5836         case "$use64bitint" in
5837         "$undef")
5838                 cat <<EOM
5839
5840 Since you have chosen a maximally 64-bit build, I'm also turning on
5841 the use of 64-bit integers.
5842 EOM
5843                 use64bitint="$define" ;;
5844         esac
5845         ;;
5846 esac
5847
5848 : Look for a hint-file generated 'call-back-unit'.  If the
5849 : user has specified that a 64-bit perl is to be built,
5850 : we may need to set or change some other defaults.
5851 if $test -f use64bitint.cbu; then
5852         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5853         . ./use64bitint.cbu
5854 fi
5855 case "$use64bitint" in
5856 "$define"|true|[yY]*)
5857         case "$longsize" in
5858         4) case "$archname64" in
5859            '') archname64=64int ;;
5860            esac
5861            ;;
5862         esac
5863         ;;
5864 esac
5865
5866 : Look for a hint-file generated 'call-back-unit'.  If the
5867 : user has specified that a maximally 64-bit perl is to be built,
5868 : we may need to set or change some other defaults.
5869 if $test -f use64bitall.cbu; then
5870         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5871         . ./use64bitall.cbu
5872 fi
5873 case "$use64bitall" in
5874 "$define"|true|[yY]*)
5875         case "$longsize" in
5876         4) case "$archname64" in
5877            ''|64int) archname64=64all ;;
5878            esac
5879            ;;
5880         esac
5881         ;;
5882 esac
5883
5884 case "$d_quad:$use64bitint" in
5885 $undef:$define)
5886         cat >&4 <<EOF
5887
5888 *** You have chosen to use 64-bit integers,
5889 *** but none can be found.
5890 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5891 *** Cannot continue, aborting.
5892
5893 EOF
5894         exit 1
5895         ;;
5896 esac
5897
5898 : check for length of double
5899 echo " "
5900 case "$doublesize" in
5901 '')
5902         echo "Checking to see how big your double precision numbers are..." >&4
5903         $cat >try.c <<EOCP
5904 #include <stdio.h>
5905 #$i_stdlib I_STDLIB
5906 #ifdef I_STDLIB
5907 #include <stdlib.h>
5908 #endif
5909 int main()
5910 {
5911     printf("%d\n", (int)sizeof(double));
5912     exit(0);
5913 }
5914 EOCP
5915         set try
5916         if eval $compile_ok; then
5917                 doublesize=`$run ./try`
5918                 echo "Your double is $doublesize bytes long."
5919         else
5920                 dflt='8'
5921                 echo "(I can't seem to compile the test program.  Guessing...)"
5922                 rp="What is the size of a double precision number (in bytes)?"
5923                 . ./myread
5924                 doublesize="$ans"
5925         fi
5926         ;;
5927 esac
5928 $rm_try
5929
5930 : check for long doubles
5931 echo " "
5932 echo "Checking to see if you have long double..." >&4
5933 echo 'int main() { long double x = 7.0; }' > try.c
5934 set try
5935 if eval $compile; then
5936         val="$define"
5937         echo "You have long double."
5938 else
5939         val="$undef"
5940         echo "You do not have long double."
5941 fi
5942 $rm_try
5943 set d_longdbl
5944 eval $setvar
5945
5946 : check for length of long double
5947 case "${d_longdbl}${longdblsize}" in
5948 $define)
5949         echo " "
5950         echo "Checking to see how big your long doubles are..." >&4
5951         $cat >try.c <<'EOCP'
5952 #include <stdio.h>
5953 int main()
5954 {
5955         printf("%d\n", sizeof(long double));
5956 }
5957 EOCP
5958         set try
5959         set try
5960         if eval $compile; then
5961                 longdblsize=`$run ./try`
5962                 echo "Your long doubles are $longdblsize bytes long."
5963         else
5964                 dflt='8'
5965                 echo " "
5966                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5967                 rp="What is the size of a long double (in bytes)?"
5968                 . ./myread
5969                 longdblsize="$ans"
5970         fi
5971         if $test "X$doublesize" = "X$longdblsize"; then
5972                 echo "That isn't any different from an ordinary double."
5973                 echo "I'll keep your setting anyway, but you may see some"
5974                 echo "harmless compilation warnings."
5975         fi
5976         ;;
5977 esac
5978 $rm_try
5979
5980 : determine the architecture name
5981 echo " "
5982 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5983         tarch=`arch`"-$osname"
5984 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5985         if uname -m > tmparch 2>&1 ; then
5986                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5987                         -e 's/$/'"-$osname/" tmparch`
5988         else
5989                 tarch="$osname"
5990         fi
5991         $rm -f tmparch
5992 else
5993         tarch="$osname"
5994 fi
5995 case "$myarchname" in
5996 ''|"$tarch") ;;
5997 *)
5998         echo "(Your architecture name used to be $myarchname.)"
5999         archname=''
6000         ;;
6001 esac
6002 case "$targetarch" in
6003 '') ;;
6004 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6005 esac
6006 myarchname="$tarch"
6007 case "$archname" in
6008 '') dflt="$tarch";;
6009 *) dflt="$archname";;
6010 esac
6011 rp='What is your architecture name'
6012 . ./myread
6013 archname="$ans"
6014 case "$usethreads" in
6015 $define)
6016         echo "Threads selected." >&4
6017         case "$archname" in
6018         *-thread*) echo "...and architecture name already has -thread." >&4
6019                 ;;
6020         *)      archname="$archname-thread"
6021                 echo "...setting architecture name to $archname." >&4
6022                 ;;
6023         esac
6024         ;;
6025 esac
6026 case "$usemultiplicity" in
6027 $define)
6028         echo "Multiplicity selected." >&4
6029         case "$archname" in
6030         *-multi*) echo "...and architecture name already has -multi." >&4
6031                 ;;
6032         *)      archname="$archname-multi"
6033                 echo "...setting architecture name to $archname." >&4
6034                 ;;
6035         esac
6036         ;;
6037 esac
6038 case "$use64bitint$use64bitall" in
6039 *"$define"*)
6040         case "$archname64" in
6041         '')
6042                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6043                 ;;
6044         *)
6045                 case "$use64bitint" in
6046                 "$define") echo "64 bit integers selected." >&4 ;;
6047                 esac
6048                 case "$use64bitall" in
6049                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6050                 esac
6051                 case "$archname" in
6052                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6053                         ;;
6054                 *)      archname="$archname-$archname64"
6055                         echo "...setting architecture name to $archname." >&4
6056                         ;;
6057                 esac
6058                 ;;
6059         esac
6060 esac
6061 case "$uselongdouble" in
6062 $define)
6063         echo "Long doubles selected." >&4
6064         case "$longdblsize" in
6065         $doublesize)
6066                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6067                 ;;
6068         *)
6069                 case "$archname" in
6070                 *-ld*) echo "...and architecture name already has -ld." >&4
6071                         ;;
6072                 *)      archname="$archname-ld"
6073                         echo "...setting architecture name to $archname." >&4
6074                         ;;
6075                 esac
6076                 ;;
6077         esac
6078         ;;
6079 esac
6080 if $test -f archname.cbu; then
6081         echo "Your platform has some specific hints for architecture name, using them..."
6082         . ./archname.cbu
6083 fi
6084
6085 : set the prefixit variable, to compute a suitable default value
6086 prefixit='case "$3" in
6087 ""|none)
6088         case "$oldprefix" in
6089         "") eval "$1=\"\$$2\"";;
6090         *)
6091                 case "$3" in
6092                 "") eval "$1=";;
6093                 none)
6094                         eval "tp=\"\$$2\"";
6095                         case "$tp" in
6096                         ""|" ") eval "$1=\"\$$2\"";;
6097                         *) eval "$1=";;
6098                         esac;;
6099                 esac;;
6100         esac;;
6101 *)
6102         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6103         case "$tp" in
6104         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6105         /*-$oldprefix/*|\~*-$oldprefix/*)
6106                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6107         *) eval "$1=\"\$$2\"";;
6108         esac;;
6109 esac'
6110
6111 : determine installation style
6112 : For now, try to deduce it from prefix unless it is already set.
6113 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6114 case "$installstyle" in
6115 '')     case "$prefix" in
6116                 *perl*) dflt='lib';;
6117                 *) dflt='lib/perl5' ;;
6118         esac
6119         ;;
6120 *)      dflt="$installstyle" ;;
6121 esac
6122 : Probably not worth prompting for this since we prompt for all
6123 : the directories individually, and the prompt would be too long and
6124 : confusing anyway.
6125 installstyle=$dflt
6126
6127 : determine where public executables go
6128 echo " "
6129 set dflt bin bin
6130 eval $prefixit
6131 fn=d~
6132 rp='Pathname where the public executables will reside?'
6133 . ./getfile
6134 if $test "X$ansexp" != "X$binexp"; then
6135         installbin=''
6136 fi
6137 prefixvar=bin
6138 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6139 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6140 :     this via initialinstalllocation
6141 . ./setprefixvar
6142
6143 case "$userelocatableinc" in
6144 $define|true|[yY]*)     dflt='y' ;;
6145 *)                      dflt='n' ;;
6146 esac
6147 cat <<EOM
6148
6149 Would you like to build Perl so that the installation is relocatable, so that
6150 library paths in @INC are determined relative to the path of the perl binary?
6151 This is not advised for system Perl installs, or if you need to run setid
6152 scripts or scripts under taint mode.
6153
6154 If this doesn't make any sense to you, just accept the default '$dflt'.
6155 EOM
6156 rp='Use relocatable @INC?'
6157 . ./myread
6158 case "$ans" in
6159 y|Y)    val="$define" ;;
6160 *)      val="$undef"  ;;
6161 esac
6162 set userelocatableinc
6163 eval $setvar
6164
6165 initialinstalllocation="$binexp"
6166 : Default prefix is now "up one level from where the binaries are"
6167 case "$userelocatableinc" in
6168 $define|true|[yY]*)
6169     bin=".../"
6170     binexp=".../"
6171     prefix=".../.."
6172     prefixexp=".../.."
6173     installprefixexp=".../.."
6174     ;;
6175 esac
6176
6177 : determine where private library files go
6178 : Usual default is /usr/local/lib/perl5/$version.
6179 : Also allow things like /opt/perl/lib/$version, since
6180 : /opt/perl/lib/perl5... would be redundant.
6181 : The default "style" setting is made in installstyle.U
6182 case "$installstyle" in
6183 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6184 *)       set dflt privlib lib/$version ;;
6185 esac
6186 eval $prefixit
6187 $cat <<EOM
6188
6189 There are some auxiliary files for $package that need to be put into a
6190 private library directory that is accessible by everyone.
6191
6192 EOM
6193 fn=$binexp
6194 fn=d~+
6195 rp='Pathname where the private library files will reside?'
6196 . ./getfile
6197 prefixvar=privlib
6198 . ./setprefixvar
6199
6200 : set the prefixup variable, to restore leading tilda escape
6201 prefixup='case "$prefixexp" in
6202 "$prefix") ;;
6203 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6204 esac'
6205
6206 : determine where public architecture dependent libraries go
6207 set archlib archlib
6208 eval $prefixit
6209 : privlib default is /usr/local/lib/$package/$version
6210 : archlib default is /usr/local/lib/$package/$version/$archname
6211 : privlib may have an optional trailing /share.
6212 tdflt=`echo $privlib | $sed 's,/share$,,'`
6213 tdflt=$tdflt/$archname
6214 case "$archlib" in
6215 '')     dflt=$tdflt
6216         ;;
6217 *)      dflt="$archlib"
6218     ;;
6219 esac
6220 $cat <<EOM
6221
6222 $spackage contains architecture-dependent library files.  If you are
6223 sharing libraries in a heterogeneous environment, you might store
6224 these files in a separate location.  Otherwise, you can just include
6225 them with the rest of the public library files.
6226
6227 EOM
6228 fn=$binexp
6229 fn=d+~
6230 rp='Where do you want to put the public architecture-dependent libraries?'
6231 . ./getfile
6232 prefixvar=archlib
6233 . ./setprefixvar
6234 if $test X"$archlib" = X"$privlib"; then
6235         d_archlib="$undef"
6236 else
6237         d_archlib="$define"
6238 fi
6239
6240 : see if setuid scripts can be secure
6241 $cat <<EOM
6242
6243 Some kernels have a bug that prevents setuid #! scripts from being
6244 secure.  Some sites have disabled setuid #! scripts because of this.
6245
6246 First let's decide if your kernel supports secure setuid #! scripts.
6247 (If setuid #! scripts would be secure but have been disabled anyway,
6248 don't say that they are secure if asked.)
6249
6250 EOM
6251
6252 val="$undef"
6253 if $test -d /dev/fd; then
6254         echo "#!$ls" >reflect
6255         chmod +x,u+s reflect
6256         ./reflect >flect 2>&1
6257         if $contains "/dev/fd" flect >/dev/null; then
6258                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6259                 val="$define"
6260         else
6261                 $cat <<EOM
6262 If you are not sure if they are secure, I can check but I'll need a
6263 username and password different from the one you are using right now.
6264 If you don't have such a username or don't want me to test, simply
6265 enter 'none'.
6266
6267 EOM
6268                 rp='Other username to test security of setuid scripts with?'
6269                 dflt='none'
6270                 . ./myread
6271                 case "$ans" in
6272                 n|none)
6273                         case "$d_suidsafe" in
6274                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6275                                 dflt=n;;
6276                         "$undef")
6277                                 echo "Well, the $hint value is *not* secure." >&4
6278                                 dflt=n;;
6279                         *)      echo "Well, the $hint value *is* secure." >&4
6280                                 dflt=y;;
6281                         esac
6282                         ;;
6283                 *)
6284                         $rm -f reflect flect
6285                         echo "#!$ls" >reflect
6286                         chmod +x,u+s reflect
6287                         echo >flect
6288                         chmod a+w flect
6289                         echo '"su" will (probably) prompt you for '"$ans's password."
6290                         su $ans -c './reflect >flect'
6291                         if $contains "/dev/fd" flect >/dev/null; then
6292                                 echo "Okay, it looks like setuid scripts are secure." >&4
6293                                 dflt=y
6294                         else
6295                                 echo "I don't think setuid scripts are secure." >&4
6296                                 dflt=n
6297                         fi
6298                         ;;
6299                 esac
6300                 rp='Does your kernel have *secure* setuid scripts?'
6301                 . ./myread
6302                 case "$ans" in
6303                 [yY]*)  val="$define";;
6304                 *)      val="$undef";;
6305                 esac
6306         fi
6307 else
6308         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6309         echo "(That's for file descriptors, not floppy disks.)"
6310         val="$undef"
6311 fi
6312 set d_suidsafe
6313 eval $setvar
6314
6315 $rm -f reflect flect
6316
6317 : now see if they want to do setuid emulation
6318 if $test $patchlevel -lt 11; then
6319 echo " "
6320 val="$undef"
6321 case "$d_suidsafe" in
6322 "$define")
6323         val="$undef"
6324         echo "No need to emulate SUID scripts since they are secure here." >&4
6325         ;;
6326 *)
6327         $cat <<EOM
6328 Some systems have disabled setuid scripts, especially systems where
6329 setuid scripts cannot be secure.  On systems where setuid scripts have
6330 been disabled, the setuid/setgid bits on scripts are currently
6331 useless.  It is possible for $package to detect those bits and emulate
6332 setuid/setgid in a secure fashion.  This emulation will only work if
6333 setuid scripts have been disabled in your kernel.
6334
6335 EOM
6336         case "$d_dosuid" in
6337         "$define") dflt=y ;;
6338         *) dflt=n ;;
6339         esac
6340         rp="Do you want to do setuid/setgid emulation?"
6341         . ./myread
6342         case "$ans" in
6343         [yY]*)  val="$define";;
6344         *)      val="$undef";;
6345         esac
6346         ;;
6347 esac
6348 set d_dosuid
6349 eval $setvar
6350 else
6351     case "$d_dosuid" in
6352         "$define")
6353         cat >&4 <<EOH
6354
6355 SUID emulation has been removed for 5.12
6356 Please re-run Configure without -Dd_dosuid
6357
6358 EOH
6359         exit 1;
6360         ;;
6361     esac
6362     d_dosuid=undef
6363 fi
6364
6365 : Find perl5.005 or later.
6366 echo "Looking for a previously installed perl5.005 or later... "
6367 case "$perl5" in
6368 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6369                 : Check if this perl is recent and can load a simple module
6370                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371                         perl5=$tdir/perl
6372                         break;
6373                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374                         perl5=$tdir/perl5
6375                         break;
6376                 fi
6377         done
6378         ;;
6379 *)      perl5="$perl5"
6380         ;;
6381 esac
6382 case "$perl5" in
6383 '')     echo "None found.  That's ok.";;
6384 *)      echo "Using $perl5." ;;
6385 esac
6386
6387 : Set the siteprefix variables
6388 $cat <<EOM
6389
6390 After $package is installed, you may wish to install various
6391 add-on modules and utilities.  Typically, these add-ons will
6392 be installed under $prefix with the rest
6393 of this package.  However, you may wish to install such add-ons
6394 elsewhere under a different prefix.
6395
6396 If you do not wish to put everything under a single prefix, that's
6397 ok.  You will be prompted for the individual locations; this siteprefix
6398 is only used to suggest the defaults.
6399
6400 The default should be fine for most people.
6401
6402 EOM
6403 fn=d~+
6404 rp='Installation prefix to use for add-on modules and utilities?'
6405 : XXX Here might be another good place for an installstyle setting.
6406 case "$siteprefix" in
6407 '') dflt=$prefix ;;
6408 *)  dflt=$siteprefix ;;
6409 esac
6410 . ./getfile
6411 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6412 oldsiteprefix=''
6413 case "$siteprefix" in
6414 '') ;;
6415 *)      case "$ans" in
6416         "$prefix") ;;
6417         *) oldsiteprefix="$prefix";;
6418         esac
6419         ;;
6420 esac
6421 siteprefix="$ans"
6422 siteprefixexp="$ansexp"
6423
6424 : determine where site specific libraries go.
6425 : Usual default is /usr/local/lib/perl5/site_perl/$version
6426 : The default "style" setting is made in installstyle.U
6427 : XXX No longer works with Prefixit stuff.
6428 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6429 case "$sitelib" in
6430 '') case "$installstyle" in
6431         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6432         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6433         esac
6434         ;;
6435 *)      dflt="$sitelib"
6436         ;;
6437 esac
6438 $cat <<EOM
6439
6440 The installation process will create a directory for
6441 site-specific extensions and modules.  Most users find it convenient
6442 to place all site-specific files in this directory rather than in the
6443 main distribution directory.
6444
6445 EOM
6446 fn=d~+
6447 rp='Pathname for the site-specific library files?'
6448 . ./getfile
6449 prefixvar=sitelib
6450 . ./setprefixvar
6451 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6452
6453 : Determine list of previous versions to include in @INC
6454 $cat > getverlist <<EOPL
6455 #!$perl5 -w
6456 use File::Basename;
6457 \$api_versionstring = "$api_versionstring";
6458 \$version = "$version";
6459 \$stem = "$sitelib_stem";
6460 \$archname = "$archname";
6461 EOPL
6462         $cat >> getverlist <<'EOPL'
6463 # The list found is store twice for each entry: the original name, and
6464 # the binary broken down version as pack "sss", so sorting is easy and
6465 # unambiguous. This will work for all versions that have a maximum of
6466 # three digit groups, separate by '.'s or '_'s. Names are extended with
6467 # ".0.0" to ensure at least three elements for the pack.
6468 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6469
6470 # Can't have leading @ because metaconfig interprets it as a command!
6471 ;@inc_version_list=();
6472 # XXX Redo to do opendir/readdir?
6473 if (-d $stem) {
6474     chdir($stem);
6475     ;@candidates = map {
6476         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6477     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6478 }
6479 else {
6480     ;@candidates = ();
6481 }
6482
6483 ($pversion, $aversion, $vsn5005) = map {
6484     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6485 foreach $d (@candidates) {
6486     if ($d->[1] lt $pversion) {
6487         if ($d->[1] ge $aversion) {
6488             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6489         }
6490         elsif ($d->[1] ge $vsn5005) {
6491             unshift(@inc_version_list, grep { -d } $d->[0]);
6492         }
6493     }
6494     else {
6495         # Skip newer version.  I.e. don't look in
6496         # 5.7.0 if we're installing 5.6.1.
6497     }
6498 }
6499
6500 if (@inc_version_list) {
6501     print join(' ', @inc_version_list);
6502 }
6503 else {
6504     # Blank space to preserve value for next Configure run.
6505     print " ";
6506 }
6507 EOPL
6508 chmod +x getverlist
6509 case "$inc_version_list" in
6510 '')     if test -x "$perl5$exe_ext"; then
6511                 dflt=`$perl5 getverlist`
6512         else
6513                 dflt='none'
6514         fi
6515         ;;
6516 $undef) dflt='none' ;;
6517 *)  eval dflt=\"$inc_version_list\" ;;
6518 esac
6519 case "$dflt" in
6520 ''|' ') dflt=none ;;
6521 esac
6522 case "$dflt" in
6523 5.005) dflt=none ;;
6524 esac
6525 $cat <<EOM
6526
6527 In order to ease the process of upgrading, this version of perl
6528 can be configured to use modules built and installed with earlier
6529 versions of perl that were installed under $prefix.  Specify here
6530 the list of earlier versions that this version of perl should check.
6531 If Configure detected no earlier versions of perl installed under
6532 $prefix, then the list will be empty.  Answer 'none' to tell perl
6533 to not search earlier versions.
6534
6535 The default should almost always be sensible, so if you're not sure,
6536 just accept the default.
6537 EOM
6538
6539 rp='List of earlier versions to include in @INC?'
6540 . ./myread
6541 case "$ans" in
6542 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6543 *) inc_version_list="$ans" ;;
6544 esac
6545 case "$inc_version_list" in
6546 ''|' ')
6547         inc_version_list_init='0'
6548         d_inc_version_list="$undef"
6549         ;;
6550 *)      inc_version_list_init=`echo $inc_version_list |
6551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6552         d_inc_version_list="$define"
6553         ;;
6554 esac
6555 $rm -f getverlist
6556
6557 : see if malloc/malloc.h has to be included
6558 set malloc/malloc.h i_mallocmalloc
6559 eval $inhdr
6560
6561 : see if this is a malloc.h system
6562 : we want a real compile instead of Inhdr because some systems have a
6563 : malloc.h that just gives a compile error saying to use stdlib.h instead
6564 echo " "
6565 $cat >try.c <<EOCP
6566 #include <stdlib.h>
6567 #include <malloc.h>
6568 #$i_mallocmalloc I_MALLOCMALLOC
6569 #ifdef I_MALLOCMALLOC
6570 # include <malloc/malloc.h>
6571 #endif
6572
6573 int main () { return 0; }
6574 EOCP
6575 set try
6576 if eval $compile; then
6577     echo "<malloc.h> found." >&4
6578     val="$define"
6579 else
6580     echo "<malloc.h> NOT found." >&4
6581     val="$undef"
6582 fi
6583 $rm_try
6584 set i_malloc
6585 eval $setvar
6586
6587 : check for void type
6588 echo " "
6589 echo "Checking to see how well your C compiler groks the void type..." >&4
6590 case "$voidflags" in
6591 '')
6592         $cat >try.c <<EOCP
6593 #$i_stdlib I_STDLIB
6594 #ifdef I_STDLIB
6595 #include <stdlib.h>
6596 #endif
6597 #if TRY & 1
6598 void sub() {
6599 #else
6600 sub() {
6601 #endif
6602         extern void moo();      /* function returning void */
6603         void (*goo)();          /* ptr to func returning void */
6604 #if TRY & 8
6605         void *hue;              /* generic ptr */
6606 #endif
6607 #if TRY & 2
6608         void (*foo[10])();
6609 #endif
6610
6611 #if TRY & 4
6612         if(goo == moo) {
6613                 exit(0);
6614         }
6615 #endif
6616         exit(0);
6617 }
6618 int main() { sub(); }
6619 EOCP
6620         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6621                 voidflags=$defvoidused
6622         echo "Good.  It appears to support void to the level $package wants.">&4
6623                 if $contains warning .out >/dev/null 2>&1; then
6624                         echo "However, you might get some warnings that look like this:"
6625                         $cat .out
6626                 fi
6627         else
6628 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6629                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6630                         echo "It supports 1..."
6631                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6632                                 echo "It also supports 2..."
6633                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6634                                         voidflags=7
6635                                         echo "And it supports 4 but not 8 definitely."
6636                                 else
6637                                         echo "It doesn't support 4..."
6638                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6639                                                 voidflags=11
6640                                                 echo "But it supports 8."
6641                                         else
6642                                                 voidflags=3
6643                                                 echo "Neither does it support 8."
6644                                         fi
6645                                 fi
6646                         else
6647                                 echo "It does not support 2..."
6648                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6649                                         voidflags=13
6650                                         echo "But it supports 4 and 8."
6651                                 else
6652                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6653                                                 voidflags=5
6654                                                 echo "And it supports 4 but has not heard about 8."
6655                                         else
6656                                                 echo "However it supports 8 but not 4."
6657                                         fi
6658                                 fi
6659                         fi
6660                 else
6661                         echo "There is no support at all for void."
6662                         voidflags=0
6663                 fi
6664         fi
6665 esac
6666 case "$voidflags" in
6667 "$defvoidused") ;;
6668 *)      $cat >&4 <<'EOM'
6669   Support flag bits are:
6670     1: basic void declarations.
6671     2: arrays of pointers to functions returning void.
6672     4: operations between pointers to and addresses of void functions.
6673     8: generic void pointers.
6674 EOM
6675         dflt="$voidflags";
6676         rp="Your void support flags add up to what?"
6677         . ./myread
6678         voidflags="$ans"
6679         ;;
6680 esac
6681 $rm_try
6682
6683 : check for length of pointer
6684 echo " "
6685 case "$ptrsize" in
6686 '')
6687         echo "Checking to see how big your pointers are..." >&4
6688         if test "$voidflags" -gt 7; then
6689                 echo '#define VOID_PTR char *' > try.c
6690         else
6691                 echo '#define VOID_PTR void *' > try.c
6692         fi
6693         $cat >>try.c <<EOCP
6694 #include <stdio.h>
6695 #$i_stdlib I_STDLIB
6696 #ifdef I_STDLIB
6697 #include <stdlib.h>
6698 #endif
6699 int main()
6700 {
6701     printf("%d\n", (int)sizeof(VOID_PTR));
6702     exit(0);
6703 }
6704 EOCP
6705         set try
6706         if eval $compile_ok; then
6707                 ptrsize=`$run ./try`
6708                 echo "Your pointers are $ptrsize bytes long."
6709         else
6710                 dflt='4'
6711                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6712                 rp="What is the size of a pointer (in bytes)?"
6713                 . ./myread
6714                 ptrsize="$ans"
6715         fi
6716         ;;
6717 esac
6718 $rm_try
6719 case "$use64bitall" in
6720 "$define"|true|[yY]*)
6721         case "$ptrsize" in
6722         4)      cat <<EOM >&4
6723
6724 *** You have chosen a maximally 64-bit build,
6725 *** but your pointers are only 4 bytes wide.
6726 *** Please rerun Configure without -Duse64bitall.
6727 EOM
6728                 case "$d_quad" in
6729                 define)
6730                         cat <<EOM >&4
6731 *** Since you have quads, you could possibly try with -Duse64bitint.
6732 EOM
6733                         ;;
6734                 esac
6735                 cat <<EOM >&4
6736 *** Cannot continue, aborting.
6737
6738 EOM
6739
6740                 exit 1
6741                 ;;
6742         esac
6743         ;;
6744 esac
6745
6746
6747 : determine whether to use malloc wrapping
6748 echo " "
6749 case "$usemallocwrap" in
6750 [yY]*|true|$define)     dflt='y' ;;
6751 [nN]*|false|$undef)     dflt='n' ;;
6752 *)      case "$usedevel" in
6753         [yY]*|true|$define)     dflt='y' ;;
6754         *) dflt='n' ;;
6755         esac
6756         ;;
6757 esac
6758 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6759 . ./myread
6760 usemallocwrap="$ans"
6761 case "$ans" in
6762 y*|true)
6763         usemallocwrap="$define" ;;
6764 *)
6765         usemallocwrap="$undef" ;;
6766 esac
6767
6768 : determine which malloc to compile in
6769 echo " "
6770 case "$usemymalloc" in
6771 [yY]*|true|$define)     dflt='y' ;;
6772 [nN]*|false|$undef)     dflt='n' ;;
6773 *)      case "$ptrsize" in
6774         4) dflt='y' ;;
6775         *) dflt='n' ;;
6776         esac
6777         ;;
6778 esac
6779 rp="Do you wish to attempt to use the malloc that comes with $package?"
6780 . ./myread
6781 usemymalloc="$ans"
6782 case "$ans" in
6783 y*|true)
6784         usemymalloc='y'
6785         mallocsrc='malloc.c'
6786         mallocobj="malloc$_o"
6787         d_mymalloc="$define"
6788         case "$libs" in
6789         *-lmalloc*)
6790                 : Remove malloc from list of libraries to use
6791                 echo "Removing unneeded -lmalloc from library list" >&4
6792                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6793                 shift
6794                 libs="$*"
6795                 echo "libs = $libs" >&4
6796                 ;;
6797         esac
6798         ;;
6799 *)
6800         usemymalloc='n'
6801         mallocsrc=''
6802         mallocobj=''
6803         d_mymalloc="$undef"
6804         ;;
6805 esac
6806
6807 : compute the return types of malloc and free
6808 echo " "
6809 $cat >malloc.c <<END
6810 #$i_malloc I_MALLOC
6811 #$i_stdlib I_STDLIB
6812 #include <stdio.h>
6813 #include <sys/types.h>
6814 #ifdef I_MALLOC
6815 #include <malloc.h>
6816 #endif
6817 #ifdef I_STDLIB
6818 #include <stdlib.h>
6819 #endif
6820 #ifdef TRY_MALLOC
6821 void *malloc();
6822 #endif
6823 #ifdef TRY_FREE
6824 void free();
6825 #endif
6826 END
6827 case "$malloctype" in
6828 '')
6829         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6830                 malloctype='void *'
6831         else
6832                 malloctype='char *'
6833         fi
6834         ;;
6835 esac
6836 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6837
6838 case "$freetype" in
6839 '')
6840         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6841                 freetype='void'
6842         else
6843                 freetype='int'
6844         fi
6845         ;;
6846 esac
6847 echo "Your system uses $freetype free(), it would seem." >&4
6848 $rm -f malloc.[co]
6849 : determine where site specific architecture-dependent libraries go.
6850 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6851 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6852 : sitelib may have an optional trailing /share.
6853 case "$sitearch" in
6854 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6855         dflt="$dflt/$archname"
6856         ;;
6857 *)      dflt="$sitearch"
6858         ;;
6859 esac
6860 set sitearch sitearch none
6861 eval $prefixit
6862 $cat <<EOM
6863
6864 The installation process will also create a directory for
6865 architecture-dependent site-specific extensions and modules.
6866
6867 EOM
6868 fn=d~+
6869 rp='Pathname for the site-specific architecture-dependent library files?'
6870 . ./getfile
6871 prefixvar=sitearch
6872 . ./setprefixvar
6873 if $test X"$sitearch" = X"$sitelib"; then
6874         d_sitearch="$undef"
6875 else
6876         d_sitearch="$define"
6877 fi
6878
6879 : Set the vendorprefix variables
6880 $cat <<EOM
6881
6882 The installation process will also create a directory for
6883 vendor-supplied add-ons.  Vendors who supply perl with their system
6884 may find it convenient to place all vendor-supplied files in this
6885 directory rather than in the main distribution directory.  This will
6886 ease upgrades between binary-compatible maintenance versions of perl.
6887
6888 Of course you may also use these directories in whatever way you see
6889 fit.  For example, you might use them to access modules shared over a
6890 company-wide network.
6891
6892 The default answer should be fine for most people.
6893 This causes further questions about vendor add-ons to be skipped
6894 and no vendor-specific directories will be configured for perl.
6895
6896 EOM
6897 rp='Do you want to configure vendor-specific add-on directories?'
6898 case "$usevendorprefix" in
6899 define|true|[yY]*) dflt=y ;;
6900 *)      : User may have set vendorprefix directly on Configure command line.
6901         case "$vendorprefix" in
6902         ''|' ') dflt=n ;;
6903         *)      dflt=y ;;
6904         esac
6905         ;;
6906 esac
6907 . ./myread
6908 case "$ans" in
6909 [yY]*)  fn=d~+
6910         rp='Installation prefix to use for vendor-supplied add-ons?'
6911         case "$vendorprefix" in
6912         '') dflt='' ;;
6913         *)  dflt=$vendorprefix ;;
6914         esac
6915         . ./getfile
6916         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6917         oldvendorprefix=''
6918         case "$vendorprefix" in
6919         '') ;;
6920         *)      case "$ans" in
6921                 "$prefix") ;;
6922                 *) oldvendorprefix="$prefix";;
6923                 esac
6924                 ;;
6925         esac
6926         usevendorprefix="$define"
6927         vendorprefix="$ans"
6928         vendorprefixexp="$ansexp"
6929         ;;
6930 *)      usevendorprefix="$undef"
6931         vendorprefix=''
6932         vendorprefixexp=''
6933         ;;
6934 esac
6935
6936 : Set the vendorlib variables
6937 case "$vendorprefix" in
6938 '')     d_vendorlib="$undef"
6939         vendorlib=''
6940         vendorlibexp=''
6941         ;;
6942 *)      d_vendorlib="$define"
6943         : determine where vendor-supplied modules go.
6944         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6945         case "$vendorlib" in
6946         '')
6947                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6948                 case "$installstyle" in
6949                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6950                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6951                 esac
6952                 ;;
6953         *)      dflt="$vendorlib"
6954                 ;;
6955         esac
6956         fn=d~+
6957         rp='Pathname for the vendor-supplied library files?'
6958         . ./getfile
6959         vendorlib="$ans"
6960         vendorlibexp="$ansexp"
6961         ;;
6962 esac
6963 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6964 prefixvar=vendorlib
6965 . ./installprefix
6966
6967 : Set the vendorarch variables
6968 case "$vendorprefix" in
6969 '')     d_vendorarch="$undef"
6970         vendorarch=''
6971         vendorarchexp=''
6972         ;;
6973 *)      d_vendorarch="$define"
6974         : determine where vendor-supplied architecture-dependent libraries go.
6975         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6976         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6977         : vendorlib may have an optional trailing /share.
6978         case "$vendorarch" in
6979         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6980                 dflt="$dflt/$archname"
6981                 ;;
6982         *)      dflt="$vendorarch" ;;
6983         esac
6984         fn=d~+
6985         rp='Pathname for vendor-supplied architecture-dependent files?'
6986         . ./getfile
6987         vendorarch="$ans"
6988         vendorarchexp="$ansexp"
6989         ;;
6990 esac
6991 prefixvar=vendorarch
6992 . ./installprefix
6993 if $test X"$vendorarch" = X"$vendorlib"; then
6994         d_vendorarch="$undef"
6995 else
6996         d_vendorarch="$define"
6997 fi
6998
6999 : Final catch-all directories to search
7000 $cat <<EOM
7001
7002 Lastly, you can have perl look in other directories for extensions and
7003 modules in addition to those already specified.
7004 These directories will be searched after 
7005         $sitearch 
7006         $sitelib 
7007 EOM
7008 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7009 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7010 echo ' '
7011 case "$otherlibdirs" in
7012 ''|' ') dflt='none' ;;
7013 *)      dflt="$otherlibdirs" ;;
7014 esac
7015 $cat <<EOM
7016 Enter a colon-separated set of extra paths to include in perl's @INC
7017 search path, or enter 'none' for no extra paths.
7018
7019 EOM
7020
7021 rp='Colon-separated list of additional directories for perl to search?'
7022 . ./myread
7023 case "$ans" in
7024 ' '|''|none)    otherlibdirs=' ' ;;     
7025 *)      otherlibdirs="$ans" ;;
7026 esac
7027 case "$otherlibdirs" in
7028 ' ') val=$undef ;;
7029 *)      val=$define ;;
7030 esac
7031 set d_perl_otherlibdirs
7032 eval $setvar
7033
7034 : Cruising for prototypes
7035 echo " "
7036 echo "Checking out function prototypes..." >&4
7037 $cat >prototype.c <<EOCP
7038 #$i_stdlib I_STDLIB
7039 #ifdef I_STDLIB
7040 #include <stdlib.h>
7041 #endif
7042 int main(int argc, char *argv[]) {
7043         exit(0);}
7044 EOCP
7045 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7046         echo "Your C compiler appears to support function prototypes."
7047         val="$define"
7048 else
7049         echo "Your C compiler doesn't seem to understand function prototypes."
7050         val="$undef"
7051 fi
7052 set prototype
7053 eval $setvar
7054 $rm -f prototype*
7055
7056 : Check if ansi2knr is required
7057 case "$prototype" in
7058 "$define") ;;
7059 *)      ansi2knr='ansi2knr'
7060         echo " "
7061         cat <<EOM >&4
7062
7063 $me:  FATAL ERROR:
7064 This version of $package can only be compiled by a compiler that 
7065 understands function prototypes.  Unfortunately, your C compiler 
7066         $cc $ccflags
7067 doesn't seem to understand them.  Sorry about that.
7068
7069 If GNU cc is available for your system, perhaps you could try that instead.  
7070
7071 Eventually, we hope to support building Perl with pre-ANSI compilers.
7072 If you would like to help in that effort, please contact <perlbug@perl.org>.
7073
7074 Aborting Configure now.
7075 EOM
7076         exit 2
7077         ;;
7078 esac
7079
7080 : DTrace support
7081 dflt_dtrace='/usr/sbin/dtrace'
7082 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7083
7084 cat <<EOM
7085
7086 Perl can be built to support DTrace on platforms that support it.
7087 DTrace is a diagnosis and performance analysis tool from Sun.
7088
7089 If this doesn't make any sense to you, just accept the default '$dflt'.
7090 EOM
7091
7092 while $test 1 ; do
7093         case "$usedtrace" in
7094         $define|true|[yY]*)
7095                 dflt='y'
7096                 ;;
7097         ?*)
7098                 dflt='y'
7099                 dflt_dtrace=$usedtrace
7100                 ;;
7101         *)
7102                 dflt='n'
7103                 ;;
7104         esac
7105
7106         rp='Support DTrace if available?'
7107         . ./myread
7108         case "$ans" in
7109         y|Y)    val="$define" ;;
7110         *)      val="$undef" ;;
7111         esac
7112         set usedtrace
7113         eval $setvar
7114
7115         test "X$usedtrace" != "X$define" && break
7116
7117         echo " "
7118         rp='Where is the dtrace executable?'
7119         dflt=$dflt_dtrace
7120         . ./getfile
7121         val="$ans"
7122         set dtrace
7123         eval $setvar
7124
7125         if $test -f $dtrace
7126         then
7127                 if $dtrace -h -s ../perldtrace.d \
7128                         -o perldtrace.tmp >/dev/null 2>&1 \
7129                         && rm -f perldtrace.tmp
7130                 then
7131                         echo " "
7132                         echo "Good: your $dtrace knows about the -h flag."
7133                 else
7134                         cat >&2 <<EOM
7135
7136 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7137 ***
7138 *** Your installed dtrace doesn't support the -h switch to compile a D
7139 *** program into a C header. Can't continue.
7140
7141 EOM
7142                         exit 1
7143                 fi
7144                 break;
7145         fi
7146
7147         case "$fastread" in
7148         yes)
7149                 cat >&2 <<EOM
7150
7151 *** $me:  Fatal Error:  $dtrace not found.
7152 *** Can't continue.
7153
7154 EOM
7155                 exit 1
7156                 ;;
7157         *)
7158                 echo "*** $dtrace was not found."
7159                 echo " "
7160                 ;;
7161         esac
7162 done
7163
7164 : See if we want extra modules installed
7165 echo " "
7166 case "$extras" in
7167 '') dflt='n';;
7168 *) dflt='y';;
7169 esac
7170 cat <<EOM
7171 Perl can be built with extra modules or bundles of modules which
7172 will be fetched from the CPAN and installed alongside Perl.
7173
7174 Notice that you will need access to the CPAN; either via the Internet,
7175 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7176 be asked later to configure the CPAN.pm module which will in turn do
7177 the installation of the rest of the extra modules or bundles.)
7178
7179 Notice also that if the modules require any external software such as
7180 libraries and headers (the libz library and the zlib.h header for the
7181 Compress::Zlib module, for example) you MUST have any such software
7182 already installed, this configuration process will NOT install such
7183 things for you.
7184
7185 If this doesn't make any sense to you, just accept the default '$dflt'.
7186 EOM
7187 rp='Install any extra modules (y or n)?'
7188 . ./myread
7189 case "$ans" in
7190 y|Y)
7191         cat <<EOM
7192
7193 Please list any extra modules or bundles to be installed from CPAN,
7194 with spaces between the names.  The names can be in any format the
7195 'install' command of CPAN.pm will understand.  (Answer 'none',
7196 without the quotes, to install no extra modules or bundles.)
7197 EOM
7198         rp='Extras?'
7199         dflt="$extras"
7200         . ./myread
7201         extras="$ans"
7202 esac
7203 case "$extras" in
7204 ''|'none')
7205         val=''
7206         $rm -f ../extras.lst
7207         ;;
7208 *)      echo "(Saving the list of extras for later...)"
7209         echo "$extras" > ../extras.lst
7210         val="'$extras'"
7211         ;;
7212 esac
7213 set extras
7214 eval $setvar
7215 echo " "
7216
7217 : determine where html pages for programs go
7218 set html1dir html1dir none
7219 eval $prefixit
7220 $cat <<EOM
7221
7222 If you wish to install html files for programs in $spackage, indicate
7223 the appropriate directory here.  To skip installing html files,
7224 answer "none".
7225 EOM
7226 case "$html1dir" in
7227 ''|none|$undef|' ') dflt=none ;;
7228 *) dflt=$html1dir ;;
7229 esac
7230 fn=dn+~
7231 rp="Directory for the main $spackage html pages?"
7232 . ./getfile
7233 prefixvar=html1dir
7234 . ./setprefixvar
7235 : Use ' ' for none so value is preserved next time through Configure
7236 $test X"$html1dir" = "X" && html1dir=' '
7237
7238 : determine where html pages for libraries and modules go
7239 set html3dir html3dir none
7240 eval $prefixit
7241 $cat <<EOM
7242
7243 If you wish to install html files for modules associated with $spackage,
7244 indicate the appropriate directory here.  To skip installing html files,
7245 answer "none".
7246 EOM
7247 : There is no obvious default.  If they have specified html1dir, then
7248 : try to key off that, possibly changing .../html1 into .../html3.
7249 case "$html3dir" in
7250 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7251 *) dflt=$html3dir ;;
7252 esac
7253 fn=dn+~
7254 rp="Directory for the $spackage module html pages?"
7255 . ./getfile
7256 prefixvar=html3dir
7257 . ./setprefixvar
7258 : Use ' ' for none so value is preserved next time through Configure
7259 $test X"$html3dir" = "X" && html3dir=' '
7260
7261 : determine whether to install perl also as /usr/bin/perl
7262
7263 echo " "
7264 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7265         $cat <<EOM
7266 Many scripts expect perl to be installed as /usr/bin/perl.
7267
7268 If you want to, I can install the perl you are about to compile
7269 as /usr/bin/perl (in addition to $bin/perl).
7270 EOM
7271         if test -f /usr/bin/perl; then
7272             $cat <<EOM
7273
7274 However, please note that because you already have a /usr/bin/perl,
7275 overwriting that with a new Perl would very probably cause problems.
7276 Therefore I'm assuming you don't want to do that (unless you insist).
7277
7278 EOM
7279             case "$installusrbinperl" in
7280             "$define"|[yY]*)    dflt='y';;
7281             *)                  dflt='n';;
7282             esac
7283         else
7284             $cat <<EOM
7285
7286 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7287
7288 EOM
7289             case "$installusrbinperl" in
7290             "$undef"|[nN]*)     dflt='n';;
7291             *)                  dflt='y';;
7292             esac
7293         fi
7294         rp="Do you want to install perl as /usr/bin/perl?"
7295         . ./myread
7296         case "$ans" in
7297         [yY]*)  val="$define";;
7298         *)      val="$undef" ;;
7299         esac
7300 else
7301         val="$undef"
7302 fi
7303 set installusrbinperl
7304 eval $setvar
7305
7306 : Check if we are using the GNU C library
7307 echo " "
7308 echo "Checking for GNU C Library..." >&4
7309 cat >try.c <<'EOCP'
7310 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7311    alone are insufficient to distinguish different versions, such as
7312    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7313    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7314 */
7315 #include <stdio.h>
7316 int main(void)
7317 {
7318 #ifdef __GLIBC__
7319 #   ifdef __GLIBC_MINOR__
7320 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7321 #           include <gnu/libc-version.h>
7322             printf("%s\n",  gnu_get_libc_version());
7323 #       else
7324             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7325 #       endif
7326 #   else
7327         printf("%d\n",  __GLIBC__);
7328 #   endif
7329     return 0;
7330 #else
7331     return 1;
7332 #endif
7333 }
7334 EOCP
7335 set try
7336 if eval $compile_ok && $run ./try > glibc.ver; then
7337         val="$define"
7338         gnulibc_version=`$cat glibc.ver`
7339         echo "You are using the GNU C Library version $gnulibc_version"
7340 else
7341         val="$undef"
7342         gnulibc_version=''
7343         echo "You are not using the GNU C Library"
7344 fi
7345 $rm_try glibc.ver
7346 set d_gnulibc
7347 eval $setvar
7348
7349 : see if nm is to be used to determine whether a symbol is defined or not
7350 case "$usenm" in
7351 '')
7352         dflt=''
7353         case "$d_gnulibc" in
7354         "$define")
7355                 echo " "
7356                 echo "nm probably won't work on the GNU C Library." >&4
7357                 dflt=n
7358                 ;;
7359         esac
7360         case "$dflt" in
7361         '') 
7362                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7363                         echo " "
7364                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7365                         echo "'nm' won't be sufficient on this sytem." >&4
7366                         dflt=n
7367                 fi
7368                 ;;
7369         esac
7370         case "$dflt" in
7371         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7372                 if $test $dflt -gt 20; then
7373                         dflt=y
7374                 else
7375                         dflt=n
7376                 fi
7377                 ;;
7378         esac
7379         ;;
7380 *)
7381         case "$usenm" in
7382         true|$define) dflt=y;;
7383         *) dflt=n;;
7384         esac
7385         ;;
7386 esac
7387 $cat <<EOM
7388
7389 I can use $nm to extract the symbols from your C libraries. This
7390 is a time consuming task which may generate huge output on the disk (up
7391 to 3 megabytes) but that should make the symbols extraction faster. The
7392 alternative is to skip the 'nm' extraction part and to compile a small
7393 test program instead to determine whether each symbol is present. If
7394 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7395 this may be the best solution.
7396
7397 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7398
7399 EOM
7400 rp="Shall I use $nm to extract C symbols from the libraries?"
7401 . ./myread
7402 case "$ans" in
7403 [Nn]*) usenm=false;;
7404 *) usenm=true;;
7405 esac
7406
7407 runnm=$usenm
7408 case "$reuseval" in
7409 true) runnm=false;;
7410 esac
7411
7412 : nm options which may be necessary
7413 case "$nm_opt" in
7414 '') if $test -f /mach_boot; then
7415                 nm_opt=''       # Mach
7416         elif $test -d /usr/ccs/lib; then
7417                 nm_opt='-p'     # Solaris (and SunOS?)
7418         elif $test -f /dgux; then
7419                 nm_opt='-p'     # DG-UX
7420         elif $test -f /lib64/rld; then
7421                 nm_opt='-p'     # 64-bit Irix
7422         else
7423                 nm_opt=''
7424         fi;;
7425 esac
7426
7427 : nm options which may be necessary for shared libraries but illegal
7428 : for archive libraries.  Thank you, Linux.
7429 case "$nm_so_opt" in
7430 '')     case "$myuname" in
7431         *linux*|gnu*)
7432                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7433                         nm_so_opt='--dynamic'
7434                 fi
7435                 ;;
7436         esac
7437         ;;
7438 esac
7439
7440 : Figure out where the libc is located
7441 case "$runnm" in
7442 true)
7443 : get list of predefined functions in a handy place
7444 echo " "
7445 case "$libc" in
7446 '') libc=unknown
7447         case "$libs" in
7448         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7449         esac
7450         ;;
7451 esac
7452 case "$libs" in
7453 '') ;;
7454 *)  for thislib in $libs; do
7455         case "$thislib" in
7456         -lc|-lc_s)
7457                 : Handle C library specially below.
7458                 ;;
7459         -l*)
7460                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7461                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7462                         :
7463                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7464                         :
7465                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7466                         :
7467                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7468                         :
7469                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7470                         :
7471                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7472                         :
7473                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7474                         :
7475                 else
7476                         try=''
7477                 fi
7478                 libnames="$libnames $try"
7479                 ;;
7480         *) libnames="$libnames $thislib" ;;
7481         esac
7482         done
7483         ;;
7484 esac
7485 xxx=normal
7486 case "$libc" in
7487 unknown)
7488         set /lib/libc.$so
7489         for xxx in $libpth; do
7490                 $test -r $1 || set $xxx/libc.$so
7491                 : The messy sed command sorts on library version numbers.
7492                 $test -r $1 || \
7493                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7494                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7495                                 h
7496                                 s/[0-9][0-9]*/0000&/g
7497                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7498                                 G
7499                                 s/\n/ /' | \
7500                          $sort | $sed -e 's/^.* //'`
7501                 eval set \$$#
7502         done
7503         $test -r $1 || set /usr/ccs/lib/libc.$so
7504         $test -r $1 || set /lib/libsys_s$_a
7505         ;;
7506 *)
7507         set blurfl
7508         ;;
7509 esac
7510 if $test -r "$1"; then
7511         echo "Your (shared) C library seems to be in $1."
7512         libc="$1"
7513 elif $test -r /lib/libc && $test -r /lib/clib; then
7514         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7515         xxx=apollo
7516         libc='/lib/clib /lib/libc'
7517         if $test -r /lib/syslib; then
7518                 echo "(Your math library is in /lib/syslib.)"
7519                 libc="$libc /lib/syslib"
7520         fi
7521 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7522         echo "Your C library seems to be in $libc, as you said before."
7523 elif $test -r $incpath/usr/lib/libc$_a; then
7524         libc=$incpath/usr/lib/libc$_a;
7525         echo "Your C library seems to be in $libc.  That's fine."
7526 elif $test -r /lib/libc$_a; then
7527         libc=/lib/libc$_a;
7528         echo "Your C library seems to be in $libc.  You're normal."
7529 else
7530         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7531                 :
7532         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7533                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7534         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7535                 :
7536         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7537                 :
7538         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7539                 :
7540         else
7541                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7542         fi
7543         if $test -r "$tans"; then
7544                 echo "Your C library seems to be in $tans, of all places."
7545                 libc=$tans
7546         else
7547                 libc='blurfl'
7548         fi
7549 fi
7550 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7551         dflt="$libc"
7552         cat <<EOM
7553
7554 If the guess above is wrong (which it might be if you're using a strange
7555 compiler, or your machine supports multiple models), you can override it here.
7556
7557 EOM
7558 else
7559         dflt=''
7560         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7561         cat >&4 <<EOM
7562 I can't seem to find your C library.  I've looked in the following places:
7563
7564 EOM
7565         $sed 's/^/      /' libpath
7566         cat <<EOM
7567
7568 None of these seems to contain your C library. I need to get its name...
7569
7570 EOM
7571 fi
7572 fn=f
7573 rp='Where is your C library?'
7574 . ./getfile
7575 libc="$ans"
7576
7577 echo " "
7578 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7579 set X `cat libnames`
7580 shift
7581 xxx=files
7582 case $# in 1) xxx=file; esac
7583 echo "Extracting names from the following $xxx for later perusal:" >&4
7584 echo " "
7585 $sed 's/^/      /' libnames >&4
7586 echo " "
7587 $echo $n "This may take a while...$c" >&4
7588
7589 for file in $*; do
7590         case $file in
7591         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7592         *) $nm $nm_opt $file 2>/dev/null;;
7593         esac
7594 done >libc.tmp
7595
7596 $echo $n ".$c"
7597 $grep fprintf libc.tmp > libc.ptf
7598 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7599 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7600 xxx='[ADTSIWi]'
7601 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7602         eval $xscan;\
7603         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7604                 eval $xrun
7605 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7606         eval $xscan;\
7607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7608                 eval $xrun
7609 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7610         eval $xscan;\
7611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7612                 eval $xrun
7613 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7614         eval $xscan;\
7615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7616                 eval $xrun
7617 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7618         eval $xscan;\
7619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620                 eval $xrun
7621 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7622         eval $xscan;\
7623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7624                 eval $xrun
7625 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7626                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7627         eval $xscan;\
7628         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7629                 eval $xrun
7630 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7631         eval $xscan;\
7632         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7633                 eval $xrun
7634 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7635         eval $xscan;\
7636         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637                 eval $xrun
7638 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7655         eval $xscan;\
7656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657                 eval $xrun
7658 else
7659         $nm -p $* 2>/dev/null >libc.tmp
7660         $grep fprintf libc.tmp > libc.ptf
7661         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7662                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7663         then
7664                 nm_opt='-p'
7665                 eval $xrun
7666         else
7667                 echo " "
7668                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7669                 com=''
7670                 if $ar t $libc > libc.tmp && \
7671                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7672                 then
7673                         for thisname in $libnames $libc; do
7674                                 $ar t $thisname >>libc.tmp
7675                         done
7676                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7677                         echo "Ok." >&4
7678                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7679                         for thisname in $libnames $libc; do
7680                                 $ar tv $thisname >>libc.tmp
7681                                 emximp -o tmp.imp $thisname \
7682                                     2>/dev/null && \
7683                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7684                                     < tmp.imp >>libc.tmp
7685                                 $rm -f tmp.imp
7686                         done
7687                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7688                         echo "Ok." >&4
7689                 else
7690                         echo "$ar didn't seem to work right." >&4
7691                         echo "Maybe this is a Cray...trying bld instead..." >&4
7692                         if  bld t $libc | \
7693                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7694                                 $test -s libc.list
7695                         then
7696                                 for thisname in $libnames; do
7697                                         bld t $libnames | \
7698                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7699                                         $ar t $thisname >>libc.tmp
7700                                 done
7701                                 echo "Ok." >&4
7702                         else
7703                                 echo "That didn't work either.  Giving up." >&4
7704                                 exit 1
7705                         fi
7706                 fi
7707         fi
7708 fi
7709 nm_extract="$com"
7710 case "$PASE" in
7711 define)
7712     echo " "
7713     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7714     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7715     ;;
7716 *)  if $test -f /lib/syscalls.exp; then
7717         echo " "
7718         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7719         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7720                 /lib/syscalls.exp >>libc.list
7721     fi
7722     ;;
7723 esac
7724 ;;
7725 esac
7726 $rm -f libnames libpath
7727
7728 : see if dld is available
7729 set dld.h i_dld
7730 eval $inhdr
7731
7732 : Check if we are using C++
7733 echo " "
7734 echo "Checking for C++..." >&4
7735 $cat >try.c <<'EOCP'
7736 #include <stdio.h>
7737 int main(void)
7738 {
7739 #ifdef __cplusplus
7740     return 0;
7741 #else
7742     return 1;
7743 #endif
7744 }
7745 EOCP
7746 set try
7747 if eval $compile_ok && $run ./try; then
7748         val="$define"
7749         echo "You are using a C++ compiler."
7750 else
7751         val="$undef"
7752         echo "You are not using a C++ compiler."
7753 fi
7754 $rm_try cplusplus$$
7755 set d_cplusplus
7756 eval $setvar
7757
7758 : is a C symbol defined?
7759 csym='tlook=$1;
7760 case "$3" in
7761 -v) tf=libc.tmp; tdc="";;
7762 -a) tf=libc.tmp; tdc="[]";;
7763 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7764 esac;
7765 case "$d_cplusplus" in
7766     $define)    extern_C="extern \"C\"" ;;
7767     *)          extern_C="extern"       ;;
7768 esac;
7769 tx=yes;
7770 case "$reuseval-$4" in
7771 true-) ;;
7772 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7773 esac;
7774 case "$tx" in
7775 yes)
7776         tval=false;
7777         if $test "$runnm" = true; then
7778                 if $contains $tlook $tf >/dev/null 2>&1; then
7779                         tval=true;
7780                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7781                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7782                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7783                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7784                         $rm_try;
7785                 fi;
7786         else
7787                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7788                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7789                 $rm_try;
7790         fi;
7791         ;;
7792 *)
7793         case "$tval" in
7794         $define) tval=true;;
7795         *) tval=false;;
7796         esac;
7797         ;;
7798 esac;
7799 eval "$2=$tval"'
7800
7801 : define an is-in-libc? function
7802 inlibc='echo " "; td=$define; tu=$undef;
7803 sym=$1; var=$2; eval "was=\$$2";
7804 tx=yes;
7805 case "$reuseval$was" in
7806 true) ;;
7807 true*) tx=no;;
7808 esac;
7809 case "$tx" in
7810 yes)
7811         set $sym tres -f;
7812         eval $csym;
7813         case "$tres" in
7814         true)
7815                 echo "$sym() found." >&4;
7816                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7817         *)
7818                 echo "$sym() NOT found." >&4;
7819                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7820         esac;;
7821 *)
7822         case "$was" in
7823         $define) echo "$sym() found." >&4;;
7824         *) echo "$sym() NOT found." >&4;;
7825         esac;;
7826 esac'
7827
7828 : see if dlopen exists
7829 xxx_runnm="$runnm"
7830 xxx_ccflags="$ccflags"
7831 runnm=false
7832 : with g++ one needs -shared to get is-in-libc to work for dlopen
7833 case "$gccversion" in
7834 '')     ;;
7835 *)      case "$d_cplusplus" in
7836         "$define") ccflags="$ccflags -shared" ;;
7837         esac
7838         ;;
7839 esac
7840 set dlopen d_dlopen
7841 eval $inlibc
7842 runnm="$xxx_runnm"
7843 ccflags="$xxx_ccflags"
7844
7845 : see if this is a unistd.h system
7846 set unistd.h i_unistd
7847 eval $inhdr
7848
7849 : determine which dynamic loading, if any, to compile in
7850 echo " "
7851 dldir="ext/DynaLoader"
7852 case "$usedl" in
7853 $define|y|true)
7854         dflt='y'
7855         usedl="$define"
7856         ;;
7857 $undef|n|false)
7858         dflt='n'
7859         usedl="$undef"
7860         ;;
7861 *)
7862         dflt='n'
7863         case "$d_dlopen" in
7864             $define) dflt='y' ;;
7865         esac
7866         case "$i_dld" in
7867             $define) dflt='y' ;;
7868         esac
7869         : Does a dl_xxx.xs file exist for this operating system
7870         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7871         ;;
7872 esac
7873 rp="Do you wish to use dynamic loading?"
7874 . ./myread
7875 usedl="$ans"
7876 bin_ELF="$undef"
7877 case "$ans" in
7878 y*) usedl="$define"
7879         case "$dlsrc" in
7880         '')
7881                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7882                         dflt="$dldir/dl_${osname}.xs"
7883                 elif $test "$d_dlopen" = "$define" ; then
7884                         dflt="$dldir/dl_dlopen.xs"
7885                 elif $test "$i_dld" = "$define" ; then
7886                         dflt="$dldir/dl_dld.xs"
7887                 else
7888                         dflt=''
7889                 fi
7890                 ;;
7891         *)      dflt="$dldir/$dlsrc"
7892                 ;;
7893         esac
7894     echo "The following dynamic loading files are available:"
7895         : Can not go over to $dldir because getfile has path hard-coded in.
7896         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7897         rp="Source file to use for dynamic loading"
7898         fn="fne"
7899         gfpth="$src"
7900         . ./getfile
7901         usedl="$define"
7902         : emulate basename
7903         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7904
7905         $cat << EOM
7906
7907 Some systems may require passing special flags to $cc -c to
7908 compile modules that will be used to create a shared library.
7909 To use no flags, say "none".
7910
7911 EOM
7912     case "$cccdlflags" in
7913     '') case "$gccversion" in
7914                 '') case "$osname" in
7915                         hpux)   dflt='+z' ;;
7916                         next)   dflt='none' ;;
7917                         irix*)  dflt='-KPIC' ;;
7918                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7919                         sunos)  dflt='-pic' ;;
7920                         *)      dflt='none' ;;
7921                     esac
7922                         ;;
7923                 *)  case "$osname" in
7924                         darwin) dflt='none' ;;
7925                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7926                         *)      dflt='-fpic' ;;
7927                     esac ;;
7928             esac ;;
7929         ' ') dflt='none' ;;
7930     *)  dflt="$cccdlflags" ;;
7931     esac
7932     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7933     . ./myread
7934     case "$ans" in
7935     none) cccdlflags=' ' ;;
7936     *) cccdlflags="$ans" ;;
7937     esac
7938
7939     cat << EOM
7940
7941 Some systems use ld to create libraries that can be dynamically loaded,
7942 while other systems (such as those using ELF) use $cc.
7943
7944 EOM
7945         case "$ld" in
7946         '')     $cat >try.c <<EOM
7947 /* Test for whether ELF binaries are produced */
7948 #include <fcntl.h>
7949 #$i_stdlib I_STDLIB
7950 #ifdef I_STDLIB
7951 #include <stdlib.h>
7952 #endif
7953 #$i_unistd I_UNISTD
7954 #ifdef I_UNISTD
7955 #include <unistd.h>
7956 #endif
7957 int main() {
7958         char b[4];
7959         int i = open("a.out",O_RDONLY);
7960         if(i == -1)
7961                 exit(1); /* fail */
7962         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7963                 exit(0); /* succeed (yes, it's ELF) */
7964         else
7965                 exit(1); /* fail */
7966 }
7967 EOM
7968                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7969                         cat <<EOM
7970 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7971 EOM
7972                         dflt="$cc"
7973                         bin_ELF="$define"
7974                 else
7975                         echo "I'll use ld to build dynamic libraries."
7976                         dflt='ld'
7977                 fi
7978                 $rm_try
7979                 ;;
7980         *)      dflt="$ld"
7981                 ;;
7982         esac
7983
7984     rp="What command should be used to create dynamic libraries?"
7985     . ./myread
7986         ld="$ans"
7987
7988     cat << EOM
7989
7990 Some systems may require passing special flags to $ld to create a
7991 library that can be dynamically loaded.  If your ld flags include
7992 -L/other/path options to locate libraries outside your loader's normal
7993 search path, you may need to specify those -L options here as well.  To
7994 use no flags, say "none".
7995
7996 EOM
7997     case "$lddlflags" in
7998     '') case "$osname" in
7999                         beos) dflt='-nostart' ;;
8000                         haiku) dflt='-shared' ;;
8001                         hpux) dflt='-b';
8002                               case "$gccversion" in
8003                               '') dflt="$dflt +vnocompatwarnings" ;;
8004                               esac
8005                               ;;
8006                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8007                         next)  dflt='none' ;;
8008                         solaris) dflt='-G' ;;
8009                         sunos) dflt='-assert nodefinitions' ;;
8010                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8011                 *)     dflt='none' ;;
8012                         esac
8013                         ;;
8014     *) dflt="$lddlflags" ;;
8015     esac
8016
8017         : Try to guess additional flags to pick up local libraries.
8018         : Be careful not to append to a plain 'none'
8019         case "$dflt" in
8020         none) dflt='' ;;
8021         esac
8022         for thisflag in $ldflags; do
8023                 case "$thisflag" in
8024                 -L*|-R*|-Wl,-R*)
8025                         case " $dflt " in
8026                         *" $thisflag "*) ;;
8027                         *) dflt="$dflt $thisflag" ;;
8028                         esac
8029                         ;;
8030                 esac
8031         done
8032
8033         case "$dflt" in
8034         ''|' ') dflt='none' ;;
8035         esac
8036
8037         case "$ldflags" in
8038         *-fstack-protector*)
8039             case "$dflt" in
8040                         *-fstack-protector*) ;; # Don't add it again
8041                         *) dflt="$dflt -fstack-protector" ;; 
8042                 esac
8043                 ;;
8044         esac
8045
8046
8047     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8048     . ./myread
8049     case "$ans" in
8050     none) lddlflags=' ' ;;
8051     *) lddlflags="$ans" ;;
8052     esac
8053
8054         cat <<EOM
8055
8056 Some systems may require passing special flags to $cc to indicate that
8057 the resulting executable will use dynamic linking.  To use no flags,
8058 say "none".
8059
8060 EOM
8061     case "$ccdlflags" in
8062     '') case "$osname" in
8063             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8064             next|sunos) dflt='none' ;;
8065             *)          dflt='none' ;;
8066             esac ;;
8067     ' ')  dflt='none' ;;
8068     *)  dflt="$ccdlflags" ;;
8069     esac
8070     rp="Any special flags to pass to $cc to use dynamic linking?"
8071     . ./myread
8072     case "$ans" in
8073     none) ccdlflags=' ' ;;
8074     *) ccdlflags="$ans" ;;
8075     esac
8076     ;;
8077 *)  usedl="$undef"
8078         ld='ld'
8079     dlsrc='dl_none.xs'
8080     lddlflags=''
8081     ccdlflags=''
8082     ;;
8083 esac
8084
8085 : Do we want a shared libperl?
8086 also=''
8087 case "$usedl" in
8088 $undef)
8089         # No dynamic loading being used, so don't bother even to prompt.
8090         useshrplib='false'
8091         ;;
8092 *)      case "$useshrplib" in
8093         '')     case "$osname" in
8094                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8095                         dflt=y
8096                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8097                         ;;
8098                 next*)
8099                         case "$osvers" in
8100                         4*)     dflt=y
8101                                 also='Building a shared libperl is needed for MAB support.'
8102                                 ;;
8103                         *)      dflt=n
8104                                 ;;
8105                         esac
8106                         ;;
8107                 *)      dflt=n
8108                         ;;
8109                 esac
8110                 ;;
8111         $define|true|[Yy]*)
8112                 dflt=y
8113                 ;;
8114         *)      dflt=n
8115                 ;;
8116         esac
8117         $cat << EOM
8118
8119 The perl executable is normally obtained by linking perlmain.c with
8120 libperl${_a}, any static extensions (usually just DynaLoader), and
8121 any other libraries needed on this system (such as -lm, etc.).  Since
8122 your system supports dynamic loading, it is probably possible to build
8123 a shared libperl.$so.  If you will have more than one executable linked
8124 to libperl.$so, this will significantly reduce the size of each
8125 executable, but it may have a noticeable effect on performance.  The
8126 default is probably sensible for your system.
8127 $also
8128
8129 EOM
8130         rp="Build a shared libperl.$so (y/n)"
8131         . ./myread
8132         case "$ans" in
8133         true|$define|[Yy]*)
8134                 useshrplib='true'  ;;
8135         *)      useshrplib='false' ;;
8136         esac
8137         ;;
8138 esac
8139
8140 case "$useshrplib" in
8141 true)
8142         case "$userelocatableinc" in
8143         true|define)
8144                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8145                 echo "See INSTALL for an explanation why that won't work." >&4
8146                 exit 4
8147                 ;;
8148         esac
8149         case "$libperl" in
8150         '')
8151                 # Figure out a good name for libperl.so.  Since it gets stored in
8152                 # a version-specific architecture-dependent library, the version
8153                 # number isn't really that important, except for making cc/ld happy.
8154                 #
8155                 # A name such as libperl.so.10.1
8156                 majmin="libperl.$so.$patchlevel.$subversion"
8157                 # A name such as libperl.so.100
8158                 majonly=`echo $patchlevel $subversion |
8159                         $awk '{printf "%d%02d", $1, $2}'`
8160                 majonly=libperl.$so.$majonly
8161                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8162                 # rely on figuring it out from the naming of libc.
8163                 case "${osname}${osvers}" in
8164                 next4*)
8165                         dflt=libperl.5.$so
8166                         # XXX How handle the --version stuff for MAB?
8167                         ;;
8168                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8169                         dflt=libperl.$so
8170                         ;;
8171                 cygwin*) # ld links now against the dll directly
8172                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8173                         majonly=`echo $patchlevel $subversion |
8174                                 $awk '{printf "%03d%03d", $1, $2}'`
8175                         majonly=cygperl5.$majonly.$so
8176                         dflt=$majmin
8177                         ;;
8178                 *)      # Try to guess based on whether libc has major.minor.
8179                         case "$libc" in
8180                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8181                         *libc.$so.[0-9]*) dflt=$majonly ;;
8182                         *)      dflt=libperl.$so ;;
8183                         esac
8184                         ;;
8185                 esac
8186                 ;;
8187         *)      dflt=$libperl
8188                 ;;
8189         esac
8190         cat << EOM
8191
8192 I need to select a good name for the shared libperl.  If your system uses
8193 library names with major and minor numbers, then you might want something
8194 like $majmin.  Alternatively, if your system uses a single version
8195 number for shared libraries, then you might want to use $majonly.
8196 Or, your system might be quite happy with a simple libperl.$so.
8197
8198 Since the shared libperl will get installed into a version-specific
8199 architecture-dependent directory, the version number of the shared perl
8200 library probably isn't important, so the default should be o.k.
8201
8202 EOM
8203         rp='What name do you want to give to the shared libperl?'
8204         . ./myread
8205         libperl=$ans
8206         echo "Ok, I'll use $libperl"
8207         ;;
8208 *)
8209         libperl="libperl${_a}"
8210         ;;
8211 esac
8212
8213 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8214 case "$shrpdir" in
8215 '') ;;
8216 *)      $cat >&4 <<EOM
8217 WARNING:  Use of the shrpdir variable for the installation location of
8218 the shared $libperl is not supported.  It was never documented and
8219 will not work in this version.  Let me (perlbug@perl.org)
8220 know of any problems this may cause.
8221
8222 EOM
8223         case "$shrpdir" in
8224         "$archlibexp/CORE")
8225                 $cat >&4 <<EOM
8226 But your current setting of $shrpdir is
8227 the default anyway, so it's harmless.
8228 EOM
8229                 ;;
8230         *)
8231                 $cat >&4 <<EOM
8232 Further, your current attempted setting of $shrpdir
8233 conflicts with the value of $archlibexp/CORE
8234 that installperl will use.
8235 EOM
8236                 ;;
8237         esac
8238         ;;
8239 esac
8240
8241 # How will the perl executable find the installed shared $libperl?
8242 # Add $xxx to ccdlflags.
8243 # If we can't figure out a command-line option, use $shrpenv to
8244 # set env LD_RUN_PATH.  The main perl makefile uses this.
8245 shrpdir=$archlibexp/CORE
8246 xxx=''
8247 tmp_shrpenv=''
8248 if "$useshrplib"; then
8249     case "$osname" in
8250         aix)
8251                 # We'll set it in Makefile.SH...
8252                 ;;
8253         solaris)
8254                 xxx="-R $shrpdir"
8255                 ;;
8256         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8257                 xxx="-Wl,-R$shrpdir"
8258                 ;;
8259         bsdos|linux|irix*|dec_osf|gnu*)
8260                 xxx="-Wl,-rpath,$shrpdir"
8261                 ;;
8262         next)
8263                 # next doesn't like the default...
8264                 ;;
8265         beos)
8266                 # beos doesn't like the default, either.
8267                 ;;
8268         haiku)
8269                 # Haiku doesn't like the default, either.
8270                 ;;
8271         hpux*)
8272                 # hpux doesn't like the default, either.
8273                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8274                 ;;
8275         cygwin)
8276                 # cygwin needs only ldlibpth
8277                 ;;
8278         *)
8279                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8280                 ;;
8281         esac
8282         case "$xxx" in
8283         '') ;;
8284         *)
8285                 # Only add $xxx if it isn't already in ccdlflags.
8286                 case " $ccdlflags " in
8287                 *" $xxx "*)     ;;
8288                 *)      ccdlflags="$ccdlflags $xxx"
8289                         cat <<EOM >&4
8290
8291 Adding $xxx to the flags
8292 passed to $ld so that the perl executable will find the
8293 installed shared $libperl.
8294
8295 EOM
8296                         ;;
8297                 esac
8298                 ;;
8299         esac
8300 fi
8301 # Fix ccdlflags in AIX for building external extensions.
8302 # (For building Perl itself bare -bE:perl.exp is needed,
8303 #  Makefile.SH takes care of this.)
8304 case "$osname" in
8305 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8306 esac
8307 # Respect a hint or command-line value.
8308 case "$shrpenv" in
8309 '') shrpenv="$tmp_shrpenv" ;;
8310 esac
8311 case "$ldlibpthname" in
8312 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8313 none)   ldlibpthname='' ;;
8314 esac
8315
8316 : determine where manual pages are on this system
8317 echo " "
8318 case "$sysman" in
8319 '') 
8320         syspath='/usr/share/man/man1 /usr/man/man1'
8321         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8322         syspath="$syspath /usr/man/u_man/man1"
8323         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8324         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8325         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8326         sysman=`./loc . /usr/man/man1 $syspath`
8327         ;;
8328 esac
8329 if $test -d "$sysman"; then
8330         echo "System manual is in $sysman." >&4
8331 else
8332         echo "Could not find manual pages in source form." >&4
8333 fi
8334
8335 : determine where manual pages go
8336 set man1dir man1dir none
8337 eval $prefixit
8338 $cat <<EOM
8339
8340 $spackage has manual pages available in source form.
8341 EOM
8342 case "$nroff" in
8343 nroff)
8344         echo "However, you don't have nroff, so they're probably useless to you."
8345         case "$man1dir" in
8346         '') man1dir="none";;
8347         esac;;
8348 esac
8349 echo "If you don't want the manual sources installed, answer 'none'."
8350 case "$man1dir" in
8351 ' ') dflt=none
8352         ;;
8353 '')
8354         lookpath="$prefixexp/share/man/man1"
8355         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8356         lookpath="$lookpath $prefixexp/man/p_man/man1"
8357         lookpath="$lookpath $prefixexp/man/u_man/man1"
8358         lookpath="$lookpath $prefixexp/man/man.1"
8359         case "$sysman" in
8360         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8361         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8362         esac
8363         set dflt
8364         eval $prefixup
8365         ;;
8366 *)  dflt="$man1dir"
8367         ;;
8368 esac
8369 echo " "
8370 fn=dn+~
8371 rp="Where do the main $spackage manual pages (source) go?"
8372 . ./getfile
8373 if $test "X$man1direxp" != "X$ansexp"; then
8374         installman1dir=''
8375 fi
8376 prefixvar=man1dir
8377 . ./setprefixvar
8378
8379 case "$man1dir" in
8380 '')     man1dir=' '
8381         installman1dir='';;
8382 esac
8383
8384 : What suffix to use on installed man pages
8385
8386 case "$man1dir" in
8387 ' ')
8388         man1ext='0'
8389         ;;
8390 *)
8391         rp="What suffix should be used for the main $spackage man pages?"
8392         case "$man1ext" in
8393         '')     case "$man1dir" in
8394                 *1)  dflt=1 ;;
8395                 *1p) dflt=1p ;;
8396                 *1pm) dflt=1pm ;;
8397                 *l) dflt=l;;
8398                 *n) dflt=n;;
8399                 *o) dflt=o;;
8400                 *p) dflt=p;;
8401                 *C) dflt=C;;
8402                 *L) dflt=L;;
8403                 *L1) dflt=L1;;
8404                 *) dflt=1;;
8405                 esac
8406                 ;;
8407         *)      dflt="$man1ext";;
8408         esac
8409         . ./myread
8410         man1ext="$ans"
8411         ;;
8412 esac
8413
8414 : see if we can have long filenames
8415 echo " "
8416 first=123456789abcdef
8417 $rm -f $first
8418 if (echo hi >$first) 2>/dev/null; then
8419         if $test -f 123456789abcde; then
8420                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8421                 val="$undef"
8422         else
8423                 echo 'You can have filenames longer than 14 characters.'>&4
8424                 val="$define"
8425         fi
8426 else
8427         $cat <<'EOM'
8428 You can't have filenames longer than 14 chars.
8429 You can't even think about them!
8430 EOM
8431         val="$undef"
8432 fi
8433 set d_flexfnam
8434 eval $setvar
8435 $rm -rf 123456789abcde*
8436
8437 : determine where library module manual pages go
8438 set man3dir man3dir none
8439 eval $prefixit
8440 $cat <<EOM
8441
8442 $spackage has manual pages for many of the library modules.
8443 EOM
8444
8445 case "$nroff" in
8446 nroff)
8447         $cat <<'EOM'
8448 However, you don't have nroff, so they're probably useless to you.
8449 EOM
8450         case "$man3dir" in
8451         '') man3dir="none";;
8452         esac;;
8453 esac
8454
8455 case "$d_flexfnam" in
8456 undef)
8457         $cat <<'EOM'
8458 However, your system can't handle the long file names like File::Basename.3.
8459 EOM
8460         case "$man3dir" in
8461         '') man3dir="none";;
8462         esac;;
8463 esac
8464
8465 echo "If you don't want the manual sources installed, answer 'none'."
8466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8467 case "$man3dir" in
8468 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8469         if $test -d "$privlib/man/man3"; then
8470                 cat <<EOM >&4
8471
8472 WARNING:  Previous versions of perl installed man3 pages into
8473 $privlib/man/man3.  This version will suggest a
8474 new default of $dflt.
8475 EOM
8476                 tdflt=$dflt
8477                 dflt='n'
8478                 rp='Do you wish to preserve the old behavior?(y/n)'
8479                 . ./myread
8480                 case "$ans" in
8481                 y*) dflt="$privlib/man/man3" ;;
8482                 *)  dflt=$tdflt ;;
8483                 esac
8484     fi
8485         ;;
8486 *)      dflt="$man3dir" ;;
8487 esac
8488 case "$dflt" in
8489 ' ') dflt=none ;;
8490 esac
8491 echo " "
8492 fn=dn+~
8493 rp="Where do the $package library man pages (source) go?"
8494 . ./getfile
8495 prefixvar=man3dir
8496 . ./setprefixvar
8497
8498 case "$man3dir" in
8499 '')     man3dir=' '
8500         installman3dir='';;
8501 esac
8502
8503 : What suffix to use on installed man pages
8504 case "$man3dir" in
8505 ' ')
8506         man3ext='0'
8507         ;;
8508 *)
8509         rp="What suffix should be used for the $package library man pages?"
8510         case "$man3ext" in
8511         '')     case "$man3dir" in
8512                 *3)  dflt=3 ;;
8513                 *3p) dflt=3p ;;
8514                 *3pm) dflt=3pm ;;
8515                 *l) dflt=l;;
8516                 *n) dflt=n;;
8517                 *o) dflt=o;;
8518                 *p) dflt=p;;
8519                 *C) dflt=C;;
8520                 *L) dflt=L;;
8521                 *L3) dflt=L3;;
8522                 *) dflt=3;;
8523                 esac
8524                 ;;
8525         *)      dflt="$man3ext";;
8526         esac
8527         . ./myread
8528         man3ext="$ans"
8529         ;;
8530 esac
8531
8532 : see if we have to deal with yellow pages, now NIS.
8533 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8534         if $test -f /usr/etc/nibindd; then
8535                 echo " "
8536                 echo "I'm fairly confident you're on a NeXT."
8537                 echo " "
8538                 rp='Do you get the hosts file via NetInfo?'
8539                 dflt=y
8540                 case "$hostcat" in
8541                 nidump*) ;;
8542                 '') ;;
8543                 *) dflt=n;;
8544                 esac
8545                 . ./myread
8546                 case "$ans" in
8547                 y*) hostcat='nidump hosts .';;
8548                 *)      case "$hostcat" in
8549                         nidump*) hostcat='';;
8550                         esac
8551                         ;;
8552                 esac
8553         fi
8554         case "$hostcat" in
8555         nidump*) ;;
8556         *)
8557                 case "$hostcat" in
8558                 *ypcat*) dflt=y;;
8559                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8560                                 dflt=y
8561                         else
8562                                 dflt=n
8563                         fi;;
8564                 *) dflt=n;;
8565                 esac
8566                 echo " "
8567                 rp='Are you getting the hosts file via yellow pages?'
8568                 . ./myread
8569                 case "$ans" in
8570                 y*) hostcat='ypcat hosts';;
8571                 *) hostcat='cat /etc/hosts';;
8572                 esac
8573                 ;;
8574         esac
8575 fi
8576 case "$hostcat" in
8577 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8578 esac
8579 case "$groupcat" in
8580 '') test -f /etc/group && groupcat='cat /etc/group';;
8581 esac
8582 case "$passcat" in
8583 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8584 esac
8585
8586 : now get the host name
8587 echo " "
8588 echo "Figuring out host name..." >&4
8589 case "$myhostname" in
8590 '') cont=true
8591         echo 'Maybe "hostname" will work...'
8592         if tans=`sh -c hostname 2>&1` ; then
8593                 myhostname=$tans
8594                 phostname=hostname
8595                 cont=''
8596         fi
8597         ;;
8598 *) cont='';;
8599 esac
8600 if $test "$cont"; then
8601         if ./xenix; then
8602                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8603                 if tans=`cat /etc/systemid 2>&1` ; then
8604                         myhostname=$tans
8605                         phostname='cat /etc/systemid'
8606                         echo "Whadyaknow.  Xenix always was a bit strange..."
8607                         cont=''
8608                 fi
8609         elif $test -r /etc/systemid; then
8610                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8611         fi
8612 fi
8613 if $test "$cont"; then
8614         echo 'No, maybe "uuname -l" will work...'
8615         if tans=`sh -c 'uuname -l' 2>&1` ; then
8616                 myhostname=$tans
8617                 phostname='uuname -l'
8618         else
8619                 echo 'Strange.  Maybe "uname -n" will work...'
8620                 if tans=`sh -c 'uname -n' 2>&1` ; then
8621                         myhostname=$tans
8622                         phostname='uname -n'
8623                 else
8624                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8625                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8626                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8627                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8628                         else
8629                                 case "$myhostname" in
8630                                 '') echo "Does this machine have an identity crisis or something?"
8631                                         phostname='';;
8632                                 *)
8633                                         echo "Well, you said $myhostname before..."
8634                                         phostname='echo $myhostname';;
8635                                 esac
8636                         fi
8637                 fi
8638         fi
8639 fi
8640 case "$myhostname" in
8641 '') myhostname=noname ;;
8642 esac
8643 : you do not want to know about this
8644 set $myhostname
8645 myhostname=$1
8646
8647 : verify guess
8648 if $test "$myhostname" ; then
8649         dflt=y
8650         rp='Your host name appears to be "'$myhostname'".'" Right?"
8651         . ./myread
8652         case "$ans" in
8653         y*) ;;
8654         *) myhostname='';;
8655         esac
8656 fi
8657
8658 : bad guess or no guess
8659 while $test "X$myhostname" = X ; do
8660         dflt=''
8661         rp="Please type the (one word) name of your host:"
8662         . ./myread
8663         myhostname="$ans"
8664 done
8665
8666 : translate upper to lower if necessary
8667 case "$myhostname" in
8668 *[A-Z]*)
8669         echo "(Normalizing case in your host name)"
8670         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8671         ;;
8672 esac
8673
8674 case "$myhostname" in
8675 *.*)
8676         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8677         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8678         echo "(Trimming domain name from host name--host name is now $myhostname)"
8679         ;;
8680 *) case "$mydomain" in
8681         '')
8682                 {
8683                         test "X$hostcat" = "Xypcat hosts" &&
8684                         ypmatch "$myhostname" hosts 2>/dev/null |\
8685                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8686                         $test -s hosts
8687                 } || {
8688                         test "X$hostcat" != "X" &&
8689                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8690                                         /[       ]$myhostname[  . ]/p" > hosts
8691                 }
8692                 tmp_re="[       . ]"
8693                 if $test -f hosts; then
8694                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8695                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8696                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8697                                 hosts | $sort | $uniq | \
8698                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8699                         case `$echo X$dflt` in
8700                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8701                                 dflt=.
8702                                 ;;
8703                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8704                                 ;;
8705                         esac
8706                 else
8707                         echo "(I cannot locate a hosts database anywhere)"
8708                         dflt=.
8709                 fi
8710                 case "$dflt" in
8711                 .)
8712                         tans=`./loc resolv.conf X /etc /usr/etc`
8713                         if $test -f "$tans"; then
8714                                 echo "(Attempting domain name extraction from $tans)"
8715                                 dflt=.`$sed -n -e 's/   / /g' \
8716                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8717                                   -e 1q 2>/dev/null`
8718                                 case "$dflt" in
8719                                 .) dflt=.`$sed -n -e 's/        / /g' \
8720                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8721                                      -e 1q 2>/dev/null`
8722                                         ;;
8723                                 esac
8724                         fi
8725                         ;;
8726                 esac
8727                 case "$dflt" in
8728                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8729                         dflt=.`sh -c domainname 2>/dev/null`
8730                         case "$dflt" in
8731                         '') dflt='.';;
8732                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8733                         esac
8734                         ;;
8735                 esac
8736                 case "$dflt$osname" in
8737                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8738                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8739                         ;;
8740                 esac
8741                 case "$dflt" in
8742                 .) echo "(Lost all hope -- silly guess then)"
8743                         dflt='.nonet'
8744                         ;;
8745                 esac
8746                 $rm -f hosts
8747                 ;;
8748         *) dflt="$mydomain";;
8749         esac;;
8750 esac
8751 echo " "
8752 rp="What is your domain name?"
8753 . ./myread
8754 tans="$ans"
8755 case "$ans" in
8756 '') ;;
8757 .*) ;;
8758 *) tans=".$tans";;
8759 esac
8760 mydomain="$tans"
8761
8762 : translate upper to lower if necessary
8763 case "$mydomain" in
8764 *[A-Z]*)
8765         echo "(Normalizing case in your domain name)"
8766         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8767         ;;
8768 esac
8769
8770 : a little sanity check here
8771 case "$phostname" in
8772 '') ;;
8773 *)
8774         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8775         $myhostname$mydomain|$myhostname) ;;
8776         *)
8777                 case "$phostname" in
8778                 sed*)
8779                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8780                         ;;
8781                 *)
8782                         echo "(That doesn't agree with your $phostname command, by the way.)"
8783                         ;;
8784                 esac
8785         ;;
8786         esac
8787         ;;
8788 esac
8789
8790 : determine the e-mail address of the user who is running us
8791 $cat <<EOM
8792
8793 I need to get your e-mail address in Internet format if possible, i.e.
8794 something like user@host.domain. Please answer accurately since I have
8795 no easy means to double check it. The default value provided below
8796 is most probably close to reality but may not be valid from outside
8797 your organization...
8798
8799 EOM
8800 cont=x
8801 while test "$cont"; do
8802         case "$cf_email" in
8803         '') dflt="$cf_by@$myhostname$mydomain";;
8804         *) dflt="$cf_email";;
8805         esac
8806         rp='What is your e-mail address?'
8807         . ./myread
8808         cf_email="$ans"
8809         case "$cf_email" in
8810         *@*.*) cont='' ;;
8811         *)
8812                 rp='Address does not look like an Internet one.  Use it anyway?'
8813                 case "$fastread" in
8814                 yes) dflt=y ;;
8815                 *) dflt=n ;;
8816                 esac
8817                 . ./myread
8818                 case "$ans" in
8819                 y*) cont='' ;;
8820                 *) echo " " ;;
8821                 esac
8822                 ;;
8823         esac
8824 done
8825
8826 : Ask e-mail of administrator
8827 $cat <<EOM
8828
8829 If you or somebody else will be maintaining perl at your site, please
8830 fill in the correct e-mail address here so that they may be contacted
8831 if necessary. Currently, the "perlbug" program included with perl
8832 will send mail to this address in addition to perlbug@perl.org. You may
8833 enter "none" for no administrator.
8834
8835 EOM
8836 case "$perladmin" in
8837 '') dflt="$cf_email";;
8838 *) dflt="$perladmin";;
8839 esac
8840 rp='Perl administrator e-mail address'
8841 . ./myread
8842 perladmin="$ans"
8843
8844 : determine whether to only install version-specific parts.
8845 echo " "
8846 $cat <<EOM
8847 Do you want to install only the version-specific parts of the perl
8848 distribution?  Usually you do *not* want to do this.
8849 EOM
8850 case "$versiononly" in
8851 "$define"|[Yy]*|true) dflt='y' ;;
8852 *) dflt='n';
8853 esac
8854 rp="Do you want to install only the version-specific parts of perl?"
8855 . ./myread
8856 case "$ans" in
8857 [yY]*)  val="$define";;
8858 *)      val="$undef" ;;
8859 esac
8860 set versiononly
8861 eval $setvar
8862
8863 case "$versiononly" in
8864 "$define") inc_version_list=''
8865            inc_version_list_init=0
8866            ;;
8867 esac
8868
8869 : figure out how to guarantee perl startup
8870 : XXX Note that this currently takes advantage of the bug that binexp ignores
8871 :     the Configure -Dinstallprefix setting, which in turn means that under
8872 :     relocatable @INC, initialinstalllocation is what binexp started as.
8873 case "$startperl" in
8874 '')
8875         case "$sharpbang" in
8876         *!)
8877                 $cat <<EOH
8878
8879 I can use the #! construct to start perl on your system. This will
8880 make startup of perl scripts faster, but may cause problems if you
8881 want to share those scripts and perl is not in a standard place
8882 ($initialinstalllocation/perl) on all your platforms. The alternative
8883 is to force a shell by starting the script with a single ':' character.
8884
8885 EOH
8886                 case "$versiononly" in
8887                 "$define")      dflt="$initialinstalllocation/perl$version";;
8888                 *)              dflt="$initialinstalllocation/perl";;
8889                 esac
8890                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8891                 . ./myread
8892                 case "$ans" in
8893                 none)   startperl=": # use perl";;
8894                 *)      startperl="#!$ans"
8895                         if $test 30 -lt `echo "$ans" | wc -c`; then
8896                                 $cat >&4 <<EOM
8897
8898 WARNING:  Some systems limit the #! command to 32 characters.
8899 If you experience difficulty running Perl scripts with #!, try
8900 installing Perl in a directory with a shorter pathname.
8901
8902 EOM
8903                         fi ;;
8904                 esac
8905                 ;;
8906         *) startperl=": # use perl"
8907                 ;;
8908         esac
8909         ;;
8910 esac
8911 echo "I'll use $startperl to start perl scripts."
8912
8913 : figure best path for perl in scripts
8914 case "$perlpath" in
8915 '')
8916         case "$versiononly" in
8917         "$define")      perlpath="$initialinstalllocation/perl$version";;
8918         *)              perlpath="$initialinstalllocation/perl";;
8919         esac
8920         case "$startperl" in
8921         *!*) ;;
8922         *)
8923                 $cat <<EOH
8924
8925 I will use the "eval 'exec'" idiom to start Perl on your system.
8926 I can use the full path of your Perl binary for this purpose, but
8927 doing so may cause problems if you want to share those scripts and
8928 Perl is not always in a standard place ($initialinstalllocation/perl).
8929
8930 EOH
8931                 dflt="$initialinstalllocation/perl"
8932                 rp="What path shall I use in \"eval 'exec'\"?"
8933                 . ./myread
8934                 perlpath="$ans"
8935                 ;;
8936         esac
8937         ;;
8938 esac
8939 case "$startperl" in
8940 *!*)    ;;
8941 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8942 esac
8943
8944 : determine where public executable scripts go
8945 set scriptdir scriptdir
8946 eval $prefixit
8947 case "$scriptdir" in
8948 '')
8949         dflt="$bin"
8950         : guess some guesses
8951         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8952         $test -d /usr/share/bin     && dflt=/usr/share/bin
8953         $test -d /usr/local/script  && dflt=/usr/local/script
8954         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8955         $test -d $prefixexp/script  && dflt=$prefixexp/script
8956         set dflt
8957         eval $prefixup
8958         ;;
8959 *)  dflt="$scriptdir"
8960         ;;
8961 esac
8962 $cat <<EOM
8963
8964 Some installations have a separate directory just for executable scripts so
8965 that they can mount it across multiple architectures but keep the scripts in
8966 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8967 Or you might just lump your scripts in with all your other executables.
8968
8969 EOM
8970 fn=d~
8971 rp='Where do you keep publicly executable scripts?'
8972 . ./getfile
8973 if $test "X$ansexp" != "X$scriptdirexp"; then
8974         installscript=''
8975 fi
8976 installscriptdir=''
8977 prefixvar=scriptdir
8978 . ./setprefixvar
8979 : A little fix up for an irregularly named variable.
8980 installscript="$installscriptdir"
8981
8982 : determine where add-on public executables go
8983 case "$sitebin" in
8984 '')     dflt=$siteprefix/bin ;;
8985 *)      dflt=$sitebin ;;
8986 esac
8987 fn=d~
8988 rp='Pathname where the add-on public executables should be installed?'
8989 . ./getfile
8990 prefixvar=sitebin
8991 . ./setprefixvar
8992
8993 : determine where add-on html pages go
8994 : There is no standard location, so try to copy the previously-selected
8995 : directory structure for the core html pages.
8996 case "$sitehtml1dir" in
8997 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8998 *)     dflt=$sitehtml1dir ;;
8999 esac
9000 case "$dflt" in
9001 ''|' ') dflt=none ;;
9002 esac
9003 fn=dn+~
9004 rp='Pathname where the site-specific html pages should be installed?'
9005 . ./getfile
9006 prefixvar=sitehtml1dir
9007 . ./setprefixvar
9008
9009 : determine where add-on library html pages go
9010 : There is no standard location, so try to copy the previously-selected
9011 : directory structure for the core html pages.
9012 case "$sitehtml3dir" in
9013 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9014 *)     dflt=$sitehtml3dir ;;
9015 esac
9016 case "$dflt" in
9017 ''|' ') dflt=none ;;
9018 esac
9019 fn=dn+~
9020 rp='Pathname where the site-specific library html pages should be installed?'
9021 . ./getfile
9022 prefixvar=sitehtml3dir
9023 . ./setprefixvar
9024
9025 : determine where add-on manual pages go
9026 case "$siteman1dir" in
9027 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9028 *)      dflt=$siteman1dir ;;
9029 esac
9030 case "$dflt" in
9031 ''|' ') dflt=none ;;
9032 esac
9033 fn=dn+~
9034 rp='Pathname where the site-specific manual pages should be installed?'
9035 . ./getfile
9036 prefixvar=siteman1dir
9037 . ./setprefixvar
9038
9039 : determine where add-on library man pages go
9040 case "$siteman3dir" in
9041 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9042 *)      dflt=$siteman3dir ;;
9043 esac
9044 case "$dflt" in
9045 ''|' ') dflt=none ;;
9046 esac
9047 fn=dn+~
9048 rp='Pathname where the site-specific library manual pages should be installed?'
9049 . ./getfile
9050 prefixvar=siteman3dir
9051 . ./setprefixvar
9052
9053 : determine where add-on public executable scripts go
9054 case "$sitescript" in
9055 '')     dflt=$siteprefix/script
9056         $test -d $dflt || dflt=$sitebin ;;
9057 *)  dflt="$sitescript" ;;
9058 esac
9059 fn=d~+
9060 rp='Pathname where add-on public executable scripts should be installed?'
9061 . ./getfile
9062 prefixvar=sitescript
9063 . ./setprefixvar
9064
9065 : Check if faststdio is requested and available
9066 case "$usefaststdio" in
9067 $define|true|[yY]*|'')
9068         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9069         case "$xversion" in
9070         [68])   dflt='y' ;;
9071         *)      dflt='n' ;;
9072         esac
9073         ;;
9074 *) dflt='n';;
9075 esac
9076 cat <<EOM
9077
9078 Perl can be built to use 'fast stdio', which means using the stdio
9079 library but also directly manipulating the stdio buffers to enable
9080 faster I/O.  Using stdio is better for backward compatibility (especially
9081 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9082 interface has been preferred instead of stdio.
9083
9084 If this doesn't make any sense to you, just accept the default '$dflt'.
9085 EOM
9086 rp='Use the "fast stdio" if available?'
9087 . ./myread
9088 case "$ans" in
9089 y|Y)    val="$define" ;;
9090 *)      val="$undef" ;;
9091 esac
9092 set usefaststdio
9093 eval $setvar
9094
9095
9096 : define an is-a-typedef? function
9097 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9098 case "$inclist" in
9099 "") inclist="sys/types.h";;
9100 esac;
9101 eval "varval=\$$var";
9102 case "$varval" in
9103 "")
9104         $rm -f temp.c;
9105         for inc in $inclist; do
9106                 echo "#include <$inc>" >>temp.c;
9107         done;
9108         echo "#ifdef $type" >> temp.c;
9109         echo "printf(\"We have $type\");" >> temp.c;
9110         echo "#endif" >> temp.c;
9111         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9112         if $contains $type temp.E >/dev/null 2>&1; then
9113                 eval "$var=\$type";
9114         else
9115                 eval "$var=\$def";
9116         fi;
9117         $rm -f temp.?;;
9118 *) eval "$var=\$varval";;
9119 esac'
9120
9121 : define an is-a-typedef? function that prompts if the type is not available.
9122 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9123 case "$inclist" in
9124 "") inclist="sys/types.h";;
9125 esac;
9126 eval "varval=\$$var";
9127 case "$varval" in
9128 "")
9129         $rm -f temp.c;
9130         for inc in $inclist; do
9131                 echo "#include <$inc>" >>temp.c;
9132         done;
9133         echo "#ifdef $type" >> temp.c;
9134         echo "printf(\"We have $type\");" >> temp.c;
9135         echo "#endif" >> temp.c;
9136         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9137         echo " " ;
9138         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9139         if $contains $type temp.E >/dev/null 2>&1; then
9140                 echo "$type found." >&4;
9141                 eval "$var=\$type";
9142         else
9143                 echo "$type NOT found." >&4;
9144                 dflt="$def";
9145                 . ./myread ;
9146                 eval "$var=\$ans";
9147         fi;
9148         $rm -f temp.?;;
9149 *) eval "$var=\$varval";;
9150 esac'
9151
9152 : see what type lseek is declared as in the kernel
9153 rp="What is the type used for lseek's offset on this system?"
9154 set off_t lseektype long stdio.h sys/types.h
9155 eval $typedef_ask
9156
9157 echo " "
9158 echo "Checking to see how big your file offsets are..." >&4
9159 $cat >try.c <<EOCP
9160 #include <sys/types.h>
9161 #include <stdio.h>
9162 int main()
9163 {
9164     printf("%d\n", (int)sizeof($lseektype));
9165     return(0);
9166 }
9167 EOCP
9168 set try
9169 if eval $compile_ok; then
9170         lseeksize=`$run ./try`
9171         echo "Your file offsets are $lseeksize bytes long."
9172 else
9173         dflt=$longsize
9174         echo " "
9175         echo "(I can't seem to compile the test program.  Guessing...)"
9176         rp="What is the size of your file offsets (in bytes)?"
9177         . ./myread
9178         lseeksize="$ans"
9179 fi
9180 $rm_try
9181
9182 : see what type file positions are declared as in the library
9183 rp="What is the type for file position used by fsetpos()?"
9184 set fpos_t fpostype long stdio.h sys/types.h
9185 eval $typedef_ask
9186
9187 : Check size for Fpos_t
9188 echo " "
9189 case "$fpostype" in
9190 *_t) zzz="$fpostype"    ;;
9191 *)   zzz="fpos_t"       ;;
9192 esac
9193 echo "Checking the size of $zzz..." >&4
9194 cat > try.c <<EOCP
9195 #include <sys/types.h>
9196 #include <stdio.h>
9197 #$i_stdlib I_STDLIB
9198 #ifdef I_STDLIB
9199 #include <stdlib.h>
9200 #endif
9201 int main() {
9202     printf("%d\n", (int)sizeof($fpostype));
9203     exit(0);
9204 }
9205 EOCP
9206 set try
9207 if eval $compile_ok; then
9208         yyy=`$run ./try`
9209         case "$yyy" in
9210         '')     fpossize=4
9211                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9212                 ;;
9213         *)      fpossize=$yyy
9214                 echo "Your $zzz is $fpossize bytes long."
9215                 ;;
9216         esac
9217 else
9218         dflt="$longsize"
9219         echo " " >&4
9220         echo "(I can't compile the test program.  Guessing...)" >&4
9221         rp="What is the size of your file positions (in bytes)?"
9222         . ./myread
9223         fpossize="$ans"
9224 fi
9225
9226 : Check for large file support
9227 # Backward compatibility (uselfs is deprecated).
9228 case "$uselfs" in
9229 "$define"|true|[yY]*)
9230         cat <<EOM >&4
9231
9232 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9233 EOM
9234         uselargefiles="$define"
9235         ;;
9236 esac
9237
9238 case "$lseeksize:$fpossize" in
9239 8:8) cat <<EOM
9240
9241 You can have files larger than 2 gigabytes.
9242 EOM
9243    val="$define" ;;
9244 *)    case "$uselargefiles" in
9245    "$undef"|false|[nN]*) dflt='n' ;;
9246    *)   dflt='y' ;;
9247    esac
9248    cat <<EOM
9249
9250 Perl can be built to understand large files (files larger than 2 gigabytes)
9251 on some systems.  To do so, Configure can be run with -Duselargefiles.
9252
9253 If this doesn't make any sense to you, just accept the default '$dflt'.
9254 EOM
9255    rp='Try to understand large files, if available?'
9256    . ./myread
9257    case "$ans" in
9258    y|Y)         val="$define" ;;
9259    *)           val="$undef"  ;;
9260    esac
9261    ;;
9262 esac
9263 set uselargefiles
9264 eval $setvar
9265 : Look for a hint-file generated 'call-back-unit'.  If the
9266 : user has specified that a large files perl is to be built,
9267 : we may need to set or change some other defaults.
9268 if $test -f uselargefiles.cbu; then
9269         echo "Your platform has some specific hints regarding large file builds, using them..."
9270         . ./uselargefiles.cbu
9271 fi
9272 case "$uselargefiles" in
9273 "$define")
9274         if $test -f uselargefiles.cbu; then
9275                 echo " "
9276                 echo "Rechecking to see how big your file offsets are..." >&4
9277                 $cat >try.c <<EOCP
9278 #include <sys/types.h>
9279 #include <stdio.h>
9280 int main()
9281 {
9282     printf("%d\n", (int)sizeof($lseektype));
9283     return(0);
9284 }
9285 EOCP
9286                 set try
9287                 if eval $compile_ok; then
9288                         lseeksize=`$run ./try`
9289                         $echo "Your file offsets are now $lseeksize bytes long."
9290                 else
9291                         dflt="$lseeksize"
9292                         echo " "
9293                         echo "(I can't seem to compile the test program.  Guessing...)"
9294                         rp="What is the size of your file offsets (in bytes)?"
9295                         . ./myread
9296                         lseeksize="$ans"
9297                 fi
9298                 case "$fpostype" in
9299                 *_t) zzz="$fpostype"    ;;
9300                 *)   zzz="fpos_t"       ;;
9301                 esac
9302                 $echo $n "Rechecking the size of $zzz...$c" >&4
9303                 $cat > try.c <<EOCP
9304 #include <sys/types.h>
9305 #include <stdio.h>
9306 #$i_stdlib I_STDLIB
9307 #ifdef I_STDLIB
9308 #include <stdlib.h>
9309 #endif
9310 int main() {
9311     printf("%d\n", (int)sizeof($fpostype));
9312     return(0);
9313 }
9314 EOCP
9315                 set try
9316                 if eval $compile_ok; then
9317                         yyy=`$run ./try`
9318                         dflt="$lseeksize"
9319                         case "$yyy" in
9320                         '')     echo " "
9321                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9322                                 ;;
9323                         *)      fpossize=$yyy
9324                                 echo " $fpossize bytes." >&4
9325                                 ;;
9326                         esac
9327                 else
9328                         dflt="$fpossize"
9329                         echo " "
9330                         echo "(I can't compile the test program.  Guessing...)" >&4
9331                         rp="What is the size of your file positions (in bytes)?"
9332                         . ./myread
9333                         fpossize="$ans"
9334                 fi
9335                 $rm_try
9336         fi
9337         ;;
9338 esac
9339
9340 : Check if we want perlio
9341 useperlio="$define"
9342
9343 : Set the vendorbin variables
9344 case "$vendorprefix" in
9345 '')     d_vendorbin="$undef"
9346         vendorbin=''
9347         vendorbinexp=''
9348         ;;
9349 *)      d_vendorbin="$define"
9350         : determine where vendor-supplied executables go.
9351         case "$vendorbin" in
9352         '') dflt=$vendorprefix/bin ;;
9353         *)      dflt="$vendorbin" ;;
9354         esac
9355         fn=d~+
9356         rp='Pathname for the vendor-supplied executables directory?'
9357         . ./getfile
9358         vendorbin="$ans"
9359         vendorbinexp="$ansexp"
9360         ;;
9361 esac
9362 prefixvar=vendorbin
9363 . ./installprefix
9364
9365 : Set the vendorhtml1dir variables
9366 case "$vendorprefix" in
9367 '')     vendorhtml1dir=''
9368         vendorhtml1direxp=''
9369         ;;
9370 *)      : determine where vendor-supplied html pages go.
9371         : There is no standard location, so try to copy the previously-selected
9372         : directory structure for the core html pages.
9373         : XXX Better default suggestions would be welcome.
9374         case "$vendorhtml1dir" in
9375         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9376         *)      dflt=$vendorhtml1dir ;;
9377         esac
9378         case "$dflt" in
9379         ''|' ') dflt=none ;;
9380         esac
9381         fn=dn+~
9382         rp='Pathname for the vendor-supplied html pages?'
9383         . ./getfile
9384         vendorhtml1dir="$ans"
9385         vendorhtml1direxp="$ansexp"
9386         ;;
9387 esac
9388 : Use ' ' for none so value is preserved next time through Configure
9389 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9390 prefixvar=vendorhtml1dir
9391 . ./installprefix
9392
9393 : Set the vendorhtml3dir variables
9394 case "$vendorprefix" in
9395 '')     vendorhtml3dir=''
9396         vendorhtml3direxp=''
9397         ;;
9398 *)      : determine where vendor-supplied module html pages go.
9399         : There is no standard location, so try to copy the previously-selected
9400         : directory structure for the core html pages.
9401         : XXX Better default suggestions would be welcome.
9402         case "$vendorhtml3dir" in
9403         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9404         *)      dflt=$vendorhtml3dir ;;
9405         esac
9406         case "$dflt" in
9407         ''|' ') dflt=none ;;
9408         esac
9409         fn=dn+~
9410         rp='Pathname for the vendor-supplied html pages?'
9411         . ./getfile
9412         vendorhtml3dir="$ans"
9413         vendorhtml3direxp="$ansexp"
9414         ;;
9415 esac
9416 : Use ' ' for none so value is preserved next time through Configure
9417 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9418 prefixvar=vendorhtml3dir
9419 . ./installprefix
9420
9421 : Set the vendorman1dir variables
9422 case "$vendorprefix" in
9423 '')     vendorman1dir=''
9424         vendorman1direxp=''
9425         ;;
9426 *)      : determine where vendor-supplied manual pages go.
9427         case "$vendorman1dir" in
9428         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9429         *)      dflt=$vendorman1dir ;;
9430         esac
9431         case "$dflt" in
9432         ''|' ') dflt=none ;;
9433         esac
9434         fn=nd~+
9435         rp='Pathname for the vendor-supplied manual section 1 pages?'
9436         . ./getfile
9437         vendorman1dir="$ans"
9438         vendorman1direxp="$ansexp"
9439         ;;
9440 esac
9441 : Use ' ' for none so value is preserved next time through Configure
9442 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9443 prefixvar=vendorman1dir
9444 . ./installprefix
9445
9446 : Set the vendorman3dir variables
9447 case "$vendorprefix" in
9448 '')     vendorman3dir=''
9449         vendorman3direxp=''
9450         ;;
9451 *)      : determine where vendor-supplied module manual pages go.
9452         case "$vendorman3dir" in
9453         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9454         *)      dflt=$vendorman3dir ;;
9455         esac
9456         case "$dflt" in
9457         ''|' ') dflt=none ;;
9458         esac
9459         fn=nd~+
9460         rp='Pathname for the vendor-supplied manual section 3 pages?'
9461         . ./getfile
9462         vendorman3dir="$ans"
9463         vendorman3direxp="$ansexp"
9464         ;;
9465 esac
9466 : Use ' ' for none so value is preserved next time through Configure
9467 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9468 prefixvar=vendorman3dir
9469 . ./installprefix
9470
9471 : Set the vendorscript variables
9472 case "$vendorprefix" in
9473 '')     d_vendorscript="$undef"
9474         vendorscript=''
9475         vendorscriptexp=''
9476         ;;
9477 *)      d_vendorscript="$define"
9478         : determine where vendor-supplied scripts go.
9479         case "$vendorscript" in
9480         '')     dflt=$vendorprefix/script
9481                 $test -d $dflt || dflt=$vendorbin ;;
9482         *)  dflt="$vendorscript" ;;
9483         esac
9484         $cat <<EOM
9485
9486 The installation process will create a directory for
9487 vendor-supplied scripts.
9488
9489 EOM
9490         fn=d~+
9491         rp='Pathname for the vendor-supplied scripts directory?'
9492         . ./getfile
9493         vendorscript="$ans"
9494         vendorscriptexp="$ansexp"
9495         ;;
9496 esac
9497 prefixvar=vendorscript
9498 . ./installprefix
9499
9500 : script used to emit important warnings
9501 cat >warn <<EOS
9502 $startsh
9503 if test \$# -gt 0; then
9504         echo "\$@" >msg
9505 else
9506         cat >msg
9507 fi
9508 echo "*** WARNING:" >&4
9509 sed -e 's/^/*** /' <msg >&4
9510 echo "*** " >&4
9511 cat msg >>config.msg
9512 echo " " >>config.msg
9513 rm -f msg
9514 EOS
9515 chmod +x warn
9516 $eunicefix warn
9517
9518 : see which of string.h or strings.h is needed
9519 echo " "
9520 strings=`./findhdr string.h`
9521 if $test "$strings" && $test -r "$strings"; then
9522         echo "Using <string.h> instead of <strings.h>." >&4
9523         val="$define"
9524 else
9525         val="$undef"
9526         strings=`./findhdr strings.h`
9527         if $test "$strings" && $test -r "$strings"; then
9528                 echo "Using <strings.h> instead of <string.h>." >&4
9529         else
9530                 ./warn "No string header found -- You'll surely have problems."
9531         fi
9532 fi
9533 set i_string
9534 eval $setvar
9535 case "$i_string" in
9536 "$undef") strings=`./findhdr strings.h`;;
9537 *)        strings=`./findhdr string.h`;;
9538 esac
9539
9540 : see if qgcvt exists
9541 set qgcvt d_qgcvt
9542 eval $inlibc
9543
9544 : Check print/scan long double stuff
9545 echo " "
9546
9547 if $test X"$d_longdbl" = X"$define"; then
9548
9549 echo "Checking how to print long doubles..." >&4
9550
9551 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9552         $cat >try.c <<'EOCP'
9553 #include <sys/types.h>
9554 #include <stdio.h>
9555 int main() {
9556   double d = 123.456;
9557   printf("%.3f\n", d);
9558 }
9559 EOCP
9560         set try
9561         if eval $compile; then
9562                 yyy=`$run ./try`
9563                 case "$yyy" in
9564                 123.456)
9565                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9566                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9567                         echo "We will use %f."
9568                         ;;
9569                 esac
9570         fi
9571 fi
9572
9573 if $test X"$sPRIfldbl" = X; then
9574         $cat >try.c <<'EOCP'
9575 #include <sys/types.h>
9576 #include <stdio.h>
9577 int main() {
9578   long double d = 123.456;
9579   printf("%.3Lf\n", d);
9580 }
9581 EOCP
9582         set try
9583         if eval $compile; then
9584                 yyy=`$run ./try`
9585                 case "$yyy" in
9586                 123.456)
9587                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9588                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9589                         echo "We will use %Lf."
9590                         ;;
9591                 esac
9592         fi
9593 fi
9594
9595 if $test X"$sPRIfldbl" = X; then
9596         $cat >try.c <<'EOCP'
9597 #include <sys/types.h>
9598 #include <stdio.h>
9599 int main() {
9600   long double d = 123.456;
9601   printf("%.3llf\n", d);
9602 }
9603 EOCP
9604         set try
9605         if eval $compile; then
9606                 yyy=`$run ./try`
9607                 case "$yyy" in
9608                 123.456)
9609                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9610                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9611                         echo "We will use %llf."
9612                         ;;
9613                 esac
9614         fi
9615 fi
9616
9617 if $test X"$sPRIfldbl" = X; then
9618         $cat >try.c <<'EOCP'
9619 #include <sys/types.h>
9620 #include <stdio.h>
9621 int main() {
9622   long double d = 123.456;
9623   printf("%.3lf\n", d);
9624 }
9625 EOCP
9626         set try
9627         if eval $compile; then
9628                 yyy=`$run ./try`
9629                 case "$yyy" in
9630                 123.456)
9631                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9632                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9633                         echo "We will use %lf."
9634                         ;;
9635                 esac
9636         fi
9637 fi
9638
9639 if $test X"$sPRIfldbl" = X; then
9640         echo "Cannot figure out how to print long doubles." >&4
9641 else
9642         sSCNfldbl=$sPRIfldbl    # expect consistency
9643 fi
9644
9645 $rm_try
9646
9647 fi # d_longdbl
9648
9649 case "$sPRIfldbl" in
9650 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9651         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9652         d_SCNfldbl="$undef";
9653         ;;
9654 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9655         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9656         d_SCNfldbl="$define";
9657         ;;
9658 esac
9659
9660 : Check how to convert floats to strings.
9661
9662 if test "X$d_Gconvert" = X; then
9663
9664 echo " "
9665 echo "Checking for an efficient way to convert floats to strings."
9666 echo " " > try.c
9667 case "$uselongdouble" in
9668 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9669 esac
9670 case "$d_longdbl" in
9671 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9672 esac
9673 case "$d_PRIgldbl" in
9674 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9675 esac
9676 $cat >>try.c <<EOP
9677 #ifdef TRY_gconvert
9678 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9679 char *myname = "gconvert";
9680 #endif
9681 #ifdef TRY_gcvt
9682 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9683 char *myname = "gcvt";
9684 #endif
9685 #ifdef TRY_qgcvt
9686 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9687 char *myname = "qgcvt";
9688 #define DOUBLETYPE long double
9689 #endif
9690 #ifdef TRY_sprintf
9691 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9692 #ifdef HAS_PRIgldbl
9693 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9694 #else
9695 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9696 #endif
9697 #else
9698 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9699 #endif
9700 char *myname = "sprintf";
9701 #endif
9702
9703 #ifndef DOUBLETYPE
9704 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9705 #define DOUBLETYPE long double
9706 #else
9707 #define DOUBLETYPE double
9708 #endif
9709 #endif
9710
9711 #include <stdio.h>
9712
9713 #$i_stdlib I_STDLIB
9714 #ifdef I_STDLIB
9715 #include <stdlib.h>
9716 #endif
9717 #$i_string I_STRING
9718 #ifdef I_STRING
9719 #  include <string.h>
9720 #else
9721 #  include <strings.h>
9722 #endif
9723
9724 int checkit(char *expect, char *got)
9725 {
9726     if (strcmp(expect, got)) {
9727                 printf("%s oddity:  Expected %s, got %s\n",
9728                         myname, expect, got);
9729                 exit(1);
9730         }
9731 }
9732
9733 int main()
9734 {
9735         char buf[64];
9736         buf[63] = '\0';
9737
9738         /* This must be 1st test on (which?) platform */
9739         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9740         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9741         checkit("0.1", buf);
9742
9743         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9744         checkit("0.01", buf);
9745
9746         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9747         checkit("0.001", buf);
9748
9749         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9750         checkit("0.0001", buf);
9751
9752         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9753         if (strlen(buf) > 5)
9754             checkit("9e-005", buf); /* for Microsoft ?? */
9755         else
9756             checkit("9e-05", buf);
9757
9758         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9759         checkit("1", buf);
9760
9761         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9762         checkit("1.1", buf);
9763
9764         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9765         checkit("1.01", buf);
9766
9767         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9768         checkit("1.001", buf);
9769
9770         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9771         checkit("1.0001", buf);
9772
9773         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9774         checkit("1.00001", buf);
9775
9776         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9777         checkit("1.000001", buf);
9778
9779         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9780         checkit("0", buf);
9781
9782         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9783         checkit("-1", buf);
9784
9785         /* Some Linux gcvt's give 1.e+5 here. */
9786         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9787         checkit("100000", buf);
9788
9789         /* Some Linux gcvt's give -1.e+5 here. */
9790         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9791         checkit("-100000", buf);
9792
9793         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9794         checkit("123.456", buf);
9795
9796         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9797         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9798         /* 34 should be enough to scare even long double
9799          * places into using the e notation. */
9800         if (strlen(buf) > 5)
9801             checkit("1e+034", buf); /* for Microsoft */
9802         else
9803             checkit("1e+34", buf);
9804
9805         /* For Perl, if you add additional tests here, also add them to
9806          * t/base/num.t for benefit of platforms not using Configure or
9807          * overriding d_Gconvert */
9808
9809         exit(0);
9810 }
9811 EOP
9812 : first add preferred functions to our list
9813 xxx_list=""
9814 for xxx_convert in $gconvert_preference; do
9815     case $xxx_convert in
9816     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9817     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9818     esac
9819 done
9820 : then add any others
9821 for xxx_convert in gconvert gcvt sprintf; do
9822     case "$xxx_list" in
9823     *$xxx_convert*) ;;
9824     *) xxx_list="$xxx_list $xxx_convert" ;;
9825     esac
9826 done
9827
9828 case "$d_longdbl$uselongdouble" in
9829 "$define$define")
9830     : again, add preferred functions to our list first
9831     xxx_ld_list=""
9832     for xxx_convert in $gconvert_ld_preference; do
9833         case $xxx_convert in
9834         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9835         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9836         esac
9837     done
9838     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9839     for xxx_convert in qgcvt sprintf $xxx_list; do
9840         case "$xxx_ld_list" in
9841         $xxx_convert*|*" $xxx_convert"*) ;;
9842         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9843         esac
9844     done
9845     : if sprintf cannot do long doubles, move it to the end
9846     if test "$d_PRIgldbl" != "$define"; then
9847         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9848     fi
9849     : if no qgcvt, remove it
9850     if test "$d_qgcvt" != "$define"; then
9851         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9852     fi
9853     : use the ld_list
9854     xxx_list="$xxx_ld_list"
9855     ;;
9856 esac
9857
9858 for xxx_convert in $xxx_list; do
9859         echo "Trying $xxx_convert..."
9860         $rm -f try try$_o core
9861         set try -DTRY_$xxx_convert
9862         if eval $compile; then
9863                 echo "$xxx_convert() found." >&4
9864                 if $run ./try; then
9865                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9866                         break;
9867                 else
9868                         echo "...But $xxx_convert didn't work as I expected."
9869                         xxx_convert=''
9870                 fi
9871         else
9872                 echo "$xxx_convert NOT found." >&4
9873         fi
9874 done
9875
9876 if test X$xxx_convert = X; then
9877     echo "*** WHOA THERE!!! ***" >&4
9878     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9879     xxx_convert=sprintf
9880 fi
9881
9882 case "$xxx_convert" in
9883 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9884 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9885 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9886 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9887    "$define$define$define")
9888       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9889    "$define$define$undef")
9890       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9891    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9892    esac
9893    ;;
9894 esac
9895
9896 fi
9897 $rm_try
9898
9899 : see if _fwalk exists
9900 set fwalk d__fwalk
9901 eval $inlibc
9902
9903 : Initialize h_fcntl
9904 h_fcntl=false
9905
9906 : Initialize h_sysfile
9907 h_sysfile=false
9908
9909 : access call always available on UNIX
9910 set access d_access
9911 eval $inlibc
9912
9913 : locate the flags for 'access()'
9914 case "$d_access" in
9915 "$define")
9916         echo " "
9917         $cat >access.c <<EOCP
9918 #include <sys/types.h>
9919 #ifdef I_FCNTL
9920 #include <fcntl.h>
9921 #endif
9922 #ifdef I_SYS_FILE
9923 #include <sys/file.h>
9924 #endif
9925 #ifdef I_UNISTD
9926 #include <unistd.h>
9927 #endif
9928 #$i_stdlib I_STDLIB
9929 #ifdef I_STDLIB
9930 #include <stdlib.h>
9931 #endif
9932 int main() {
9933         exit(R_OK);
9934 }
9935 EOCP
9936         : check sys/file.h first, no particular reason here
9937         if $test `./findhdr sys/file.h` && \
9938                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9939                 h_sysfile=true;
9940                 echo "<sys/file.h> defines the *_OK access constants." >&4
9941         elif $test `./findhdr fcntl.h` && \
9942                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9943                 h_fcntl=true;
9944                 echo "<fcntl.h> defines the *_OK access constants." >&4
9945         elif $test `./findhdr unistd.h` && \
9946                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9947                 echo "<unistd.h> defines the *_OK access constants." >&4
9948         else
9949                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9950         fi
9951         ;;
9952 esac
9953 $rm -f access*
9954
9955 : see if accessx exists
9956 set accessx d_accessx
9957 eval $inlibc
9958
9959 : see if aintl exists
9960 set aintl d_aintl
9961 eval $inlibc
9962
9963 : see if alarm exists
9964 set alarm d_alarm
9965 eval $inlibc
9966
9967 : see if 64bit time functions exists
9968
9969 set ctime64 d_ctime64
9970 eval $inlibc
9971
9972 set localtime64 d_localtime64
9973 eval $inlibc
9974
9975 set gmtime64 d_gmtime64
9976 eval $inlibc
9977
9978 set mktime64 d_mktime64
9979 eval $inlibc
9980
9981 set difftime64 d_difftime64
9982 eval $inlibc
9983
9984 set asctime64 d_asctime64
9985 eval $inlibc
9986
9987 : see if POSIX threads are available
9988 set pthread.h i_pthread
9989 eval $inhdr
9990
9991 : define a function to check prototypes
9992 $cat > protochk <<EOSH
9993 $startsh
9994 cc="$cc"
9995 optimize="$optimize"
9996 ccflags="$ccflags"
9997 prototype="$prototype"
9998 define="$define"
9999 rm_try="$rm_try"
10000 usethreads=$usethreads
10001 i_pthread=$i_pthread
10002 pthread_h_first=$pthread_h_first
10003 EOSH
10004
10005 $cat >> protochk <<'EOSH'
10006
10007 $rm_try
10008 foo="$1"
10009 shift
10010 while test $# -ge 2; do
10011         case "$1" in
10012                 $define) echo "#include <$2>" >> try.c ;;
10013                 literal) echo "$2" >> try.c ;;
10014         esac
10015     # Extra magic for the benefit of systems that need pthread.h
10016     # to be included early to correctly detect threadsafe functions.
10017     # Such functions must guarantee themselves, though, that the usethreads
10018     # and i_pthread have been defined, before calling protochk.
10019     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10020         echo "#include <pthread.h>" >> try.c
10021         pthread_h_done=yes
10022     fi
10023     shift 2
10024 done
10025 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10026 cat >> try.c <<'EOCP'
10027 #ifdef CAN_PROTOTYPE
10028 #define _(args) args
10029 #else
10030 #define _(args) ()
10031 #endif
10032 EOCP
10033 echo "$foo" >> try.c
10034 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10035 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10036 status=$?
10037 $rm_try
10038 exit $status
10039 EOSH
10040 chmod +x protochk
10041 $eunicefix protochk
10042
10043 : Define hasproto macro for Configure internal use
10044 hasproto='varname=$1; func=$2; shift; shift;
10045 while $test $# -ge 2; do
10046         case "$1" in
10047         $define) echo "#include <$2>";;
10048         esac ;
10049     shift 2;
10050 done > try.c;
10051 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10052 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10053         echo "$func() prototype found.";
10054         val="$define";
10055 else
10056         echo "$func() prototype NOT found.";
10057         val="$undef";
10058 fi;
10059 set $varname;
10060 eval $setvar;
10061 $rm_try tryout.c'
10062
10063 : see if sys/types.h has to be included
10064 set sys/types.h i_systypes
10065 eval $inhdr
10066
10067 : see if sys/select.h has to be included
10068 set sys/select.h i_sysselct
10069 eval $inhdr
10070
10071 : Define hasfield macro for Configure internal use
10072 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10073 while $test $# -ge 2; do
10074         case "$1" in
10075         $define) echo "#include <$2>";;
10076         esac ;
10077     shift 2;
10078 done > try.c;
10079 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10080 set try;
10081 if eval $compile; then
10082         val="$define";
10083 else
10084         val="$undef";
10085 fi;
10086 set $varname;
10087 eval $setvar;
10088 $rm_try'
10089
10090 : see if we should include time.h, sys/time.h, or both
10091 echo " "
10092 if test "X$timeincl" = X; then
10093         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10094         $echo $n "I'm now running the test program...$c"
10095         $cat >try.c <<EOCP
10096 #include <sys/types.h>
10097 #ifdef I_TIME
10098 #include <time.h>
10099 #endif
10100 #ifdef I_SYSTIME
10101 #ifdef SYSTIMEKERNEL
10102 #define KERNEL
10103 #endif
10104 #include <sys/time.h>
10105 #endif
10106 #ifdef I_SYSSELECT
10107 #include <sys/select.h>
10108 #endif
10109 #$i_stdlib I_STDLIB
10110 #ifdef I_STDLIB
10111 #include <stdlib.h>
10112 #endif
10113 int main()
10114 {
10115         struct tm foo;
10116 #ifdef S_TIMEVAL
10117         struct timeval bar;
10118 #endif
10119 #ifdef S_TIMEZONE
10120         struct timezone tzp;
10121 #endif
10122         if (foo.tm_sec == foo.tm_sec)
10123                 exit(0);
10124 #ifdef S_TIMEVAL
10125         if (bar.tv_sec == bar.tv_sec)
10126                 exit(0);
10127 #endif
10128         exit(1);
10129 }
10130 EOCP
10131         flags=''
10132         for s_timezone in '-DS_TIMEZONE' ''; do
10133         sysselect=''
10134         for s_timeval in '-DS_TIMEVAL' ''; do
10135         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10136         for i_time in '' '-DI_TIME'; do
10137         for i_systime in '-DI_SYSTIME' ''; do
10138                 case "$flags" in
10139                 '') $echo $n ".$c"
10140                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10141                         if eval $compile; then
10142                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10143                                 shift
10144                                 flags="$*"
10145                                 echo " "
10146                                 $echo $n "Succeeded with $flags$c"
10147                         fi
10148                         ;;
10149                 esac
10150         done
10151         done
10152         done
10153         done
10154         done
10155         timeincl=''
10156         echo " "
10157         case "$flags" in
10158         *SYSTIMEKERNEL*) i_systimek="$define"
10159                 timeincl=`./findhdr sys/time.h`
10160                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10161         *) i_systimek="$undef";;
10162         esac
10163         case "$flags" in
10164         *I_TIME*) i_time="$define"
10165                 timeincl=`./findhdr time.h`" $timeincl"
10166                 echo "We'll include <time.h>." >&4;;
10167         *) i_time="$undef";;
10168         esac
10169         case "$flags" in
10170         *I_SYSTIME*) i_systime="$define"
10171                 timeincl=`./findhdr sys/time.h`" $timeincl"
10172                 echo "We'll include <sys/time.h>." >&4;;
10173         *) i_systime="$undef";;
10174         esac
10175         $rm_try
10176 fi
10177 : see if struct tm knows about tm_zone
10178 case "$i_systime$i_time" in
10179 *$define*)
10180         echo " "
10181         echo "Checking to see if your struct tm has tm_zone field..." >&4
10182         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10183         eval $hasfield
10184         ;;
10185 *)      val="$undef"
10186         set d_tm_tm_zone
10187         eval $setvar
10188         ;;
10189 esac
10190 case "$d_tm_tm_zone" in
10191 "$define")      echo "Yes, it does."   ;;
10192 *)              echo "No, it doesn't." ;;
10193 esac
10194 : see if struct tm knows about tm_gmtoff
10195 case "$i_systime$i_time" in
10196 *$define*)
10197         echo " "
10198         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10199         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10200         eval $hasfield
10201         ;;
10202 *)      val="$undef"
10203         set d_tm_tm_gmtoff
10204         eval $setvar
10205         ;;
10206 esac
10207 case "$d_tm_tm_gmtoff" in
10208 "$define")      echo "Yes, it does."   ;;
10209 *)              echo "No, it doesn't." ;;
10210 esac
10211
10212 : see if asctime_r exists
10213 set asctime_r d_asctime_r
10214 eval $inlibc
10215 case "$d_asctime_r" in
10216 "$define")
10217         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10218         case "$d_asctime_r_proto:$usethreads" in
10219         ":define")      d_asctime_r_proto=define
10220                 set d_asctime_r_proto asctime_r $hdrs
10221                 eval $hasproto ;;
10222         *)      ;;
10223         esac
10224         case "$d_asctime_r_proto" in
10225         define)
10226         case "$asctime_r_proto" in
10227         ''|0) try='char* asctime_r(const struct tm*, char*);'
10228         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10229         esac
10230         case "$asctime_r_proto" in
10231         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10232         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10233         esac
10234         case "$asctime_r_proto" in
10235         ''|0) try='int asctime_r(const struct tm*, char*);'
10236         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10237         esac
10238         case "$asctime_r_proto" in
10239         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10240         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10241         esac
10242         case "$asctime_r_proto" in
10243         ''|0)   d_asctime_r=undef
10244                 asctime_r_proto=0
10245                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10246         * )     case "$asctime_r_proto" in
10247                 REENTRANT_PROTO*) ;;
10248                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10249                 esac
10250                 echo "Prototype: $try" ;;
10251         esac
10252         ;;
10253         *)      case "$usethreads" in
10254                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10255                 esac
10256                 d_asctime_r=undef
10257                 asctime_r_proto=0
10258                 ;;
10259         esac
10260         ;;
10261 *)      asctime_r_proto=0
10262         ;;
10263 esac
10264
10265 : see if atolf exists
10266 set atolf d_atolf
10267 eval $inlibc
10268
10269 : see if atoll exists
10270 set atoll d_atoll
10271 eval $inlibc
10272
10273 : Look for GCC-style attribute format
10274 case "$d_attribute_format" in
10275 '')
10276 echo " "
10277 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10278 $cat >attrib.c <<'EOCP'
10279 #include <stdio.h>
10280 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10281 EOCP
10282 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10283         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10284                 echo "Your C compiler doesn't support __attribute__((format))."
10285                 val="$undef"
10286         else
10287                 echo "Your C compiler supports __attribute__((format))."
10288                 val="$define"
10289         fi
10290 else
10291         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10292         val="$undef"
10293 fi
10294 ;;
10295 *) val="$d_attribute_format" ;;
10296 esac
10297 set d_attribute_format
10298 eval $setvar
10299 $rm -f attrib*
10300
10301 : Look for GCC-style attribute format with null format allowed
10302 case "$d_printf_format_null" in
10303 '') case "$d_attribute_format" in
10304     $define)
10305         echo " "
10306         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10307 $cat >attrib.c <<EOCP
10308 #include <stdio.h>
10309 #$i_stdlib I_STDLIB
10310 #ifdef I_STDLIB
10311 #include <stdlib.h>
10312 #endif
10313 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10314 int null_printf (char* pat,...) { return (int)pat; }
10315 int main () { exit(null_printf(NULL)); }
10316 EOCP
10317         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10318             : run the executable in case it produces a run-time warning
10319             if $run ./attrib >>attrib.out 2>&1; then
10320                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10321                     echo "Your C compiler doesn't allow __printf__ format to be null."
10322                     val="$undef"
10323                 else
10324                     echo "Your C compiler allows __printf__ format to be null."
10325                     val="$define"
10326                 fi
10327             else
10328             echo "Your C compiler executable failed with __printf__ format null."
10329             val="$undef"
10330         fi
10331     else
10332         echo "Your C compiler fails with __printf__ format null."
10333         val="$undef"
10334     fi
10335     ;;
10336     *)  val="$undef" ;;
10337     esac
10338 ;;
10339 *)  val="$d_printf_format_null" ;;
10340 esac
10341 set d_printf_format_null
10342 eval $setvar
10343 $rm -f attrib*
10344
10345 : Look for GCC-style attribute malloc
10346 case "$d_attribute_malloc" in
10347 '')
10348 echo " "
10349 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10350 $cat >attrib.c <<'EOCP'
10351 #include <stdio.h>
10352 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10353 EOCP
10354 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10355         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10356                 echo "Your C compiler doesn't support __attribute__((malloc))."
10357                 val="$undef"
10358         else
10359                 echo "Your C compiler supports __attribute__((malloc))."
10360                 val="$define"
10361         fi
10362 else
10363         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10364         val="$undef"
10365 fi
10366 ;;
10367 *) val="$d_attribute_malloc" ;;
10368 esac
10369 set d_attribute_malloc
10370 eval $setvar
10371 $rm -f attrib*
10372
10373 : Look for GCC-style attribute nonnull
10374 case "$d_attribute_nonnull" in
10375 '')
10376 echo " "
10377 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10378 $cat >attrib.c <<'EOCP'
10379 #include <stdio.h>
10380 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10381 EOCP
10382 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10383         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10384                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10385                 val="$undef"
10386         else
10387                 echo "Your C compiler supports __attribute__((nonnull))."
10388                 val="$define"
10389         fi
10390 else
10391         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10392         val="$undef"
10393 fi
10394 ;;
10395 *) val="$d_attribute_nonnull" ;;
10396 esac
10397 set d_attribute_nonnull
10398 eval $setvar
10399 $rm -f attrib*
10400
10401 : Look for GCC-style attribute noreturn
10402 case "$d_attribute_noreturn" in
10403 '')
10404 echo " "
10405 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10406 $cat >attrib.c <<'EOCP'
10407 #include <stdio.h>
10408 void fall_over_dead( void ) __attribute__((noreturn));
10409 EOCP
10410 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10411         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10412                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10413                 val="$undef"
10414         else
10415                 echo "Your C compiler supports __attribute__((noreturn))."
10416                 val="$define"
10417         fi
10418 else
10419         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10420         val="$undef"
10421 fi
10422 ;;
10423 *) val="$d_attribute_noreturn" ;;
10424 esac
10425 set d_attribute_noreturn
10426 eval $setvar
10427 $rm -f attrib*
10428
10429 : Look for GCC-style attribute pure
10430 case "$d_attribute_pure" in
10431 '')
10432 echo " "
10433 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10434 $cat >attrib.c <<'EOCP'
10435 #include <stdio.h>
10436 int square( int n ) __attribute__((pure));
10437 EOCP
10438 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10439         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10440                 echo "Your C compiler doesn't support __attribute__((pure))."
10441                 val="$undef"
10442         else
10443                 echo "Your C compiler supports __attribute__((pure))."
10444                 val="$define"
10445         fi
10446 else
10447         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10448         val="$undef"
10449 fi
10450 ;;
10451 *) val="$d_attribute_pure" ;;
10452 esac
10453 set d_attribute_pure
10454 eval $setvar
10455 $rm -f attrib*
10456
10457 : Look for GCC-style attribute unused
10458 case "$d_attribute_unused" in
10459 '')
10460 echo " "
10461 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10462 $cat >attrib.c <<'EOCP'
10463 #include <stdio.h>
10464 int do_something( int dummy __attribute__((unused)), int n );
10465 EOCP
10466 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10467         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10468                 echo "Your C compiler doesn't support __attribute__((unused))."
10469                 val="$undef"
10470         else
10471                 echo "Your C compiler supports __attribute__((unused))."
10472                 val="$define"
10473         fi
10474 else
10475         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10476         val="$undef"
10477 fi
10478 ;;
10479 *) val="$d_attribute_unused" ;;
10480 esac
10481 set d_attribute_unused
10482 eval $setvar
10483 $rm -f attrib*
10484
10485 : Look for GCC-style attribute deprecated
10486 case "$d_attribute_deprecated" in
10487 '')
10488 echo " "
10489 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10490 $cat >attrib.c <<'EOCP'
10491 #include <stdio.h>
10492 int I_am_deprecated(void) __attribute__((deprecated));
10493 EOCP
10494 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10495         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10496                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10497                 val="$undef"
10498         else
10499                 echo "Your C compiler supports __attribute__((deprecated))."
10500                 val="$define"
10501         fi
10502 else
10503         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10504         val="$undef"
10505 fi
10506 ;;
10507 *) val="$d_attribute_deprecated" ;;
10508 esac
10509 set d_attribute_deprecated
10510 eval $setvar
10511 $rm -f attrib*
10512
10513 : Look for GCC-style attribute warn_unused_result
10514 case "$d_attribute_warn_unused_result" in
10515 '')
10516 echo " "
10517 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10518 $cat >attrib.c <<'EOCP'
10519 #include <stdio.h>
10520 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10521 EOCP
10522 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10523         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10524                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10525                 val="$undef"
10526         else
10527                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10528                 val="$define"
10529         fi
10530 else
10531         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10532         val="$undef"
10533 fi
10534 ;;
10535 *) val="$d_attribute_warn_unused_result" ;;
10536 esac
10537 set d_attribute_warn_unused_result
10538 eval $setvar
10539 $rm -f attrib*
10540
10541 : see if bcmp exists
10542 set bcmp d_bcmp
10543 eval $inlibc
10544
10545 : see if bcopy exists
10546 set bcopy d_bcopy
10547 eval $inlibc
10548
10549 : see if getpgrp exists
10550 set getpgrp d_getpgrp
10551 eval $inlibc
10552
10553 case "$d_getpgrp" in
10554 "$define")
10555         echo " "
10556         echo "Checking to see which flavor of getpgrp is in use..."
10557         $cat >try.c <<EOP
10558 #$i_unistd I_UNISTD
10559 #include <sys/types.h>
10560 #ifdef I_UNISTD
10561 #  include <unistd.h>
10562 #endif
10563 #$i_stdlib I_STDLIB
10564 #ifdef I_STDLIB
10565 #include <stdlib.h>
10566 #endif
10567 int main()
10568 {
10569         if (getuid() == 0) {
10570                 printf("(I see you are running Configure as super-user...)\n");
10571                 setuid(1);
10572         }
10573 #ifdef TRY_BSD_PGRP
10574         if (getpgrp(1) == 0)
10575                 exit(0);
10576 #else
10577         if (getpgrp() > 0)
10578                 exit(0);
10579 #endif
10580         exit(1);
10581 }
10582 EOP
10583         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10584                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10585                 val="$define"
10586         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10587                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10588                 val="$undef"
10589         else
10590                 echo "I can't seem to compile and run the test program."
10591                 if ./usg; then
10592                         xxx="a USG one, i.e. you use getpgrp()."
10593                 else
10594                         # SVR4 systems can appear rather BSD-ish.
10595                         case "$i_unistd" in
10596                         $undef)
10597                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10598                                 val="$define"
10599                                 ;;
10600                         $define)
10601                                 xxx="probably a USG one, i.e. you use getpgrp()."
10602                                 val="$undef"
10603                                 ;;
10604                         esac
10605                 fi
10606                 echo "Assuming your getpgrp is $xxx" >&4
10607         fi
10608         ;;
10609 *) val="$undef";;
10610 esac
10611 set d_bsdgetpgrp
10612 eval $setvar
10613 $rm_try
10614
10615 : see if setpgrp exists
10616 set setpgrp d_setpgrp
10617 eval $inlibc
10618
10619 case "$d_setpgrp" in
10620 "$define")
10621         echo " "
10622         echo "Checking to see which flavor of setpgrp is in use..."
10623         $cat >try.c <<EOP
10624 #$i_unistd I_UNISTD
10625 #include <sys/types.h>
10626 #ifdef I_UNISTD
10627 #  include <unistd.h>
10628 #endif
10629 #$i_stdlib I_STDLIB
10630 #ifdef I_STDLIB
10631 #include <stdlib.h>
10632 #endif
10633 int main()
10634 {
10635         if (getuid() == 0) {
10636                 printf("(I see you are running Configure as super-user...)\n");
10637                 setuid(1);
10638         }
10639 #ifdef TRY_BSD_PGRP
10640         if (-1 == setpgrp(1, 1))
10641                 exit(0);
10642 #else
10643         if (setpgrp() != -1)
10644                 exit(0);
10645 #endif
10646         exit(1);
10647 }
10648 EOP
10649         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10650                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10651                 val="$define"
10652         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10653                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10654                 val="$undef"
10655         else
10656                 echo "(I can't seem to compile and run the test program.)"
10657                 if ./usg; then
10658                         xxx="a USG one, i.e. you use setpgrp()."
10659                 else
10660                         # SVR4 systems can appear rather BSD-ish.
10661                         case "$i_unistd" in
10662                         $undef)
10663                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10664                                 val="$define"
10665                                 ;;
10666                         $define)
10667                                 xxx="probably a USG one, i.e. you use setpgrp()."
10668                                 val="$undef"
10669                                 ;;
10670                         esac
10671                 fi
10672                 echo "Assuming your setpgrp is $xxx" >&4
10673         fi
10674         ;;
10675 *) val="$undef";;
10676 esac
10677 set d_bsdsetpgrp
10678 eval $setvar
10679 $rm_try
10680
10681 : Look for GCC-style __builtin_choose_expr
10682 case "$d_builtin_choose_expr" in
10683 '')
10684     echo " "
10685     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10686     $cat >try.c <<'EOCP'
10687 #include <assert.h>
10688 #include <stdlib.h>
10689 #include <stdio.h>
10690
10691 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10692
10693 int main(void) {
10694     assert( SYRINX(1) == 2112 );
10695     assert( SYRINX(1) != 5150 );
10696     assert( SYRINX(0) == 5150 );
10697     assert( SYRINX(0) != 2112 );
10698     puts( "All good!" );
10699     exit(0);
10700 }
10701
10702 EOCP
10703     set try
10704     if eval $compile && $run ./try; then
10705         echo "Your C compiler supports __builtin_choose_expr."
10706         val="$define"
10707     else
10708         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10709         val="$undef"
10710     fi
10711 ;;
10712 *) val="$d_builtin_choose_expr" ;;
10713 esac
10714
10715 set d_builtin_choose_expr
10716 eval $setvar
10717 $rm_try
10718
10719 : Look for GCC-style __builtin_expect
10720 case "$d_builtin_expect" in
10721 '')
10722     echo " "
10723     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10724     $cat >try.c <<'EOCP'
10725 int main(void) {
10726     int n = 50;
10727     if ( __builtin_expect(n, 0) ) n = 1;
10728     /* Remember shell exit code truth is 0, C truth is non-zero */
10729     return !(n == 1);
10730 }
10731 EOCP
10732     set try
10733     if eval $compile && $run ./try; then
10734         echo "Your C compiler supports __builtin_expect."
10735         val="$define"
10736     else
10737         echo "Your C compiler doesn't seem to understand __builtin_expect."
10738         val="$undef"
10739     fi
10740     ;;
10741 *) val="$d_builtin_expect" ;;
10742 esac
10743
10744 set d_builtin_expect
10745 eval $setvar
10746 $rm_try
10747
10748 : see if bzero exists
10749 set bzero d_bzero
10750 eval $inlibc
10751
10752 : see if stdarg is available
10753 echo " "
10754 if $test `./findhdr stdarg.h`; then
10755         echo "<stdarg.h> found." >&4
10756         valstd="$define"
10757 else
10758         echo "<stdarg.h> NOT found." >&4
10759         valstd="$undef"
10760 fi
10761
10762 : see if varags is available
10763 echo " "
10764 if $test `./findhdr varargs.h`; then
10765         echo "<varargs.h> found." >&4
10766 else
10767         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10768 fi
10769
10770 : set up the varargs testing programs
10771 $cat > varargs.c <<EOP
10772 #ifdef I_STDARG
10773 #include <stdarg.h>
10774 #endif
10775 #ifdef I_VARARGS
10776 #include <varargs.h>
10777 #endif
10778
10779 #ifdef I_STDARG
10780 int f(char *p, ...)
10781 #else
10782 int f(va_alist)
10783 va_dcl
10784 #endif
10785 {
10786         va_list ap;
10787 #ifndef I_STDARG
10788         char *p;
10789 #endif
10790 #ifdef I_STDARG
10791         va_start(ap,p);
10792 #else
10793         va_start(ap);
10794         p = va_arg(ap, char *);
10795 #endif
10796         va_end(ap);
10797         return 0;
10798 }
10799 EOP
10800 $cat > varargs <<EOP
10801 $startsh
10802 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10803         echo "true"
10804 else
10805         echo "false"
10806 fi
10807 $rm -f varargs$_o
10808 EOP
10809 chmod +x varargs
10810
10811 : now check which varargs header should be included
10812 echo " "
10813 i_varhdr=''
10814 case "$valstd" in
10815 "$define")
10816         if `./varargs I_STDARG`; then
10817                 val='stdarg.h'
10818         elif `./varargs I_VARARGS`; then
10819                 val='varargs.h'
10820         fi
10821         ;;
10822 *)
10823         if `./varargs I_VARARGS`; then
10824                 val='varargs.h'
10825         fi
10826         ;;
10827 esac
10828 case "$val" in
10829 '')
10830 echo "I could not find the definition for va_dcl... You have problems..." >&4
10831         val="$undef"; set i_stdarg; eval $setvar
10832         val="$undef"; set i_varargs; eval $setvar
10833         ;;
10834 *)
10835         set i_varhdr
10836         eval $setvar
10837         case "$i_varhdr" in
10838         stdarg.h)
10839                 val="$define"; set i_stdarg; eval $setvar
10840                 val="$undef"; set i_varargs; eval $setvar
10841                 ;;
10842         varargs.h)
10843                 val="$undef"; set i_stdarg; eval $setvar
10844                 val="$define"; set i_varargs; eval $setvar
10845                 ;;
10846         esac
10847         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10848 esac
10849 $rm -f varargs*
10850
10851 : see if the Compiler supports C99 variadic macros
10852 case "$i_stdarg$i_stdlib" in
10853     "$define$define")
10854     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10855     $cat >try.c <<EOCP
10856 #include <stdio.h>
10857 #include <stdarg.h>
10858
10859 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10860
10861 int main() {
10862   char buf[20];
10863   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10864   puts(buf);
10865   return 0;
10866 }
10867 EOCP
10868     set try
10869     if eval $compile && $run ./try 2>&1 >/dev/null; then
10870         case "`$run ./try`" in
10871             "123 456 789")
10872             echo "You have C99 variadic macros." >&4
10873             d_c99_variadic_macros="$define"
10874             ;;
10875             *)
10876             echo "You don't have functional C99 variadic macros." >&4
10877             d_c99_variadic_macros="$undef"
10878             ;;
10879         esac
10880     else
10881         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10882         d_c99_variadic_macros="$undef"
10883     fi
10884     $rm_try
10885     ;;
10886     *)
10887     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10888     d_c99_variadic_macros="$undef"
10889     ;;
10890 esac
10891
10892 : see if signal is declared as pointer to function returning int or void
10893 echo " "
10894 xxx=`./findhdr signal.h`
10895 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10896 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10897         echo "You have int (*signal())() instead of void." >&4
10898         val="$undef"
10899 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10900         echo "You have void (*signal())()." >&4
10901         val="$define"
10902 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10903         echo "You have int (*signal())() instead of void." >&4
10904         val="$undef"
10905 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10906         echo "You have void (*signal())()." >&4
10907         val="$define"
10908 else
10909         case "$d_voidsig" in
10910         '')
10911         echo "I can't determine whether signal handler returns void or int..." >&4
10912                 dflt=void
10913                 rp="What type does your signal handler return?"
10914                 . ./myread
10915                 case "$ans" in
10916                 v*) val="$define";;
10917                 *) val="$undef";;
10918                 esac;;
10919         "$define")
10920                 echo "As you already told me, signal handler returns void." >&4
10921                 val="$define"
10922                 ;;
10923         *)      echo "As you already told me, signal handler returns int." >&4
10924                 val="$undef"
10925                 ;;
10926         esac
10927 fi
10928 set d_voidsig
10929 eval $setvar
10930 case "$d_voidsig" in
10931 "$define") signal_t="void";;
10932 *) signal_t="int";;
10933 esac
10934 $rm -f $$.tmp
10935
10936 : check for ability to cast large floats to 32-bit ints.
10937 echo " "
10938 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10939 if $test "$intsize" -ge 4; then
10940         xxx=int
10941 else
10942         xxx=long
10943 fi
10944 $cat >try.c <<EOCP
10945 #include <stdio.h>
10946 #$i_stdlib I_STDLIB
10947 #ifdef I_STDLIB
10948 #include <stdlib.h>
10949 #endif
10950 #include <sys/types.h>
10951 #include <signal.h>
10952 $signal_t blech(int s) { exit(3); }
10953 int main()
10954 {
10955         $xxx i32;
10956         double f, g;
10957         int result = 0;
10958         char str[16];
10959         signal(SIGFPE, blech);
10960
10961         /* Don't let compiler optimize the test away.  Store the number
10962            in a writable string for gcc to pass to sscanf under HP-UX.
10963         */
10964         sprintf(str, "2147483647");
10965         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10966         g = 10 * f;
10967         i32  = ($xxx) g;
10968
10969         /* x86 processors will probably give 0x8000 0000, which is a
10970            sign change.  We don't want that.  We want to mimic SPARC
10971            behavior here, which is to preserve the sign and give
10972            back 0x7fff ffff.
10973         */
10974         if (i32 != ($xxx) f)
10975                 result |= 1;
10976         exit(result);
10977 }
10978 EOCP
10979 set try
10980 if eval $compile_ok; then
10981         $run ./try
10982         yyy=$?
10983 else
10984         echo "(I can't seem to compile the test program--assuming it can't)"
10985         yyy=1
10986 fi
10987 case "$yyy" in
10988 0)      val="$define"
10989         echo "Yup, it can."
10990         ;;
10991 *)      val="$undef"
10992         echo "Nope, it can't."
10993         ;;
10994 esac
10995 set d_casti32
10996 eval $setvar
10997 $rm_try
10998
10999 : check for ability to cast negative floats to unsigned
11000 echo " "
11001 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11002 $cat >try.c <<EOCP
11003 #include <stdio.h>
11004 #$i_stdlib I_STDLIB
11005 #ifdef I_STDLIB
11006 #include <stdlib.h>
11007 #endif
11008 #include <sys/types.h>
11009 #include <signal.h>
11010 $signal_t blech(int s) { exit(7); }
11011 $signal_t blech_in_list(int s) { exit(4); }
11012 unsigned long dummy_long(unsigned long p) { return p; }
11013 unsigned int dummy_int(unsigned int p) { return p; }
11014 unsigned short dummy_short(unsigned short p) { return p; }
11015 int main()
11016 {
11017         double f;
11018         unsigned long along;
11019         unsigned int aint;
11020         unsigned short ashort;
11021         int result = 0;
11022         char str[16];
11023
11024         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11025            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11026            optimized the whole file away
11027         */
11028         /* Store the number in a writable string for gcc to pass to
11029            sscanf under HP-UX.
11030         */
11031         sprintf(str, "-123");
11032         sscanf(str, "%lf", &f);  /* f = -123.; */
11033
11034         signal(SIGFPE, blech);
11035         along = (unsigned long)f;
11036         aint = (unsigned int)f;
11037         ashort = (unsigned short)f;
11038         if (along != (unsigned long)-123)
11039                 result |= 1;
11040         if (aint != (unsigned int)-123)
11041                 result |= 1;
11042         if (ashort != (unsigned short)-123)
11043                 result |= 1;
11044         sprintf(str, "1073741824.");
11045         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11046         f = f + f;
11047         along = 0;
11048         along = (unsigned long)f;
11049         if (along != 0x80000000)
11050                 result |= 2;
11051         f -= 1.;
11052         along = 0;
11053         along = (unsigned long)f;
11054         if (along != 0x7fffffff)
11055                 result |= 1;
11056         f += 2.;
11057         along = 0;
11058         along = (unsigned long)f;
11059         if (along != 0x80000001)
11060                 result |= 2;
11061         if (result)
11062                 exit(result);
11063         signal(SIGFPE, blech_in_list);
11064         sprintf(str, "123.");
11065         sscanf(str, "%lf", &f);  /* f = 123.; */
11066         along = dummy_long((unsigned long)f);
11067         aint = dummy_int((unsigned int)f);
11068         ashort = dummy_short((unsigned short)f);
11069         if (along != (unsigned long)123)
11070                 result |= 4;
11071         if (aint != (unsigned int)123)
11072                 result |= 4;
11073         if (ashort != (unsigned short)123)
11074                 result |= 4;
11075         exit(result);
11076
11077 }
11078 EOCP
11079 set try
11080 if eval $compile_ok; then
11081         $run ./try
11082         castflags=$?
11083 else
11084         echo "(I can't seem to compile the test program--assuming it can't)"
11085         castflags=7
11086 fi
11087 case "$castflags" in
11088 0)      val="$define"
11089         echo "Yup, it can."
11090         ;;
11091 *)      val="$undef"
11092         echo "Nope, it can't."
11093         ;;
11094 esac
11095 set d_castneg
11096 eval $setvar
11097 $rm_try
11098
11099 : see if vprintf exists
11100 echo " "
11101 if set vprintf val -f d_vprintf; eval $csym; $val; then
11102         echo 'vprintf() found.' >&4
11103         val="$define"
11104         $cat >try.c <<EOF
11105 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11106 #$i_varargs I_VARARGS
11107
11108 #$i_stdlib I_STDLIB
11109 #$i_unistd I_UNISTD
11110
11111 #ifdef I_STDARG
11112 #  include <stdarg.h>
11113 #else /* I_VARARGS */
11114 #  include <varargs.h>
11115 #endif
11116
11117 #ifdef I_UNISTD
11118 #  include <unistd.h>
11119 #endif
11120
11121 #ifdef I_STDLIB
11122 #  include <stdlib.h>
11123 #endif
11124
11125 #include <stdio.h> /* vsprintf prototype */
11126
11127 #ifdef I_STDARG
11128 void xxx(int n, ...)
11129 {
11130     va_list args;
11131     char buf[10];
11132     va_start(args, n);
11133     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11134 }
11135 int main() { xxx(1, "foo"); }
11136
11137 #else /* I_VARARGS */
11138
11139 xxx(va_alist)
11140 va_dcl
11141 {
11142     va_list args;
11143     char buf[10];
11144     va_start(args);
11145     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11146 }
11147 int main() { xxx("foo"); }
11148
11149 #endif
11150
11151 EOF
11152         set try
11153         if eval $compile_ok; then
11154                 if $run ./try; then
11155                         echo "Your vsprintf() returns (int)." >&4
11156                         val2="$undef"
11157                 else
11158                         echo "Your vsprintf() returns (char*)." >&4
11159                         val2="$define"
11160                 fi
11161         else
11162                 echo 'I am unable to compile the vsprintf() test program.' >&4
11163                 # We shouldn't get here.  If we do, assume the standard signature,
11164                 # not the old BSD one.
11165                 echo 'Guessing that vsprintf() returns (int).' >&4
11166                 val2="$undef"
11167         fi
11168 else
11169         echo 'vprintf() NOT found.' >&4
11170         val="$undef"
11171         val2="$undef"
11172 fi
11173 $rm_try
11174 set d_vprintf
11175 eval $setvar
11176 val=$val2
11177 set d_charvspr
11178 eval $setvar
11179
11180 : see if chown exists
11181 set chown d_chown
11182 eval $inlibc
11183
11184 : see if chroot exists
11185 set chroot d_chroot
11186 eval $inlibc
11187
11188 : see if chsize exists
11189 set chsize d_chsize
11190 eval $inlibc
11191
11192 : see if class exists
11193 set class d_class
11194 eval $inlibc
11195
11196 : see if clearenv exists
11197 set clearenv d_clearenv
11198 eval $inlibc
11199
11200 : Define hasstruct macro for Configure internal use
11201 hasstruct='varname=$1; struct=$2; shift; shift;
11202 while $test $# -ge 2; do
11203         case "$1" in
11204         $define) echo "#include <$2>";;
11205         esac ;
11206     shift 2;
11207 done > try.c;
11208 echo "int main () { struct $struct foo; }" >> try.c;
11209 set try;
11210 if eval $compile; then
11211         val="$define";
11212 else
11213         val="$undef";
11214 fi;
11215 set $varname;
11216 eval $setvar;
11217 $rm_try'
11218
11219 : see whether socket exists
11220 socketlib=''
11221 sockethdr=''
11222 echo " "
11223 $echo $n "Hmm... $c" >&4
11224 if set socket val -f d_socket; eval $csym; $val; then
11225         echo "Looks like you have Berkeley networking support." >&4
11226         d_socket="$define"
11227         if set setsockopt val -f; eval $csym; $val; then
11228                 d_oldsock="$undef"
11229         else
11230                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11231                 d_oldsock="$define"
11232         fi
11233 else
11234         if $contains socklib libc.list >/dev/null 2>&1; then
11235                 echo "Looks like you have Berkeley networking support." >&4
11236                 d_socket="$define"
11237                 : we will have to assume that it supports the 4.2 BSD interface
11238                 d_oldsock="$undef"
11239         else
11240                 echo "You don't have Berkeley networking in libc$_a..." >&4
11241                 if test "X$d_socket" = "X$define"; then
11242                    echo "...but you seem to believe that you have sockets." >&4
11243                 else
11244                         for net in net socket
11245                         do
11246                                 if test -f /usr/lib/lib$net$_a; then
11247                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11248                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11249                                         if $contains socket libc.list >/dev/null 2>&1; then
11250                                                 d_socket="$define"
11251                                                 socketlib="-l$net"
11252                                                 case "$net" in
11253                                                 net)
11254                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11255                                                         sockethdr="-I/usr/netinclude"
11256                                                         ;;
11257                                                 esac
11258                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11259                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11260                                                         d_oldsock="$undef"
11261                                                 else
11262                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11263                                                         d_oldsock="$define"
11264                                                 fi
11265                                                 break
11266                                         fi
11267                                 fi
11268                         done
11269                         if test "X$d_socket" != "X$define"; then
11270                            echo "or anywhere else I see." >&4
11271                            d_socket="$undef"
11272                            d_oldsock="$undef"
11273                         fi
11274                 fi
11275         fi
11276 fi
11277
11278 : see if socketpair exists
11279 set socketpair d_sockpair
11280 eval $inlibc
11281
11282
11283 echo " "
11284 echo "Checking the availability sa_len in the sock struct ..." >&4
11285 $cat >try.c <<EOF
11286 #include <sys/types.h>
11287 #include <sys/socket.h>
11288 int main() {
11289 struct sockaddr sa;
11290 return (sa.sa_len);
11291 }
11292 EOF
11293 val="$undef"
11294 set try; if eval $compile; then
11295         val="$define"
11296 fi
11297 set d_sockaddr_sa_len; eval $setvar
11298 $rm_try
11299
11300 echo " "
11301 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11302 $cat >try.c <<EOF
11303 #include <sys/types.h>
11304 #include <sys/socket.h>
11305 #include <netinet/in.h>
11306 int main() {
11307 struct sockaddr_in6 sin6;
11308 return (sin6.sin6_scope_id);
11309 }
11310 EOF
11311 val="$undef"
11312 set try; if eval $compile; then
11313         val="$define"
11314 fi
11315 set d_sin6_scope_id; eval $setvar
11316 $rm_try
11317
11318 echo " "
11319 echo "Checking the availability of certain socket constants..." >&4
11320 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11321         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11322         $cat >try.c <<EOF
11323 #include <sys/types.h>
11324 #include <sys/socket.h>
11325 int main() {
11326     int i = $ENUM;
11327 }
11328 EOF
11329         val="$undef"
11330         set try; if eval $compile; then
11331                 val="$define"
11332         fi
11333         set d_${enum}; eval $setvar
11334         $rm_try
11335 done
11336
11337 : see if this is a sys/uio.h system
11338 set sys/uio.h i_sysuio
11339 eval $inhdr
11340
11341 : Check for cmsghdr support
11342 echo " "
11343 echo "Checking to see if your system supports struct cmsghdr..." >&4
11344 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11345 eval $hasstruct
11346 case "$d_cmsghdr_s" in
11347 "$define")      echo "Yes, it does."   ;;
11348 *)              echo "No, it doesn't." ;;
11349 esac
11350
11351
11352 : check for const keyword
11353 echo " "
11354 echo 'Checking to see if your C compiler knows about "const"...' >&4
11355 $cat >const.c <<'EOCP'
11356 typedef struct spug { int drokk; } spug;
11357 int main()
11358 {
11359         const char *foo;
11360         const spug y = { 0 };
11361 }
11362 EOCP
11363 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11364         val="$define"
11365         echo "Yup, it does."
11366 else
11367         val="$undef"
11368         echo "Nope, it doesn't."
11369 fi
11370 set d_const
11371 eval $setvar
11372
11373 : see if copysignl exists
11374 set copysignl d_copysignl
11375 eval $inlibc
11376
11377 : see if crypt exists
11378 echo " "
11379 set crypt d_crypt
11380 eval $inlibc
11381 case "$d_crypt" in
11382 $define) cryptlib='' ;;
11383 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11384                 echo 'crypt() found.' >&4
11385                 val="$define"
11386                 cryptlib=''
11387         else
11388                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11389                 if $test -z "$cryptlib"; then
11390                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11391                 else
11392                         cryptlib=-lcrypt
11393                 fi
11394                 if $test -z "$cryptlib"; then
11395                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11396                 else
11397                         cryptlib=-lcrypt
11398                 fi
11399                 if $test -z "$cryptlib"; then
11400                         cryptlib=`./loc libcrypt$_a "" $libpth`
11401                 else
11402                         cryptlib=-lcrypt
11403                 fi
11404                 if $test -z "$cryptlib"; then
11405                         echo 'crypt() NOT found.' >&4
11406                         val="$undef"
11407                 else
11408                         val="$define"
11409                 fi
11410         fi
11411         set d_crypt
11412         eval $setvar
11413         ;;
11414 esac
11415
11416 : see if this is a crypt.h system
11417 set crypt.h i_crypt
11418 eval $inhdr
11419
11420 : see if crypt_r exists
11421 set crypt_r d_crypt_r
11422 eval $inlibc
11423 case "$d_crypt_r" in
11424 "$define")
11425         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11426         case "$d_crypt_r_proto:$usethreads" in
11427         ":define")      d_crypt_r_proto=define
11428                 set d_crypt_r_proto crypt_r $hdrs
11429                 eval $hasproto ;;
11430         *)      ;;
11431         esac
11432         case "$d_crypt_r_proto" in
11433         define)
11434         case "$crypt_r_proto" in
11435         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11436         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11437         esac
11438         case "$crypt_r_proto" in
11439         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11440         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11441         esac
11442         case "$crypt_r_proto" in
11443         ''|0)   d_crypt_r=undef
11444                 crypt_r_proto=0
11445                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11446         * )     case "$crypt_r_proto" in
11447                 REENTRANT_PROTO*) ;;
11448                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11449                 esac
11450                 echo "Prototype: $try" ;;
11451         esac
11452         ;;
11453         *)      case "$usethreads" in
11454                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11455                 esac
11456                 d_crypt_r=undef
11457                 crypt_r_proto=0
11458                 ;;
11459         esac
11460         ;;
11461 *)      crypt_r_proto=0
11462         ;;
11463 esac
11464
11465 : get csh whereabouts
11466 case "$csh" in
11467 'csh') val="$undef" ;;
11468 *) val="$define" ;;
11469 esac
11470 set d_csh
11471 eval $setvar
11472 : Respect a hint or command line value for full_csh.
11473 case "$full_csh" in
11474 '') full_csh=$csh ;;
11475 esac
11476
11477 : see if ctermid exists
11478 set ctermid d_ctermid
11479 eval $inlibc
11480
11481 : see if ctermid_r exists
11482 set ctermid_r d_ctermid_r
11483 eval $inlibc
11484 case "$d_ctermid_r" in
11485 "$define")
11486         hdrs="$i_systypes sys/types.h define stdio.h "
11487         case "$d_ctermid_r_proto:$usethreads" in
11488         ":define")      d_ctermid_r_proto=define
11489                 set d_ctermid_r_proto ctermid_r $hdrs
11490                 eval $hasproto ;;
11491         *)      ;;
11492         esac
11493         case "$d_ctermid_r_proto" in
11494         define)
11495         case "$ctermid_r_proto" in
11496         ''|0) try='char* ctermid_r(char*);'
11497         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11498         esac
11499         case "$ctermid_r_proto" in
11500         ''|0)   d_ctermid_r=undef
11501                 ctermid_r_proto=0
11502                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11503         * )     case "$ctermid_r_proto" in
11504                 REENTRANT_PROTO*) ;;
11505                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11506                 esac
11507                 echo "Prototype: $try" ;;
11508         esac
11509         ;;
11510         *)      case "$usethreads" in
11511                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11512                 esac
11513                 d_ctermid_r=undef
11514                 ctermid_r_proto=0
11515                 ;;
11516         esac
11517         ;;
11518 *)      ctermid_r_proto=0
11519         ;;
11520 esac
11521
11522 : see if ctime_r exists
11523 set ctime_r d_ctime_r
11524 eval $inlibc
11525 case "$d_ctime_r" in
11526 "$define")
11527         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11528         case "$d_ctime_r_proto:$usethreads" in
11529         ":define")      d_ctime_r_proto=define
11530                 set d_ctime_r_proto ctime_r $hdrs
11531                 eval $hasproto ;;
11532         *)      ;;
11533         esac
11534         case "$d_ctime_r_proto" in
11535         define)
11536         case "$ctime_r_proto" in
11537         ''|0) try='char* ctime_r(const time_t*, char*);'
11538         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11539         esac
11540         case "$ctime_r_proto" in
11541         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11542         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11543         esac
11544         case "$ctime_r_proto" in
11545         ''|0) try='int ctime_r(const time_t*, char*);'
11546         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11547         esac
11548         case "$ctime_r_proto" in
11549         ''|0) try='int ctime_r(const time_t*, char*, int);'
11550         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11551         esac
11552         case "$ctime_r_proto" in
11553         ''|0)   d_ctime_r=undef
11554                 ctime_r_proto=0
11555                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11556         * )     case "$ctime_r_proto" in
11557                 REENTRANT_PROTO*) ;;
11558                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11559                 esac
11560                 echo "Prototype: $try" ;;
11561         esac
11562         ;;
11563         *)      case "$usethreads" in
11564                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11565                 esac
11566                 d_ctime_r=undef
11567                 ctime_r_proto=0
11568                 ;;
11569         esac
11570         ;;
11571 *)      ctime_r_proto=0
11572         ;;
11573 esac
11574
11575 : see if cuserid exists
11576 set cuserid d_cuserid
11577 eval $inlibc
11578
11579 : see if this is a limits.h system
11580 set limits.h i_limits
11581 eval $inhdr
11582
11583 : see if this is a float.h system
11584 set float.h i_float
11585 eval $inhdr
11586
11587 : See if number of significant digits in a double precision number is known
11588 echo " "
11589 $cat >dbl_dig.c <<EOM
11590 #$i_limits I_LIMITS
11591 #$i_float I_FLOAT
11592 #ifdef I_LIMITS
11593 #include <limits.h>
11594 #endif
11595 #ifdef I_FLOAT
11596 #include <float.h>
11597 #endif
11598 #ifdef DBL_DIG
11599 printf("Contains DBL_DIG");
11600 #endif
11601 EOM
11602 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11603 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11604         echo "DBL_DIG found." >&4
11605         val="$define"
11606 else
11607         echo "DBL_DIG NOT found." >&4
11608         val="$undef"
11609 fi
11610 $rm -f dbl_dig.?
11611 set d_dbl_dig
11612 eval $setvar
11613
11614 : see if dbm.h is available
11615 : see if dbmclose exists
11616 set dbmclose d_dbmclose
11617 eval $inlibc
11618
11619 case "$d_dbmclose" in
11620 $define)
11621         set dbm.h i_dbm
11622         eval $inhdr
11623         case "$i_dbm" in
11624         $define)
11625                 val="$undef"
11626                 set i_rpcsvcdbm
11627                 eval $setvar
11628                 ;;
11629         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11630                 eval $inhdr
11631                 ;;
11632         esac
11633         ;;
11634 *)      echo "We won't be including <dbm.h>"
11635         val="$undef"
11636         set i_dbm
11637         eval $setvar
11638         val="$undef"
11639         set i_rpcsvcdbm
11640         eval $setvar
11641         ;;
11642 esac
11643
11644 : see if prototype for dbminit is available
11645 echo " "
11646 set d_dbminitproto dbminit $i_dbm dbm.h
11647 eval $hasproto
11648
11649 : see if difftime exists
11650 set difftime d_difftime
11651 eval $inlibc
11652
11653 : see if this is a dirent system
11654 echo " "
11655 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11656         val="$define"
11657         echo "<dirent.h> found." >&4
11658 else
11659         val="$undef"
11660         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11661                 echo "<sys/dir.h> found." >&4
11662                 echo " "
11663         else
11664                 xinc=`./findhdr sys/ndir.h`
11665         fi
11666         echo "<dirent.h> NOT found." >&4
11667 fi
11668 set i_dirent
11669 eval $setvar
11670
11671 : Look for type of directory structure.
11672 echo " "
11673 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11674
11675 case "$direntrytype" in
11676 ''|' ')
11677         case "$i_dirent" in
11678         $define) guess1='struct dirent' ;;
11679         *) guess1='struct direct'  ;;
11680         esac
11681         ;;
11682 *)      guess1="$direntrytype"
11683         ;;
11684 esac
11685
11686 case "$guess1" in
11687 'struct dirent') guess2='struct direct' ;;
11688 *) guess2='struct dirent' ;;
11689 esac
11690
11691 if $contains "$guess1" try.c >/dev/null 2>&1; then
11692         direntrytype="$guess1"
11693         echo "Your directory entries are $direntrytype." >&4
11694 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11695         direntrytype="$guess2"
11696         echo "Your directory entries seem to be $direntrytype." >&4
11697 else
11698         echo "I don't recognize your system's directory entries." >&4
11699         rp="What type is used for directory entries on this system?"
11700         dflt="$guess1"
11701         . ./myread
11702         direntrytype="$ans"
11703 fi
11704 $rm_try
11705
11706 : see if the directory entry stores field length
11707 echo " "
11708 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11709 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11710         echo "Good, your directory entry keeps length information in d_namlen." >&4
11711         val="$define"
11712 else
11713         echo "Your directory entry does not know about the d_namlen field." >&4
11714         val="$undef"
11715 fi
11716 set d_dirnamlen
11717 eval $setvar
11718 $rm_try
11719
11720 : Look for DIR.dd_fd
11721 case "$i_dirent" in
11722 "$define")
11723     echo "Checking to see if DIR has a dd_fd member variable" >&4
11724     $cat >try.c <<EOCP
11725 #$i_stdlib I_STDLIB
11726 #ifdef I_STDLIB
11727 #include <stdlib.h>
11728 #endif
11729 #include <dirent.h>
11730
11731 int main() {
11732     DIR dir;
11733     dir.dd_fd = 1;
11734     return 0;
11735 }
11736 EOCP
11737     val=$undef
11738     set try
11739     if eval $compile; then
11740         echo "Yes, it does."
11741         val="$define"
11742     else
11743         echo "No, it does not."
11744         val="$undef"
11745     fi
11746     ;;
11747 *)
11748     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11749     val="$undef"
11750     ;;
11751 esac
11752 set d_dir_dd_fd
11753 eval $setvar
11754 $rm_try
11755
11756 : see if this is an sysdir system
11757 set sys/dir.h i_sysdir
11758 eval $inhdr
11759
11760 : see if this is an sysndir system
11761 set sys/ndir.h i_sysndir
11762 eval $inhdr
11763
11764 : Look for dirfd
11765 echo " "
11766 $cat >dirfd.c <<EOM
11767 #include <stdio.h>
11768 #$i_stdlib I_STDLIB
11769 #ifdef I_STDLIB
11770 #include <stdlib.h>
11771 #endif
11772 #$i_dirent I_DIRENT             /**/
11773 #$i_sysdir I_SYS_DIR            /**/
11774 #$i_sysndir I_SYS_NDIR          /**/
11775 #$i_systypes I_SYS_TYPES        /**/
11776 #if defined(I_SYS_TYPES)
11777 #include <sys/types.h>
11778 #endif
11779 #if defined(I_DIRENT)
11780 #include <dirent.h>
11781 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11782 #include <sys/dir.h>
11783 #endif
11784 #else
11785 #ifdef I_SYS_NDIR
11786 #include <sys/ndir.h>
11787 #else
11788 #ifdef I_SYS_DIR
11789 #ifdef hp9000s500
11790 #include <ndir.h>       /* may be wrong in the future */
11791 #else
11792 #include <sys/dir.h>
11793 #endif
11794 #endif
11795 #endif
11796 #endif 
11797 int main() {
11798         DIR *dirp = opendir(".");
11799         if (dirfd(dirp) >= 0)
11800                 exit(0);
11801         else
11802                 exit(1);
11803 }
11804 EOM
11805 val=$undef
11806 set dirfd
11807 if eval $compile; then
11808         val="$define"
11809 fi
11810 case "$val" in
11811 $define)        echo "dirfd() found." >&4       ;;
11812 *)              echo "dirfd() NOT found." >&4   ;;
11813 esac
11814 set d_dirfd
11815 eval $setvar
11816 $rm -f dirfd*
11817
11818 : see if dlerror exists
11819 xxx_runnm="$runnm"
11820 runnm=false
11821 set dlerror d_dlerror
11822 eval $inlibc
11823 runnm="$xxx_runnm"
11824
11825 : see if dlfcn is available
11826 set dlfcn.h i_dlfcn
11827 eval $inhdr
11828
11829 : Check what extension to use for shared libs
11830 case "$usedl" in
11831 $define|y|true)
11832         $cat << EOM
11833
11834 On a few systems, the dynamically loaded modules that perl generates and uses
11835 will need a different extension than shared libs. The default will probably
11836 be appropriate.
11837
11838 EOM
11839         case "$dlext" in
11840         '')     dflt="$so" ;;
11841         *)      dflt="$dlext" ;;
11842         esac
11843         rp='What is the extension of dynamically loaded modules'
11844         . ./myread
11845         dlext="$ans"
11846         ;;
11847 *)
11848         dlext="none"
11849         ;;
11850 esac
11851
11852 : Check if dlsym need a leading underscore
11853 echo " "
11854 val="$undef"
11855
11856 case "$dlsrc" in
11857 dl_dlopen.xs)
11858         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11859         $cat >dyna.c <<'EOM'
11860 fred () { }
11861 EOM
11862
11863 $cat >fred.c<<EOM
11864
11865 #include <stdio.h>
11866 #$i_stdlib I_STDLIB
11867 #ifdef I_STDLIB
11868 #include <stdlib.h>
11869 #endif
11870 #$i_dlfcn I_DLFCN
11871 #ifdef I_DLFCN
11872 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11873 #else
11874 #include <sys/types.h>
11875 #include <nlist.h>
11876 #include <link.h>
11877 #endif
11878
11879 extern int fred() ;
11880
11881 int main()
11882 {
11883     void * handle ;
11884     void * symbol ;
11885 #ifndef RTLD_LAZY
11886     int mode = 1 ;
11887 #else
11888     int mode = RTLD_LAZY ;
11889 #endif
11890     handle = dlopen("./dyna.$dlext", mode) ;
11891     if (handle == NULL) {
11892         printf ("1\n") ;
11893         fflush (stdout) ;
11894         exit(0);
11895     }
11896     symbol = dlsym(handle, "fred") ;
11897     if (symbol == NULL) {
11898         /* try putting a leading underscore */
11899         symbol = dlsym(handle, "_fred") ;
11900         if (symbol == NULL) {
11901             printf ("2\n") ;
11902             fflush (stdout) ;
11903             exit(0);
11904         }
11905         printf ("3\n") ;
11906     }
11907     else
11908         printf ("4\n") ;
11909     fflush (stdout) ;
11910     exit(0);
11911 }
11912 EOM
11913         : Call the object file tmp-dyna.o in case dlext=o.
11914         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11915                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11916                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11917                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11918                 xxx=`$run ./fred`
11919                 case $xxx in
11920                 1)      echo "Test program failed using dlopen." >&4
11921                         echo "Perhaps you should not use dynamic loading." >&4;;
11922                 2)      echo "Test program failed using dlsym." >&4
11923                         echo "Perhaps you should not use dynamic loading." >&4;;
11924                 3)      echo "dlsym needs a leading underscore" >&4
11925                         val="$define" ;;
11926                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11927                 esac
11928         else
11929                 echo "I can't compile and run the test program." >&4
11930                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11931         fi
11932         ;;
11933 esac
11934
11935 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11936
11937 set d_dlsymun
11938 eval $setvar
11939
11940 : see if drand48_r exists
11941 set drand48_r d_drand48_r
11942 eval $inlibc
11943 case "$d_drand48_r" in
11944 "$define")
11945         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11946         case "$d_drand48_r_proto:$usethreads" in
11947         ":define")      d_drand48_r_proto=define
11948                 set d_drand48_r_proto drand48_r $hdrs
11949                 eval $hasproto ;;
11950         *)      ;;
11951         esac
11952         case "$d_drand48_r_proto" in
11953         define)
11954         case "$drand48_r_proto" in
11955         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11956         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11957         esac
11958         case "$drand48_r_proto" in
11959         ''|0)   d_drand48_r=undef
11960                 drand48_r_proto=0
11961                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11962         * )     case "$drand48_r_proto" in
11963                 REENTRANT_PROTO*) ;;
11964                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11965                 esac
11966                 echo "Prototype: $try" ;;
11967         esac
11968         ;;
11969         *)      case "$usethreads" in
11970                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11971                 esac
11972                 d_drand48_r=undef
11973                 drand48_r_proto=0
11974                 ;;
11975         esac
11976         ;;
11977 *)      drand48_r_proto=0
11978         ;;
11979 esac
11980
11981 : see if prototype for drand48 is available
11982 echo " "
11983 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11984 eval $hasproto
11985
11986 : see if dup2 exists
11987 set dup2 d_dup2
11988 eval $inlibc
11989
11990 : see if eaccess exists
11991 set eaccess d_eaccess
11992 eval $inlibc
11993
11994 : see if endgrent exists
11995 set endgrent d_endgrent
11996 eval $inlibc
11997
11998 : see if this is an grp system
11999 set grp.h i_grp
12000 eval $inhdr
12001
12002 case "$i_grp" in
12003 $define)
12004         xxx=`./findhdr grp.h`
12005         $cppstdin $cppflags $cppminus < $xxx >$$.h
12006
12007         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12008                 val="$define"
12009         else
12010                 val="$undef"
12011         fi
12012         set d_grpasswd
12013         eval $setvar
12014
12015         $rm -f $$.h
12016         ;;
12017 *)
12018         val="$undef";
12019         set d_grpasswd; eval $setvar
12020         ;;
12021 esac
12022
12023 : see if endgrent_r exists
12024 set endgrent_r d_endgrent_r
12025 eval $inlibc
12026 case "$d_endgrent_r" in
12027 "$define")
12028         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12029         case "$d_endgrent_r_proto:$usethreads" in
12030         ":define")      d_endgrent_r_proto=define
12031                 set d_endgrent_r_proto endgrent_r $hdrs
12032                 eval $hasproto ;;
12033         *)      ;;
12034         esac
12035         case "$d_endgrent_r_proto" in
12036         define)
12037         case "$endgrent_r_proto" in
12038         ''|0) try='int endgrent_r(FILE**);'
12039         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12040         esac
12041         case "$endgrent_r_proto" in
12042         ''|0) try='void endgrent_r(FILE**);'
12043         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12044         esac
12045         case "$endgrent_r_proto" in
12046         ''|0)   d_endgrent_r=undef
12047                 endgrent_r_proto=0
12048                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12049         * )     case "$endgrent_r_proto" in
12050                 REENTRANT_PROTO*) ;;
12051                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12052                 esac
12053                 echo "Prototype: $try" ;;
12054         esac
12055         ;;
12056         *)      case "$usethreads" in
12057                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12058                 esac
12059                 d_endgrent_r=undef
12060                 endgrent_r_proto=0
12061                 ;;
12062         esac
12063         ;;
12064 *)      endgrent_r_proto=0
12065         ;;
12066 esac
12067
12068 : see if endhostent exists
12069 set endhostent d_endhent
12070 eval $inlibc
12071
12072 : see if this is a netdb.h system
12073 set netdb.h i_netdb
12074 eval $inhdr
12075
12076 : see if endhostent_r exists
12077 set endhostent_r d_endhostent_r
12078 eval $inlibc
12079 case "$d_endhostent_r" in
12080 "$define")
12081         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12082         case "$d_endhostent_r_proto:$usethreads" in
12083         ":define")      d_endhostent_r_proto=define
12084                 set d_endhostent_r_proto endhostent_r $hdrs
12085                 eval $hasproto ;;
12086         *)      ;;
12087         esac
12088         case "$d_endhostent_r_proto" in
12089         define)
12090         case "$endhostent_r_proto" in
12091         ''|0) try='int endhostent_r(struct hostent_data*);'
12092         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12093         esac
12094         case "$endhostent_r_proto" in
12095         ''|0) try='void endhostent_r(struct hostent_data*);'
12096         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12097         esac
12098         case "$endhostent_r_proto" in
12099         ''|0)   d_endhostent_r=undef
12100                 endhostent_r_proto=0
12101                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12102         * )     case "$endhostent_r_proto" in
12103                 REENTRANT_PROTO*) ;;
12104                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12105                 esac
12106                 echo "Prototype: $try" ;;
12107         esac
12108         ;;
12109         *)      case "$usethreads" in
12110                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12111                 esac
12112                 d_endhostent_r=undef
12113                 endhostent_r_proto=0
12114                 ;;
12115         esac
12116         ;;
12117 *)      endhostent_r_proto=0
12118         ;;
12119 esac
12120
12121 : see if endnetent exists
12122 set endnetent d_endnent
12123 eval $inlibc
12124
12125 : see if endnetent_r exists
12126 set endnetent_r d_endnetent_r
12127 eval $inlibc
12128 case "$d_endnetent_r" in
12129 "$define")
12130         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12131         case "$d_endnetent_r_proto:$usethreads" in
12132         ":define")      d_endnetent_r_proto=define
12133                 set d_endnetent_r_proto endnetent_r $hdrs
12134                 eval $hasproto ;;
12135         *)      ;;
12136         esac
12137         case "$d_endnetent_r_proto" in
12138         define)
12139         case "$endnetent_r_proto" in
12140         ''|0) try='int endnetent_r(struct netent_data*);'
12141         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12142         esac
12143         case "$endnetent_r_proto" in
12144         ''|0) try='void endnetent_r(struct netent_data*);'
12145         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12146         esac
12147         case "$endnetent_r_proto" in
12148         ''|0)   d_endnetent_r=undef
12149                 endnetent_r_proto=0
12150                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12151         * )     case "$endnetent_r_proto" in
12152                 REENTRANT_PROTO*) ;;
12153                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12154                 esac
12155                 echo "Prototype: $try" ;;
12156         esac
12157         ;;
12158         *)      case "$usethreads" in
12159                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12160                 esac
12161                 d_endnetent_r=undef
12162                 endnetent_r_proto=0
12163                 ;;
12164         esac
12165         ;;
12166 *)      endnetent_r_proto=0
12167         ;;
12168 esac
12169
12170 : see if endprotoent exists
12171 set endprotoent d_endpent
12172 eval $inlibc
12173
12174 : see if endprotoent_r exists
12175 set endprotoent_r d_endprotoent_r
12176 eval $inlibc
12177 case "$d_endprotoent_r" in
12178 "$define")
12179         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12180         case "$d_endprotoent_r_proto:$usethreads" in
12181         ":define")      d_endprotoent_r_proto=define
12182                 set d_endprotoent_r_proto endprotoent_r $hdrs
12183                 eval $hasproto ;;
12184         *)      ;;
12185         esac
12186         case "$d_endprotoent_r_proto" in
12187         define)
12188         case "$endprotoent_r_proto" in
12189         ''|0) try='int endprotoent_r(struct protoent_data*);'
12190         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12191         esac
12192         case "$endprotoent_r_proto" in
12193         ''|0) try='void endprotoent_r(struct protoent_data*);'
12194         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12195         esac
12196         case "$endprotoent_r_proto" in
12197         ''|0)   d_endprotoent_r=undef
12198                 endprotoent_r_proto=0
12199                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12200         * )     case "$endprotoent_r_proto" in
12201                 REENTRANT_PROTO*) ;;
12202                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12203                 esac
12204                 echo "Prototype: $try" ;;
12205         esac
12206         ;;
12207         *)      case "$usethreads" in
12208                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12209                 esac
12210                 d_endprotoent_r=undef
12211                 endprotoent_r_proto=0
12212                 ;;
12213         esac
12214         ;;
12215 *)      endprotoent_r_proto=0
12216         ;;
12217 esac
12218
12219 : see if endpwent exists
12220 set endpwent d_endpwent
12221 eval $inlibc
12222
12223 : see if this is a pwd.h system
12224 set pwd.h i_pwd
12225 eval $inhdr
12226
12227 case "$i_pwd" in
12228 $define)
12229         xxx=`./findhdr pwd.h`
12230         $cppstdin $cppflags $cppminus < $xxx >$$.h
12231
12232         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12233                 val="$define"
12234         else
12235                 val="$undef"
12236         fi
12237         set d_pwquota
12238         eval $setvar
12239
12240         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12241                 val="$define"
12242         else
12243                 val="$undef"
12244         fi
12245         set d_pwage
12246         eval $setvar
12247
12248         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12249                 val="$define"
12250         else
12251                 val="$undef"
12252         fi
12253         set d_pwchange
12254         eval $setvar
12255
12256         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12257                 val="$define"
12258         else
12259                 val="$undef"
12260         fi
12261         set d_pwclass
12262         eval $setvar
12263
12264         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12265                 val="$define"
12266         else
12267                 val="$undef"
12268         fi
12269         set d_pwexpire
12270         eval $setvar
12271
12272         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12273                 val="$define"
12274         else
12275                 val="$undef"
12276         fi
12277         set d_pwcomment
12278         eval $setvar
12279
12280         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12281                 val="$define"
12282         else
12283                 val="$undef"
12284         fi
12285         set d_pwgecos
12286         eval $setvar
12287
12288         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12289                 val="$define"
12290         else
12291                 val="$undef"
12292         fi
12293         set d_pwpasswd
12294         eval $setvar
12295
12296         $rm -f $$.h
12297         ;;
12298 *)
12299         val="$undef"; 
12300         set d_pwquota; eval $setvar
12301         set d_pwage; eval $setvar
12302         set d_pwchange; eval $setvar
12303         set d_pwclass; eval $setvar
12304         set d_pwexpire; eval $setvar
12305         set d_pwcomment; eval $setvar
12306         set d_pwgecos; eval $setvar
12307         set d_pwpasswd; eval $setvar
12308         ;;
12309 esac
12310
12311 : see if endpwent_r exists
12312 set endpwent_r d_endpwent_r
12313 eval $inlibc
12314 case "$d_endpwent_r" in
12315 "$define")
12316         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12317         case "$d_endpwent_r_proto:$usethreads" in
12318         ":define")      d_endpwent_r_proto=define
12319                 set d_endpwent_r_proto endpwent_r $hdrs
12320                 eval $hasproto ;;
12321         *)      ;;
12322         esac
12323         case "$d_endpwent_r_proto" in
12324         define)
12325         case "$endpwent_r_proto" in
12326         ''|0) try='int endpwent_r(FILE**);'
12327         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12328         esac
12329         case "$endpwent_r_proto" in
12330         ''|0) try='void endpwent_r(FILE**);'
12331         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12332         esac
12333         case "$endpwent_r_proto" in
12334         ''|0)   d_endpwent_r=undef
12335                 endpwent_r_proto=0
12336                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12337         * )     case "$endpwent_r_proto" in
12338                 REENTRANT_PROTO*) ;;
12339                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12340                 esac
12341                 echo "Prototype: $try" ;;
12342         esac
12343         ;;
12344         *)      case "$usethreads" in
12345                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12346                 esac
12347                 d_endpwent_r=undef
12348                 endpwent_r_proto=0
12349                 ;;
12350         esac
12351         ;;
12352 *)      endpwent_r_proto=0
12353         ;;
12354 esac
12355
12356 : see if endservent exists
12357 set endservent d_endsent
12358 eval $inlibc
12359
12360 : see if endservent_r exists
12361 set endservent_r d_endservent_r
12362 eval $inlibc
12363 case "$d_endservent_r" in
12364 "$define")
12365         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12366         case "$d_endservent_r_proto:$usethreads" in
12367         ":define")      d_endservent_r_proto=define
12368                 set d_endservent_r_proto endservent_r $hdrs
12369                 eval $hasproto ;;
12370         *)      ;;
12371         esac
12372         case "$d_endservent_r_proto" in
12373         define)
12374         case "$endservent_r_proto" in
12375         ''|0) try='int endservent_r(struct servent_data*);'
12376         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12377         esac
12378         case "$endservent_r_proto" in
12379         ''|0) try='void endservent_r(struct servent_data*);'
12380         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12381         esac
12382         case "$endservent_r_proto" in
12383         ''|0)   d_endservent_r=undef
12384                 endservent_r_proto=0
12385                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12386         * )     case "$endservent_r_proto" in
12387                 REENTRANT_PROTO*) ;;
12388                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12389                 esac
12390                 echo "Prototype: $try" ;;
12391         esac
12392         ;;
12393         *)      case "$usethreads" in
12394                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12395                 esac
12396                 d_endservent_r=undef
12397                 endservent_r_proto=0
12398                 ;;
12399         esac
12400         ;;
12401 *)      endservent_r_proto=0
12402         ;;
12403 esac
12404
12405 : Locate the flags for 'open()'
12406 echo " "
12407 $cat >try.c <<EOCP
12408 #include <sys/types.h>
12409 #ifdef I_FCNTL
12410 #include <fcntl.h>
12411 #endif
12412 #ifdef I_SYS_FILE
12413 #include <sys/file.h>
12414 #endif
12415 #$i_stdlib I_STDLIB
12416 #ifdef I_STDLIB
12417 #include <stdlib.h>
12418 #endif
12419 int main() {
12420         if(O_RDONLY);
12421 #ifdef O_TRUNC
12422         exit(0);
12423 #else
12424         exit(1);
12425 #endif
12426 }
12427 EOCP
12428 : check sys/file.h first to get FREAD on Sun
12429 if $test `./findhdr sys/file.h` && \
12430                 set try -DI_SYS_FILE && eval $compile; then
12431         h_sysfile=true;
12432         echo "<sys/file.h> defines the O_* constants..." >&4
12433         if $run ./try; then
12434                 echo "and you have the 3 argument form of open()." >&4
12435                 val="$define"
12436         else
12437                 echo "but not the 3 argument form of open().  Oh, well." >&4
12438                 val="$undef"
12439         fi
12440 elif $test `./findhdr fcntl.h` && \
12441                 set try -DI_FCNTL && eval $compile; then
12442         h_fcntl=true;
12443         echo "<fcntl.h> defines the O_* constants..." >&4
12444         if $run ./try; then
12445                 echo "and you have the 3 argument form of open()." >&4
12446                 val="$define"
12447         else
12448                 echo "but not the 3 argument form of open().  Oh, well." >&4
12449                 val="$undef"
12450         fi
12451 else
12452         val="$undef"
12453         echo "I can't find the O_* constant definitions!  You got problems." >&4
12454 fi
12455 set d_open3
12456 eval $setvar
12457 $rm_try
12458
12459 : see if this is a sys/file.h system
12460 val=''
12461 set sys/file.h val
12462 eval $inhdr
12463
12464 : do we need to include sys/file.h ?
12465 case "$val" in
12466 "$define")
12467         echo " "
12468         if $h_sysfile; then
12469                 val="$define"
12470                 echo "We'll be including <sys/file.h>." >&4
12471         else
12472                 val="$undef"
12473                 echo "We won't be including <sys/file.h>." >&4
12474         fi
12475         ;;
12476 *)
12477         h_sysfile=false
12478         ;;
12479 esac
12480 set i_sysfile
12481 eval $setvar
12482
12483 : see if fcntl.h is there
12484 val=''
12485 set fcntl.h val
12486 eval $inhdr
12487
12488 : see if we can include fcntl.h
12489 case "$val" in
12490 "$define")
12491         echo " "
12492         if $h_fcntl; then
12493                 val="$define"
12494                 echo "We'll be including <fcntl.h>." >&4
12495         else
12496                 val="$undef"
12497                 if $h_sysfile; then
12498         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12499                 else
12500                         echo "We won't be including <fcntl.h>." >&4
12501                 fi
12502         fi
12503         ;;
12504 *)
12505         h_fcntl=false
12506         val="$undef"
12507         ;;
12508 esac
12509 set i_fcntl
12510 eval $setvar
12511
12512 : see if fork exists
12513 set fork d_fork
12514 eval $inlibc
12515
12516 : see if pipe exists
12517 set pipe d_pipe
12518 eval $inlibc
12519
12520 : check for non-blocking I/O stuff
12521 case "$h_sysfile" in
12522 true) echo "#include <sys/file.h>" > head.c;;
12523 *)
12524        case "$h_fcntl" in
12525        true) echo "#include <fcntl.h>" > head.c;;
12526        *) echo "#include <sys/fcntl.h>" > head.c;;
12527        esac
12528        ;;
12529 esac
12530 echo " "
12531 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12532 case "$o_nonblock" in
12533 '')
12534         $cat head.c > try.c
12535         $cat >>try.c <<EOCP
12536 #include <stdio.h>
12537 #$i_stdlib I_STDLIB
12538 #ifdef I_STDLIB
12539 #include <stdlib.h>
12540 #endif
12541 #$i_fcntl I_FCNTL
12542 #ifdef I_FCNTL
12543 #include <fcntl.h>
12544 #endif
12545 int main() {
12546 #ifdef O_NONBLOCK
12547         printf("O_NONBLOCK\n");
12548         exit(0);
12549 #endif
12550 #ifdef O_NDELAY
12551         printf("O_NDELAY\n");
12552         exit(0);
12553 #endif
12554 #ifdef FNDELAY
12555         printf("FNDELAY\n");
12556         exit(0);
12557 #endif
12558         exit(0);
12559 }
12560 EOCP
12561         set try
12562         if eval $compile_ok; then
12563                 o_nonblock=`$run ./try`
12564                 case "$o_nonblock" in
12565                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12566                 *) echo "Seems like we can use $o_nonblock.";;
12567                 esac
12568         else
12569                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12570         fi
12571         ;;
12572 *) echo "Using $hint value $o_nonblock.";;
12573 esac
12574 $rm_try
12575
12576 echo " "
12577 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12578 case "$eagain" in
12579 '')
12580         case "$d_fork:$d_pipe" in
12581         define:define)
12582         $cat head.c > try.c
12583         $cat >>try.c <<EOCP
12584 #include <errno.h>
12585 #include <sys/types.h>
12586 #include <signal.h>
12587 #include <stdio.h>
12588 #$i_stdlib I_STDLIB
12589 #ifdef I_STDLIB
12590 #include <stdlib.h>
12591 #endif
12592 #$i_fcntl I_FCNTL
12593 #ifdef I_FCNTL
12594 #include <fcntl.h>
12595 #endif
12596 #define MY_O_NONBLOCK $o_nonblock
12597 #ifndef errno  /* XXX need better Configure test */
12598 extern int errno;
12599 #endif
12600 #$i_unistd I_UNISTD
12601 #ifdef I_UNISTD
12602 #include <unistd.h>
12603 #endif
12604 #$i_string I_STRING
12605 #ifdef I_STRING
12606 #include <string.h>
12607 #else
12608 #include <strings.h>
12609 #endif
12610 $signal_t blech(int x) { exit(3); }
12611 EOCP
12612         $cat >> try.c <<'EOCP'
12613 int main()
12614 {
12615         int pd[2];
12616         int pu[2];
12617         char buf[1];
12618         char string[100];
12619
12620         pipe(pd);       /* Down: child -> parent */
12621         pipe(pu);       /* Up: parent -> child */
12622         if (0 != fork()) {
12623                 int ret;
12624                 close(pd[1]);   /* Parent reads from pd[0] */
12625                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12626 #ifdef F_SETFL
12627                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12628                         exit(1);
12629 #else
12630                 exit(4);
12631 #endif
12632                 signal(SIGALRM, blech);
12633                 alarm(5);
12634                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12635                         exit(2);
12636                 sprintf(string, "%d\n", ret);
12637                 write(2, string, strlen(string));
12638                 alarm(0);
12639 #ifdef EAGAIN
12640                 if (errno == EAGAIN) {
12641                         printf("EAGAIN\n");
12642                         goto ok;
12643                 }
12644 #endif
12645 #ifdef EWOULDBLOCK
12646                 if (errno == EWOULDBLOCK)
12647                         printf("EWOULDBLOCK\n");
12648 #endif
12649         ok:
12650                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12651                 sleep(2);                               /* Give it time to close our pipe */
12652                 alarm(5);
12653                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12654                 alarm(0);
12655                 sprintf(string, "%d\n", ret);
12656                 write(4, string, strlen(string));
12657                 exit(0);
12658         }
12659
12660         close(pd[0]);                   /* We write to pd[1] */
12661         close(pu[1]);                   /* We read from pu[0] */
12662         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12663         close(pd[1]);                   /* Pipe pd is now fully closed! */
12664         exit(0);                                /* Bye bye, thank you for playing! */
12665 }
12666 EOCP
12667         set try
12668         if eval $compile_ok; then
12669                 echo "$startsh" >mtry
12670                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12671                 chmod +x mtry
12672                 ./mtry >/dev/null 2>&1
12673                 case $? in
12674                 0) eagain=`$cat try.out`;;
12675                 1) echo "Could not perform non-blocking setting!";;
12676                 2) echo "I did a successful read() for something that was not there!";;
12677                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12678                 4) echo "Could not find F_SETFL!";;
12679                 *) echo "Something terribly wrong happened during testing.";;
12680                 esac
12681                 rd_nodata=`$cat try.ret`
12682                 echo "A read() system call with no data present returns $rd_nodata."
12683                 case "$rd_nodata" in
12684                 0|-1) ;;
12685                 *)
12686                         echo "(That's peculiar, fixing that to be -1.)"
12687                         rd_nodata=-1
12688                         ;;
12689                 esac
12690                 case "$eagain" in
12691                 '')
12692                         echo "Forcing errno EAGAIN on read() with no data available."
12693                         eagain=EAGAIN
12694                         ;;
12695                 *)
12696                         echo "Your read() sets errno to $eagain when no data is available."
12697                         ;;
12698                 esac
12699                 status=`$cat try.err`
12700                 case "$status" in
12701                 0) echo "And it correctly returns 0 to signal EOF.";;
12702                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12703                 *) echo "However, your read() returns '$status' on EOF??";;
12704                 esac
12705                 val="$define"
12706                 if test "$status" = "$rd_nodata"; then
12707                         echo "WARNING: you can't distinguish between EOF and no data!"
12708                         val="$undef"
12709                 fi
12710         else
12711                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12712                 eagain=EAGAIN
12713         fi
12714         ;;
12715         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12716                 eagain=EAGAIN
12717                 val="$define"
12718                 ;;
12719         esac
12720         set d_eofnblk
12721         eval $setvar
12722         ;;
12723 *)
12724         echo "Using $hint value $eagain."
12725         echo "Your read() returns $rd_nodata when no data is present."
12726         case "$d_eofnblk" in
12727         "$define") echo "And you can see EOF because read() returns 0.";;
12728         "$undef") echo "But you can't see EOF status from read() returned value.";;
12729         *)
12730                 echo "(Assuming you can't see EOF status from read anyway.)"
12731                 d_eofnblk=$undef
12732                 ;;
12733         esac
12734         ;;
12735 esac
12736 $rm_try head.c mtry
12737
12738 : see if _ptr and _cnt from stdio act std
12739 echo " "
12740
12741 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12742         echo "(Looks like you have stdio.h from BSD.)"
12743         case "$stdio_ptr" in
12744         '') stdio_ptr='((fp)->_p)'
12745                 ptr_lval=$define
12746                 ;;
12747         *)      ptr_lval=$d_stdio_ptr_lval;;
12748         esac
12749         case "$stdio_cnt" in
12750         '') stdio_cnt='((fp)->_r)'
12751                 cnt_lval=$define
12752                 ;;
12753         *)      cnt_lval=$d_stdio_cnt_lval;;
12754         esac
12755         case "$stdio_base" in
12756         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12757         esac
12758         case "$stdio_bufsiz" in
12759         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12760         esac
12761 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12762         echo "(Looks like you have stdio.h from Linux.)"
12763         case "$stdio_ptr" in
12764         '') stdio_ptr='((fp)->_IO_read_ptr)'
12765                 ptr_lval=$define
12766                 ;;
12767         *)      ptr_lval=$d_stdio_ptr_lval;;
12768         esac
12769         case "$stdio_cnt" in
12770         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12771                 cnt_lval=$undef
12772                 ;;
12773         *)      cnt_lval=$d_stdio_cnt_lval;;
12774         esac
12775         case "$stdio_base" in
12776         '') stdio_base='((fp)->_IO_read_base)';;
12777         esac
12778         case "$stdio_bufsiz" in
12779         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12780         esac
12781 else
12782         case "$stdio_ptr" in
12783         '') stdio_ptr='((fp)->_ptr)'
12784                 ptr_lval=$define
12785                 ;;
12786         *)      ptr_lval=$d_stdio_ptr_lval;;
12787         esac
12788         case "$stdio_cnt" in
12789         '') stdio_cnt='((fp)->_cnt)'
12790                 cnt_lval=$define
12791                 ;;
12792         *)      cnt_lval=$d_stdio_cnt_lval;;
12793         esac
12794         case "$stdio_base" in
12795         '') stdio_base='((fp)->_base)';;
12796         esac
12797         case "$stdio_bufsiz" in
12798         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12799         esac
12800 fi
12801
12802 : test whether _ptr and _cnt really work
12803 echo "Checking how std your stdio is..." >&4
12804 $cat >try.c <<EOP
12805 #include <stdio.h>
12806 #$i_stdlib I_STDLIB
12807 #ifdef I_STDLIB
12808 #include <stdlib.h>
12809 #endif
12810 #define FILE_ptr(fp)    $stdio_ptr
12811 #define FILE_cnt(fp)    $stdio_cnt
12812 int main() {
12813         FILE *fp = fopen("try.c", "r");
12814         char c = getc(fp);
12815         if (
12816                 18 <= FILE_cnt(fp) &&
12817                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12818         )
12819                 exit(0);
12820         exit(1);
12821 }
12822 EOP
12823 val="$undef"
12824 set try
12825 if eval $compile && $to try.c; then
12826         if $run ./try; then
12827                 echo "Your stdio acts pretty std."
12828                 val="$define"
12829         else
12830                 echo "Your stdio isn't very std."
12831         fi
12832 else
12833         echo "Your stdio doesn't appear very std."
12834 fi
12835 $rm_try
12836
12837 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12838 # direct buffer manipulation no longer works.  The Configure tests
12839 # should be changed to correctly detect this, but until then,
12840 # the following check should at least let perl compile and run.
12841 # (This quick fix should be updated before 5.8.1.)
12842 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12843 # A. Dougherty, June 3, 2002.
12844 case "$d_gnulibc" in
12845 $define)
12846         case "$gnulibc_version" in
12847         2.[01]*)  ;;
12848         2.2) ;;
12849         2.2.[0-9]) ;;
12850         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12851                 val="$undef"
12852                 ;;
12853         esac
12854         ;;
12855 esac
12856 set d_stdstdio
12857 eval $setvar
12858
12859 : Can _ptr be used as an lvalue?
12860 case "$d_stdstdio$ptr_lval" in
12861 $define$define) val=$define ;;
12862 *) val=$undef ;;
12863 esac
12864 set d_stdio_ptr_lval
12865 eval $setvar
12866
12867 : Can _cnt be used as an lvalue?
12868 case "$d_stdstdio$cnt_lval" in
12869 $define$define) val=$define ;;
12870 *) val=$undef ;;
12871 esac
12872 set d_stdio_cnt_lval
12873 eval $setvar
12874
12875
12876 : test whether setting _ptr sets _cnt as a side effect
12877 d_stdio_ptr_lval_sets_cnt="$undef"
12878 d_stdio_ptr_lval_nochange_cnt="$undef"
12879 case "$d_stdio_ptr_lval$d_stdstdio" in
12880 $define$define)
12881         echo "Checking to see what happens if we set the stdio ptr..." >&4
12882 $cat >try.c <<EOP
12883 #include <stdio.h>
12884 /* Can we scream? */
12885 /* Eat dust sed :-) */
12886 /* In the buffer space, no one can hear you scream. */
12887 #$i_stdlib I_STDLIB
12888 #ifdef I_STDLIB
12889 #include <stdlib.h>
12890 #endif
12891 #define FILE_ptr(fp)    $stdio_ptr
12892 #define FILE_cnt(fp)    $stdio_cnt
12893 #include <sys/types.h>
12894 int main() {
12895         FILE *fp = fopen("try.c", "r");
12896         int c;
12897         char *ptr;
12898         size_t cnt;
12899         if (!fp) {
12900             puts("Fail even to read");
12901             exit(1);
12902         }
12903         c = getc(fp); /* Read away the first # */
12904         if (c == EOF) {
12905             puts("Fail even to read");
12906             exit(1);
12907         }
12908         if (!(
12909                 18 <= FILE_cnt(fp) &&
12910                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12911         )) {
12912                 puts("Fail even to read");
12913                 exit (1);
12914         }
12915         ptr = (char*) FILE_ptr(fp);
12916         cnt = (size_t)FILE_cnt(fp);
12917
12918         FILE_ptr(fp) += 42;
12919
12920         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12921                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12922                 exit (1);
12923         }
12924         if (FILE_cnt(fp) <= 20) {
12925                 printf ("Fail (<20 chars to test)");
12926                 exit (1);
12927         }
12928         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12929                 puts("Fail compare");
12930                 exit (1);
12931         }
12932         if (cnt == FILE_cnt(fp)) {
12933                 puts("Pass_unchanged");
12934                 exit (0);
12935         }
12936         if (FILE_cnt(fp) == (cnt - 42)) {
12937                 puts("Pass_changed");
12938                 exit (0);
12939         }
12940         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12941         return 1;
12942
12943 }
12944 EOP
12945         set try
12946         if eval $compile && $to try.c; then
12947                 case `$run ./try` in
12948                 Pass_changed)
12949                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12950                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12951                 Pass_unchanged)
12952                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12953                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12954                 Fail*)
12955                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12956                 *)
12957                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12958         esac
12959         else
12960                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12961         fi
12962         $rm_try
12963         ;;
12964 esac
12965
12966 : see if _base is also standard
12967 val="$undef"
12968 case "$d_stdstdio" in
12969 $define)
12970         $cat >try.c <<EOP
12971 #include <stdio.h>
12972 #$i_stdlib I_STDLIB
12973 #ifdef I_STDLIB
12974 #include <stdlib.h>
12975 #endif
12976 #define FILE_base(fp)   $stdio_base
12977 #define FILE_bufsiz(fp) $stdio_bufsiz
12978 int main() {
12979         FILE *fp = fopen("try.c", "r");
12980         char c = getc(fp);
12981         if (
12982                 19 <= FILE_bufsiz(fp) &&
12983                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12984         )
12985                 exit(0);
12986         exit(1);
12987 }
12988 EOP
12989         set try
12990         if eval $compile && $to try.c; then
12991                 if $run ./try; then
12992                         echo "And its _base field acts std."
12993                         val="$define"
12994                 else
12995                         echo "But its _base field isn't std."
12996                 fi
12997         else
12998                 echo "However, it seems to be lacking the _base field."
12999         fi
13000         $rm_try
13001         ;;
13002 esac
13003 set d_stdiobase
13004 eval $setvar
13005
13006 : see if fast_stdio exists
13007 val="$undef"
13008 case "$d_stdstdio:$d_stdio_ptr_lval" in
13009 "$define:$define")
13010         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13011         *$define*)
13012                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13013                 val="$define"
13014                 ;;
13015         esac
13016         ;;
13017 esac
13018 set d_faststdio
13019 eval $setvar
13020
13021
13022
13023 : see if fchdir exists
13024 set fchdir d_fchdir
13025 eval $inlibc
13026
13027 : see if fchmod exists
13028 set fchmod d_fchmod
13029 eval $inlibc
13030
13031 : see if fchown exists
13032 set fchown d_fchown
13033 eval $inlibc
13034
13035 : see if this is an fcntl system
13036 set fcntl d_fcntl
13037 eval $inlibc
13038
13039 : See if fcntl-based locking works.
13040 echo " "
13041 $cat >try.c <<EOCP
13042 #$i_stdlib I_STDLIB
13043 #ifdef I_STDLIB
13044 #include <stdlib.h>
13045 #endif
13046 #include <unistd.h>
13047 #include <fcntl.h>
13048 #include <signal.h>
13049 $signal_t blech(int x) { exit(3); }
13050 int main() {
13051 #if defined(F_SETLK) && defined(F_SETLKW)
13052      struct flock flock;
13053      int retval, fd;
13054      fd = open("try.c", O_RDONLY);
13055      flock.l_type = F_RDLCK;
13056      flock.l_whence = SEEK_SET;
13057      flock.l_start = flock.l_len = 0;
13058      signal(SIGALRM, blech);
13059      alarm(10);
13060      retval = fcntl(fd, F_SETLK, &flock);
13061      close(fd);
13062      (retval < 0 ? exit(2) : exit(0));
13063 #else
13064      exit(2);
13065 #endif
13066 }
13067 EOCP
13068 echo "Checking if fcntl-based file locking works... "
13069 case "$d_fcntl" in
13070 "$define")
13071         set try
13072         if eval $compile_ok; then
13073                 if $run ./try; then
13074                         echo "Yes, it seems to work."
13075                         val="$define"
13076                 else
13077                         echo "Nope, it didn't work."
13078                         val="$undef"
13079                         case "$?" in
13080                         3) $cat >&4 <<EOM
13081 ***
13082 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13083 *** This is (almost) impossible.
13084 *** If your NFS lock daemons are not feeling well, something like
13085 *** this may happen, please investigate.  Cannot continue, aborting.
13086 ***
13087 EOM
13088                                 exit 1
13089                                 ;;
13090                         esac
13091                 fi
13092         else
13093                 echo "I'm unable to compile the test program, so I'll assume not."
13094                 val="$undef"
13095         fi
13096         ;;
13097 *) val="$undef";
13098         echo "Nope, since you don't even have fcntl()."
13099         ;;
13100 esac
13101 set d_fcntl_can_lock
13102 eval $setvar
13103 $rm_try
13104
13105 : check for fd_set items
13106 $cat <<EOM
13107
13108 Checking to see how well your C compiler handles fd_set and friends ...
13109 EOM
13110 $cat >try.c <<EOCP
13111 #$i_stdlib I_STDLIB
13112 #ifdef I_STDLIB
13113 #include <stdlib.h>
13114 #endif
13115 #$i_systime I_SYS_TIME
13116 #$i_sysselct I_SYS_SELECT
13117 #$d_socket HAS_SOCKET
13118 #include <sys/types.h>
13119 #ifdef HAS_SOCKET
13120 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13121 #endif
13122 #ifdef I_SYS_TIME
13123 #include <sys/time.h>
13124 #endif
13125 #ifdef I_SYS_SELECT
13126 #include <sys/select.h>
13127 #endif
13128 int main() {
13129         fd_set fds;
13130
13131 #ifdef TRYBITS
13132         if(fds.fds_bits);
13133 #endif
13134
13135 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13136         exit(0);
13137 #else
13138         exit(1);
13139 #endif
13140 }
13141 EOCP
13142 set try -DTRYBITS
13143 if eval $compile; then
13144         d_fds_bits="$define"
13145         d_fd_set="$define"
13146         echo "Well, your system knows about the normal fd_set typedef..." >&4
13147         if $run ./try; then
13148                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13149                 d_fd_macros="$define"
13150         else
13151                 $cat >&4 <<'EOM'
13152 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13153 EOM
13154                 d_fd_macros="$undef"
13155         fi
13156 else
13157         $cat <<'EOM'
13158 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13159 EOM
13160         set try
13161         if eval $compile; then
13162                 d_fds_bits="$undef"
13163                 d_fd_set="$define"
13164                 echo "Well, your system has some sort of fd_set available..." >&4
13165                 if $run ./try; then
13166                         echo "and you have the normal fd_set macros." >&4
13167                         d_fd_macros="$define"
13168                 else
13169                         $cat <<'EOM'
13170 but not the normal fd_set macros!  Gross!  More work for me...
13171 EOM
13172                         d_fd_macros="$undef"
13173                 fi
13174         else
13175         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13176                 d_fd_set="$undef"
13177                 d_fds_bits="$undef"
13178                 d_fd_macros="$undef"
13179         fi
13180 fi
13181 $rm_try
13182
13183 : see if fgetpos exists
13184 set fgetpos d_fgetpos
13185 eval $inlibc
13186
13187 : see if finite exists
13188 set finite d_finite
13189 eval $inlibc
13190
13191 : see if finitel exists
13192 set finitel d_finitel
13193 eval $inlibc
13194
13195 : see if flock exists
13196 set flock d_flock
13197 eval $inlibc
13198
13199 : see if prototype for flock is available
13200 echo " "
13201 set d_flockproto flock $i_sysfile sys/file.h
13202 eval $hasproto
13203
13204 : see if fp_class exists
13205 set fp_class d_fp_class
13206 eval $inlibc
13207
13208 : see if pathconf exists
13209 set pathconf d_pathconf
13210 eval $inlibc
13211
13212 : see if fpathconf exists
13213 set fpathconf d_fpathconf
13214 eval $inlibc
13215
13216 : see if fpclass exists
13217 set fpclass d_fpclass
13218 eval $inlibc
13219
13220 : see if fpclassify exists
13221 set fpclassify d_fpclassify
13222 eval $inlibc
13223
13224 : see if fpclassl exists
13225 set fpclassl d_fpclassl
13226 eval $inlibc
13227
13228 : check for fpos64_t
13229 echo " "
13230 echo "Checking to see if you have fpos64_t..." >&4
13231 $cat >try.c <<EOCP
13232 #include <stdio.h>
13233 int main() { fpos64_t x = 7; }
13234 EOCP
13235 set try
13236 if eval $compile; then
13237         val="$define"
13238         echo "You have fpos64_t."
13239 else
13240         val="$undef"
13241         echo "You do not have fpos64_t."
13242         case "$fpossize" in
13243         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13244         esac
13245 fi
13246 $rm_try
13247 set d_fpos64_t
13248 eval $setvar
13249
13250 : see if frexpl exists
13251 set frexpl d_frexpl
13252 eval $inlibc
13253
13254 : see if this is a sys/param system
13255 set sys/param.h i_sysparam
13256 eval $inhdr
13257
13258 : see if this is a sys/mount.h system
13259 set sys/mount.h i_sysmount
13260 eval $inhdr
13261
13262 : Check for fs_data_s
13263 echo " "
13264 echo "Checking to see if your system supports struct fs_data..." >&4
13265 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13266 eval $hasstruct
13267 case "$d_fs_data_s" in
13268 "$define")      echo "Yes, it does."   ;;
13269 *)              echo "No, it doesn't." ;;
13270 esac
13271
13272 : see if fseeko exists
13273 set fseeko d_fseeko
13274 eval $inlibc
13275 case "$longsize" in
13276 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13277 esac
13278
13279 : see if fsetpos exists
13280 set fsetpos d_fsetpos
13281 eval $inlibc
13282
13283 : see if fstatfs exists
13284 set fstatfs d_fstatfs
13285 eval $inlibc
13286
13287 : see if statvfs exists
13288 set statvfs d_statvfs
13289 eval $inlibc
13290
13291 : see if fstatvfs exists
13292 set fstatvfs d_fstatvfs
13293 eval $inlibc
13294
13295
13296 : see if fsync exists
13297 set fsync d_fsync
13298 eval $inlibc
13299
13300 : see if ftello exists
13301 set ftello d_ftello
13302 eval $inlibc
13303 case "$longsize" in
13304 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13305 esac
13306
13307 : check for a working futimes
13308 d_futimes="$undef"
13309 echo " "
13310 echo "Checking if you have a working futimes()" >&4
13311 $cat >try.c <<EOCP
13312 #include <stdio.h>
13313 #include <sys/time.h>
13314 #include <errno.h>
13315 #include <fcntl.h>
13316
13317 int main ()
13318 {
13319     int fd, rv;
13320     fd = open ("try.c", O_RDWR);
13321     if (-1 == fd) exit (1);
13322     rv = futimes (fd, NULL);
13323     exit (rv == -1 ? errno : 0);
13324 }
13325 EOCP
13326 set try
13327 if eval $compile; then
13328     `$run ./try`
13329     rc=$?
13330     case "$rc" in
13331         0)  echo "Yes, you have" >&4
13332             d_futimes="$define"
13333             ;;
13334         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13335             ;;
13336     esac
13337 else
13338     echo "No, it does not (probably harmless)" >&4
13339 fi
13340 $rm_try
13341
13342 : see if ndbm.h is available
13343 set ndbm.h i_ndbm
13344 eval $inhdr
13345 : Compatibility location for RedHat 7.1
13346 set gdbm/ndbm.h i_gdbmndbm
13347 eval $inhdr
13348 : Compatibility location for Debian 4.0
13349 set gdbm-ndbm.h i_gdbm_ndbm
13350 eval $inhdr
13351
13352 val="$undef"
13353 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13354         : see if dbm_open exists
13355         set dbm_open d_dbm_open
13356         eval $inlibc
13357         case "$d_dbm_open" in
13358         $undef)
13359                 i_ndbm="$undef"
13360                 i_gdbmndbm="$undef"
13361                 i_gdbm_ndbm="$undef"
13362                 echo "We won't be including <ndbm.h>"
13363                 val="$undef"
13364                 ;;
13365         *) val="$define"
13366            ;;
13367         esac
13368 fi
13369 set d_ndbm
13370 eval $setvar
13371
13372 ndbm_hdr_protochk='name=$1; hdr=$2;
13373 eval "ihdr=\$""i_$name";
13374 val="$undef";
13375 if $test "$ihdr" = "$define"; then
13376         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13377         case "$d_cplusplus" in
13378         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13379         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13380         esac;
13381         case "$val" in
13382         $define) $echo "Your <$hdr> seems to have prototypes";;
13383         *) $echo "Your <$hdr> does not seem to have prototypes";;
13384         esac;
13385 fi;
13386 set "d_${name}_h_uses_prototypes";
13387 eval $setvar'
13388
13389 set ndbm ndbm.h
13390 eval $ndbm_hdr_protochk
13391 set gdbmndbm gdbm/ndbm.h
13392 eval $ndbm_hdr_protochk
13393 set gdbm_ndbm gdbm-ndbm.h
13394 eval $ndbm_hdr_protochk
13395
13396 : see if getaddrinfo exists
13397 set getaddrinfo d_getaddrinfo
13398 eval $inlibc
13399
13400 : see if getcwd exists
13401 set getcwd d_getcwd
13402 eval $inlibc
13403
13404 : see if getespwnam exists
13405 set getespwnam d_getespwnam
13406 eval $inlibc
13407
13408 : see if getfsstat exists
13409 set getfsstat d_getfsstat
13410 eval $inlibc
13411
13412 : see if getgrent exists
13413 set getgrent d_getgrent
13414 eval $inlibc
13415
13416 : see if getgrent_r exists
13417 set getgrent_r d_getgrent_r
13418 eval $inlibc
13419 case "$d_getgrent_r" in
13420 "$define")
13421         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13422         case "$d_getgrent_r_proto:$usethreads" in
13423         ":define")      d_getgrent_r_proto=define
13424                 set d_getgrent_r_proto getgrent_r $hdrs
13425                 eval $hasproto ;;
13426         *)      ;;
13427         esac
13428         case "$d_getgrent_r_proto" in
13429         define)
13430         case "$getgrent_r_proto" in
13431         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13432         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13433         esac
13434         case "$getgrent_r_proto" in
13435         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13436         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13437         esac
13438         case "$getgrent_r_proto" in
13439         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13440         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13441         esac
13442         case "$getgrent_r_proto" in
13443         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13444         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13445         esac
13446         case "$getgrent_r_proto" in
13447         ''|0) try='int getgrent_r(struct group*, char*, int);'
13448         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13449         esac
13450         case "$getgrent_r_proto" in
13451         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13452         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13453         esac
13454         case "$getgrent_r_proto" in
13455         ''|0)   d_getgrent_r=undef
13456                 getgrent_r_proto=0
13457                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13458         * )     case "$getgrent_r_proto" in
13459                 REENTRANT_PROTO*) ;;
13460                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13461                 esac
13462                 echo "Prototype: $try" ;;
13463         esac
13464         ;;
13465         *)      case "$usethreads" in
13466                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13467                 esac
13468                 d_getgrent_r=undef
13469                 getgrent_r_proto=0
13470                 ;;
13471         esac
13472         ;;
13473 *)      getgrent_r_proto=0
13474         ;;
13475 esac
13476
13477 : see if getgrgid_r exists
13478 set getgrgid_r d_getgrgid_r
13479 eval $inlibc
13480 case "$d_getgrgid_r" in
13481 "$define")
13482         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13483         case "$d_getgrgid_r_proto:$usethreads" in
13484         ":define")      d_getgrgid_r_proto=define
13485                 set d_getgrgid_r_proto getgrgid_r $hdrs
13486                 eval $hasproto ;;
13487         *)      ;;
13488         esac
13489         case "$d_getgrgid_r_proto" in
13490         define)
13491         case "$getgrgid_r_proto" in
13492         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13493         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13494         esac
13495         case "$getgrgid_r_proto" in
13496         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13497         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13498         esac
13499         case "$getgrgid_r_proto" in
13500         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13501         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13502         esac
13503         case "$getgrgid_r_proto" in
13504         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13505         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13506         esac
13507         case "$getgrgid_r_proto" in
13508         ''|0)   d_getgrgid_r=undef
13509                 getgrgid_r_proto=0
13510                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getgrgid_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getgrgid_r=undef
13522                 getgrgid_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getgrgid_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if getgrnam_r exists
13531 set getgrnam_r d_getgrnam_r
13532 eval $inlibc
13533 case "$d_getgrnam_r" in
13534 "$define")
13535         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13536         case "$d_getgrnam_r_proto:$usethreads" in
13537         ":define")      d_getgrnam_r_proto=define
13538                 set d_getgrnam_r_proto getgrnam_r $hdrs
13539                 eval $hasproto ;;
13540         *)      ;;
13541         esac
13542         case "$d_getgrnam_r_proto" in
13543         define)
13544         case "$getgrnam_r_proto" in
13545         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13546         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13547         esac
13548         case "$getgrnam_r_proto" in
13549         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13550         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13551         esac
13552         case "$getgrnam_r_proto" in
13553         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13554         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13555         esac
13556         case "$getgrnam_r_proto" in
13557         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13558         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13559         esac
13560         case "$getgrnam_r_proto" in
13561         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13562         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13563         esac
13564         case "$getgrnam_r_proto" in
13565         ''|0)   d_getgrnam_r=undef
13566                 getgrnam_r_proto=0
13567                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13568         * )     case "$getgrnam_r_proto" in
13569                 REENTRANT_PROTO*) ;;
13570                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13571                 esac
13572                 echo "Prototype: $try" ;;
13573         esac
13574         ;;
13575         *)      case "$usethreads" in
13576                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13577                 esac
13578                 d_getgrnam_r=undef
13579                 getgrnam_r_proto=0
13580                 ;;
13581         esac
13582         ;;
13583 *)      getgrnam_r_proto=0
13584         ;;
13585 esac
13586
13587 : see if gethostbyaddr exists
13588 set gethostbyaddr d_gethbyaddr
13589 eval $inlibc
13590
13591 : see if gethostbyname exists
13592 set gethostbyname d_gethbyname
13593 eval $inlibc
13594
13595 : see if gethostent exists
13596 set gethostent d_gethent
13597 eval $inlibc
13598
13599 : see how we will look up host name
13600 echo " "
13601 call=''
13602 if set gethostname val -f d_gethname; eval $csym; $val; then
13603         echo 'gethostname() found.' >&4
13604         d_gethname="$define"
13605         call=gethostname
13606 fi
13607 if set uname val -f d_uname; eval $csym; $val; then
13608         if ./xenix; then
13609                 $cat <<'EOM'
13610 uname() was found, but you're running xenix, and older versions of xenix
13611 have a broken uname(). If you don't really know whether your xenix is old
13612 enough to have a broken system call, use the default answer.
13613
13614 EOM
13615                 dflt=y
13616                 case "$d_uname" in
13617                 "$define") dflt=n;;
13618                 esac
13619                 rp='Is your uname() broken?'
13620                 . ./myread
13621                 case "$ans" in
13622                 n*) d_uname="$define"; call=uname;;
13623                 esac
13624         else
13625                 echo 'uname() found.' >&4
13626                 d_uname="$define"
13627                 case "$call" in
13628                 '') call=uname ;;
13629                 esac
13630         fi
13631 fi
13632 case "$d_gethname" in
13633 '') d_gethname="$undef";;
13634 esac
13635 case "$d_uname" in
13636 '') d_uname="$undef";;
13637 esac
13638 case "$d_uname$d_gethname" in
13639 *define*)
13640         dflt=n
13641         cat <<EOM
13642
13643 Every now and then someone has a $call() that lies about the hostname
13644 but can't be fixed for political or economic reasons.  If you wish, I can
13645 pretend $call() isn't there and maybe compute hostname at run-time
13646 thanks to the '$phostname' command.
13647
13648 EOM
13649         rp="Shall I ignore $call() from now on?"
13650         . ./myread
13651         case "$ans" in
13652         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13653         esac;;
13654 esac
13655 case "$phostname" in
13656 '') aphostname='';;
13657 *) case "$aphostname" in
13658         /*) ;;
13659         *) set X $phostname
13660                 shift
13661                 file=$1
13662                 shift
13663                 file=`./loc $file $file $pth`
13664                 aphostname=`echo $file $*`
13665                 ;;
13666         esac
13667         ;;
13668 esac
13669 case "$d_uname$d_gethname" in
13670 *define*) ;;
13671 *)
13672         case "$phostname" in
13673         '')
13674                 echo "There will be no way for $package to get your hostname." >&4;;
13675         *)
13676         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13677                 ;;
13678         esac;;
13679 esac
13680 case "$d_phostname" in
13681 '') d_phostname="$undef";;
13682 esac
13683
13684 : see if gethostbyaddr_r exists
13685 set gethostbyaddr_r d_gethostbyaddr_r
13686 eval $inlibc
13687 case "$d_gethostbyaddr_r" in
13688 "$define")
13689         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13690         case "$d_gethostbyaddr_r_proto:$usethreads" in
13691         ":define")      d_gethostbyaddr_r_proto=define
13692                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13693                 eval $hasproto ;;
13694         *)      ;;
13695         esac
13696         case "$d_gethostbyaddr_r_proto" in
13697         define)
13698         case "$gethostbyaddr_r_proto" in
13699         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13700         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13701         esac
13702         case "$gethostbyaddr_r_proto" in
13703         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13704         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13705         esac
13706         case "$gethostbyaddr_r_proto" in
13707         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13708         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13709         esac
13710         case "$gethostbyaddr_r_proto" in
13711         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13712         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13713         esac
13714         case "$gethostbyaddr_r_proto" in
13715         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13717         esac
13718         case "$gethostbyaddr_r_proto" in
13719         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13721         esac
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13725         esac
13726         case "$gethostbyaddr_r_proto" in
13727         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13729         esac
13730         case "$gethostbyaddr_r_proto" in
13731         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13733         esac
13734         case "$gethostbyaddr_r_proto" in
13735         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13737         esac
13738         case "$gethostbyaddr_r_proto" in
13739         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13740         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13741         esac
13742         case "$gethostbyaddr_r_proto" in
13743         ''|0)   d_gethostbyaddr_r=undef
13744                 gethostbyaddr_r_proto=0
13745                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13746         * )     case "$gethostbyaddr_r_proto" in
13747                 REENTRANT_PROTO*) ;;
13748                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13749                 esac
13750                 echo "Prototype: $try" ;;
13751         esac
13752         ;;
13753         *)      case "$usethreads" in
13754                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13755                 esac
13756                 d_gethostbyaddr_r=undef
13757                 gethostbyaddr_r_proto=0
13758                 ;;
13759         esac
13760         ;;
13761 *)      gethostbyaddr_r_proto=0
13762         ;;
13763 esac
13764
13765 : see if gethostbyname_r exists
13766 set gethostbyname_r d_gethostbyname_r
13767 eval $inlibc
13768 case "$d_gethostbyname_r" in
13769 "$define")
13770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13771         case "$d_gethostbyname_r_proto:$usethreads" in
13772         ":define")      d_gethostbyname_r_proto=define
13773                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13774                 eval $hasproto ;;
13775         *)      ;;
13776         esac
13777         case "$d_gethostbyname_r_proto" in
13778         define)
13779         case "$gethostbyname_r_proto" in
13780         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13782         esac
13783         case "$gethostbyname_r_proto" in
13784         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13785         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13786         esac
13787         case "$gethostbyname_r_proto" in
13788         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13789         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13790         esac
13791         case "$gethostbyname_r_proto" in
13792         ''|0)   d_gethostbyname_r=undef
13793                 gethostbyname_r_proto=0
13794                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13795         * )     case "$gethostbyname_r_proto" in
13796                 REENTRANT_PROTO*) ;;
13797                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13798                 esac
13799                 echo "Prototype: $try" ;;
13800         esac
13801         ;;
13802         *)      case "$usethreads" in
13803                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13804                 esac
13805                 d_gethostbyname_r=undef
13806                 gethostbyname_r_proto=0
13807                 ;;
13808         esac
13809         ;;
13810 *)      gethostbyname_r_proto=0
13811         ;;
13812 esac
13813
13814 : see if gethostent_r exists
13815 set gethostent_r d_gethostent_r
13816 eval $inlibc
13817 case "$d_gethostent_r" in
13818 "$define")
13819         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13820         case "$d_gethostent_r_proto:$usethreads" in
13821         ":define")      d_gethostent_r_proto=define
13822                 set d_gethostent_r_proto gethostent_r $hdrs
13823                 eval $hasproto ;;
13824         *)      ;;
13825         esac
13826         case "$d_gethostent_r_proto" in
13827         define)
13828         case "$gethostent_r_proto" in
13829         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13831         esac
13832         case "$gethostent_r_proto" in
13833         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13835         esac
13836         case "$gethostent_r_proto" in
13837         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13838         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13839         esac
13840         case "$gethostent_r_proto" in
13841         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13842         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13843         esac
13844         case "$gethostent_r_proto" in
13845         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13846         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13847         esac
13848         case "$gethostent_r_proto" in
13849         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13851         esac
13852         case "$gethostent_r_proto" in
13853         ''|0)   d_gethostent_r=undef
13854                 gethostent_r_proto=0
13855                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13856         * )     case "$gethostent_r_proto" in
13857                 REENTRANT_PROTO*) ;;
13858                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13859                 esac
13860                 echo "Prototype: $try" ;;
13861         esac
13862         ;;
13863         *)      case "$usethreads" in
13864                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13865                 esac
13866                 d_gethostent_r=undef
13867                 gethostent_r_proto=0
13868                 ;;
13869         esac
13870         ;;
13871 *)      gethostent_r_proto=0
13872         ;;
13873 esac
13874
13875 : see if prototypes for various gethostxxx netdb.h functions are available
13876 echo " "
13877 set d_gethostprotos gethostent $i_netdb netdb.h
13878 eval $hasproto
13879
13880 : see if getitimer exists
13881 set getitimer d_getitimer
13882 eval $inlibc
13883
13884 : see if getlogin exists
13885 set getlogin d_getlogin
13886 eval $inlibc
13887
13888 : see if getlogin_r exists
13889 set getlogin_r d_getlogin_r
13890 eval $inlibc
13891 case "$d_getlogin_r" in
13892 "$define")
13893         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13894         case "$d_getlogin_r_proto:$usethreads" in
13895         ":define")      d_getlogin_r_proto=define
13896                 set d_getlogin_r_proto getlogin_r $hdrs
13897                 eval $hasproto ;;
13898         *)      ;;
13899         esac
13900         case "$d_getlogin_r_proto" in
13901         define)
13902         case "$getlogin_r_proto" in
13903         ''|0) try='int getlogin_r(char*, size_t);'
13904         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13905         esac
13906         case "$getlogin_r_proto" in
13907         ''|0) try='int getlogin_r(char*, int);'
13908         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13909         esac
13910         case "$getlogin_r_proto" in
13911         ''|0) try='char* getlogin_r(char*, size_t);'
13912         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13913         esac
13914         case "$getlogin_r_proto" in
13915         ''|0) try='char* getlogin_r(char*, int);'
13916         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13917         esac
13918         case "$getlogin_r_proto" in
13919         ''|0)   d_getlogin_r=undef
13920                 getlogin_r_proto=0
13921                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13922         * )     case "$getlogin_r_proto" in
13923                 REENTRANT_PROTO*) ;;
13924                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13925                 esac
13926                 echo "Prototype: $try" ;;
13927         esac
13928         ;;
13929         *)      case "$usethreads" in
13930                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13931                 esac
13932                 d_getlogin_r=undef
13933                 getlogin_r_proto=0
13934                 ;;
13935         esac
13936         ;;
13937 *)      getlogin_r_proto=0
13938         ;;
13939 esac
13940
13941 : see if getmnt exists
13942 set getmnt d_getmnt
13943 eval $inlibc
13944
13945 : see if getmntent exists
13946 set getmntent d_getmntent
13947 eval $inlibc
13948
13949 : see if getnameinfo exists
13950 set getnameinfo d_getnameinfo
13951 eval $inlibc
13952
13953 : see if getnetbyaddr exists
13954 set getnetbyaddr d_getnbyaddr
13955 eval $inlibc
13956
13957 : see if getnetbyname exists
13958 set getnetbyname d_getnbyname
13959 eval $inlibc
13960
13961 : see if getnetent exists
13962 set getnetent d_getnent
13963 eval $inlibc
13964
13965 : see if getnetbyaddr_r exists
13966 set getnetbyaddr_r d_getnetbyaddr_r
13967 eval $inlibc
13968 case "$d_getnetbyaddr_r" in
13969 "$define")
13970         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13971         case "$d_getnetbyaddr_r_proto:$usethreads" in
13972         ":define")      d_getnetbyaddr_r_proto=define
13973                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13974                 eval $hasproto ;;
13975         *)      ;;
13976         esac
13977         case "$d_getnetbyaddr_r_proto" in
13978         define)
13979         case "$getnetbyaddr_r_proto" in
13980         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13981         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13982         esac
13983         case "$getnetbyaddr_r_proto" in
13984         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13985         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13986         esac
13987         case "$getnetbyaddr_r_proto" in
13988         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13989         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13990         esac
13991         case "$getnetbyaddr_r_proto" in
13992         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13993         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13994         esac
13995         case "$getnetbyaddr_r_proto" in
13996         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13998         esac
13999         case "$getnetbyaddr_r_proto" in
14000         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14002         esac
14003         case "$getnetbyaddr_r_proto" in
14004         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14006         esac
14007         case "$getnetbyaddr_r_proto" in
14008         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14009         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14010         esac
14011         case "$getnetbyaddr_r_proto" in
14012         ''|0)   d_getnetbyaddr_r=undef
14013                 getnetbyaddr_r_proto=0
14014                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14015         * )     case "$getnetbyaddr_r_proto" in
14016                 REENTRANT_PROTO*) ;;
14017                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14018                 esac
14019                 echo "Prototype: $try" ;;
14020         esac
14021         ;;
14022         *)      case "$usethreads" in
14023                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14024                 esac
14025                 d_getnetbyaddr_r=undef
14026                 getnetbyaddr_r_proto=0
14027                 ;;
14028         esac
14029         ;;
14030 *)      getnetbyaddr_r_proto=0
14031         ;;
14032 esac
14033
14034 : see if getnetbyname_r exists
14035 set getnetbyname_r d_getnetbyname_r
14036 eval $inlibc
14037 case "$d_getnetbyname_r" in
14038 "$define")
14039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14040         case "$d_getnetbyname_r_proto:$usethreads" in
14041         ":define")      d_getnetbyname_r_proto=define
14042                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14043                 eval $hasproto ;;
14044         *)      ;;
14045         esac
14046         case "$d_getnetbyname_r_proto" in
14047         define)
14048         case "$getnetbyname_r_proto" in
14049         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14050         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14051         esac
14052         case "$getnetbyname_r_proto" in
14053         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14054         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14055         esac
14056         case "$getnetbyname_r_proto" in
14057         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14058         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14059         esac
14060         case "$getnetbyname_r_proto" in
14061         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14062         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14063         esac
14064         case "$getnetbyname_r_proto" in
14065         ''|0)   d_getnetbyname_r=undef
14066                 getnetbyname_r_proto=0
14067                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14068         * )     case "$getnetbyname_r_proto" in
14069                 REENTRANT_PROTO*) ;;
14070                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14071                 esac
14072                 echo "Prototype: $try" ;;
14073         esac
14074         ;;
14075         *)      case "$usethreads" in
14076                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14077                 esac
14078                 d_getnetbyname_r=undef
14079                 getnetbyname_r_proto=0
14080                 ;;
14081         esac
14082         ;;
14083 *)      getnetbyname_r_proto=0
14084         ;;
14085 esac
14086
14087 : see if getnetent_r exists
14088 set getnetent_r d_getnetent_r
14089 eval $inlibc
14090 case "$d_getnetent_r" in
14091 "$define")
14092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14093         case "$d_getnetent_r_proto:$usethreads" in
14094         ":define")      d_getnetent_r_proto=define
14095                 set d_getnetent_r_proto getnetent_r $hdrs
14096                 eval $hasproto ;;
14097         *)      ;;
14098         esac
14099         case "$d_getnetent_r_proto" in
14100         define)
14101         case "$getnetent_r_proto" in
14102         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14103         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14104         esac
14105         case "$getnetent_r_proto" in
14106         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14107         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14108         esac
14109         case "$getnetent_r_proto" in
14110         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14111         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14112         esac
14113         case "$getnetent_r_proto" in
14114         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14115         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14116         esac
14117         case "$getnetent_r_proto" in
14118         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14119         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14120         esac
14121         case "$getnetent_r_proto" in
14122         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14123         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14124         esac
14125         case "$getnetent_r_proto" in
14126         ''|0)   d_getnetent_r=undef
14127                 getnetent_r_proto=0
14128                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14129         * )     case "$getnetent_r_proto" in
14130                 REENTRANT_PROTO*) ;;
14131                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14132                 esac
14133                 echo "Prototype: $try" ;;
14134         esac
14135         ;;
14136         *)      case "$usethreads" in
14137                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14138                 esac
14139                 d_getnetent_r=undef
14140                 getnetent_r_proto=0
14141                 ;;
14142         esac
14143         ;;
14144 *)      getnetent_r_proto=0
14145         ;;
14146 esac
14147
14148 : see if prototypes for various getnetxxx netdb.h functions are available
14149 echo " "
14150 set d_getnetprotos getnetent $i_netdb netdb.h
14151 eval $hasproto
14152
14153 : see if getpagesize exists
14154 set getpagesize d_getpagsz
14155 eval $inlibc
14156
14157 : Optional checks for getprotobyname and getprotobynumber
14158
14159 : see if getprotobyname exists
14160 set getprotobyname d_getpbyname
14161 eval $inlibc
14162
14163 : see if getprotobynumber exists
14164 set getprotobynumber d_getpbynumber
14165 eval $inlibc
14166
14167 : see if getprotoent exists
14168 set getprotoent d_getpent
14169 eval $inlibc
14170
14171 : see if getpgid exists
14172 set getpgid d_getpgid
14173 eval $inlibc
14174
14175 : see if getpgrp2 exists
14176 set getpgrp2 d_getpgrp2
14177 eval $inlibc
14178
14179 : see if getppid exists
14180 set getppid d_getppid
14181 eval $inlibc
14182
14183 : see if getpriority exists
14184 set getpriority d_getprior
14185 eval $inlibc
14186
14187 : see if getprotobyname_r exists
14188 set getprotobyname_r d_getprotobyname_r
14189 eval $inlibc
14190 case "$d_getprotobyname_r" in
14191 "$define")
14192         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14193         case "$d_getprotobyname_r_proto:$usethreads" in
14194         ":define")      d_getprotobyname_r_proto=define
14195                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14196                 eval $hasproto ;;
14197         *)      ;;
14198         esac
14199         case "$d_getprotobyname_r_proto" in
14200         define)
14201         case "$getprotobyname_r_proto" in
14202         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14203         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14204         esac
14205         case "$getprotobyname_r_proto" in
14206         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14207         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14208         esac
14209         case "$getprotobyname_r_proto" in
14210         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14211         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14212         esac
14213         case "$getprotobyname_r_proto" in
14214         ''|0)   d_getprotobyname_r=undef
14215                 getprotobyname_r_proto=0
14216                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14217         * )     case "$getprotobyname_r_proto" in
14218                 REENTRANT_PROTO*) ;;
14219                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14220                 esac
14221                 echo "Prototype: $try" ;;
14222         esac
14223         ;;
14224         *)      case "$usethreads" in
14225                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14226                 esac
14227                 d_getprotobyname_r=undef
14228                 getprotobyname_r_proto=0
14229                 ;;
14230         esac
14231         ;;
14232 *)      getprotobyname_r_proto=0
14233         ;;
14234 esac
14235
14236 : see if getprotobynumber_r exists
14237 set getprotobynumber_r d_getprotobynumber_r
14238 eval $inlibc
14239 case "$d_getprotobynumber_r" in
14240 "$define")
14241         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14242         case "$d_getprotobynumber_r_proto:$usethreads" in
14243         ":define")      d_getprotobynumber_r_proto=define
14244                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14245                 eval $hasproto ;;
14246         *)      ;;
14247         esac
14248         case "$d_getprotobynumber_r_proto" in
14249         define)
14250         case "$getprotobynumber_r_proto" in
14251         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14252         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14253         esac
14254         case "$getprotobynumber_r_proto" in
14255         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14256         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14257         esac
14258         case "$getprotobynumber_r_proto" in
14259         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14260         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14261         esac
14262         case "$getprotobynumber_r_proto" in
14263         ''|0)   d_getprotobynumber_r=undef
14264                 getprotobynumber_r_proto=0
14265                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14266         * )     case "$getprotobynumber_r_proto" in
14267                 REENTRANT_PROTO*) ;;
14268                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14269                 esac
14270                 echo "Prototype: $try" ;;
14271         esac
14272         ;;
14273         *)      case "$usethreads" in
14274                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14275                 esac
14276                 d_getprotobynumber_r=undef
14277                 getprotobynumber_r_proto=0
14278                 ;;
14279         esac
14280         ;;
14281 *)      getprotobynumber_r_proto=0
14282         ;;
14283 esac
14284
14285 : see if getprotoent_r exists
14286 set getprotoent_r d_getprotoent_r
14287 eval $inlibc
14288 case "$d_getprotoent_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14291         case "$d_getprotoent_r_proto:$usethreads" in
14292         ":define")      d_getprotoent_r_proto=define
14293                 set d_getprotoent_r_proto getprotoent_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_getprotoent_r_proto" in
14298         define)
14299         case "$getprotoent_r_proto" in
14300         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14301         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14302         esac
14303         case "$getprotoent_r_proto" in
14304         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14305         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14306         esac
14307         case "$getprotoent_r_proto" in
14308         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14310         esac
14311         case "$getprotoent_r_proto" in
14312         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14313         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14314         esac
14315         case "$getprotoent_r_proto" in
14316         ''|0)   d_getprotoent_r=undef
14317                 getprotoent_r_proto=0
14318                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14319         * )     case "$getprotoent_r_proto" in
14320                 REENTRANT_PROTO*) ;;
14321                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14322                 esac
14323                 echo "Prototype: $try" ;;
14324         esac
14325         ;;
14326         *)      case "$usethreads" in
14327                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14328                 esac
14329                 d_getprotoent_r=undef
14330                 getprotoent_r_proto=0
14331                 ;;
14332         esac
14333         ;;
14334 *)      getprotoent_r_proto=0
14335         ;;
14336 esac
14337
14338 : see if prototypes for various getprotoxxx netdb.h functions are available
14339 echo " "
14340 set d_getprotoprotos getprotoent $i_netdb netdb.h
14341 eval $hasproto
14342
14343 : see if getprpwnam exists
14344 set getprpwnam d_getprpwnam
14345 eval $inlibc
14346
14347 : see if getpwent exists
14348 set getpwent d_getpwent
14349 eval $inlibc
14350
14351 : see if getpwent_r exists
14352 set getpwent_r d_getpwent_r
14353 eval $inlibc
14354 case "$d_getpwent_r" in
14355 "$define")
14356         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14357         case "$d_getpwent_r_proto:$usethreads" in
14358         ":define")      d_getpwent_r_proto=define
14359                 set d_getpwent_r_proto getpwent_r $hdrs
14360                 eval $hasproto ;;
14361         *)      ;;
14362         esac
14363         case "$d_getpwent_r_proto" in
14364         define)
14365         case "$getpwent_r_proto" in
14366         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14367         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14368         esac
14369         case "$getpwent_r_proto" in
14370         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14371         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14372         esac
14373         case "$getpwent_r_proto" in
14374         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14375         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14376         esac
14377         case "$getpwent_r_proto" in
14378         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14380         esac
14381         case "$getpwent_r_proto" in
14382         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14383         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14384         esac
14385         case "$getpwent_r_proto" in
14386         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14387         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14388         esac
14389         case "$getpwent_r_proto" in
14390         ''|0)   d_getpwent_r=undef
14391                 getpwent_r_proto=0
14392                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14393         * )     case "$getpwent_r_proto" in
14394                 REENTRANT_PROTO*) ;;
14395                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14396                 esac
14397                 echo "Prototype: $try" ;;
14398         esac
14399         ;;
14400         *)      case "$usethreads" in
14401                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14402                 esac
14403                 d_getpwent_r=undef
14404                 getpwent_r_proto=0
14405                 ;;
14406         esac
14407         ;;
14408 *)      getpwent_r_proto=0
14409         ;;
14410 esac
14411
14412 : see if getpwnam_r exists
14413 set getpwnam_r d_getpwnam_r
14414 eval $inlibc
14415 case "$d_getpwnam_r" in
14416 "$define")
14417         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14418         case "$d_getpwnam_r_proto:$usethreads" in
14419         ":define")      d_getpwnam_r_proto=define
14420                 set d_getpwnam_r_proto getpwnam_r $hdrs
14421                 eval $hasproto ;;
14422         *)      ;;
14423         esac
14424         case "$d_getpwnam_r_proto" in
14425         define)
14426         case "$getpwnam_r_proto" in
14427         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14428         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14429         esac
14430         case "$getpwnam_r_proto" in
14431         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14432         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14433         esac
14434         case "$getpwnam_r_proto" in
14435         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14436         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14437         esac
14438         case "$getpwnam_r_proto" in
14439         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14440         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14441         esac
14442         case "$getpwnam_r_proto" in
14443         ''|0)   d_getpwnam_r=undef
14444                 getpwnam_r_proto=0
14445                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14446         * )     case "$getpwnam_r_proto" in
14447                 REENTRANT_PROTO*) ;;
14448                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14449                 esac
14450                 echo "Prototype: $try" ;;
14451         esac
14452         ;;
14453         *)      case "$usethreads" in
14454                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14455                 esac
14456                 d_getpwnam_r=undef
14457                 getpwnam_r_proto=0
14458                 ;;
14459         esac
14460         ;;
14461 *)      getpwnam_r_proto=0
14462         ;;
14463 esac
14464
14465 : see if getpwuid_r exists
14466 set getpwuid_r d_getpwuid_r
14467 eval $inlibc
14468 case "$d_getpwuid_r" in
14469 "$define")
14470         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14471         case "$d_getpwuid_r_proto:$usethreads" in
14472         ":define")      d_getpwuid_r_proto=define
14473                 set d_getpwuid_r_proto getpwuid_r $hdrs
14474                 eval $hasproto ;;
14475         *)      ;;
14476         esac
14477         case "$d_getpwuid_r_proto" in
14478         define)
14479         case "$getpwuid_r_proto" in
14480         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14481         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14482         esac
14483         case "$getpwuid_r_proto" in
14484         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14485         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14486         esac
14487         case "$getpwuid_r_proto" in
14488         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14489         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14490         esac
14491         case "$getpwuid_r_proto" in
14492         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14493         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14494         esac
14495         case "$getpwuid_r_proto" in
14496         ''|0)   d_getpwuid_r=undef
14497                 getpwuid_r_proto=0
14498                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14499         * )     case "$getpwuid_r_proto" in
14500                 REENTRANT_PROTO*) ;;
14501                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14502                 esac
14503                 echo "Prototype: $try" ;;
14504         esac
14505         ;;
14506         *)      case "$usethreads" in
14507                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14508                 esac
14509                 d_getpwuid_r=undef
14510                 getpwuid_r_proto=0
14511                 ;;
14512         esac
14513         ;;
14514 *)      getpwuid_r_proto=0
14515         ;;
14516 esac
14517
14518 : Optional checks for getsbyname and getsbyport
14519
14520 : see if getservbyname exists
14521 set getservbyname d_getsbyname
14522 eval $inlibc
14523
14524 : see if getservbyport exists
14525 set getservbyport d_getsbyport
14526 eval $inlibc
14527
14528 : see if getservent exists
14529 set getservent d_getsent
14530 eval $inlibc
14531
14532 : see if getservbyname_r exists
14533 set getservbyname_r d_getservbyname_r
14534 eval $inlibc
14535 case "$d_getservbyname_r" in
14536 "$define")
14537         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14538         case "$d_getservbyname_r_proto:$usethreads" in
14539         ":define")      d_getservbyname_r_proto=define
14540                 set d_getservbyname_r_proto getservbyname_r $hdrs
14541                 eval $hasproto ;;
14542         *)      ;;
14543         esac
14544         case "$d_getservbyname_r_proto" in
14545         define)
14546         case "$getservbyname_r_proto" in
14547         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14548         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14549         esac
14550         case "$getservbyname_r_proto" in
14551         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14552         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14553         esac
14554         case "$getservbyname_r_proto" in
14555         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14556         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14557         esac
14558         case "$getservbyname_r_proto" in
14559         ''|0)   d_getservbyname_r=undef
14560                 getservbyname_r_proto=0
14561                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14562         * )     case "$getservbyname_r_proto" in
14563                 REENTRANT_PROTO*) ;;
14564                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14565                 esac
14566                 echo "Prototype: $try" ;;
14567         esac
14568         ;;
14569         *)      case "$usethreads" in
14570                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14571                 esac
14572                 d_getservbyname_r=undef
14573                 getservbyname_r_proto=0
14574                 ;;
14575         esac
14576         ;;
14577 *)      getservbyname_r_proto=0
14578         ;;
14579 esac
14580
14581 : see if getservbyport_r exists
14582 set getservbyport_r d_getservbyport_r
14583 eval $inlibc
14584 case "$d_getservbyport_r" in
14585 "$define")
14586         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14587         case "$d_getservbyport_r_proto:$usethreads" in
14588         ":define")      d_getservbyport_r_proto=define
14589                 set d_getservbyport_r_proto getservbyport_r $hdrs
14590                 eval $hasproto ;;
14591         *)      ;;
14592         esac
14593         case "$d_getservbyport_r_proto" in
14594         define)
14595         case "$getservbyport_r_proto" in
14596         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14597         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14598         esac
14599         case "$getservbyport_r_proto" in
14600         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14601         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14602         esac
14603         case "$getservbyport_r_proto" in
14604         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14605         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14606         esac
14607         case "$getservbyport_r_proto" in
14608         ''|0)   d_getservbyport_r=undef
14609                 getservbyport_r_proto=0
14610                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14611         * )     case "$getservbyport_r_proto" in
14612                 REENTRANT_PROTO*) ;;
14613                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14614                 esac
14615                 echo "Prototype: $try" ;;
14616         esac
14617         ;;
14618         *)      case "$usethreads" in
14619                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14620                 esac
14621                 d_getservbyport_r=undef
14622                 getservbyport_r_proto=0
14623                 ;;
14624         esac
14625         ;;
14626 *)      getservbyport_r_proto=0
14627         ;;
14628 esac
14629
14630 : see if getservent_r exists
14631 set getservent_r d_getservent_r
14632 eval $inlibc
14633 case "$d_getservent_r" in
14634 "$define")
14635         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14636         case "$d_getservent_r_proto:$usethreads" in
14637         ":define")      d_getservent_r_proto=define
14638                 set d_getservent_r_proto getservent_r $hdrs
14639                 eval $hasproto ;;
14640         *)      ;;
14641         esac
14642         case "$d_getservent_r_proto" in
14643         define)
14644         case "$getservent_r_proto" in
14645         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14646         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14647         esac
14648         case "$getservent_r_proto" in
14649         ''|0) try='int getservent_r(struct servent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14651         esac
14652         case "$getservent_r_proto" in
14653         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14654         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14655         esac
14656         case "$getservent_r_proto" in
14657         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14658         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14659         esac
14660         case "$getservent_r_proto" in
14661         ''|0)   d_getservent_r=undef
14662                 getservent_r_proto=0
14663                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14664         * )     case "$getservent_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_getservent_r=undef
14675                 getservent_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      getservent_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if prototypes for various getservxxx netdb.h functions are available
14684 echo " "
14685 set d_getservprotos getservent $i_netdb netdb.h
14686 eval $hasproto
14687
14688 : see if getspnam exists
14689 set getspnam d_getspnam
14690 eval $inlibc
14691
14692 : see if this is a shadow.h system
14693 set shadow.h i_shadow
14694 eval $inhdr
14695
14696 : see if getspnam_r exists
14697 set getspnam_r d_getspnam_r
14698 eval $inlibc
14699 case "$d_getspnam_r" in
14700 "$define")
14701         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14702         case "$d_getspnam_r_proto:$usethreads" in
14703         ":define")      d_getspnam_r_proto=define
14704                 set d_getspnam_r_proto getspnam_r $hdrs
14705                 eval $hasproto ;;
14706         *)      ;;
14707         esac
14708         case "$d_getspnam_r_proto" in
14709         define)
14710         case "$getspnam_r_proto" in
14711         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14712         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14713         esac
14714         case "$getspnam_r_proto" in
14715         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14716         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14717         esac
14718         case "$getspnam_r_proto" in
14719         ''|0)   d_getspnam_r=undef
14720                 getspnam_r_proto=0
14721                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14722         * )     case "$getspnam_r_proto" in
14723                 REENTRANT_PROTO*) ;;
14724                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14725                 esac
14726                 echo "Prototype: $try" ;;
14727         esac
14728         ;;
14729         *)      case "$usethreads" in
14730                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14731                 esac
14732                 d_getspnam_r=undef
14733                 getspnam_r_proto=0
14734                 ;;
14735         esac
14736         ;;
14737 *)      getspnam_r_proto=0
14738         ;;
14739 esac
14740
14741 : see if gettimeofday or ftime exists
14742 set gettimeofday d_gettimeod
14743 eval $inlibc
14744 case "$d_gettimeod" in
14745 "$undef")
14746         set ftime d_ftime 
14747         eval $inlibc
14748         ;;
14749 *)
14750         val="$undef"; set d_ftime; eval $setvar
14751         ;;
14752 esac
14753 case "$d_gettimeod$d_ftime" in
14754 "$undef$undef")
14755         echo " "
14756         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14757         ;;
14758 esac
14759
14760 : see if gmtime_r exists
14761 set gmtime_r d_gmtime_r
14762 eval $inlibc
14763 case "$d_gmtime_r" in
14764 "$define")
14765         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14766         case "$d_gmtime_r_proto:$usethreads" in
14767         ":define")      d_gmtime_r_proto=define
14768                 set d_gmtime_r_proto gmtime_r $hdrs
14769                 eval $hasproto ;;
14770         *)      ;;
14771         esac
14772         case "$d_gmtime_r_proto" in
14773         define)
14774         case "$gmtime_r_proto" in
14775         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14776         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14777         esac
14778         case "$gmtime_r_proto" in
14779         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14780         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14781         esac
14782         case "$gmtime_r_proto" in
14783         ''|0)   d_gmtime_r=undef
14784                 gmtime_r_proto=0
14785                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14786         * )     case "$gmtime_r_proto" in
14787                 REENTRANT_PROTO*) ;;
14788                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14789                 esac
14790                 echo "Prototype: $try" ;;
14791         esac
14792         ;;
14793         *)      case "$usethreads" in
14794                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14795                 esac
14796                 d_gmtime_r=undef
14797                 gmtime_r_proto=0
14798                 ;;
14799         esac
14800         ;;
14801 *)      gmtime_r_proto=0
14802         ;;
14803 esac
14804
14805 : see if hasmntopt exists
14806 set hasmntopt d_hasmntopt
14807 eval $inlibc
14808
14809 : see if this is a netinet/in.h or sys/in.h system
14810 set netinet/in.h i_niin sys/in.h i_sysin
14811 eval $inhdr
14812
14813 : see if arpa/inet.h has to be included
14814 set arpa/inet.h i_arpainet
14815 eval $inhdr
14816
14817 : see if htonl --and friends-- exists
14818 val=''
14819 set htonl val
14820 eval $inlibc
14821
14822 : Maybe they are macros.
14823 case "$val" in
14824 $undef)
14825         $cat >htonl.c <<EOM
14826 #include <stdio.h>
14827 #include <sys/types.h>
14828 #$i_niin I_NETINET_IN
14829 #$i_sysin I_SYS_IN
14830 #$i_arpainet I_ARPA_INET
14831 #ifdef I_NETINET_IN
14832 #include <netinet/in.h>
14833 #endif
14834 #ifdef I_SYS_IN
14835 #include <sys/in.h>
14836 #endif
14837 #ifdef I_ARPA_INET
14838 #include <arpa/inet.h>
14839 #endif
14840 #ifdef htonl
14841 printf("Defined as a macro.");
14842 #endif
14843 EOM
14844         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14845         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14846                 val="$define"
14847                 echo "But it seems to be defined as a macro." >&4
14848         fi
14849         $rm -f htonl.?
14850         ;;
14851 esac
14852 set d_htonl
14853 eval $setvar
14854
14855 : see if ilogbl exists
14856 set ilogbl d_ilogbl
14857 eval $inlibc
14858
14859 : index or strchr
14860 echo " "
14861 if set index val -f; eval $csym; $val; then
14862         if set strchr val -f d_strchr; eval $csym; $val; then
14863                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14864                         val="$define"
14865                         vali="$undef"
14866                         echo "strchr() found." >&4
14867                 else
14868                         val="$undef"
14869                         vali="$define"
14870                         echo "index() found." >&4
14871                 fi
14872         else
14873                 val="$undef"
14874                 vali="$define"
14875                 echo "index() found." >&4
14876         fi
14877 else
14878         if set strchr val -f d_strchr; eval $csym; $val; then
14879                 val="$define"
14880                 vali="$undef"
14881                 echo "strchr() found." >&4
14882         else
14883                 echo "No index() or strchr() found!" >&4
14884                 val="$undef"
14885                 vali="$undef"
14886         fi
14887 fi
14888 set d_strchr; eval $setvar
14889 val="$vali"
14890 set d_index; eval $setvar
14891
14892 : check whether inet_aton exists
14893 set inet_aton d_inetaton
14894 eval $inlibc
14895
14896 : see if inet_ntop exists
14897 set inet_ntop d_inetntop
14898 eval $inlibc
14899
14900 : see if inet_pton exists
14901 set inet_pton d_inetpton
14902 eval $inlibc
14903
14904 : Look for isascii
14905 echo " "
14906 $cat >isascii.c <<EOCP
14907 #include <stdio.h>
14908 #include <ctype.h>
14909 #$i_stdlib I_STDLIB
14910 #ifdef I_STDLIB
14911 #include <stdlib.h>
14912 #endif
14913 int main() {
14914         int c = 'A';
14915         if (isascii(c))
14916                 exit(0);
14917         else
14918                 exit(1);
14919 }
14920 EOCP
14921 set isascii
14922 if eval $compile; then
14923         echo "isascii() found." >&4
14924         val="$define"
14925 else
14926         echo "isascii() NOT found." >&4
14927         val="$undef"
14928 fi
14929 set d_isascii
14930 eval $setvar
14931 $rm -f isascii*
14932
14933 : Look for isblank
14934 echo " "
14935 $cat >isblank.c <<'EOCP'
14936 #include <stdio.h>
14937 #include <ctype.h>
14938 int main() {
14939         int c = ' ';
14940         if (isblank(c))
14941                 exit(0);
14942         else
14943                 exit(1);
14944 }
14945 EOCP
14946 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
14947         echo "isblank() found." >&4
14948         val="$define"
14949 else
14950         echo "isblank() NOT found." >&4
14951         val="$undef"
14952 fi
14953 set d_isblank
14954 eval $setvar
14955 $rm -f isblank*
14956
14957 : see if isfinite exists
14958 set isfinite d_isfinite
14959 eval $inlibc
14960
14961 : see if isinf exists
14962 set isinf d_isinf
14963 eval $inlibc
14964
14965 : see if isnan exists
14966 set isnan d_isnan
14967 eval $inlibc
14968
14969 : see if isnanl exists
14970 set isnanl d_isnanl
14971 eval $inlibc
14972
14973 : see if killpg exists
14974 set killpg d_killpg
14975 eval $inlibc
14976
14977 : see if lchown exists
14978 echo " "
14979 $cat > try.c <<'EOCP'
14980 /* System header to define __stub macros and hopefully few prototypes,
14981     which can conflict with char lchown(); below.  */
14982 #include <assert.h>
14983 /* Override any gcc2 internal prototype to avoid an error.  */
14984 /* We use char because int might match the return type of a gcc2
14985    builtin and then its argument prototype would still apply.  */
14986 char lchown();
14987 int main() {
14988     /*  The GNU C library defines this for functions which it implements
14989         to always fail with ENOSYS.  Some functions are actually named
14990         something starting with __ and the normal name is an alias.  */
14991 #if defined (__stub_lchown) || defined (__stub___lchown)
14992 choke me
14993 #else
14994 lchown();
14995 #endif
14996 ; return 0; }
14997 EOCP
14998 set try
14999 if eval $compile; then
15000     $echo "lchown() found." >&4
15001     val="$define"
15002 else
15003     $echo "lchown() NOT found." >&4
15004     val="$undef"
15005 fi
15006 set d_lchown
15007 eval $setvar
15008
15009 : See if number of significant digits in a double precision number is known
15010 echo " "
15011 $cat >ldbl_dig.c <<EOM
15012 #$i_limits I_LIMITS
15013 #$i_float I_FLOAT
15014 #ifdef I_LIMITS
15015 #include <limits.h>
15016 #endif
15017 #ifdef I_FLOAT
15018 #include <float.h>
15019 #endif
15020 #ifdef LDBL_DIG
15021 printf("Contains LDBL_DIG");
15022 #endif
15023 EOM
15024 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15025 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15026         echo "LDBL_DIG found." >&4
15027         val="$define"
15028 else
15029         echo "LDBL_DIG NOT found." >&4
15030         val="$undef"
15031 fi
15032 $rm -f ldbl_dig.?
15033 set d_ldbl_dig
15034 eval $setvar
15035
15036 : see if this is a math.h system
15037 set math.h i_math
15038 eval $inhdr
15039
15040 : check to see if math.h defines _LIB_VERSION
15041 d_libm_lib_version="$undef"
15042 case $i_math in
15043     $define)
15044         echo " "
15045         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15046         $cat >try.c <<EOCP
15047 #include <unistd.h>
15048 #include <math.h>
15049 int main (int argc, char *argv[])
15050 {
15051     printf ("%d\n", _LIB_VERSION);
15052     return (0);
15053     } /* main */
15054 EOCP
15055         set try
15056         if eval $compile; then
15057             foo=`$run ./try`
15058             echo "Yes, it does ($foo)" >&4
15059             d_libm_lib_version="$define"
15060         else
15061             echo "No, it does not (probably harmless)" >&4
15062             fi
15063         $rm_try
15064         ;;
15065
15066     esac
15067
15068 : see if link exists
15069 set link d_link
15070 eval $inlibc
15071
15072 : see if localtime_r exists
15073 set localtime_r d_localtime_r
15074 eval $inlibc
15075 case "$d_localtime_r" in
15076 "$define")
15077         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15078         case "$d_localtime_r_proto:$usethreads" in
15079         ":define")      d_localtime_r_proto=define
15080                 set d_localtime_r_proto localtime_r $hdrs
15081                 eval $hasproto ;;
15082         *)      ;;
15083         esac
15084         case "$d_localtime_r_proto" in
15085         define)
15086         case "$localtime_r_proto" in
15087         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15088         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15089         esac
15090         case "$localtime_r_proto" in
15091         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15092         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15093         esac
15094         case "$localtime_r_proto" in
15095         ''|0)   d_localtime_r=undef
15096                 localtime_r_proto=0
15097                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15098         * )     case "$localtime_r_proto" in
15099                 REENTRANT_PROTO*) ;;
15100                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15101                 esac
15102                 echo "Prototype: $try" ;;
15103         esac
15104         ;;
15105         *)      case "$usethreads" in
15106                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15107                 esac
15108                 d_localtime_r=undef
15109                 localtime_r_proto=0
15110                 ;;
15111         esac
15112         ;;
15113 *)      localtime_r_proto=0
15114         ;;
15115 esac
15116
15117 : see if localtime_r calls tzset
15118 case "$localtime_r_proto" in
15119 REENTRANT_PROTO*)
15120         $cat >try.c <<EOCP
15121 /*  Does our libc's localtime_r call tzset ?
15122  *  return 0 if so, 1 otherwise.
15123  */
15124 #$i_systypes    I_SYS_TYPES
15125 #$i_unistd      I_UNISTD
15126 #$i_time        I_TIME
15127 #$i_stdlib      I_STDLIB
15128 #$i_string      I_STRING
15129 #$i_malloc      I_MALLOC
15130 #ifdef I_SYS_TYPES
15131 #  include <sys/types.h>
15132 #endif
15133 #ifdef I_UNISTD
15134 #  include <unistd.h>
15135 #endif
15136 #ifdef I_TIME
15137 #  include <time.h>
15138 #endif
15139 #ifdef I_STDLIB
15140 #include <stdlib.h>
15141 #endif
15142 #ifdef I_STRING
15143 #  include <string.h>
15144 #else
15145 #  include <strings.h>
15146 #endif
15147 #ifdef I_MALLOC
15148 #  include <malloc.h>
15149 #endif
15150 int main()
15151 {
15152     time_t t = time(0L);
15153     char w_tz[]="TZ" "=GMT+5",
15154          e_tz[]="TZ" "=GMT-5",
15155         *tz_e = (char*)malloc(16),
15156         *tz_w = (char*)malloc(16);
15157     struct tm tm_e, tm_w;
15158     memset(&tm_e,'\0',sizeof(struct tm));
15159     memset(&tm_w,'\0',sizeof(struct tm));
15160     strcpy(tz_e,e_tz);
15161     strcpy(tz_w,w_tz);
15162
15163     putenv(tz_e);
15164     localtime_r(&t, &tm_e);
15165
15166     putenv(tz_w);
15167     localtime_r(&t, &tm_w);
15168
15169     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15170         return 1;
15171     return 0;
15172 }
15173 EOCP
15174         set try
15175         if eval $compile; then
15176             if $run ./try; then
15177                 d_localtime_r_needs_tzset=undef;
15178             else
15179                 d_localtime_r_needs_tzset=define;
15180             fi;
15181         else
15182             d_localtime_r_needs_tzset=undef;
15183         fi;
15184      ;;
15185   *)
15186      d_localtime_r_needs_tzset=undef;
15187      ;;
15188 esac
15189 $rm_try
15190
15191 : see if localeconv exists
15192 set localeconv d_locconv
15193 eval $inlibc
15194
15195 : see if lockf exists
15196 set lockf d_lockf
15197 eval $inlibc
15198
15199 : see if prototype for lseek is available
15200 echo " "
15201 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15202 eval $hasproto
15203
15204 : see if lstat exists
15205 set lstat d_lstat
15206 eval $inlibc
15207
15208 : see if madvise exists
15209 set madvise d_madvise
15210 eval $inlibc
15211
15212 : see if malloc_size exists
15213 set malloc_size d_malloc_size
15214 eval $inlibc
15215
15216 : see if malloc_size_good exists
15217 set malloc_good_size d_malloc_good_size
15218 eval $inlibc
15219
15220 : see if mblen exists
15221 set mblen d_mblen
15222 eval $inlibc
15223
15224 : see if mbstowcs exists
15225 set mbstowcs d_mbstowcs
15226 eval $inlibc
15227
15228 : see if mbtowc exists
15229 set mbtowc d_mbtowc
15230 eval $inlibc
15231
15232 : see if memchr exists
15233 set memchr d_memchr
15234 eval $inlibc
15235
15236 : see if memcmp exists
15237 set memcmp d_memcmp
15238 eval $inlibc
15239
15240 : see if memcpy exists
15241 set memcpy d_memcpy
15242 eval $inlibc
15243
15244 : see if memmove exists
15245 set memmove d_memmove
15246 eval $inlibc
15247
15248 : see if memset exists
15249 set memset d_memset
15250 eval $inlibc
15251
15252 : see if mkdir exists
15253 set mkdir d_mkdir
15254 eval $inlibc
15255
15256 : see if mkdtemp exists
15257 set mkdtemp d_mkdtemp
15258 eval $inlibc
15259
15260 : see if mkfifo exists
15261 set mkfifo d_mkfifo
15262 eval $inlibc
15263
15264 : see if mkstemp exists
15265 set mkstemp d_mkstemp
15266 eval $inlibc
15267
15268 : see if mkstemps exists
15269 set mkstemps d_mkstemps
15270 eval $inlibc
15271
15272 : see if mktime exists
15273 set mktime d_mktime
15274 eval $inlibc
15275
15276 : see if this is a sys/mman.h system
15277 set sys/mman.h i_sysmman
15278 eval $inhdr
15279
15280 : see if mmap exists
15281 set mmap d_mmap
15282 eval $inlibc
15283 : see what shmat returns
15284 : default to something harmless
15285 mmaptype='void *'
15286 case "$i_sysmman$d_mmap" in
15287 "$define$define")
15288         $cat >mmap.c <<'END'
15289 #include <sys/mman.h>
15290 void *mmap();
15291 END
15292         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15293                 mmaptype='void *'
15294         else
15295                 mmaptype='caddr_t'
15296         fi
15297         echo "and it returns ($mmaptype)." >&4
15298         ;;
15299 esac
15300
15301
15302
15303 : see if sqrtl exists
15304 set sqrtl d_sqrtl
15305 eval $inlibc
15306
15307 : see if scalbnl exists
15308 set scalbnl d_scalbnl
15309 eval $inlibc
15310
15311 : see if modfl exists
15312 set modfl d_modfl
15313 eval $inlibc
15314
15315 : see if prototype for modfl is available
15316 echo " "
15317 set d_modflproto modfl $i_math math.h
15318 eval $hasproto
15319
15320 d_modfl_pow32_bug="$undef"
15321
15322 case "$d_longdbl$d_modfl" in
15323 $define$define)
15324         $cat <<EOM
15325 Checking to see whether your modfl() is okay for large values...
15326 EOM
15327 $cat >try.c <<EOCP
15328 #include <math.h>
15329 #include <stdio.h>
15330 EOCP
15331 if $test "X$d_modflproto" != "X$define"; then
15332         $cat >>try.c <<EOCP
15333 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15334 long double modfl (long double, long double *);
15335 EOCP
15336 fi
15337 $cat >>try.c <<EOCP
15338 int main() {
15339     long double nv = 4294967303.15;
15340     long double v, w;
15341     v = modfl(nv, &w);
15342 #ifdef __GLIBC__
15343     printf("glibc");
15344 #endif
15345     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15346     return 0;
15347 }
15348 EOCP
15349         case "$osname:$gccversion" in
15350         aix:)   saveccflags="$ccflags"
15351                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15352         esac
15353         set try
15354         if eval $compile; then
15355                 foo=`$run ./try`
15356                 case "$foo" in
15357                 *" 4294967303.150000 1.150000 4294967302.000000")
15358                         echo >&4 "Your modfl() is broken for large values."
15359                         d_modfl_pow32_bug="$define"
15360                         case "$foo" in
15361                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15362                         ;;
15363                         esac
15364                         ;;
15365                 *" 4294967303.150000 0.150000 4294967303.000000")
15366                         echo >&4 "Your modfl() seems okay for large values."
15367                         ;;
15368                 *)      echo >&4 "I don't understand your modfl() at all."
15369                         d_modfl="$undef"
15370                         ;;
15371                 esac
15372                 $rm_try
15373         else
15374                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15375                 d_modfl="$undef"
15376         fi
15377         case "$osname:$gccversion" in
15378         aix:)   ccflags="$saveccflags" ;; # restore
15379         esac
15380         ;;
15381 esac
15382
15383 if $test "$uselongdouble" = "$define"; then
15384     message=""
15385     if $test "$d_sqrtl" != "$define"; then
15386         message="$message sqrtl"
15387     fi
15388     if $test "$d_modfl" != "$define"; then
15389         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15390             echo "You have both aintl and copysignl, so I can emulate modfl."
15391         else
15392             message="$message modfl"
15393         fi
15394     fi
15395     if $test "$d_frexpl" != "$define"; then
15396         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15397             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15398         else
15399             message="$message frexpl"
15400         fi
15401     fi
15402
15403     if $test "$message" != ""; then
15404         $cat <<EOM >&4
15405
15406 *** You requested the use of long doubles but you do not seem to have
15407 *** the following mathematical functions needed for long double support:
15408 ***    $message
15409 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15410 *** Cannot continue, aborting.
15411
15412 EOM
15413
15414         exit 1
15415     fi
15416 fi
15417
15418 : see if mprotect exists
15419 set mprotect d_mprotect
15420 eval $inlibc
15421
15422 : see if msgctl exists
15423 set msgctl d_msgctl
15424 eval $inlibc
15425
15426 : see if msgget exists
15427 set msgget d_msgget
15428 eval $inlibc
15429
15430 : see if msgsnd exists
15431 set msgsnd d_msgsnd
15432 eval $inlibc
15433
15434 : see if msgrcv exists
15435 set msgrcv d_msgrcv
15436 eval $inlibc
15437
15438 : see how much of the 'msg*(2)' library is present.
15439 h_msg=true
15440 echo " "
15441 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15442 *"$undef"*) h_msg=false;;
15443 esac
15444 case "$osname" in
15445 freebsd)
15446     case "`ipcs 2>&1`" in
15447     "SVID messages"*"not configured"*)
15448         echo "Your $osname does not have the msg*(2) configured." >&4
15449         h_msg=false
15450         val="$undef"
15451         set msgctl d_msgctl
15452         eval $setvar
15453         set msgget d_msgget
15454         eval $setvar
15455         set msgsnd d_msgsnd
15456         eval $setvar
15457         set msgrcv d_msgrcv
15458         eval $setvar
15459         ;;
15460     esac
15461     ;;
15462 esac
15463 : we could also check for sys/ipc.h ...
15464 if $h_msg && $test `./findhdr sys/msg.h`; then
15465         echo "You have the full msg*(2) library." >&4
15466         val="$define"
15467 else
15468         echo "You don't have the full msg*(2) library." >&4
15469         val="$undef"
15470 fi
15471 set d_msg
15472 eval $setvar
15473
15474 : Check for msghdr_s
15475 echo " "
15476 echo "Checking to see if your system supports struct msghdr..." >&4
15477 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15478 eval $hasstruct
15479 case "$d_msghdr_s" in
15480 "$define")      echo "Yes, it does."   ;;
15481 *)              echo "No, it doesn't." ;;
15482 esac
15483
15484
15485 : see if msync exists
15486 set msync d_msync
15487 eval $inlibc
15488
15489 : see if munmap exists
15490 set munmap d_munmap
15491 eval $inlibc
15492
15493 : see if nice exists
15494 set nice d_nice
15495 eval $inlibc
15496
15497 : see if this is a langinfo.h system
15498 set langinfo.h i_langinfo
15499 eval $inhdr
15500
15501 : see if nl_langinfo exists
15502 set nl_langinfo d_nl_langinfo
15503 eval $inlibc
15504
15505 : check for volatile keyword
15506 echo " "
15507 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15508 $cat >try.c <<'EOCP'
15509 int main()
15510 {
15511         typedef struct _goo_struct goo_struct;
15512         goo_struct * volatile goo = ((goo_struct *)0);
15513         struct _goo_struct {
15514                 long long_int;
15515                 int reg_int;
15516                 char char_var;
15517         };
15518         typedef unsigned short foo_t;
15519         char *volatile foo;
15520         volatile int bar;
15521         volatile foo_t blech;
15522         foo = foo;
15523 }
15524 EOCP
15525 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15526         val="$define"
15527         echo "Yup, it does."
15528 else
15529         val="$undef"
15530         echo "Nope, it doesn't."
15531 fi
15532 set d_volatile
15533 eval $setvar
15534 $rm_try
15535
15536 : Check basic sizes
15537 echo " "
15538 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15539
15540 case "$use64bitint:$d_quad:$quadtype" in
15541 define:define:?*)
15542         ivtype="$quadtype"
15543         uvtype="$uquadtype"
15544         ivsize=8
15545         uvsize=8
15546         ;;
15547 *)      ivtype="long"
15548         uvtype="unsigned long"
15549         ivsize=$longsize
15550         uvsize=$longsize
15551         ;;
15552 esac
15553
15554 case "$uselongdouble:$d_longdbl" in
15555 define:define)
15556         nvtype="long double"
15557         nvsize=$longdblsize
15558         ;;
15559 *)      nvtype=double
15560         nvsize=$doublesize
15561         ;;
15562 esac
15563
15564 $echo "(IV will be "$ivtype", $ivsize bytes)"
15565 $echo "(UV will be "$uvtype", $uvsize bytes)"
15566 $echo "(NV will be "$nvtype", $nvsize bytes)"
15567
15568 $cat >try.c <<EOCP
15569 #$i_inttypes I_INTTYPES
15570 #ifdef I_INTTYPES
15571 #include <inttypes.h>
15572 #endif
15573 #include <stdio.h>
15574 int main() {
15575 #ifdef INT8
15576    int8_t i =  INT8_MAX;
15577   uint8_t u = UINT8_MAX;
15578   printf("int8_t\n");
15579 #endif
15580 #ifdef INT16
15581    int16_t i =  INT16_MAX;
15582   uint16_t i = UINT16_MAX;
15583   printf("int16_t\n");
15584 #endif
15585 #ifdef INT32
15586    int32_t i =  INT32_MAX;
15587   uint32_t u = UINT32_MAX;
15588   printf("int32_t\n");
15589 #endif
15590 }
15591 EOCP
15592
15593 i8type="signed char"
15594 u8type="unsigned char"
15595 i8size=1
15596 u8size=1
15597
15598 case "$i16type" in
15599 '')     case "$shortsize" in
15600         2)      i16type=short
15601                 u16type="unsigned short"
15602                 i16size=$shortsize
15603                 u16size=$shortsize
15604                 ;;
15605         esac
15606         ;;
15607 esac
15608 case "$i16type" in
15609 '')     set try -DINT16
15610         if eval $compile; then
15611                 case "`$run ./try`" in
15612                 int16_t)
15613                         i16type=int16_t
15614                         u16type=uint16_t
15615                         i16size=2
15616                         u16size=2
15617                         ;;
15618                 esac
15619         fi
15620         ;;
15621 esac
15622 case "$i16type" in
15623 '')     if $test $shortsize -ge 2; then
15624                 i16type=short
15625                 u16type="unsigned short"
15626                 i16size=$shortsize
15627                 u16size=$shortsize
15628         fi
15629         ;;
15630 esac
15631
15632 case "$i32type" in
15633 '')     case "$longsize" in
15634         4)      i32type=long
15635                 u32type="unsigned long"
15636                 i32size=$longsize
15637                 u32size=$longsize
15638                 ;;
15639         *)      case "$intsize" in
15640                 4)      i32type=int
15641                         u32type="unsigned int"
15642                         i32size=$intsize
15643                         u32size=$intsize
15644                         ;;
15645                 esac
15646                 ;;
15647         esac
15648         ;;
15649 esac
15650 case "$i32type" in
15651 '')     set try -DINT32
15652         if eval $compile; then
15653                 case "`$run ./try`" in
15654                 int32_t)
15655                         i32type=int32_t
15656                         u32type=uint32_t
15657                         i32size=4
15658                         u32size=4
15659                         ;;
15660                 esac
15661         fi
15662         ;;
15663 esac
15664 case "$i32type" in
15665 '')     if $test $intsize -ge 4; then
15666                 i32type=int
15667                 u32type="unsigned int"
15668                 i32size=$intsize
15669                 u32size=$intsize
15670         fi
15671         ;;
15672 esac
15673
15674 case "$i64type" in
15675 '')     case "$d_quad:$quadtype" in
15676         define:?*)
15677                 i64type="$quadtype"
15678                 u64type="$uquadtype"
15679                 i64size=8
15680                 u64size=8
15681                 ;;
15682         esac
15683         ;;
15684 esac
15685
15686 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15687 : volatile so that the compiler has to store it out to memory.
15688 if test X"$d_volatile" = X"$define"; then
15689         volatile=volatile
15690 fi
15691 $cat <<EOP >try.c
15692 #include <stdio.h>
15693 #$i_stdlib I_STDLIB
15694 #ifdef I_STDLIB
15695 #include <stdlib.h>
15696 #endif
15697 #include <sys/types.h>
15698 #include <signal.h>
15699 #ifdef SIGFPE
15700 $volatile int bletched = 0;
15701 $signal_t blech(int s) { bletched = 1; }
15702 #endif
15703 int main() {
15704     $uvtype u = 0;
15705     $nvtype d;
15706     int     n = 8 * $uvsize;
15707     int     i;
15708 #ifdef SIGFPE
15709     signal(SIGFPE, blech);
15710 #endif
15711
15712     for (i = 0; i < n; i++) {
15713       u = u << 1 | ($uvtype)1;
15714       d = ($nvtype)u;
15715       if (($uvtype)d != u)
15716         break;
15717       if (d <= 0)
15718         break;
15719       d = ($nvtype)(u - 1);
15720       if (($uvtype)d != (u - 1))
15721         break;
15722 #ifdef SIGFPE
15723       if (bletched)
15724         break;
15725 #endif
15726     }
15727     printf("%d\n", ((i == n) ? -n : i));
15728     exit(0);
15729 }
15730 EOP
15731 set try
15732
15733 d_nv_preserves_uv="$undef"
15734 if eval $compile; then
15735         nv_preserves_uv_bits="`$run ./try`"
15736 fi
15737 case "$nv_preserves_uv_bits" in
15738 \-[1-9]*)
15739         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15740         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15741         d_nv_preserves_uv="$define"
15742         ;;
15743 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15744         d_nv_preserves_uv="$undef" ;;
15745 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15746         nv_preserves_uv_bits="0" ;;
15747 esac
15748 $rm_try
15749
15750 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15751 : volatile so that the compiler has to store it out to memory.
15752 if test X"$d_volatile" = X"$define"; then
15753         volatile=volatile
15754 fi
15755 $cat <<EOP >try.c
15756 #include <stdio.h>
15757
15758 typedef $nvtype NV;
15759
15760 int
15761 main() {
15762   NV value = 2;
15763   int count = 1;
15764
15765   while(count < 256) {
15766     $volatile NV up = value + 1.0;
15767     $volatile NV negated = -value;
15768     $volatile NV down = negated - 1.0;
15769     $volatile NV got_up = up - value;
15770     int up_good = got_up == 1.0;
15771     int got_down = down - negated;
15772     int down_good = got_down == -1.0;
15773
15774     if (down_good != up_good) {
15775       fprintf(stderr,
15776               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15777               up_good, (double) got_up, down_good, (double) got_down,
15778               count, (double) value);
15779       return 1;
15780     }
15781     if (!up_good) {
15782       while (1) {
15783         if (count > 8) {
15784           count -= 8;
15785           fputs("256.0", stdout);
15786         } else {
15787           count--;
15788           fputs("2.0", stdout);
15789         }
15790         if (!count) {
15791           puts("");
15792           return 0;
15793         }
15794         fputs("*", stdout);
15795       }
15796     }
15797     value *= 2;
15798     ++count;
15799   }
15800   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15801           count, (double) value);
15802   return 1;
15803 }
15804 EOP
15805 set try
15806
15807 nv_overflows_integers_at='0'
15808 if eval $compile; then
15809     xxx="`$run ./try`"
15810     case "$?" in
15811         0)
15812             case "$xxx" in
15813                 2*)  cat >&4 <<EOM
15814 The largest integer your NVs can preserve is equal to $xxx
15815 EOM
15816                     nv_overflows_integers_at="$xxx"
15817                     ;;
15818                 *)  cat >&4 <<EOM
15819 Cannot determine the largest integer value your NVs can hold, unexpected output
15820 '$xxx'
15821 EOM
15822                     ;;
15823             esac
15824             ;;
15825         *)  cat >&4 <<EOM
15826 Cannot determine the largest integer value your NVs can hold
15827 EOM
15828             ;;
15829     esac
15830 fi
15831 $rm_try
15832
15833 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15834 : volatile so that the compiler has to store it out to memory.
15835 if test X"$d_volatile" = X"$define"; then
15836         volatile=volatile
15837 fi
15838 $cat <<EOP >try.c
15839 #include <stdio.h>
15840 #$i_stdlib I_STDLIB
15841 #ifdef I_STDLIB
15842 #include <stdlib.h>
15843 #endif
15844 #$i_string I_STRING
15845 #ifdef I_STRING
15846 #  include <string.h>
15847 #else
15848 #  include <strings.h>
15849 #endif
15850 #include <sys/types.h>
15851 #include <signal.h>
15852 #ifdef SIGFPE
15853 $volatile int bletched = 0;
15854 $signal_t blech(int s) { bletched = 1; }
15855 #endif
15856
15857 int checkit($nvtype d, char *where) {
15858     unsigned char *p = (char *)&d;
15859     unsigned char *end = p + sizeof(d);
15860     int fail = 0;
15861
15862     while (p < end)
15863         fail += *p++;
15864
15865     if (!fail)
15866         return 0;
15867
15868     p = (char *)&d;
15869     printf("No - %s: 0x", where);
15870     while (p < end)
15871         printf ("%02X", *p++);
15872     printf("\n");
15873     return 1;
15874 }
15875
15876 int main(int argc, char **argv) {
15877     $nvtype d = 0.0;
15878     int fail = 0;
15879     fail += checkit(d, "0.0");
15880
15881     /* The compiler shouldn't be assuming that bletched is 0  */
15882     d = bletched;
15883
15884     fail += checkit(d, "bleched");
15885
15886 #ifdef SIGFPE
15887     signal(SIGFPE, blech);
15888 #endif
15889
15890     /* Paranoia - the compiler should have no way of knowing that ANSI says
15891        that argv[argc] will always be NULL.  Actually, if it did assume this it
15892        would be buggy, as this is C and main() can be called from elsewhere in
15893        the program.  */
15894     d = argv[argc] ? 1 : 0;
15895
15896     if (d) {
15897         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15898     }
15899
15900     fail += checkit(d, "ternary");
15901
15902     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15903
15904     if (d != 0.0) {
15905         printf("No - memset doesn't give 0.0\n");
15906         /* This might just blow up:  */
15907         printf("(gives %g)\n", d);
15908         return 1;
15909     }
15910
15911 #ifdef SIGFPE
15912     if (bletched) {
15913         printf("No - something bleched\n");
15914         return 1;
15915     }
15916 #endif
15917     if (fail) {
15918       printf("No - %d fail(s)\n", fail);
15919       return 1;
15920     }
15921     printf("Yes\n");
15922     return 0;
15923 }
15924 EOP
15925 set try
15926
15927 d_nv_zero_is_allbits_zero="$undef"
15928 if eval $compile; then
15929     xxx="`$run ./try`"
15930     case "$?" in
15931         0)
15932             case "$xxx" in
15933                 Yes)  cat >&4 <<EOM
15934 0.0 is represented as all bits zero in memory
15935 EOM
15936                     d_nv_zero_is_allbits_zero="$define"
15937                     ;;
15938                 *)  cat >&4 <<EOM
15939 0.0 is not represented as all bits zero in memory
15940 EOM
15941                     d_nv_zero_is_allbits_zero="$undef"
15942                     ;;
15943             esac
15944             ;;
15945         *)  cat >&4 <<EOM
15946 0.0 is not represented as all bits zero in memory
15947 EOM
15948             d_nv_zero_is_allbits_zero="$undef"
15949             ;;
15950     esac
15951 fi
15952 $rm_try
15953
15954 : check for off64_t
15955 echo " "
15956 echo "Checking to see if you have off64_t..." >&4
15957 $cat >try.c <<EOCP
15958 #include <sys/types.h>
15959 #include <unistd.h>
15960 int main() { off64_t x = 7; }
15961 EOCP
15962 set try
15963 if eval $compile; then
15964         val="$define"
15965         echo "You have off64_t."
15966 else
15967         val="$undef"
15968         echo "You do not have off64_t."
15969         case "$lseeksize" in
15970         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15971         esac
15972 fi
15973 $rm_try
15974 set d_off64_t
15975 eval $setvar
15976
15977 : how to create joinable pthreads
15978 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15979         echo " "
15980         echo "Checking what constant to use for creating joinable pthreads..." >&4
15981         $cat >try.c <<'EOCP'
15982 #include <pthread.h>
15983 int main() {
15984     int detachstate = JOINABLE;
15985 }
15986 EOCP
15987         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15988         if eval $compile; then
15989                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15990                 val="$undef" # Yes, undef.
15991                 set d_old_pthread_create_joinable
15992                 eval $setvar
15993                 val=""
15994                 set old_pthread_create_joinable
15995                 eval $setvar
15996         else
15997                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15998                 if eval $compile; then
15999                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16000                         val="$define"
16001                         set d_old_pthread_create_joinable
16002                         eval $setvar
16003                         val=PTHREAD_CREATE_UNDETACHED
16004                         set old_pthread_create_joinable
16005                         eval $setvar
16006                 else
16007                         set try -DJOINABLE=__UNDETACHED
16008                         if eval $compile; then
16009                                 echo "You seem to use __UNDETACHED." >&4
16010                                 val="$define"
16011                                 set d_old_pthread_create_joinable
16012                                 eval $setvar
16013                                 val=__UNDETACHED
16014                                 set old_pthread_create_joinable
16015                                 eval $setvar
16016                         else
16017                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16018                                 val="$define"
16019                                 set d_old_pthread_create_joinable
16020                                 eval $setvar
16021                                 val=0
16022                                 set old_pthread_create_joinable
16023                                 eval $setvar
16024                         fi
16025                 fi
16026         fi
16027         $rm_try
16028 else
16029     d_old_pthread_create_joinable="$undef"
16030     old_pthread_create_joinable=""
16031 fi
16032
16033 : see if pause exists
16034 set pause d_pause
16035 eval $inlibc
16036
16037 : see if poll exists
16038 set poll d_poll
16039 eval $inlibc
16040
16041 : see if prctl exists
16042 set prctl d_prctl
16043 eval $inlibc
16044
16045 : see if prctl supports PR_SET_NAME
16046 d_prctl_set_name=$undef
16047 case $d_prctl in
16048     $define)
16049         $cat >try.c <<EOM
16050 #include <sys/prctl.h>
16051
16052 int main (int argc, char *argv[])
16053 {
16054     return (prctl (PR_SET_NAME, "Test"));
16055     } /* main */
16056 EOM
16057         set try
16058         if eval $compile_ok && $run ./try; then
16059             echo "Your prctl (PR_SET_NAME, ...) works"
16060             d_prctl_set_name=$define
16061             fi
16062         $rm_try
16063         ;;
16064     esac
16065
16066 : see if readlink exists
16067 set readlink d_readlink
16068 eval $inlibc
16069
16070 : Check if exe is symlink to abs path of executing program
16071 echo " "
16072 procselfexe=''
16073 val="$undef"
16074 case "$d_readlink" in
16075     "$define")
16076         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16077         : more tidy to avoid an extra level of symlink
16078         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16079         while test $# -gt 0; do
16080             type=$1; try=$2
16081             shift; shift
16082             if $issymlink $try; then
16083                 $ls -l $try > reflect
16084                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16085                     echo "You have $type-like $try."
16086                     procselfexe='"'$try'"'
16087                     val="$define"
16088                     : This will break out of the loop
16089                     set X; shift
16090                 fi
16091             fi
16092         done
16093         ;;
16094 esac
16095 $rm -f reflect
16096 set d_procselfexe
16097 eval $setvar
16098
16099 : backward compatibility for d_hvfork
16100 if test X$d_hvfork != X; then
16101         d_vfork="$d_hvfork"
16102         d_hvfork=''
16103 fi
16104 : see if there is a vfork
16105 val=''
16106 set vfork val
16107 eval $inlibc
16108
16109 d_pseudofork=$undef
16110
16111 : Ok, but do we want to use it. vfork is reportedly unreliable in
16112 : perl on Solaris 2.x, and probably elsewhere.
16113 case "$val" in
16114 $define)
16115         echo " "
16116         case "$usevfork" in
16117         false) dflt='n';;
16118         *) dflt='y';;
16119         esac
16120         cat <<'EOM'
16121
16122 Perl can only use a vfork() that doesn't suffer from strict
16123 restrictions on calling functions or modifying global data in
16124 the child.  For example, glibc-2.1 contains such a vfork()
16125 that is unsuitable.  If your system provides a proper fork()
16126 call, chances are that you do NOT want perl to use vfork().
16127
16128 EOM
16129         rp="Do you still want to use vfork()?"
16130         . ./myread
16131         case "$ans" in
16132         y|Y) ;;
16133         *)
16134                 echo "Ok, we won't use vfork()."
16135                 val="$undef"
16136                 ;;
16137         esac
16138         ;;
16139 esac
16140 set d_vfork
16141 eval $setvar
16142 case "$d_vfork" in
16143 $define) usevfork='true';;
16144 *) usevfork='false';;
16145 esac
16146
16147 : see whether the pthread_atfork exists
16148 $cat >try.c <<EOP
16149 #include <pthread.h>
16150 #include <stdio.h>
16151 int main() {
16152 #ifdef  PTHREAD_ATFORK
16153         pthread_atfork(NULL,NULL,NULL);
16154 #endif
16155 }
16156 EOP
16157
16158 : see if pthread_atfork exists
16159 set try -DPTHREAD_ATFORK
16160 if eval $compile; then
16161     val="$define"
16162 else
16163     val="$undef"
16164 fi
16165 case "$usethreads" in
16166 $define)
16167         case "$val" in
16168         $define) echo 'pthread_atfork found.' >&4        ;;
16169         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16170         esac
16171 esac
16172 set d_pthread_atfork
16173 eval $setvar
16174
16175 : see if pthread_attr_setscope exists
16176 set pthread_attr_setscope d_pthread_attr_setscope
16177 eval $inlibc
16178
16179 : see whether the various POSIXish _yields exist
16180 $cat >try.c <<EOP
16181 #include <pthread.h>
16182 #include <stdio.h>
16183 int main() {
16184 #ifdef SCHED_YIELD
16185         sched_yield();
16186 #else
16187 #ifdef PTHREAD_YIELD
16188         pthread_yield();
16189 #else
16190 #ifdef PTHREAD_YIELD_NULL
16191         pthread_yield(NULL);
16192 #endif
16193 #endif
16194 #endif
16195 }
16196 EOP
16197 : see if sched_yield exists
16198 set try -DSCHED_YIELD
16199 if eval $compile; then
16200     val="$define"
16201     sched_yield='sched_yield()'
16202 else
16203     val="$undef"
16204 fi
16205 case "$usethreads" in
16206 $define)
16207         case "$val" in
16208         $define) echo 'sched_yield() found.' >&4        ;;
16209         *)       echo 'sched_yield() NOT found.' >&4    ;;
16210         esac
16211 esac
16212 set d_sched_yield
16213 eval $setvar
16214
16215 : see if pthread_yield exists
16216 set try -DPTHREAD_YIELD
16217 if eval $compile; then
16218     val="$define"
16219     case "$sched_yield" in
16220     '') sched_yield='pthread_yield()' ;;
16221     esac
16222 else
16223     set try -DPTHREAD_YIELD_NULL
16224     if eval $compile; then
16225         val="$define"
16226         case "$sched_yield" in
16227         '') sched_yield='pthread_yield(NULL)' ;;
16228         esac
16229     else
16230         val="$undef"
16231     fi
16232 fi
16233 case "$usethreads" in
16234 $define)
16235         case "$val" in
16236         $define) echo 'pthread_yield() found.' >&4      ;;
16237         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16238         esac
16239         ;;
16240 esac
16241 set d_pthread_yield
16242 eval $setvar
16243 case "$sched_yield" in
16244 '') sched_yield=undef ;;
16245 esac
16246 $rm_try
16247
16248 : see if random_r exists
16249 set random_r d_random_r
16250 eval $inlibc
16251 case "$d_random_r" in
16252 "$define")
16253         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16254         case "$d_random_r_proto:$usethreads" in
16255         ":define")      d_random_r_proto=define
16256                 set d_random_r_proto random_r $hdrs
16257                 eval $hasproto ;;
16258         *)      ;;
16259         esac
16260         case "$d_random_r_proto" in
16261         define)
16262         case "$random_r_proto" in
16263         ''|0) try='int random_r(int*, struct random_data*);'
16264         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16265         esac
16266         case "$random_r_proto" in
16267         ''|0) try='int random_r(long*, struct random_data*);'
16268         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16269         esac
16270         case "$random_r_proto" in
16271         ''|0) try='int random_r(struct random_data*, int32_t*);'
16272         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16273         esac
16274         case "$random_r_proto" in
16275         ''|0)   d_random_r=undef
16276                 random_r_proto=0
16277                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16278         * )     case "$random_r_proto" in
16279                 REENTRANT_PROTO*) ;;
16280                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16281                 esac
16282                 echo "Prototype: $try" ;;
16283         esac
16284         ;;
16285         *)      case "$usethreads" in
16286                 define) echo "random_r has no prototype, not using it." >&4 ;;
16287                 esac
16288                 d_random_r=undef
16289                 random_r_proto=0
16290                 ;;
16291         esac
16292         ;;
16293 *)      random_r_proto=0
16294         ;;
16295 esac
16296
16297 : see if readdir and friends exist
16298 set readdir d_readdir
16299 eval $inlibc
16300 set seekdir d_seekdir
16301 eval $inlibc
16302 set telldir d_telldir
16303 eval $inlibc
16304 set rewinddir d_rewinddir
16305 eval $inlibc
16306
16307 : see if readdir64_r exists
16308 set readdir64_r d_readdir64_r
16309 eval $inlibc
16310 case "$d_readdir64_r" in
16311 "$define")
16312         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16313         case "$d_readdir64_r_proto:$usethreads" in
16314         ":define")      d_readdir64_r_proto=define
16315                 set d_readdir64_r_proto readdir64_r $hdrs
16316                 eval $hasproto ;;
16317         *)      ;;
16318         esac
16319         case "$d_readdir64_r_proto" in
16320         define)
16321         case "$readdir64_r_proto" in
16322         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16323         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16324         esac
16325         case "$readdir64_r_proto" in
16326         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16327         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16328         esac
16329         case "$readdir64_r_proto" in
16330         ''|0)   d_readdir64_r=undef
16331                 readdir64_r_proto=0
16332                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16333         * )     case "$readdir64_r_proto" in
16334                 REENTRANT_PROTO*) ;;
16335                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16336                 esac
16337                 echo "Prototype: $try" ;;
16338         esac
16339         ;;
16340         *)      case "$usethreads" in
16341                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16342                 esac
16343                 d_readdir64_r=undef
16344                 readdir64_r_proto=0
16345                 ;;
16346         esac
16347         ;;
16348 *)      readdir64_r_proto=0
16349         ;;
16350 esac
16351
16352 : see if readdir_r exists
16353 set readdir_r d_readdir_r
16354 eval $inlibc
16355 case "$d_readdir_r" in
16356 "$define")
16357         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16358         case "$d_readdir_r_proto:$usethreads" in
16359         ":define")      d_readdir_r_proto=define
16360                 set d_readdir_r_proto readdir_r $hdrs
16361                 eval $hasproto ;;
16362         *)      ;;
16363         esac
16364         case "$d_readdir_r_proto" in
16365         define)
16366         case "$readdir_r_proto" in
16367         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16368         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16369         esac
16370         case "$readdir_r_proto" in
16371         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16372         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16373         esac
16374         case "$readdir_r_proto" in
16375         ''|0)   d_readdir_r=undef
16376                 readdir_r_proto=0
16377                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16378         * )     case "$readdir_r_proto" in
16379                 REENTRANT_PROTO*) ;;
16380                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16381                 esac
16382                 echo "Prototype: $try" ;;
16383         esac
16384         ;;
16385         *)      case "$usethreads" in
16386                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16387                 esac
16388                 d_readdir_r=undef
16389                 readdir_r_proto=0
16390                 ;;
16391         esac
16392         ;;
16393 *)      readdir_r_proto=0
16394         ;;
16395 esac
16396
16397 : see if readv exists
16398 set readv d_readv
16399 eval $inlibc
16400
16401 : see if recvmsg exists
16402 set recvmsg d_recvmsg
16403 eval $inlibc
16404
16405 : see if rename exists
16406 set rename d_rename
16407 eval $inlibc
16408
16409 : see if rmdir exists
16410 set rmdir d_rmdir
16411 eval $inlibc
16412
16413 : see if memory.h is available.
16414 val=''
16415 set memory.h val
16416 eval $inhdr
16417
16418 : See if it conflicts with string.h
16419 case "$val" in
16420 $define)
16421         case "$strings" in
16422         '') ;;
16423         *)
16424                 $cppstdin $cppflags $cppminus < $strings > mem.h
16425                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16426                         echo " "
16427                         echo "We won't be including <memory.h>."
16428                         val="$undef"
16429                 fi
16430                 $rm -f mem.h
16431                 ;;
16432         esac
16433 esac
16434 set i_memory
16435 eval $setvar
16436
16437 : can bcopy handle overlapping blocks?
16438 echo " "
16439 val="$undef"
16440 case "$d_memmove" in
16441 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16442 *)      case "$d_bcopy" in
16443         "$define")
16444                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16445                 $cat >try.c <<EOCP
16446 #$i_memory I_MEMORY
16447 #$i_stdlib I_STDLIB
16448 #$i_string I_STRING
16449 #$i_unistd I_UNISTD
16450 EOCP
16451         $cat >>try.c <<'EOCP'
16452 #include <stdio.h>
16453 #ifdef I_MEMORY
16454 #  include <memory.h>
16455 #endif
16456 #ifdef I_STDLIB
16457 #  include <stdlib.h>
16458 #endif
16459 #ifdef I_STRING
16460 #  include <string.h>
16461 #else
16462 #  include <strings.h>
16463 #endif
16464 #ifdef I_UNISTD
16465 #  include <unistd.h>  /* Needed for NetBSD */
16466 #endif
16467 int main()
16468 {
16469 char buf[128], abc[128];
16470 char *b;
16471 int len;
16472 int off;
16473 int align;
16474
16475 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16476    try to store the string in read-only memory. */
16477 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16478
16479 for (align = 7; align >= 0; align--) {
16480         for (len = 36; len; len--) {
16481                 b = buf+align;
16482                 bcopy(abc, b, len);
16483                 for (off = 1; off <= len; off++) {
16484                         bcopy(b, b+off, len);
16485                         bcopy(b+off, b, len);
16486                         if (bcmp(b, abc, len))
16487                                 exit(1);
16488                 }
16489         }
16490 }
16491 exit(0);
16492 }
16493 EOCP
16494                 set try
16495                 if eval $compile_ok; then
16496                         if $run ./try 2>/dev/null; then
16497                                 echo "Yes, it can."
16498                                 val="$define"
16499                         else
16500                                 echo "It can't, sorry."
16501                         fi
16502                 else
16503                         echo "(I can't compile the test program, so we'll assume not...)"
16504                 fi
16505                 ;;
16506         esac
16507         $rm_try
16508         ;;
16509 esac
16510 set d_safebcpy
16511 eval $setvar
16512
16513 : can memcpy handle overlapping blocks?
16514 echo " "
16515 val="$undef"
16516 case "$d_memmove" in
16517 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16518 *)      case "$d_memcpy" in
16519         "$define")
16520                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16521                 $cat >try.c <<EOCP
16522 #$i_memory I_MEMORY
16523 #$i_stdlib I_STDLIB
16524 #$i_string I_STRING
16525 #$i_unistd I_UNISTD
16526 EOCP
16527         $cat >>try.c <<'EOCP'
16528 #include <stdio.h>
16529 #ifdef I_MEMORY
16530 #  include <memory.h>
16531 #endif
16532 #ifdef I_STDLIB
16533 #  include <stdlib.h>
16534 #endif
16535 #ifdef I_STRING
16536 #  include <string.h>
16537 #else
16538 #  include <strings.h>
16539 #endif
16540 #ifdef I_UNISTD
16541 #  include <unistd.h>  /* Needed for NetBSD */
16542 #endif
16543 int main()
16544 {
16545 char buf[128], abc[128];
16546 char *b;
16547 int len;
16548 int off;
16549 int align;
16550
16551 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16552    try to store the string in read-only memory. */
16553 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16554
16555 for (align = 7; align >= 0; align--) {
16556         for (len = 36; len; len--) {
16557                 b = buf+align;
16558                 memcpy(b, abc, len);
16559                 for (off = 1; off <= len; off++) {
16560                         memcpy(b+off, b, len);
16561                         memcpy(b, b+off, len);
16562                         if (memcmp(b, abc, len))
16563                                 exit(1);
16564                 }
16565         }
16566 }
16567 exit(0);
16568 }
16569 EOCP
16570                 set try
16571                 if eval $compile_ok; then
16572                         if $run ./try 2>/dev/null; then
16573                                 echo "Yes, it can."
16574                                 val="$define"
16575                         else
16576                                 echo "It can't, sorry."
16577                         fi
16578                 else
16579                         echo "(I can't compile the test program, so we'll assume not...)"
16580                 fi
16581                 ;;
16582         esac
16583         $rm_try
16584         ;;
16585 esac
16586 set d_safemcpy
16587 eval $setvar
16588
16589 : can memcmp be trusted to compare relative magnitude?
16590 val="$undef"
16591 case "$d_memcmp" in
16592 "$define")
16593         echo " "
16594         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16595         $cat >try.c <<EOCP
16596 #$i_memory I_MEMORY
16597 #$i_stdlib I_STDLIB
16598 #$i_string I_STRING
16599 #$i_unistd I_UNISTD
16600 EOCP
16601         $cat >>try.c <<'EOCP'
16602 #include <stdio.h>
16603 #ifdef I_MEMORY
16604 #  include <memory.h>
16605 #endif
16606 #ifdef I_STDLIB
16607 #  include <stdlib.h>
16608 #endif
16609 #ifdef I_STRING
16610 #  include <string.h>
16611 #else
16612 #  include <strings.h>
16613 #endif
16614 #ifdef I_UNISTD
16615 #  include <unistd.h>  /* Needed for NetBSD */
16616 #endif
16617 int main()
16618 {
16619 char a = -1;
16620 char b = 0;
16621 if ((a < b) && memcmp(&a, &b, 1) < 0)
16622         exit(1);
16623 exit(0);
16624 }
16625 EOCP
16626         set try
16627         if eval $compile_ok; then
16628                 if $run ./try 2>/dev/null; then
16629                         echo "Yes, it can."
16630                         val="$define"
16631                 else
16632                         echo "No, it can't (it uses signed chars)."
16633                 fi
16634         else
16635                 echo "(I can't compile the test program, so we'll assume not...)"
16636         fi
16637         ;;
16638 esac
16639 $rm_try
16640 set d_sanemcmp
16641 eval $setvar
16642
16643 : see if prototype for sbrk is available
16644 echo " "
16645 set d_sbrkproto sbrk $i_unistd unistd.h
16646 eval $hasproto
16647
16648 : see if select exists
16649 set select d_select
16650 eval $inlibc
16651
16652 : see if semctl exists
16653 set semctl d_semctl
16654 eval $inlibc
16655
16656 : see if semget exists
16657 set semget d_semget
16658 eval $inlibc
16659
16660 : see if semop exists
16661 set semop d_semop
16662 eval $inlibc
16663
16664 : see how much of the 'sem*(2)' library is present.
16665 h_sem=true
16666 echo " "
16667 case "$d_semctl$d_semget$d_semop" in
16668 *"$undef"*) h_sem=false;;
16669 esac
16670 case "$osname" in
16671 freebsd)
16672     case "`ipcs 2>&1`" in
16673     "SVID messages"*"not configured"*)
16674         echo "Your $osname does not have the sem*(2) configured." >&4
16675         h_sem=false
16676         val="$undef"
16677         set semctl d_semctl
16678         eval $setvar
16679         set semget d_semget
16680         eval $setvar
16681         set semop d_semop
16682         eval $setvar
16683         ;;
16684     esac
16685     ;;
16686 esac
16687 : we could also check for sys/ipc.h ...
16688 if $h_sem && $test `./findhdr sys/sem.h`; then
16689         echo "You have the full sem*(2) library." >&4
16690         val="$define"
16691 else
16692         echo "You don't have the full sem*(2) library." >&4
16693         val="$undef"
16694 fi
16695 set d_sem
16696 eval $setvar
16697
16698 : see whether sys/sem.h defines union semun
16699 echo " "
16700 $cat > try.c <<'END'
16701 #include <sys/types.h>
16702 #include <sys/ipc.h>
16703 #include <sys/sem.h>
16704 int main () { union semun semun; semun.buf = 0; }
16705 END
16706 set try
16707 if eval $compile; then
16708     echo "You have union semun in <sys/sem.h>." >&4
16709     val="$define"
16710 else
16711     echo "You do not have union semun in <sys/sem.h>." >&4
16712     val="$undef"
16713 fi
16714 $rm_try
16715 set d_union_semun
16716 eval $setvar
16717
16718 : see how to do semctl IPC_STAT
16719 case "$d_sem" in
16720 $define)
16721     echo " "
16722     $cat > tryh.h <<END
16723 #ifndef S_IRUSR
16724 #   ifdef S_IREAD
16725 #       define S_IRUSR S_IREAD
16726 #       define S_IWUSR S_IWRITE
16727 #       define S_IXUSR S_IEXEC
16728 #   else
16729 #       define S_IRUSR 0400
16730 #       define S_IWUSR 0200
16731 #       define S_IXUSR 0100
16732 #   endif
16733 #   define S_IRGRP (S_IRUSR>>3)
16734 #   define S_IWGRP (S_IWUSR>>3)
16735 #   define S_IXGRP (S_IXUSR>>3)
16736 #   define S_IROTH (S_IRUSR>>6)
16737 #   define S_IWOTH (S_IWUSR>>6)
16738 #   define S_IXOTH (S_IXUSR>>6)
16739 #endif
16740 #ifndef S_IRWXU
16741 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16742 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16743 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16744 #endif
16745 END
16746     : see whether semctl IPC_STAT can use union semun
16747     case "$d_semctl_semun" in
16748     '')
16749       val="$undef"
16750       $cat > try.c <<END
16751 #include <sys/types.h>
16752 #include <sys/ipc.h>
16753 #include <sys/sem.h>
16754 #include <sys/stat.h>
16755 #include <stdio.h>
16756 #include <errno.h>
16757 #include "tryh.h"
16758 #ifndef errno
16759 extern int errno;
16760 #endif
16761 #$d_union_semun HAS_UNION_SEMUN
16762 int main() {
16763     union semun
16764 #ifndef HAS_UNION_SEMUN
16765     {
16766         int val;
16767         struct semid_ds *buf;
16768         unsigned short *array;
16769     }
16770 #endif
16771     arg;
16772     int sem, st;
16773
16774 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16775     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16776     if (sem > -1) {
16777         struct semid_ds argbuf;
16778         arg.buf = &argbuf;
16779 #       ifdef IPC_STAT
16780         st = semctl(sem, 0, IPC_STAT, arg);
16781         if (st == 0)
16782             printf("semun\n");
16783         else
16784 #       endif /* IPC_STAT */
16785             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16786 #       ifdef IPC_RMID
16787         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16788 #       endif /* IPC_RMID */
16789             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16790     } else
16791 #endif /* IPC_PRIVATE && ... */
16792         printf("semget failed: errno = %d\n", errno);
16793   return 0;
16794 }
16795 END
16796       set try
16797       if eval $compile; then
16798           xxx=`$run ./try`
16799           case "$xxx" in
16800           semun) val="$define" ;;
16801           esac
16802       fi
16803       $rm_try
16804       set d_semctl_semun
16805       eval $setvar
16806       ;;
16807     esac
16808     case "$d_semctl_semun" in
16809     $define)
16810         echo "You can use union semun for semctl IPC_STAT." >&4
16811         also='also'
16812         ;;
16813     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16814         also=''
16815         ;;
16816     esac
16817
16818     : see whether semctl IPC_STAT can use struct semid_ds pointer
16819     case "$d_semctl_semid_ds" in
16820     '')
16821       val="$undef"
16822       $cat > try.c <<'END'
16823 #include <sys/types.h>
16824 #include <sys/ipc.h>
16825 #include <sys/sem.h>
16826 #include <sys/stat.h>
16827 #include "tryh.h"
16828 #include <stdio.h>
16829 #include <errno.h>
16830 #ifndef errno
16831 extern int errno;
16832 #endif
16833 int main() {
16834     struct semid_ds arg;
16835     int sem, st;
16836
16837 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16838     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16839     if (sem > -1) {
16840 #       ifdef IPC_STAT
16841         st = semctl(sem, 0, IPC_STAT, &arg);
16842         if (st == 0)
16843             printf("semid_ds\n");
16844         else
16845 #       endif /* IPC_STAT */
16846             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16847 #       ifdef IPC_RMID
16848         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16849 #       endif /* IPC_RMID */
16850             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16851     } else
16852 #endif /* IPC_PRIVATE && ... */
16853         printf("semget failed: errno = %d\n", errno);
16854
16855     return 0;
16856 }
16857 END
16858       set try
16859       if eval $compile; then
16860           xxx=`$run ./try`
16861           case "$xxx" in
16862           semid_ds) val="$define" ;;
16863           esac
16864       fi
16865       $rm_try
16866       set d_semctl_semid_ds
16867       eval $setvar
16868       ;;
16869     esac
16870     case "$d_semctl_semid_ds" in
16871     $define)
16872         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16873         ;;
16874     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16875         ;;
16876     esac
16877     ;;
16878 *)  val="$undef"
16879
16880     # We do not have the full sem*(2) library, so assume we can not
16881     # use either.
16882
16883     set d_semctl_semun
16884     eval $setvar
16885
16886     set d_semctl_semid_ds
16887     eval $setvar
16888     ;;
16889 esac
16890 $rm_try tryh.h
16891
16892 : see if sendmsg exists
16893 set sendmsg d_sendmsg
16894 eval $inlibc
16895
16896 : see if setegid exists
16897 set setegid d_setegid
16898 eval $inlibc
16899
16900 : see if seteuid exists
16901 set seteuid d_seteuid
16902 eval $inlibc
16903
16904 : see if setgrent exists
16905 set setgrent d_setgrent
16906 eval $inlibc
16907
16908 : see if setgrent_r exists
16909 set setgrent_r d_setgrent_r
16910 eval $inlibc
16911 case "$d_setgrent_r" in
16912 "$define")
16913         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16914         case "$d_setgrent_r_proto:$usethreads" in
16915         ":define")      d_setgrent_r_proto=define
16916                 set d_setgrent_r_proto setgrent_r $hdrs
16917                 eval $hasproto ;;
16918         *)      ;;
16919         esac
16920         case "$d_setgrent_r_proto" in
16921         define)
16922         case "$setgrent_r_proto" in
16923         ''|0) try='int setgrent_r(FILE**);'
16924         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16925         esac
16926         case "$setgrent_r_proto" in
16927         ''|0) try='void setgrent_r(FILE**);'
16928         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16929         esac
16930         case "$setgrent_r_proto" in
16931         ''|0)   d_setgrent_r=undef
16932                 setgrent_r_proto=0
16933                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16934         * )     case "$setgrent_r_proto" in
16935                 REENTRANT_PROTO*) ;;
16936                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16937                 esac
16938                 echo "Prototype: $try" ;;
16939         esac
16940         ;;
16941         *)      case "$usethreads" in
16942                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16943                 esac
16944                 d_setgrent_r=undef
16945                 setgrent_r_proto=0
16946                 ;;
16947         esac
16948         ;;
16949 *)      setgrent_r_proto=0
16950         ;;
16951 esac
16952
16953 : see if sethostent exists
16954 set sethostent d_sethent
16955 eval $inlibc
16956
16957 : see if sethostent_r exists
16958 set sethostent_r d_sethostent_r
16959 eval $inlibc
16960 case "$d_sethostent_r" in
16961 "$define")
16962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16963         case "$d_sethostent_r_proto:$usethreads" in
16964         ":define")      d_sethostent_r_proto=define
16965                 set d_sethostent_r_proto sethostent_r $hdrs
16966                 eval $hasproto ;;
16967         *)      ;;
16968         esac
16969         case "$d_sethostent_r_proto" in
16970         define)
16971         case "$sethostent_r_proto" in
16972         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16973         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16974         esac
16975         case "$sethostent_r_proto" in
16976         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16977         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16978         esac
16979         case "$sethostent_r_proto" in
16980         ''|0)   d_sethostent_r=undef
16981                 sethostent_r_proto=0
16982                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16983         * )     case "$sethostent_r_proto" in
16984                 REENTRANT_PROTO*) ;;
16985                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16986                 esac
16987                 echo "Prototype: $try" ;;
16988         esac
16989         ;;
16990         *)      case "$usethreads" in
16991                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16992                 esac
16993                 d_sethostent_r=undef
16994                 sethostent_r_proto=0
16995                 ;;
16996         esac
16997         ;;
16998 *)      sethostent_r_proto=0
16999         ;;
17000 esac
17001
17002 : see if setitimer exists
17003 set setitimer d_setitimer
17004 eval $inlibc
17005
17006 : see if setlinebuf exists
17007 set setlinebuf d_setlinebuf
17008 eval $inlibc
17009
17010 : see if setlocale exists
17011 set setlocale d_setlocale
17012 eval $inlibc
17013
17014 : see if locale.h is available
17015 set locale.h i_locale
17016 eval $inhdr
17017
17018 : see if setlocale_r exists
17019 set setlocale_r d_setlocale_r
17020 eval $inlibc
17021 case "$d_setlocale_r" in
17022 "$define")
17023         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17024         case "$d_setlocale_r_proto:$usethreads" in
17025         ":define")      d_setlocale_r_proto=define
17026                 set d_setlocale_r_proto setlocale_r $hdrs
17027                 eval $hasproto ;;
17028         *)      ;;
17029         esac
17030         case "$d_setlocale_r_proto" in
17031         define)
17032         case "$setlocale_r_proto" in
17033         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17034         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17035         esac
17036         case "$setlocale_r_proto" in
17037         ''|0)   d_setlocale_r=undef
17038                 setlocale_r_proto=0
17039                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17040         * )     case "$setlocale_r_proto" in
17041                 REENTRANT_PROTO*) ;;
17042                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17043                 esac
17044                 echo "Prototype: $try" ;;
17045         esac
17046         ;;
17047         *)      case "$usethreads" in
17048                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17049                 esac
17050                 d_setlocale_r=undef
17051                 setlocale_r_proto=0
17052                 ;;
17053         esac
17054         ;;
17055 *)      setlocale_r_proto=0
17056         ;;
17057 esac
17058
17059 : see if setnetent exists
17060 set setnetent d_setnent
17061 eval $inlibc
17062
17063 : see if setnetent_r exists
17064 set setnetent_r d_setnetent_r
17065 eval $inlibc
17066 case "$d_setnetent_r" in
17067 "$define")
17068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17069         case "$d_setnetent_r_proto:$usethreads" in
17070         ":define")      d_setnetent_r_proto=define
17071                 set d_setnetent_r_proto setnetent_r $hdrs
17072                 eval $hasproto ;;
17073         *)      ;;
17074         esac
17075         case "$d_setnetent_r_proto" in
17076         define)
17077         case "$setnetent_r_proto" in
17078         ''|0) try='int setnetent_r(int, struct netent_data*);'
17079         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17080         esac
17081         case "$setnetent_r_proto" in
17082         ''|0) try='void setnetent_r(int, struct netent_data*);'
17083         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17084         esac
17085         case "$setnetent_r_proto" in
17086         ''|0)   d_setnetent_r=undef
17087                 setnetent_r_proto=0
17088                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17089         * )     case "$setnetent_r_proto" in
17090                 REENTRANT_PROTO*) ;;
17091                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17092                 esac
17093                 echo "Prototype: $try" ;;
17094         esac
17095         ;;
17096         *)      case "$usethreads" in
17097                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17098                 esac
17099                 d_setnetent_r=undef
17100                 setnetent_r_proto=0
17101                 ;;
17102         esac
17103         ;;
17104 *)      setnetent_r_proto=0
17105         ;;
17106 esac
17107
17108 : see if setprotoent exists
17109 set setprotoent d_setpent
17110 eval $inlibc
17111
17112 : see if setpgid exists
17113 set setpgid d_setpgid
17114 eval $inlibc
17115
17116 : see if setpgrp2 exists
17117 set setpgrp2 d_setpgrp2
17118 eval $inlibc
17119
17120 : see if setpriority exists
17121 set setpriority d_setprior
17122 eval $inlibc
17123
17124 : see if setproctitle exists
17125 set setproctitle d_setproctitle
17126 eval $inlibc
17127
17128 : see if setprotoent_r exists
17129 set setprotoent_r d_setprotoent_r
17130 eval $inlibc
17131 case "$d_setprotoent_r" in
17132 "$define")
17133         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17134         case "$d_setprotoent_r_proto:$usethreads" in
17135         ":define")      d_setprotoent_r_proto=define
17136                 set d_setprotoent_r_proto setprotoent_r $hdrs
17137                 eval $hasproto ;;
17138         *)      ;;
17139         esac
17140         case "$d_setprotoent_r_proto" in
17141         define)
17142         case "$setprotoent_r_proto" in
17143         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17144         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17145         esac
17146         case "$setprotoent_r_proto" in
17147         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17148         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17149         esac
17150         case "$setprotoent_r_proto" in
17151         ''|0)   d_setprotoent_r=undef
17152                 setprotoent_r_proto=0
17153                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17154         * )     case "$setprotoent_r_proto" in
17155                 REENTRANT_PROTO*) ;;
17156                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17157                 esac
17158                 echo "Prototype: $try" ;;
17159         esac
17160         ;;
17161         *)      case "$usethreads" in
17162                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17163                 esac
17164                 d_setprotoent_r=undef
17165                 setprotoent_r_proto=0
17166                 ;;
17167         esac
17168         ;;
17169 *)      setprotoent_r_proto=0
17170         ;;
17171 esac
17172
17173 : see if setpwent exists
17174 set setpwent d_setpwent
17175 eval $inlibc
17176
17177 : see if setpwent_r exists
17178 set setpwent_r d_setpwent_r
17179 eval $inlibc
17180 case "$d_setpwent_r" in
17181 "$define")
17182         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17183         case "$d_setpwent_r_proto:$usethreads" in
17184         ":define")      d_setpwent_r_proto=define
17185                 set d_setpwent_r_proto setpwent_r $hdrs
17186                 eval $hasproto ;;
17187         *)      ;;
17188         esac
17189         case "$d_setpwent_r_proto" in
17190         define)
17191         case "$setpwent_r_proto" in
17192         ''|0) try='int setpwent_r(FILE**);'
17193         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17194         esac
17195         case "$setpwent_r_proto" in
17196         ''|0) try='void setpwent_r(FILE**);'
17197         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17198         esac
17199         case "$setpwent_r_proto" in
17200         ''|0)   d_setpwent_r=undef
17201                 setpwent_r_proto=0
17202                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17203         * )     case "$setpwent_r_proto" in
17204                 REENTRANT_PROTO*) ;;
17205                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17206                 esac
17207                 echo "Prototype: $try" ;;
17208         esac
17209         ;;
17210         *)      case "$usethreads" in
17211                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17212                 esac
17213                 d_setpwent_r=undef
17214                 setpwent_r_proto=0
17215                 ;;
17216         esac
17217         ;;
17218 *)      setpwent_r_proto=0
17219         ;;
17220 esac
17221
17222 : see if setregid exists
17223 set setregid d_setregid
17224 eval $inlibc
17225 set setresgid d_setresgid
17226 eval $inlibc
17227
17228 : see if setreuid exists
17229 set setreuid d_setreuid
17230 eval $inlibc
17231 set setresuid d_setresuid
17232 eval $inlibc
17233
17234 : see if setrgid exists
17235 set setrgid d_setrgid
17236 eval $inlibc
17237
17238 : see if setruid exists
17239 set setruid d_setruid
17240 eval $inlibc
17241
17242 : see if setservent exists
17243 set setservent d_setsent
17244 eval $inlibc
17245
17246 : see if setservent_r exists
17247 set setservent_r d_setservent_r
17248 eval $inlibc
17249 case "$d_setservent_r" in
17250 "$define")
17251         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17252         case "$d_setservent_r_proto:$usethreads" in
17253         ":define")      d_setservent_r_proto=define
17254                 set d_setservent_r_proto setservent_r $hdrs
17255                 eval $hasproto ;;
17256         *)      ;;
17257         esac
17258         case "$d_setservent_r_proto" in
17259         define)
17260         case "$setservent_r_proto" in
17261         ''|0) try='int setservent_r(int, struct servent_data*);'
17262         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17263         esac
17264         case "$setservent_r_proto" in
17265         ''|0) try='void setservent_r(int, struct servent_data*);'
17266         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17267         esac
17268         case "$setservent_r_proto" in
17269         ''|0)   d_setservent_r=undef
17270                 setservent_r_proto=0
17271                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17272         * )     case "$setservent_r_proto" in
17273                 REENTRANT_PROTO*) ;;
17274                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17275                 esac
17276                 echo "Prototype: $try" ;;
17277         esac
17278         ;;
17279         *)      case "$usethreads" in
17280                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17281                 esac
17282                 d_setservent_r=undef
17283                 setservent_r_proto=0
17284                 ;;
17285         esac
17286         ;;
17287 *)      setservent_r_proto=0
17288         ;;
17289 esac
17290
17291 : see if setsid exists
17292 set setsid d_setsid
17293 eval $inlibc
17294
17295 : see if setvbuf exists
17296 set setvbuf d_setvbuf
17297 eval $inlibc
17298
17299 : see if sfio.h is available
17300 set sfio.h i_sfio
17301 eval $inhdr
17302
17303 : see if sfio library is available
17304 case "$i_sfio" in
17305 $define)
17306         val=''
17307         set sfreserve val
17308         eval $inlibc
17309         ;;
17310 *)
17311         val="$undef"
17312         ;;
17313 esac
17314 : Ok, but do we want to use it.
17315 case "$val" in
17316 $define)
17317         case "$usesfio" in
17318         true|$define|[yY]*) dflt='y';;
17319         *) dflt='n';;
17320         esac
17321         echo "$package can use the sfio library, but it is experimental."
17322         rp="You seem to have sfio available, do you want to try using it?"
17323         . ./myread
17324         case "$ans" in
17325         y|Y)    echo "Ok, turning on sfio then."
17326                 val="$define"
17327                 ;;
17328         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17329                 val="$undef"
17330                 ;;
17331         esac
17332         ;;
17333 *)      case "$usesfio" in
17334         true|$define|[yY]*)
17335                 echo "Sorry, cannot find sfio on this machine." >&4
17336                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17337                 val="$undef"
17338                 ;;
17339         esac
17340         ;;
17341 esac
17342 set d_sfio
17343 eval $setvar
17344 case "$d_sfio" in
17345 $define) usesfio='true';;
17346 *) usesfio='false';;
17347 esac
17348 case "$d_sfio" in
17349 $define) ;;
17350 *)      : Remove sfio from list of libraries to use
17351         case "$libs" in
17352         *-lsfio*)
17353                 echo "Removing unneeded -lsfio from library list" >&4
17354                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17355                 shift
17356                 libs="$*"
17357                 echo "libs = $libs" >&4
17358                 ;;
17359         esac
17360 ;;
17361 esac
17362
17363
17364 : see if shmctl exists
17365 set shmctl d_shmctl
17366 eval $inlibc
17367
17368 : see if shmget exists
17369 set shmget d_shmget
17370 eval $inlibc
17371
17372 : see if shmat exists
17373 set shmat d_shmat
17374 eval $inlibc
17375 : see what shmat returns
17376 case "$d_shmat" in
17377 "$define")
17378         $cat >shmat.c <<'END'
17379 #include <sys/shm.h>
17380 void *shmat();
17381 END
17382         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17383                 shmattype='void *'
17384         else
17385                 shmattype='char *'
17386         fi
17387         echo "and it returns ($shmattype)." >&4
17388         : see if a prototype for shmat is available
17389         xxx=`./findhdr sys/shm.h`
17390         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17391         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17392                 val="$define"
17393         else
17394                 val="$undef"
17395         fi
17396         $rm -f shmat.[co]
17397         ;;
17398 *)
17399         val="$undef"
17400         ;;
17401 esac
17402 set d_shmatprototype
17403 eval $setvar
17404
17405 : see if shmdt exists
17406 set shmdt d_shmdt
17407 eval $inlibc
17408
17409 : see how much of the 'shm*(2)' library is present.
17410 h_shm=true
17411 echo " "
17412 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17413 *"$undef"*) h_shm=false;;
17414 esac
17415 case "$osname" in
17416 freebsd)
17417     case "`ipcs 2>&1`" in
17418     "SVID shared memory"*"not configured"*)
17419         echo "Your $osname does not have the shm*(2) configured." >&4
17420         h_shm=false
17421         val="$undef"
17422         set shmctl d_shmctl
17423         evat $setvar
17424         set shmget d_shmget
17425         evat $setvar
17426         set shmat d_shmat
17427         evat $setvar
17428         set shmdt d_shmdt
17429         evat $setvar
17430         ;;
17431     esac
17432     ;;
17433 esac
17434 : we could also check for sys/ipc.h ...
17435 if $h_shm && $test `./findhdr sys/shm.h`; then
17436         echo "You have the full shm*(2) library." >&4
17437         val="$define"
17438 else
17439         echo "You don't have the full shm*(2) library." >&4
17440         val="$undef"
17441 fi
17442 set d_shm
17443 eval $setvar
17444
17445 : see if we have sigaction
17446 echo " "
17447 if set sigaction val -f d_sigaction; eval $csym; $val; then
17448         echo 'sigaction() found.' >&4
17449         $cat > try.c <<EOP
17450 #include <stdio.h>
17451 #include <sys/types.h>
17452 #include <signal.h>
17453 #$i_stdlib I_STDLIB
17454 #ifdef I_STDLIB
17455 #include <stdlib.h>
17456 #endif
17457 int main()
17458 {
17459     struct sigaction act, oact;
17460     act.sa_flags = 0;
17461     oact.sa_handler = 0;
17462     /* so that act and oact are used */
17463     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17464 }
17465 EOP
17466         set try
17467         if eval $compile_ok; then
17468                 val="$define"
17469         else
17470                 echo "But you don't seem to have a useable struct sigaction." >&4
17471                 val="$undef"
17472         fi
17473 else
17474         echo 'sigaction NOT found.' >&4
17475         val="$undef"
17476 fi
17477 set d_sigaction; eval $setvar
17478 $rm_try
17479
17480 : see if this is a sunmath.h system
17481 set sunmath.h i_sunmath
17482 eval $inhdr
17483
17484 : see if signbit exists
17485 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17486 $cat >try.c <<EOCP
17487 #$i_math I_MATH
17488 #$i_sunmath I_SUNMATH
17489 #ifdef I_MATH
17490 #  include <math.h>
17491 #endif
17492 #ifdef I_SUNMATH  /* Solaris special math library */
17493 #  include <sunmath.h>
17494 #endif
17495 #define NV $nvtype
17496 int main(int argc, char **argv)
17497 {
17498     NV x = 0.0;
17499     NV y = -0.0;
17500     if ((signbit(x) == 0) && (signbit(y) != 0))
17501         return 0;
17502     else
17503         return 1;
17504 }
17505 EOCP
17506 val="$undef"
17507 set try
17508 if eval $compile; then
17509     if $run ./try; then
17510         $echo "Yes." >&4
17511         val="$define"
17512     else
17513         $echo "Signbit seems to be available, but doesn't work as I expected."
17514         $echo "I won't use it." >&4
17515         val="$undef"
17516     fi
17517 else
17518     $echo "Nope." >&4
17519     dflt="$undef"
17520 fi
17521 set d_signbit
17522 eval $setvar
17523 $rm_try
17524
17525 : see if sigprocmask exists
17526 set sigprocmask d_sigprocmask
17527 eval $inlibc
17528
17529 : see if sigsetjmp exists
17530 echo " "
17531 case "$d_sigsetjmp" in
17532 '')
17533         $cat >try.c <<EOP
17534 #include <setjmp.h>
17535 #$i_stdlib I_STDLIB
17536 #ifdef I_STDLIB
17537 #include <stdlib.h>
17538 #endif
17539 sigjmp_buf env;
17540 int set = 1;
17541 int main()
17542 {
17543         if (sigsetjmp(env,1))
17544                 exit(set);
17545         set = 0;
17546         siglongjmp(env, 1);
17547         exit(1);
17548 }
17549 EOP
17550         set try
17551         if eval $compile; then
17552                 if $run ./try >/dev/null 2>&1; then
17553                         echo "POSIX sigsetjmp found." >&4
17554                         val="$define"
17555                 else
17556                         $cat >&4 <<EOM
17557 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17558 I'll ignore them.
17559 EOM
17560                         val="$undef"
17561                 fi
17562         else
17563                 echo "sigsetjmp not found." >&4
17564                 val="$undef"
17565         fi
17566         ;;
17567 *) val="$d_sigsetjmp"
17568         case "$d_sigsetjmp" in
17569         $define) echo "POSIX sigsetjmp found." >&4;;
17570         $undef) echo "sigsetjmp not found." >&4;;
17571         esac
17572         ;;
17573 esac
17574 set d_sigsetjmp
17575 eval $setvar
17576 $rm_try
17577
17578 : see if snprintf exists
17579 set snprintf d_snprintf
17580 eval $inlibc
17581
17582 : see if vsnprintf exists
17583 set vsnprintf d_vsnprintf
17584 eval $inlibc
17585
17586 case "$d_snprintf-$d_vsnprintf" in
17587 "$define-$define")
17588     $cat <<EOM
17589 Checking whether your snprintf() and vsnprintf() work okay...
17590 EOM
17591     $cat >try.c <<'EOCP'
17592 /* v?snprintf testing logic courtesy of Russ Allbery.
17593  * According to C99:
17594  * - if the buffer is too short it still must be \0-terminated
17595  * - if the buffer is too short the potentially required length
17596  *   must be returned and not -1
17597  * - if the buffer is NULL the potentially required length
17598  *   must be returned and not -1 or core dump
17599  */
17600 #include <stdio.h>
17601 #include <stdarg.h>
17602
17603 char buf[2];
17604
17605 int test (char *format, ...)
17606 {
17607     va_list args;
17608     int count;
17609
17610     va_start (args, format);
17611     count = vsnprintf (buf, sizeof buf, format, args);
17612     va_end (args);
17613     return count;
17614 }
17615
17616 int main ()
17617 {
17618     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17619              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17620 }
17621 EOCP
17622     set try
17623     if eval $compile; then
17624         `$run ./try`
17625         case "$?" in
17626         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17627         *) cat <<EOM >&4
17628 Your snprintf() and snprintf() don't seem to be working okay.
17629 EOM
17630            d_snprintf="$undef"
17631            d_vsnprintf="$undef"
17632            ;;
17633         esac
17634     else
17635         echo "(I can't seem to compile the test program--assuming they don't)"
17636         d_snprintf="$undef"
17637         d_vsnprintf="$undef"
17638     fi
17639     $rm_try
17640     ;;
17641 esac
17642
17643 : see if sockatmark exists
17644 set sockatmark d_sockatmark
17645 eval $inlibc
17646
17647 : see if prototype for sockatmark is available
17648 echo " "
17649 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17650 eval $hasproto
17651
17652 : see if socks5_init exists
17653 set socks5_init d_socks5_init
17654 eval $inlibc
17655
17656 : see if sprintf returns the length of the string in the buffer as per ANSI
17657 $echo "Checking whether sprintf returns the length of the string..." >&4
17658 $cat <<EOP >try.c
17659 #include <stdio.h>
17660 #$i_stdlib I_STDLIB
17661 #ifdef I_STDLIB
17662 #include <stdlib.h>
17663 #endif
17664 #$i_string I_STRING
17665 #ifdef I_STRING
17666 #  include <string.h>
17667 #else
17668 #  include <strings.h>
17669 #endif
17670 #$i_math I_MATH
17671 #ifdef I_MATH
17672 #include <math.h>
17673 #endif
17674
17675 char buffer[256];
17676
17677 int check (size_t expect, int test) {
17678   size_t got = strlen(buffer);
17679   if (expect == got)
17680     return 0;
17681
17682   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17683        test, buffer);
17684   exit (test);
17685 }
17686
17687 int main(int argc, char **argv) {
17688   int test = 0;
17689
17690   check(sprintf(buffer, ""), ++test);
17691   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17692   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17693
17694   return 0;
17695 }
17696 EOP
17697 set try
17698
17699 if eval $compile; then
17700     xxx="`$run ./try`"
17701     case "$?" in
17702         0) cat >&4 <<EOM
17703 sprintf returns the length of the string (as ANSI says it should)
17704 EOM
17705         d_sprintf_returns_strlen="$define"
17706         ;;
17707         *) cat >&4 <<EOM
17708 sprintf does not return the length of the string (how old is this system?)
17709 EOM
17710         d_sprintf_returns_strlen="$undef"
17711         ;;
17712     esac
17713 else
17714     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17715     d_sprintf_returns_strlen="$undef"
17716 fi
17717 $rm_try
17718
17719 : see if srand48_r exists
17720 set srand48_r d_srand48_r
17721 eval $inlibc
17722 case "$d_srand48_r" in
17723 "$define")
17724         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17725         case "$d_srand48_r_proto:$usethreads" in
17726         ":define")      d_srand48_r_proto=define
17727                 set d_srand48_r_proto srand48_r $hdrs
17728                 eval $hasproto ;;
17729         *)      ;;
17730         esac
17731         case "$d_srand48_r_proto" in
17732         define)
17733         case "$srand48_r_proto" in
17734         ''|0) try='int srand48_r(long, struct drand48_data*);'
17735         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17736         esac
17737         case "$srand48_r_proto" in
17738         ''|0)   d_srand48_r=undef
17739                 srand48_r_proto=0
17740                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17741         * )     case "$srand48_r_proto" in
17742                 REENTRANT_PROTO*) ;;
17743                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17744                 esac
17745                 echo "Prototype: $try" ;;
17746         esac
17747         ;;
17748         *)      case "$usethreads" in
17749                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17750                 esac
17751                 d_srand48_r=undef
17752                 srand48_r_proto=0
17753                 ;;
17754         esac
17755         ;;
17756 *)      srand48_r_proto=0
17757         ;;
17758 esac
17759
17760 : see if srandom_r exists
17761 set srandom_r d_srandom_r
17762 eval $inlibc
17763 case "$d_srandom_r" in
17764 "$define")
17765         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17766         case "$d_srandom_r_proto:$usethreads" in
17767         ":define")      d_srandom_r_proto=define
17768                 set d_srandom_r_proto srandom_r $hdrs
17769                 eval $hasproto ;;
17770         *)      ;;
17771         esac
17772         case "$d_srandom_r_proto" in
17773         define)
17774         case "$srandom_r_proto" in
17775         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17776         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17777         esac
17778         case "$srandom_r_proto" in
17779         ''|0)   d_srandom_r=undef
17780                 srandom_r_proto=0
17781                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17782         * )     case "$srandom_r_proto" in
17783                 REENTRANT_PROTO*) ;;
17784                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17785                 esac
17786                 echo "Prototype: $try" ;;
17787         esac
17788         ;;
17789         *)      case "$usethreads" in
17790                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17791                 esac
17792                 d_srandom_r=undef
17793                 srandom_r_proto=0
17794                 ;;
17795         esac
17796         ;;
17797 *)      srandom_r_proto=0
17798         ;;
17799 esac
17800
17801 : see if prototype for setresgid is available
17802 echo " "
17803 set d_sresgproto setresgid $i_unistd unistd.h
17804 eval $hasproto
17805
17806 : see if prototype for setresuid is available
17807 echo " "
17808 set d_sresuproto setresuid $i_unistd unistd.h
17809 eval $hasproto
17810
17811 : see if sys/stat.h is available
17812 set sys/stat.h i_sysstat
17813 eval $inhdr
17814
17815 : see if stat knows about block sizes
17816 echo " "
17817 echo "Checking to see if your struct stat has st_blocks field..." >&4
17818 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17819 eval $hasfield
17820
17821 : see if this is a sys/vfs.h system
17822 set sys/vfs.h i_sysvfs
17823 eval $inhdr
17824
17825 : see if this is a sys/statfs.h system
17826 set sys/statfs.h i_sysstatfs
17827 eval $inhdr
17828
17829 : Check for statfs_s
17830 echo " "
17831 echo "Checking to see if your system supports struct statfs..." >&4
17832 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
17833 eval $hasstruct
17834 case "$d_statfs_s" in
17835 "$define")      echo "Yes, it does."   ;;
17836 *)              echo "No, it doesn't." ;;
17837 esac
17838
17839
17840 : see if struct statfs knows about f_flags
17841 case "$d_statfs_s" in
17842 define)
17843         echo " "
17844         echo "Checking to see if your struct statfs has f_flags field..." >&4
17845         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
17846         eval $hasfield
17847         ;;
17848 *)      val="$undef"
17849         set d_statfs_f_flags
17850         eval $setvar
17851         ;;
17852 esac
17853 case "$d_statfs_f_flags" in
17854 "$define")      echo "Yes, it does."   ;;
17855 *)              echo "No, it doesn't." ;;
17856 esac
17857
17858 : see what flavor, if any, of static inline is supported
17859 echo " "
17860 echo "Checking to see if your system supports static inline..."
17861 $cat > try.c <<'EOCP'
17862 #include <stdlib.h>
17863 extern int f_via_a(int x);
17864 extern int f_via_b(int x);
17865 int main(int argc, char **argv)
17866 {
17867     int y;
17868
17869     y = f_via_a(0);
17870 #ifdef USE_B
17871     y = f_via_b(0);
17872 #endif
17873     if (y == 42) {
17874         return EXIT_SUCCESS;
17875     }
17876     else {
17877         return EXIT_FAILURE;
17878     }
17879 }
17880 EOCP
17881 $cat > a.c <<'EOCP'
17882 static INLINE int f(int x) {
17883     int y;
17884     y = x + 42;
17885     return y;
17886 }
17887
17888 int f_via_a(int x)
17889 {
17890     return f(x);
17891 }
17892 EOCP
17893 $cat > b.c <<'EOCP'
17894 extern int f(int x);
17895
17896 int f_via_b(int x)
17897 {
17898     return f(x);
17899 }
17900 EOCP
17901
17902 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17903 case "$perl_static_inline" in
17904 '')     # Check the various possibilities, and break out on success.
17905         # For gcc, prefer __inline__, which will still permit 
17906         # cflags.SH to add in -ansi.
17907         case "$gccversion" in
17908                 '') xxx="inline __inline__ __inline _inline";;
17909                 *)  xxx="__inline__ inline __inline _inline";;
17910         esac
17911         for inline in $xxx; do
17912                 set try -DINLINE=$inline a.c
17913                 if eval $compile && $run ./try; then
17914                         # Now make sure there is no external linkage of static
17915                         # functions
17916                         set try -DINLINE=$inline -DUSE_B a.c b.c
17917                         if eval $compile && $run ./try; then
17918                                 $echo "Your compiler supports static $inline, " >&4
17919                                 $echo "but it also creates an external definition," >&4
17920                                 $echo "so I won't use it." >&4
17921                                 val=$undef
17922                         else
17923                                 $echo "Your compiler supports static $inline." >&4
17924                                 val=$define
17925                                 perl_static_inline="static $inline";
17926                                 break;
17927                         fi
17928                 else
17929                         $echo "Your compiler does NOT support static $inline." >&4
17930                         val="$undef"
17931                 fi
17932         done
17933         ;;
17934 *inline*) # Some variant of inline exists.
17935         echo "Keeping your $hint value of $perl_static_inline."
17936         val=$define
17937         ;;
17938 static)  # No inline capabilities
17939         echo "Keeping your $hint value of $perl_static_inline."
17940         val=$undef
17941         ;;
17942 *)  # Unrecognized previous value -- blindly trust the supplied
17943         # value and hope it makes sense.  Use old value for
17944         # d_static_inline, if there is one.
17945         echo "Keeping your $hint value of $perl_static_inline."
17946         case "$d_static_inline" in
17947                 '') val=$define ;;
17948                 *)  val=$d_static_inline ;;
17949         esac
17950         ;;
17951 esac
17952 # Fallback to plain 'static' if nothing worked.
17953 case "$perl_static_inline" in
17954 '')
17955         perl_static_inline="static"
17956         val=$undef
17957         ;;
17958 esac
17959 set d_static_inline
17960 eval $setvar
17961 $rm -f a.[co] b.[co]
17962 $rm_try
17963
17964 : Check stream access
17965 $cat >&4 <<EOM
17966 Checking how to access stdio streams by file descriptor number...
17967 EOM
17968 case "$stdio_stream_array" in
17969 '')     $cat >try.c <<EOCP
17970 #include <stdio.h>
17971 int main() {
17972   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17973     printf("yes\n");
17974 }
17975 EOCP
17976         for s in _iob __iob __sF
17977         do
17978                 set try -DSTDIO_STREAM_ARRAY=$s
17979                 if eval $compile; then
17980                         case "`$run ./try`" in
17981                         yes)    stdio_stream_array=$s; break ;;
17982                         esac
17983                 fi
17984         done
17985         $rm_try
17986 esac
17987 case "$stdio_stream_array" in
17988 '')     $cat >&4 <<EOM
17989 I can't figure out how to access stdio streams by file descriptor number.
17990 EOM
17991         d_stdio_stream_array="$undef"
17992         ;;
17993 *)      $cat >&4 <<EOM
17994 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17995 EOM
17996         d_stdio_stream_array="$define"
17997         ;;
17998 esac
17999
18000 : see if strcoll exists
18001 set strcoll d_strcoll
18002 eval $inlibc
18003
18004 : check for structure copying
18005 echo " "
18006 echo "Checking to see if your C compiler can copy structs..." >&4
18007 $cat >try.c <<'EOCP'
18008 int main()
18009 {
18010         struct blurfl {
18011                 int dyick;
18012         } foo, bar;
18013
18014         foo = bar;
18015 }
18016 EOCP
18017 if $cc -c try.c >/dev/null 2>&1 ; then
18018         val="$define"
18019         echo "Yup, it can."
18020 else
18021         val="$undef"
18022         echo "Nope, it can't."
18023 fi
18024 set d_strctcpy
18025 eval $setvar
18026 $rm_try
18027
18028 : see if strerror and/or sys_errlist[] exist
18029 echo " "
18030 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18031     if set strerror val -f d_strerror; eval $csym; $val; then
18032                 echo 'strerror() found.' >&4
18033                 d_strerror="$define"
18034                 d_strerrm='strerror(e)'
18035                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18036                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18037                         d_syserrlst="$define"
18038                 else
18039                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18040                         d_syserrlst="$undef"
18041                 fi
18042     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18043                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18044                 echo 'strerror() found in string header.' >&4
18045                 d_strerror="$define"
18046                 d_strerrm='strerror(e)'
18047                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18048                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18049                                 d_syserrlst="$define"
18050                 else
18051                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18052                         d_syserrlst="$undef"
18053                 fi
18054     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18055                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18056                 d_strerror="$undef"
18057                 d_syserrlst="$define"
18058                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18059     else
18060                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18061                 d_strerror="$undef"
18062                 d_syserrlst="$undef"
18063                 d_strerrm='"unknown"'
18064     fi
18065 fi
18066
18067 : see if strerror_r exists
18068 set strerror_r d_strerror_r
18069 eval $inlibc
18070 case "$d_strerror_r" in
18071 "$define")
18072         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18073         case "$d_strerror_r_proto:$usethreads" in
18074         ":define")      d_strerror_r_proto=define
18075                 set d_strerror_r_proto strerror_r $hdrs
18076                 eval $hasproto ;;
18077         *)      ;;
18078         esac
18079         case "$d_strerror_r_proto" in
18080         define)
18081         case "$strerror_r_proto" in
18082         ''|0) try='int strerror_r(int, char*, size_t);'
18083         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18084         esac
18085         case "$strerror_r_proto" in
18086         ''|0) try='int strerror_r(int, char*, int);'
18087         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18088         esac
18089         case "$strerror_r_proto" in
18090         ''|0) try='char* strerror_r(int, char*, size_t);'
18091         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18092         esac
18093         case "$strerror_r_proto" in
18094         ''|0)   d_strerror_r=undef
18095                 strerror_r_proto=0
18096                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18097         * )     case "$strerror_r_proto" in
18098                 REENTRANT_PROTO*) ;;
18099                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18100                 esac
18101                 echo "Prototype: $try" ;;
18102         esac
18103         ;;
18104         *)      case "$usethreads" in
18105                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18106                 esac
18107                 d_strerror_r=undef
18108                 strerror_r_proto=0
18109                 ;;
18110         esac
18111         ;;
18112 *)      strerror_r_proto=0
18113         ;;
18114 esac
18115
18116 : see if strftime exists
18117 set strftime d_strftime
18118 eval $inlibc
18119
18120 : see if strlcat exists
18121 set strlcat d_strlcat
18122 eval $inlibc
18123
18124 : see if strlcpy exists
18125 set strlcpy d_strlcpy
18126 eval $inlibc
18127
18128 : see if strtod exists
18129 set strtod d_strtod
18130 eval $inlibc
18131
18132 : see if strtol exists
18133 set strtol d_strtol
18134 eval $inlibc
18135
18136 : see if strtold exists
18137 set strtold d_strtold
18138 eval $inlibc
18139
18140 : see if strtoll exists
18141 set strtoll d_strtoll
18142 eval $inlibc
18143
18144 case "$d_longlong-$d_strtoll" in
18145 "$define-$define")
18146         $cat <<EOM
18147 Checking whether your strtoll() works okay...
18148 EOM
18149         $cat >try.c <<'EOCP'
18150 #include <errno.h>
18151 #ifdef __hpux
18152 #define strtoll __strtoll
18153 #endif
18154 #ifdef __EMX__
18155 #define strtoll _strtoll
18156 #endif
18157 #include <stdio.h>
18158 extern long long int strtoll(char *s, char **, int);
18159 static int bad = 0;
18160 int check(char *s, long long ell, int een) {
18161         long long gll;
18162         errno = 0;
18163         gll = strtoll(s, 0, 10);
18164         if (!((gll == ell) && (errno == een)))
18165                 bad++;
18166 }
18167 int main() {
18168         check(" 1",                                      1LL, 0);
18169         check(" 0",                                      0LL, 0);
18170         check("-1",                                     -1LL, 0);
18171         check("-9223372036854775808", -9223372036854775808LL, 0);
18172         check("-9223372036854775808", -9223372036854775808LL, 0);
18173         check(" 9223372036854775807",  9223372036854775807LL, 0);
18174         check("-9223372036854775808", -9223372036854775808LL, 0);
18175         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18176         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18177         if (!bad)
18178                 printf("ok\n");
18179 }
18180 EOCP
18181         set try
18182         if eval $compile; then
18183                 yyy=`$run ./try`
18184                 case "$yyy" in
18185                 ok) echo "Your strtoll() seems to be working okay." ;;
18186                 *) cat <<EOM >&4
18187 Your strtoll() doesn't seem to be working okay.
18188 EOM
18189                    d_strtoll="$undef"
18190                    ;;
18191                 esac
18192         else
18193                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18194                 d_strtoll="$undef"
18195         fi
18196         ;;
18197 esac
18198
18199 : see if strtoq exists
18200 set strtoq d_strtoq
18201 eval $inlibc
18202
18203 : see if strtoul exists
18204 set strtoul d_strtoul
18205 eval $inlibc
18206
18207 case "$d_strtoul" in
18208 "$define")
18209         $cat <<EOM
18210 Checking whether your strtoul() works okay...
18211 EOM
18212         $cat >try.c <<'EOCP'
18213 #include <errno.h>
18214 #include <stdio.h>
18215 extern unsigned long int strtoul(char *s, char **, int);
18216 static int bad = 0;
18217 void check(char *s, unsigned long eul, int een) {
18218         unsigned long gul;
18219         errno = 0;
18220         gul = strtoul(s, 0, 10);
18221         if (!((gul == eul) && (errno == een)))
18222                 bad++;
18223 }
18224 int main() {
18225         check(" 1", 1L, 0);
18226         check(" 0", 0L, 0);
18227 EOCP
18228         case "$longsize" in
18229         8)
18230             $cat >>try.c <<'EOCP'
18231         check("18446744073709551615", 18446744073709551615UL, 0);
18232         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18233 #if 0 /* strtoul() for /^-/ strings is undefined. */
18234         check("-1", 18446744073709551615UL, 0);
18235         check("-18446744073709551614", 2, 0);
18236         check("-18446744073709551615", 1, 0);
18237         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18238         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18239 #endif
18240 EOCP
18241                 ;;
18242         4)
18243                     $cat >>try.c <<'EOCP'
18244         check("4294967295", 4294967295UL, 0);
18245         check("4294967296", 4294967295UL, ERANGE);
18246 #if 0 /* strtoul() for /^-/ strings is undefined. */
18247         check("-1", 4294967295UL, 0);
18248         check("-4294967294", 2, 0);
18249         check("-4294967295", 1, 0);
18250         check("-4294967296", 4294967295UL, ERANGE);
18251         check("-4294967297", 4294967295UL, ERANGE);
18252 #endif
18253 EOCP
18254                 ;;
18255         *)
18256 : Should we write these tests to be more portable by sprintf-ing
18257 : ~0 and then manipulating that char string as input for strtol?
18258                 ;;
18259         esac
18260         $cat >>try.c <<'EOCP'
18261         if (!bad)
18262                 printf("ok\n");
18263         return 0;
18264 }
18265 EOCP
18266         set try
18267         if eval $compile; then
18268                 case "`$run ./try`" in
18269                 ok) echo "Your strtoul() seems to be working okay." ;;
18270                 *) cat <<EOM >&4
18271 Your strtoul() doesn't seem to be working okay.
18272 EOM
18273                    d_strtoul="$undef"
18274                    ;;
18275                 esac
18276         else
18277                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18278                 d_strtoul="$undef"
18279         fi
18280         ;;
18281 esac
18282
18283 : see if strtoull exists
18284 set strtoull d_strtoull
18285 eval $inlibc
18286
18287 case "$d_longlong-$d_strtoull" in
18288 "$define-$define")
18289         $cat <<EOM
18290 Checking whether your strtoull() works okay...
18291 EOM
18292         $cat >try.c <<'EOCP'
18293 #include <errno.h>
18294 #ifdef __hpux
18295 #define strtoull __strtoull
18296 #endif
18297 #include <stdio.h>
18298 extern unsigned long long int strtoull(char *s, char **, int);
18299 static int bad = 0;
18300 int check(char *s, long long eull, int een) {
18301         long long gull;
18302         errno = 0;
18303         gull = strtoull(s, 0, 10);
18304         if (!((gull == eull) && (errno == een)))
18305                 bad++;
18306 }
18307 int main() {
18308         check(" 1",                                        1LL, 0);
18309         check(" 0",                                        0LL, 0);
18310         check("18446744073709551615",  18446744073709551615ULL, 0);
18311         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18312 #if 0 /* strtoull() for /^-/ strings is undefined. */
18313         check("-1",                    18446744073709551615ULL, 0);
18314         check("-18446744073709551614",                     2LL, 0);
18315         check("-18446744073709551615",                     1LL, 0);
18316         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18317         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18318 #endif
18319         if (!bad)
18320                 printf("ok\n");
18321 }
18322 EOCP
18323         set try
18324         if eval $compile; then
18325                 case "`$run ./try`" in
18326                 ok) echo "Your strtoull() seems to be working okay." ;;
18327                 *) cat <<EOM >&4
18328 Your strtoull() doesn't seem to be working okay.
18329 EOM
18330                    d_strtoull="$undef"
18331                    ;;
18332                 esac
18333         else
18334                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18335                 d_strtoull="$undef"
18336         fi
18337         ;;
18338 esac
18339
18340 : see if strtouq exists
18341 set strtouq d_strtouq
18342 eval $inlibc
18343
18344 case "$d_strtouq" in
18345 "$define")
18346         $cat <<EOM
18347 Checking whether your strtouq() works okay...
18348 EOM
18349         $cat >try.c <<'EOCP'
18350 #include <errno.h>
18351 #include <stdio.h>
18352 extern unsigned long long int strtouq(char *s, char **, int);
18353 static int bad = 0;
18354 void check(char *s, unsigned long long eull, int een) {
18355         unsigned long long gull;
18356         errno = 0;
18357         gull = strtouq(s, 0, 10);
18358         if (!((gull == eull) && (errno == een)))
18359                 bad++;
18360 }
18361 int main() {
18362         check(" 1",                                        1LL, 0);
18363         check(" 0",                                        0LL, 0);
18364         check("18446744073709551615",  18446744073709551615ULL, 0);
18365         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18366 #if 0 /* strtouq() for /^-/ strings is undefined. */
18367         check("-1",                    18446744073709551615ULL, 0);
18368         check("-18446744073709551614",                     2LL, 0);
18369         check("-18446744073709551615",                     1LL, 0);
18370         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18371         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18372 #endif
18373         if (!bad)
18374                 printf("ok\n");
18375         return 0;
18376 }
18377 EOCP
18378         set try
18379         if eval $compile; then
18380                 case "`$run ./try`" in
18381                 ok) echo "Your strtouq() seems to be working okay." ;;
18382                 *) cat <<EOM >&4
18383 Your strtouq() doesn't seem to be working okay.
18384 EOM
18385                    d_strtouq="$undef"
18386                    ;;
18387                 esac
18388         else
18389                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18390                 d_strtouq="$undef"
18391         fi
18392         ;;
18393 esac
18394
18395 : see if strxfrm exists
18396 set strxfrm d_strxfrm
18397 eval $inlibc
18398
18399 : see if symlink exists
18400 set symlink d_symlink
18401 eval $inlibc
18402
18403 : see if syscall exists
18404 set syscall d_syscall
18405 eval $inlibc
18406
18407 : see if prototype for syscall is available
18408 echo " "
18409 set d_syscallproto syscall $i_unistd unistd.h
18410 eval $hasproto
18411
18412 : see if sysconf exists
18413 set sysconf d_sysconf
18414 eval $inlibc
18415
18416 : see if system exists
18417 set system d_system
18418 eval $inlibc
18419
18420 : see if tcgetpgrp exists
18421 set tcgetpgrp d_tcgetpgrp
18422 eval $inlibc
18423
18424 : see if tcsetpgrp exists
18425 set tcsetpgrp d_tcsetpgrp
18426 eval $inlibc
18427
18428 : see if prototype for telldir is available
18429 echo " "
18430 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18431 eval $hasproto
18432
18433 : see if time exists
18434 echo " "
18435 if test "X$d_time" = X -o X"$timetype" = X; then
18436     if set time val -f d_time; eval $csym; $val; then
18437                 echo 'time() found.' >&4
18438                 val="$define"
18439                 rp="What is the type returned by time() on this system?"
18440                 set time_t timetype long stdio.h sys/types.h
18441                 eval $typedef_ask
18442     else
18443                 echo 'time() not found, hope that will do.' >&4
18444                 val="$undef"
18445                 timetype='int';
18446     fi
18447     set d_time
18448     eval $setvar
18449 fi
18450
18451 : see if timegm exists
18452 set timegm d_timegm
18453 eval $inlibc
18454
18455 : see if this is a sys/times.h system
18456 set sys/times.h i_systimes
18457 eval $inhdr
18458
18459 : see if times exists
18460 echo " "
18461 if set times val -f d_times; eval $csym; $val; then
18462         echo 'times() found.' >&4
18463         d_times="$define"
18464         inc=''
18465         case "$i_systimes" in
18466         "$define") inc='sys/times.h';;
18467         esac
18468         rp="What is the type returned by times() on this system?"
18469         set clock_t clocktype long stdio.h sys/types.h $inc
18470         eval $typedef_ask
18471 else
18472         echo 'times() NOT found, hope that will do.' >&4
18473         d_times="$undef"
18474         clocktype='int'
18475 fi
18476
18477 : see if tmpnam_r exists
18478 set tmpnam_r d_tmpnam_r
18479 eval $inlibc
18480 case "$d_tmpnam_r" in
18481 "$define")
18482         hdrs="$i_systypes sys/types.h define stdio.h "
18483         case "$d_tmpnam_r_proto:$usethreads" in
18484         ":define")      d_tmpnam_r_proto=define
18485                 set d_tmpnam_r_proto tmpnam_r $hdrs
18486                 eval $hasproto ;;
18487         *)      ;;
18488         esac
18489         case "$d_tmpnam_r_proto" in
18490         define)
18491         case "$tmpnam_r_proto" in
18492         ''|0) try='char* tmpnam_r(char*);'
18493         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18494         esac
18495         case "$tmpnam_r_proto" in
18496         ''|0)   d_tmpnam_r=undef
18497                 tmpnam_r_proto=0
18498                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18499         * )     case "$tmpnam_r_proto" in
18500                 REENTRANT_PROTO*) ;;
18501                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18502                 esac
18503                 echo "Prototype: $try" ;;
18504         esac
18505         ;;
18506         *)      case "$usethreads" in
18507                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18508                 esac
18509                 d_tmpnam_r=undef
18510                 tmpnam_r_proto=0
18511                 ;;
18512         esac
18513         ;;
18514 *)      tmpnam_r_proto=0
18515         ;;
18516 esac
18517
18518 : see if truncate exists
18519 set truncate d_truncate
18520 eval $inlibc
18521
18522 : see if ttyname_r exists
18523 set ttyname_r d_ttyname_r
18524 eval $inlibc
18525 case "$d_ttyname_r" in
18526 "$define")
18527         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18528         case "$d_ttyname_r_proto:$usethreads" in
18529         ":define")      d_ttyname_r_proto=define
18530                 set d_ttyname_r_proto ttyname_r $hdrs
18531                 eval $hasproto ;;
18532         *)      ;;
18533         esac
18534         case "$d_ttyname_r_proto" in
18535         define)
18536         case "$ttyname_r_proto" in
18537         ''|0) try='int ttyname_r(int, char*, size_t);'
18538         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18539         esac
18540         case "$ttyname_r_proto" in
18541         ''|0) try='int ttyname_r(int, char*, int);'
18542         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18543         esac
18544         case "$ttyname_r_proto" in
18545         ''|0) try='char* ttyname_r(int, char*, int);'
18546         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18547         esac
18548         case "$ttyname_r_proto" in
18549         ''|0)   d_ttyname_r=undef
18550                 ttyname_r_proto=0
18551                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18552         * )     case "$ttyname_r_proto" in
18553                 REENTRANT_PROTO*) ;;
18554                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18555                 esac
18556                 echo "Prototype: $try" ;;
18557         esac
18558         ;;
18559         *)      case "$usethreads" in
18560                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18561                 esac
18562                 d_ttyname_r=undef
18563                 ttyname_r_proto=0
18564                 ;;
18565         esac
18566         ;;
18567 *)      ttyname_r_proto=0
18568         ;;
18569 esac
18570
18571 : see if tzname[] exists
18572 echo " "
18573 if set tzname val -a d_tzname; eval $csym; $val; then
18574         val="$define"
18575         echo 'tzname[] found.' >&4
18576 else
18577         val="$undef"
18578         echo 'tzname[] NOT found.' >&4
18579 fi
18580 set d_tzname
18581 eval $setvar
18582
18583 : Check if is a multiplatform env
18584 case "$osname" in
18585 next|rhapsody|darwin) multiarch="$define" ;;
18586 esac
18587 case "$multiarch" in
18588 ''|[nN]*) multiarch="$undef" ;;
18589 esac
18590
18591 : check for ordering of bytes in a UV
18592 echo " "
18593 case "$usecrosscompile$multiarch" in
18594 *$define*)
18595         $cat <<EOM
18596 You seem to be either cross-compiling or doing a multiarchitecture build,
18597 skipping the byteorder check.
18598
18599 EOM
18600         byteorder='ffff'
18601         ;;
18602 *)
18603         case "$byteorder" in
18604         '')
18605                 $cat <<'EOM'
18606 In the following, larger digits indicate more significance.  A big-endian
18607 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18608 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18609 machines may have weird orders like 3412.  A Cray will report 87654321,
18610 an Alpha will report 12345678. If the test program works the default is
18611 probably right.
18612 I'm now running the test program...
18613 EOM
18614                 $cat >try.c <<EOCP
18615 #include <stdio.h>
18616 #$i_stdlib I_STDLIB
18617 #ifdef I_STDLIB
18618 #include <stdlib.h>
18619 #endif
18620 #include <sys/types.h>
18621 typedef $uvtype UV;
18622 int main()
18623 {
18624         int i;
18625         union {
18626                 UV l;
18627                 char c[$uvsize];
18628         } u;
18629
18630         if ($uvsize > 4)
18631                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18632         else
18633                 u.l = (UV)0x04030201;
18634         for (i = 0; i < $uvsize; i++)
18635                 printf("%c", u.c[i]+'0');
18636         printf("\n");
18637         exit(0);
18638 }
18639 EOCP
18640                 xxx_prompt=y
18641                 set try
18642                 if eval $compile && $run ./try > /dev/null; then
18643                         dflt=`$run ./try`
18644                         case "$dflt" in
18645                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18646                                 echo "(The test program ran ok.)"
18647                                 echo "byteorder=$dflt"
18648                                 xxx_prompt=n
18649                         ;;
18650                         ????|????????) echo "(The test program ran ok.)" ;;
18651                         *) echo "(The test program didn't run right for some reason.)" ;;
18652                         esac
18653                 else
18654                         dflt='4321'
18655                         cat <<'EOM'
18656 (I can't seem to compile the test program.  Guessing big-endian...)
18657 EOM
18658                 fi
18659                 case "$xxx_prompt" in
18660                 y)
18661                         rp="What is the order of bytes in $uvtype?"
18662                         . ./myread
18663                         byteorder="$ans"
18664                         ;;
18665                 *)      byteorder=$dflt
18666                         ;;
18667                 esac
18668                 ;;
18669         esac
18670         $rm_try
18671         ;;
18672 esac
18673
18674 : Checking 32bit alignedness
18675 $cat <<EOM
18676
18677 Checking to see whether you can access character data unalignedly...
18678 EOM
18679 case "$d_u32align" in
18680 '')   $cat >try.c <<EOCP
18681 #include <stdio.h>
18682 #$i_stdlib I_STDLIB
18683 #ifdef I_STDLIB
18684 #include <stdlib.h>
18685 #endif
18686 #define U32 $u32type
18687 #define BYTEORDER 0x$byteorder
18688 #define U8 $u8type
18689 #include <signal.h>
18690 #ifdef SIGBUS
18691 $signal_t bletch(int s) { exit(4); }
18692 #endif
18693 int main() {
18694 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18695     volatile U8 buf[8];
18696     volatile U32 *up;
18697     int i;
18698
18699     if (sizeof(U32) != 4) {
18700         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18701         exit(1);
18702     }
18703
18704     fflush(stdout);
18705
18706 #ifdef SIGBUS
18707     signal(SIGBUS, bletch);
18708 #endif
18709
18710     buf[0] = 0;
18711     buf[1] = 0;
18712     buf[2] = 0;
18713     buf[3] = 1;
18714     buf[4] = 0;
18715     buf[5] = 0;
18716     buf[6] = 0;
18717     buf[7] = 1;
18718
18719     for (i = 0; i < 4; i++) {
18720         up = (U32*)(buf + i);
18721         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18722                (*up == 1 << (8*(3-i)))  /* little-endian */
18723               )
18724            )
18725         {
18726             printf("read failed (%x)\n", *up);
18727             exit(2);
18728         }
18729     }
18730
18731     /* write test */
18732     for (i = 0; i < 4; i++) {
18733         up = (U32*)(buf + i);
18734         *up = 0xBeef;
18735         if (*up != 0xBeef) {
18736             printf("write failed (%x)\n", *up);
18737             exit(3);
18738         }
18739     }
18740
18741     exit(0);
18742 #else
18743     printf("1\n");
18744     exit(1);
18745 #endif
18746     return 0;
18747 }
18748 EOCP
18749 set try
18750 if eval $compile_ok; then
18751         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18752         $run ./try 2>&1 >/dev/null
18753         case "$?" in
18754         0)      cat >&4 <<EOM
18755 You can access character data pretty unalignedly.
18756 EOM
18757                 d_u32align="$undef"
18758                 ;;
18759         *)      cat >&4 <<EOM
18760 It seems that you must access character data in an aligned manner.
18761 EOM
18762                 d_u32align="$define"
18763                 ;;
18764         esac
18765 else
18766         rp='Can you access character data at unaligned addresses?'
18767         dflt='n'
18768         . ./myread
18769         case "$ans" in
18770         [yY]*)  d_u32align="$undef"  ;;
18771         *)      d_u32align="$define" ;;
18772         esac
18773 fi
18774 $rm_try
18775 ;;
18776 esac
18777
18778 : see if ualarm exists
18779 set ualarm d_ualarm
18780 eval $inlibc
18781
18782 : see if umask exists
18783 set umask d_umask
18784 eval $inlibc
18785
18786 : see if unordered exists
18787 set unordered d_unordered
18788 eval $inlibc
18789
18790 : see if unsetenv exists
18791 set unsetenv d_unsetenv
18792 eval $inlibc
18793
18794 : see if usleep exists
18795 set usleep d_usleep
18796 eval $inlibc
18797
18798 : see if prototype for usleep is available
18799 echo " "
18800 set d_usleepproto usleep $i_unistd unistd.h
18801 eval $hasproto
18802
18803 : see if ustat exists
18804 set ustat d_ustat
18805 eval $inlibc
18806
18807 : see if closedir exists
18808 set closedir d_closedir
18809 eval $inlibc
18810
18811 case "$d_closedir" in
18812 "$define")
18813         echo " "
18814         echo "Checking whether closedir() returns a status..." >&4
18815         cat > try.c <<EOM
18816 #$i_dirent I_DIRENT             /**/
18817 #$i_sysdir I_SYS_DIR            /**/
18818 #$i_sysndir I_SYS_NDIR          /**/
18819 #$i_systypes I_SYS_TYPES        /**/
18820
18821 #if defined(I_SYS_TYPES)
18822 #include <sys/types.h>
18823 #endif
18824 #if defined(I_DIRENT)
18825 #include <dirent.h>
18826 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18827 #include <sys/dir.h>
18828 #endif
18829 #else
18830 #ifdef I_SYS_NDIR
18831 #include <sys/ndir.h>
18832 #else
18833 #ifdef I_SYS_DIR
18834 #ifdef hp9000s500
18835 #include <ndir.h>       /* may be wrong in the future */
18836 #else
18837 #include <sys/dir.h>
18838 #endif
18839 #endif
18840 #endif
18841 #endif
18842 int main() { return closedir(opendir(".")); }
18843 EOM
18844         set try
18845         if eval $compile_ok; then
18846                 if $run ./try > /dev/null 2>&1 ; then
18847                         echo "Yes, it does."
18848                         val="$undef"
18849                 else
18850                         echo "No, it doesn't."
18851                         val="$define"
18852                 fi
18853         else
18854                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18855                 val="$define"
18856         fi
18857         ;;
18858 *)
18859         val="$undef";
18860         ;;
18861 esac
18862 set d_void_closedir
18863 eval $setvar
18864 $rm_try
18865
18866 : see if there is a wait4
18867 set wait4 d_wait4
18868 eval $inlibc
18869
18870 : see if waitpid exists
18871 set waitpid d_waitpid
18872 eval $inlibc
18873
18874 : see if wcstombs exists
18875 set wcstombs d_wcstombs
18876 eval $inlibc
18877
18878 : see if wctomb exists
18879 set wctomb d_wctomb
18880 eval $inlibc
18881
18882 : see if writev exists
18883 set writev d_writev
18884 eval $inlibc
18885
18886 : preserve RCS keywords in files with variable substitution, grrr
18887 Date='$Date'
18888 Id='$Id'
18889 Log='$Log'
18890 RCSfile='$RCSfile'
18891 Revision='$Revision'
18892
18893 : check for alignment requirements
18894 echo " "
18895 case "$usecrosscompile$multiarch" in
18896 *$define*)
18897         $cat <<EOM
18898 You seem to be either cross-compiling or doing a multiarchitecture build,
18899 skipping the memory alignment check.
18900
18901 EOM
18902         case "$alignbytes" in
18903         '') alignbytes=8 ;;
18904         esac
18905         ;;
18906 *)
18907         case "$alignbytes" in
18908         '') echo "Checking alignment constraints..." >&4
18909                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18910                         $cat >try.c <<'EOCP'
18911 typedef long double NV;
18912 EOCP
18913                 else
18914                         $cat >try.c <<'EOCP'
18915 typedef double NV;
18916 EOCP
18917                 fi
18918                 $cat >>try.c <<'EOCP'
18919 #include <stdio.h>
18920 struct foobar {
18921         char foo;
18922         NV bar;
18923 } try_algn;
18924 int main()
18925 {
18926     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18927     return(0);
18928 }
18929 EOCP
18930                 set try
18931                 if eval $compile_ok; then
18932                         dflt=`$run ./try`
18933                 else
18934                         dflt='8'
18935                         echo "(I can't seem to compile the test program...)"
18936                 fi
18937                 ;;
18938         *) dflt="$alignbytes"
18939                 ;;
18940         esac
18941         rp="Doubles must be aligned on a how-many-byte boundary?"
18942         . ./myread
18943         alignbytes="$ans"
18944         $rm_try
18945         ;;
18946 esac
18947
18948
18949 : set the base revision
18950 baserev=5.0
18951
18952 : length of character in bytes. Is always 1, otherwise it isnt C
18953 : This used to be a test using sizeof
18954 charsize=1
18955
18956 : Check for the number of bits in a character
18957 case "$charbits" in
18958 '')     echo "Checking how long a character is (in bits)..." >&4
18959         $cat >try.c <<EOCP
18960 #include <stdio.h>
18961 int main ()
18962 {
18963     int n;
18964     unsigned char c;
18965     for (c = 1, n = 0; c; c <<= 1, n++) ;
18966     printf ("%d\n", n);
18967     return (0);
18968     }
18969 EOCP
18970         set try
18971         if eval $compile_ok; then
18972                 dflt=`$run ./try`
18973         else
18974                 dflt='8'
18975                 echo "(I can't seem to compile the test program.  Guessing...)"
18976         fi
18977         ;;
18978 *)
18979         dflt="$charbits"
18980         ;;
18981 esac
18982 rp="What is the length of a character (in bits)?"
18983 . ./myread
18984 charbits="$ans"
18985 $rm_try
18986 case "$charbits" in
18987 8)      ;;
18988 *)      cat >&4 << EOM
18989 Your system has an unsigned character size of $charbits bits, which
18990 is rather unusual (normally it is 8 bits).  Perl likely will not work
18991 correctly on your system, with subtle bugs in various places.
18992 EOM
18993         rp='Do you really want to continue?'
18994         dflt='n'
18995         . ./myread
18996         case "$ans" in
18997                 [yY])   echo >&4 "Okay, continuing."    ;;
18998                 *)      exit 1                          ;;
18999         esac
19000 esac
19001
19002 : how do we concatenate cpp tokens here?
19003 echo " "
19004 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19005 $cat >cpp_stuff.c <<'EOCP'
19006 #define RCAT(a,b)a/**/b
19007 #define ACAT(a,b)a ## b
19008 RCAT(Rei,ser)
19009 ACAT(Cir,cus)
19010 EOCP
19011 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19012 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19013         echo "Oh!  Smells like ANSI's been here." >&4
19014         echo "We can catify or stringify, separately or together!"
19015         cpp_stuff=42
19016 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19017         echo "Ah, yes!  The good old days!" >&4
19018         echo "However, in the good old days we don't know how to stringify and"
19019         echo "catify at the same time."
19020         cpp_stuff=1
19021 else
19022         $cat >&4 <<EOM
19023 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19024 You're going to have to edit the values of CAT[2-5] in config.h...
19025 EOM
19026         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19027 fi
19028 $rm -f cpp_stuff.*
19029
19030 : see if this is a db.h system
19031 set db.h i_db
19032 eval $inhdr
19033
19034 case "$i_db" in
19035 $define)
19036         : Check db version.
19037         echo " "
19038         echo "Checking Berkeley DB version ..." >&4
19039         $cat >try.c <<EOCP
19040 #$d_const HASCONST
19041 #ifndef HASCONST
19042 #define const
19043 #endif
19044 #include <sys/types.h>
19045 #include <stdio.h>
19046 #$i_stdlib I_STDLIB
19047 #ifdef I_STDLIB
19048 #include <stdlib.h>
19049 #endif
19050 #include <db.h>
19051 int main(int argc, char *argv[])
19052 {
19053 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19054     int Major, Minor, Patch ;
19055     unsigned long Version ;
19056     (void)db_version(&Major, &Minor, &Patch) ;
19057     if (argc == 2) {
19058         printf("%d %d %d %d %d %d\n",
19059                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19060                Major, Minor, Patch);
19061         exit(0);
19062     }
19063     printf("You have Berkeley DB Version 2 or greater.\n");
19064
19065     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19066                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19067     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19068                 Major, Minor, Patch) ;
19069
19070     /* check that db.h & libdb are compatible */
19071     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19072         printf("db.h and libdb are incompatible.\n") ;
19073         exit(3);
19074     }
19075
19076     printf("db.h and libdb are compatible.\n") ;
19077
19078     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19079                 + DB_VERSION_PATCH ;
19080
19081     /* needs to be >= 2.3.4 */
19082     if (Version < 2003004) {
19083     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19084         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19085         exit(2);
19086     }
19087
19088     exit(0);
19089 #else
19090 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19091     if (argc == 2) {
19092         printf("1 0 0\n");
19093         exit(0);
19094     }
19095     printf("You have Berkeley DB Version 1.\n");
19096     exit(0);    /* DB version < 2: the coast is clear. */
19097 #else
19098     exit(1);    /* <db.h> not Berkeley DB? */
19099 #endif
19100 #endif
19101 }
19102 EOCP
19103         set try
19104         if eval $compile_ok && $run ./try; then
19105                 echo 'Looks OK.' >&4
19106                 set `$run ./try 1`
19107                 db_version_major=$1
19108                 db_version_minor=$2
19109                 db_version_patch=$3
19110         else
19111                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19112                 i_db=$undef
19113                 case " $libs " in
19114                 *"-ldb "*)
19115                         : Remove db from list of libraries to use
19116                         echo "Removing unusable -ldb from library list" >&4
19117                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19118                         shift
19119                         libs="$*"
19120                         echo "libs = $libs" >&4
19121                         ;;
19122                 esac
19123         fi
19124         $rm_try
19125         ;;
19126 esac
19127
19128 case "$i_db" in
19129 define)
19130         : Check the return type needed for hash
19131         echo " "
19132         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19133         $cat >try.c <<EOCP
19134 #$d_const HASCONST
19135 #ifndef HASCONST
19136 #define const
19137 #endif
19138 #include <sys/types.h>
19139 #include <db.h>
19140
19141 #ifndef DB_VERSION_MAJOR
19142 u_int32_t hash_cb (ptr, size)
19143 const void *ptr;
19144 size_t size;
19145 {
19146 }
19147 HASHINFO info;
19148 int main()
19149 {
19150         info.hash = hash_cb;
19151 }
19152 #endif
19153 EOCP
19154         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19155                 if $contains warning try.out >>/dev/null 2>&1 ; then
19156                         db_hashtype='int'
19157                 else
19158                         db_hashtype='u_int32_t'
19159                 fi
19160         else
19161                 : XXX Maybe we should just give up here.
19162                 db_hashtype=u_int32_t
19163                 $cat try.out >&4
19164                 echo "Help:  I can't seem to compile the db test program." >&4
19165                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19166         fi
19167         $rm_try
19168         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19169         ;;
19170 *)      db_hashtype=u_int32_t
19171         ;;
19172 esac
19173 case "$i_db" in
19174 define)
19175         : Check the return type needed for prefix
19176         echo " "
19177         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19178         cat >try.c <<EOCP
19179 #$d_const HASCONST
19180 #ifndef HASCONST
19181 #define const
19182 #endif
19183 #include <sys/types.h>
19184 #include <db.h>
19185
19186 #ifndef DB_VERSION_MAJOR
19187 size_t prefix_cb (key1, key2)
19188 const DBT *key1;
19189 const DBT *key2;
19190 {
19191 }
19192 BTREEINFO info;
19193 int main()
19194 {
19195         info.prefix = prefix_cb;
19196 }
19197 #endif
19198 EOCP
19199         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19200                 if $contains warning try.out >>/dev/null 2>&1 ; then
19201                         db_prefixtype='int'
19202                 else
19203                         db_prefixtype='size_t'
19204                 fi
19205         else
19206                 db_prefixtype='size_t'
19207                 : XXX Maybe we should just give up here.
19208                 $cat try.out >&4
19209                 echo "Help:  I can't seem to compile the db test program." >&4
19210                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19211         fi
19212         $rm_try
19213         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19214         ;;
19215 *)      db_prefixtype='size_t'
19216         ;;
19217 esac
19218
19219 : How can we generate normalized random numbers ?
19220 echo " "
19221 echo "Looking for a random number function..." >&4
19222 case "$randfunc" in
19223 '')
19224         if set drand48 val -f; eval $csym; $val; then
19225                 dflt="drand48"
19226                 echo "Good, found drand48()." >&4
19227         elif set random val -f; eval $csym; $val; then
19228                 dflt="random"
19229                 echo "OK, found random()." >&4
19230         else
19231                 dflt="rand"
19232                 echo "Yick, looks like I have to use rand()." >&4
19233         fi
19234         echo " "
19235         ;;
19236 *)
19237         dflt="$randfunc"
19238         ;;
19239 esac
19240 cont=true
19241
19242 case "$ccflags" in
19243 *-Dmy_rand=*|*-Dmy_srand=*)
19244         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19245         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19246         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19247         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19248         ;;
19249 esac
19250
19251 while $test "$cont"; do
19252         rp="Use which function to generate random numbers?"
19253         . ./myread
19254         if $test "$ans" = "$dflt"; then
19255                 : null
19256         else
19257                 randbits=''
19258         fi
19259         randfunc="$ans"
19260         if set $ans val -f; eval $csym; $val; then
19261                 cont=''
19262         else
19263                 dflt=y
19264                 rp="I cannot find function $ans. Use that name anyway?"
19265                 . ./myread
19266                 dflt=rand
19267                 case "$ans" in
19268                         [yY]*) cont='';;
19269                 esac
19270         fi
19271         case "$cont" in
19272         '')
19273                 case "$randfunc" in
19274                 drand48)
19275                         drand01="drand48()"
19276                         seedfunc="srand48"
19277                         randbits=48
19278                         randseedtype=long
19279                         ;;
19280                 rand|random)
19281                         case "$randbits" in
19282                         '')
19283 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19284                                 $cat >try.c <<EOCP
19285 #$i_unistd I_UNISTD
19286 #$i_stdlib I_STDLIB
19287 #include <stdio.h>
19288 #ifdef I_UNISTD
19289 #  include <unistd.h>
19290 #endif
19291 #ifdef I_STDLIB
19292 #  include <stdlib.h>
19293 #endif
19294 int main()
19295 {
19296         register int i;
19297         register unsigned long tmp;
19298         register unsigned long max = 0L;
19299
19300         for (i = 1000; i; i--) {
19301                 tmp = (unsigned long) $randfunc();
19302                 if (tmp > max) max = tmp;
19303         }
19304         for (i = 0; max; i++)
19305                 max /= 2;
19306         printf("%d\n",i);
19307 }
19308 EOCP
19309                                 set try
19310                                 if eval $compile_ok; then
19311                                         dflt=`try`
19312                                 else
19313                                         dflt='?'
19314                                         echo "(I can't seem to compile the test program...)"
19315                                 fi
19316                                 ;;
19317                         *)
19318                                 dflt="$randbits"
19319                                 ;;
19320                         esac
19321                         rp="How many bits does your $randfunc() function produce?"
19322                         . ./myread
19323                         randbits="$ans"
19324                         $rm_try
19325                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19326                         seedfunc="s$randfunc"
19327                         randseedtype=unsigned
19328                         ;;
19329                 *)
19330                         dflt="31"
19331                         rp="How many bits does your $randfunc() function produce?"
19332                         . ./myread
19333                         randbits="$ans"
19334                         seedfunc="s$randfunc"
19335                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19336                         if set $seedfunc val -f; eval $csym; $val; then
19337                                 echo "(Using $seedfunc() to seed random generator)"
19338                         else
19339                                 echo "(Warning: no $seedfunc() to seed random generator)"
19340                                 seedfunc=rand
19341                         fi
19342                         randseedtype=unsigned
19343                         ;;
19344                 esac
19345                 ;;
19346         esac
19347 done
19348
19349 : Determine if this is an EBCDIC system
19350 echo " "
19351 echo "Determining whether or not we are on an EBCDIC system..." >&4
19352 $cat >try.c <<'EOM'
19353 int main()
19354 {
19355   if ('M'==0xd4) return 0;
19356   return 1;
19357 }
19358 EOM
19359
19360 val=$undef
19361 set try
19362 if eval $compile_ok; then
19363         if $run ./try; then
19364                 echo "You seem to speak EBCDIC." >&4
19365                 val="$define"
19366         else
19367                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19368         fi
19369 else
19370         echo "I'm unable to compile the test program." >&4
19371         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19372 fi
19373 $rm_try
19374 set ebcdic
19375 eval $setvar
19376
19377 : Check how to flush
19378 echo " "
19379 $cat >&4 <<EOM
19380 Checking how to flush all pending stdio output...
19381 EOM
19382 # I only know how to find the first 32 possibly open files on SunOS.
19383 # See also hints/sunos_4_1.sh and util.c  --AD
19384 case "$osname" in
19385 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19386 esac
19387 $cat >>try.c <<EOCP
19388 #include <stdio.h>
19389 #$i_stdlib I_STDLIB
19390 #ifdef I_STDLIB
19391 #include <stdlib.h>
19392 #endif
19393 #$i_unistd I_UNISTD
19394 #ifdef I_UNISTD
19395 # include <unistd.h>
19396 #endif
19397 #$d_sysconf HAS_SYSCONF
19398 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19399 #ifdef HAS_STDIO_STREAM_ARRAY
19400 # define STDIO_STREAM_ARRAY $stdio_stream_array
19401 #endif
19402 int main() {
19403   FILE* p;
19404   unlink("try.out");
19405   p = fopen("try.out", "w");
19406 #ifdef TRY_FPUTC
19407   fputc('x', p);
19408 #else
19409 # ifdef TRY_FPRINTF
19410   fprintf(p, "x");
19411 # endif
19412 #endif
19413 #ifdef TRY_FFLUSH_NULL
19414   fflush(NULL);
19415 #endif
19416 #ifdef TRY_FFLUSH_ALL
19417   {
19418     long open_max = -1;
19419 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19420     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19421 # else
19422 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19423     open_max = sysconf(_SC_OPEN_MAX);
19424 #  else
19425 #   ifdef FOPEN_MAX
19426     open_max = FOPEN_MAX;
19427 #   else
19428 #    ifdef OPEN_MAX
19429     open_max = OPEN_MAX;
19430 #    else
19431 #     ifdef _NFILE
19432     open_max = _NFILE;
19433 #     endif
19434 #    endif
19435 #   endif
19436 #  endif
19437 # endif
19438 # ifdef HAS_STDIO_STREAM_ARRAY
19439     if (open_max > 0) {
19440       long i;
19441       for (i = 0; i < open_max; i++)
19442             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19443                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19444                 STDIO_STREAM_ARRAY[i]._flag)
19445                 fflush(&STDIO_STREAM_ARRAY[i]);
19446     }
19447   }
19448 # endif
19449 #endif
19450   _exit(42);
19451 }
19452 EOCP
19453 : first we have to find out how _not_ to flush
19454 $to try.c
19455 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19456     output=''
19457     set try -DTRY_FPUTC
19458     if eval $compile; then
19459             $run ./try 2>/dev/null
19460             code="$?"
19461             $from try.out
19462             if $test ! -s try.out -a "X$code" = X42; then
19463                 output=-DTRY_FPUTC
19464             fi
19465     fi
19466     case "$output" in
19467     '')
19468             set try -DTRY_FPRINTF
19469             if eval $compile; then
19470                     $run ./try 2>/dev/null
19471                     code="$?"
19472                     $from try.out
19473                     if $test ! -s try.out -a "X$code" = X42; then
19474                         output=-DTRY_FPRINTF
19475                     fi
19476             fi
19477         ;;
19478     esac
19479 fi
19480 : check for fflush NULL behaviour
19481 case "$fflushNULL" in
19482 '')     set try -DTRY_FFLUSH_NULL $output
19483         if eval $compile; then
19484                 $run ./try 2>/dev/null
19485                 code="$?"
19486                 $from try.out
19487                 if $test -s try.out -a "X$code" = X42; then
19488                         fflushNULL="`$cat try.out`"
19489                 else
19490                         if $test "X$code" != X42; then
19491                                 $cat >&4 <<EOM
19492 (If this test failed, don't worry, we'll try another method shortly.)
19493 EOM
19494                         fi
19495                 fi
19496         fi
19497         $rm -f core try.core core.try.*
19498         case "$fflushNULL" in
19499         x)      $cat >&4 <<EOM
19500 Your fflush(NULL) works okay for output streams.
19501 Let's see if it clobbers input pipes...
19502 EOM
19503 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19504 # bug that improperly flushes the input end of pipes.  So we avoid the
19505 # autoflush on fork/system/exec support for now. :-(
19506 $cat >tryp.c <<EOCP
19507 #include <stdio.h>
19508 int
19509 main(int argc, char **argv)
19510 {
19511     char buf[1024];
19512     int i;
19513     char *bp = buf;
19514     while (1) {
19515         while ((i = getc(stdin)) != -1
19516                && (*bp++ = i) != '\n'
19517                && bp < &buf[1024])
19518         /* DO NOTHING */ ;
19519         *bp = '\0';
19520         fprintf(stdout, "%s", buf);
19521         fflush(NULL);
19522         if (i == -1)
19523             return 0;
19524         bp = buf;
19525     }
19526 }
19527 EOCP
19528                 fflushNULL="$define"
19529                 set tryp
19530                 if eval $compile; then
19531                     $rm -f tryp.out
19532                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19533                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19534                        $cat >&4 <<EOM
19535 fflush(NULL) seems to behave okay with input streams.
19536 EOM
19537                         fflushNULL="$define"
19538                     else
19539                         $cat >&4 <<EOM
19540 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19541 EOM
19542                         fflushNULL="$undef"
19543                     fi
19544                 fi
19545                 $rm -f core tryp.c tryp.core core.tryp.*
19546                 ;;
19547         '')     $cat >&4 <<EOM
19548 Your fflush(NULL) isn't working (contrary to ANSI C).
19549 EOM
19550                 fflushNULL="$undef"
19551                 ;;
19552         *)      $cat >&4 <<EOM
19553 Cannot figure out whether your fflush(NULL) works or not.
19554 I'm assuming it doesn't (contrary to ANSI C).
19555 EOM
19556                 fflushNULL="$undef"
19557                 ;;
19558         esac
19559         ;;
19560 $define|true|[yY]*)
19561         fflushNULL="$define"
19562         ;;
19563 *)
19564         fflushNULL="$undef"
19565         ;;
19566 esac
19567 : check explicit looping only if NULL did not work, and if the pipe
19568 : bug does not show up on an explicit flush too
19569 case "$fflushNULL" in
19570 "$undef")
19571         $cat >tryp.c <<EOCP
19572 #include <stdio.h>
19573 int
19574 main(int argc, char **argv)
19575 {
19576     char buf[1024];
19577     int i;
19578     char *bp = buf;
19579     while (1) {
19580         while ((i = getc(stdin)) != -1
19581                && (*bp++ = i) != '\n'
19582                && bp < &buf[1024])
19583         /* DO NOTHING */ ;
19584         *bp = '\0';
19585         fprintf(stdout, "%s", buf);
19586         fflush(stdin);
19587         if (i == -1)
19588             return 0;
19589         bp = buf;
19590     }
19591 }
19592 EOCP
19593         set tryp
19594         if eval $compile; then
19595             $rm -f tryp.out
19596             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19597             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19598                $cat >&4 <<EOM
19599 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19600 EOM
19601                 : now check for fflushall behaviour
19602                 case "$fflushall" in
19603                 '')     set try -DTRY_FFLUSH_ALL $output
19604                         if eval $compile; then
19605                                 $cat >&4 <<EOM
19606 (Now testing the other method--but note that this also may fail.)
19607 EOM
19608                                 $run ./try 2>/dev/null
19609                                 code=$?
19610                                 $from try.out
19611                                 if $test -s try.out -a "X$code" = X42; then
19612                                         fflushall="`$cat try.out`"
19613                                 fi
19614                         fi
19615                         $rm_try
19616                         case "$fflushall" in
19617                         x)      $cat >&4 <<EOM
19618 Whew. Flushing explicitly all the stdio streams works.
19619 EOM
19620                                 fflushall="$define"
19621                                 ;;
19622                         '')     $cat >&4 <<EOM
19623 Sigh. Flushing explicitly all the stdio streams doesn't work.
19624 EOM
19625                                 fflushall="$undef"
19626                                 ;;
19627                         *)      $cat >&4 <<EOM
19628 Cannot figure out whether flushing stdio streams explicitly works or not.
19629 I'm assuming it doesn't.
19630 EOM
19631                                 fflushall="$undef"
19632                                 ;;
19633                         esac
19634                         ;;
19635                 "$define"|true|[yY]*)
19636                         fflushall="$define"
19637                         ;;
19638                 *)
19639                         fflushall="$undef"
19640                         ;;
19641                 esac
19642             else
19643                 $cat >&4 <<EOM
19644 All is futile.  Even fflush(stdin) clobbers input pipes!
19645 EOM
19646                 fflushall="$undef"
19647             fi
19648         else
19649             fflushall="$undef"
19650         fi
19651         $rm -f core tryp.c tryp.core core.tryp.*
19652         ;;
19653 *)      fflushall="$undef"
19654         ;;
19655 esac
19656
19657 case "$fflushNULL$fflushall" in
19658 undefundef)
19659         $cat <<EOM
19660 OK, I give up.  I cannot figure out how to flush pending stdio output.
19661 We won't be flushing handles at all before fork/exec/popen.
19662 EOM
19663         ;;
19664 esac
19665 $rm_try tryp
19666
19667 : Store the full pathname to the ar program for use in the C program
19668 : Respect a hint or command line value for full_ar.
19669 case "$full_ar" in
19670 '') full_ar=$ar ;;
19671 esac
19672
19673 : Store the full pathname to the sed program for use in the C program
19674 full_sed=$sed
19675
19676 : see what type gids are declared as in the kernel
19677 echo " "
19678 echo "Looking for the type for group ids returned by getgid()."
19679 set gid_t gidtype xxx stdio.h sys/types.h
19680 eval $typedef
19681 case "$gidtype" in
19682 xxx)
19683         xxx=`./findhdr sys/user.h`
19684         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19685         case $1 in
19686         unsigned) dflt="$1 $2" ;;
19687         *) dflt="$1" ;;
19688         esac
19689         ;;
19690 *) dflt="$gidtype";;
19691 esac
19692 case "$gidtype" in
19693 gid_t) echo "gid_t found." ;;
19694 *)      rp="What is the type for group ids returned by getgid()?"
19695         . ./myread
19696         gidtype="$ans"
19697         ;;
19698 esac
19699
19700 : Check the size of GID
19701 echo " "
19702 case "$gidtype" in
19703 *_t) zzz="$gidtype"     ;;
19704 *)   zzz="gid"          ;;
19705 esac
19706 echo "Checking the size of $zzz..." >&4
19707 cat > try.c <<EOCP
19708 #include <sys/types.h>
19709 #include <stdio.h>
19710 #$i_stdlib I_STDLIB
19711 #ifdef I_STDLIB
19712 #include <stdlib.h>
19713 #endif
19714 int main() {
19715     printf("%d\n", (int)sizeof($gidtype));
19716     exit(0);
19717 }
19718 EOCP
19719 set try
19720 if eval $compile_ok; then
19721         yyy=`$run ./try`
19722         case "$yyy" in
19723         '')     gidsize=4
19724                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19725                 ;;
19726         *)      gidsize=$yyy
19727                 echo "Your $zzz is $gidsize bytes long."
19728                 ;;
19729         esac
19730 else
19731         gidsize=4
19732         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19733 fi
19734
19735
19736 : Check if GID is signed
19737 echo " "
19738 case "$gidtype" in
19739 *_t) zzz="$gidtype"     ;;
19740 *)   zzz="gid"          ;;
19741 esac
19742 echo "Checking the sign of $zzz..." >&4
19743 cat > try.c <<EOCP
19744 #include <sys/types.h>
19745 #include <stdio.h>
19746 int main() {
19747         $gidtype foo = -1;
19748         if (foo < 0)
19749                 printf("-1\n");
19750         else
19751                 printf("1\n");
19752 }
19753 EOCP
19754 set try
19755 if eval $compile; then
19756         yyy=`$run ./try`
19757         case "$yyy" in
19758         '')     gidsign=1
19759                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19760                 ;;
19761         *)      gidsign=$yyy
19762                 case "$gidsign" in
19763                  1) echo "Your $zzz is unsigned." ;;
19764                 -1) echo "Your $zzz is signed."   ;;
19765                 esac
19766                 ;;
19767         esac
19768 else
19769         gidsign=1
19770         echo "(I can't compile the test program--guessing unsigned.)" >&4
19771 fi
19772
19773
19774 : Check 64bit sizes
19775 echo " "
19776
19777 if $test X"$quadtype" != X; then
19778
19779 echo "Checking how to print 64-bit integers..." >&4
19780
19781 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19782         $cat >try.c <<'EOCP'
19783 #include <sys/types.h>
19784 #include <stdio.h>
19785 int main() {
19786   int q = 12345678901;
19787   printf("%ld\n", q);
19788 }
19789 EOCP
19790         set try
19791         if eval $compile; then
19792                 yyy=`$run ./try`
19793                 case "$yyy" in
19794                 12345678901)
19795                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19796                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19797                         echo "We will use %d."
19798                         ;;
19799                 esac
19800         fi
19801 fi
19802
19803 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19804         $cat >try.c <<'EOCP'
19805 #include <sys/types.h>
19806 #include <stdio.h>
19807 int main() {
19808   long q = 12345678901;
19809   printf("%ld\n", q);
19810 }
19811 EOCP
19812         set try
19813         if eval $compile; then
19814                 yyy=`$run ./try`
19815                 case "$yyy" in
19816                 12345678901)
19817                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19818                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19819                         echo "We will use %ld."
19820                         ;;
19821                 esac
19822         fi
19823 fi
19824
19825 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19826         $cat >try.c <<'EOCP'
19827 #include <sys/types.h>
19828 #include <inttypes.h>
19829 #include <stdio.h>
19830 int main() {
19831   int64_t q = 12345678901;
19832   printf("%" PRId64 "\n", q);
19833 }
19834 EOCP
19835         set try
19836         if eval $compile; then
19837                 yyy=`$run ./try`
19838                 case "$yyy" in
19839                 12345678901)
19840                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19841                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19842                         echo "We will use the C9X style."
19843                         ;;
19844                 esac
19845         fi
19846 fi
19847
19848 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19849         $cat >try.c <<EOCP
19850 #include <sys/types.h>
19851 #include <stdio.h>
19852 int main() {
19853   $quadtype q = 12345678901;
19854   printf("%Ld\n", q);
19855 }
19856 EOCP
19857         set try
19858         if eval $compile; then
19859                 yyy=`$run ./try`
19860                 case "$yyy" in
19861                 12345678901)
19862                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19863                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19864                         echo "We will use %Ld."
19865                         ;;
19866                 esac
19867         fi
19868 fi
19869
19870 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19871         $cat >try.c <<'EOCP'
19872 #include <sys/types.h>
19873 #include <stdio.h>
19874 int main() {
19875   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19876   printf("%lld\n", q);
19877 }
19878 EOCP
19879         set try
19880         if eval $compile; then
19881                 yyy=`$run ./try`
19882                 case "$yyy" in
19883                 12345678901)
19884                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19885                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19886                         echo "We will use the %lld style."
19887                         ;;
19888                 esac
19889         fi
19890 fi
19891
19892 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19893         $cat >try.c <<EOCP
19894 #include <sys/types.h>
19895 #include <stdio.h>
19896 int main() {
19897   $quadtype q = 12345678901;
19898   printf("%qd\n", q);
19899 }
19900 EOCP
19901         set try
19902         if eval $compile; then
19903                 yyy=`$run ./try`
19904                 case "$yyy" in
19905                 12345678901)
19906                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19907                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19908                         echo "We will use %qd."
19909                         ;;
19910                 esac
19911         fi
19912 fi
19913
19914 if $test X"$sPRId64" = X; then
19915         echo "Cannot figure out how to print 64-bit integers." >&4
19916 fi
19917 $rm_try
19918
19919 fi
19920
19921 case "$sPRId64" in
19922 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19923         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19924         ;;
19925 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19926         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19927         ;;
19928 esac
19929
19930 : Check format strings for internal types
19931 echo " "
19932 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19933
19934 if $test X"$ivsize" = X8; then
19935         ivdformat="$sPRId64"
19936         uvuformat="$sPRIu64"
19937         uvoformat="$sPRIo64"
19938         uvxformat="$sPRIx64"
19939         uvXUformat="$sPRIXU64"
19940 else
19941         if $test X"$ivsize" = X"$longsize"; then
19942                 ivdformat='"ld"'
19943                 uvuformat='"lu"'
19944                 uvoformat='"lo"'
19945                 uvxformat='"lx"'
19946                 uvXUformat='"lX"'
19947         else
19948                 if $test X"$ivsize" = X"$intsize"; then
19949                         ivdformat='"d"'
19950                         uvuformat='"u"'
19951                         uvoformat='"o"'
19952                         uvxformat='"x"'
19953                         uvXUformat='"X"'
19954                 else
19955                         : far out
19956                         if $test X"$ivsize" = X"$shortsize"; then
19957                                 ivdformat='"hd"'
19958                                 uvuformat='"hu"'
19959                                 uvoformat='"ho"'
19960                                 uvxformat='"hx"'
19961                                 uvXUformat='"hX"'
19962                         fi
19963                 fi
19964         fi
19965 fi
19966
19967 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19968         nveformat="$sPRIeldbl"
19969         nvfformat="$sPRIfldbl"
19970         nvgformat="$sPRIgldbl"
19971         nvEUformat="$sPRIEUldbl"
19972         nvFUformat="$sPRIFUldbl"
19973         nvGUformat="$sPRIGUldbl"
19974 else
19975         nveformat='"e"'
19976         nvfformat='"f"'
19977         nvgformat='"g"'
19978         nvEUformat='"E"'
19979         nvFUformat='"F"'
19980         nvGUformat='"G"'
19981 fi
19982
19983 case "$ivdformat" in
19984 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19985     exit 1
19986     ;;
19987 esac
19988
19989 : Check format string for GID
19990
19991 echo " "
19992 $echo "Checking the format string to be used for gids..." >&4
19993
19994 case "$gidsign" in
19995 -1)     if $test X"$gidsize" = X"$ivsize"; then
19996                 gidformat="$ivdformat"
19997         else
19998                 if $test X"$gidsize" = X"$longsize"; then
19999                         gidformat='"ld"'
20000                 else
20001                         if $test X"$gidsize" = X"$intsize"; then
20002                                 gidformat='"d"'
20003                         else
20004                                 if $test X"$gidsize" = X"$shortsize"; then
20005                                         gidformat='"hd"'
20006                                 fi
20007                         fi
20008                 fi
20009         fi
20010         ;;
20011 *)      if $test X"$gidsize" = X"$uvsize"; then
20012                 gidformat="$uvuformat"
20013         else
20014                 if $test X"$gidsize" = X"$longsize"; then
20015                         gidformat='"lu"'
20016                 else
20017                         if $test X"$gidsize" = X"$intsize"; then
20018                                 gidformat='"u"'
20019                         else
20020                                 if $test X"$gidsize" = X"$shortsize"; then
20021                                         gidformat='"hu"'
20022                                 fi
20023                         fi
20024                 fi
20025         fi
20026         ;;
20027 esac
20028
20029 : see if getgroups exists
20030 set getgroups d_getgrps
20031 eval $inlibc
20032
20033 : see if setgroups exists
20034 set setgroups d_setgrps
20035 eval $inlibc
20036
20037 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20038 echo " "
20039 case "$d_getgrps$d_setgrps" in
20040 *define*)
20041         case "$groupstype" in
20042         '') dflt="$gidtype" ;;
20043         *)  dflt="$groupstype" ;;
20044         esac
20045         $cat <<EOM
20046 What type of pointer is the second argument to getgroups() and setgroups()?
20047 Usually this is the same as group ids, $gidtype, but not always.
20048
20049 EOM
20050         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20051         . ./myread
20052         groupstype="$ans"
20053         ;;
20054 *)  groupstype="$gidtype";;
20055 esac
20056
20057 : MAD = Misc Attribute Definition
20058
20059 if $test $patchlevel -lt 9; then
20060 : MAD is not available in 5.8.x or earlier.
20061     ans=n;
20062 else
20063     case "$mad" in
20064     $define|true|[yY]*) dflt='y' ;;
20065     *)                  dflt='n' ;;
20066     esac
20067     cat <<EOM
20068
20069 Would you like to build with Misc Attribute Decoration? This is development
20070 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20071 overhead on the interpreter.
20072
20073 If this doesn't make any sense to you, just accept the default '$dflt'.
20074 EOM
20075     rp='Build Perl with MAD?'
20076     . ./myread
20077 fi
20078 case "$ans" in
20079 y|Y)    val="$define"
20080         madlyh='madly.h madly.act madly.tab'
20081         madlysrc='madly.c'
20082         madlyobj="madly$_o" ;;
20083 *)      val="$undef"
20084         madlyh=''
20085         madlysrc=''
20086         madlyobj='' ;;
20087 esac
20088 set mad
20089 eval $setvar
20090
20091 : check whether make sets MAKE
20092 echo " "
20093 echo "Checking if your $make program sets \$(MAKE)..." >&4
20094 case "$make_set_make" in
20095 '')
20096         $sed 's/^X //' > testmake.mak << 'EOF'
20097 Xall:
20098 X       @echo 'maketemp="$(MAKE)"'
20099 EOF
20100         case "`$make -f testmake.mak 2>/dev/null`" in
20101         *maketemp=*) make_set_make='#' ;;
20102         *)      make_set_make="MAKE=$make" ;;
20103         esac
20104         $rm -f testmake.mak
20105         ;;
20106 esac
20107 case "$make_set_make" in
20108 '#') echo "Yup, it does.";;
20109 *) echo "Nope, it doesn't.";;
20110 esac
20111
20112 : see what type is used for mode_t
20113 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20114 set mode_t modetype int stdio.h sys/types.h
20115 eval $typedef_ask
20116
20117 : see if we need va_copy
20118 echo " "
20119 case "$i_stdarg" in
20120 "$define")
20121         $cat >try.c <<EOCP
20122 #include <stdarg.h>
20123 #include <stdio.h>
20124 #$i_stdlib I_STDLIB
20125 #ifdef I_STDLIB
20126 #include <stdlib.h>
20127 #endif
20128 #include <signal.h>
20129
20130 int
20131 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20132 {
20133   return vfprintf(f, fmt, *valp);
20134 }
20135
20136 int
20137 myvfprintf(FILE *f, const  char *fmt, va_list val)
20138 {
20139   return ivfprintf(f, fmt, &val);
20140 }
20141
20142 int
20143 myprintf(char *fmt, ...)
20144 {
20145   va_list val;
20146   va_start(val, fmt);
20147   return myvfprintf(stdout, fmt, val);
20148 }
20149
20150 int
20151 main(int ac, char **av)
20152 {
20153   signal(SIGSEGV, exit);
20154
20155   myprintf("%s%cs all right, then\n", "that", '\'');
20156   exit(0);
20157 }
20158 EOCP
20159         set try
20160         if eval $compile && $run ./try 2>&1 >/dev/null; then
20161                 case "`$run ./try`" in
20162                 "that's all right, then")
20163                         okay=yes
20164                         ;;
20165                 esac
20166         fi
20167         case "$okay" in
20168         yes)    echo "It seems that you don't need va_copy()." >&4
20169                 need_va_copy="$undef"
20170                 ;;
20171         *)      echo "It seems that va_copy() or similar will be needed." >&4
20172                 need_va_copy="$define"
20173                 ;;
20174         esac
20175         $rm_try
20176         ;;
20177 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20178         ;;
20179 esac
20180
20181 : see what type is used for size_t
20182 rp="What is the type used for the length parameter for string functions?"
20183 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20184 eval $typedef_ask
20185
20186 : check for type of arguments to gethostbyaddr. 
20187 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20188         case "$d_gethbyaddr" in
20189         $define)
20190                 $cat <<EOM
20191
20192 Checking to see what type of arguments are accepted by gethostbyaddr().
20193 EOM
20194                 hdrs="$define sys/types.h
20195                         $d_socket sys/socket.h 
20196                         $i_niin netinet/in.h 
20197                         $i_netdb netdb.h
20198                         $i_unistd unistd.h"
20199                 : The first arg can 'char *' or 'void *'
20200                 : The second arg is some of integral type
20201                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20202                         for yyy in size_t long int; do
20203                                 case "$netdb_host_type" in
20204                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20205                                         if ./protochk "$try" $hdrs; then
20206                                                 echo "Your system accepts $xxx for the first arg."
20207                                                 echo "...and $yyy for the second arg."
20208                                                 netdb_host_type="$xxx"
20209                                                 netdb_hlen_type="$yyy"
20210                                         fi
20211                                         ;;
20212                                 esac
20213                         done
20214                 done
20215                 : In case none of those worked, prompt the user.
20216                 case "$netdb_host_type" in
20217                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20218                         dflt='char *'
20219                         . ./myread
20220                         netdb_host_type=$ans
20221                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20222                         dflt="$sizetype"
20223                         . ./myread
20224                         netdb_hlen_type=$ans
20225                         ;;
20226                 esac
20227                 ;;
20228         *)      : no gethostbyaddr, so pick harmless defaults
20229                 netdb_host_type='char *'
20230                 netdb_hlen_type="$sizetype"
20231                 ;;
20232         esac
20233         # Remove the "const" if needed. -- but then we'll have a 
20234         # prototype clash!
20235         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20236 fi
20237
20238 : check for type of argument to gethostbyname. 
20239 if test "X$netdb_name_type" = X ; then
20240         case "$d_gethbyname" in
20241         $define)
20242                 $cat <<EOM
20243
20244 Checking to see what type of argument is accepted by gethostbyname().
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                 for xxx in "const char *" "char *"; do
20252                         case "$netdb_name_type" in
20253                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20254                                 if ./protochk "$try" $hdrs; then
20255                                         echo "Your system accepts $xxx."
20256                                         netdb_name_type="$xxx"
20257                                 fi
20258                                 ;;
20259                         esac
20260                 done
20261                 : In case none of those worked, prompt the user.
20262                 case "$netdb_name_type" in
20263                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20264                         dflt='char *'
20265                         . ./myread
20266                         netdb_name_type=$ans
20267                         ;;
20268                 esac
20269                 ;;
20270         *)      : no gethostbyname, so pick harmless default
20271                 netdb_name_type='char *'
20272                 ;;
20273         esac
20274 fi
20275
20276 : check for type of 1st argument to getnetbyaddr. 
20277 if test "X$netdb_net_type" = X ; then
20278         case "$d_getnbyaddr" in
20279         $define)
20280                 $cat <<EOM
20281
20282 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20283 EOM
20284                 hdrs="$define sys/types.h
20285                         $d_socket sys/socket.h 
20286                         $i_niin netinet/in.h 
20287                         $i_netdb netdb.h
20288                         $i_unistd unistd.h"
20289                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20290                         case "$netdb_net_type" in
20291                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20292                                 if ./protochk "$try" $hdrs; then
20293                                         echo "Your system accepts $xxx."
20294                                         netdb_net_type="$xxx"
20295                                 fi
20296                                 ;;
20297                         esac
20298                 done
20299                 : In case none of those worked, prompt the user.
20300                 case "$netdb_net_type" in
20301                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20302                         dflt='long'
20303                         . ./myread
20304                         netdb_net_type=$ans
20305                         ;;
20306                 esac
20307                 ;;
20308         *)      : no getnetbyaddr, so pick harmless default
20309                 netdb_net_type='long'
20310                 ;;
20311         esac
20312 fi
20313 : locate the preferred pager for this system
20314 fn=f/
20315 case "$pager" in
20316 '')
20317         dflt=''
20318         case "$pg" in
20319         /*) dflt=$pg;;
20320         [a-zA-Z]:/*) dflt=$pg;;
20321         esac
20322         case "$more" in
20323         /*) dflt=$more;;
20324         [a-zA-Z]:/*) dflt=$more;;
20325         esac
20326         case "$less" in
20327         /*) dflt=$less;;
20328         [a-zA-Z]:/*) dflt=$less;;
20329         esac
20330         case "$dflt" in
20331         '') dflt=/usr/ucb/more;;
20332         esac
20333         ;;
20334 *)      dflt="$pager"
20335         fn="f/($pager)"
20336         ;;
20337 esac
20338 echo " "
20339 rp='What pager is used on your system?'
20340 . ./getfile
20341 pager="$ans"
20342
20343 : see what type pids are declared as in the kernel
20344 rp="What is the type of process ids on this system?"
20345 set pid_t pidtype int stdio.h sys/types.h
20346 eval $typedef_ask
20347
20348 : see if ar generates random libraries by itself
20349 echo " "
20350 echo "Checking how to generate random libraries on your machine..." >&4
20351 echo 'int bar1() { return bar2(); }' > bar1.c
20352 echo 'int bar2() { return 2; }' > bar2.c
20353 $cat > foo.c <<EOP
20354 #$i_stdlib I_STDLIB
20355 #ifdef I_STDLIB
20356 #include <stdlib.h>
20357 #endif
20358 int main() { printf("%d\n", bar1()); exit(0); }
20359 EOP
20360 $cc $ccflags -c bar1.c >/dev/null 2>&1
20361 $cc $ccflags -c bar2.c >/dev/null 2>&1
20362 $cc $ccflags -c foo.c >/dev/null 2>&1
20363 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20364 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20365         $run ./foobar >/dev/null 2>&1; then
20366         echo "$ar appears to generate random libraries itself."
20367         orderlib=false
20368         if [ "X$ranlib" = "X" ]; then
20369             ranlib=":"
20370         fi
20371 elif $ar s bar$_a >/dev/null 2>&1 &&
20372         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20373         $run ./foobar >/dev/null 2>&1; then
20374                 echo "a table of contents needs to be added with '$ar s'."
20375                 orderlib=false
20376                 ranlib="$ar s"
20377 elif $ar ts bar$_a >/dev/null 2>&1 &&
20378         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20379         $run ./foobar >/dev/null 2>&1; then
20380                 echo "a table of contents needs to be added with '$ar ts'."
20381                 orderlib=false
20382                 ranlib="$ar ts"
20383 else
20384         case "$ranlib" in
20385         :) ranlib='';;
20386         '')
20387                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20388                 $test -f $ranlib || ranlib=''
20389                 ;;
20390         esac
20391         if $test -n "$ranlib"; then
20392                 echo "your system has '$ranlib'; we'll use that."
20393                 orderlib=false
20394         else
20395                 echo "your system doesn't seem to support random libraries"
20396                 echo "so we'll use lorder and tsort to order the libraries."
20397                 orderlib=true
20398                 ranlib=":"
20399         fi
20400 fi
20401 $rm -f foo* bar*
20402
20403 : see if this is a values.h system
20404 set values.h i_values
20405 eval $inhdr
20406
20407 : Check the max offset that gmtime and localtime accept
20408 echo "Checking max offsets that gmtime () accepts"
20409
20410 case $i_values in
20411     define) yyy="#include <values.h>" ;;
20412     *)      yyy="" ;;
20413     esac
20414
20415 case "$sGMTIME_min/$sGMTIME_max" in
20416     0/0|/)
20417         $cat >try.c <<EOCP
20418 #include <sys/types.h>
20419 #include <stdio.h>
20420 #include <time.h>
20421 $yyy
20422
20423 int i;
20424 struct tm *tmp;
20425 time_t pt;
20426
20427 void gm_check (time_t t, int min_year, int max_year)
20428 {
20429     tmp = gmtime (&t);
20430     if ( tmp == NULL ||
20431         /* Check tm_year overflow */
20432          tmp->tm_year < min_year || tmp->tm_year > max_year)
20433         tmp = NULL;
20434     else
20435         pt = t;
20436     } /* gm_check */
20437
20438 int check_max ()
20439 {
20440     tmp = NULL;
20441     pt  = 0;
20442 #ifdef MAXLONG
20443     gm_check (MAXLONG, 69, 0x7fffffff);
20444 #endif
20445     if (tmp == NULL || tmp->tm_year < 0) {
20446         for (i = 63; i >= 0; i--) {
20447             time_t x = pt | ((time_t)1 << i);
20448             if (x < 0 || x < pt) continue;
20449             gm_check (x, 69, 0x7fffffff);
20450             }
20451         }
20452     printf ("sGMTIME_max=%ld\n", pt);
20453     return (0);
20454     } /* check_max */
20455
20456 int check_min ()
20457 {
20458     tmp = NULL;
20459     pt  = 0;
20460 #ifdef MINLONG
20461     gm_check (MINLONG, -1900, 70);
20462 #endif
20463     if (tmp == NULL) {
20464         for (i = 36; i >= 0; i--) {
20465             time_t x = pt - ((time_t)1 << i);
20466             if (x > 0) continue;
20467             gm_check (x, -1900, 70);
20468             }
20469         }
20470     printf ("sGMTIME_min=%ld\n", pt);
20471     return (0);
20472     } /* check_min */
20473
20474 int main (int argc, char *argv[])
20475 {
20476     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20477     check_max ();
20478     check_min ();
20479     return (0);
20480     } /* main */
20481 EOCP
20482         set try
20483         if eval $compile; then
20484             eval `$run ./try`
20485         else
20486             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20487             fi
20488         $rm_try
20489         ;;
20490     esac
20491
20492 echo "Checking max offsets that localtime () accepts"
20493
20494 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20495     0/0|/)
20496         $cat >try.c <<EOCP
20497 #include <sys/types.h>
20498 #include <stdio.h>
20499 #include <time.h>
20500 $yyy
20501
20502 int i;
20503 struct tm *tmp;
20504 time_t pt;
20505
20506 void local_check (time_t t, int min_year, int max_year)
20507 {
20508     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20509         tmp = NULL;
20510     else
20511         tmp = localtime (&t);
20512     if ( tmp == NULL ||
20513         /* Check tm_year overflow */
20514          tmp->tm_year < min_year || tmp->tm_year > max_year)
20515         tmp = NULL;
20516     else
20517         pt = t;
20518     } /* local_check */
20519
20520 int check_max ()
20521 {
20522     tmp = NULL;
20523     pt  = 0;
20524 #ifdef MAXLONG
20525     local_check (MAXLONG, 69, 0x7fffffff);
20526 #endif
20527     if (tmp == NULL || tmp->tm_year < 0) {
20528         for (i = 63; i >= 0; i--) {
20529             time_t x = pt | ((time_t)1 << i);
20530             if (x < 0 || x < pt) continue;
20531             local_check (x, 69, 0x7fffffff);
20532             }
20533         }
20534     printf ("sLOCALTIME_max=%ld\n", pt);
20535     return (0);
20536    } /* check_max */
20537
20538 int check_min ()
20539 {
20540     tmp = NULL;
20541     pt  = 0;
20542 #ifdef MINLONG
20543     local_check (MINLONG, -1900, 70);
20544 #endif
20545     if (tmp == NULL) {
20546         for (i = 36; i >= 0; i--) {
20547             time_t x = pt - ((time_t)1 << i);
20548             if (x > 0) continue;
20549             local_check (x, -1900, 70);
20550             }
20551         }
20552     printf ("sLOCALTIME_min=%ld\n", pt);
20553     return (0);
20554     } /* check_min */
20555
20556 int main (int argc, char *argv[])
20557 {
20558     check_max ();
20559     check_min ();
20560     return (0);
20561     } /* main */
20562 EOCP
20563         set try
20564         if eval $compile; then
20565             eval `$run ./try`
20566         else
20567             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20568             fi
20569         $rm_try
20570         ;;
20571     esac
20572
20573 : check for type of arguments to select.
20574 case "$selecttype" in
20575 '') case "$d_select" in
20576         $define)
20577                 echo " "
20578                 $cat <<EOM
20579 Checking to see what type of arguments are accepted by select().
20580 EOM
20581                 hdrs="$define sys/types.h
20582                         $i_systime sys/time.h
20583                         $i_sysselct sys/select.h
20584                         $d_socket sys/socket.h"
20585                 : The first arg can be int, unsigned, or size_t
20586                 : The last arg may or may not be 'const'
20587                 val=''
20588                 : void pointer has been seen but using that
20589                 : breaks the selectminbits test
20590                 for xxx in 'fd_set *' 'int *'; do
20591                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20592                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20593                                         case "$val" in
20594                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20595                                                 if ./protochk "$try" $hdrs; then
20596                                                         echo "Your system accepts $xxx."
20597                                                         val="$xxx"
20598                                                 fi
20599                                                 ;;
20600                                         esac
20601                                 done
20602                         done
20603                 done
20604                 case "$val" in
20605                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20606                         case "$d_fd_set" in
20607                                 $define) dflt="fd_set *" ;;
20608                                 *)              dflt="int *" ;;
20609                         esac
20610                         . ./myread
20611                         val=$ans
20612                         ;;
20613                 esac
20614                 selecttype="$val"
20615                 ;;
20616         *)      : no select, so pick a harmless default
20617                 selecttype='int *'
20618                 ;;
20619         esac
20620         ;;
20621 esac
20622
20623 : check for the select 'width'
20624 case "$selectminbits" in
20625 '') safebits=`expr $ptrsize \* 8`
20626     case "$d_select" in
20627         $define)
20628                 $cat <<EOM
20629
20630 Checking to see on how many bits at a time your select() operates...
20631 EOM
20632                 $cat >try.c <<EOCP
20633 #include <sys/types.h>
20634 #$i_time I_TIME
20635 #$i_systime I_SYS_TIME
20636 #$i_systimek I_SYS_TIME_KERNEL
20637 #ifdef I_TIME
20638 #   include <time.h>
20639 #endif
20640 #ifdef I_SYS_TIME
20641 #   ifdef I_SYS_TIME_KERNEL
20642 #       define KERNEL
20643 #   endif
20644 #   include <sys/time.h>
20645 #   ifdef I_SYS_TIME_KERNEL
20646 #       undef KERNEL
20647 #   endif
20648 #endif
20649 #$i_sysselct I_SYS_SELECT
20650 #ifdef I_SYS_SELECT
20651 #include <sys/select.h>
20652 #endif
20653 #$d_socket HAS_SOCKET
20654 #ifdef HAS_SOCKET
20655 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20656 #endif
20657 #include <stdio.h>
20658 #$i_stdlib I_STDLIB
20659 #ifdef I_STDLIB
20660 #include <stdlib.h>
20661 #endif
20662 $selecttype b;
20663 #define S sizeof(*(b))
20664 #define MINBITS 64
20665 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20666 #define NBITS  (NBYTES * 8)
20667 int main() {
20668     char *s = (char *)malloc(NBYTES);
20669     struct timeval t;
20670     int i;
20671     FILE* fp;
20672     int fd;
20673
20674     if (!s)
20675         exit(1);
20676     fclose(stdin);
20677     fp = fopen("try.c", "r");
20678     if (fp == 0)
20679       exit(2);
20680     fd = fileno(fp);
20681     if (fd < 0)
20682       exit(3);
20683     b = ($selecttype)s;
20684     for (i = 0; i < NBITS; i++)
20685         FD_SET(i, b);
20686     t.tv_sec  = 0;
20687     t.tv_usec = 0;
20688     select(fd + 1, b, 0, 0, &t);
20689     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20690     free(s);
20691     printf("%d\n", i + 1);
20692     return 0;
20693 }
20694 EOCP
20695                 set try
20696                 if eval $compile_ok; then
20697                         selectminbits=`$run ./try`
20698                         case "$selectminbits" in
20699                         '')     cat >&4 <<EOM
20700 Cannot figure out on how many bits at a time your select() operates.
20701 I'll play safe and guess it is $safebits bits.
20702 EOM
20703                                 selectminbits=$safebits
20704                                 bits="$safebits bits"
20705                                 ;;
20706                         1)      bits="1 bit" ;;
20707                         *)      bits="$selectminbits bits" ;;
20708                         esac
20709                         echo "Your select() operates on $bits at a time." >&4
20710                 else
20711                         rp='What is the minimum number of bits your select() operates on?'
20712                         case "$byteorder" in
20713                         12345678)       dflt=64 ;;
20714                         1234)           dflt=32 ;;
20715                         *)              dflt=1  ;;
20716                         esac
20717                         . ./myread
20718                         val=$ans
20719                         selectminbits="$val"
20720                 fi
20721                 $rm_try
20722                 ;;
20723         *)      : no select, so pick a harmless default
20724                 selectminbits=$safebits
20725                 ;;
20726         esac
20727         ;;
20728 esac
20729
20730 : Trace out the files included by signal.h, then look for SIGxxx names.
20731 if [ "X$fieldn" = X ]; then
20732         : Just make some guesses.  We check them later.
20733         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20734 else
20735         xxx=`echo '#include <signal.h>' |
20736         $cppstdin $cppminus $cppflags 2>/dev/null |
20737         $grep '^[       ]*#.*include' |
20738         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20739                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20740 fi
20741 xxxfiles=''
20742 for xx in $xxx /dev/null ; do
20743         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20744 done
20745 case "$xxxfiles" in
20746 '')     xxxfiles=`./findhdr signal.h` ;;
20747 esac
20748 xxx=`awk '
20749 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20750         print substr($2, 4, 20)
20751 }
20752 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20753         print substr($3, 4, 20)
20754 }' $xxxfiles`
20755 : Append some common names just in case the awk scan failed.
20756 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20757 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20758 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20759 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20760 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20761
20762 : generate a few handy files for later
20763 $cat > signal.c <<EOCP
20764 #include <sys/types.h>
20765 #include <signal.h>
20766 #$i_stdlib I_STDLIB
20767 #ifdef I_STDLIB
20768 #include <stdlib.h>
20769 #endif
20770 #include <stdio.h>
20771 int main() {
20772
20773 /* Strange style to avoid deeply-nested #if/#else/#endif */
20774 #ifndef NSIG
20775 #  ifdef _NSIG
20776 #    define NSIG (_NSIG)
20777 #  endif
20778 #endif
20779
20780 #ifndef NSIG
20781 #  ifdef SIGMAX
20782 #    define NSIG (SIGMAX+1)
20783 #  endif
20784 #endif
20785
20786 #ifndef NSIG
20787 #  ifdef SIG_MAX
20788 #    define NSIG (SIG_MAX+1)
20789 #  endif
20790 #endif
20791
20792 #ifndef NSIG
20793 #  ifdef _SIG_MAX
20794 #    define NSIG (_SIG_MAX+1)
20795 #  endif
20796 #endif
20797
20798 #ifndef NSIG
20799 #  ifdef MAXSIG
20800 #    define NSIG (MAXSIG+1)
20801 #  endif
20802 #endif
20803
20804 #ifndef NSIG
20805 #  ifdef MAX_SIG
20806 #    define NSIG (MAX_SIG+1)
20807 #  endif
20808 #endif
20809
20810 #ifndef NSIG
20811 #  ifdef SIGARRAYSIZE
20812 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20813 #  endif
20814 #endif
20815
20816 #ifndef NSIG
20817 #  ifdef _sys_nsig
20818 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20819 #  endif
20820 #endif
20821
20822 /* Default to some arbitrary number that's big enough to get most
20823    of the common signals.
20824 */
20825 #ifndef NSIG
20826 #    define NSIG 50
20827 #endif
20828
20829 printf("NSIG %d\n", NSIG);
20830
20831 #ifndef JUST_NSIG
20832
20833 EOCP
20834
20835 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20836 {
20837         printf "#ifdef SIG"; printf $1; printf "\n"
20838         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20839         printf $1; printf ");\n"
20840         printf "#endif\n"
20841 }
20842 END {
20843         printf "#endif /* JUST_NSIG */\n";
20844         printf "exit(0);\n}\n";
20845 }
20846 ' >>signal.c
20847 $cat >signal.awk <<'EOP'
20848 BEGIN { ndups = 0 }
20849 $1 ~ /^NSIG$/ { nsig = $2 }
20850 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20851     if ($2 > maxsig) { maxsig = $2 }
20852     if (sig_name[$2]) {
20853         dup_name[ndups] = $1
20854         dup_num[ndups] = $2
20855         ndups++
20856     }
20857     else {
20858         sig_name[$2] = $1
20859         sig_num[$2] = $2
20860     }
20861 }
20862 END {
20863     if (nsig == 0) {
20864         nsig = maxsig + 1
20865     }
20866     printf("NSIG %d\n", nsig);
20867     for (n = 1; n < nsig; n++) {
20868         if (sig_name[n]) {
20869             printf("%s %d\n", sig_name[n], sig_num[n])
20870         }
20871         else {
20872             printf("NUM%d %d\n", n, n)
20873         }
20874     }
20875     for (n = 0; n < ndups; n++) {
20876         printf("%s %d\n", dup_name[n], dup_num[n])
20877     }
20878 }
20879 EOP
20880 $cat >signal_cmd <<EOS
20881 $startsh
20882 if $test -s signal.lst; then
20883     echo "Using your existing signal.lst file"
20884         exit 0
20885 fi
20886 xxx="$xxx"
20887 EOS
20888 $cat >>signal_cmd <<'EOS'
20889
20890 set signal
20891 if eval $compile_ok; then
20892         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20893                 $uniq | $awk -f signal.awk >signal.lst
20894 else
20895         echo "(I can't seem be able to compile the whole test program)" >&4
20896         echo "(I'll try it in little pieces.)" >&4
20897         set signal -DJUST_NSIG
20898         if eval $compile_ok; then
20899                 $run ./signal$_exe > signal.nsg
20900                 $cat signal.nsg
20901         else
20902                 echo "I can't seem to figure out how many signals you have." >&4
20903                 echo "Guessing 50." >&4
20904                 echo 'NSIG 50' > signal.nsg
20905         fi
20906         : Now look at all the signal names, one at a time.
20907         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20908                 $cat > signal.c <<EOCP
20909 #include <sys/types.h>
20910 #include <signal.h>
20911 #include <stdio.h>
20912 int main() {
20913 printf("$xx %d\n", SIG${xx});
20914 return 0;
20915 }
20916 EOCP
20917                 set signal
20918                 if eval $compile; then
20919                         echo "SIG${xx} found."
20920                         $run ./signal$_exe  >> signal.ls1
20921                 else
20922                         echo "SIG${xx} NOT found."
20923                 fi
20924         done
20925         if $test -s signal.ls1; then
20926                 $cat signal.nsg signal.ls1 |
20927                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20928         fi
20929
20930 fi
20931 if $test -s signal.lst; then
20932         :
20933 else
20934         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20935         echo 'kill -l' >signal
20936         set X `csh -f <signal`
20937         $rm -f signal
20938         shift
20939         case $# in
20940         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20941         esac
20942         echo $@ | $tr ' ' $trnl | \
20943             $awk '{ printf "%s %d\n", $1, ++s; }
20944                   END { printf "NSIG %d\n", ++s }' >signal.lst
20945 fi
20946 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20947 EOS
20948 chmod a+x signal_cmd
20949 $eunicefix signal_cmd
20950
20951 : generate list of signal names
20952 echo " "
20953 case "$sig_name_init" in
20954 '') doinit=yes ;;
20955 *)  case "$sig_num_init" in
20956     ''|*,*) doinit=yes ;;
20957     esac ;;
20958 esac
20959 case "$doinit" in
20960 yes)
20961         echo "Generating a list of signal names and numbers..." >&4
20962         . ./signal_cmd
20963         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20964         sig_name=`$awk 'BEGIN { printf "ZERO " }
20965                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20966         sig_num=`$awk  'BEGIN { printf "0 " }
20967                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20968         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20969                              !/^NSIG/   { printf "\"%s\", ", $1 }
20970                              END        { printf "0\n" }' signal.lst`
20971         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20972                              !/^NSIG/   { printf "%d, ", $2}
20973                              END        { printf "0\n"}' signal.lst`
20974         ;;
20975 esac
20976 echo "The following $sig_count signals are available:"
20977 echo " "
20978 echo $sig_name | $awk \
20979 'BEGIN { linelen = 0 }
20980 {
20981         for (i = 1; i <= NF; i++) {
20982                 name = "SIG" $i " "
20983                 linelen = linelen + length(name)
20984                 if (linelen > 70) {
20985                         printf "\n"
20986                         linelen = length(name)
20987                 }
20988                 printf "%s", name
20989         }
20990         printf "\n"
20991 }'
20992 sig_size=`echo $sig_name | awk '{print NF}'`
20993 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20994
20995 : Check size of size
20996 echo " "
20997 case "$sizetype" in
20998 *_t) zzz="$sizetype"    ;;
20999 *)   zzz="filesize"     ;;
21000 esac
21001 echo "Checking the size of $zzz..." >&4
21002 cat > try.c <<EOCP
21003 #include <sys/types.h>
21004 #include <stdio.h>
21005 #$i_stdlib I_STDLIB
21006 #ifdef I_STDLIB
21007 #include <stdlib.h>
21008 #endif
21009 int main() {
21010     printf("%d\n", (int)sizeof($sizetype));
21011     exit(0);
21012 }
21013 EOCP
21014 set try
21015 if eval $compile_ok; then
21016         yyy=`$run ./try`
21017         case "$yyy" in
21018         '')     sizesize=4
21019                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21020                 ;;
21021         *)      sizesize=$yyy
21022                 echo "Your $zzz size is $sizesize bytes."
21023                 ;;
21024         esac
21025 else
21026         sizesize=4
21027         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21028 fi
21029
21030
21031 : check for socklen_t
21032 echo " "
21033 echo "Checking to see if you have socklen_t..." >&4
21034 $cat >try.c <<EOCP
21035 #include <sys/types.h>
21036 #$d_socket HAS_SOCKET
21037 #ifdef HAS_SOCKET
21038 #include <sys/socket.h>
21039 #endif
21040 int main() { socklen_t x = 16; }
21041 EOCP
21042 set try
21043 if eval $compile; then
21044         val="$define"
21045         echo "You have socklen_t."
21046 else
21047         val="$undef"
21048         echo "You do not have socklen_t."
21049         case "$sizetype" in
21050         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21051         esac
21052 fi
21053 $rm_try
21054 set d_socklen_t
21055 eval $setvar
21056
21057 : see if this is a socks.h system
21058 set socks.h i_socks
21059 eval $inhdr
21060
21061 : check for type of the size argument to socket calls
21062 case "$d_socket" in
21063 "$define")
21064         $cat <<EOM
21065
21066 Checking to see what type is the last argument of accept().
21067 EOM
21068         yyy=''
21069         case "$d_socklen_t" in
21070         "$define") yyy="$yyy socklen_t"
21071         esac
21072         yyy="$yyy $sizetype int long unsigned"
21073         for xxx in $yyy; do
21074                 case "$socksizetype" in
21075                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21076                         case "$usesocks" in
21077                         "$define")
21078                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21079                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21080                                         socksizetype="$xxx"
21081                                 fi
21082                                 ;;
21083                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21084                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21085                                         socksizetype="$xxx"
21086                                 fi
21087                                 ;;
21088                         esac
21089                         ;;
21090                 esac
21091         done
21092 : In case none of those worked, prompt the user.
21093         case "$socksizetype" in
21094         '')     rp='What is the type for socket address structure sizes?'
21095                 dflt='int'
21096                 . ./myread
21097                 socksizetype=$ans
21098                 ;;
21099         esac
21100         ;;
21101 *)      : no sockets, so pick relatively harmless default
21102         socksizetype='int'
21103         ;;
21104 esac
21105
21106 : see what type is used for signed size_t
21107 set ssize_t ssizetype int stdio.h sys/types.h
21108 eval $typedef
21109 dflt="$ssizetype"
21110 $cat > try.c <<EOM
21111 #include <stdio.h>
21112 #$i_stdlib I_STDLIB
21113 #ifdef I_STDLIB
21114 #include <stdlib.h>
21115 #endif
21116 #include <sys/types.h>
21117 #define Size_t $sizetype
21118 #define SSize_t $dflt
21119 int main()
21120 {
21121         if (sizeof(Size_t) == sizeof(SSize_t))
21122                 printf("$dflt\n");
21123         else if (sizeof(Size_t) == sizeof(int))
21124                 printf("int\n");
21125         else
21126                 printf("long\n");
21127         exit(0);
21128 }
21129 EOM
21130 echo " "
21131 set try
21132 if eval $compile_ok && $run ./try > /dev/null; then
21133         ssizetype=`$run ./try`
21134         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21135 else
21136         $cat >&4 <<EOM
21137 Help! I can't compile and run the ssize_t test program: please enlighten me!
21138 (This is probably a misconfiguration in your system or libraries, and
21139 you really ought to fix it.  Still, I'll try anyway.)
21140
21141 I need a type that is the same size as $sizetype, but is guaranteed to
21142 be signed.  Common values are ssize_t, int and long.
21143
21144 EOM
21145         rp="What signed type is the same size as $sizetype?"
21146         . ./myread
21147         ssizetype="$ans"
21148 fi
21149 $rm_try
21150
21151 : Check the size of st_ino
21152 $echo " "
21153 $echo "Checking the size of st_ino..." >&4
21154 $cat > try.c <<EOCP
21155 #include <sys/stat.h>
21156 #include <stdio.h>
21157 #$i_stdlib I_STDLIB
21158 #ifdef I_STDLIB
21159 #include <stdlib.h>
21160 #endif
21161 int main() {
21162     struct stat st;
21163     printf("%d\n", (int)sizeof(st.st_ino));
21164     exit(0);
21165 }
21166 EOCP
21167 set try
21168 if eval $compile_ok; then
21169         val=`$run ./try`
21170         case "$val" in
21171         '')     st_ino_size=4
21172                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21173                 ;;
21174         *)      st_ino_size=$val
21175                 $echo "Your st_ino is $st_ino_size bytes long."
21176                 ;;
21177         esac
21178 else
21179         st_ino_size=4
21180         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21181 fi
21182 $rm_try
21183
21184 : Check if st_ino is signed
21185 $echo " "
21186 $echo "Checking the sign of st_ino..." >&4
21187 $cat > try.c <<EOCP
21188 #include <sys/stat.h>
21189 #include <stdio.h>
21190 int main() {
21191         struct stat foo;
21192         foo.st_ino = -1;
21193         if (foo.st_ino < 0)
21194                 printf("-1\n");
21195         else
21196                 printf("1\n");
21197 }
21198 EOCP
21199 set try
21200 if eval $compile; then
21201         val=`$run ./try`
21202         case "$val" in
21203         '')     st_ino_sign=1
21204                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21205                 ;;
21206         *)      st_ino_sign=$val
21207                 case "$st_ino_sign" in
21208                  1) $echo "Your st_ino is unsigned." ;;
21209                 -1) $echo "Your st_ino is signed."   ;;
21210                 esac
21211                 ;;
21212         esac
21213 else
21214         st_ino_sign=1
21215         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21216 fi
21217 $rm_try
21218
21219 : see what type of char stdio uses.
21220 echo " "
21221 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21222 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21223         echo "Your stdio uses unsigned chars." >&4
21224         stdchar="unsigned char"
21225 else
21226         echo "Your stdio uses signed chars." >&4
21227         stdchar="char"
21228 fi
21229 $rm -f stdioh
21230
21231 : see what type uids are declared as in the kernel
21232 echo " "
21233 echo "Looking for the type for user ids returned by getuid()."
21234 set uid_t uidtype xxx stdio.h sys/types.h
21235 eval $typedef
21236 case "$uidtype" in
21237 xxx)
21238         xxx=`./findhdr sys/user.h`
21239         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21240         case $1 in
21241         unsigned) dflt="$1 $2" ;;
21242         *) dflt="$1" ;;
21243         esac
21244         ;;
21245 *) dflt="$uidtype";;
21246 esac
21247 case "$uidtype" in
21248 uid_t)  echo "uid_t found." ;;
21249 *)      rp="What is the type for user ids returned by getuid()?"
21250         . ./myread
21251         uidtype="$ans"
21252         ;;
21253 esac
21254
21255 : Check size of UID
21256 echo " "
21257 case "$uidtype" in
21258 *_t) zzz="$uidtype"     ;;
21259 *)   zzz="uid"          ;;
21260 esac
21261 echo "Checking the size of $zzz..." >&4
21262 cat > try.c <<EOCP
21263 #include <sys/types.h>
21264 #include <stdio.h>
21265 #$i_stdlib I_STDLIB
21266 #ifdef I_STDLIB
21267 #include <stdlib.h>
21268 #endif
21269 int main() {
21270     printf("%d\n", (int)sizeof($uidtype));
21271     exit(0);
21272 }
21273 EOCP
21274 set try
21275 if eval $compile_ok; then
21276         yyy=`$run ./try`
21277         case "$yyy" in
21278         '')     uidsize=4
21279                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21280                 ;;
21281         *)      uidsize=$yyy
21282                 echo "Your $zzz is $uidsize bytes long."
21283                 ;;
21284         esac
21285 else
21286         uidsize=4
21287         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21288 fi
21289
21290 : Check if UID is signed
21291 echo " "
21292 case "$uidtype" in
21293 *_t) zzz="$uidtype"     ;;
21294 *)   zzz="uid"          ;;
21295 esac
21296 echo "Checking the sign of $zzz..." >&4
21297 cat > try.c <<EOCP
21298 #include <sys/types.h>
21299 #include <stdio.h>
21300 int main() {
21301         $uidtype foo = -1;
21302         if (foo < 0)
21303                 printf("-1\n");
21304         else
21305                 printf("1\n");
21306 }
21307 EOCP
21308 set try
21309 if eval $compile; then
21310         yyy=`$run ./try`
21311         case "$yyy" in
21312         '')     uidsign=1
21313                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21314                 ;;
21315         *)      uidsign=$yyy
21316                 case "$uidsign" in
21317                  1) echo "Your $zzz is unsigned." ;;
21318                 -1) echo "Your $zzz is signed."   ;;
21319                 esac
21320                 ;;
21321         esac
21322 else
21323         uidsign=1
21324         echo "(I can't compile the test program--guessing unsigned.)" >&4
21325 fi
21326
21327
21328 : Check format string for UID
21329 echo " "
21330 $echo "Checking the format string to be used for uids..." >&4
21331
21332 case "$uidsign" in
21333 -1)     if $test X"$uidsize" = X"$ivsize"; then
21334                 uidformat="$ivdformat"
21335         else
21336                 if $test X"$uidsize" = X"$longsize"; then
21337                         uidformat='"ld"'
21338                 else
21339                         if $test X"$uidsize" = X"$intsize"; then
21340                                 uidformat='"d"'
21341                         else
21342                                 if $test X"$uidsize" = X"$shortsize"; then
21343                                         uidformat='"hd"'
21344                                 fi
21345                         fi
21346                 fi
21347         fi
21348         ;;
21349 *)      if $test X"$uidsize" = X"$uvsize"; then
21350                 uidformat="$uvuformat"
21351         else
21352                 if $test X"$uidsize" = X"$longsize"; then
21353                         uidformat='"lu"'
21354                 else
21355                         if $test X"$uidsize" = X"$intsize"; then
21356                                 uidformat='"u"'
21357                         else
21358                                 if $test X"$uidsize" = X"$shortsize"; then
21359                                         uidformat='"hu"'
21360                                 fi
21361                         fi
21362                 fi
21363         fi
21364         ;;
21365 esac
21366
21367 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21368 echo " "
21369 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21370 $cat >try.c <<'EOM'
21371 /* Intentionally a long probe as I'd like to sanity check that the exact
21372    approach is going to work, as thinking it will work, but only having it
21373    part working at runtime is worse than not having it.  */
21374
21375 #include <sys/types.h>
21376 #include <sys/sysctl.h>
21377 #include <sys/param.h>
21378 #include <stdio.h>
21379 #include <string.h>
21380 #include <stdlib.h>
21381 #include <unistd.h>
21382
21383 int
21384 main(int argc, char **argv) {
21385     char *buffer;
21386     char *argv_leaf = strrchr(argv[0], '/');
21387     char *buffer_leaf;
21388     size_t size = 0;
21389     int mib[4];
21390
21391     mib[0] = CTL_KERN;
21392     mib[1] = KERN_PROC;
21393     mib[2] = KERN_PROC_PATHNAME;
21394     mib[3] = -1;
21395
21396     if (!argv_leaf) {
21397         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21398         return 1;
21399     }
21400
21401     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21402         perror("sysctl");
21403         return 2;
21404     }
21405
21406     if (size < strlen(argv_leaf) + 1) {
21407         fprintf(stderr, "size %lu is too short for a path\n",
21408                 (unsigned long) size);
21409         return 3;
21410     }
21411
21412     if (size > MAXPATHLEN * MAXPATHLEN) {
21413         fprintf(stderr, "size %lu is too long for a path\n",
21414                 (unsigned long) size);
21415         return 4;
21416     }
21417
21418     buffer = malloc(size);
21419     if (!buffer) {
21420         perror("malloc");
21421         return 5;
21422     }
21423
21424     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21425         perror("sysctl");
21426         return 6;
21427     }
21428
21429     if (strlen(buffer) + 1 != size) {
21430         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21431                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21432         return 7;
21433     }
21434
21435
21436     if (*buffer != '/') {
21437         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21438         return 8;
21439     }
21440
21441     if (strstr(buffer, "/./")) {
21442         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21443         return 9;
21444     }
21445
21446     if (strstr(buffer, "/../")) {
21447         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21448         return 10;
21449     }
21450
21451     buffer_leaf = strrchr(buffer, '/');
21452     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21453         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21454         return 11;
21455     }
21456
21457     free(buffer);
21458
21459     return 0;
21460 }
21461 EOM
21462
21463 val=$undef
21464 set try
21465 if eval $compile_ok; then
21466         if $run ./try; then
21467                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21468                 val="$define"
21469         else
21470                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21471                 val="$undef"
21472         fi
21473 else
21474         echo "I'm unable to compile the test program." >&4
21475         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21476         val="$undef"
21477 fi
21478 $rm_try
21479 set usekernprocpathname
21480 eval $setvar
21481
21482 : Determine if we can use _NSGetExecutablePath to find executing program
21483 echo " "
21484 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21485 $cat >try.c <<'EOM'
21486 /* Intentionally a long probe as I'd like to sanity check that the exact
21487    approach is going to work, as thinking it will work, but only having it
21488    part working at runtime is worse than not having it.  */
21489 #include <mach-o/dyld.h>
21490 #include <stdio.h>
21491 #include <stdlib.h>
21492 #include <sys/param.h>
21493 #include <string.h>
21494
21495 int
21496 main(int argc, char **argv) {
21497     char buf[1];
21498     uint32_t size = sizeof(buf);
21499     int result;
21500     char *buffer;
21501     char *tidied;
21502     char *argv_leaf = strrchr(argv[0], '/');
21503     char *tidied_leaf;
21504
21505     if (!argv_leaf) {
21506         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21507         return 1;
21508     }
21509
21510     _NSGetExecutablePath(buf, &size);
21511     if (size > MAXPATHLEN * MAXPATHLEN) {
21512         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21513                 (unsigned int) size);
21514         return 2;
21515     }
21516
21517     buffer = malloc(size);
21518     if (!buffer) {
21519         perror("malloc");
21520         return 3;
21521     }
21522
21523     result = _NSGetExecutablePath(buffer, &size);
21524     if (result != 0) {
21525         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21526                 result, (unsigned int) size);
21527         return 4;
21528     }
21529
21530     tidied = realpath(buffer, NULL);
21531     if (!tidied) {
21532         perror("realpath");
21533         return 5;
21534     }
21535
21536     free(buffer);
21537
21538     if (*tidied != '/') {
21539         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21540         return 6;
21541     }
21542
21543     if (strstr(tidied, "/./")) {
21544         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21545         return 7;
21546     }
21547
21548     if (strstr(tidied, "/../")) {
21549         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21550         return 8;
21551     }
21552
21553     tidied_leaf = strrchr(tidied, '/');
21554     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21555         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21556         return 9;
21557     }
21558
21559     free(tidied);
21560
21561     return 0;
21562 }
21563 EOM
21564
21565 val=$undef
21566 set try
21567 if eval $compile_ok; then
21568         if $run ./try; then
21569                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21570                 val="$define"
21571         else
21572                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21573         fi
21574 else
21575         echo "I'm unable to compile the test program." >&4
21576         echo "I'll assume no _NSGetExecutablePath here." >&4
21577 fi
21578 $rm_try
21579 set usensgetexecutablepath
21580 eval $setvar
21581
21582 : Check if site customization support was requested
21583 case "$usesitecustomize" in
21584     $define|true|[Yy]*)
21585         usesitecustomize="$define"
21586         ;;
21587     *)
21588         usesitecustomize="$undef"
21589         ;;
21590     esac
21591
21592 : see if prototypes support variable argument declarations
21593 echo " "
21594 case "$prototype$i_stdarg" in
21595 $define$define)
21596         echo "It appears we'll be able to prototype varargs functions." >&4
21597         val="$define"
21598         ;;
21599 *)
21600         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21601         val="$undef"
21602         ;;
21603 esac
21604 set vaproto
21605 eval $setvar
21606
21607 : determine compiler compiler
21608 case "$yacc" in
21609 '')
21610         dflt=yacc;;
21611 *)
21612         dflt="$yacc";;
21613 esac
21614 echo " "
21615 comp='yacc'
21616 if $test -f "$byacc$_exe"; then
21617         dflt="$byacc"
21618         comp="byacc or $comp"
21619 fi
21620 if $test -f "$bison$_exe"; then
21621         comp="$comp or bison -y"
21622 fi
21623 rp="Which compiler compiler ($comp) shall I use?"
21624 . ./myread
21625 yacc="$ans"
21626 case "$yacc" in
21627 *bis*)
21628         case "$yacc" in
21629         *-y*) ;;
21630         *)
21631                 yacc="$yacc -y"
21632                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21633                 ;;
21634         esac
21635         ;;
21636 esac
21637
21638 : see if this is a assert.h system
21639 set assert.h i_assert
21640 eval $inhdr
21641
21642 : see if this is a fp.h system
21643 set fp.h i_fp
21644 eval $inhdr
21645
21646 : see if this is a fp_class.h system
21647 set fp_class.h i_fp_class
21648 eval $inhdr
21649
21650 : see if gdbm.h is available
21651 set gdbm.h t_gdbm
21652 eval $inhdr
21653 case "$t_gdbm" in
21654 $define)
21655         : see if gdbm_open exists
21656         set gdbm_open d_gdbm_open
21657         eval $inlibc
21658         case "$d_gdbm_open" in
21659         $undef)
21660                 t_gdbm="$undef"
21661                 echo "We won't be including <gdbm.h>"
21662                 ;;
21663         esac
21664         ;;
21665 esac
21666 val="$t_gdbm"
21667 set i_gdbm
21668 eval $setvar
21669
21670 : see if this is a ieeefp.h system
21671 case "$i_ieeefp" in
21672 '' ) set ieeefp.h i_ieeefp
21673      eval $inhdr
21674      ;;
21675 esac
21676
21677 : see if this is a libutil.h system
21678 set libutil.h i_libutil
21679 eval $inhdr
21680
21681 : see if mach cthreads are available
21682 if test "X$usethreads" = "X$define"; then
21683         set mach/cthreads.h i_machcthr
21684         eval $inhdr
21685 else
21686         i_machcthr="$undef"
21687 fi
21688
21689 : see if this is a mntent.h system
21690 set mntent.h i_mntent
21691 eval $inhdr
21692
21693 : see if net/errno.h is available
21694 val=''
21695 set net/errno.h val
21696 eval $inhdr
21697
21698 : Unfortunately, it causes problems on some systems.  Arrgh.
21699 case "$val" in
21700 $define)
21701         cat > try.c <<'EOM'
21702 #include <stdio.h>
21703 #include <errno.h>
21704 #include <net/errno.h>
21705 int func()
21706 {
21707         return ENOTSOCK;
21708 }
21709 EOM
21710         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21711                 echo "We'll be including <net/errno.h>." >&4
21712         else
21713                 echo "We won't be including <net/errno.h>." >&4
21714                 val="$undef"
21715         fi
21716         $rm_try
21717         ;;
21718 esac
21719 set i_neterrno
21720 eval $setvar
21721
21722 : see if netinet/tcp.h is available
21723 set netinet/tcp.h i_netinettcp
21724 eval $inhdr
21725
21726 : see if this is a poll.h system
21727 set poll.h i_poll
21728 eval $inhdr
21729
21730 : see if this is a prot.h system
21731 set prot.h i_prot
21732 eval $inhdr
21733
21734 : Preprocessor symbols
21735 echo " "
21736 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21737 $cat <<'EOSH' > Cppsym.know
21738 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21739 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21740 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21741 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21742 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21743 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21744 bull c cadmus clipper CMU COFF COMPILER_VERSION
21745 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21746 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21747 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21748 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21749 GLIBC GLIBC_MINOR
21750 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21751 H3050R H3050RX hbullx20 hcx host_mips
21752 hp200 hp300 hp700 HP700 hp800 hp9000
21753 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21754 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21755 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21756 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21757 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21758 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21759 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21760 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21761 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21762 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21763 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21764 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21765 MATH_HAS_NO_SIDE_EFFECTS
21766 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21767 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21768 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21769 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21770 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21771 NetBSD news1500 news1700 news1800 news1900 news3700
21772 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21773 ns32016 ns32332 ns32k nsc32000
21774 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21775 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21776 pc532 pdp11 PGC PIC plexus PORTAR posix
21777 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21778 POSIX_C_SOURCE POSIX_SOURCE POWER
21779 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21780 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21781 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21782 sony sony_news sonyrisc sparc sparclite spectrum
21783 stardent stdc STDC_EXT stratos sun sun3 sun386
21784 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21785 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21786 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21787 sysV68 sysV88 Tek4132 Tek4300 titan
21788 TM3200 TM5400 TM5600
21789 tower tower32 tower32_200 tower32_600 tower32_700
21790 tower32_800 tower32_850 tss
21791 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21792 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21793 unix UNIX95 UNIX99 unixpc unos
21794 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21795 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21796 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21797 USGr4 USGr4_2
21798 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21799 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21800 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21801 z8000
21802 EOSH
21803 # Maybe put other stuff here too.
21804 cat <<EOSH >>Cppsym.know
21805 $osname
21806 EOSH
21807 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21808 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21809 $cat Cppsym.know > Cppsym.c
21810 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21811 $rm -f Cppsym.a Cppsym.b Cppsym.c
21812 cat <<EOSH > Cppsym
21813 $startsh
21814 if $test \$# -gt 0; then
21815     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21816     if $test -s Cppsym.got; then
21817         $rm -f Cppsym.got
21818         exit 0
21819     fi
21820     $rm -f Cppsym.got
21821     exit 1
21822 else
21823     $tr " " "$trnl" | ./Cppsym.try
21824     exit 0
21825 fi
21826 EOSH
21827 chmod +x Cppsym
21828 $eunicefix Cppsym
21829 cat <<EOSH > Cppsym.try
21830 $startsh
21831 cat <<'EOCP' > try.c
21832 #include <stdio.h>
21833 #if cpp_stuff == 1
21834 #define STRINGIFY(a)    "a"
21835 #endif
21836 #if cpp_stuff == 42
21837 #define StGiFy(a)  #a
21838 #define STRINGIFY(a)    StGiFy(a)
21839 #endif
21840 #if $cpp_stuff != 1 && $cpp_stuff != 42
21841 #   include "Bletch: How does this C preprocessor stringify macros?"
21842 #endif
21843 int main() {
21844 EOCP
21845 $awk \\
21846 EOSH
21847 cat <<'EOSH' >> Cppsym.try
21848 'length($1) > 0 {
21849     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21850     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21851     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21852     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21853 }'       >> try.c
21854 echo 'return 0;}' >> try.c
21855 EOSH
21856 cat <<EOSH >> Cppsym.try
21857 ccflags="$ccflags"
21858 case "$osname-$gccversion" in
21859 irix-) ccflags="\$ccflags -woff 1178" ;;
21860 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21861 esac
21862 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21863 EOSH
21864 chmod +x Cppsym.try
21865 $eunicefix Cppsym.try
21866 ./Cppsym < Cppsym.know > Cppsym.true
21867 : Add in any linux cpp "predefined macros":
21868 case "$osname::$gccversion" in
21869   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21870     tHdrH=_tmpHdr
21871     rm -f $tHdrH'.h' $tHdrH
21872     touch $tHdrH'.h'
21873     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21874        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21875        if [ -s $tHdrH'_cppsym.real' ]; then
21876           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21877        fi
21878     fi
21879     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21880   ;;
21881 esac
21882 : now check the C compiler for additional symbols
21883 postprocess_cc_v=''
21884 case "$osname" in
21885 aix) postprocess_cc_v="|$tr , ' '" ;;
21886 esac
21887 $cat >ccsym <<EOS
21888 $startsh
21889 $cat >tmp.c <<EOF
21890 extern int foo;
21891 EOF
21892 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21893 do
21894         case "\$i" in
21895         -D*) echo "\$i" | $sed 's/^-D//';;
21896         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21897         esac
21898 done
21899 $rm_try
21900 EOS
21901 postprocess_cc_v=''
21902 chmod +x ccsym
21903 $eunicefix ccsym
21904 ./ccsym > ccsym1.raw
21905 if $test -s ccsym1.raw; then
21906        $sort ccsym1.raw | $uniq >ccsym.raw
21907 else
21908        mv ccsym1.raw ccsym.raw
21909 fi
21910
21911 $awk '/\=/ { print $0; next }
21912         { print $0"=1" }' ccsym.raw >ccsym.list
21913 $comm -13 Cppsym.true ccsym.list >ccsym.own
21914 $comm -12 Cppsym.true ccsym.list >ccsym.com
21915 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21916 also=''
21917 if $test -z ccsym.raw; then
21918         echo "Your C compiler doesn't seem to define any symbols!" >&4
21919         echo " "
21920         echo "However, your C preprocessor defines the following symbols:"
21921         $cat Cppsym.true
21922         ccsymbols=''
21923         cppsymbols=`$cat Cppsym.true`
21924         cppsymbols=`echo $cppsymbols`
21925         cppccsymbols="$cppsymbols"
21926 else
21927         if $test -s ccsym.com; then
21928                 echo "Your C compiler and pre-processor define these symbols:"
21929                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21930                 also='also '
21931                 symbols='ones'
21932                 cppccsymbols=`$cat ccsym.com`
21933                 cppccsymbols=`echo $cppccsymbols`
21934                 $test "$silent" || sleep 1
21935         fi
21936         if $test -s ccsym.cpp; then
21937                 $test "$also" && echo " "
21938                 echo "Your C pre-processor ${also}defines the following symbols:"
21939                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21940                 also='further '
21941                 cppsymbols=`$cat ccsym.cpp`
21942                 cppsymbols=`echo $cppsymbols`
21943                 $test "$silent" || sleep 1
21944         fi
21945         if $test -s ccsym.own; then
21946                 $test "$also" && echo " "
21947                 echo "Your C compiler ${also}defines the following cpp symbols:"
21948                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21949                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21950                 ccsymbols=`$cat ccsym.own`
21951                 ccsymbols=`echo $ccsymbols`
21952                 $test "$silent" || sleep 1
21953         fi
21954 fi
21955
21956 : see if this is a termio system
21957 val="$undef"
21958 val2="$undef"
21959 val3="$undef"
21960 if $test `./findhdr termios.h`; then
21961         set tcsetattr i_termios
21962         eval $inlibc
21963         val3="$i_termios"
21964 fi
21965 echo " "
21966 case "$val3" in
21967 "$define") echo "You have POSIX termios.h... good!" >&4;;
21968 *) if ./Cppsym pyr; then
21969                 case "`/bin/universe`" in
21970                 ucb) if $test `./findhdr sgtty.h`; then
21971                                 val2="$define"
21972                                 echo "<sgtty.h> found." >&4
21973                         else
21974                                 echo "System is pyramid with BSD universe."
21975                                 ./warn "<sgtty.h> not found--you could have problems."
21976                         fi;;
21977                 *) if $test `./findhdr termio.h`; then
21978                                 val="$define"
21979                                 echo "<termio.h> found." >&4
21980                         else
21981                                 echo "System is pyramid with USG universe."
21982                                 ./warn "<termio.h> not found--you could have problems."
21983                         fi;;
21984                 esac
21985         elif ./usg; then
21986                 if $test `./findhdr termio.h`; then
21987                         echo "<termio.h> found." >&4
21988                         val="$define"
21989                 elif $test `./findhdr sgtty.h`; then
21990                         echo "<sgtty.h> found." >&4
21991                         val2="$define"
21992                 else
21993                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21994                 fi
21995         else
21996                 if $test `./findhdr sgtty.h`; then
21997                         echo "<sgtty.h> found." >&4
21998                         val2="$define"
21999                 elif $test `./findhdr termio.h`; then
22000                         echo "<termio.h> found." >&4
22001                         val="$define"
22002                 else
22003                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22004                 fi
22005         fi;;
22006 esac
22007 set i_termio; eval $setvar
22008 val=$val2; set i_sgtty; eval $setvar
22009 val=$val3; set i_termios; eval $setvar
22010
22011 : see if stdbool is available
22012 : we want a real compile instead of Inhdr because some Solaris systems
22013 : have stdbool.h, but it can only be used if the compiler indicates it
22014 : is sufficiently c99-compliant.
22015 echo " "
22016 $cat >try.c <<EOCP
22017 #include <stdio.h>
22018 #include <stdbool.h>
22019 int func(bool x)
22020 {
22021     return x ? 1 : 0;
22022 }
22023 int main(int argc, char **argv)
22024 {
22025     return func(0);
22026 }
22027 EOCP
22028 set try
22029 if eval $compile; then
22030         echo "<stdbool.h> found." >&4
22031         val="$define"
22032 else
22033         echo "<stdbool.h> NOT found." >&4
22034         val="$undef"
22035 fi
22036 $rm_try
22037 set i_stdbool
22038 eval $setvar
22039
22040 : see if stddef is available
22041 set stddef.h i_stddef
22042 eval $inhdr
22043
22044 : see if sys/access.h is available
22045 set sys/access.h i_sysaccess
22046 eval $inhdr
22047
22048 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22049 set sys/filio.h i_sysfilio
22050 eval $inhdr
22051 echo " "
22052 if $test `./findhdr sys/ioctl.h`; then
22053         val="$define"
22054         echo '<sys/ioctl.h> found.' >&4
22055 else
22056         val="$undef"
22057         if $test $i_sysfilio = "$define"; then
22058             echo '<sys/ioctl.h> NOT found.' >&4
22059         else
22060                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22061                 $test $i_termio = "$define" && xxx="termio.h"
22062                 $test $i_termios = "$define" && xxx="termios.h"
22063 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22064         fi
22065 fi
22066 set i_sysioctl
22067 eval $setvar
22068
22069 : see if socket ioctl defs are in sys/sockio.h
22070 echo " "
22071 xxx=`./findhdr sys/sockio.h`
22072 if $test "$xxx"; then
22073         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22074                 val="$define"
22075                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22076         else
22077                 val="$undef"
22078                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22079         fi
22080 else
22081         val="$undef"
22082         $cat <<EOM
22083 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22084 EOM
22085 fi
22086 set i_syssockio
22087 eval $setvar
22088
22089 : see if this is a syslog.h system
22090 set syslog.h i_syslog
22091 eval $inhdr
22092
22093 : see if this is a sys/mode.h system
22094 set sys/mode.h i_sysmode
22095 eval $inhdr
22096
22097 : see if there is a sys/poll.h file
22098 set sys/poll.h i_syspoll
22099 eval $inhdr
22100
22101 : see if sys/resource.h has to be included
22102 set sys/resource.h i_sysresrc
22103 eval $inhdr
22104
22105 : see if sys/security.h is available
22106 set sys/security.h i_syssecrt
22107 eval $inhdr
22108
22109 : see if this is a sys/statvfs.h system
22110 set sys/statvfs.h i_sysstatvfs
22111 eval $inhdr
22112
22113 : see if this is a sys/un.h system
22114 set sys/un.h i_sysun
22115 eval $inhdr
22116
22117 : see if this is a sys/utsname.h system
22118 set sys/utsname.h i_sysutsname
22119 eval $inhdr
22120
22121 : see if this is a syswait system
22122 set sys/wait.h i_syswait
22123 eval $inhdr
22124
22125 : see if this is a ustat.h system
22126 set ustat.h i_ustat
22127 eval $inhdr
22128
22129 : see if this is an utime system
22130 set utime.h i_utime
22131 eval $inhdr
22132
22133 : see if this is a vfork system
22134 case "$d_vfork" in
22135 "$define")
22136         set vfork.h i_vfork
22137         eval $inhdr
22138         ;;
22139 *)
22140         i_vfork="$undef"
22141         ;;
22142 esac
22143
22144 : Check extensions
22145 echo " "
22146 echo "Looking for extensions..." >&4
22147 : If we are using the old config.sh, known_extensions may contain
22148 : old or inaccurate or duplicate values.
22149 known_extensions=''
22150 nonxs_extensions=''
22151 : We do not use find because it might not be available.
22152 : We do not just use MANIFEST because the user may have dropped
22153 : some additional extensions into the source tree and expect them
22154 : to be built.
22155
22156 : Function to recursively find available extensions, ignoring DynaLoader
22157 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22158 : In 5.10.1 and later, extensions are stored in directories
22159 : like File-Glob instead of the older File/Glob/.
22160 find_extensions='
22161     for xxx in *; do
22162         case "$xxx" in
22163             DynaLoader|dynaload) ;;
22164             *)
22165             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22166             leaf=`echo $xxx | $sed -e s/.*-//`;
22167             if $test -d File; then
22168                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22169                     known_extensions="$known_extensions $1$this_ext";
22170                 elif $test -f $xxx/Makefile.PL; then
22171                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22172                 else
22173                     if $test -d $xxx -a $# -lt 10; then
22174                         set $1$xxx/ $*;
22175                         cd "$xxx";
22176                         eval $find_extensions;
22177                         cd ..;
22178                         shift;
22179                     fi;
22180                 fi;
22181             else
22182                 $ls -1 $xxx > $$.tmp;
22183                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22184                     known_extensions="$known_extensions $this_ext";
22185                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22186                     known_extensions="$known_extensions $this_ext";
22187                 elif $test -d $xxx; then
22188                     nonxs_extensions="$nonxs_extensions $this_ext";
22189                 fi;
22190                 $rm -f $$.tmp;
22191             fi
22192             ;;
22193         esac;
22194     done'
22195 tdir=`pwd`
22196 cd "$rsrc/cpan"
22197 set X
22198 shift
22199 eval $find_extensions
22200 cd "$rsrc/dist"
22201 set X
22202 shift
22203 eval $find_extensions
22204 cd "$rsrc/ext"
22205 set X
22206 shift
22207 eval $find_extensions
22208 if $test -d File-Glob; then
22209     : All ext/ flattened
22210 else
22211     # Special case:  Add in modules that nest beyond the first level.
22212     # Currently threads/shared and Hash/Util/FieldHash, since they are
22213     # not picked up by the recursive find above (and adding in general
22214     # recursive finding breaks SDBM_File/sdbm).
22215     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22216     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22217 fi
22218 set X $known_extensions
22219 shift
22220 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22221 set X $nonxs_extensions
22222 shift
22223 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22224 cd "$tdir"
22225
22226 : Now see which are supported on this system.
22227 avail_ext=''
22228 for xxx in $known_extensions ; do
22229         case "$xxx" in
22230         DB_File|db_file)
22231                 case "$i_db" in
22232                 $define) avail_ext="$avail_ext $xxx" ;;
22233                 esac
22234                 ;;
22235         GDBM_File|gdbm_fil)
22236                 case "$i_gdbm" in
22237                 $define) avail_ext="$avail_ext $xxx" ;;
22238                 esac
22239                 ;;
22240         I18N/Langinfo|i18n_lan)
22241                 case "$i_langinfo$d_nl_langinfo" in
22242                 $define$define) avail_ext="$avail_ext $xxx" ;;
22243                 esac
22244                 ;;
22245         IPC/SysV|ipc/sysv)
22246                 : XXX Do we need a useipcsysv variable here
22247                 case "${d_msg}${d_sem}${d_shm}" in
22248                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22249                 esac
22250                 ;;
22251         NDBM_File|ndbm_fil)
22252                 case "$d_ndbm" in
22253                 $define)
22254                     case "$osname-$use64bitint" in
22255                     hpux-define)
22256                         case "$libs" in
22257                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22258                         esac
22259                         ;;
22260                     *) avail_ext="$avail_ext $xxx" ;;
22261                     esac
22262                     ;;
22263                 esac
22264                 ;;
22265         ODBM_File|odbm_fil)
22266                 case "${i_dbm}${i_rpcsvcdbm}" in
22267                 *"${define}"*)
22268                     case "$d_cplusplus" in
22269                     define) ;; # delete as a function name will not work
22270                     *)  case "$osname-$use64bitint" in
22271                         hpux-define)
22272                             case "$libs" in
22273                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22274                             esac
22275                             ;;
22276                         *) avail_ext="$avail_ext $xxx" ;;
22277                         esac
22278                         ;;
22279                     esac
22280                     ;;
22281                 esac
22282                 ;;
22283         Opcode|opcode)
22284                 case "$useopcode" in
22285                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22286                 esac
22287                 ;;
22288         POSIX|posix)
22289                 case "$useposix" in
22290                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22291                 esac
22292                 ;;
22293         Socket|socket)
22294                 case "$d_socket" in
22295                 true|$define|y)
22296                     case "$osname" in
22297                     beos) ;; # not unless BONE
22298                     *) avail_ext="$avail_ext $xxx" ;;
22299                     esac
22300                     ;;
22301                 esac
22302                 ;;
22303         Sys/Syslog|sys/syslog)
22304                 : XXX syslog requires socket
22305                 case "$d_socket" in
22306                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22307                 esac
22308                 ;;
22309         Thread|thread)
22310                 case "$usethreads" in
22311                 true|$define|y)
22312                         case "$use5005threads" in
22313                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22314                         esac
22315                 esac
22316                 ;;
22317         threads|threads/shared)
22318                 # threads and threads::shared are special cases.
22319                 # To stop people from asking "Perl 5.8.0 was supposed
22320                 # to have this new fancy threads implementation but my
22321                 # perl doesn't have it" and from people trying to
22322                 # (re)install the threads module using CPAN.pm and
22323                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22324                 # the threads.pm and threads/shared.pm will always be
22325                 # there, croaking informatively ("you need to rebuild
22326                 # all of Perl with threads, sorry") when threads haven't
22327                 # been compiled in.
22328                 # --jhi
22329                 avail_ext="$avail_ext $xxx"
22330                 ;;
22331         VMS*)
22332                 ;;
22333         Win32*)
22334                 case "$osname" in
22335                 cygwin) avail_ext="$avail_ext $xxx" ;;
22336                 esac
22337                 ;;
22338         XS/APItest|xs/apitest)
22339                 # This is just for testing.  Skip it unless we have dynamic loading.
22340
22341                 case "$usedl" in
22342                 $define) avail_ext="$avail_ext $xxx" ;;
22343                 esac
22344                 ;;
22345         XS/Typemap|xs/typemap)
22346                 # This is just for testing.  Skip it unless we have dynamic loading.
22347                 case "$usedl" in
22348                 $define) avail_ext="$avail_ext $xxx" ;;
22349                 esac
22350                 ;;
22351         *)      avail_ext="$avail_ext $xxx"
22352                 ;;
22353         esac
22354 done
22355
22356 set X $avail_ext
22357 shift
22358 avail_ext="$*"
22359
22360 case "$onlyextensions" in
22361 '') ;;
22362 *)  keepextensions=''
22363     echo "You have requested that only certain extensions be included..." >&4
22364     for i in $onlyextensions; do
22365         case " $avail_ext " in
22366         *" $i "*)
22367             echo "Keeping extension $i."
22368             keepextensions="$keepextensions $i"
22369             ;;
22370         *) echo "Ignoring extension $i." ;;
22371         esac
22372     done
22373     avail_ext="$keepextensions"
22374     ;;
22375 esac
22376
22377 case "$noextensions" in
22378 '') ;;
22379 *)  keepextensions=''
22380     echo "You have requested that certain extensions be ignored..." >&4
22381     for i in $avail_ext; do
22382         case " $noextensions " in
22383         *" $i "*) echo "Ignoring extension $i." ;;
22384         *) echo "Keeping extension $i.";
22385            keepextensions="$keepextensions $i"
22386            ;;
22387         esac
22388     done
22389     avail_ext="$keepextensions"
22390     ;;
22391 esac
22392
22393 : Now see which nonxs extensions are supported on this system.
22394 : For now assume all are.
22395 nonxs_ext=''
22396 for xxx in $nonxs_extensions ; do
22397         case "$xxx" in
22398         *)      nonxs_ext="$nonxs_ext $xxx"
22399                 ;;
22400         esac
22401 done
22402
22403 set X $nonxs_ext
22404 shift
22405 nonxs_ext="$*"
22406
22407 case $usedl in
22408 $define)
22409         $cat <<EOM
22410 A number of extensions are supplied with $package.  You may choose to
22411 compile these extensions for dynamic loading (the default), compile
22412 them into the $package executable (static loading), or not include
22413 them at all.  Answer "none" to include no extensions.
22414 Note that DynaLoader is always built and need not be mentioned here.
22415
22416 EOM
22417         case "$dynamic_ext" in
22418         '')
22419                 : Exclude those listed in static_ext
22420                 dflt=''
22421                 for xxx in $avail_ext; do
22422                         case " $static_ext " in
22423                         *" $xxx "*) ;;
22424                         *) dflt="$dflt $xxx" ;;
22425                         esac
22426                 done
22427                 set X $dflt
22428                 shift
22429                 dflt="$*"
22430                 ;;
22431         *)      dflt="$dynamic_ext"
22432                 # Perhaps we are reusing an old out-of-date config.sh.
22433                 case "$hint" in
22434                 previous)
22435                         if test X"$dynamic_ext" != X"$avail_ext"; then
22436                                 $cat <<EOM
22437 NOTICE:  Your previous config.sh list may be incorrect.
22438 The extensions now available to you are
22439         ${avail_ext}
22440 but the default list from your previous config.sh is
22441         ${dynamic_ext}
22442
22443 EOM
22444                         fi
22445                         ;;
22446                 esac
22447                 ;;
22448         esac
22449         case "$dflt" in
22450         '')     dflt=none;;
22451         esac
22452         rp="What extensions do you wish to load dynamically?"
22453         . ./myread
22454         case "$ans" in
22455         none) dynamic_ext=' ' ;;
22456         *) dynamic_ext="$ans" ;;
22457         esac
22458
22459         case "$static_ext" in
22460         '')
22461                 : Exclude those already listed in dynamic linking
22462                 dflt=''
22463                 for xxx in $avail_ext; do
22464                         case " $dynamic_ext " in
22465                         *" $xxx "*) ;;
22466                         *) dflt="$dflt $xxx" ;;
22467                         esac
22468                 done
22469                 set X $dflt
22470                 shift
22471                 dflt="$*"
22472                 ;;
22473         *)  dflt="$static_ext"
22474                 ;;
22475         esac
22476
22477         case "$dflt" in
22478         '')     dflt=none;;
22479         esac
22480         rp="What extensions do you wish to load statically?"
22481         . ./myread
22482         case "$ans" in
22483         none) static_ext=' ' ;;
22484         *) static_ext="$ans" ;;
22485         esac
22486         ;;
22487 *)
22488         $cat <<EOM
22489 A number of extensions are supplied with $package.  Answer "none"
22490 to include no extensions.
22491 Note that DynaLoader is always built and need not be mentioned here.
22492
22493 EOM
22494         case "$static_ext" in
22495         '') dflt="$avail_ext" ;;
22496         *)      dflt="$static_ext"
22497                 # Perhaps we are reusing an old out-of-date config.sh.
22498                 case "$hint" in
22499                 previous)
22500                         if test X"$static_ext" != X"$avail_ext"; then
22501                                 $cat <<EOM
22502 NOTICE:  Your previous config.sh list may be incorrect.
22503 The extensions now available to you are
22504         ${avail_ext}
22505 but the default list from your previous config.sh is
22506         ${static_ext}
22507
22508 EOM
22509                         fi
22510                         ;;
22511                 esac
22512                 ;;
22513         esac
22514         : Exclude those that are not xs extensions
22515         case "$dflt" in
22516         '')     dflt=none;;
22517         esac
22518         rp="What extensions do you wish to include?"
22519         . ./myread
22520         case "$ans" in
22521         none) static_ext=' ' ;;
22522         *) static_ext="$ans" ;;
22523         esac
22524         ;;
22525 esac
22526 #
22527 # Encode is a special case.  If we are building Encode as a static
22528 # extension, we need to explicitly list its subextensions as well.
22529 # For other nested extensions, this is handled automatically by
22530 # the appropriate Makefile.PL.
22531 case " $static_ext " in
22532         *" Encode "*) # Add the subextensions of Encode
22533         cd "$rsrc/cpan"
22534         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22535                 static_ext="$static_ext Encode/$xxx"
22536         done
22537         cd "$tdir"
22538         ;;
22539 esac
22540
22541 set X $dynamic_ext $static_ext $nonxs_ext
22542 shift
22543 extensions="$*"
22544
22545 # Sanity check:  We require an extension suitable for use with
22546 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22547 # should show up as failures in the test suite, but it's helpful to
22548 # catch them now.) The 'extensions' list is normally sorted
22549 # alphabetically, so we need to accept either
22550 #    DB_File ... Fcntl ... IO  ....
22551 # or something like
22552 #    Fcntl ... NDBM_File ... IO  ....
22553 case " $extensions"  in
22554 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22555 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22556 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22557 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22558    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22559    ;;
22560 esac
22561
22562 : Remove libraries needed only for extensions
22563 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22564 : The exception is SunOS 4.x, which needs them.
22565 case "${osname}X${osvers}" in
22566 sunos*X4*)
22567     perllibs="$libs"
22568     ;;
22569 *) case "$usedl" in
22570     $define|true|[yY]*)
22571             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22572             shift
22573             perllibs="$*"
22574             ;;
22575     *)  perllibs="$libs"
22576             ;;
22577     esac
22578     ;;
22579 esac
22580
22581 : Remove build directory name from cppstdin so it can be used from
22582 : either the present location or the final installed location.
22583 echo " "
22584 : Get out of the UU directory to get correct path name.
22585 cd ..
22586 case "$cppstdin" in
22587 `pwd`/cppstdin)
22588         echo "Stripping down cppstdin path name"
22589         cppstdin=cppstdin
22590         ;;
22591 esac
22592 cd UU
22593
22594 : end of configuration questions
22595 echo " "
22596 echo "End of configuration questions."
22597 echo " "
22598
22599 : back to where it started
22600 if test -d ../UU; then
22601         cd ..
22602 fi
22603
22604 : configuration may be unconditionally patched via a 'config.arch' file
22605 if $test -f config.arch; then
22606         echo "I see a config.arch file, loading it." >&4
22607         . ./config.arch
22608 fi
22609
22610 : configuration may be patched via a 'config.over' file
22611 if $test -f config.over; then
22612         echo " "
22613         dflt=y
22614         rp='I see a config.over file.  Do you wish to load it?'
22615         . UU/myread
22616         case "$ans" in
22617         n*) echo "OK, I'll ignore it.";;
22618         *)      . ./config.over
22619                 echo "Configuration override changes have been loaded."
22620                 ;;
22621         esac
22622 fi
22623
22624 : in case they want portability, strip down executable paths
22625 case "$d_portable" in
22626 "$define")
22627         echo " "
22628         echo "Stripping down executable paths..." >&4
22629         for file in $loclist $trylist; do
22630                 eval temp=\$$file
22631                 eval $file=`basename $temp`
22632         done
22633         ;;
22634 esac
22635
22636 : create config.sh file
22637 echo " "
22638 echo "Creating config.sh..." >&4
22639 $spitshell <<EOT >config.sh
22640 $startsh
22641 #
22642 # This file was produced by running the Configure script. It holds all the
22643 # definitions figured out by Configure. Should you modify one of these values,
22644 # do not forget to propagate your changes by running "Configure -der". You may
22645 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22646 #
22647
22648 # Package name      : $package
22649 # Source directory  : $src
22650 # Configuration time: $cf_time
22651 # Configured by     : $cf_by
22652 # Target system     : $myuname
22653
22654 EOT
22655 : Add in command line options if available
22656 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22657
22658 $spitshell <<EOT >>config.sh
22659
22660 Author='$Author'
22661 Date='$Date'
22662 Header='$Header'
22663 Id='$Id'
22664 Locker='$Locker'
22665 Log='$Log'
22666 RCSfile='$RCSfile'
22667 Revision='$Revision'
22668 Source='$Source'
22669 State='$State'
22670 _a='$_a'
22671 _exe='$_exe'
22672 _o='$_o'
22673 afs='$afs'
22674 afsroot='$afsroot'
22675 alignbytes='$alignbytes'
22676 ansi2knr='$ansi2knr'
22677 aphostname='$aphostname'
22678 api_revision='$api_revision'
22679 api_subversion='$api_subversion'
22680 api_version='$api_version'
22681 api_versionstring='$api_versionstring'
22682 ar='$ar'
22683 archlib='$archlib'
22684 archlibexp='$archlibexp'
22685 archname64='$archname64'
22686 archname='$archname'
22687 archobjs='$archobjs'
22688 asctime_r_proto='$asctime_r_proto'
22689 awk='$awk'
22690 baserev='$baserev'
22691 bash='$bash'
22692 bin='$bin'
22693 bin_ELF='$bin_ELF'
22694 binexp='$binexp'
22695 bison='$bison'
22696 byacc='$byacc'
22697 byteorder='$byteorder'
22698 c='$c'
22699 castflags='$castflags'
22700 cat='$cat'
22701 cc='$cc'
22702 cccdlflags='$cccdlflags'
22703 ccdlflags='$ccdlflags'
22704 ccflags='$ccflags'
22705 ccflags_uselargefiles='$ccflags_uselargefiles'
22706 ccname='$ccname'
22707 ccsymbols='$ccsymbols'
22708 ccversion='$ccversion'
22709 cf_by='$cf_by'
22710 cf_email='$cf_email'
22711 cf_time='$cf_time'
22712 charbits='$charbits'
22713 charsize='$charsize'
22714 chgrp='$chgrp'
22715 chmod='$chmod'
22716 chown='$chown'
22717 clocktype='$clocktype'
22718 comm='$comm'
22719 compress='$compress'
22720 contains='$contains'
22721 cp='$cp'
22722 cpio='$cpio'
22723 cpp='$cpp'
22724 cpp_stuff='$cpp_stuff'
22725 cppccsymbols='$cppccsymbols'
22726 cppflags='$cppflags'
22727 cpplast='$cpplast'
22728 cppminus='$cppminus'
22729 cpprun='$cpprun'
22730 cppstdin='$cppstdin'
22731 cppsymbols='$cppsymbols'
22732 crypt_r_proto='$crypt_r_proto'
22733 cryptlib='$cryptlib'
22734 csh='$csh'
22735 ctermid_r_proto='$ctermid_r_proto'
22736 ctime_r_proto='$ctime_r_proto'
22737 d_Gconvert='$d_Gconvert'
22738 d_PRIEUldbl='$d_PRIEUldbl'
22739 d_PRIFUldbl='$d_PRIFUldbl'
22740 d_PRIGUldbl='$d_PRIGUldbl'
22741 d_PRIXU64='$d_PRIXU64'
22742 d_PRId64='$d_PRId64'
22743 d_PRIeldbl='$d_PRIeldbl'
22744 d_PRIfldbl='$d_PRIfldbl'
22745 d_PRIgldbl='$d_PRIgldbl'
22746 d_PRIi64='$d_PRIi64'
22747 d_PRIo64='$d_PRIo64'
22748 d_PRIu64='$d_PRIu64'
22749 d_PRIx64='$d_PRIx64'
22750 d_SCNfldbl='$d_SCNfldbl'
22751 d__fwalk='$d__fwalk'
22752 d_access='$d_access'
22753 d_accessx='$d_accessx'
22754 d_aintl='$d_aintl'
22755 d_alarm='$d_alarm'
22756 d_archlib='$d_archlib'
22757 d_asctime64='$d_asctime64'
22758 d_asctime_r='$d_asctime_r'
22759 d_atolf='$d_atolf'
22760 d_atoll='$d_atoll'
22761 d_attribute_deprecated='$d_attribute_deprecated'
22762 d_attribute_format='$d_attribute_format'
22763 d_attribute_malloc='$d_attribute_malloc'
22764 d_attribute_nonnull='$d_attribute_nonnull'
22765 d_attribute_noreturn='$d_attribute_noreturn'
22766 d_attribute_pure='$d_attribute_pure'
22767 d_attribute_unused='$d_attribute_unused'
22768 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22769 d_bcmp='$d_bcmp'
22770 d_bcopy='$d_bcopy'
22771 d_bsd='$d_bsd'
22772 d_bsdgetpgrp='$d_bsdgetpgrp'
22773 d_bsdsetpgrp='$d_bsdsetpgrp'
22774 d_builtin_choose_expr='$d_builtin_choose_expr'
22775 d_builtin_expect='$d_builtin_expect'
22776 d_bzero='$d_bzero'
22777 d_c99_variadic_macros='$d_c99_variadic_macros'
22778 d_casti32='$d_casti32'
22779 d_castneg='$d_castneg'
22780 d_charvspr='$d_charvspr'
22781 d_chown='$d_chown'
22782 d_chroot='$d_chroot'
22783 d_chsize='$d_chsize'
22784 d_class='$d_class'
22785 d_clearenv='$d_clearenv'
22786 d_closedir='$d_closedir'
22787 d_cmsghdr_s='$d_cmsghdr_s'
22788 d_const='$d_const'
22789 d_copysignl='$d_copysignl'
22790 d_cplusplus='$d_cplusplus'
22791 d_crypt='$d_crypt'
22792 d_crypt_r='$d_crypt_r'
22793 d_csh='$d_csh'
22794 d_ctermid='$d_ctermid'
22795 d_ctermid_r='$d_ctermid_r'
22796 d_ctime64='$d_ctime64'
22797 d_ctime_r='$d_ctime_r'
22798 d_cuserid='$d_cuserid'
22799 d_dbl_dig='$d_dbl_dig'
22800 d_dbminitproto='$d_dbminitproto'
22801 d_difftime64='$d_difftime64'
22802 d_difftime='$d_difftime'
22803 d_dir_dd_fd='$d_dir_dd_fd'
22804 d_dirfd='$d_dirfd'
22805 d_dirnamlen='$d_dirnamlen'
22806 d_dlerror='$d_dlerror'
22807 d_dlopen='$d_dlopen'
22808 d_dlsymun='$d_dlsymun'
22809 d_dosuid='$d_dosuid'
22810 d_drand48_r='$d_drand48_r'
22811 d_drand48proto='$d_drand48proto'
22812 d_dup2='$d_dup2'
22813 d_eaccess='$d_eaccess'
22814 d_endgrent='$d_endgrent'
22815 d_endgrent_r='$d_endgrent_r'
22816 d_endhent='$d_endhent'
22817 d_endhostent_r='$d_endhostent_r'
22818 d_endnent='$d_endnent'
22819 d_endnetent_r='$d_endnetent_r'
22820 d_endpent='$d_endpent'
22821 d_endprotoent_r='$d_endprotoent_r'
22822 d_endpwent='$d_endpwent'
22823 d_endpwent_r='$d_endpwent_r'
22824 d_endsent='$d_endsent'
22825 d_endservent_r='$d_endservent_r'
22826 d_eofnblk='$d_eofnblk'
22827 d_eunice='$d_eunice'
22828 d_faststdio='$d_faststdio'
22829 d_fchdir='$d_fchdir'
22830 d_fchmod='$d_fchmod'
22831 d_fchown='$d_fchown'
22832 d_fcntl='$d_fcntl'
22833 d_fcntl_can_lock='$d_fcntl_can_lock'
22834 d_fd_macros='$d_fd_macros'
22835 d_fd_set='$d_fd_set'
22836 d_fds_bits='$d_fds_bits'
22837 d_fgetpos='$d_fgetpos'
22838 d_finite='$d_finite'
22839 d_finitel='$d_finitel'
22840 d_flexfnam='$d_flexfnam'
22841 d_flock='$d_flock'
22842 d_flockproto='$d_flockproto'
22843 d_fork='$d_fork'
22844 d_fp_class='$d_fp_class'
22845 d_fpathconf='$d_fpathconf'
22846 d_fpclass='$d_fpclass'
22847 d_fpclassify='$d_fpclassify'
22848 d_fpclassl='$d_fpclassl'
22849 d_fpos64_t='$d_fpos64_t'
22850 d_frexpl='$d_frexpl'
22851 d_fs_data_s='$d_fs_data_s'
22852 d_fseeko='$d_fseeko'
22853 d_fsetpos='$d_fsetpos'
22854 d_fstatfs='$d_fstatfs'
22855 d_fstatvfs='$d_fstatvfs'
22856 d_fsync='$d_fsync'
22857 d_ftello='$d_ftello'
22858 d_ftime='$d_ftime'
22859 d_futimes='$d_futimes'
22860 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22861 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22862 d_getaddrinfo='$d_getaddrinfo'
22863 d_getcwd='$d_getcwd'
22864 d_getespwnam='$d_getespwnam'
22865 d_getfsstat='$d_getfsstat'
22866 d_getgrent='$d_getgrent'
22867 d_getgrent_r='$d_getgrent_r'
22868 d_getgrgid_r='$d_getgrgid_r'
22869 d_getgrnam_r='$d_getgrnam_r'
22870 d_getgrps='$d_getgrps'
22871 d_gethbyaddr='$d_gethbyaddr'
22872 d_gethbyname='$d_gethbyname'
22873 d_gethent='$d_gethent'
22874 d_gethname='$d_gethname'
22875 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22876 d_gethostbyname_r='$d_gethostbyname_r'
22877 d_gethostent_r='$d_gethostent_r'
22878 d_gethostprotos='$d_gethostprotos'
22879 d_getitimer='$d_getitimer'
22880 d_getlogin='$d_getlogin'
22881 d_getlogin_r='$d_getlogin_r'
22882 d_getmnt='$d_getmnt'
22883 d_getmntent='$d_getmntent'
22884 d_getnameinfo='$d_getnameinfo'
22885 d_getnbyaddr='$d_getnbyaddr'
22886 d_getnbyname='$d_getnbyname'
22887 d_getnent='$d_getnent'
22888 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22889 d_getnetbyname_r='$d_getnetbyname_r'
22890 d_getnetent_r='$d_getnetent_r'
22891 d_getnetprotos='$d_getnetprotos'
22892 d_getpagsz='$d_getpagsz'
22893 d_getpbyname='$d_getpbyname'
22894 d_getpbynumber='$d_getpbynumber'
22895 d_getpent='$d_getpent'
22896 d_getpgid='$d_getpgid'
22897 d_getpgrp2='$d_getpgrp2'
22898 d_getpgrp='$d_getpgrp'
22899 d_getppid='$d_getppid'
22900 d_getprior='$d_getprior'
22901 d_getprotobyname_r='$d_getprotobyname_r'
22902 d_getprotobynumber_r='$d_getprotobynumber_r'
22903 d_getprotoent_r='$d_getprotoent_r'
22904 d_getprotoprotos='$d_getprotoprotos'
22905 d_getprpwnam='$d_getprpwnam'
22906 d_getpwent='$d_getpwent'
22907 d_getpwent_r='$d_getpwent_r'
22908 d_getpwnam_r='$d_getpwnam_r'
22909 d_getpwuid_r='$d_getpwuid_r'
22910 d_getsbyname='$d_getsbyname'
22911 d_getsbyport='$d_getsbyport'
22912 d_getsent='$d_getsent'
22913 d_getservbyname_r='$d_getservbyname_r'
22914 d_getservbyport_r='$d_getservbyport_r'
22915 d_getservent_r='$d_getservent_r'
22916 d_getservprotos='$d_getservprotos'
22917 d_getspnam='$d_getspnam'
22918 d_getspnam_r='$d_getspnam_r'
22919 d_gettimeod='$d_gettimeod'
22920 d_gmtime64='$d_gmtime64'
22921 d_gmtime_r='$d_gmtime_r'
22922 d_gnulibc='$d_gnulibc'
22923 d_grpasswd='$d_grpasswd'
22924 d_hasmntopt='$d_hasmntopt'
22925 d_htonl='$d_htonl'
22926 d_ilogbl='$d_ilogbl'
22927 d_inc_version_list='$d_inc_version_list'
22928 d_index='$d_index'
22929 d_inetaton='$d_inetaton'
22930 d_inetntop='$d_inetntop'
22931 d_inetpton='$d_inetpton'
22932 d_int64_t='$d_int64_t'
22933 d_isascii='$d_isascii'
22934 d_isblank='$d_isblank'
22935 d_isfinite='$d_isfinite'
22936 d_isinf='$d_isinf'
22937 d_isnan='$d_isnan'
22938 d_isnanl='$d_isnanl'
22939 d_killpg='$d_killpg'
22940 d_lchown='$d_lchown'
22941 d_ldbl_dig='$d_ldbl_dig'
22942 d_libm_lib_version='$d_libm_lib_version'
22943 d_link='$d_link'
22944 d_localtime64='$d_localtime64'
22945 d_localtime_r='$d_localtime_r'
22946 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22947 d_locconv='$d_locconv'
22948 d_lockf='$d_lockf'
22949 d_longdbl='$d_longdbl'
22950 d_longlong='$d_longlong'
22951 d_lseekproto='$d_lseekproto'
22952 d_lstat='$d_lstat'
22953 d_madvise='$d_madvise'
22954 d_malloc_good_size='$d_malloc_good_size'
22955 d_malloc_size='$d_malloc_size'
22956 d_mblen='$d_mblen'
22957 d_mbstowcs='$d_mbstowcs'
22958 d_mbtowc='$d_mbtowc'
22959 d_memchr='$d_memchr'
22960 d_memcmp='$d_memcmp'
22961 d_memcpy='$d_memcpy'
22962 d_memmove='$d_memmove'
22963 d_memset='$d_memset'
22964 d_mkdir='$d_mkdir'
22965 d_mkdtemp='$d_mkdtemp'
22966 d_mkfifo='$d_mkfifo'
22967 d_mkstemp='$d_mkstemp'
22968 d_mkstemps='$d_mkstemps'
22969 d_mktime64='$d_mktime64'
22970 d_mktime='$d_mktime'
22971 d_mmap='$d_mmap'
22972 d_modfl='$d_modfl'
22973 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22974 d_modflproto='$d_modflproto'
22975 d_mprotect='$d_mprotect'
22976 d_msg='$d_msg'
22977 d_msg_ctrunc='$d_msg_ctrunc'
22978 d_msg_dontroute='$d_msg_dontroute'
22979 d_msg_oob='$d_msg_oob'
22980 d_msg_peek='$d_msg_peek'
22981 d_msg_proxy='$d_msg_proxy'
22982 d_msgctl='$d_msgctl'
22983 d_msgget='$d_msgget'
22984 d_msghdr_s='$d_msghdr_s'
22985 d_msgrcv='$d_msgrcv'
22986 d_msgsnd='$d_msgsnd'
22987 d_msync='$d_msync'
22988 d_munmap='$d_munmap'
22989 d_mymalloc='$d_mymalloc'
22990 d_ndbm='$d_ndbm'
22991 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22992 d_nice='$d_nice'
22993 d_nl_langinfo='$d_nl_langinfo'
22994 d_nv_preserves_uv='$d_nv_preserves_uv'
22995 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22996 d_off64_t='$d_off64_t'
22997 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22998 d_oldpthreads='$d_oldpthreads'
22999 d_oldsock='$d_oldsock'
23000 d_open3='$d_open3'
23001 d_pathconf='$d_pathconf'
23002 d_pause='$d_pause'
23003 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23004 d_phostname='$d_phostname'
23005 d_pipe='$d_pipe'
23006 d_poll='$d_poll'
23007 d_portable='$d_portable'
23008 d_prctl='$d_prctl'
23009 d_prctl_set_name='$d_prctl_set_name'
23010 d_printf_format_null='$d_printf_format_null'
23011 d_procselfexe='$d_procselfexe'
23012 d_pseudofork='$d_pseudofork'
23013 d_pthread_atfork='$d_pthread_atfork'
23014 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23015 d_pthread_yield='$d_pthread_yield'
23016 d_pwage='$d_pwage'
23017 d_pwchange='$d_pwchange'
23018 d_pwclass='$d_pwclass'
23019 d_pwcomment='$d_pwcomment'
23020 d_pwexpire='$d_pwexpire'
23021 d_pwgecos='$d_pwgecos'
23022 d_pwpasswd='$d_pwpasswd'
23023 d_pwquota='$d_pwquota'
23024 d_qgcvt='$d_qgcvt'
23025 d_quad='$d_quad'
23026 d_random_r='$d_random_r'
23027 d_readdir64_r='$d_readdir64_r'
23028 d_readdir='$d_readdir'
23029 d_readdir_r='$d_readdir_r'
23030 d_readlink='$d_readlink'
23031 d_readv='$d_readv'
23032 d_recvmsg='$d_recvmsg'
23033 d_rename='$d_rename'
23034 d_rewinddir='$d_rewinddir'
23035 d_rmdir='$d_rmdir'
23036 d_safebcpy='$d_safebcpy'
23037 d_safemcpy='$d_safemcpy'
23038 d_sanemcmp='$d_sanemcmp'
23039 d_sbrkproto='$d_sbrkproto'
23040 d_scalbnl='$d_scalbnl'
23041 d_sched_yield='$d_sched_yield'
23042 d_scm_rights='$d_scm_rights'
23043 d_seekdir='$d_seekdir'
23044 d_select='$d_select'
23045 d_sem='$d_sem'
23046 d_semctl='$d_semctl'
23047 d_semctl_semid_ds='$d_semctl_semid_ds'
23048 d_semctl_semun='$d_semctl_semun'
23049 d_semget='$d_semget'
23050 d_semop='$d_semop'
23051 d_sendmsg='$d_sendmsg'
23052 d_setegid='$d_setegid'
23053 d_seteuid='$d_seteuid'
23054 d_setgrent='$d_setgrent'
23055 d_setgrent_r='$d_setgrent_r'
23056 d_setgrps='$d_setgrps'
23057 d_sethent='$d_sethent'
23058 d_sethostent_r='$d_sethostent_r'
23059 d_setitimer='$d_setitimer'
23060 d_setlinebuf='$d_setlinebuf'
23061 d_setlocale='$d_setlocale'
23062 d_setlocale_r='$d_setlocale_r'
23063 d_setnent='$d_setnent'
23064 d_setnetent_r='$d_setnetent_r'
23065 d_setpent='$d_setpent'
23066 d_setpgid='$d_setpgid'
23067 d_setpgrp2='$d_setpgrp2'
23068 d_setpgrp='$d_setpgrp'
23069 d_setprior='$d_setprior'
23070 d_setproctitle='$d_setproctitle'
23071 d_setprotoent_r='$d_setprotoent_r'
23072 d_setpwent='$d_setpwent'
23073 d_setpwent_r='$d_setpwent_r'
23074 d_setregid='$d_setregid'
23075 d_setresgid='$d_setresgid'
23076 d_setresuid='$d_setresuid'
23077 d_setreuid='$d_setreuid'
23078 d_setrgid='$d_setrgid'
23079 d_setruid='$d_setruid'
23080 d_setsent='$d_setsent'
23081 d_setservent_r='$d_setservent_r'
23082 d_setsid='$d_setsid'
23083 d_setvbuf='$d_setvbuf'
23084 d_sfio='$d_sfio'
23085 d_shm='$d_shm'
23086 d_shmat='$d_shmat'
23087 d_shmatprototype='$d_shmatprototype'
23088 d_shmctl='$d_shmctl'
23089 d_shmdt='$d_shmdt'
23090 d_shmget='$d_shmget'
23091 d_sigaction='$d_sigaction'
23092 d_signbit='$d_signbit'
23093 d_sigprocmask='$d_sigprocmask'
23094 d_sigsetjmp='$d_sigsetjmp'
23095 d_sin6_scope_id='$d_sin6_scope_id'
23096 d_sitearch='$d_sitearch'
23097 d_snprintf='$d_snprintf'
23098 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23099 d_sockatmark='$d_sockatmark'
23100 d_sockatmarkproto='$d_sockatmarkproto'
23101 d_socket='$d_socket'
23102 d_socklen_t='$d_socklen_t'
23103 d_sockpair='$d_sockpair'
23104 d_socks5_init='$d_socks5_init'
23105 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23106 d_sqrtl='$d_sqrtl'
23107 d_srand48_r='$d_srand48_r'
23108 d_srandom_r='$d_srandom_r'
23109 d_sresgproto='$d_sresgproto'
23110 d_sresuproto='$d_sresuproto'
23111 d_statblks='$d_statblks'
23112 d_statfs_f_flags='$d_statfs_f_flags'
23113 d_statfs_s='$d_statfs_s'
23114 d_static_inline='$d_static_inline'
23115 d_statvfs='$d_statvfs'
23116 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23117 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23118 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23119 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23120 d_stdio_stream_array='$d_stdio_stream_array'
23121 d_stdiobase='$d_stdiobase'
23122 d_stdstdio='$d_stdstdio'
23123 d_strchr='$d_strchr'
23124 d_strcoll='$d_strcoll'
23125 d_strctcpy='$d_strctcpy'
23126 d_strerrm='$d_strerrm'
23127 d_strerror='$d_strerror'
23128 d_strerror_r='$d_strerror_r'
23129 d_strftime='$d_strftime'
23130 d_strlcat='$d_strlcat'
23131 d_strlcpy='$d_strlcpy'
23132 d_strtod='$d_strtod'
23133 d_strtol='$d_strtol'
23134 d_strtold='$d_strtold'
23135 d_strtoll='$d_strtoll'
23136 d_strtoq='$d_strtoq'
23137 d_strtoul='$d_strtoul'
23138 d_strtoull='$d_strtoull'
23139 d_strtouq='$d_strtouq'
23140 d_strxfrm='$d_strxfrm'
23141 d_suidsafe='$d_suidsafe'
23142 d_symlink='$d_symlink'
23143 d_syscall='$d_syscall'
23144 d_syscallproto='$d_syscallproto'
23145 d_sysconf='$d_sysconf'
23146 d_sysernlst='$d_sysernlst'
23147 d_syserrlst='$d_syserrlst'
23148 d_system='$d_system'
23149 d_tcgetpgrp='$d_tcgetpgrp'
23150 d_tcsetpgrp='$d_tcsetpgrp'
23151 d_telldir='$d_telldir'
23152 d_telldirproto='$d_telldirproto'
23153 d_time='$d_time'
23154 d_timegm='$d_timegm'
23155 d_times='$d_times'
23156 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23157 d_tm_tm_zone='$d_tm_tm_zone'
23158 d_tmpnam_r='$d_tmpnam_r'
23159 d_truncate='$d_truncate'
23160 d_ttyname_r='$d_ttyname_r'
23161 d_tzname='$d_tzname'
23162 d_u32align='$d_u32align'
23163 d_ualarm='$d_ualarm'
23164 d_umask='$d_umask'
23165 d_uname='$d_uname'
23166 d_union_semun='$d_union_semun'
23167 d_unordered='$d_unordered'
23168 d_unsetenv='$d_unsetenv'
23169 d_usleep='$d_usleep'
23170 d_usleepproto='$d_usleepproto'
23171 d_ustat='$d_ustat'
23172 d_vendorarch='$d_vendorarch'
23173 d_vendorbin='$d_vendorbin'
23174 d_vendorlib='$d_vendorlib'
23175 d_vendorscript='$d_vendorscript'
23176 d_vfork='$d_vfork'
23177 d_void_closedir='$d_void_closedir'
23178 d_voidsig='$d_voidsig'
23179 d_voidtty='$d_voidtty'
23180 d_volatile='$d_volatile'
23181 d_vprintf='$d_vprintf'
23182 d_vsnprintf='$d_vsnprintf'
23183 d_wait4='$d_wait4'
23184 d_waitpid='$d_waitpid'
23185 d_wcstombs='$d_wcstombs'
23186 d_wctomb='$d_wctomb'
23187 d_writev='$d_writev'
23188 d_xenix='$d_xenix'
23189 date='$date'
23190 db_hashtype='$db_hashtype'
23191 db_prefixtype='$db_prefixtype'
23192 db_version_major='$db_version_major'
23193 db_version_minor='$db_version_minor'
23194 db_version_patch='$db_version_patch'
23195 defvoidused='$defvoidused'
23196 direntrytype='$direntrytype'
23197 dlext='$dlext'
23198 dlsrc='$dlsrc'
23199 doublesize='$doublesize'
23200 drand01='$drand01'
23201 drand48_r_proto='$drand48_r_proto'
23202 dtrace='$dtrace'
23203 dynamic_ext='$dynamic_ext'
23204 eagain='$eagain'
23205 ebcdic='$ebcdic'
23206 echo='$echo'
23207 egrep='$egrep'
23208 emacs='$emacs'
23209 endgrent_r_proto='$endgrent_r_proto'
23210 endhostent_r_proto='$endhostent_r_proto'
23211 endnetent_r_proto='$endnetent_r_proto'
23212 endprotoent_r_proto='$endprotoent_r_proto'
23213 endpwent_r_proto='$endpwent_r_proto'
23214 endservent_r_proto='$endservent_r_proto'
23215 eunicefix='$eunicefix'
23216 exe_ext='$exe_ext'
23217 expr='$expr'
23218 extensions='$extensions'
23219 extern_C='$extern_C'
23220 extras='$extras'
23221 fflushNULL='$fflushNULL'
23222 fflushall='$fflushall'
23223 find='$find'
23224 firstmakefile='$firstmakefile'
23225 flex='$flex'
23226 fpossize='$fpossize'
23227 fpostype='$fpostype'
23228 freetype='$freetype'
23229 from='$from'
23230 full_ar='$full_ar'
23231 full_csh='$full_csh'
23232 full_sed='$full_sed'
23233 gccansipedantic='$gccansipedantic'
23234 gccosandvers='$gccosandvers'
23235 gccversion='$gccversion'
23236 getgrent_r_proto='$getgrent_r_proto'
23237 getgrgid_r_proto='$getgrgid_r_proto'
23238 getgrnam_r_proto='$getgrnam_r_proto'
23239 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23240 gethostbyname_r_proto='$gethostbyname_r_proto'
23241 gethostent_r_proto='$gethostent_r_proto'
23242 getlogin_r_proto='$getlogin_r_proto'
23243 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23244 getnetbyname_r_proto='$getnetbyname_r_proto'
23245 getnetent_r_proto='$getnetent_r_proto'
23246 getprotobyname_r_proto='$getprotobyname_r_proto'
23247 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23248 getprotoent_r_proto='$getprotoent_r_proto'
23249 getpwent_r_proto='$getpwent_r_proto'
23250 getpwnam_r_proto='$getpwnam_r_proto'
23251 getpwuid_r_proto='$getpwuid_r_proto'
23252 getservbyname_r_proto='$getservbyname_r_proto'
23253 getservbyport_r_proto='$getservbyport_r_proto'
23254 getservent_r_proto='$getservent_r_proto'
23255 getspnam_r_proto='$getspnam_r_proto'
23256 gidformat='$gidformat'
23257 gidsign='$gidsign'
23258 gidsize='$gidsize'
23259 gidtype='$gidtype'
23260 glibpth='$glibpth'
23261 gmake='$gmake'
23262 gmtime_r_proto='$gmtime_r_proto'
23263 gnulibc_version='$gnulibc_version'
23264 grep='$grep'
23265 groupcat='$groupcat'
23266 groupstype='$groupstype'
23267 gzip='$gzip'
23268 h_fcntl='$h_fcntl'
23269 h_sysfile='$h_sysfile'
23270 hint='$hint'
23271 hostcat='$hostcat'
23272 html1dir='$html1dir'
23273 html1direxp='$html1direxp'
23274 html3dir='$html3dir'
23275 html3direxp='$html3direxp'
23276 i16size='$i16size'
23277 i16type='$i16type'
23278 i32size='$i32size'
23279 i32type='$i32type'
23280 i64size='$i64size'
23281 i64type='$i64type'
23282 i8size='$i8size'
23283 i8type='$i8type'
23284 i_arpainet='$i_arpainet'
23285 i_assert='$i_assert'
23286 i_bsdioctl='$i_bsdioctl'
23287 i_crypt='$i_crypt'
23288 i_db='$i_db'
23289 i_dbm='$i_dbm'
23290 i_dirent='$i_dirent'
23291 i_dld='$i_dld'
23292 i_dlfcn='$i_dlfcn'
23293 i_fcntl='$i_fcntl'
23294 i_float='$i_float'
23295 i_fp='$i_fp'
23296 i_fp_class='$i_fp_class'
23297 i_gdbm='$i_gdbm'
23298 i_gdbm_ndbm='$i_gdbm_ndbm'
23299 i_gdbmndbm='$i_gdbmndbm'
23300 i_grp='$i_grp'
23301 i_ieeefp='$i_ieeefp'
23302 i_inttypes='$i_inttypes'
23303 i_langinfo='$i_langinfo'
23304 i_libutil='$i_libutil'
23305 i_limits='$i_limits'
23306 i_locale='$i_locale'
23307 i_machcthr='$i_machcthr'
23308 i_malloc='$i_malloc'
23309 i_mallocmalloc='$i_mallocmalloc'
23310 i_math='$i_math'
23311 i_memory='$i_memory'
23312 i_mntent='$i_mntent'
23313 i_ndbm='$i_ndbm'
23314 i_netdb='$i_netdb'
23315 i_neterrno='$i_neterrno'
23316 i_netinettcp='$i_netinettcp'
23317 i_niin='$i_niin'
23318 i_poll='$i_poll'
23319 i_prot='$i_prot'
23320 i_pthread='$i_pthread'
23321 i_pwd='$i_pwd'
23322 i_rpcsvcdbm='$i_rpcsvcdbm'
23323 i_sfio='$i_sfio'
23324 i_sgtty='$i_sgtty'
23325 i_shadow='$i_shadow'
23326 i_socks='$i_socks'
23327 i_stdarg='$i_stdarg'
23328 i_stdbool='$i_stdbool'
23329 i_stddef='$i_stddef'
23330 i_stdlib='$i_stdlib'
23331 i_string='$i_string'
23332 i_sunmath='$i_sunmath'
23333 i_sysaccess='$i_sysaccess'
23334 i_sysdir='$i_sysdir'
23335 i_sysfile='$i_sysfile'
23336 i_sysfilio='$i_sysfilio'
23337 i_sysin='$i_sysin'
23338 i_sysioctl='$i_sysioctl'
23339 i_syslog='$i_syslog'
23340 i_sysmman='$i_sysmman'
23341 i_sysmode='$i_sysmode'
23342 i_sysmount='$i_sysmount'
23343 i_sysndir='$i_sysndir'
23344 i_sysparam='$i_sysparam'
23345 i_syspoll='$i_syspoll'
23346 i_sysresrc='$i_sysresrc'
23347 i_syssecrt='$i_syssecrt'
23348 i_sysselct='$i_sysselct'
23349 i_syssockio='$i_syssockio'
23350 i_sysstat='$i_sysstat'
23351 i_sysstatfs='$i_sysstatfs'
23352 i_sysstatvfs='$i_sysstatvfs'
23353 i_systime='$i_systime'
23354 i_systimek='$i_systimek'
23355 i_systimes='$i_systimes'
23356 i_systypes='$i_systypes'
23357 i_sysuio='$i_sysuio'
23358 i_sysun='$i_sysun'
23359 i_sysutsname='$i_sysutsname'
23360 i_sysvfs='$i_sysvfs'
23361 i_syswait='$i_syswait'
23362 i_termio='$i_termio'
23363 i_termios='$i_termios'
23364 i_time='$i_time'
23365 i_unistd='$i_unistd'
23366 i_ustat='$i_ustat'
23367 i_utime='$i_utime'
23368 i_values='$i_values'
23369 i_varargs='$i_varargs'
23370 i_varhdr='$i_varhdr'
23371 i_vfork='$i_vfork'
23372 ignore_versioned_solibs='$ignore_versioned_solibs'
23373 inc_version_list='$inc_version_list'
23374 inc_version_list_init='$inc_version_list_init'
23375 incpath='$incpath'
23376 inews='$inews'
23377 initialinstalllocation='$initialinstalllocation'
23378 installarchlib='$installarchlib'
23379 installbin='$installbin'
23380 installhtml1dir='$installhtml1dir'
23381 installhtml3dir='$installhtml3dir'
23382 installman1dir='$installman1dir'
23383 installman3dir='$installman3dir'
23384 installprefix='$installprefix'
23385 installprefixexp='$installprefixexp'
23386 installprivlib='$installprivlib'
23387 installscript='$installscript'
23388 installsitearch='$installsitearch'
23389 installsitebin='$installsitebin'
23390 installsitehtml1dir='$installsitehtml1dir'
23391 installsitehtml3dir='$installsitehtml3dir'
23392 installsitelib='$installsitelib'
23393 installsiteman1dir='$installsiteman1dir'
23394 installsiteman3dir='$installsiteman3dir'
23395 installsitescript='$installsitescript'
23396 installstyle='$installstyle'
23397 installusrbinperl='$installusrbinperl'
23398 installvendorarch='$installvendorarch'
23399 installvendorbin='$installvendorbin'
23400 installvendorhtml1dir='$installvendorhtml1dir'
23401 installvendorhtml3dir='$installvendorhtml3dir'
23402 installvendorlib='$installvendorlib'
23403 installvendorman1dir='$installvendorman1dir'
23404 installvendorman3dir='$installvendorman3dir'
23405 installvendorscript='$installvendorscript'
23406 intsize='$intsize'
23407 issymlink='$issymlink'
23408 ivdformat='$ivdformat'
23409 ivsize='$ivsize'
23410 ivtype='$ivtype'
23411 known_extensions='$known_extensions'
23412 ksh='$ksh'
23413 ld='$ld'
23414 lddlflags='$lddlflags'
23415 ldflags='$ldflags'
23416 ldflags_uselargefiles='$ldflags_uselargefiles'
23417 ldlibpthname='$ldlibpthname'
23418 less='$less'
23419 lib_ext='$lib_ext'
23420 libc='$libc'
23421 libperl='$libperl'
23422 libpth='$libpth'
23423 libs='$libs'
23424 libsdirs='$libsdirs'
23425 libsfiles='$libsfiles'
23426 libsfound='$libsfound'
23427 libspath='$libspath'
23428 libswanted='$libswanted'
23429 libswanted_uselargefiles='$libswanted_uselargefiles'
23430 line='$line'
23431 lint='$lint'
23432 lkflags='$lkflags'
23433 ln='$ln'
23434 lns='$lns'
23435 localtime_r_proto='$localtime_r_proto'
23436 locincpth='$locincpth'
23437 loclibpth='$loclibpth'
23438 longdblsize='$longdblsize'
23439 longlongsize='$longlongsize'
23440 longsize='$longsize'
23441 lp='$lp'
23442 lpr='$lpr'
23443 ls='$ls'
23444 lseeksize='$lseeksize'
23445 lseektype='$lseektype'
23446 mad='$mad'
23447 madlyh='$madlyh'
23448 madlyobj='$madlyobj'
23449 madlysrc='$madlysrc'
23450 mail='$mail'
23451 mailx='$mailx'
23452 make='$make'
23453 make_set_make='$make_set_make'
23454 mallocobj='$mallocobj'
23455 mallocsrc='$mallocsrc'
23456 malloctype='$malloctype'
23457 man1dir='$man1dir'
23458 man1direxp='$man1direxp'
23459 man1ext='$man1ext'
23460 man3dir='$man3dir'
23461 man3direxp='$man3direxp'
23462 man3ext='$man3ext'
23463 mips_type='$mips_type'
23464 mistrustnm='$mistrustnm'
23465 mkdir='$mkdir'
23466 mmaptype='$mmaptype'
23467 modetype='$modetype'
23468 more='$more'
23469 multiarch='$multiarch'
23470 mv='$mv'
23471 myarchname='$myarchname'
23472 mydomain='$mydomain'
23473 myhostname='$myhostname'
23474 myuname='$myuname'
23475 n='$n'
23476 need_va_copy='$need_va_copy'
23477 netdb_hlen_type='$netdb_hlen_type'
23478 netdb_host_type='$netdb_host_type'
23479 netdb_name_type='$netdb_name_type'
23480 netdb_net_type='$netdb_net_type'
23481 nm='$nm'
23482 nm_opt='$nm_opt'
23483 nm_so_opt='$nm_so_opt'
23484 nonxs_ext='$nonxs_ext'
23485 nroff='$nroff'
23486 nvEUformat='$nvEUformat'
23487 nvFUformat='$nvFUformat'
23488 nvGUformat='$nvGUformat'
23489 nv_overflows_integers_at='$nv_overflows_integers_at'
23490 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23491 nveformat='$nveformat'
23492 nvfformat='$nvfformat'
23493 nvgformat='$nvgformat'
23494 nvsize='$nvsize'
23495 nvtype='$nvtype'
23496 o_nonblock='$o_nonblock'
23497 obj_ext='$obj_ext'
23498 old_pthread_create_joinable='$old_pthread_create_joinable'
23499 optimize='$optimize'
23500 orderlib='$orderlib'
23501 osname='$osname'
23502 osvers='$osvers'
23503 otherlibdirs='$otherlibdirs'
23504 package='$package'
23505 pager='$pager'
23506 passcat='$passcat'
23507 patchlevel='$patchlevel'
23508 path_sep='$path_sep'
23509 perl5='$perl5'
23510 perl='$perl'
23511 perl_patchlevel='$perl_patchlevel'
23512 perl_static_inline='$perl_static_inline'
23513 perladmin='$perladmin'
23514 perllibs='$perllibs'
23515 perlpath='$perlpath'
23516 pg='$pg'
23517 phostname='$phostname'
23518 pidtype='$pidtype'
23519 plibpth='$plibpth'
23520 pmake='$pmake'
23521 pr='$pr'
23522 prefix='$prefix'
23523 prefixexp='$prefixexp'
23524 privlib='$privlib'
23525 privlibexp='$privlibexp'
23526 procselfexe='$procselfexe'
23527 prototype='$prototype'
23528 ptrsize='$ptrsize'
23529 quadkind='$quadkind'
23530 quadtype='$quadtype'
23531 randbits='$randbits'
23532 randfunc='$randfunc'
23533 random_r_proto='$random_r_proto'
23534 randseedtype='$randseedtype'
23535 ranlib='$ranlib'
23536 rd_nodata='$rd_nodata'
23537 readdir64_r_proto='$readdir64_r_proto'
23538 readdir_r_proto='$readdir_r_proto'
23539 revision='$revision'
23540 rm='$rm'
23541 rm_try='$rm_try'
23542 rmail='$rmail'
23543 run='$run'
23544 runnm='$runnm'
23545 sGMTIME_max='$sGMTIME_max'
23546 sGMTIME_min='$sGMTIME_min'
23547 sLOCALTIME_max='$sLOCALTIME_max'
23548 sLOCALTIME_min='$sLOCALTIME_min'
23549 sPRIEUldbl='$sPRIEUldbl'
23550 sPRIFUldbl='$sPRIFUldbl'
23551 sPRIGUldbl='$sPRIGUldbl'
23552 sPRIXU64='$sPRIXU64'
23553 sPRId64='$sPRId64'
23554 sPRIeldbl='$sPRIeldbl'
23555 sPRIfldbl='$sPRIfldbl'
23556 sPRIgldbl='$sPRIgldbl'
23557 sPRIi64='$sPRIi64'
23558 sPRIo64='$sPRIo64'
23559 sPRIu64='$sPRIu64'
23560 sPRIx64='$sPRIx64'
23561 sSCNfldbl='$sSCNfldbl'
23562 sched_yield='$sched_yield'
23563 scriptdir='$scriptdir'
23564 scriptdirexp='$scriptdirexp'
23565 sed='$sed'
23566 seedfunc='$seedfunc'
23567 selectminbits='$selectminbits'
23568 selecttype='$selecttype'
23569 sendmail='$sendmail'
23570 setgrent_r_proto='$setgrent_r_proto'
23571 sethostent_r_proto='$sethostent_r_proto'
23572 setlocale_r_proto='$setlocale_r_proto'
23573 setnetent_r_proto='$setnetent_r_proto'
23574 setprotoent_r_proto='$setprotoent_r_proto'
23575 setpwent_r_proto='$setpwent_r_proto'
23576 setservent_r_proto='$setservent_r_proto'
23577 sh='$sh'
23578 shar='$shar'
23579 sharpbang='$sharpbang'
23580 shmattype='$shmattype'
23581 shortsize='$shortsize'
23582 shrpenv='$shrpenv'
23583 shsharp='$shsharp'
23584 sig_count='$sig_count'
23585 sig_name='$sig_name'
23586 sig_name_init='$sig_name_init'
23587 sig_num='$sig_num'
23588 sig_num_init='$sig_num_init'
23589 sig_size='$sig_size'
23590 signal_t='$signal_t'
23591 sitearch='$sitearch'
23592 sitearchexp='$sitearchexp'
23593 sitebin='$sitebin'
23594 sitebinexp='$sitebinexp'
23595 sitehtml1dir='$sitehtml1dir'
23596 sitehtml1direxp='$sitehtml1direxp'
23597 sitehtml3dir='$sitehtml3dir'
23598 sitehtml3direxp='$sitehtml3direxp'
23599 sitelib='$sitelib'
23600 sitelib_stem='$sitelib_stem'
23601 sitelibexp='$sitelibexp'
23602 siteman1dir='$siteman1dir'
23603 siteman1direxp='$siteman1direxp'
23604 siteman3dir='$siteman3dir'
23605 siteman3direxp='$siteman3direxp'
23606 siteprefix='$siteprefix'
23607 siteprefixexp='$siteprefixexp'
23608 sitescript='$sitescript'
23609 sitescriptexp='$sitescriptexp'
23610 sizesize='$sizesize'
23611 sizetype='$sizetype'
23612 sleep='$sleep'
23613 smail='$smail'
23614 so='$so'
23615 sockethdr='$sockethdr'
23616 socketlib='$socketlib'
23617 socksizetype='$socksizetype'
23618 sort='$sort'
23619 spackage='$spackage'
23620 spitshell='$spitshell'
23621 srand48_r_proto='$srand48_r_proto'
23622 srandom_r_proto='$srandom_r_proto'
23623 src='$src'
23624 ssizetype='$ssizetype'
23625 st_ino_sign='$st_ino_sign'
23626 st_ino_size='$st_ino_size'
23627 startperl='$startperl'
23628 startsh='$startsh'
23629 static_ext='$static_ext'
23630 stdchar='$stdchar'
23631 stdio_base='$stdio_base'
23632 stdio_bufsiz='$stdio_bufsiz'
23633 stdio_cnt='$stdio_cnt'
23634 stdio_filbuf='$stdio_filbuf'
23635 stdio_ptr='$stdio_ptr'
23636 stdio_stream_array='$stdio_stream_array'
23637 strerror_r_proto='$strerror_r_proto'
23638 strings='$strings'
23639 submit='$submit'
23640 subversion='$subversion'
23641 sysman='$sysman'
23642 tail='$tail'
23643 tar='$tar'
23644 targetarch='$targetarch'
23645 tbl='$tbl'
23646 tee='$tee'
23647 test='$test'
23648 timeincl='$timeincl'
23649 timetype='$timetype'
23650 tmpnam_r_proto='$tmpnam_r_proto'
23651 to='$to'
23652 touch='$touch'
23653 tr='$tr'
23654 trnl='$trnl'
23655 troff='$troff'
23656 ttyname_r_proto='$ttyname_r_proto'
23657 u16size='$u16size'
23658 u16type='$u16type'
23659 u32size='$u32size'
23660 u32type='$u32type'
23661 u64size='$u64size'
23662 u64type='$u64type'
23663 u8size='$u8size'
23664 u8type='$u8type'
23665 uidformat='$uidformat'
23666 uidsign='$uidsign'
23667 uidsize='$uidsize'
23668 uidtype='$uidtype'
23669 uname='$uname'
23670 uniq='$uniq'
23671 uquadtype='$uquadtype'
23672 use5005threads='$use5005threads'
23673 use64bitall='$use64bitall'
23674 use64bitint='$use64bitint'
23675 usecrosscompile='$usecrosscompile'
23676 usedevel='$usedevel'
23677 usedl='$usedl'
23678 usedtrace='$usedtrace'
23679 usefaststdio='$usefaststdio'
23680 useithreads='$useithreads'
23681 usekernprocpathname='$usekernprocpathname'
23682 uselargefiles='$uselargefiles'
23683 uselongdouble='$uselongdouble'
23684 usemallocwrap='$usemallocwrap'
23685 usemorebits='$usemorebits'
23686 usemultiplicity='$usemultiplicity'
23687 usemymalloc='$usemymalloc'
23688 usenm='$usenm'
23689 usensgetexecutablepath='$usensgetexecutablepath'
23690 useopcode='$useopcode'
23691 useperlio='$useperlio'
23692 useposix='$useposix'
23693 usereentrant='$usereentrant'
23694 userelocatableinc='$userelocatableinc'
23695 usesfio='$usesfio'
23696 useshrplib='$useshrplib'
23697 usesitecustomize='$usesitecustomize'
23698 usesocks='$usesocks'
23699 usethreads='$usethreads'
23700 usevendorprefix='$usevendorprefix'
23701 usevfork='$usevfork'
23702 usrinc='$usrinc'
23703 uuname='$uuname'
23704 uvXUformat='$uvXUformat'
23705 uvoformat='$uvoformat'
23706 uvsize='$uvsize'
23707 uvtype='$uvtype'
23708 uvuformat='$uvuformat'
23709 uvxformat='$uvxformat'
23710 vaproto='$vaproto'
23711 vendorarch='$vendorarch'
23712 vendorarchexp='$vendorarchexp'
23713 vendorbin='$vendorbin'
23714 vendorbinexp='$vendorbinexp'
23715 vendorhtml1dir='$vendorhtml1dir'
23716 vendorhtml1direxp='$vendorhtml1direxp'
23717 vendorhtml3dir='$vendorhtml3dir'
23718 vendorhtml3direxp='$vendorhtml3direxp'
23719 vendorlib='$vendorlib'
23720 vendorlib_stem='$vendorlib_stem'
23721 vendorlibexp='$vendorlibexp'
23722 vendorman1dir='$vendorman1dir'
23723 vendorman1direxp='$vendorman1direxp'
23724 vendorman3dir='$vendorman3dir'
23725 vendorman3direxp='$vendorman3direxp'
23726 vendorprefix='$vendorprefix'
23727 vendorprefixexp='$vendorprefixexp'
23728 vendorscript='$vendorscript'
23729 vendorscriptexp='$vendorscriptexp'
23730 version='$version'
23731 version_patchlevel_string='$version_patchlevel_string'
23732 versiononly='$versiononly'
23733 vi='$vi'
23734 voidflags='$voidflags'
23735 xlibpth='$xlibpth'
23736 yacc='$yacc'
23737 yaccflags='$yaccflags'
23738 zcat='$zcat'
23739 zip='$zip'
23740 EOT
23741
23742 : add special variables
23743 $test -f $src/patchlevel.h && \
23744 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23745 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23746 echo "PERL_CONFIG_SH=true" >>config.sh
23747
23748 : propagate old symbols
23749 if $test -f UU/config.sh; then
23750         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23751         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23752                 config.sh config.sh UU/oldconfig.sh |\
23753                 $sort | $uniq -u >UU/oldsyms
23754         set X `$cat UU/oldsyms`
23755         shift
23756         case $# in
23757         0) ;;
23758         *)
23759                 $cat <<EOM
23760 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23761 EOM
23762                 echo ": Variables propagated from previous config.sh file." >>config.sh
23763                 for sym in `$cat UU/oldsyms`; do
23764                         echo "    Propagating $hint variable "'$'"$sym..."
23765                         eval 'tmp="$'"${sym}"'"'
23766                         echo "$tmp" | \
23767                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23768                 done
23769                 ;;
23770         esac
23771 fi
23772
23773 : Finish up by extracting the .SH files
23774 case "$alldone" in
23775 exit)
23776         $rm -rf UU
23777         echo "Extraction done."
23778         exit 0
23779         ;;
23780 cont)
23781         ;;
23782 '')
23783         dflt=''
23784         nostick=true
23785         $cat <<EOM
23786
23787 If you'd like to make any changes to the config.sh file before I begin
23788 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23789
23790 EOM
23791         rp="Press return or use a shell escape to edit config.sh:"
23792         . UU/myread
23793         nostick=''
23794         case "$ans" in
23795         '') ;;
23796         *) : in case they cannot read
23797                 sh 1>&4 -c "$ans";;
23798         esac
23799         ;;
23800 esac
23801
23802 : if this fails, just run all the .SH files by hand
23803 . ./config.sh
23804
23805 echo " "
23806 exec 1>&4
23807 pwd=`pwd`
23808 . ./UU/extract
23809 cd "$pwd"
23810
23811 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23812         dflt=y
23813         case "$silent" in
23814         true) ;;
23815         *)
23816                 $cat <<EOM
23817
23818 Now you need to generate make dependencies by running "$make depend".
23819 You might prefer to run it in background: "$make depend > makedepend.out &"
23820 It can take a while, so you might not want to run it right now.
23821
23822 EOM
23823                 ;;
23824         esac
23825         rp="Run $make depend now?"
23826         . UU/myread
23827         case "$ans" in
23828         y*)
23829                 $make depend && echo "Now you must run '$make'."
23830                 ;;
23831         *)
23832                 echo "You must run '$make depend' then '$make'."
23833                 ;;
23834         esac
23835 elif test -f [Mm]akefile; then
23836         echo " "
23837         echo "Now you must run a $make."
23838 else
23839         echo "Configure done."
23840 fi
23841
23842 if $test -f Policy.sh; then
23843     $cat <<EOM
23844
23845 If you compile $package on a different machine or from a different object
23846 directory, copy the Policy.sh file from this object directory to the
23847 new one before you run Configure -- this will help you with most of
23848 the policy defaults.
23849
23850 EOM
23851 fi
23852 if $test -f config.msg; then
23853     echo "Hmm.  I also noted the following information while running:"
23854     echo " "
23855     $cat config.msg >&4
23856     $rm -f config.msg
23857 fi
23858 $rm -f kit*isdone ark*isdone
23859 $rm -rf UU
23860
23861 : End of Configure
23862