This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Remove blanks in files for non-DEBUGGING builds
[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 Sat Oct  1 12:33:17 CEST 2011 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isfinite=''
569 d_isinf=''
570 d_isnan=''
571 d_isnanl=''
572 d_killpg=''
573 d_lchown=''
574 d_ldbl_dig=''
575 d_libm_lib_version=''
576 d_link=''
577 d_localtime_r=''
578 d_localtime_r_needs_tzset=''
579 localtime_r_proto=''
580 d_locconv=''
581 d_lockf=''
582 d_longdbl=''
583 longdblsize=''
584 d_longlong=''
585 longlongsize=''
586 d_lseekproto=''
587 d_lstat=''
588 d_madvise=''
589 d_malloc_good_size=''
590 d_malloc_size=''
591 d_mblen=''
592 d_mbstowcs=''
593 d_mbtowc=''
594 d_memchr=''
595 d_memcmp=''
596 d_memcpy=''
597 d_memmove=''
598 d_memset=''
599 d_mkdir=''
600 d_mkdtemp=''
601 d_mkfifo=''
602 d_mkstemp=''
603 d_mkstemps=''
604 d_mktime=''
605 d_mmap=''
606 mmaptype=''
607 d_modfl=''
608 d_modfl_pow32_bug=''
609 d_modflproto=''
610 d_mprotect=''
611 d_msg=''
612 d_msgctl=''
613 d_msgget=''
614 d_msghdr_s=''
615 d_msgrcv=''
616 d_msgsnd=''
617 d_msync=''
618 d_munmap=''
619 d_nice=''
620 d_nl_langinfo=''
621 d_off64_t=''
622 d_open3=''
623 d_fpathconf=''
624 d_pathconf=''
625 d_pause=''
626 d_pipe=''
627 d_poll=''
628 d_portable=''
629 d_prctl=''
630 d_prctl_set_name=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_sin6_scope_id=''
733 d_sockaddr_sa_len=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_static_inline=''
752 perl_static_inline=''
753 d_fstatvfs=''
754 d_statvfs=''
755 d_stdio_cnt_lval=''
756 d_stdio_ptr_lval=''
757 d_stdio_ptr_lval_nochange_cnt=''
758 d_stdio_ptr_lval_sets_cnt=''
759 d_stdiobase=''
760 d_stdstdio=''
761 stdio_base=''
762 stdio_bufsiz=''
763 stdio_cnt=''
764 stdio_filbuf=''
765 stdio_ptr=''
766 d_index=''
767 d_strchr=''
768 d_strcoll=''
769 d_strctcpy=''
770 d_strerrm=''
771 d_strerror=''
772 d_sysernlst=''
773 d_syserrlst=''
774 d_strerror_r=''
775 strerror_r_proto=''
776 d_strftime=''
777 d_strlcat=''
778 d_strlcpy=''
779 d_strtod=''
780 d_strtol=''
781 d_strtold=''
782 d_strtoll=''
783 d_strtoq=''
784 d_strtoul=''
785 d_strtoull=''
786 d_strtouq=''
787 d_strxfrm=''
788 d_symlink=''
789 d_syscall=''
790 d_syscallproto=''
791 d_sysconf=''
792 d_system=''
793 d_tcgetpgrp=''
794 d_tcsetpgrp=''
795 d_telldirproto=''
796 d_time=''
797 timetype=''
798 d_asctime64=''
799 d_ctime64=''
800 d_difftime64=''
801 d_gmtime64=''
802 d_localtime64=''
803 d_mktime64=''
804 d_timegm=''
805 clocktype=''
806 d_times=''
807 d_tmpnam_r=''
808 tmpnam_r_proto=''
809 d_truncate=''
810 d_ttyname_r=''
811 ttyname_r_proto=''
812 d_tzname=''
813 d_u32align=''
814 d_ualarm=''
815 d_umask=''
816 d_semctl_semid_ds=''
817 d_semctl_semun=''
818 d_union_semun=''
819 d_unordered=''
820 d_unsetenv=''
821 d_usleep=''
822 d_usleepproto=''
823 d_ustat=''
824 d_pseudofork=''
825 d_vfork=''
826 usevfork=''
827 d_voidsig=''
828 signal_t=''
829 d_volatile=''
830 d_charvspr=''
831 d_vprintf=''
832 d_wait4=''
833 d_waitpid=''
834 d_wcstombs=''
835 d_wctomb=''
836 d_writev=''
837 dlext=''
838 bin_ELF=''
839 cccdlflags=''
840 ccdlflags=''
841 dlsrc=''
842 ld=''
843 lddlflags=''
844 usedl=''
845 doublesize=''
846 ebcdic=''
847 fflushNULL=''
848 fflushall=''
849 fpossize=''
850 fpostype=''
851 gccansipedantic=''
852 gccosandvers=''
853 gccversion=''
854 gidformat=''
855 gidsign=''
856 gidsize=''
857 gidtype=''
858 groupstype=''
859 h_fcntl=''
860 h_sysfile=''
861 html1dir=''
862 html1direxp=''
863 installhtml1dir=''
864 html3dir=''
865 html3direxp=''
866 installhtml3dir=''
867 i_arpainet=''
868 i_assert=''
869 i_crypt=''
870 db_hashtype=''
871 db_prefixtype=''
872 db_version_major=''
873 db_version_minor=''
874 db_version_patch=''
875 i_db=''
876 i_dbm=''
877 i_rpcsvcdbm=''
878 d_dirnamlen=''
879 direntrytype=''
880 i_dirent=''
881 i_dld=''
882 i_dlfcn=''
883 i_fcntl=''
884 i_float=''
885 i_fp=''
886 i_fp_class=''
887 i_gdbm=''
888 d_grpasswd=''
889 i_grp=''
890 i_ieeefp=''
891 i_inttypes=''
892 i_langinfo=''
893 i_libutil=''
894 i_limits=''
895 i_locale=''
896 i_machcthr=''
897 i_malloc=''
898 i_mallocmalloc=''
899 i_math=''
900 i_memory=''
901 i_mntent=''
902 d_gdbm_ndbm_h_uses_prototypes=''
903 d_gdbmndbm_h_uses_prototypes=''
904 d_ndbm=''
905 d_ndbm_h_uses_prototypes=''
906 i_gdbm_ndbm=''
907 i_gdbmndbm=''
908 i_ndbm=''
909 i_netdb=''
910 i_neterrno=''
911 i_netinettcp=''
912 i_niin=''
913 i_sysin=''
914 i_poll=''
915 i_prot=''
916 i_pthread=''
917 d_pwage=''
918 d_pwchange=''
919 d_pwclass=''
920 d_pwcomment=''
921 d_pwexpire=''
922 d_pwgecos=''
923 d_pwpasswd=''
924 d_pwquota=''
925 i_pwd=''
926 i_sfio=''
927 i_shadow=''
928 i_socks=''
929 i_stdbool=''
930 i_stddef=''
931 i_stdlib=''
932 i_string=''
933 strings=''
934 i_sunmath=''
935 i_sysaccess=''
936 i_sysdir=''
937 i_sysfile=''
938 d_voidtty=''
939 i_bsdioctl=''
940 i_sysfilio=''
941 i_sysioctl=''
942 i_syssockio=''
943 i_syslog=''
944 i_sysmman=''
945 i_sysmode=''
946 i_sysmount=''
947 i_sysndir=''
948 i_sysparam=''
949 i_syspoll=''
950 i_sysresrc=''
951 i_syssecrt=''
952 i_sysselct=''
953 i_sysstat=''
954 i_sysstatfs=''
955 i_sysstatvfs=''
956 i_systimes=''
957 i_systypes=''
958 i_sysuio=''
959 i_sysun=''
960 i_sysutsname=''
961 i_sysvfs=''
962 i_syswait=''
963 i_sgtty=''
964 i_termio=''
965 i_termios=''
966 d_tm_tm_gmtoff=''
967 d_tm_tm_zone=''
968 i_systime=''
969 i_systimek=''
970 i_time=''
971 timeincl=''
972 i_unistd=''
973 i_ustat=''
974 i_utime=''
975 i_values=''
976 i_stdarg=''
977 i_varargs=''
978 i_varhdr=''
979 i_vfork=''
980 d_inc_version_list=''
981 inc_version_list=''
982 inc_version_list_init=''
983 installprefix=''
984 installprefixexp=''
985 installstyle=''
986 installusrbinperl=''
987 intsize=''
988 longsize=''
989 shortsize=''
990 issymlink=''
991 libc=''
992 ldlibpthname=''
993 libperl=''
994 shrpenv=''
995 useshrplib=''
996 glibpth=''
997 libpth=''
998 loclibpth=''
999 plibpth=''
1000 xlibpth=''
1001 ignore_versioned_solibs=''
1002 libs=''
1003 libsdirs=''
1004 libsfiles=''
1005 libsfound=''
1006 libspath=''
1007 lns=''
1008 d_PRIEUldbl=''
1009 d_PRIFUldbl=''
1010 d_PRIGUldbl=''
1011 d_PRIeldbl=''
1012 d_PRIfldbl=''
1013 d_PRIgldbl=''
1014 d_SCNfldbl=''
1015 sPRIEUldbl=''
1016 sPRIFUldbl=''
1017 sPRIGUldbl=''
1018 sPRIeldbl=''
1019 sPRIfldbl=''
1020 sPRIgldbl=''
1021 sSCNfldbl=''
1022 lseeksize=''
1023 lseektype=''
1024 mad=''
1025 madlyh=''
1026 madlyobj=''
1027 madlysrc=''
1028 make_set_make=''
1029 d_mymalloc=''
1030 freetype=''
1031 mallocobj=''
1032 mallocsrc=''
1033 malloctype=''
1034 usemallocwrap=''
1035 usemymalloc=''
1036 installman1dir=''
1037 man1dir=''
1038 man1direxp=''
1039 man1ext=''
1040 installman3dir=''
1041 man3dir=''
1042 man3direxp=''
1043 man3ext=''
1044 modetype=''
1045 multiarch=''
1046 mydomain=''
1047 myhostname=''
1048 phostname=''
1049 c=''
1050 n=''
1051 d_eofnblk=''
1052 eagain=''
1053 o_nonblock=''
1054 rd_nodata=''
1055 need_va_copy=''
1056 netdb_hlen_type=''
1057 netdb_host_type=''
1058 netdb_name_type=''
1059 netdb_net_type=''
1060 groupcat=''
1061 hostcat=''
1062 passcat=''
1063 orderlib=''
1064 ranlib=''
1065 d_perl_otherlibdirs=''
1066 otherlibdirs=''
1067 package=''
1068 spackage=''
1069 pager=''
1070 api_revision=''
1071 api_subversion=''
1072 api_version=''
1073 api_versionstring=''
1074 patchlevel=''
1075 perl_patchlevel=''
1076 revision=''
1077 subversion=''
1078 version=''
1079 version_patchlevel_string=''
1080 perl5=''
1081 perladmin=''
1082 perlpath=''
1083 d_nv_preserves_uv=''
1084 d_nv_zero_is_allbits_zero=''
1085 i16size=''
1086 i16type=''
1087 i32size=''
1088 i32type=''
1089 i64size=''
1090 i64type=''
1091 i8size=''
1092 i8type=''
1093 ivsize=''
1094 ivtype=''
1095 nv_overflows_integers_at=''
1096 nv_preserves_uv_bits=''
1097 nvsize=''
1098 nvtype=''
1099 u16size=''
1100 u16type=''
1101 u32size=''
1102 u32type=''
1103 u64size=''
1104 u64type=''
1105 u8size=''
1106 u8type=''
1107 uvsize=''
1108 uvtype=''
1109 ivdformat=''
1110 nvEUformat=''
1111 nvFUformat=''
1112 nvGUformat=''
1113 nveformat=''
1114 nvfformat=''
1115 nvgformat=''
1116 uvXUformat=''
1117 uvoformat=''
1118 uvuformat=''
1119 uvxformat=''
1120 pidtype=''
1121 prefix=''
1122 prefixexp=''
1123 installprivlib=''
1124 privlib=''
1125 privlibexp=''
1126 prototype=''
1127 ptrsize=''
1128 d_PRIXU64=''
1129 d_PRId64=''
1130 d_PRIi64=''
1131 d_PRIo64=''
1132 d_PRIu64=''
1133 d_PRIx64=''
1134 sPRIXU64=''
1135 sPRId64=''
1136 sPRIi64=''
1137 sPRIo64=''
1138 sPRIu64=''
1139 sPRIx64=''
1140 d_quad=''
1141 quadkind=''
1142 quadtype=''
1143 uquadtype=''
1144 drand01=''
1145 randbits=''
1146 randfunc=''
1147 randseedtype=''
1148 seedfunc=''
1149 installscript=''
1150 scriptdir=''
1151 scriptdirexp=''
1152 selectminbits=''
1153 selecttype=''
1154 sh=''
1155 sig_count=''
1156 sig_name=''
1157 sig_name_init=''
1158 sig_num=''
1159 sig_num_init=''
1160 sig_size=''
1161 d_sitearch=''
1162 installsitearch=''
1163 sitearch=''
1164 sitearchexp=''
1165 installsitebin=''
1166 sitebin=''
1167 sitebinexp=''
1168 installsitehtml1dir=''
1169 sitehtml1dir=''
1170 sitehtml1direxp=''
1171 installsitehtml3dir=''
1172 sitehtml3dir=''
1173 sitehtml3direxp=''
1174 installsitelib=''
1175 sitelib=''
1176 sitelib_stem=''
1177 sitelibexp=''
1178 installsiteman1dir=''
1179 siteman1dir=''
1180 siteman1direxp=''
1181 installsiteman3dir=''
1182 siteman3dir=''
1183 siteman3direxp=''
1184 siteprefix=''
1185 siteprefixexp=''
1186 installsitescript=''
1187 sitescript=''
1188 sitescriptexp=''
1189 sizesize=''
1190 sizetype=''
1191 so=''
1192 socksizetype=''
1193 sharpbang=''
1194 shsharp=''
1195 spitshell=''
1196 src=''
1197 ssizetype=''
1198 st_ino_sign=''
1199 st_ino_size=''
1200 startperl=''
1201 startsh=''
1202 stdchar=''
1203 d_stdio_stream_array=''
1204 stdio_stream_array=''
1205 sysman=''
1206 sGMTIME_max=''
1207 sGMTIME_min=''
1208 sLOCALTIME_max=''
1209 sLOCALTIME_min=''
1210 trnl=''
1211 uidformat=''
1212 uidsign=''
1213 uidsize=''
1214 uidtype=''
1215 archname64=''
1216 use64bitall=''
1217 use64bitint=''
1218 dtrace=''
1219 usedtrace=''
1220 usefaststdio=''
1221 usekernprocpathname=''
1222 ccflags_uselargefiles=''
1223 ldflags_uselargefiles=''
1224 libswanted_uselargefiles=''
1225 uselargefiles=''
1226 uselongdouble=''
1227 usemorebits=''
1228 usemultiplicity=''
1229 nm_opt=''
1230 nm_so_opt=''
1231 runnm=''
1232 usenm=''
1233 usensgetexecutablepath=''
1234 useperlio=''
1235 usesocks=''
1236 d_oldpthreads=''
1237 use5005threads=''
1238 useithreads=''
1239 usereentrant=''
1240 usethreads=''
1241 incpath=''
1242 mips_type=''
1243 usrinc=''
1244 vaproto=''
1245 d_vendorarch=''
1246 installvendorarch=''
1247 vendorarch=''
1248 vendorarchexp=''
1249 d_vendorbin=''
1250 installvendorbin=''
1251 vendorbin=''
1252 vendorbinexp=''
1253 installvendorhtml1dir=''
1254 vendorhtml1dir=''
1255 vendorhtml1direxp=''
1256 installvendorhtml3dir=''
1257 vendorhtml3dir=''
1258 vendorhtml3direxp=''
1259 d_vendorlib=''
1260 installvendorlib=''
1261 vendorlib=''
1262 vendorlib_stem=''
1263 vendorlibexp=''
1264 installvendorman1dir=''
1265 vendorman1dir=''
1266 vendorman1direxp=''
1267 installvendorman3dir=''
1268 vendorman3dir=''
1269 vendorman3direxp=''
1270 usevendorprefix=''
1271 vendorprefix=''
1272 vendorprefixexp=''
1273 d_vendorscript=''
1274 installvendorscript=''
1275 vendorscript=''
1276 vendorscriptexp=''
1277 versiononly=''
1278 defvoidused=''
1279 voidflags=''
1280 yacc=''
1281 yaccflags=''
1282 CONFIG=''
1283
1284 : Detect odd OSs
1285 define='define'
1286 undef='undef'
1287 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1288 rmlist=''
1289
1290 : We must find out about Eunice early
1291 eunicefix=':'
1292 if test -f /etc/unixtovms; then
1293         eunicefix=/etc/unixtovms
1294 fi
1295 if test -f /etc/unixtovms.exe; then
1296         eunicefix=/etc/unixtovms.exe
1297 fi
1298
1299 : Set executable suffix now -- needed before hints available
1300 if test -f "/libs/version.library"; then
1301 : Amiga OS
1302     _exe=""
1303 elif test -f "/system/gnu_library/bin/ar.pm"; then
1304 : Stratus VOS
1305     _exe=".pm"
1306 elif test -n "$DJGPP"; then
1307 : DOS DJGPP
1308     _exe=".exe"
1309 elif test -d c:/. -o -n "$is_os2" ; then
1310 : OS/2 or cygwin
1311     _exe=".exe"
1312 fi
1313
1314 groupstype=''
1315 i_whoami=''
1316 : Trailing extension.  Override this in a hint file, if needed.
1317 : Extra object files, if any, needed on this platform.
1318 archobjs=''
1319 archname=''
1320 : Possible local include directories to search.
1321 : Set locincpth to "" in a hint file to defeat local include searches.
1322 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1323 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1324 :
1325 : no include file wanted by default
1326 inclwanted=''
1327
1328 : Enable -DEBUGGING and -DDEBUGGING from the command line
1329 EBUGGING=''
1330 DEBUGGING=''
1331
1332 libnames=''
1333 : change the next line if compiling for Xenix/286 on Xenix/386
1334 xlibpth='/usr/lib/386 /lib/386'
1335 : Possible local library directories to search.
1336 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1337 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1338
1339 : general looking path for locating libraries
1340 glibpth="/lib /usr/lib $xlibpth"
1341 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1342 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1343 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1344 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1345
1346 : Private path used by Configure to find libraries.  Its value
1347 : is prepended to libpth. This variable takes care of special
1348 : machines, like the mips.  Usually, it should be empty.
1349 plibpth=''
1350
1351 : default library list
1352 libswanted=''
1353 : some systems want to use only the non-versioned libso:s
1354 ignore_versioned_solibs=''
1355 : set usethreads on the Configure command line to enable threads.
1356 usereentrant='undef'
1357 : full support for void wanted by default
1358 defvoidused=15
1359
1360 ccname=''
1361 ccversion=''
1362 perllibs=''
1363 : set useposix=false in your hint file to disable the POSIX extension.
1364 useposix=true
1365 : set useopcode=false in your hint file to disable the Opcode extension.
1366 useopcode=true
1367 archname64=''
1368 ccflags_uselargefiles=''
1369 ldflags_uselargefiles=''
1370 libswanted_uselargefiles=''
1371 : set usemultiplicity on the Configure command line to enable multiplicity.
1372 : set usesocks on the Configure command line to enable socks.
1373 : List of libraries we want.
1374 : If anyone needs extra -lxxx, put those in a hint file.
1375 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1376 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1377 : We probably want to search /usr/shlib before most other libraries.
1378 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1379 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1380 glibpth="/usr/shlib $glibpth"
1381 : Do not use vfork unless overridden by a hint file.
1382 usevfork=false
1383
1384 : Find the basic shell for Bourne shell scripts
1385 case "$sh" in
1386 '')
1387         case "$SYSTYPE" in
1388         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1389         *) xxx='/bin/sh';;
1390         esac
1391         if test -f "$xxx"; then
1392                 sh="$xxx"
1393         else
1394                 : Build up a list and do a single loop so we can 'break' out.
1395                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1396                 for xxx in sh bash ksh pdksh ash; do
1397                         for p in $pth; do
1398                                 try="$try ${p}/${xxx}"
1399                         done
1400                 done
1401                 for xxx in $try; do
1402                         if test -f "$xxx"; then
1403                                 sh="$xxx";
1404                                 break
1405                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1406                                 sh="$xxx";
1407                                 break
1408                         elif test -f "$xxx.exe"; then
1409                                 sh="$xxx";
1410                                 break
1411                         fi
1412                 done
1413         fi
1414         ;;
1415 esac
1416
1417 case "$sh" in
1418 '')     cat >&2 <<EOM
1419 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1420
1421 Usually it's in /bin/sh.  How did you even get this far?
1422 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1423 we'll try to straighten this all out.
1424 EOM
1425         exit 1
1426         ;;
1427 esac
1428
1429 : see if sh knows # comments
1430 if `$sh -c '#' >/dev/null 2>&1`; then
1431         shsharp=true
1432         spitshell=cat
1433         xcat=/bin/cat
1434         test -f $xcat$_exe || xcat=/usr/bin/cat
1435         if test ! -f $xcat$_exe; then
1436                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1437                         if test -f $p/cat$_exe; then
1438                                 xcat=$p/cat
1439                                 break
1440                         fi
1441                 done
1442                 if test ! -f $xcat$_exe; then
1443                         echo "Can't find cat anywhere!"
1444                         exit 1
1445                 fi
1446         fi
1447         echo "#!$xcat" >sharp
1448         $eunicefix sharp
1449         chmod +x sharp
1450         ./sharp > today 2>/dev/null
1451         if test -s today; then
1452                 sharpbang='#!'
1453         else
1454                 echo "#! $xcat" > sharp
1455                 $eunicefix sharp
1456                 chmod +x sharp
1457                 ./sharp > today 2>/dev/null
1458                 if test -s today; then
1459                         sharpbang='#! '
1460                 else
1461                         sharpbang=': use '
1462                 fi
1463         fi
1464 else
1465         echo " "
1466         echo "Your $sh doesn't grok # comments--I will strip them later on."
1467         shsharp=false
1468         cd ..
1469         echo "exec grep -v '^[  ]*#'" >spitshell
1470         chmod +x spitshell
1471         $eunicefix spitshell
1472         spitshell=`pwd`/spitshell
1473         cd UU
1474         echo "I presume that if # doesn't work, #! won't work either!"
1475         sharpbang=': use '
1476 fi
1477 rm -f sharp today
1478
1479 : figure out how to guarantee sh startup
1480 case "$startsh" in
1481 '') startsh=${sharpbang}${sh} ;;
1482 *)
1483 esac
1484 cat >sharp <<EOSS
1485 $startsh
1486 set abc
1487 test "$?abc" != 1
1488 EOSS
1489
1490 chmod +x sharp
1491 $eunicefix sharp
1492 if ./sharp; then
1493         : echo "Yup, it does."
1494 else
1495         echo "Hmm... '$startsh' does not guarantee sh startup..."
1496         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1497 fi
1498 rm -f sharp
1499
1500 : Save command line options in file UU/cmdline.opt for later use in
1501 : generating config.sh.
1502 cat > cmdline.opt <<EOSH
1503 : Configure command line arguments.
1504 config_arg0='$0'
1505 config_args='$*'
1506 config_argc=$#
1507 EOSH
1508 argn=1
1509 args_exp=''
1510 args_sep=''
1511 for arg in "$@"; do
1512         cat >>cmdline.opt <<EOSH
1513 config_arg$argn='$arg'
1514 EOSH
1515         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1516 $arg
1517 EOC
1518         arg_exp=`cat cmdl.opt`
1519         args_exp="$args_exp$args_sep'$arg_exp'"
1520         argn=`expr $argn + 1`
1521         args_sep=' '
1522 done
1523 rm -f cmdl.opt
1524
1525 : produce awk script to parse command line options
1526 cat >options.awk <<'EOF'
1527 BEGIN {
1528         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1529
1530         len = length(optstr);
1531         for (i = 1; i <= len; i++) {
1532                 c = substr(optstr, i, 1);
1533                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1534                 if (a == ":") {
1535                         arg[c] = 1;
1536                         i++;
1537                 }
1538                 opt[c] = 1;
1539         }
1540 }
1541 {
1542         expect = 0;
1543         str = $0;
1544         if (substr(str, 1, 1) != "-") {
1545                 printf("'%s'\n", str);
1546                 next;
1547         }
1548         len = length($0);
1549         for (i = 2; i <= len; i++) {
1550                 c = substr(str, i, 1);
1551                 if (!opt[c]) {
1552                         printf("-%s\n", substr(str, i));
1553                         next;
1554                 }
1555                 printf("-%s\n", c);
1556                 if (arg[c]) {
1557                         if (i < len)
1558                                 printf("'%s'\n", substr(str, i + 1));
1559                         else
1560                                 expect = 1;
1561                         next;
1562                 }
1563         }
1564 }
1565 END {
1566         if (expect)
1567                 print "?";
1568 }
1569 EOF
1570
1571 : process the command line options
1572 set X `for arg in "$@"; do echo "X$arg"; done |
1573         sed -e s/X// | awk -f options.awk`
1574 eval "set $*"
1575 shift
1576 rm -f options.awk
1577
1578 : set up default values
1579 fastread=''
1580 reuseval=false
1581 config_sh=''
1582 alldone=''
1583 error=''
1584 silent=''
1585 extractsh=''
1586 override=''
1587 knowitall=''
1588 rm -f optdef.sh posthint.sh
1589 cat >optdef.sh <<EOS
1590 $startsh
1591 EOS
1592
1593
1594 : option parsing
1595 while test $# -gt 0; do
1596         case "$1" in
1597         -d) shift; fastread=yes;;
1598         -e) shift; alldone=cont;;
1599         -f)
1600                 shift
1601                 cd ..
1602                 if test -r "$1"; then
1603                         config_sh="$1"
1604                 else
1605                         echo "$me: cannot read config file $1." >&2
1606                         error=true
1607                 fi
1608                 cd UU
1609                 shift;;
1610         --help|\
1611         -h) shift; error=true;;
1612         -r) shift; reuseval=true;;
1613         -s) shift; silent=true; realsilent=true;;
1614         -E) shift; alldone=exit;;
1615         -K) shift; knowitall=true;;
1616         -O) shift; override=true;;
1617         -S) shift; silent=true; extractsh=true;;
1618         -D)
1619                 shift
1620                 case "$1" in
1621                 *=)
1622                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1623                         echo "$me: ignoring -D $1" >&2
1624                         ;;
1625                 *=*) echo "$1" | \
1626                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1627                 *) echo "$1='define'" >> optdef.sh;;
1628                 esac
1629                 shift
1630                 ;;
1631         -U)
1632                 shift
1633                 case "$1" in
1634                 *=) echo "$1" >> optdef.sh;;
1635                 *=*)
1636                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1637                         echo "$me: ignoring -U $1" >&2
1638                         ;;
1639                 *) echo "$1='undef'" >> optdef.sh;;
1640                 esac
1641                 shift
1642                 ;;
1643         -A)
1644             shift
1645             xxx=''
1646             yyy="$1"
1647             zzz=''
1648             uuu=undef
1649             case "$yyy" in
1650             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1651                  case "$zzz" in
1652                  *:*) zzz='' ;;
1653                  *)   xxx=append
1654                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1655                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656                  esac
1657                  ;;
1658             esac
1659             case "$xxx" in
1660             '')  case "$yyy" in
1661                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1662                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1663                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1664                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1666                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1667                  esac
1668                  ;;
1669             esac
1670             case "$xxx" in
1671             append)
1672                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1673             clear)
1674                 echo "$yyy=''"                  >> posthint.sh ;;
1675             define)
1676                 case "$zzz" in
1677                 '') zzz=define ;;
1678                 esac
1679                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1680             eval)
1681                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1682             prepend)
1683                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1684             undef)
1685                 case "$zzz" in
1686                 '') zzz="$uuu" ;;
1687                 esac
1688                 echo "$yyy=$zzz"                >> posthint.sh ;;
1689             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1690             esac
1691             shift
1692             ;;
1693         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1694             exit 0;;
1695         --) break;;
1696         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1697         *) break;;
1698         esac
1699 done
1700
1701 case "$error" in
1702 true)
1703         cat >&2 <<EOM
1704 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1705                  [-U symbol] [-U symbol=] [-A command:symbol...]
1706   -d : use defaults for all answers.
1707   -e : go on without questioning past the production of config.sh.
1708   -f : specify an alternate default configuration file.
1709   -h : print this help message and exit (with an error status).
1710   -r : reuse C symbols value if possible (skips costly nm extraction).
1711   -s : silent mode, only echoes questions and essential information.
1712   -D : define symbol to have some value:
1713          -D symbol         symbol gets the value 'define'
1714          -D symbol=value   symbol gets the value 'value'
1715        common used examples (see INSTALL for more info):
1716          -Duse64bitint            use 64bit integers
1717          -Duse64bitall            use 64bit integers and pointers
1718          -Dusethreads             use thread support
1719          -Dinc_version_list=none  do not include older perl trees in @INC
1720          -DEBUGGING=none          DEBUGGING options
1721          -Dcc=gcc                 choose your compiler
1722          -Dprefix=/opt/perl5      choose your destination
1723   -E : stop at the end of questions, after having produced config.sh.
1724   -K : do not use unless you know what you are doing.
1725   -O : let -D and -U override definitions from loaded configuration file.
1726   -S : perform variable substitutions on all .SH files (can mix with -f)
1727   -U : undefine symbol:
1728          -U symbol    symbol gets the value 'undef'
1729          -U symbol=   symbol gets completely empty
1730        e.g.:  -Uversiononly
1731   -A : manipulate symbol after the platform specific hints have been applied:
1732          -A append:symbol=value   append value to symbol
1733          -A symbol=value          like append:, but with a separating space
1734          -A define:symbol=value   define symbol to have value
1735          -A clear:symbol          define symbol to be ''
1736          -A define:symbol         define symbol to be 'define'
1737          -A eval:symbol=value     define symbol to be eval of value
1738          -A prepend:symbol=value  prepend value to symbol
1739          -A undef:symbol          define symbol to be 'undef'
1740          -A undef:symbol=         define symbol to be ''
1741        e.g.:  -A prepend:libswanted='cl pthread '
1742               -A ccflags=-DSOME_MACRO
1743   -V : print version number and exit (with a zero status).
1744 EOM
1745         exit 1
1746         ;;
1747 esac
1748
1749 : Sanity checks
1750 case "$fastread$alldone" in
1751 yescont|yesexit) ;;
1752 *)
1753         case "$extractsh" in
1754         true) ;;
1755         *)
1756                 if test ! -t 0; then
1757                         echo "Say 'sh Configure', not 'sh <Configure'"
1758                         exit 1
1759                 fi
1760                 ;;
1761         esac
1762         ;;
1763 esac
1764
1765 exec 4>&1
1766 case "$silent" in
1767 true) exec 1>/dev/null;;
1768 esac
1769
1770 : run the defines and the undefines, if any, but leave the file out there...
1771 touch optdef.sh
1772 . ./optdef.sh
1773 : create the posthint manipulation script and leave the file out there...
1774 touch posthint.sh
1775
1776 : set package name
1777 package='perl5'
1778 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1779 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1780 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1781 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1782 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1783 esac
1784
1785 : Some greps do not return status, grrr.
1786 echo "grimblepritz" >grimble
1787 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1788         contains=contains
1789 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1790         contains=grep
1791 else
1792         contains=contains
1793 fi
1794 rm -f grimble
1795 : the following should work in any shell
1796 case "$contains" in
1797 contains*)
1798         echo " "
1799         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1800         cat >contains <<'EOSS'
1801 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1802 EOSS
1803 chmod +x contains
1804 esac
1805
1806 : Find the path to the source tree
1807 case "$src" in
1808 '') case "$0" in
1809     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1810          case "$src" in
1811          /*)    ;;
1812          .)     ;;
1813          *)     src=`cd ../$src && pwd` ;;
1814          esac
1815          ;;
1816     *)   src='.';;
1817     esac;;
1818 esac
1819 case "$src" in
1820 '')     src=/
1821         rsrc=/
1822         ;;
1823 /*)     rsrc="$src";;
1824 *)      rsrc="../$src";;
1825 esac
1826 if test -f $rsrc/Configure && \
1827         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1828 then
1829    : found it, so we are ok.
1830 else
1831         rsrc=''
1832         for src in . .. ../.. ../../.. ../../../..; do
1833                 if test -f ../$src/Configure && \
1834                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1835                 then
1836                         rsrc=../$src
1837                         break
1838                 fi
1839         done
1840 fi
1841 case "$rsrc" in
1842 '')
1843         cat <<EOM >&4
1844
1845 Sorry, I can't seem to locate the source dir for $package.  Please start
1846 Configure with an explicit path -- i.e. /some/path/Configure.
1847
1848 EOM
1849         exit 1
1850         ;;
1851 ../.)   rsrc='..';;
1852 *)
1853         echo " "
1854         echo "Sources for $package found in \"$src\"." >&4
1855         ;;
1856 esac
1857
1858 : script used to extract .SH files with variable substitutions
1859 cat >extract <<'EOS'
1860 PERL_CONFIG_SH=true
1861 echo "Doing variable substitutions on .SH files..."
1862 if test -f MANIFEST; then
1863         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1864 else
1865         echo "(Looking for .SH files under the source directory.)"
1866         set x `(cd "$src"; find . -name "*.SH" -print)`
1867 fi
1868 shift
1869 case $# in
1870 0) set x `(cd "$src"; echo *.SH)`; shift;;
1871 esac
1872 if test ! -f "$src/$1"; then
1873         shift
1874 fi
1875 mkdir_p='
1876 name=$1;
1877 create="";
1878 while test $name; do
1879         if test ! -d "$name"; then
1880                 create="$name $create";
1881                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1882                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1883         else
1884                 name="";
1885         fi;
1886 done;
1887 for file in $create; do
1888         mkdir $file;
1889 done
1890 '
1891 for file in $*; do
1892         case "$src" in
1893         ".")
1894                 case "$file" in
1895                 */*)
1896                         dir=`expr X$file : 'X\(.*\)/'`
1897                         file=`expr X$file : 'X.*/\(.*\)'`
1898                         (cd "$dir" && . ./$file)
1899                         ;;
1900                 *)
1901                         . ./$file
1902                         ;;
1903                 esac
1904                 ;;
1905         *)
1906                 case "$file" in
1907                 */*)
1908                         dir=`expr X$file : 'X\(.*\)/'`
1909                         file=`expr X$file : 'X.*/\(.*\)'`
1910                         (set x $dir; shift; eval $mkdir_p)
1911                         sh <"$src/$dir/$file"
1912                         ;;
1913                 *)
1914                         sh <"$src/$file"
1915                         ;;
1916                 esac
1917                 ;;
1918         esac
1919 done
1920 if test -f "$src/config_h.SH"; then
1921         if test ! -f config.h; then
1922         : oops, they left it out of MANIFEST, probably, so do it anyway.
1923         . "$src/config_h.SH"
1924         fi
1925 fi
1926 EOS
1927
1928 : extract files and exit if asked to do so
1929 case "$extractsh" in
1930 true)
1931         case "$realsilent" in
1932         true) ;;
1933         *) exec 1>&4;;
1934         esac
1935         case "$config_sh" in
1936         '') config_sh='config.sh';;
1937         esac
1938         echo " "
1939         echo "Fetching answers from $config_sh..."
1940         cd ..
1941         . $config_sh
1942         test "$override" && . ./optdef.sh
1943         echo " "
1944         . UU/extract
1945         rm -rf UU
1946         echo "Extraction done."
1947         exit 0
1948         ;;
1949 esac
1950
1951 : Eunice requires " " instead of "", can you believe it
1952 echo " "
1953 : Here we go...
1954 echo "Beginning of configuration questions for $package."
1955
1956 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1957
1958 : first determine how to suppress newline on echo command
1959 echo " "
1960 echo "Checking echo to see how to suppress newlines..."
1961 (echo "hi there\c" ; echo " ") >.echotmp
1962 if $contains c .echotmp >/dev/null 2>&1 ; then
1963         echo "...using -n."
1964         n='-n'
1965         c=''
1966 else
1967         cat <<'EOM'
1968 ...using \c
1969 EOM
1970         n=''
1971         c='\c'
1972 fi
1973 echo $n "The star should be here-->$c"
1974 echo '*'
1975 rm -f .echotmp
1976
1977 : Now test for existence of everything in MANIFEST
1978 echo " "
1979 if test -f "$rsrc/MANIFEST"; then
1980         echo "First let's make sure your kit is complete.  Checking..." >&4
1981         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1982                 (split -l 50 2>/dev/null || split -50)
1983         rm -f missing
1984         tmppwd=`pwd`
1985         for filelist in x??; do
1986                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1987                         >/dev/null 2>>"$tmppwd/missing")
1988         done
1989         if test -s missing; then
1990                 cat missing >&4
1991                 cat >&4 <<'EOM'
1992
1993 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1994
1995 You have the option of continuing the configuration process, despite the
1996 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1997 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1998 and contact the author (perlbug@perl.org).
1999
2000 EOM
2001                 echo $n "Continue? [n] $c" >&4
2002                 read ans
2003                 case "$ans" in
2004                 y*)
2005                         echo "Continuing..." >&4
2006                         rm -f missing
2007                         ;;
2008                 *)
2009                         echo "ABORTING..." >&4
2010                         kill $$
2011                         ;;
2012                 esac
2013         else
2014                 echo "Looks good..."
2015         fi
2016 else
2017         echo "There is no MANIFEST file.  I hope your kit is complete !"
2018 fi
2019 rm -f missing x??
2020
2021 : Find the appropriate value for a newline for tr
2022 echo " "
2023 if test -n "$DJGPP"; then
2024        trnl='\012'
2025 fi
2026 if test X"$trnl" = X; then
2027         case "`echo foo|tr '\n' x 2>/dev/null`" in
2028         foox) trnl='\n' ;;
2029         esac
2030 fi
2031 if test X"$trnl" = X; then
2032         case "`echo foo|tr '\012' x 2>/dev/null`" in
2033         foox) trnl='\012' ;;
2034         esac
2035 fi
2036 if test X"$trnl" = X; then
2037        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2038        fooxy) trnl='\n\r' ;;
2039        esac
2040 fi
2041 if test X"$trnl" = X; then
2042         cat <<EOM >&2
2043
2044 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2045
2046 EOM
2047         exit 1
2048 fi
2049
2050 : compute the number of columns on the terminal for proper question formatting
2051 case "$COLUMNS" in
2052 '') COLUMNS='80';;
2053 esac
2054
2055 : set up the echo used in my read
2056 myecho="case \"\$xxxm\" in
2057 '') echo $n \"\$rp $c\" >&4;;
2058 *) case \"\$rp\" in
2059         '') echo $n \"[\$xxxm] $c\";;
2060         *)
2061                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2062                         echo \"\$rp\" >&4
2063                         echo $n \"[\$xxxm] $c\" >&4
2064                 else
2065                         echo $n \"\$rp [\$xxxm] $c\" >&4
2066                 fi
2067                 ;;
2068         esac;;
2069 esac"
2070
2071 : now set up to do reads with possible shell escape and default assignment
2072 cat <<EOSC >myread
2073 $startsh
2074 xxxm=\$dflt
2075 $myecho
2076 ans='!'
2077 case "\$fastread" in
2078 yes) case "\$dflt" in
2079         '') ;;
2080         *) ans='';
2081                 case "\$silent-\$rp" in
2082                 true-) ;;
2083                 *) echo " " >&4;;
2084                 esac;;
2085         esac;;
2086 *) case "\$silent" in
2087         true) case "\$rp" in
2088                 '') ans='';;
2089                 esac;;
2090         esac;;
2091 esac
2092 while expr "X\$ans" : "X!" >/dev/null; do
2093         read answ
2094         set x \$xxxm
2095         shift
2096         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2097         case  "\$answ" in
2098         "!")
2099                 sh 1>&4
2100                 echo " "
2101                 $myecho
2102                 ;;
2103         !*)
2104                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2105                 shift
2106                 sh 1>&4 -c "\$*"
2107                 echo " "
2108                 $myecho
2109                 ;;
2110         "\$ans")
2111                 case "\$ans" in
2112                 \\&*)
2113                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2114                         shift
2115                         case "\$1" in
2116                         -d)
2117                                 fastread=yes
2118                                 echo "(OK, I'll run with -d after this question.)" >&4
2119                                 ;;
2120                         -*)
2121                                 echo "*** Sorry, \$1 not supported yet." >&4
2122                                 ;;
2123                         esac
2124                         $myecho
2125                         ans=!
2126                         ;;
2127                 esac;;
2128         *)
2129                 case "\$aok" in
2130                 y)
2131                         echo "*** Substitution done -- please confirm."
2132                         xxxm="\$ans"
2133                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2134                         xxxm="\$ans"
2135                         ans=!
2136                         ;;
2137                 *)
2138                         echo "*** Error -- try again."
2139                         ans=!
2140                         ;;
2141                 esac
2142                 $myecho
2143                 ;;
2144         esac
2145         case "\$ans\$xxxm\$nostick" in
2146         '')
2147                 ans=!
2148                 $myecho
2149                 ;;
2150         esac
2151 done
2152 case "\$ans" in
2153 '') ans="\$xxxm";;
2154 esac
2155 EOSC
2156
2157 : create .config dir to save info across Configure sessions
2158 test -d ../.config || mkdir ../.config
2159 cat >../.config/README <<EOF
2160 This directory created by Configure to save information that should
2161 persist across sessions for $package.
2162
2163 You may safely delete it if you wish.
2164 EOF
2165
2166 : See if we are using a devel version and want that
2167 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2168 case "$usedevel" in
2169 $define|true|[yY]*)
2170     usedevel="$define" ;;
2171 *) case "$xversion" in
2172    *[13579])
2173         cat >&4 <<EOH
2174 *** WHOA THERE!!! ***
2175
2176     This is an UNSTABLE DEVELOPMENT release.
2177     The version of this $package distribution is $xversion, that is, odd,
2178     (as opposed to even) and that signifies a development release.
2179     If you want a maintenance release, you want an even-numbered version.
2180
2181     Do ***NOT*** install this into production use.
2182     Data corruption and crashes are possible.
2183
2184     It is most seriously suggested that you do not continue any further
2185     unless you want to help in developing and debugging Perl.
2186
2187     If you *still* want to build perl, you can answer 'y' now,
2188     or pass -Dusedevel to Configure.
2189
2190 EOH
2191         rp='Do you really want to continue?'
2192         dflt='n'
2193         . ./myread
2194         case "$ans" in
2195         [yY]) echo >&4 "Okay, continuing."
2196               usedevel="$define" ;;
2197         *) echo >&4 "Okay, bye."
2198            exit 1
2199            ;;
2200         esac
2201         ;;
2202     esac
2203     usedevel="$undef"
2204     ;;
2205 esac
2206 case "$usedevel" in
2207 $define|true|[yY]*)
2208         case "$versiononly" in
2209         '') versiononly="$define" ;;
2210         esac
2211         case "$installusrbinperl" in
2212         '') installusrbinperl="$undef" ;;
2213         esac
2214         ;;
2215 esac
2216
2217 : general instructions
2218 needman=true
2219 firsttime=true
2220 user=`(logname) 2>/dev/null`
2221 case "$user" in
2222 '') user=`whoami 2>&1`;;
2223 esac
2224 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2225         firsttime=false
2226         echo " "
2227         rp='Would you like to see the instructions?'
2228         dflt=n
2229         . ./myread
2230         case "$ans" in
2231         [yY]*) ;;
2232         *) needman=false;;
2233         esac
2234 fi
2235 if $needman; then
2236         cat <<EOH
2237
2238 This installation shell script will examine your system and ask you questions
2239 to determine how the perl5 package should be installed. If you get
2240 stuck on a question, you may use a ! shell escape to start a subshell or
2241 execute a command.  Many of the questions will have default answers in square
2242 brackets; typing carriage return will give you the default.
2243
2244 On some of the questions which ask for file or directory names you are allowed
2245 to use the ~name construct to specify the login directory belonging to "name",
2246 even if you don't have a shell which knows about that.  Questions where this is
2247 allowed will be marked "(~name ok)".
2248
2249 EOH
2250         rp=''
2251         dflt='Type carriage return to continue'
2252         . ./myread
2253         cat <<'EOH'
2254
2255 The prompter used in this script allows you to use shell variables and
2256 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2257 in the default answer, as if the default line was a set of arguments given to a
2258 script shell.  This means you may also use $* to repeat the whole default line,
2259 so you do not have to re-type everything to add something to the default.
2260
2261 Every time there is a substitution, you will have to confirm.  If there is an
2262 error (e.g. an unmatched backtick), the default answer will remain unchanged
2263 and you will be prompted again.
2264
2265 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2266 the questions and use the computed defaults (or the previous answers if there
2267 was already a config.sh file). Type 'Configure -h' for a list of options.
2268 You may also start interactively and then answer '& -d' at any prompt to turn
2269 on the non-interactive behaviour for the remainder of the execution.
2270
2271 EOH
2272         . ./myread
2273         cat <<EOH
2274
2275 Much effort has been expended to ensure that this shell script will run on any
2276 Unix system.  If despite that it blows up on yours, your best bet is to edit
2277 Configure and run it again.  If you can't run Configure for some reason,
2278 you'll have to generate a config.sh file by hand.  Whatever problems you
2279 have, let me (perlbug@perl.org) know how I blew it.
2280
2281 This installation script affects things in two ways:
2282
2283 1) it may do direct variable substitutions on some of the files included
2284    in this kit.
2285 2) it builds a config.h file for inclusion in C programs.  You may edit
2286    any of these files as the need arises after running this script.
2287
2288 If you make a mistake on a question, there is no easy way to back up to it
2289 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2290 files.  Configure will offer to let you do this before it runs the SH files.
2291
2292 EOH
2293         dflt='Type carriage return to continue'
2294         . ./myread
2295         case "$firsttime" in
2296         true) echo $user >>../.config/instruct;;
2297         esac
2298 fi
2299
2300 : find out where common programs are
2301 echo " "
2302 echo "Locating common programs..." >&4
2303 cat <<EOSC >loc
2304 $startsh
2305 case \$# in
2306 0) exit 1;;
2307 esac
2308 thing=\$1
2309 shift
2310 dflt=\$1
2311 shift
2312 for dir in \$*; do
2313         case "\$thing" in
2314         .)
2315         if test -d \$dir/\$thing; then
2316                 echo \$dir
2317                 exit 0
2318         fi
2319         ;;
2320         *)
2321         for thisthing in \$dir/\$thing; do
2322                 : just loop through to pick last item
2323         done
2324         if test -f \$thisthing; then
2325                 echo \$thisthing
2326                 exit 0
2327         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2328                 echo \$thisthing
2329                 exit 0
2330         elif test -f \$dir/\$thing.exe; then
2331                 if test -n "$DJGPP"; then
2332                         echo \$dir/\$thing.exe
2333                 elif test "$eunicefix" != ":"; then
2334                         : on Eunice apparently
2335                         echo \$dir/\$thing
2336                 fi
2337                 exit 0
2338         fi
2339         ;;
2340         esac
2341 done
2342 echo \$dflt
2343 exit 1
2344 EOSC
2345 chmod +x loc
2346 $eunicefix loc
2347 loclist="
2348 awk
2349 cat
2350 chmod
2351 comm
2352 cp
2353 echo
2354 expr
2355 grep
2356 ls
2357 mkdir
2358 rm
2359 sed
2360 sort
2361 touch
2362 tr
2363 uniq
2364 "
2365 trylist="
2366 ar
2367 bison
2368 byacc
2369 cpp
2370 csh
2371 date
2372 egrep
2373 gmake
2374 gzip
2375 less
2376 ln
2377 make
2378 more
2379 nm
2380 nroff
2381 perl
2382 pg
2383 test
2384 uname
2385 zip
2386 "
2387 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2388 pth="$pth /lib /usr/lib"
2389 for file in $loclist; do
2390         eval xxx=\$$file
2391         case "$xxx" in
2392         /*|?:[\\/]*)
2393                 if test -f "$xxx"; then
2394                         : ok
2395                 else
2396                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2397                         xxx=`./loc $file $file $pth`
2398                 fi
2399                 ;;
2400         '') xxx=`./loc $file $file $pth`;;
2401         *) xxx=`./loc $xxx $xxx $pth`;;
2402         esac
2403         eval $file=$xxx$_exe
2404         eval _$file=$xxx
2405         case "$xxx" in
2406         /*)
2407                 echo $file is in $xxx.
2408                 ;;
2409         ?:[\\/]*)
2410                 echo $file is in $xxx.
2411                 ;;
2412         *)
2413                 echo "I don't know where '$file' is, and my life depends on it." >&4
2414                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2415                 exit 1
2416                 ;;
2417         esac
2418 done
2419 echo " "
2420 echo "Don't worry if any of the following aren't found..."
2421 say=offhand
2422 for file in $trylist; do
2423         eval xxx=\$$file
2424         case "$xxx" in
2425         /*|?:[\\/]*)
2426                 if test -f "$xxx"; then
2427                         : ok
2428                 else
2429                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2430                         xxx=`./loc $file $file $pth`
2431                 fi
2432                 ;;
2433         '') xxx=`./loc $file $file $pth`;;
2434         *) xxx=`./loc $xxx $xxx $pth`;;
2435         esac
2436         eval $file=$xxx$_exe
2437         eval _$file=$xxx
2438         case "$xxx" in
2439         /*)
2440                 echo $file is in $xxx.
2441                 ;;
2442         ?:[\\/]*)
2443                 echo $file is in $xxx.
2444                 ;;
2445         *)
2446                 echo "I don't see $file out there, $say."
2447                 say=either
2448                 ;;
2449         esac
2450 done
2451 case "$egrep" in
2452 egrep)
2453         echo "Substituting grep for egrep."
2454         egrep=$grep
2455         _egrep=$grep
2456         ;;
2457 esac
2458 case "$less" in
2459 '')     ;;
2460 *)      if $less -R </dev/null >/dev/null; then
2461                echo "Substituting less -R for less."
2462                less="$less -R"
2463                _less=$less
2464         fi
2465         ;;
2466 esac
2467 case "$ln" in
2468 ln)
2469         echo "Substituting cp for ln."
2470         ln=$cp
2471         _ln=$cp
2472         ;;
2473 esac
2474 case "$make" in
2475 make)
2476         case "$gmake" in
2477         gmake)
2478         echo "I can't find make or gmake, and my life depends on it." >&4
2479         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2480         exit 1
2481         ;;
2482         esac
2483         ;;
2484 esac
2485 case "$gmake" in
2486 gmake)  ;;
2487 *)      # We can't have osname yet.
2488         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2489                 # Assume that gmake, if found, is definitely GNU make
2490                 # and prefer it over the system make.
2491                 echo "Substituting gmake for make."
2492                 make=$gmake
2493                 _make=$gmake
2494         fi
2495         ;;
2496 esac
2497 case "$test" in
2498 test)
2499         echo "Hopefully test is built into your sh."
2500         ;;
2501 *)
2502         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2503                 echo "Using the test built into your sh."
2504                 test=test
2505                 _test=test
2506         fi
2507         ;;
2508 esac
2509 case "$echo" in
2510 echo)
2511         echo "Hopefully echo is built into your sh."
2512         ;;
2513 '') ;;
2514 *)
2515         echo " "
2516 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2517         $echo $n "hi there$c" >foo1
2518         echo $n "hi there$c" >foo2
2519         if cmp foo1 foo2 >/dev/null 2>&1; then
2520                 echo "They are compatible.  In fact, they may be identical."
2521         else
2522                 case "$n" in
2523                 '-n') n='' c='\c';;
2524                 *) n='-n' c='';;
2525                 esac
2526                 cat <<FOO
2527 They are not compatible!  You are probably running ksh on a non-USG system.
2528 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2529 have echo built in and we may have to run some Bourne shell scripts.  That
2530 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2531
2532 FOO
2533                 $echo $n "The star should be here-->$c"
2534                 $echo "*"
2535         fi
2536         $rm -f foo1 foo2
2537         ;;
2538 esac
2539
2540 # This question was auctioned at YAPC::Europe-2007 in Vienna
2541 # I never promised you could answer it. I only auctioned the question.
2542 cat <<FOO
2543 The following message is sponsored by
2544
2545   Dresden.pm<--The stars should be here.
2546
2547 Dear Perl user, system administrator or package
2548 maintainer, the Perl community sends greetings to
2549 you. Do you (emblematical) greet back [Y/n]? n
2550
2551 FOO
2552
2553 : Check what type of C compiler we use
2554 cat <<EOS >trygcc
2555 $startsh
2556 EOS
2557 cat <<'EOSC' >>trygcc
2558 case "$cc" in
2559 '') ;;
2560 *)  $rm -f try try.*
2561     $cat >try.c <<EOM
2562 int main(int argc, char *argv[]) {
2563   return 0;
2564 }
2565 EOM
2566     if $cc -o try $ccflags $ldflags try.c; then
2567        :
2568     else
2569         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2570         despair=yes
2571         trygcc=yes
2572         case "$cc" in
2573         *gcc*) trygcc=no ;;
2574         esac
2575         # Skip this test because it gives a false match on output like:
2576         #    ./trygcc: line 23: cc: command not found
2577         # case "`$cc -v -c try.c 2>&1`" in
2578         # *gcc*) trygcc=no ;;
2579         # esac
2580         if $test X"$trygcc" = Xyes; then
2581             if gcc -o try -c try.c; then
2582                 echo " "
2583                 echo "You seem to have a working gcc, though." >&4
2584                 # Switching compilers may undo the work of hints files.
2585                 # The most common problem is -D_REENTRANT for threads.
2586                 # This heuristic catches that case, but gets false positives
2587                 # if -Dusethreads was not actually specified.  Better to
2588                 # bail out here with a useful message than fail 
2589                 # mysteriously later. Should we perhaps just try to
2590                 # re-invoke Configure -Dcc=gcc config_args ?
2591                 if $test -f usethreads.cbu; then
2592                         $cat >&4 <<EOM 
2593
2594 *** However, any setting of the C compiler flags (e.g. for thread support)
2595 *** will be lost.  It may be necessary for you to restart Configure and
2596 *** add -Dcc=gcc to your Configure command line.
2597
2598 EOM
2599                         rp="Would you like to go ahead and try gcc anyway?"
2600                         dflt=n
2601                 else
2602                         rp="Would you like to use it?"
2603                         dflt=y
2604                 fi
2605                 if $test -f myread; then
2606                     . ./myread
2607                 else
2608                     if $test -f UU/myread; then
2609                         . ./UU/myread
2610                     else
2611                         echo "Cannot find myread, sorry.  Aborting." >&2
2612                         exit 1
2613                     fi
2614                 fi  
2615                 case "$ans" in
2616                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2617                 esac
2618             fi
2619         fi
2620     fi
2621     $rm -f try try.*
2622     ;;
2623 esac
2624 EOSC
2625
2626 cat <<EOS >checkcc
2627 $startsh
2628 EOS
2629 cat <<'EOSC' >>checkcc
2630 case "$cc" in        
2631 '') ;;
2632 *)  $rm -f try try.*              
2633     $cat >try.c <<EOM
2634 int main(int argc, char *argv[]) {
2635   return 0;
2636 }
2637 EOM
2638     if $cc -o try $ccflags $ldflags try.c; then
2639        :
2640     else
2641         if $test X"$despair" = Xyes; then
2642            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2643         fi
2644         $cat >&4 <<EOM         
2645 You need to find a working C compiler.
2646 Either (purchase and) install the C compiler supplied by your OS vendor,
2647 or for a free C compiler try http://gcc.gnu.org/
2648 I cannot continue any further, aborting.
2649 EOM
2650         exit 1
2651     fi
2652     $rm -f try try.*
2653     ;;
2654 esac
2655 EOSC
2656
2657 : determine whether symbolic links are supported
2658 echo " "
2659 $touch blurfl
2660 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2661         echo "Symbolic links are supported." >&4
2662         lns="$ln -s"
2663 else
2664         echo "Symbolic links are NOT supported." >&4
2665         lns="$ln"
2666 fi
2667 $rm -f blurfl sym
2668
2669 : determine whether symbolic links are supported
2670 echo " "
2671 case "$lns" in
2672 *"ln"*" -s")
2673         echo "Checking how to test for symbolic links..." >&4
2674         $lns blurfl sym
2675         if $test "X$issymlink" = X; then
2676                 case "$newsh" in
2677                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2678                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2679                 esac
2680                 if test $? = 0; then
2681                         issymlink="test -h"
2682                 else
2683                         echo "Your builtin 'test -h' may be broken." >&4
2684                         case "$test" in
2685                         /*)     ;;
2686                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2687                                 for p in $pth
2688                                 do
2689                                         if test -f "$p/$test"; then
2690                                                 test="$p/$test"
2691                                                 break
2692                                         fi
2693                                 done
2694                                 ;;
2695                         esac
2696                         case "$test" in
2697                         /*)
2698                                 echo "Trying external '$test -h'." >&4
2699                                 issymlink="$test -h"
2700                                 if $test ! -h sym >/dev/null 2>&1; then
2701                                         echo "External '$test -h' is broken, too." >&4
2702                                         issymlink=''
2703                                 fi
2704                                 ;;
2705                         *)      issymlink='' ;;
2706                         esac
2707                 fi              
2708         fi
2709         if $test "X$issymlink" = X; then
2710                 if $test -L sym 2>/dev/null; then
2711                         issymlink="$test -L"
2712                         echo "The builtin '$test -L' worked." >&4
2713                 fi
2714         fi
2715         if $test "X$issymlink" != X; then
2716                 echo "You can test for symbolic links with '$issymlink'." >&4
2717         else
2718                 echo "I do not know how you can test for symbolic links." >&4
2719         fi
2720         $rm -f blurfl sym
2721         ;;
2722 *)      echo "No symbolic links, so not testing for their testing..." >&4
2723         ;;
2724 esac
2725 echo " "
2726
2727 : Make symlinks util
2728 case "$mksymlinks" in
2729 $define|true|[yY]*)
2730         case "$src" in
2731         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2732                 exit 1
2733                 ;;
2734         *)      case "$lns:$issymlink" in
2735                 *"ln"*" -s:"*"test -"?)
2736                         echo "Creating the symbolic links..." >&4
2737                         echo "(First creating the subdirectories...)" >&4
2738                         cd ..
2739                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2740                                 read directory
2741                                 test -z "$directory" && break
2742                                 mkdir -p $directory
2743                         done
2744                         # Sanity check 1.
2745                         if test ! -d t/base; then
2746                                 echo "Failed to create the subdirectories.  Aborting." >&4
2747                                 exit 1
2748                         fi
2749                         echo "(Then creating the symlinks...)" >&4
2750                         awk '{print $1}' $src/MANIFEST | while true; do
2751                                 read filename
2752                                 test -z "$filename" && break
2753                                 if test -f $filename; then
2754                                         if $issymlink $filename; then
2755                                                 rm -f $filename
2756                                         fi
2757                                 fi
2758                                 if test -f $filename; then
2759                                         echo "$filename already exists, not symlinking."
2760                                 else
2761                                         ln -s $src/$filename $filename
2762                                 fi
2763                         done
2764                         # Sanity check 2.
2765                         if test ! -f t/base/lex.t; then
2766                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2767                                 exit 1
2768                         fi
2769                         cd UU
2770                         ;;
2771                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2772                         ;;
2773                 esac
2774                 ;;
2775         esac
2776         ;;
2777 esac
2778
2779 : Check for Cross-Compilation
2780 case "$usecrosscompile" in
2781 $define|true|[yY]*)
2782         $echo "Cross-compiling..."
2783         croak=''
2784         case "$cc" in
2785         *-*-gcc) # A cross-compiling gcc, probably.
2786             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2787             ar=$targetarch-ar
2788             # leave out ld, choosing it is more complex
2789             nm=$targetarch-nm
2790             ranlib=$targetarch-ranlib
2791             $echo 'extern int foo;' > try.c
2792             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2793             shift
2794             if $test $# -gt 0; then
2795                 incpth="$incpth $*"
2796                 incpth="`$echo $incpth|$sed 's/^ //'`"
2797                 echo "Guessing incpth '$incpth'." >&4
2798                 for i in $*; do
2799                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2800                     if $test -d $j; then
2801                         libpth="$libpth $j"
2802                     fi
2803                 done   
2804                 libpth="`$echo $libpth|$sed 's/^ //'`"
2805                 echo "Guessing libpth '$libpth'." >&4
2806             fi
2807             $rm -f try.c
2808             ;;
2809         esac
2810         case "$targetarch" in
2811         '') echo "Targetarch not defined." >&4; croak=y ;;
2812         *)  echo "Using targetarch $targetarch." >&4 ;;
2813         esac
2814         case "$incpth" in
2815         '') echo "Incpth not defined." >&4; croak=y ;;
2816         *)  echo "Using incpth '$incpth'." >&4 ;;
2817         esac
2818         case "$libpth" in
2819         '') echo "Libpth not defined." >&4; croak=y ;;
2820         *)  echo "Using libpth '$libpth'." >&4 ;;
2821         esac
2822         case "$usrinc" in
2823         '') for i in $incpth; do
2824                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2825                     usrinc=$i
2826                     echo "Guessing usrinc $usrinc." >&4
2827                     break
2828                 fi
2829             done
2830             case "$usrinc" in
2831             '') echo "Usrinc not defined." >&4; croak=y ;;
2832             esac
2833             ;;
2834         *)  echo "Using usrinc $usrinc." >&4 ;;
2835         esac
2836         case "$targethost" in
2837         '') echo "Targethost not defined." >&4; croak=y ;;
2838         *)  echo "Using targethost $targethost." >&4
2839         esac
2840         locincpth=' '
2841         loclibpth=' '
2842         case "$croak" in
2843         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2844         esac
2845         case "$src" in
2846         /*) run=$src/Cross/run
2847             targetmkdir=$src/Cross/mkdir
2848             to=$src/Cross/to
2849             from=$src/Cross/from
2850             ;;
2851         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2852             run=$pwd/Cross/run
2853             targetmkdir=$pwd/Cross/mkdir
2854             to=$pwd/Cross/to
2855             from=$pwd/Cross/from
2856             ;;
2857         esac
2858         case "$targetrun" in
2859         '') targetrun=ssh ;;
2860         esac
2861         case "$targetto" in
2862         '') targetto=scp ;;
2863         esac
2864         case "$targetfrom" in
2865         '') targetfrom=scp ;;
2866         esac
2867         run=$run-$targetrun
2868         to=$to-$targetto
2869         from=$from-$targetfrom
2870         case "$targetdir" in
2871         '')  targetdir=/tmp
2872              echo "Guessing targetdir $targetdir." >&4
2873              ;;
2874         esac
2875         case "$targetuser" in
2876         '')  targetuser=root
2877              echo "Guessing targetuser $targetuser." >&4
2878              ;;
2879         esac
2880         case "$targetfrom" in
2881         scp)    q=-q ;;
2882         *)      q='' ;;
2883         esac
2884         case "$targetrun" in
2885         ssh|rsh)
2886             cat >$run <<EOF
2887 #!/bin/sh
2888 case "\$1" in
2889 -cwd)
2890   shift
2891   cwd=\$1
2892   shift
2893   ;;
2894 esac
2895 case "\$cwd" in
2896 '') cwd=$targetdir ;;
2897 esac
2898 exe=\$1
2899 shift
2900 if $test ! -f \$exe.xok; then
2901   $to \$exe
2902   $touch \$exe.xok
2903 fi
2904 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetrun '$targetrun'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetmkdir" in
2912         */Cross/mkdir)
2913             cat >$targetmkdir <<EOF
2914 #!/bin/sh
2915 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2916 EOF
2917             $chmod a+rx $targetmkdir
2918             ;;
2919         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2920             exit 1
2921             ;;
2922         esac
2923         case "$targetto" in
2924         scp|rcp)
2925             cat >$to <<EOF
2926 #!/bin/sh
2927 for f in \$@
2928 do
2929   case "\$f" in
2930   /*)
2931     $targetmkdir \`dirname \$f\`
2932     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2933     ;;
2934   *)
2935     $targetmkdir $targetdir/\`dirname \$f\`
2936     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2937     ;;
2938   esac
2939 done
2940 exit 0
2941 EOF
2942             ;;
2943         cp) cat >$to <<EOF
2944 #!/bin/sh
2945 for f in \$@
2946 do
2947   case "\$f" in
2948   /*)
2949     $mkdir -p $targetdir/\`dirname \$f\`
2950     $cp \$f $targetdir/\$f || exit 1
2951     ;;
2952   *)
2953     $targetmkdir $targetdir/\`dirname \$f\`
2954     $cp \$f $targetdir/\$f || exit 1
2955     ;;
2956   esac
2957 done
2958 exit 0
2959 EOF
2960             ;;
2961         *)  echo "Unknown targetto '$targetto'" >&4
2962             exit 1
2963             ;;
2964         esac
2965         case "$targetfrom" in
2966         scp|rcp)
2967           cat >$from <<EOF
2968 #!/bin/sh
2969 for f in \$@
2970 do
2971   $rm -f \$f
2972   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2973 done
2974 exit 0
2975 EOF
2976             ;;
2977         cp) cat >$from <<EOF
2978 #!/bin/sh
2979 for f in \$@
2980 do
2981   $rm -f \$f
2982   cp $targetdir/\$f . || exit 1
2983 done
2984 exit 0
2985 EOF
2986             ;;
2987         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2988             exit 1
2989             ;;
2990         esac
2991         if $test ! -f $run; then
2992             echo "Target 'run' script '$run' not found." >&4
2993         else
2994             $chmod a+rx $run
2995         fi
2996         if $test ! -f $to; then
2997             echo "Target 'to' script '$to' not found." >&4
2998         else
2999             $chmod a+rx $to
3000         fi
3001         if $test ! -f $from; then
3002             echo "Target 'from' script '$from' not found." >&4
3003         else
3004             $chmod a+rx $from
3005         fi
3006         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3007             exit 1
3008         fi
3009         cat >&4 <<EOF
3010 Using '$run' for remote execution,
3011 and '$from' and '$to'
3012 for remote file transfer.
3013 EOF
3014         ;;
3015 *)      run=''
3016         to=:
3017         from=:
3018         usecrosscompile='undef'
3019         targetarch=''
3020         ;;
3021 esac
3022
3023 : see whether [:lower:] and [:upper:] are supported character classes
3024 echo " "
3025 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3026 ABYZ)
3027         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3028         up='[:upper:]'
3029         low='[:lower:]'
3030         ;;
3031 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3032         # (0xd9 and 0xe2), therefore that is a nice testing point.
3033         if test "X$up" = X -o "X$low" = X; then
3034             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3035             rs) up='[A-Z]'
3036                 low='[a-z]'
3037                 ;;
3038             esac
3039         fi
3040         if test "X$up" = X -o "X$low" = X; then
3041             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3042             rs) up='A-Z'
3043                 low='a-z'
3044                 ;;
3045             esac
3046         fi
3047         if test "X$up" = X -o "X$low" = X; then
3048             case "`echo RS | od -x 2>/dev/null`" in
3049             *D9E2*|*d9e2*)
3050                 echo "Hey, this might be EBCDIC." >&4
3051                 if test "X$up" = X -o "X$low" = X; then
3052                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3053                     rs) up='[A-IJ-RS-Z]'
3054                         low='[a-ij-rs-z]'
3055                         ;;
3056                     esac
3057                 fi
3058                 if test "X$up" = X -o "X$low" = X; then
3059                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3060                     rs) up='A-IJ-RS-Z'
3061                         low='a-ij-rs-z'
3062                         ;;
3063                     esac
3064                 fi
3065                 ;;
3066             esac
3067         fi
3068 esac
3069 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3070 rs)
3071     echo "Using $up and $low to convert case." >&4
3072     ;;
3073 *)
3074     echo "I don't know how to translate letters from upper to lower case." >&4
3075     echo "Your tr is not acting any way I know of." >&4
3076     exit 1
3077     ;;
3078 esac
3079 : set up the translation script tr, must be called with ./tr of course
3080 cat >tr <<EOSC
3081 $startsh
3082 case "\$1\$2" in
3083 '[A-Z][a-z]') exec $tr '$up' '$low';;
3084 '[a-z][A-Z]') exec $tr '$low' '$up';;
3085 esac
3086 exec $tr "\$@"
3087 EOSC
3088 chmod +x tr
3089 $eunicefix tr
3090
3091 : Try to determine whether config.sh was made on this system
3092 case "$config_sh" in
3093 '')
3094 myuname=`$uname -a 2>/dev/null`
3095 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3096 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3097 # because the A-Z/a-z are not consecutive.
3098 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3099         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3100 newmyuname="$myuname"
3101 dflt=n
3102 case "$knowitall" in
3103 '')
3104         if test -f ../config.sh; then
3105                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3106                         eval "`grep myuname= ../config.sh`"
3107                 fi
3108                 if test "X$myuname" = "X$newmyuname"; then
3109                         dflt=y
3110                 fi
3111         fi
3112         ;;
3113 *) dflt=y;;
3114 esac
3115
3116 : Get old answers from old config file if Configure was run on the
3117 : same system, otherwise use the hints.
3118 hint=default
3119 cd ..
3120 if test -f config.sh; then
3121         echo " "
3122         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3123         . UU/myread
3124         case "$ans" in
3125         n*|N*) echo "OK, I'll ignore it."
3126                 mv config.sh config.sh.old
3127                 myuname="$newmyuname"
3128                 ;;
3129         *)  echo "Fetching default answers from your old config.sh file..." >&4
3130                 tmp_n="$n"
3131                 tmp_c="$c"
3132                 tmp_sh="$sh"
3133                 . ./config.sh
3134                 cp config.sh UU
3135                 n="$tmp_n"
3136                 c="$tmp_c"
3137                 : Older versions did not always set $sh.  Catch re-use of such
3138                 : an old config.sh.
3139                 case "$sh" in
3140                 '') sh="$tmp_sh" ;;
3141                 esac
3142                 hint=previous
3143                 ;;
3144         esac
3145 fi
3146 . ./UU/checkcc
3147 if test ! -f config.sh; then
3148         $cat <<EOM
3149
3150 First time through, eh?  I have some defaults handy for some systems
3151 that need some extra help getting the Configure answers right:
3152
3153 EOM
3154         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3155         dflt=''
3156         : Half the following guesses are probably wrong... If you have better
3157         : tests or hints, please send them to perlbug@perl.org
3158         : The metaconfig authors would also appreciate a copy...
3159         $test -f /irix && osname=irix
3160         $test -f /xenix && osname=sco_xenix
3161         $test -f /dynix && osname=dynix
3162         $test -f /dnix && osname=dnix
3163         $test -f /lynx.os && osname=lynxos
3164         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3165         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3166         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3167         $test -f /bin/mips && /bin/mips && osname=mips
3168         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3169                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3170         $test -d /usr/apollo/bin && osname=apollo
3171         $test -f /etc/saf/_sactab && osname=svr4
3172         $test -d /usr/include/minix && osname=minix
3173         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3174         if $test -d /MachTen -o -d /MachTen_Folder; then
3175                 osname=machten
3176                 if $test -x /sbin/version; then
3177                         osvers=`/sbin/version | $awk '{print $2}' |
3178                         $sed -e 's/[A-Za-z]$//'`
3179                 elif $test -x /usr/etc/version; then
3180                         osvers=`/usr/etc/version | $awk '{print $2}' |
3181                         $sed -e 's/[A-Za-z]$//'`
3182                 else
3183                         osvers="$2.$3"
3184                 fi
3185         fi
3186
3187         $test -f /sys/posix.dll &&
3188                 $test -f /usr/bin/what &&
3189                 set X `/usr/bin/what /sys/posix.dll` &&
3190                 $test "$3" = UWIN &&
3191                 osname=uwin &&
3192                 osvers="$5"
3193
3194         if $test -f $uname; then
3195                 set X $myuname
3196                 shift
3197
3198                 case "$5" in
3199                 fps*) osname=fps ;;
3200                 mips*)
3201                         case "$4" in
3202                         umips) osname=umips ;;
3203                         *) osname=mips ;;
3204                         esac;;
3205                 [23]100) osname=mips ;;
3206                 next*) osname=next ;;
3207                 i386*)
3208                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3209                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3210                                 osname='sco'
3211                                 osvers=$tmp
3212                         elif $test -f /etc/kconfig; then
3213                                 osname=isc
3214                                 if test "$lns" = "$ln -s"; then
3215                                         osvers=4
3216                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3217                                         osvers=3
3218                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3219                                         osvers=2
3220                                 fi
3221                         fi
3222                         tmp=''
3223                         ;;
3224                 pc*)
3225                         if test -n "$DJGPP"; then
3226                                 osname=dos
3227                                 osvers=djgpp
3228                         fi
3229                         ;;
3230                 esac
3231
3232                 case "$1" in
3233                 aix) osname=aix
3234                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3235                         case "$tmp" in
3236                         # oslevel can fail with:
3237                         # oslevel: Unable to acquire lock.
3238                         *not\ found) osvers="$4"."$3" ;;
3239                         '<3240'|'<>3240') osvers=3.2.0 ;;
3240                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3241                         '=3250'|'>3250') osvers=3.2.5 ;;
3242                         *) osvers=$tmp;;
3243                         esac
3244                         ;;
3245                 bsd386) osname=bsd386
3246                         osvers=`$uname -r`
3247                         ;;
3248                 cygwin*) osname=cygwin
3249                         osvers="$3"
3250                         ;;
3251                 *dc.osx) osname=dcosx
3252                         osvers="$3"
3253                         ;;
3254                 dnix) osname=dnix
3255                         osvers="$3"
3256                         ;;
3257                 domainos) osname=apollo
3258                         osvers="$3"
3259                         ;;
3260                 dgux)   osname=dgux
3261                         osvers="$3"
3262                         ;;
3263                 dragonfly) osname=dragonfly
3264                         osvers="$3"
3265                         ;;
3266                 dynixptx*) osname=dynixptx
3267                         osvers=`echo "$4"|sed 's/^v//'`
3268                         ;;
3269                 freebsd) osname=freebsd
3270                         osvers="$3" ;;
3271                 genix)  osname=genix ;;
3272                 gnu)    osname=gnu
3273                         osvers="$3" ;;
3274                 hp*)    osname=hpux
3275                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3276                         ;;
3277                 irix*)  osname=irix
3278                         case "$3" in
3279                         4*) osvers=4 ;;
3280                         5*) osvers=5 ;;
3281                         *)      osvers="$3" ;;
3282                         esac
3283                         ;;
3284                 linux)  osname=linux
3285                         case "$3" in
3286                         *)      osvers="$3" ;;
3287                         esac
3288                         ;;
3289                 MiNT)   osname=mint
3290                         ;;
3291                 netbsd*) osname=netbsd
3292                         osvers="$3"
3293                         ;;
3294                 news-os) osvers="$3"
3295                         case "$3" in
3296                         4*) osname=newsos4 ;;
3297                         *) osname=newsos ;;
3298                         esac
3299                         ;;
3300                 next*) osname=next ;;
3301                 nonstop-ux) osname=nonstopux ;;
3302                 openbsd) osname=openbsd
3303                         osvers="$3"
3304                         ;;
3305                 os2)    osname=os2
3306                         osvers="$4"
3307                         ;;
3308                 POSIX-BC | posix-bc ) osname=posix-bc
3309                         osvers="$3"
3310                         ;;
3311                 powerux | power_ux | powermax_os | powermaxos | \
3312                 powerunix | power_unix) osname=powerux
3313                         osvers="$3"
3314                         ;;
3315                 qnx) osname=qnx
3316                         osvers="$4"
3317                         ;;
3318                 solaris) osname=solaris
3319                         case "$3" in
3320                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3321                         *)      osvers="$3" ;;
3322                         esac
3323                         ;;
3324                 sunos) osname=sunos
3325                         case "$3" in
3326                         5*) osname=solaris
3327                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3328                         *)      osvers="$3" ;;
3329                         esac
3330                         ;;
3331                 titanos) osname=titanos
3332                         case "$3" in
3333                         1*) osvers=1 ;;
3334                         2*) osvers=2 ;;
3335                         3*) osvers=3 ;;
3336                         4*) osvers=4 ;;
3337                         *)      osvers="$3" ;;
3338                         esac
3339                         ;;
3340                 ultrix) osname=ultrix
3341                         osvers="$3"
3342                         ;;
3343                 osf1|mls+)      case "$5" in
3344                                 alpha)
3345                                         osname=dec_osf
3346                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3347                                         case "$osvers" in
3348                                         [1-9].[0-9]*) ;;
3349                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3350                                         esac
3351                                         ;;
3352                         hp*)    osname=hp_osf1  ;;
3353                         mips)   osname=mips_osf1 ;;
3354                         esac
3355                         ;;
3356                 # UnixWare 7.1.2 is known as Open UNIX 8
3357                 openunix|unixware) osname=svr5
3358                         osvers="$4"
3359                         ;;
3360                 uts)    osname=uts
3361                         osvers="$3"
3362                         ;;
3363                 vos) osvers="$3"
3364                         ;;
3365                 $2) case "$osname" in
3366                         *isc*) ;;
3367                         *freebsd*) ;;
3368                         svr*)
3369                                 : svr4.x or possibly later
3370                                 case "svr$3" in
3371                                 ${osname}*)
3372                                         osname=svr$3
3373                                         osvers=$4
3374                                         ;;
3375                                 esac
3376                                 case "$osname" in
3377                                 svr4.0)
3378                                         : Check for ESIX
3379                                         if test -f /stand/boot ; then
3380                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3381                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3382                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3383                                                         if test -n "$isesix"; then
3384                                                                 osname=esix4
3385                                                         fi
3386                                                 fi
3387                                         fi
3388                                         ;;
3389                                 esac
3390                                 ;;
3391                         *)      if test -f /etc/systemid; then
3392                                         osname=sco
3393                                         set `echo $3 | $sed 's/\./ /g'` $4
3394                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3395                                                 osvers=$1.$2.$3
3396                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3397                                                 osvers=$1.$2
3398                                         elif $test -f $src/hints/sco_$1.sh; then
3399                                                 osvers=$1
3400                                         fi
3401                                 else
3402                                         case "$osname" in
3403                                         '') : Still unknown.  Probably a generic Sys V.
3404                                                 osname="sysv"
3405                                                 osvers="$3"
3406                                                 ;;
3407                                         esac
3408                                 fi
3409                                 ;;
3410                         esac
3411                         ;;
3412                 *)      case "$osname" in
3413                         '') : Still unknown.  Probably a generic BSD.
3414                                 osname="$1"
3415                                 osvers="$3"
3416                                 ;;
3417                         esac
3418                         ;;
3419                 esac
3420         else
3421                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3422                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3423                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3424                                 osname=news_os
3425                         fi
3426                         $rm -f UU/kernel.what
3427                 elif test -d c:/. -o -n "$is_os2" ; then
3428                         set X $myuname
3429                         osname=os2
3430                         osvers="$5"
3431                 fi
3432         fi
3433
3434         case "$targetarch" in
3435         '') ;;
3436         *)  hostarch=$osname
3437             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3438             osvers=''
3439             ;;
3440         esac
3441
3442         : Now look for a hint file osname_osvers, unless one has been
3443         : specified already.
3444         case "$hintfile" in
3445         ''|' ')
3446                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3447                 : Also try without trailing minor version numbers.
3448                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3449                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3450                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3451                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3452                 case "$file" in
3453                 '') dflt=none ;;
3454                 *)  case "$osvers" in
3455                         '') dflt=$file
3456                                 ;;
3457                         *)  if $test -f $src/hints/$file.sh ; then
3458                                         dflt=$file
3459                                 elif $test -f $src/hints/$xfile.sh ; then
3460                                         dflt=$xfile
3461                                 elif $test -f $src/hints/$xxfile.sh ; then
3462                                         dflt=$xxfile
3463                                 elif $test -f $src/hints/$xxxfile.sh ; then
3464                                         dflt=$xxxfile
3465                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3466                                         dflt=$xxxxfile
3467                                 elif $test -f "$src/hints/${osname}.sh" ; then
3468                                         dflt="${osname}"
3469                                 else
3470                                         dflt=none
3471                                 fi
3472                                 ;;
3473                         esac
3474                         ;;
3475                 esac
3476                 if $test -f Policy.sh ; then
3477                         case "$dflt" in
3478                         *Policy*) ;;
3479                         none) dflt="Policy" ;;
3480                         *) dflt="Policy $dflt" ;;
3481                         esac
3482                 fi
3483                 ;;
3484         *)
3485                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3486                 ;;
3487         esac
3488
3489         if $test -f Policy.sh ; then
3490                 $cat <<EOM
3491
3492 There's also a Policy hint file available, which should make the
3493 site-specific (policy) questions easier to answer.
3494 EOM
3495
3496         fi
3497
3498         $cat <<EOM
3499
3500 You may give one or more space-separated answers, or "none" if appropriate.
3501 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3502 previous run of Configure, you may specify it as well as or instead of
3503 OS-specific hints.  If hints are provided for your OS, you should use them:
3504 although Perl can probably be built without hints on many platforms, using
3505 hints often improve performance and may enable features that Configure can't
3506 set up on its own. If there are no hints that match your OS, specify "none";
3507 DO NOT give a wrong version or a wrong OS.
3508
3509 EOM
3510
3511         rp="Which of these apply, if any?"
3512         . UU/myread
3513         tans=$ans
3514         for file in $tans; do
3515                 if $test X$file = XPolicy -a -f Policy.sh; then
3516                         . Policy.sh
3517                         $cat Policy.sh >> UU/config.sh
3518                 elif $test -f $src/hints/$file.sh; then
3519                         . $src/hints/$file.sh
3520                         $cat $src/hints/$file.sh >> UU/config.sh
3521                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3522                         : nothing
3523                 else
3524                         : Give one chance to correct a possible typo.
3525                         echo "$file.sh does not exist"
3526                         dflt=$file
3527                         rp="hint to use instead?"
3528                         . UU/myread
3529                         for file in $ans; do
3530                                 if $test -f "$src/hints/$file.sh"; then
3531                                         . $src/hints/$file.sh
3532                                         $cat $src/hints/$file.sh >> UU/config.sh
3533                                 elif $test X$ans = X -o X$ans = Xnone ; then
3534                                         : nothing
3535                                 else
3536                                         echo "$file.sh does not exist -- ignored."
3537                                 fi
3538                         done
3539                 fi
3540         done
3541
3542         hint=recommended
3543         : Remember our hint file for later.
3544         if $test -f "$src/hints/$file.sh" ; then
3545                 hintfile="$file"
3546         else
3547                 hintfile=''
3548         fi
3549 fi
3550 cd UU
3551 ;;
3552 *)
3553         echo " "
3554         echo "Fetching default answers from $config_sh..." >&4
3555         tmp_n="$n"
3556         tmp_c="$c"
3557         cd ..
3558         cp $config_sh config.sh 2>/dev/null
3559         chmod +w config.sh
3560         . ./config.sh
3561         cd UU
3562         cp ../config.sh .
3563         n="$tmp_n"
3564         c="$tmp_c"
3565         hint=previous
3566         ;;
3567 esac
3568 test "$override" && . ./optdef.sh
3569
3570 : Restore computed paths
3571 for file in $loclist $trylist; do
3572         eval $file="\$_$file"
3573 done
3574
3575 cat << EOM
3576
3577 Configure uses the operating system name and version to set some defaults.
3578 The default value is probably right if the name rings a bell. Otherwise,
3579 since spelling matters for me, either accept the default or answer "none"
3580 to leave it blank.
3581
3582 EOM
3583 case "$osname" in
3584         ''|' ')
3585                 case "$hintfile" in
3586                 ''|' '|none) dflt=none ;;
3587                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3588                 esac
3589                 ;;
3590         *) dflt="$osname" ;;
3591 esac
3592 rp="Operating system name?"
3593 . ./myread
3594 case "$ans" in
3595 none)  osname='' ;;
3596 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3597 esac
3598 echo " "
3599 case "$osvers" in
3600         ''|' ')
3601                 case "$hintfile" in
3602                 ''|' '|none) dflt=none ;;
3603                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3604                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3605                         case "$dflt" in
3606                         ''|' ') dflt=none ;;
3607                         esac
3608                         ;;
3609                 esac
3610                 ;;
3611         *) dflt="$osvers" ;;
3612 esac
3613 rp="Operating system version?"
3614 . ./myread
3615 case "$ans" in
3616 none)  osvers='' ;;
3617 *) osvers="$ans" ;;
3618 esac
3619
3620
3621 . ./posthint.sh
3622
3623 : who configured the system
3624 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3625 case "$cf_by" in
3626 "")
3627         cf_by=`(logname) 2>/dev/null`
3628         case "$cf_by" in
3629         "")
3630                 cf_by=`(whoami) 2>/dev/null`
3631                 case "$cf_by" in
3632                 "") cf_by=unknown ;;
3633                 esac ;;
3634         esac ;;
3635 esac
3636
3637 : decide how portable to be.  Allow command line overrides.
3638 case "$d_portable" in
3639 "$undef") ;;
3640 *)      d_portable="$define" ;;
3641 esac
3642
3643 : set up shell script to do ~ expansion
3644 cat >filexp <<EOSS
3645 $startsh
3646 : expand filename
3647 case "\$1" in
3648  \~/*|\~)
3649         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3650         ;;
3651  \~*)
3652         if $test -f /bin/csh; then
3653                 /bin/csh -f -c "glob \$1"
3654                 failed=\$?
3655                 echo ""
3656                 exit \$failed
3657         else
3658                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3659                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3660                 if $test ! -d "\$dir"; then
3661                         me=\`basename \$0\`
3662                         echo "\$me: can't locate home directory for: \$name" >&2
3663                         exit 1
3664                 fi
3665                 case "\$1" in
3666                 */*)
3667                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3668                         ;;
3669                 *)
3670                         echo \$dir
3671                         ;;
3672                 esac
3673         fi
3674         ;;
3675 *)
3676         echo \$1
3677         ;;
3678 esac
3679 EOSS
3680 chmod +x filexp
3681 $eunicefix filexp
3682
3683 : now set up to get a file name
3684 cat <<EOS >getfile
3685 $startsh
3686 EOS
3687 cat <<'EOSC' >>getfile
3688 tilde=''
3689 fullpath=''
3690 already=''
3691 skip=''
3692 none_ok=''
3693 exp_file=''
3694 nopath_ok=''
3695 orig_rp="$rp"
3696 orig_dflt="$dflt"
3697 case "$gfpth" in
3698 '') gfpth='.' ;;
3699 esac
3700
3701 case "$fn" in
3702 *\(*)
3703         : getfile will accept an answer from the comma-separated list
3704         : enclosed in parentheses even if it does not meet other criteria.
3705         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3706         fn=`echo $fn | sed 's/(.*)//'`
3707         ;;
3708 esac
3709
3710 case "$fn" in
3711 *:*)
3712         loc_file=`expr $fn : '.*:\(.*\)'`
3713         fn=`expr $fn : '\(.*\):.*'`
3714         ;;
3715 esac
3716
3717 case "$fn" in
3718 *~*) tilde=true;;
3719 esac
3720 case "$fn" in
3721 */*) fullpath=true;;
3722 esac
3723 case "$fn" in
3724 *+*) skip=true;;
3725 esac
3726 case "$fn" in
3727 *n*) none_ok=true;;
3728 esac
3729 case "$fn" in
3730 *e*) exp_file=true;;
3731 esac
3732 case "$fn" in
3733 *p*) nopath_ok=true;;
3734 esac
3735
3736 case "$fn" in
3737 *f*) type='File';;
3738 *d*) type='Directory';;
3739 *l*) type='Locate';;
3740 esac
3741
3742 what="$type"
3743 case "$what" in
3744 Locate) what='File';;
3745 esac
3746
3747 case "$exp_file" in
3748 '')
3749         case "$d_portable" in
3750         "$define") ;;
3751         *) exp_file=true;;
3752         esac
3753         ;;
3754 esac
3755
3756 cd ..
3757 while test "$type"; do
3758         redo=''
3759         rp="$orig_rp"
3760         dflt="$orig_dflt"
3761         case "$tilde" in
3762         true) rp="$rp (~name ok)";;
3763         esac
3764         . UU/myread
3765         if test -f UU/getfile.ok && \
3766                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3767         then
3768                 value="$ans"
3769                 ansexp="$ans"
3770                 break
3771         fi
3772         case "$ans" in
3773         none)
3774                 value=''
3775                 ansexp=''
3776                 case "$none_ok" in
3777                 true) type='';;
3778                 esac
3779                 ;;
3780         *)
3781                 case "$tilde" in
3782                 '') value="$ans"
3783                         ansexp="$ans";;
3784                 *)
3785                         value=`UU/filexp $ans`
3786                         case $? in
3787                         0)
3788                                 if test "$ans" != "$value"; then
3789                                         echo "(That expands to $value on this system.)"
3790                                 fi
3791                                 ;;
3792                         *) value="$ans";;
3793                         esac
3794                         ansexp="$value"
3795                         case "$exp_file" in
3796                         '') value="$ans";;
3797                         esac
3798                         ;;
3799                 esac
3800                 case "$fullpath" in
3801                 true)
3802                         case "$ansexp" in
3803                         /*) value="$ansexp" ;;
3804                         [a-zA-Z]:/*) value="$ansexp" ;;
3805                         *)
3806                                 redo=true
3807                                 case "$already" in
3808                                 true)
3809                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3810                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3811                                         ;;
3812                                 *)
3813                                 echo "Please give a full path name, starting with slash." >&4
3814                                         case "$tilde" in
3815                                         true)
3816                                 echo "Note that using ~name is ok provided it expands well." >&4
3817                                                 already=true
3818                                                 ;;
3819                                         esac
3820                                 esac
3821                                 ;;
3822                         esac
3823                         ;;
3824                 esac
3825                 case "$redo" in
3826                 '')
3827                         case "$type" in
3828                         File)
3829                                 for fp in $gfpth; do
3830                                         if test "X$fp" = X.; then
3831                                             pf="$ansexp"
3832                                         else    
3833                                             pf="$fp/$ansexp"
3834                                         fi
3835                                         if test -f "$pf"; then
3836                                                 type=''
3837                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3838                                         then
3839                                                 echo "($value is not a plain file, but that's ok.)"
3840                                                 type=''
3841                                         fi
3842                                         if test X"$type" = X; then
3843                                             value="$pf"
3844                                             break
3845                                         fi
3846                                 done
3847                                 ;;
3848                         Directory)
3849                                 for fp in $gfpth; do
3850                                         if test "X$fp" = X.; then
3851                                             dir="$ans"
3852                                             direxp="$ansexp"
3853                                         else    
3854                                             dir="$fp/$ansexp"
3855                                             direxp="$fp/$ansexp"
3856                                         fi
3857                                         if test -d "$direxp"; then
3858                                                 type=''
3859                                                 value="$dir"
3860                                                 break
3861                                         fi
3862                                 done
3863                                 ;;
3864                         Locate)
3865                                 if test -d "$ansexp"; then
3866                                         echo "(Looking for $loc_file in directory $value.)"
3867                                         value="$value/$loc_file"
3868                                         ansexp="$ansexp/$loc_file"
3869                                 fi
3870                                 if test -f "$ansexp"; then
3871                                         type=''
3872                                 fi
3873                                 case "$nopath_ok" in
3874                                 true)   case "$value" in
3875                                         */*) ;;
3876                                         *)      echo "Assuming $value will be in people's path."
3877                                                 type=''
3878                                                 ;;
3879                                         esac
3880                                         ;;
3881                                 esac
3882                                 ;;
3883                         esac
3884
3885                         case "$skip" in
3886                         true) type='';
3887                         esac
3888
3889                         case "$type" in
3890                         '') ;;
3891                         *)
3892                                 if test "$fastread" = yes; then
3893                                         dflt=y
3894                                 else
3895                                         dflt=n
3896                                 fi
3897                                 rp="$what $value doesn't exist.  Use that name anyway?"
3898                                 . UU/myread
3899                                 dflt=''
3900                                 case "$ans" in
3901                                 y*) type='';;
3902                                 *) echo " ";;
3903                                 esac
3904                                 ;;
3905                         esac
3906                         ;;
3907                 esac
3908                 ;;
3909         esac
3910 done
3911 cd UU
3912 ans="$value"
3913 rp="$orig_rp"
3914 dflt="$orig_dflt"
3915 rm -f getfile.ok
3916 test "X$gfpthkeep" != Xy && gfpth=""
3917 EOSC
3918
3919 : determine root of directory hierarchy where package will be installed.
3920 case "$prefix" in
3921 '')
3922         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3923         ;;
3924 *?/)
3925         dflt=`echo "$prefix" | sed 's/.$//'`
3926         ;;
3927 *)
3928         dflt="$prefix"
3929         ;;
3930 esac
3931 $cat <<EOM
3932
3933 By default, $package will be installed in $dflt/bin, manual pages
3934 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3935 installation directories. Typically this is something like /usr/local.
3936 If you wish to have binaries under /usr/bin but other parts of the
3937 installation under /usr/local, that's ok: you will be prompted
3938 separately for each of the installation directories, the prefix being
3939 only used to set the defaults.
3940
3941 EOM
3942 fn=d~
3943 rp='Installation prefix to use?'
3944 . ./getfile
3945 oldprefix=''
3946 case "$prefix" in
3947 '') ;;
3948 *)
3949         case "$ans" in
3950         "$prefix") ;;
3951         *) oldprefix="$prefix";;
3952         esac
3953         ;;
3954 esac
3955 prefix="$ans"
3956 prefixexp="$ansexp"
3957
3958 : allow them to override the AFS root
3959 case "$afsroot" in
3960 '')     afsroot=/afs ;;
3961 *)      afsroot=$afsroot ;;
3962 esac
3963
3964 : is AFS running?
3965 echo " "
3966 case "$afs" in
3967 $define|true)   afs=true ;;
3968 $undef|false)   afs=false ;;
3969 *)      if $test -d $afsroot; then
3970                 afs=true
3971         else
3972                 afs=false
3973         fi
3974         ;;
3975 esac
3976 if $afs; then
3977         echo "AFS may be running... I'll be extra cautious then..." >&4
3978 else
3979         echo "AFS does not seem to be running..." >&4
3980 fi
3981
3982 : determine installation prefix for where package is to be installed.
3983 if $afs; then 
3984 $cat <<EOM
3985
3986 Since you are running AFS, I need to distinguish the directory in which
3987 files will reside from the directory in which they are installed (and from
3988 which they are presumably copied to the former directory by occult means).
3989
3990 EOM
3991         case "$installprefix" in
3992         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3993         *) dflt="$installprefix";;
3994         esac
3995 else
3996 $cat <<EOM
3997
3998 In some special cases, particularly when building $package for distribution,
3999 it is convenient to distinguish the directory in which files should be
4000 installed from the directory ($prefix) in which they will
4001 eventually reside.  For most users, these two directories are the same.
4002
4003 EOM
4004         case "$installprefix" in
4005         '') dflt=$prefix ;;
4006         *) dflt=$installprefix;;
4007         esac
4008 fi
4009 fn=d~
4010 rp='What installation prefix should I use for installing files?'
4011 . ./getfile
4012 installprefix="$ans"
4013 installprefixexp="$ansexp"
4014
4015 : Perform the prefixexp/installprefixexp correction if necessary
4016 cat <<EOS >installprefix
4017 $startsh
4018 EOS
4019 cat <<'EOSC' >>installprefix
4020 : Change installation prefix, if necessary.
4021 if $test X"$prefix" != X"$installprefix"; then
4022     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4023 else
4024     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4025 fi
4026 EOSC
4027 chmod +x installprefix
4028 $eunicefix installprefix
4029
4030 : Set variables such as privlib and privlibexp from the output of ./getfile
4031 : performing the prefixexp/installprefixexp correction if necessary.
4032 cat <<EOS >setprefixvar
4033 $startsh
4034 EOS
4035 cat <<'EOSC' >>setprefixvar
4036 eval "${prefixvar}=\"\$ans\""
4037 eval "${prefixvar}exp=\"\$ansexp\""
4038 . ./installprefix
4039 EOSC
4040 chmod +x setprefixvar
4041 $eunicefix setprefixvar
4042
4043 : set up the script used to warn in case of inconsistency
4044 cat <<EOS >whoa
4045 $startsh
4046 EOS
4047 cat <<'EOSC' >>whoa
4048 dflt=y
4049 case "$hint" in
4050     recommended)
4051         case "$hintfile" in
4052         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4053                 ;;
4054         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4055                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4056                 ;;
4057         esac
4058         ;;
4059     *)  echo " "
4060         echo "*** WHOA THERE!!! ***" >&4
4061         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4062         ;;
4063 esac
4064 rp="    Keep the $hint value?"
4065 . ./myread
4066 case "$ans" in
4067 y) td=$was; tu=$was;;
4068 esac
4069 EOSC
4070
4071 : function used to set '$1' to '$val'
4072 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4073 case "$val$was" in
4074 $define$undef) . ./whoa; eval "$var=\$td";;
4075 $undef$define) . ./whoa; eval "$var=\$tu";;
4076 *) eval "$var=$val";;
4077 esac'
4078
4079 : get the patchlevel
4080 echo " "
4081 echo "Getting the current patchlevel..." >&4
4082 if $test -r $rsrc/patchlevel.h;then
4083         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4084         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4085         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4086         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4087         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4088         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4089         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4090 else
4091         revision=0
4092         patchlevel=0
4093         subversion=0
4094         api_revision=0
4095         api_version=0
4096         api_subversion=0
4097         perl_patchlevel=0
4098         $echo "(You do not have patchlevel.h.  Eek.)"
4099 fi
4100 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4101 version_patchlevel_string="version $patchlevel subversion $subversion"
4102 case "$perl_patchlevel" in
4103 0|'') ;;
4104 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4105     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4106     ;;
4107 esac
4108
4109 $echo "(You have $package $version_patchlevel_string.)"
4110
4111 case "$osname" in
4112 dos|vms)
4113         : XXX Should be a Configure test for double-dots in filenames.
4114         version=`echo $revision $patchlevel $subversion | \
4115                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4116         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4117                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4118         ;;
4119 *)
4120         version=`echo $revision $patchlevel $subversion | \
4121                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4122         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4123                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4124         ;;
4125 esac
4126 : Special case the 5.005_xx maintenance series, which used 5.005
4127 : without any subversion label as a subdirectory in $sitelib
4128 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4129         api_versionstring='5.005'
4130 fi
4131
4132 : Do we want threads support and if so, what type
4133 case "$usethreads" in
4134 $define|true|[yY]*)     dflt='y';;
4135 *)     # Catch case where user specified ithreads or 5005threads but
4136        # forgot -Dusethreads (A.D. 4/2002)
4137        case "$useithreads$use5005threads" in
4138        *$define*)       dflt='y';;
4139        *)               dflt='n';;
4140        esac
4141        ;;
4142 esac
4143 cat <<EOM
4144
4145 Perl can be built to take advantage of threads on some systems.
4146 To do so, Configure can be run with -Dusethreads.
4147
4148 Note that Perl built with threading support runs slightly slower
4149 and uses more memory than plain Perl. The current implementation
4150 is believed to be stable, but it is fairly new, and so should be
4151 treated with caution.
4152
4153 If this doesn't make any sense to you, just accept the default '$dflt'.
4154 EOM
4155 rp='Build a threading Perl?'
4156 . ./myread
4157 case "$ans" in
4158 y|Y)    val="$define" ;;
4159 *)      val="$undef" ;;
4160 esac
4161 set usethreads
4162 eval $setvar
4163
4164 if $test $patchlevel -lt 9; then
4165     case "$usethreads" in
4166     $define)
4167         $cat <<EOM
4168
4169 Since release 5.6, Perl has had two different threading implementations,
4170 the newer interpreter-based version (ithreads) with one interpreter per
4171 thread, and the older 5.005 version (5005threads).
4172 The 5005threads version is effectively unmaintained and will probably be
4173 removed in Perl 5.10, so there should be no need to build a Perl using it
4174 unless needed for backwards compatibility with some existing 5.005threads
4175 code.
4176
4177 EOM
4178         : Default to ithreads unless overridden on command line or with
4179         : old config.sh
4180         dflt='y'
4181         case "$use5005threads" in
4182                 $define|true|[yY]*) dflt='n';;
4183         esac
4184         case "$useithreads" in
4185                 $undef|false|[nN]*) dflt='n';;
4186         esac
4187         rp='Use the newer interpreter-based ithreads?'
4188         . ./myread
4189         case "$ans" in
4190         y|Y)    val="$define" ;;
4191         *)      val="$undef" ;;
4192         esac
4193         set useithreads
4194         eval $setvar
4195         : Now set use5005threads to the opposite value.
4196         case "$useithreads" in
4197         $define) val="$undef" ;;
4198         *) val="$define" ;;
4199         esac
4200         set use5005threads
4201         eval $setvar
4202         ;;
4203     *)
4204         useithreads="$undef"
4205         use5005threads="$undef"
4206         ;;
4207     esac
4208
4209     case "$useithreads$use5005threads" in
4210     "$define$define")
4211         $cat >&4 <<EOM
4212
4213 You cannot have both the ithreads and the 5.005 threads enabled
4214 at the same time.  Disabling the 5.005 threads since they are
4215 much less stable than the ithreads.
4216
4217 EOM
4218         use5005threads="$undef"
4219         ;;
4220     esac
4221
4222 else
4223 : perl-5.9.x and later
4224
4225     if test X"$usethreads" = "X$define"; then
4226         case "$use5005threads" in
4227             $define|true|[yY]*)
4228                 $cat >&4 <<EOM
4229
4230 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4231
4232 EOM
4233             ;;
4234         esac
4235     fi
4236
4237     use5005threads="$undef"
4238     useithreads="$usethreads"
4239 fi
4240
4241 case "$d_oldpthreads" in
4242 '')     : Configure tests would be welcome here.  For now, assume undef.
4243         val="$undef" ;;
4244 *)      val="$d_oldpthreads" ;;
4245 esac
4246 set d_oldpthreads
4247 eval $setvar
4248
4249
4250 : Look for a hint-file generated 'call-back-unit'.  If the
4251 : user has specified that a threading perl is to be built,
4252 : we may need to set or change some other defaults.
4253 if $test -f usethreads.cbu; then
4254     echo "Your platform has some specific hints regarding threaded builds, using them..."
4255     . ./usethreads.cbu
4256 else
4257     case "$usethreads" in
4258         "$define"|true|[yY]*)
4259                 $cat <<EOM
4260 (Your platform does not have any specific hints for threaded builds.
4261  Assuming POSIX threads, then.)
4262 EOM
4263         ;;
4264     esac
4265 fi
4266
4267 : Check if multiplicity is required
4268 cat <<EOM
4269
4270 Perl can be built so that multiple Perl interpreters can coexist
4271 within the same Perl executable.
4272 EOM
4273
4274 case "$useithreads" in
4275 $define)
4276         cat <<EOM
4277 This multiple interpreter support is required for interpreter-based threads.
4278 EOM
4279         val="$define"
4280         ;;
4281 *)      case "$usemultiplicity" in
4282         $define|true|[yY]*)     dflt='y';;
4283         *) dflt='n';;
4284         esac
4285         echo " "
4286         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4287         rp='Build Perl for multiplicity?'
4288         . ./myread
4289         case "$ans" in
4290         y|Y)    val="$define" ;;
4291         *)      val="$undef" ;;
4292         esac
4293         ;;
4294 esac
4295 set usemultiplicity
4296 eval $setvar
4297
4298 : Check if morebits is requested
4299 case "$usemorebits" in
4300 "$define"|true|[yY]*)
4301         use64bitint="$define"
4302         uselongdouble="$define"
4303         usemorebits="$define"
4304         ;;
4305 *)      usemorebits="$undef"
4306         ;;
4307 esac
4308
4309 : Determine the C compiler to be used
4310 echo " "
4311 case "$cc" in
4312 '') dflt=cc;;
4313 *) dflt="$cc";;
4314 esac
4315 rp="Use which C compiler?"
4316 . ./myread
4317 cc="$ans"
4318
4319 : See whether they have no cc but they do have gcc
4320 . ./trygcc
4321 if $test -f cc.cbu; then
4322     . ./cc.cbu
4323 fi
4324 . ./checkcc
4325
4326 : make some quick guesses about what we are up against
4327 echo " "
4328 $echo $n "Hmm...  $c"
4329 echo exit 1 >bsd
4330 echo exit 1 >usg
4331 echo exit 1 >v7
4332 echo exit 1 >osf1
4333 echo exit 1 >eunice
4334 echo exit 1 >xenix
4335 echo exit 1 >venix
4336 echo exit 1 >os2
4337 d_bsd="$undef"
4338 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4339 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4340 then
4341         echo "Looks kind of like an OSF/1 system, but we'll see..."
4342         echo exit 0 >osf1
4343 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4344         xxx=`./loc addbib blurfl $pth`
4345         if $test -f $xxx; then
4346         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4347                 echo exit 0 >bsd
4348                 echo exit 0 >usg
4349         else
4350                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4351                         echo "Looks kind of like an extended USG system, but we'll see..."
4352                 else
4353                         echo "Looks kind of like a USG system, but we'll see..."
4354                 fi
4355                 echo exit 0 >usg
4356         fi
4357 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358         echo "Looks kind of like a BSD system, but we'll see..."
4359         d_bsd="$define"
4360         echo exit 0 >bsd
4361 else
4362         echo "Looks kind of like a Version 7 system, but we'll see..."
4363         echo exit 0 >v7
4364 fi
4365 case "$eunicefix" in
4366 *unixtovms*)
4367         $cat <<'EOI'
4368 There is, however, a strange, musty smell in the air that reminds me of
4369 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4370 EOI
4371         echo exit 0 >eunice
4372         d_eunice="$define"
4373 : it so happens the Eunice I know will not run shell scripts in Unix format
4374         ;;
4375 *)
4376         echo " "
4377         echo "Congratulations.  You aren't running Eunice."
4378         d_eunice="$undef"
4379         ;;
4380 esac
4381 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4382 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4383 : semicolon as a patch separator
4384 case "$p_" in
4385 :) ;;
4386 *)
4387         $cat <<'EOI'
4388 I have the feeling something is not exactly right, however...don't tell me...
4389 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4390 (Or you may be running DOS with DJGPP.)
4391 EOI
4392         echo exit 0 >os2
4393         ;;
4394 esac
4395 if test -f /xenix; then
4396         echo "Actually, this looks more like a XENIX system..."
4397         echo exit 0 >xenix
4398         d_xenix="$define"
4399 else
4400         echo " "
4401         echo "It's not Xenix..."
4402         d_xenix="$undef"
4403 fi
4404 chmod +x xenix
4405 $eunicefix xenix
4406 if test -f /venix; then
4407         echo "Actually, this looks more like a VENIX system..."
4408         echo exit 0 >venix
4409 else
4410         echo " "
4411         if ./xenix; then
4412                 : null
4413         else
4414                 echo "Nor is it Venix..."
4415         fi
4416 fi
4417 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4418 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4419 $rm -f foo
4420
4421 : Check if we are using GNU gcc and what its version is
4422 echo " "
4423 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4424 $cat >try.c <<EOM
4425 #include <stdio.h>
4426 int main() {
4427 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4428 #ifdef __VERSION__
4429         printf("%s\n", __VERSION__);
4430 #else
4431         printf("%s\n", "1");
4432 #endif
4433 #endif
4434         return(0);
4435 }
4436 EOM
4437 if $cc -o try $ccflags $ldflags try.c; then
4438         gccversion=`$run ./try`
4439         case "$gccversion" in
4440         '') echo "You are not using GNU cc." ;;
4441         *)  echo "You are using GNU cc $gccversion."
4442             ccname=gcc
4443             ;;
4444         esac
4445 else
4446         echo " "
4447         echo "*** WHOA THERE!!! ***" >&4
4448         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4449         case "$knowitall" in
4450         '')
4451         echo "    You'd better start hunting for one and let me know about it." >&4
4452                 exit 1
4453                 ;;
4454         esac
4455 fi
4456 $rm -f try try.*
4457 case "$gccversion" in
4458 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4459 esac
4460 case "$gccversion" in
4461 '') gccosandvers='' ;;
4462 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4463    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4464    gccshortvers=''
4465    case "$gccosandvers" in
4466    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4467    $osname$osvers) ;; # looking good
4468    $osname*) cat <<EOM >&4
4469
4470 *** WHOA THERE!!! ***
4471
4472     Your gcc has not been compiled for the exact release of
4473     your operating system ($gccosandvers versus $osname$osvers).
4474
4475     In general it is a good idea to keep gcc synchronized with
4476     the operating system because otherwise serious problems
4477     may ensue when trying to compile software, like Perl.
4478
4479     I'm trying to be optimistic here, though, and will continue.
4480     If later during the configuration and build icky compilation
4481     problems appear (headerfile conflicts being the most common
4482     manifestation), I suggest reinstalling the gcc to match
4483     your operating system release.
4484
4485 EOM
4486       ;;
4487    *) gccosandvers='' ;; # failed to parse, better be silent
4488    esac
4489    ;;
4490 esac
4491 case "$ccname" in
4492 '') ccname="$cc" ;;
4493 esac
4494
4495 # gcc 3.* complain about adding -Idirectories that they already know about,
4496 # so we will take those off from locincpth.
4497 case "$gccversion" in
4498 3*)
4499     echo "main(){}">try.c
4500     for incdir in $locincpth; do
4501        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4502              grep '^c[cp]p*[01]: warning: changing search order '`
4503        if test "X$warn" != X; then
4504            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4505        fi
4506     done
4507     $rm -f try try.*
4508 esac
4509
4510 : What should the include directory be ?
4511 echo " "
4512 $echo $n "Hmm...  $c"
4513 dflt='/usr/include'
4514 incpath=''
4515 mips_type=''
4516 if $test -f /bin/mips && /bin/mips; then
4517         echo "Looks like a MIPS system..."
4518         $cat >usr.c <<'EOCP'
4519 #ifdef SYSTYPE_BSD43
4520 /bsd43
4521 #endif
4522 EOCP
4523         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4524                 dflt='/bsd43/usr/include'
4525                 incpath='/bsd43'
4526                 mips_type='BSD 4.3'
4527         else
4528                 mips_type='System V'
4529         fi
4530         $rm -f usr.c usr.out
4531         echo "and you're compiling with the $mips_type compiler and libraries."
4532         xxx_prompt=y
4533         echo "exit 0" >mips
4534 else
4535         echo "Doesn't look like a MIPS system."
4536         xxx_prompt=n
4537         echo "exit 1" >mips
4538 fi
4539 chmod +x mips
4540 $eunicefix mips
4541 case "$usrinc" in
4542 '') ;;
4543 *) dflt="$usrinc";;
4544 esac
4545 case "$xxx_prompt" in
4546 y)      fn=d/
4547         echo " "
4548         rp='Where are the include files you want to use?'
4549         . ./getfile
4550         usrinc="$ans"
4551         ;;
4552 *)      usrinc="$dflt"
4553         ;;
4554 esac
4555
4556 : see how we invoke the C preprocessor
4557 echo " "
4558 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4559 cat <<'EOT' >testcpp.c
4560 #define ABC abc
4561 #define XYZ xyz
4562 ABC.XYZ
4563 EOT
4564 cd ..
4565 if test ! -f cppstdin; then
4566         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4567                 # AIX cc -E doesn't show the absolute headerfile
4568                 # locations but we'll cheat by using the -M flag.
4569                 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
4570         else
4571                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4572         fi
4573 else
4574         echo "Keeping your $hint cppstdin wrapper."
4575 fi
4576 chmod 755 cppstdin
4577 wrapper=`pwd`/cppstdin
4578 ok='false'
4579 cd UU
4580
4581 if $test "X$cppstdin" != "X" && \
4582         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4583         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4584 then
4585         echo "You used to use $cppstdin $cppminus so we'll use that again."
4586         case "$cpprun" in
4587         '') echo "But let's see if we can live without a wrapper..." ;;
4588         *)
4589                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4590                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591                 then
4592                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4593                         ok='true'
4594                 else
4595                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4596                 fi
4597                 ;;
4598         esac
4599 else
4600         case "$cppstdin" in
4601         '') ;;
4602         *)
4603                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4604                 ;;
4605         esac
4606 fi
4607
4608 if $ok; then
4609         : nothing
4610 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4611         $cc -E <testcpp.c >testcpp.out 2>&1; \
4612         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4613         echo "Yup, it does."
4614         x_cpp="$cc -E"
4615         x_minus='';
4616 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4617         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619         echo "Yup, it does."
4620         x_cpp="$cc -E"
4621         x_minus='-';
4622 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4623         $cc -P <testcpp.c >testcpp.out 2>&1; \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625         echo "Yipee, that works!"
4626         x_cpp="$cc -P"
4627         x_minus='';
4628 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4629         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4630         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631         echo "At long last!"
4632         x_cpp="$cc -P"
4633         x_minus='-';
4634 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4635         $cpp <testcpp.c >testcpp.out 2>&1; \
4636         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637         echo "It works!"
4638         x_cpp="$cpp"
4639         x_minus='';
4640 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4641         $cpp - <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "Hooray, it works!  I was beginning to wonder."
4644         x_cpp="$cpp"
4645         x_minus='-';
4646 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4647         $wrapper <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         x_cpp="$wrapper"
4650         x_minus=''
4651         echo "Eureka!"
4652 else
4653         dflt=''
4654         rp="No dice.  I can't find a C preprocessor.  Name one:"
4655         . ./myread
4656         x_cpp="$ans"
4657         x_minus=''
4658         $x_cpp <testcpp.c >testcpp.out 2>&1
4659         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660                 echo "OK, that will do." >&4
4661         else
4662 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4663                 exit 1
4664         fi
4665 fi
4666
4667 case "$ok" in
4668 false)
4669         cppstdin="$x_cpp"
4670         cppminus="$x_minus"
4671         cpprun="$x_cpp"
4672         cpplast="$x_minus"
4673         set X $x_cpp
4674         shift
4675         case "$1" in
4676         "$cpp")
4677                 echo "Perhaps can we force $cc -E using a wrapper..."
4678                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4679                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4680                 then
4681                         echo "Yup, we can."
4682                         cppstdin="$wrapper"
4683                         cppminus='';
4684                 else
4685                         echo "Nope, we'll have to live without it..."
4686                 fi
4687                 ;;
4688         esac
4689         case "$cpprun" in
4690         "$wrapper")
4691                 cpprun=''
4692                 cpplast=''
4693                 ;;
4694         esac
4695         ;;
4696 esac
4697
4698 case "$cppstdin" in
4699 "$wrapper"|'cppstdin') ;;
4700 *) $rm -f $wrapper;;
4701 esac
4702 $rm -f testcpp.c testcpp.out
4703
4704 : Set private lib path
4705 case "$plibpth" in
4706 '') if ./mips; then
4707                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4708         fi;;
4709 esac
4710 case "$libpth" in
4711 ' ') dlist='';;
4712 '') dlist="$loclibpth $plibpth $glibpth";;
4713 *) dlist="$libpth";;
4714 esac
4715
4716 : Now check and see which directories actually exist, avoiding duplicates
4717 libpth=''
4718 for xxx in $dlist
4719 do
4720     if $test -d $xxx; then
4721                 case " $libpth " in
4722                 *" $xxx "*) ;;
4723                 *) libpth="$libpth $xxx";;
4724                 esac
4725     fi
4726 done
4727 $cat <<'EOM'
4728
4729 Some systems have incompatible or broken versions of libraries.  Among
4730 the directories listed in the question below, please remove any you
4731 know not to be holding relevant libraries, and add any that are needed.
4732 Say "none" for none.
4733
4734 EOM
4735 case "$libpth" in
4736 '') dflt='none';;
4737 *)
4738         set X $libpth
4739         shift
4740         dflt=${1+"$@"}
4741         ;;
4742 esac
4743 rp="Directories to use for library searches?"
4744 . ./myread
4745 case "$ans" in
4746 none) libpth=' ';;
4747 *) libpth="$ans";;
4748 esac
4749
4750 : compute shared library extension
4751 case "$so" in
4752 '')
4753         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4754                 dflt='sl'
4755         else
4756                 dflt='so'
4757         fi
4758         ;;
4759 *) dflt="$so";;
4760 esac
4761 $cat <<EOM
4762
4763 On some systems, shared libraries may be available.  Answer 'none' if
4764 you want to suppress searching of shared libraries for the remainder
4765 of this configuration.
4766
4767 EOM
4768 rp='What is the file extension used for shared libraries?'
4769 . ./myread
4770 so="$ans"
4771
4772 : Define several unixisms.
4773 : Hints files or command line option can be used to override them.
4774 : The convoluted testing is in case hints files set either the old
4775 : or the new name.
4776 case "$_exe" in
4777 '')     case "$exe_ext" in
4778         '')     ;;
4779         *)      _exe="$exe_ext" ;;
4780         esac
4781         ;;
4782 esac
4783 case "$_a" in
4784 '')     case "$lib_ext" in
4785     '') _a='.a';;
4786         *)      _a="$lib_ext" ;;
4787         esac
4788         ;;
4789 esac
4790 case "$_o" in
4791 '') case "$obj_ext" in
4792         '')     _o='.o';;
4793         *)      _o="$obj_ext";;
4794         esac
4795         ;;
4796 esac
4797 case "$p_" in
4798 '') case "$path_sep" in
4799         '')     p_=':';;
4800         *)      p_="$path_sep";;
4801         esac
4802         ;;
4803 esac
4804 exe_ext=$_exe
4805 lib_ext=$_a
4806 obj_ext=$_o
4807 path_sep=$p_
4808
4809 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4810
4811 : Which makefile gets called first.  This is used by make depend.
4812 case "$firstmakefile" in
4813 '') firstmakefile='makefile';;
4814 esac
4815
4816 : Check is we will use socks
4817 case "$usesocks" in
4818 $define|true|[yY]*)     dflt='y';;
4819 *) dflt='n';;
4820 esac
4821 cat <<EOM
4822
4823 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4824 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4825 to use the PerlIO abstraction layer, this will be implicitly selected.
4826
4827 If this doesn't make any sense to you, just accept the default '$dflt'.
4828 EOM
4829 rp='Build Perl for SOCKS?'
4830 . ./myread
4831 case "$ans" in
4832 y|Y)    val="$define" ;;
4833 *)      val="$undef" ;;
4834 esac
4835 set usesocks
4836 eval $setvar
4837
4838 : Check for uselongdouble support
4839 case "$ccflags" in
4840 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4841 esac
4842
4843 case "$uselongdouble" in
4844 $define|true|[yY]*)     dflt='y';;
4845 *) dflt='n';;
4846 esac
4847 cat <<EOM
4848
4849 Perl can be built to take advantage of long doubles which
4850 (if available) may give more accuracy and range for floating point numbers.
4851
4852 If this doesn't make any sense to you, just accept the default '$dflt'.
4853 EOM
4854 rp='Try to use long doubles if available?'
4855 . ./myread
4856 case "$ans" in
4857 y|Y)    val="$define"   ;;
4858 *)      val="$undef"    ;;
4859 esac
4860 set uselongdouble
4861 eval $setvar
4862
4863 case "$uselongdouble" in
4864 true|[yY]*) uselongdouble="$define" ;;
4865 esac
4866
4867 : Look for a hint-file generated 'call-back-unit'.  If the
4868 : user has specified that long doubles should be used,
4869 : we may need to set or change some other defaults.
4870 if $test -f uselongdouble.cbu; then
4871     echo "Your platform has some specific hints regarding long doubles, using them..."
4872     . ./uselongdouble.cbu
4873 else
4874     case "$uselongdouble" in
4875         $define)
4876                 $cat <<EOM
4877 (Your platform does not have any specific hints for long doubles.)
4878 EOM
4879         ;;
4880     esac
4881 fi
4882
4883 : Looking for optional libraries
4884 echo " "
4885 echo "Checking for optional libraries..." >&4
4886 case "$libs" in
4887 ' '|'') dflt='';;
4888 *) dflt="$libs";;
4889 esac
4890 case "$libswanted" in
4891 '') libswanted='c_s';;
4892 esac
4893 case "$usesocks" in
4894 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4895 esac
4896 libsfound=''
4897 libsfiles=''
4898 libsdirs=''
4899 libspath=''
4900 for thisdir in $libpth $xlibpth; do
4901   test -d $thisdir && libspath="$libspath $thisdir"
4902 done
4903 for thislib in $libswanted; do
4904         for thisdir in $libspath; do
4905             xxx=''
4906             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4907                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4908                 $test -f "$xxx" && eval $libscheck
4909                 $test -f "$xxx" && libstyle=shared
4910             fi
4911             if test ! -f "$xxx"; then
4912                 xxx=$thisdir/lib$thislib.$so
4913                 $test -f "$xxx" && eval $libscheck
4914                 $test -f "$xxx" && libstyle=shared
4915             fi
4916             if test ! -f "$xxx"; then
4917                 xxx=$thisdir/lib$thislib$_a
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=static
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/$thislib$_a
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=static
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/lib${thislib}_s$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930                 $test -f "$xxx" && thislib=${thislib}_s
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/Slib$thislib$_a
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=static
4936             fi
4937             if $test -f "$xxx"; then
4938                 case "$libstyle" in
4939                 shared) echo "Found -l$thislib (shared)." ;;
4940                 static) echo "Found -l$thislib." ;;
4941                 *)      echo "Found -l$thislib ($libstyle)." ;;
4942                 esac
4943                 case " $dflt " in
4944                 *"-l$thislib "*);;
4945                 *) dflt="$dflt -l$thislib"
4946                    libsfound="$libsfound $xxx"
4947                    yyy=`basename $xxx`
4948                    libsfiles="$libsfiles $yyy"
4949                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4950                    case " $libsdirs " in
4951                    *" $yyy "*) ;;
4952                    *) libsdirs="$libsdirs $yyy" ;;
4953                    esac
4954                    ;;
4955                 esac
4956                 break
4957             fi
4958         done
4959         if $test ! -f "$xxx"; then
4960             echo "No -l$thislib."
4961         fi
4962 done
4963 set X $dflt
4964 shift
4965 dflt="$*"
4966 case "$libs" in
4967 '') dflt="$dflt";;
4968 *) dflt="$libs";;
4969 esac
4970 case "$dflt" in
4971 ' '|'') dflt='none';;
4972 esac
4973
4974 $cat <<EOM
4975
4976 In order to compile $package on your machine, a number of libraries
4977 are usually needed.  Include any other special libraries here as well.
4978 Say "none" for none.  The default list is almost always right.
4979 EOM
4980
4981 echo " "
4982 rp="What libraries to use?"
4983 . ./myread
4984 case "$ans" in
4985 none) libs=' ';;
4986 *) libs="$ans";;
4987 esac
4988
4989 : determine optimization, if desired, or use for debug flag also
4990 case "$optimize" in
4991 ' '|$undef) dflt='none';;
4992 '') dflt='-O';;
4993 *) dflt="$optimize";;
4994 esac
4995 $cat <<EOH
4996
4997 By default, $package compiles with the -O flag to use the optimizer.
4998 Alternately, you might want to use the symbolic debugger, which uses
4999 the -g flag (on traditional Unix systems).  Either flag can be
5000 specified here.  To use neither flag, specify the word "none".
5001
5002 EOH
5003 rp="What optimizer/debugger flag should be used?"
5004 . ./myread
5005 optimize="$ans"
5006 case "$optimize" in
5007 'none') optimize=" ";;
5008 esac
5009
5010 : Check what DEBUGGING is required from the command line
5011 : -DEBUGGING      or -DDEBUGGING or
5012 : -DEBUGGING=both                       = -g + -DDEBUGGING
5013 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5014 : -DEBUGGING=none or -UDEBUGGING        =
5015 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5016 case "$EBUGGING" in
5017 '')     ;;
5018 *)      DEBUGGING=$EBUGGING ;;
5019 esac
5020
5021 case "$DEBUGGING" in
5022 -g|both|$define)
5023     case "$optimize" in
5024         *-g*) ;;
5025         *)    optimize="$optimize -g" ;;
5026     esac ;;
5027 none|$undef)
5028     case "$optimize" in
5029         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5030                 shift
5031                 optimize="$*"
5032                 ;;
5033     esac ;;
5034 esac
5035
5036 dflt=''
5037 case "$DEBUGGING" in
5038 both|$define) dflt='-DDEBUGGING'
5039 esac
5040
5041 : argument order is deliberate, as the flag will start with - which set could
5042 : think is an option
5043 checkccflag='check=$1; flag=$2; callback=$3;
5044 echo " ";
5045 echo "Checking if your compiler accepts $flag" 2>&1;
5046 echo "int main(void) { return 0; }" > gcctest.c;
5047 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5048     echo "Yes, it does." 2>&1;
5049     if $test -s gcctest.out ; then
5050         echo "But your platform does not like it:";
5051         cat gcctest.out;
5052     else
5053         case "$ccflags" in
5054         *$check*)
5055             echo "Leaving current flags $ccflags alone." 2>&1
5056             ;;
5057         *) dflt="$dflt $flag";
5058             eval $callback
5059             ;;
5060         esac
5061     fi
5062 else
5063     echo "Nope, it does not, but that is ok." 2>&1;
5064 fi
5065 '
5066
5067 : We will not override a previous value, but we might want to
5068 : augment a hint file
5069 case "$hint" in
5070 default|recommended)
5071         case "$gccversion" in
5072         1*) dflt="$dflt -fpcc-struct-return" ;;
5073         esac
5074         case "$optimize:$DEBUGGING" in
5075         *-g*:old) dflt="$dflt -DDEBUGGING";;
5076         esac
5077         case "$gccversion" in
5078         2*) if $test -d /etc/conf/kconfig.d &&
5079                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5080                 then
5081                         # Interactive Systems (ISC) POSIX mode.
5082                         dflt="$dflt -posix"
5083                 fi
5084                 ;;
5085         esac
5086         case "$gccversion" in
5087         1*) ;;
5088         2.[0-8]*) ;;
5089         ?*)     set strict-aliasing -fno-strict-aliasing
5090                 eval $checkccflag
5091                 ;;
5092         esac
5093         # For gcc, adding -pipe speeds up compilations for some, but apparently
5094         # some assemblers can't read from stdin.  (It also slows down compilations
5095         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5096         case "$gccversion" in
5097         ?*)     set pipe -pipe
5098                 eval $checkccflag
5099                 ;;
5100         esac
5101
5102         # on x86_64 (at least) we require an extra library (libssp) in the
5103         # link command line. This library is not named, so I infer that it is
5104         # an implementation detail that may change. Hence the safest approach
5105         # is to add the flag to the flags passed to the compiler at link time,
5106         # as that way the compiler can do the right implementation dependant
5107         # thing. (NWC)
5108         case "$gccversion" in
5109         ?*)     set stack-protector -fstack-protector
5110                 eval $checkccflag
5111                 ;;
5112         esac
5113         ;;
5114 esac
5115
5116 case "$mips_type" in
5117 *BSD*|'') inclwanted="$locincpth $usrinc";;
5118 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5119 esac
5120 for thisincl in $inclwanted; do
5121         if $test -d $thisincl; then
5122                 if $test x$thisincl != x$usrinc; then
5123                         case "$dflt" in
5124                         *" -I$thisincl "*);;
5125                         *) dflt="$dflt -I$thisincl ";;
5126                         esac
5127                 fi
5128         fi
5129 done
5130
5131 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5132         xxx=true;
5133 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5134         xxx=true;
5135 else
5136         xxx=false;
5137 fi;
5138 if $xxx; then
5139         case "$dflt" in
5140         *$2*);;
5141         *) dflt="$dflt -D$2";;
5142         esac;
5143 fi'
5144
5145 set signal.h LANGUAGE_C; eval $inctest
5146
5147 case "$usesocks" in
5148 $define)
5149         ccflags="$ccflags -DSOCKS"
5150         ;;
5151 esac
5152
5153 case "$hint" in
5154 default|recommended) dflt="$ccflags $dflt" ;;
5155 *) dflt="$ccflags";;
5156 esac
5157
5158 case "$dflt" in
5159 ''|' ') dflt=none;;
5160 esac
5161
5162 $cat <<EOH
5163
5164 Your C compiler may want other flags.  For this question you should include
5165 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5166 but you should NOT include libraries or ld flags like -lwhatever.  If you
5167 want $package to honor its debug switch, you should include -DDEBUGGING here.
5168 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5169
5170 To use no flags, specify the word "none".
5171
5172 EOH
5173 set X $dflt
5174 shift
5175 dflt=${1+"$@"}
5176 rp="Any additional cc flags?"
5177 . ./myread
5178 case "$ans" in
5179 none) ccflags='';;
5180 *) ccflags="$ans";;
5181 esac
5182
5183 : the following weeds options from ccflags that are of no interest to cpp
5184 case "$cppflags" in
5185 '') cppflags="$ccflags" ;;
5186 *)  cppflags="$cppflags $ccflags" ;;
5187 esac
5188 case "$gccversion" in
5189 1*) cppflags="$cppflags -D__GNUC__"
5190 esac
5191 case "$mips_type" in
5192 '');;
5193 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5194 esac
5195 case "$cppflags" in
5196 '');;
5197 *)
5198         echo " "
5199         echo "Let me guess what the preprocessor flags are..." >&4
5200         set X $cppflags
5201         shift
5202         cppflags=''
5203         $cat >cpp.c <<'EOM'
5204 #define BLURFL foo
5205
5206 BLURFL xx LFRULB
5207 EOM
5208         previous=''
5209         for flag in $*
5210         do
5211                 case "$flag" in
5212                 -*) ftry="$flag";;
5213                 *) ftry="$previous $flag";;
5214                 esac
5215                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5216                         >cpp1.out 2>/dev/null && \
5217                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5218                         >cpp2.out 2>/dev/null && \
5219                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5220                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5221                 then
5222                         cppflags="$cppflags $ftry"
5223                         previous=''
5224                 else
5225                         previous="$flag"
5226                 fi
5227         done
5228         set X $cppflags
5229         shift
5230         cppflags=${1+"$@"}
5231         case "$cppflags" in
5232         *-*)  echo "They appear to be: $cppflags";;
5233         esac
5234         $rm -f cpp.c cpp?.out
5235         ;;
5236 esac
5237
5238 : flags used in final linking phase
5239 case "$ldflags" in
5240 '') if ./venix; then
5241                 dflt='-i -z'
5242         else
5243                 dflt=''
5244         fi
5245         case "$ccflags" in
5246         *-posix*) dflt="$dflt -posix" ;;
5247         esac
5248         ;;
5249 *) dflt="$ldflags";;
5250 esac
5251 # See note above about -fstack-protector
5252 case "$ccflags" in
5253 *-fstack-protector*) 
5254         case "$dflt" in
5255         *-fstack-protector*) ;; # Don't add it again
5256         *) dflt="$dflt -fstack-protector" ;; 
5257         esac
5258         ;;
5259 esac
5260
5261 : Try to guess additional flags to pick up local libraries.
5262 for thislibdir in $libpth; do
5263         case " $loclibpth " in
5264         *" $thislibdir "*)
5265                 case "$dflt " in
5266                 *"-L$thislibdir "*) ;;
5267                 *)  dflt="$dflt -L$thislibdir" ;;
5268                 esac
5269                 ;;
5270         esac
5271 done
5272
5273 case "$dflt" in
5274 '') dflt='none' ;;
5275 esac
5276
5277 $cat <<EOH
5278
5279 Your C linker may need flags.  For this question you should
5280 include -L/whatever and any other flags used by the C linker, but you
5281 should NOT include libraries like -lwhatever.
5282
5283 Make sure you include the appropriate -L/path flags if your C linker
5284 does not normally search all of the directories you specified above,
5285 namely
5286         $libpth
5287 To use no flags, specify the word "none".
5288
5289 EOH
5290
5291 rp="Any additional ld flags (NOT including libraries)?"
5292 . ./myread
5293 case "$ans" in
5294 none) ldflags='';;
5295 *) ldflags="$ans";;
5296 esac
5297 rmlist="$rmlist pdp11"
5298
5299 : coherency check
5300 echo " "
5301 echo "Checking your choice of C compiler and flags for coherency..." >&4
5302 $cat > try.c <<'EOF'
5303 #include <stdio.h>
5304 int main() { printf("Ok\n"); return(0); }
5305 EOF
5306 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5307 shift
5308 $cat >try.msg <<'EOM'
5309 I've tried to compile and run the following simple program:
5310
5311 EOM
5312 $cat try.c >> try.msg
5313
5314 $cat >> try.msg <<EOM
5315
5316 I used the command:
5317
5318         $*
5319         $run ./try
5320
5321 and I got the following output:
5322
5323 EOM
5324 dflt=y
5325 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5326         if $sh -c "$run ./try " >>try.msg 2>&1; then
5327                 xxx=`$run ./try`
5328                 case "$xxx" in
5329                 "Ok") dflt=n ;;
5330                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5331                         case " $libs " in
5332                         *" -lsfio "*)
5333                                 cat >> try.msg <<'EOQS'
5334 If $libs contains -lsfio, and sfio is mis-configured, then it
5335 sometimes (apparently) runs and exits with a 0 status, but with no
5336 output!  It may have to do with sfio's use of _exit vs. exit.
5337
5338 EOQS
5339                                 rp="You have a big problem.  Shall I abort Configure"
5340                                 dflt=y
5341                                 ;;
5342                         esac
5343                         ;;
5344                 esac
5345         else
5346                 echo "The program compiled OK, but exited with status $?." >>try.msg
5347                 rp="You have a problem.  Shall I abort Configure"
5348                 dflt=y
5349         fi
5350 else
5351         echo "I can't compile the test program." >>try.msg
5352         rp="You have a BIG problem.  Shall I abort Configure"
5353         dflt=y
5354 fi
5355 case "$dflt" in
5356 y)
5357         $cat try.msg >&4
5358         case "$knowitall" in
5359         '')
5360                 echo "(The supplied flags or libraries might be incorrect.)"
5361                 ;;
5362         *) dflt=n;;
5363         esac
5364         echo " "
5365         . ./myread
5366         case "$ans" in
5367         n*|N*) ;;
5368         *)      echo "Ok.  Stopping Configure." >&4
5369                 exit 1
5370                 ;;
5371         esac
5372         ;;
5373 n) echo "OK, that should do.";;
5374 esac
5375 $rm_try gcctest gcctest.out
5376
5377 : define a shorthand compile call
5378 compile='
5379 mc_file=$1;
5380 shift;
5381 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5382 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5383 exit 1;
5384 fi;
5385 esac;
5386 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5387 : define a shorthand compile call for compilations that should be ok.
5388 compile_ok='
5389 mc_file=$1;
5390 shift;
5391 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5392
5393 : determine filename position in cpp output
5394 echo " "
5395 echo "Computing filename position in cpp output for #include directives..." >&4
5396 case "$osname" in
5397 vos) testaccess=-e ;;
5398 *)   testaccess=-r ;;
5399 esac
5400 echo '#include <stdio.h>' > foo.c
5401 $cat >fieldn <<EOF
5402 $startsh
5403 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5404 $grep '^[       ]*#.*stdio\.h' | \
5405 while read cline; do
5406         pos=1
5407         set \$cline
5408         while $test \$# -gt 0; do
5409                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5410                         echo "\$pos"
5411                         exit 0
5412                 fi
5413                 shift
5414                 pos=\`expr \$pos + 1\`
5415         done
5416 done
5417 EOF
5418 chmod +x fieldn
5419 fieldn=`./fieldn`
5420 $rm -f foo.c fieldn
5421 case $fieldn in
5422 '') pos='???';;
5423 1) pos=first;;
5424 2) pos=second;;
5425 3) pos=third;;
5426 *) pos="${fieldn}th";;
5427 esac
5428 echo "Your cpp writes the filename in the $pos field of the line."
5429
5430 case "$osname" in
5431 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5432 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5433 *)   cppfilter='' ;;
5434 esac
5435 : locate header file
5436 $cat >findhdr <<EOF
5437 $startsh
5438 wanted=\$1
5439 name=''
5440 for usrincdir in $usrinc
5441 do
5442         if test -f \$usrincdir/\$wanted; then
5443                 echo "\$usrincdir/\$wanted"
5444                 exit 0
5445         fi
5446 done
5447 awkprg='{ print \$$fieldn }'
5448 echo "#include <\$wanted>" > foo\$\$.c
5449 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5450 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5451 while read cline; do
5452         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5453         case "\$name" in
5454         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5455         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5456         *) exit 2;;
5457         esac;
5458 done;
5459 #
5460 # status = 0: grep returned 0 lines, case statement not executed
5461 # status = 1: headerfile found
5462 # status = 2: while loop executed, no headerfile found
5463 #
5464 status=\$?
5465 $rm -f foo\$\$.c;
5466 if test \$status -eq 1; then
5467         exit 0;
5468 fi
5469 exit 1
5470 EOF
5471 chmod +x findhdr
5472
5473 : define an alternate in-header-list? function
5474 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5475 cont=true; xxf="echo \"<\$1> found.\" >&4";
5476 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5477 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5478 esac;
5479 case $# in 4) instead=instead;; *) instead="at last";; esac;
5480 while $test "$cont"; do
5481         xxx=`./findhdr $1`
5482         var=$2; eval "was=\$$2";
5483         if $test "$xxx" && $test -r "$xxx";
5484         then eval $xxf;
5485         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5486                 cont="";
5487         else eval $xxnf;
5488         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5489         set $yyy; shift; shift; yyy=$@;
5490         case $# in 0) cont="";;
5491         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5492                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5493         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5494                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5495         esac;
5496 done;
5497 while $test "$yyy";
5498 do set $yyy; var=$2; eval "was=\$$2";
5499         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5500         set $yyy; shift; shift; yyy=$@;
5501 done'
5502
5503 : see if stdlib is available
5504 set stdlib.h i_stdlib
5505 eval $inhdr
5506
5507 : check for lengths of integral types
5508 echo " "
5509 case "$intsize" in
5510 '')
5511         echo "Checking to see how big your integers are..." >&4
5512         $cat >try.c <<EOCP
5513 #include <stdio.h>
5514 #$i_stdlib I_STDLIB
5515 #ifdef I_STDLIB
5516 #include <stdlib.h>
5517 #endif
5518 int main()
5519 {
5520         printf("intsize=%d;\n", (int)sizeof(int));
5521         printf("longsize=%d;\n", (int)sizeof(long));
5522         printf("shortsize=%d;\n", (int)sizeof(short));
5523         exit(0);
5524 }
5525 EOCP
5526         set try
5527         if eval $compile_ok && $run ./try > /dev/null; then
5528                 eval `$run ./try`
5529                 echo "Your integers are $intsize bytes long."
5530                 echo "Your long integers are $longsize bytes long."
5531                 echo "Your short integers are $shortsize bytes long."
5532         else
5533                 $cat >&4 <<EOM
5534 !
5535 Help! I can't compile and run the intsize test program: please enlighten me!
5536 (This is probably a misconfiguration in your system or libraries, and
5537 you really ought to fix it.  Still, I'll try anyway.)
5538 !
5539 EOM
5540                 dflt=4
5541                 rp="What is the size of an integer (in bytes)?"
5542                 . ./myread
5543                 intsize="$ans"
5544                 dflt=$intsize
5545                 rp="What is the size of a long integer (in bytes)?"
5546                 . ./myread
5547                 longsize="$ans"
5548                 dflt=2
5549                 rp="What is the size of a short integer (in bytes)?"
5550                 . ./myread
5551                 shortsize="$ans"
5552         fi
5553         ;;
5554 esac
5555 $rm_try
5556
5557 : check for long long
5558 echo " "
5559 echo "Checking to see if you have long long..." >&4
5560 echo 'int main() { long long x = 7; return 0; }' > try.c
5561 set try
5562 if eval $compile; then
5563         val="$define"
5564         echo "You have long long."
5565 else
5566         val="$undef"
5567         echo "You do not have long long."
5568 fi
5569 $rm_try
5570 set d_longlong
5571 eval $setvar
5572
5573 : check for length of long long
5574 case "${d_longlong}${longlongsize}" in
5575 $define)
5576         echo " "
5577         echo "Checking to see how big your long longs are..." >&4
5578         $cat >try.c <<'EOCP'
5579 #include <stdio.h>
5580 int main()
5581 {
5582     printf("%d\n", (int)sizeof(long long));
5583     return(0);
5584 }
5585 EOCP
5586         set try
5587         if eval $compile_ok; then
5588                 longlongsize=`$run ./try`
5589                 echo "Your long longs are $longlongsize bytes long."
5590         else
5591                 dflt='8'
5592                 echo " "
5593                 echo "(I can't seem to compile the test program.  Guessing...)"
5594                 rp="What is the size of a long long (in bytes)?"
5595                 . ./myread
5596                 longlongsize="$ans"
5597         fi
5598         if $test "X$longsize" = "X$longlongsize"; then
5599                 echo "(That isn't any different from an ordinary long.)"
5600         fi
5601         ;;
5602 esac
5603 $rm_try
5604
5605 : see if inttypes.h is available
5606 : we want a real compile instead of Inhdr because some systems
5607 : have an inttypes.h which includes non-existent headers
5608 echo " "
5609 $cat >try.c <<EOCP
5610 #include <inttypes.h>
5611 int main() {
5612         static int32_t foo32 = 0x12345678;
5613 }
5614 EOCP
5615 set try
5616 if eval $compile; then
5617         echo "<inttypes.h> found." >&4
5618         val="$define"
5619 else
5620         echo "<inttypes.h> NOT found." >&4
5621         val="$undef"
5622 fi
5623 $rm_try
5624 set i_inttypes
5625 eval $setvar
5626
5627 : check for int64_t
5628 echo " "
5629 echo "Checking to see if you have int64_t..." >&4
5630 $cat >try.c <<EOCP
5631 #include <sys/types.h>
5632 #$i_inttypes I_INTTYPES
5633 #ifdef I_INTTYPES
5634 #include <inttypes.h>
5635 #endif
5636 int main() { int64_t x = 7; }
5637 EOCP
5638 set try
5639 if eval $compile; then
5640         val="$define"
5641         echo "You have int64_t."
5642 else
5643         val="$undef"
5644         echo "You do not have int64_t."
5645 fi
5646 $rm_try
5647 set d_int64_t
5648 eval $setvar
5649
5650 : Check if 64bit ints have a quad type
5651 echo " "
5652 echo "Checking which 64-bit integer type we could use..." >&4
5653
5654 case "$intsize" in
5655 8) val=int
5656    set quadtype
5657    eval $setvar
5658    val='"unsigned int"'
5659    set uquadtype
5660    eval $setvar
5661    quadkind=1
5662    ;;
5663 *) case "$longsize" in
5664    8) val=long
5665       set quadtype
5666       eval $setvar
5667       val='"unsigned long"'
5668       set uquadtype
5669       eval $setvar
5670       quadkind=2
5671       ;;
5672    *) case "$d_longlong:$longlongsize" in
5673       define:8)
5674         val='"long long"'
5675         set quadtype
5676         eval $setvar
5677         val='"unsigned long long"'
5678         set uquadtype
5679         eval $setvar
5680         quadkind=3
5681         ;;
5682       *) case "$d_int64_t" in
5683          define)
5684            val=int64_t
5685            set quadtype
5686            eval $setvar
5687            val=uint64_t
5688            set uquadtype
5689            eval $setvar
5690            quadkind=4
5691            ;;
5692          esac
5693          ;;
5694       esac
5695       ;;
5696    esac
5697    ;;
5698 esac
5699
5700 case "$quadtype" in
5701 '')     echo "Alas, no 64-bit integer types in sight." >&4
5702         d_quad="$undef"
5703         ;;
5704 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5705         d_quad="$define"
5706         ;;
5707 esac
5708
5709 : Do we want 64bit support
5710 case "$uselonglong" in
5711 "$define"|true|[yY]*)
5712         cat <<EOM >&4
5713
5714 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5715 EOM
5716         use64bitint="$define"
5717         ;;
5718 esac
5719 case "$use64bits" in
5720 "$define"|true|[yY]*)
5721         cat <<EOM >&4
5722
5723 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5724 EOM
5725         use64bitint="$define"
5726         ;;
5727 esac
5728 case "$use64bitints" in
5729 "$define"|true|[yY]*)
5730         cat <<EOM >&4
5731
5732 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5733 EOM
5734         use64bitint="$define"
5735         ;;
5736 esac
5737 case "$use64bitsint" in
5738 "$define"|true|[yY]*)
5739         cat <<EOM >&4
5740
5741 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5742 EOM
5743         use64bitint="$define"
5744         ;;
5745 esac
5746 case "$uselonglongs" in
5747 "$define"|true|[yY]*)
5748         cat <<EOM >&4
5749
5750 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5751 EOM
5752         use64bitint="$define"
5753         ;;
5754 esac
5755 case "$use64bitsall" in
5756 "$define"|true|[yY]*)
5757         cat <<EOM >&4
5758
5759 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5760 EOM
5761         use64bitall="$define"
5762         ;;
5763 esac
5764
5765 case "$ccflags" in
5766 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5767 esac
5768 case "$use64bitall" in
5769 "$define"|true|[yY]*) use64bitint="$define" ;;
5770 esac
5771
5772 case "$longsize" in
5773 8) cat <<EOM
5774
5775 You have natively 64-bit long integers.
5776 EOM
5777    val="$define"
5778    ;;
5779 *) case "$use64bitint" in
5780    "$define"|true|[yY]*) dflt='y';;
5781    *) dflt='n';;
5782    esac
5783    case "$d_quad" in
5784    "$define") ;;
5785    *) dflt='n' ;;
5786    esac
5787    cat <<EOM
5788
5789 Perl can be built to take advantage of 64-bit integer types
5790 on some systems.  To do so, Configure can be run with -Duse64bitint.
5791 Choosing this option will most probably introduce binary incompatibilities.
5792
5793 If this doesn't make any sense to you, just accept the default '$dflt'.
5794 (The default has been chosen based on your configuration.)
5795 EOM
5796    rp='Try to use 64-bit integers, if available?'
5797    . ./myread
5798    case "$ans" in
5799    [yY]*) val="$define" ;;
5800    *)     val="$undef"  ;;
5801    esac
5802    ;;
5803 esac
5804 set use64bitint
5805 eval $setvar
5806
5807 case "$use64bitall" in
5808 "$define"|true|[yY]*) dflt='y' ;;
5809 *) case "$longsize" in
5810    8) dflt='y' ;;
5811    *) dflt='n' ;;
5812    esac
5813    ;;
5814 esac
5815 cat <<EOM
5816
5817 You may also choose to try maximal 64-bitness.  It means using as much
5818 64-bitness as possible on the platform.  This in turn means even more
5819 binary incompatibilities.  On the other hand, your platform may not
5820 have any more 64-bitness available than what you already have chosen.
5821
5822 If this doesn't make any sense to you, just accept the default '$dflt'.
5823 (The default has been chosen based on your configuration.)
5824 EOM
5825 rp='Try to use maximal 64-bit support, if available?'
5826 . ./myread
5827 case "$ans" in
5828 [yY]*) val="$define" ;;
5829 *)     val="$undef"  ;;
5830 esac
5831 set use64bitall
5832 eval $setvar
5833 case "$use64bitall" in
5834 "$define")
5835         case "$use64bitint" in
5836         "$undef")
5837                 cat <<EOM
5838
5839 Since you have chosen a maximally 64-bit build, I'm also turning on
5840 the use of 64-bit integers.
5841 EOM
5842                 use64bitint="$define" ;;
5843         esac
5844         ;;
5845 esac
5846
5847 : Look for a hint-file generated 'call-back-unit'.  If the
5848 : user has specified that a 64-bit perl is to be built,
5849 : we may need to set or change some other defaults.
5850 if $test -f use64bitint.cbu; then
5851         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5852         . ./use64bitint.cbu
5853 fi
5854 case "$use64bitint" in
5855 "$define"|true|[yY]*)
5856         case "$longsize" in
5857         4) case "$archname64" in
5858            '') archname64=64int ;;
5859            esac
5860            ;;
5861         esac
5862         ;;
5863 esac
5864
5865 : Look for a hint-file generated 'call-back-unit'.  If the
5866 : user has specified that a maximally 64-bit perl is to be built,
5867 : we may need to set or change some other defaults.
5868 if $test -f use64bitall.cbu; then
5869         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5870         . ./use64bitall.cbu
5871 fi
5872 case "$use64bitall" in
5873 "$define"|true|[yY]*)
5874         case "$longsize" in
5875         4) case "$archname64" in
5876            ''|64int) archname64=64all ;;
5877            esac
5878            ;;
5879         esac
5880         ;;
5881 esac
5882
5883 case "$d_quad:$use64bitint" in
5884 $undef:$define)
5885         cat >&4 <<EOF
5886
5887 *** You have chosen to use 64-bit integers,
5888 *** but none can be found.
5889 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5890 *** Cannot continue, aborting.
5891
5892 EOF
5893         exit 1
5894         ;;
5895 esac
5896
5897 : check for length of double
5898 echo " "
5899 case "$doublesize" in
5900 '')
5901         echo "Checking to see how big your double precision numbers are..." >&4
5902         $cat >try.c <<EOCP
5903 #include <stdio.h>
5904 #$i_stdlib I_STDLIB
5905 #ifdef I_STDLIB
5906 #include <stdlib.h>
5907 #endif
5908 int main()
5909 {
5910     printf("%d\n", (int)sizeof(double));
5911     exit(0);
5912 }
5913 EOCP
5914         set try
5915         if eval $compile_ok; then
5916                 doublesize=`$run ./try`
5917                 echo "Your double is $doublesize bytes long."
5918         else
5919                 dflt='8'
5920                 echo "(I can't seem to compile the test program.  Guessing...)"
5921                 rp="What is the size of a double precision number (in bytes)?"
5922                 . ./myread
5923                 doublesize="$ans"
5924         fi
5925         ;;
5926 esac
5927 $rm_try
5928
5929 : check for long doubles
5930 echo " "
5931 echo "Checking to see if you have long double..." >&4
5932 echo 'int main() { long double x = 7.0; }' > try.c
5933 set try
5934 if eval $compile; then
5935         val="$define"
5936         echo "You have long double."
5937 else
5938         val="$undef"
5939         echo "You do not have long double."
5940 fi
5941 $rm_try
5942 set d_longdbl
5943 eval $setvar
5944
5945 : check for length of long double
5946 case "${d_longdbl}${longdblsize}" in
5947 $define)
5948         echo " "
5949         echo "Checking to see how big your long doubles are..." >&4
5950         $cat >try.c <<'EOCP'
5951 #include <stdio.h>
5952 int main()
5953 {
5954         printf("%d\n", sizeof(long double));
5955 }
5956 EOCP
5957         set try
5958         set try
5959         if eval $compile; then
5960                 longdblsize=`$run ./try`
5961                 echo "Your long doubles are $longdblsize bytes long."
5962         else
5963                 dflt='8'
5964                 echo " "
5965                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5966                 rp="What is the size of a long double (in bytes)?"
5967                 . ./myread
5968                 longdblsize="$ans"
5969         fi
5970         if $test "X$doublesize" = "X$longdblsize"; then
5971                 echo "That isn't any different from an ordinary double."
5972                 echo "I'll keep your setting anyway, but you may see some"
5973                 echo "harmless compilation warnings."
5974         fi
5975         ;;
5976 esac
5977 $rm_try
5978
5979 : determine the architecture name
5980 echo " "
5981 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5982         tarch=`arch`"-$osname"
5983 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5984         if uname -m > tmparch 2>&1 ; then
5985                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5986                         -e 's/$/'"-$osname/" tmparch`
5987         else
5988                 tarch="$osname"
5989         fi
5990         $rm -f tmparch
5991 else
5992         tarch="$osname"
5993 fi
5994 case "$myarchname" in
5995 ''|"$tarch") ;;
5996 *)
5997         echo "(Your architecture name used to be $myarchname.)"
5998         archname=''
5999         ;;
6000 esac
6001 case "$targetarch" in
6002 '') ;;
6003 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6004 esac
6005 myarchname="$tarch"
6006 case "$archname" in
6007 '') dflt="$tarch";;
6008 *) dflt="$archname";;
6009 esac
6010 rp='What is your architecture name'
6011 . ./myread
6012 archname="$ans"
6013 case "$usethreads" in
6014 $define)
6015         echo "Threads selected." >&4
6016         case "$archname" in
6017         *-thread*) echo "...and architecture name already has -thread." >&4
6018                 ;;
6019         *)      archname="$archname-thread"
6020                 echo "...setting architecture name to $archname." >&4
6021                 ;;
6022         esac
6023         ;;
6024 esac
6025 case "$usemultiplicity" in
6026 $define)
6027         echo "Multiplicity selected." >&4
6028         case "$archname" in
6029         *-multi*) echo "...and architecture name already has -multi." >&4
6030                 ;;
6031         *)      archname="$archname-multi"
6032                 echo "...setting architecture name to $archname." >&4
6033                 ;;
6034         esac
6035         ;;
6036 esac
6037 case "$use64bitint$use64bitall" in
6038 *"$define"*)
6039         case "$archname64" in
6040         '')
6041                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6042                 ;;
6043         *)
6044                 case "$use64bitint" in
6045                 "$define") echo "64 bit integers selected." >&4 ;;
6046                 esac
6047                 case "$use64bitall" in
6048                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6049                 esac
6050                 case "$archname" in
6051                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6052                         ;;
6053                 *)      archname="$archname-$archname64"
6054                         echo "...setting architecture name to $archname." >&4
6055                         ;;
6056                 esac
6057                 ;;
6058         esac
6059 esac
6060 case "$uselongdouble" in
6061 $define)
6062         echo "Long doubles selected." >&4
6063         case "$longdblsize" in
6064         $doublesize)
6065                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6066                 ;;
6067         *)
6068                 case "$archname" in
6069                 *-ld*) echo "...and architecture name already has -ld." >&4
6070                         ;;
6071                 *)      archname="$archname-ld"
6072                         echo "...setting architecture name to $archname." >&4
6073                         ;;
6074                 esac
6075                 ;;
6076         esac
6077         ;;
6078 esac
6079 if $test -f archname.cbu; then
6080         echo "Your platform has some specific hints for architecture name, using them..."
6081         . ./archname.cbu
6082 fi
6083
6084 : set the prefixit variable, to compute a suitable default value
6085 prefixit='case "$3" in
6086 ""|none)
6087         case "$oldprefix" in
6088         "") eval "$1=\"\$$2\"";;
6089         *)
6090                 case "$3" in
6091                 "") eval "$1=";;
6092                 none)
6093                         eval "tp=\"\$$2\"";
6094                         case "$tp" in
6095                         ""|" ") eval "$1=\"\$$2\"";;
6096                         *) eval "$1=";;
6097                         esac;;
6098                 esac;;
6099         esac;;
6100 *)
6101         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6102         case "$tp" in
6103         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6104         /*-$oldprefix/*|\~*-$oldprefix/*)
6105                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6106         *) eval "$1=\"\$$2\"";;
6107         esac;;
6108 esac'
6109
6110 : determine installation style
6111 : For now, try to deduce it from prefix unless it is already set.
6112 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6113 case "$installstyle" in
6114 '')     case "$prefix" in
6115                 *perl*) dflt='lib';;
6116                 *) dflt='lib/perl5' ;;
6117         esac
6118         ;;
6119 *)      dflt="$installstyle" ;;
6120 esac
6121 : Probably not worth prompting for this since we prompt for all
6122 : the directories individually, and the prompt would be too long and
6123 : confusing anyway.
6124 installstyle=$dflt
6125
6126 : determine where public executables go
6127 echo " "
6128 set dflt bin bin
6129 eval $prefixit
6130 fn=d~
6131 rp='Pathname where the public executables will reside?'
6132 . ./getfile
6133 if $test "X$ansexp" != "X$binexp"; then
6134         installbin=''
6135 fi
6136 prefixvar=bin
6137 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6138 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6139 :     this via initialinstalllocation
6140 . ./setprefixvar
6141
6142 case "$userelocatableinc" in
6143 $define|true|[yY]*)     dflt='y' ;;
6144 *)                      dflt='n' ;;
6145 esac
6146 cat <<EOM
6147
6148 Would you like to build Perl so that the installation is relocatable, so that
6149 library paths in @INC are determined relative to the path of the perl binary?
6150 This is not advised for system Perl installs, or if you need to run setid
6151 scripts or scripts under taint mode.
6152
6153 If this doesn't make any sense to you, just accept the default '$dflt'.
6154 EOM
6155 rp='Use relocatable @INC?'
6156 . ./myread
6157 case "$ans" in
6158 y|Y)    val="$define" ;;
6159 *)      val="$undef"  ;;
6160 esac
6161 set userelocatableinc
6162 eval $setvar
6163
6164 initialinstalllocation="$binexp"
6165 : Default prefix is now "up one level from where the binaries are"
6166 case "$userelocatableinc" in
6167 $define|true|[yY]*)
6168     bin=".../"
6169     binexp=".../"
6170     prefix=".../.."
6171     prefixexp=".../.."
6172     installprefixexp=".../.."
6173     ;;
6174 esac
6175
6176 : determine where private library files go
6177 : Usual default is /usr/local/lib/perl5/$version.
6178 : Also allow things like /opt/perl/lib/$version, since
6179 : /opt/perl/lib/perl5... would be redundant.
6180 : The default "style" setting is made in installstyle.U
6181 case "$installstyle" in
6182 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6183 *)       set dflt privlib lib/$version ;;
6184 esac
6185 eval $prefixit
6186 $cat <<EOM
6187
6188 There are some auxiliary files for $package that need to be put into a
6189 private library directory that is accessible by everyone.
6190
6191 EOM
6192 fn=$binexp
6193 fn=d~+
6194 rp='Pathname where the private library files will reside?'
6195 . ./getfile
6196 prefixvar=privlib
6197 . ./setprefixvar
6198
6199 : set the prefixup variable, to restore leading tilda escape
6200 prefixup='case "$prefixexp" in
6201 "$prefix") ;;
6202 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6203 esac'
6204
6205 : determine where public architecture dependent libraries go
6206 set archlib archlib
6207 eval $prefixit
6208 : privlib default is /usr/local/lib/$package/$version
6209 : archlib default is /usr/local/lib/$package/$version/$archname
6210 : privlib may have an optional trailing /share.
6211 tdflt=`echo $privlib | $sed 's,/share$,,'`
6212 tdflt=$tdflt/$archname
6213 case "$archlib" in
6214 '')     dflt=$tdflt
6215         ;;
6216 *)      dflt="$archlib"
6217     ;;
6218 esac
6219 $cat <<EOM
6220
6221 $spackage contains architecture-dependent library files.  If you are
6222 sharing libraries in a heterogeneous environment, you might store
6223 these files in a separate location.  Otherwise, you can just include
6224 them with the rest of the public library files.
6225
6226 EOM
6227 fn=$binexp
6228 fn=d+~
6229 rp='Where do you want to put the public architecture-dependent libraries?'
6230 . ./getfile
6231 prefixvar=archlib
6232 . ./setprefixvar
6233 if $test X"$archlib" = X"$privlib"; then
6234         d_archlib="$undef"
6235 else
6236         d_archlib="$define"
6237 fi
6238
6239 : see if setuid scripts can be secure
6240 $cat <<EOM
6241
6242 Some kernels have a bug that prevents setuid #! scripts from being
6243 secure.  Some sites have disabled setuid #! scripts because of this.
6244
6245 First let's decide if your kernel supports secure setuid #! scripts.
6246 (If setuid #! scripts would be secure but have been disabled anyway,
6247 don't say that they are secure if asked.)
6248
6249 EOM
6250
6251 val="$undef"
6252 if $test -d /dev/fd; then
6253         echo "#!$ls" >reflect
6254         chmod +x,u+s reflect
6255         ./reflect >flect 2>&1
6256         if $contains "/dev/fd" flect >/dev/null; then
6257                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6258                 val="$define"
6259         else
6260                 $cat <<EOM
6261 If you are not sure if they are secure, I can check but I'll need a
6262 username and password different from the one you are using right now.
6263 If you don't have such a username or don't want me to test, simply
6264 enter 'none'.
6265
6266 EOM
6267                 rp='Other username to test security of setuid scripts with?'
6268                 dflt='none'
6269                 . ./myread
6270                 case "$ans" in
6271                 n|none)
6272                         case "$d_suidsafe" in
6273                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6274                                 dflt=n;;
6275                         "$undef")
6276                                 echo "Well, the $hint value is *not* secure." >&4
6277                                 dflt=n;;
6278                         *)      echo "Well, the $hint value *is* secure." >&4
6279                                 dflt=y;;
6280                         esac
6281                         ;;
6282                 *)
6283                         $rm -f reflect flect
6284                         echo "#!$ls" >reflect
6285                         chmod +x,u+s reflect
6286                         echo >flect
6287                         chmod a+w flect
6288                         echo '"su" will (probably) prompt you for '"$ans's password."
6289                         su $ans -c './reflect >flect'
6290                         if $contains "/dev/fd" flect >/dev/null; then
6291                                 echo "Okay, it looks like setuid scripts are secure." >&4
6292                                 dflt=y
6293                         else
6294                                 echo "I don't think setuid scripts are secure." >&4
6295                                 dflt=n
6296                         fi
6297                         ;;
6298                 esac
6299                 rp='Does your kernel have *secure* setuid scripts?'
6300                 . ./myread
6301                 case "$ans" in
6302                 [yY]*)  val="$define";;
6303                 *)      val="$undef";;
6304                 esac
6305         fi
6306 else
6307         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6308         echo "(That's for file descriptors, not floppy disks.)"
6309         val="$undef"
6310 fi
6311 set d_suidsafe
6312 eval $setvar
6313
6314 $rm -f reflect flect
6315
6316 : now see if they want to do setuid emulation
6317 if $test $patchlevel -lt 11; then
6318 echo " "
6319 val="$undef"
6320 case "$d_suidsafe" in
6321 "$define")
6322         val="$undef"
6323         echo "No need to emulate SUID scripts since they are secure here." >&4
6324         ;;
6325 *)
6326         $cat <<EOM
6327 Some systems have disabled setuid scripts, especially systems where
6328 setuid scripts cannot be secure.  On systems where setuid scripts have
6329 been disabled, the setuid/setgid bits on scripts are currently
6330 useless.  It is possible for $package to detect those bits and emulate
6331 setuid/setgid in a secure fashion.  This emulation will only work if
6332 setuid scripts have been disabled in your kernel.
6333
6334 EOM
6335         case "$d_dosuid" in
6336         "$define") dflt=y ;;
6337         *) dflt=n ;;
6338         esac
6339         rp="Do you want to do setuid/setgid emulation?"
6340         . ./myread
6341         case "$ans" in
6342         [yY]*)  val="$define";;
6343         *)      val="$undef";;
6344         esac
6345         ;;
6346 esac
6347 set d_dosuid
6348 eval $setvar
6349 else
6350     case "$d_dosuid" in
6351         "$define")
6352         cat >&4 <<EOH
6353
6354 SUID emulation has been removed for 5.12
6355 Please re-run Configure without -Dd_dosuid
6356
6357 EOH
6358         exit 1;
6359         ;;
6360     esac
6361     d_dosuid=undef
6362 fi
6363
6364 : Find perl5.005 or later.
6365 echo "Looking for a previously installed perl5.005 or later... "
6366 case "$perl5" in
6367 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6368                 : Check if this perl is recent and can load a simple module
6369                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6370                         perl5=$tdir/perl
6371                         break;
6372                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6373                         perl5=$tdir/perl5
6374                         break;
6375                 fi
6376         done
6377         ;;
6378 *)      perl5="$perl5"
6379         ;;
6380 esac
6381 case "$perl5" in
6382 '')     echo "None found.  That's ok.";;
6383 *)      echo "Using $perl5." ;;
6384 esac
6385
6386 : Set the siteprefix variables
6387 $cat <<EOM
6388
6389 After $package is installed, you may wish to install various
6390 add-on modules and utilities.  Typically, these add-ons will
6391 be installed under $prefix with the rest
6392 of this package.  However, you may wish to install such add-ons
6393 elsewhere under a different prefix.
6394
6395 If you do not wish to put everything under a single prefix, that's
6396 ok.  You will be prompted for the individual locations; this siteprefix
6397 is only used to suggest the defaults.
6398
6399 The default should be fine for most people.
6400
6401 EOM
6402 fn=d~+
6403 rp='Installation prefix to use for add-on modules and utilities?'
6404 : XXX Here might be another good place for an installstyle setting.
6405 case "$siteprefix" in
6406 '') dflt=$prefix ;;
6407 *)  dflt=$siteprefix ;;
6408 esac
6409 . ./getfile
6410 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6411 oldsiteprefix=''
6412 case "$siteprefix" in
6413 '') ;;
6414 *)      case "$ans" in
6415         "$prefix") ;;
6416         *) oldsiteprefix="$prefix";;
6417         esac
6418         ;;
6419 esac
6420 siteprefix="$ans"
6421 siteprefixexp="$ansexp"
6422
6423 : determine where site specific libraries go.
6424 : Usual default is /usr/local/lib/perl5/site_perl/$version
6425 : The default "style" setting is made in installstyle.U
6426 : XXX No longer works with Prefixit stuff.
6427 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6428 case "$sitelib" in
6429 '') case "$installstyle" in
6430         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6431         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6432         esac
6433         ;;
6434 *)      dflt="$sitelib"
6435         ;;
6436 esac
6437 $cat <<EOM
6438
6439 The installation process will create a directory for
6440 site-specific extensions and modules.  Most users find it convenient
6441 to place all site-specific files in this directory rather than in the
6442 main distribution directory.
6443
6444 EOM
6445 fn=d~+
6446 rp='Pathname for the site-specific library files?'
6447 . ./getfile
6448 prefixvar=sitelib
6449 . ./setprefixvar
6450 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6451
6452 : Determine list of previous versions to include in @INC
6453 $cat > getverlist <<EOPL
6454 #!$perl5 -w
6455 use File::Basename;
6456 \$api_versionstring = "$api_versionstring";
6457 \$version = "$version";
6458 \$stem = "$sitelib_stem";
6459 \$archname = "$archname";
6460 EOPL
6461         $cat >> getverlist <<'EOPL'
6462 # The list found is store twice for each entry: the original name, and
6463 # the binary broken down version as pack "sss", so sorting is easy and
6464 # unambiguous. This will work for all versions that have a maximum of
6465 # three digit groups, separate by '.'s or '_'s. Names are extended with
6466 # ".0.0" to ensure at least three elements for the pack.
6467 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6468
6469 # Can't have leading @ because metaconfig interprets it as a command!
6470 ;@inc_version_list=();
6471 # XXX Redo to do opendir/readdir?
6472 if (-d $stem) {
6473     chdir($stem);
6474     ;@candidates = map {
6475         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6476     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6477 }
6478 else {
6479     ;@candidates = ();
6480 }
6481
6482 ($pversion, $aversion, $vsn5005) = map {
6483     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6484 foreach $d (@candidates) {
6485     if ($d->[1] lt $pversion) {
6486         if ($d->[1] ge $aversion) {
6487             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6488         }
6489         elsif ($d->[1] ge $vsn5005) {
6490             unshift(@inc_version_list, grep { -d } $d->[0]);
6491         }
6492     }
6493     else {
6494         # Skip newer version.  I.e. don't look in
6495         # 5.7.0 if we're installing 5.6.1.
6496     }
6497 }
6498
6499 if (@inc_version_list) {
6500     print join(' ', @inc_version_list);
6501 }
6502 else {
6503     # Blank space to preserve value for next Configure run.
6504     print " ";
6505 }
6506 EOPL
6507 chmod +x getverlist
6508 case "$inc_version_list" in
6509 '')     if test -x "$perl5$exe_ext"; then
6510                 dflt=`$perl5 getverlist`
6511         else
6512                 dflt='none'
6513         fi
6514         ;;
6515 $undef) dflt='none' ;;
6516 *)  eval dflt=\"$inc_version_list\" ;;
6517 esac
6518 case "$dflt" in
6519 ''|' ') dflt=none ;;
6520 esac
6521 case "$dflt" in
6522 5.005) dflt=none ;;
6523 esac
6524 $cat <<EOM
6525
6526 In order to ease the process of upgrading, this version of perl
6527 can be configured to use modules built and installed with earlier
6528 versions of perl that were installed under $prefix.  Specify here
6529 the list of earlier versions that this version of perl should check.
6530 If Configure detected no earlier versions of perl installed under
6531 $prefix, then the list will be empty.  Answer 'none' to tell perl
6532 to not search earlier versions.
6533
6534 The default should almost always be sensible, so if you're not sure,
6535 just accept the default.
6536 EOM
6537
6538 rp='List of earlier versions to include in @INC?'
6539 . ./myread
6540 case "$ans" in
6541 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6542 *) inc_version_list="$ans" ;;
6543 esac
6544 case "$inc_version_list" in
6545 ''|' ')
6546         inc_version_list_init='0'
6547         d_inc_version_list="$undef"
6548         ;;
6549 *)      inc_version_list_init=`echo $inc_version_list |
6550                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6551         d_inc_version_list="$define"
6552         ;;
6553 esac
6554 $rm -f getverlist
6555
6556 : see if malloc/malloc.h has to be included
6557 set malloc/malloc.h i_mallocmalloc
6558 eval $inhdr
6559
6560 : see if this is a malloc.h system
6561 : we want a real compile instead of Inhdr because some systems have a
6562 : malloc.h that just gives a compile error saying to use stdlib.h instead
6563 echo " "
6564 $cat >try.c <<EOCP
6565 #include <stdlib.h>
6566 #include <malloc.h>
6567 #$i_mallocmalloc I_MALLOCMALLOC
6568 #ifdef I_MALLOCMALLOC
6569 # include <malloc/malloc.h>
6570 #endif
6571
6572 int main () { return 0; }
6573 EOCP
6574 set try
6575 if eval $compile; then
6576     echo "<malloc.h> found." >&4
6577     val="$define"
6578 else
6579     echo "<malloc.h> NOT found." >&4
6580     val="$undef"
6581 fi
6582 $rm_try
6583 set i_malloc
6584 eval $setvar
6585
6586 : check for void type
6587 echo " "
6588 echo "Checking to see how well your C compiler groks the void type..." >&4
6589 case "$voidflags" in
6590 '')
6591         $cat >try.c <<EOCP
6592 #$i_stdlib I_STDLIB
6593 #ifdef I_STDLIB
6594 #include <stdlib.h>
6595 #endif
6596 #if TRY & 1
6597 void sub() {
6598 #else
6599 sub() {
6600 #endif
6601         extern void moo();      /* function returning void */
6602         void (*goo)();          /* ptr to func returning void */
6603 #if TRY & 8
6604         void *hue;              /* generic ptr */
6605 #endif
6606 #if TRY & 2
6607         void (*foo[10])();
6608 #endif
6609
6610 #if TRY & 4
6611         if(goo == moo) {
6612                 exit(0);
6613         }
6614 #endif
6615         exit(0);
6616 }
6617 int main() { sub(); }
6618 EOCP
6619         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6620                 voidflags=$defvoidused
6621         echo "Good.  It appears to support void to the level $package wants.">&4
6622                 if $contains warning .out >/dev/null 2>&1; then
6623                         echo "However, you might get some warnings that look like this:"
6624                         $cat .out
6625                 fi
6626         else
6627 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6628                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6629                         echo "It supports 1..."
6630                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6631                                 echo "It also supports 2..."
6632                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6633                                         voidflags=7
6634                                         echo "And it supports 4 but not 8 definitely."
6635                                 else
6636                                         echo "It doesn't support 4..."
6637                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6638                                                 voidflags=11
6639                                                 echo "But it supports 8."
6640                                         else
6641                                                 voidflags=3
6642                                                 echo "Neither does it support 8."
6643                                         fi
6644                                 fi
6645                         else
6646                                 echo "It does not support 2..."
6647                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6648                                         voidflags=13
6649                                         echo "But it supports 4 and 8."
6650                                 else
6651                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6652                                                 voidflags=5
6653                                                 echo "And it supports 4 but has not heard about 8."
6654                                         else
6655                                                 echo "However it supports 8 but not 4."
6656                                         fi
6657                                 fi
6658                         fi
6659                 else
6660                         echo "There is no support at all for void."
6661                         voidflags=0
6662                 fi
6663         fi
6664 esac
6665 case "$voidflags" in
6666 "$defvoidused") ;;
6667 *)      $cat >&4 <<'EOM'
6668   Support flag bits are:
6669     1: basic void declarations.
6670     2: arrays of pointers to functions returning void.
6671     4: operations between pointers to and addresses of void functions.
6672     8: generic void pointers.
6673 EOM
6674         dflt="$voidflags";
6675         rp="Your void support flags add up to what?"
6676         . ./myread
6677         voidflags="$ans"
6678         ;;
6679 esac
6680 $rm_try
6681
6682 : check for length of pointer
6683 echo " "
6684 case "$ptrsize" in
6685 '')
6686         echo "Checking to see how big your pointers are..." >&4
6687         if test "$voidflags" -gt 7; then
6688                 echo '#define VOID_PTR char *' > try.c
6689         else
6690                 echo '#define VOID_PTR void *' > try.c
6691         fi
6692         $cat >>try.c <<EOCP
6693 #include <stdio.h>
6694 #$i_stdlib I_STDLIB
6695 #ifdef I_STDLIB
6696 #include <stdlib.h>
6697 #endif
6698 int main()
6699 {
6700     printf("%d\n", (int)sizeof(VOID_PTR));
6701     exit(0);
6702 }
6703 EOCP
6704         set try
6705         if eval $compile_ok; then
6706                 ptrsize=`$run ./try`
6707                 echo "Your pointers are $ptrsize bytes long."
6708         else
6709                 dflt='4'
6710                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6711                 rp="What is the size of a pointer (in bytes)?"
6712                 . ./myread
6713                 ptrsize="$ans"
6714         fi
6715         ;;
6716 esac
6717 $rm_try
6718 case "$use64bitall" in
6719 "$define"|true|[yY]*)
6720         case "$ptrsize" in
6721         4)      cat <<EOM >&4
6722
6723 *** You have chosen a maximally 64-bit build,
6724 *** but your pointers are only 4 bytes wide.
6725 *** Please rerun Configure without -Duse64bitall.
6726 EOM
6727                 case "$d_quad" in
6728                 define)
6729                         cat <<EOM >&4
6730 *** Since you have quads, you could possibly try with -Duse64bitint.
6731 EOM
6732                         ;;
6733                 esac
6734                 cat <<EOM >&4
6735 *** Cannot continue, aborting.
6736
6737 EOM
6738
6739                 exit 1
6740                 ;;
6741         esac
6742         ;;
6743 esac
6744
6745
6746 : determine whether to use malloc wrapping
6747 echo " "
6748 case "$usemallocwrap" in
6749 [yY]*|true|$define)     dflt='y' ;;
6750 [nN]*|false|$undef)     dflt='n' ;;
6751 *)      case "$usedevel" in
6752         [yY]*|true|$define)     dflt='y' ;;
6753         *) dflt='n' ;;
6754         esac
6755         ;;
6756 esac
6757 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6758 . ./myread
6759 usemallocwrap="$ans"
6760 case "$ans" in
6761 y*|true)
6762         usemallocwrap="$define" ;;
6763 *)
6764         usemallocwrap="$undef" ;;
6765 esac
6766
6767 : determine which malloc to compile in
6768 echo " "
6769 case "$usemymalloc" in
6770 [yY]*|true|$define)     dflt='y' ;;
6771 [nN]*|false|$undef)     dflt='n' ;;
6772 *)      case "$ptrsize" in
6773         4) dflt='y' ;;
6774         *) dflt='n' ;;
6775         esac
6776         ;;
6777 esac
6778 rp="Do you wish to attempt to use the malloc that comes with $package?"
6779 . ./myread
6780 usemymalloc="$ans"
6781 case "$ans" in
6782 y*|true)
6783         usemymalloc='y'
6784         mallocsrc='malloc.c'
6785         mallocobj="malloc$_o"
6786         d_mymalloc="$define"
6787         case "$libs" in
6788         *-lmalloc*)
6789                 : Remove malloc from list of libraries to use
6790                 echo "Removing unneeded -lmalloc from library list" >&4
6791                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6792                 shift
6793                 libs="$*"
6794                 echo "libs = $libs" >&4
6795                 ;;
6796         esac
6797         ;;
6798 *)
6799         usemymalloc='n'
6800         mallocsrc=''
6801         mallocobj=''
6802         d_mymalloc="$undef"
6803         ;;
6804 esac
6805
6806 : compute the return types of malloc and free
6807 echo " "
6808 $cat >malloc.c <<END
6809 #$i_malloc I_MALLOC
6810 #$i_stdlib I_STDLIB
6811 #include <stdio.h>
6812 #include <sys/types.h>
6813 #ifdef I_MALLOC
6814 #include <malloc.h>
6815 #endif
6816 #ifdef I_STDLIB
6817 #include <stdlib.h>
6818 #endif
6819 #ifdef TRY_MALLOC
6820 void *malloc();
6821 #endif
6822 #ifdef TRY_FREE
6823 void free();
6824 #endif
6825 END
6826 case "$malloctype" in
6827 '')
6828         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6829                 malloctype='void *'
6830         else
6831                 malloctype='char *'
6832         fi
6833         ;;
6834 esac
6835 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6836
6837 case "$freetype" in
6838 '')
6839         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6840                 freetype='void'
6841         else
6842                 freetype='int'
6843         fi
6844         ;;
6845 esac
6846 echo "Your system uses $freetype free(), it would seem." >&4
6847 $rm -f malloc.[co]
6848 : determine where site specific architecture-dependent libraries go.
6849 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6850 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6851 : sitelib may have an optional trailing /share.
6852 case "$sitearch" in
6853 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6854         dflt="$dflt/$archname"
6855         ;;
6856 *)      dflt="$sitearch"
6857         ;;
6858 esac
6859 set sitearch sitearch none
6860 eval $prefixit
6861 $cat <<EOM
6862
6863 The installation process will also create a directory for
6864 architecture-dependent site-specific extensions and modules.
6865
6866 EOM
6867 fn=d~+
6868 rp='Pathname for the site-specific architecture-dependent library files?'
6869 . ./getfile
6870 prefixvar=sitearch
6871 . ./setprefixvar
6872 if $test X"$sitearch" = X"$sitelib"; then
6873         d_sitearch="$undef"
6874 else
6875         d_sitearch="$define"
6876 fi
6877
6878 : Set the vendorprefix variables
6879 $cat <<EOM
6880
6881 The installation process will also create a directory for
6882 vendor-supplied add-ons.  Vendors who supply perl with their system
6883 may find it convenient to place all vendor-supplied files in this
6884 directory rather than in the main distribution directory.  This will
6885 ease upgrades between binary-compatible maintenance versions of perl.
6886
6887 Of course you may also use these directories in whatever way you see
6888 fit.  For example, you might use them to access modules shared over a
6889 company-wide network.
6890
6891 The default answer should be fine for most people.
6892 This causes further questions about vendor add-ons to be skipped
6893 and no vendor-specific directories will be configured for perl.
6894
6895 EOM
6896 rp='Do you want to configure vendor-specific add-on directories?'
6897 case "$usevendorprefix" in
6898 define|true|[yY]*) dflt=y ;;
6899 *)      : User may have set vendorprefix directly on Configure command line.
6900         case "$vendorprefix" in
6901         ''|' ') dflt=n ;;
6902         *)      dflt=y ;;
6903         esac
6904         ;;
6905 esac
6906 . ./myread
6907 case "$ans" in
6908 [yY]*)  fn=d~+
6909         rp='Installation prefix to use for vendor-supplied add-ons?'
6910         case "$vendorprefix" in
6911         '') dflt='' ;;
6912         *)  dflt=$vendorprefix ;;
6913         esac
6914         . ./getfile
6915         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6916         oldvendorprefix=''
6917         case "$vendorprefix" in
6918         '') ;;
6919         *)      case "$ans" in
6920                 "$prefix") ;;
6921                 *) oldvendorprefix="$prefix";;
6922                 esac
6923                 ;;
6924         esac
6925         usevendorprefix="$define"
6926         vendorprefix="$ans"
6927         vendorprefixexp="$ansexp"
6928         ;;
6929 *)      usevendorprefix="$undef"
6930         vendorprefix=''
6931         vendorprefixexp=''
6932         ;;
6933 esac
6934
6935 : Set the vendorlib variables
6936 case "$vendorprefix" in
6937 '')     d_vendorlib="$undef"
6938         vendorlib=''
6939         vendorlibexp=''
6940         ;;
6941 *)      d_vendorlib="$define"
6942         : determine where vendor-supplied modules go.
6943         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6944         case "$vendorlib" in
6945         '')
6946                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6947                 case "$installstyle" in
6948                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6949                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6950                 esac
6951                 ;;
6952         *)      dflt="$vendorlib"
6953                 ;;
6954         esac
6955         fn=d~+
6956         rp='Pathname for the vendor-supplied library files?'
6957         . ./getfile
6958         vendorlib="$ans"
6959         vendorlibexp="$ansexp"
6960         ;;
6961 esac
6962 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6963 prefixvar=vendorlib
6964 . ./installprefix
6965
6966 : Set the vendorarch variables
6967 case "$vendorprefix" in
6968 '')     d_vendorarch="$undef"
6969         vendorarch=''
6970         vendorarchexp=''
6971         ;;
6972 *)      d_vendorarch="$define"
6973         : determine where vendor-supplied architecture-dependent libraries go.
6974         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6975         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6976         : vendorlib may have an optional trailing /share.
6977         case "$vendorarch" in
6978         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6979                 dflt="$dflt/$archname"
6980                 ;;
6981         *)      dflt="$vendorarch" ;;
6982         esac
6983         fn=d~+
6984         rp='Pathname for vendor-supplied architecture-dependent files?'
6985         . ./getfile
6986         vendorarch="$ans"
6987         vendorarchexp="$ansexp"
6988         ;;
6989 esac
6990 prefixvar=vendorarch
6991 . ./installprefix
6992 if $test X"$vendorarch" = X"$vendorlib"; then
6993         d_vendorarch="$undef"
6994 else
6995         d_vendorarch="$define"
6996 fi
6997
6998 : Final catch-all directories to search
6999 $cat <<EOM
7000
7001 Lastly, you can have perl look in other directories for extensions and
7002 modules in addition to those already specified.
7003 These directories will be searched after 
7004         $sitearch 
7005         $sitelib 
7006 EOM
7007 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7008 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7009 echo ' '
7010 case "$otherlibdirs" in
7011 ''|' ') dflt='none' ;;
7012 *)      dflt="$otherlibdirs" ;;
7013 esac
7014 $cat <<EOM
7015 Enter a colon-separated set of extra paths to include in perl's @INC
7016 search path, or enter 'none' for no extra paths.
7017
7018 EOM
7019
7020 rp='Colon-separated list of additional directories for perl to search?'
7021 . ./myread
7022 case "$ans" in
7023 ' '|''|none)    otherlibdirs=' ' ;;     
7024 *)      otherlibdirs="$ans" ;;
7025 esac
7026 case "$otherlibdirs" in
7027 ' ') val=$undef ;;
7028 *)      val=$define ;;
7029 esac
7030 set d_perl_otherlibdirs
7031 eval $setvar
7032
7033 : Cruising for prototypes
7034 echo " "
7035 echo "Checking out function prototypes..." >&4
7036 $cat >prototype.c <<EOCP
7037 #$i_stdlib I_STDLIB
7038 #ifdef I_STDLIB
7039 #include <stdlib.h>
7040 #endif
7041 int main(int argc, char *argv[]) {
7042         exit(0);}
7043 EOCP
7044 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7045         echo "Your C compiler appears to support function prototypes."
7046         val="$define"
7047 else
7048         echo "Your C compiler doesn't seem to understand function prototypes."
7049         val="$undef"
7050 fi
7051 set prototype
7052 eval $setvar
7053 $rm -f prototype*
7054
7055 : Check if ansi2knr is required
7056 case "$prototype" in
7057 "$define") ;;
7058 *)      ansi2knr='ansi2knr'
7059         echo " "
7060         cat <<EOM >&4
7061
7062 $me:  FATAL ERROR:
7063 This version of $package can only be compiled by a compiler that 
7064 understands function prototypes.  Unfortunately, your C compiler 
7065         $cc $ccflags
7066 doesn't seem to understand them.  Sorry about that.
7067
7068 If GNU cc is available for your system, perhaps you could try that instead.  
7069
7070 Eventually, we hope to support building Perl with pre-ANSI compilers.
7071 If you would like to help in that effort, please contact <perlbug@perl.org>.
7072
7073 Aborting Configure now.
7074 EOM
7075         exit 2
7076         ;;
7077 esac
7078
7079 : DTrace support
7080 dflt_dtrace='/usr/sbin/dtrace'
7081 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7082
7083 cat <<EOM
7084
7085 Perl can be built to support DTrace on platforms that support it.
7086 DTrace is a diagnosis and performance analysis tool from Sun.
7087
7088 If this doesn't make any sense to you, just accept the default '$dflt'.
7089 EOM
7090
7091 while $test 1 ; do
7092         case "$usedtrace" in
7093         $define|true|[yY]*)
7094                 dflt='y'
7095                 ;;
7096         ?*)
7097                 dflt='y'
7098                 dflt_dtrace=$usedtrace
7099                 ;;
7100         *)
7101                 dflt='n'
7102                 ;;
7103         esac
7104
7105         rp='Support DTrace if available?'
7106         . ./myread
7107         case "$ans" in
7108         y|Y)    val="$define" ;;
7109         *)      val="$undef" ;;
7110         esac
7111         set usedtrace
7112         eval $setvar
7113
7114         test "X$usedtrace" != "X$define" && break
7115
7116         echo " "
7117         rp='Where is the dtrace executable?'
7118         dflt=$dflt_dtrace
7119         . ./getfile
7120         val="$ans"
7121         set dtrace
7122         eval $setvar
7123
7124         if $test -f $dtrace
7125         then
7126                 if $dtrace -h -s ../perldtrace.d \
7127                         -o perldtrace.tmp >/dev/null 2>&1 \
7128                         && rm -f perldtrace.tmp
7129                 then
7130                         echo " "
7131                         echo "Good: your $dtrace knows about the -h flag."
7132                 else
7133                         cat >&2 <<EOM
7134
7135 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7136 ***
7137 *** Your installed dtrace doesn't support the -h switch to compile a D
7138 *** program into a C header. Can't continue.
7139
7140 EOM
7141                         exit 1
7142                 fi
7143                 break;
7144         fi
7145
7146         case "$fastread" in
7147         yes)
7148                 cat >&2 <<EOM
7149
7150 *** $me:  Fatal Error:  $dtrace not found.
7151 *** Can't continue.
7152
7153 EOM
7154                 exit 1
7155                 ;;
7156         *)
7157                 echo "*** $dtrace was not found."
7158                 echo " "
7159                 ;;
7160         esac
7161 done
7162
7163 : See if we want extra modules installed
7164 echo " "
7165 case "$extras" in
7166 '') dflt='n';;
7167 *) dflt='y';;
7168 esac
7169 cat <<EOM
7170 Perl can be built with extra modules or bundles of modules which
7171 will be fetched from the CPAN and installed alongside Perl.
7172
7173 Notice that you will need access to the CPAN; either via the Internet,
7174 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7175 be asked later to configure the CPAN.pm module which will in turn do
7176 the installation of the rest of the extra modules or bundles.)
7177
7178 Notice also that if the modules require any external software such as
7179 libraries and headers (the libz library and the zlib.h header for the
7180 Compress::Zlib module, for example) you MUST have any such software
7181 already installed, this configuration process will NOT install such
7182 things for you.
7183
7184 If this doesn't make any sense to you, just accept the default '$dflt'.
7185 EOM
7186 rp='Install any extra modules (y or n)?'
7187 . ./myread
7188 case "$ans" in
7189 y|Y)
7190         cat <<EOM
7191
7192 Please list any extra modules or bundles to be installed from CPAN,
7193 with spaces between the names.  The names can be in any format the
7194 'install' command of CPAN.pm will understand.  (Answer 'none',
7195 without the quotes, to install no extra modules or bundles.)
7196 EOM
7197         rp='Extras?'
7198         dflt="$extras"
7199         . ./myread
7200         extras="$ans"
7201 esac
7202 case "$extras" in
7203 ''|'none')
7204         val=''
7205         $rm -f ../extras.lst
7206         ;;
7207 *)      echo "(Saving the list of extras for later...)"
7208         echo "$extras" > ../extras.lst
7209         val="'$extras'"
7210         ;;
7211 esac
7212 set extras
7213 eval $setvar
7214 echo " "
7215
7216 : determine where html pages for programs go
7217 set html1dir html1dir none
7218 eval $prefixit
7219 $cat <<EOM
7220
7221 If you wish to install html files for programs in $spackage, indicate
7222 the appropriate directory here.  To skip installing html files,
7223 answer "none".
7224 EOM
7225 case "$html1dir" in
7226 ''|none|$undef|' ') dflt=none ;;
7227 *) dflt=$html1dir ;;
7228 esac
7229 fn=dn+~
7230 rp="Directory for the main $spackage html pages?"
7231 . ./getfile
7232 prefixvar=html1dir
7233 . ./setprefixvar
7234 : Use ' ' for none so value is preserved next time through Configure
7235 $test X"$html1dir" = "X" && html1dir=' '
7236
7237 : determine where html pages for libraries and modules go
7238 set html3dir html3dir none
7239 eval $prefixit
7240 $cat <<EOM
7241
7242 If you wish to install html files for modules associated with $spackage,
7243 indicate the appropriate directory here.  To skip installing html files,
7244 answer "none".
7245 EOM
7246 : There is no obvious default.  If they have specified html1dir, then
7247 : try to key off that, possibly changing .../html1 into .../html3.
7248 case "$html3dir" in
7249 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7250 *) dflt=$html3dir ;;
7251 esac
7252 fn=dn+~
7253 rp="Directory for the $spackage module html pages?"
7254 . ./getfile
7255 prefixvar=html3dir
7256 . ./setprefixvar
7257 : Use ' ' for none so value is preserved next time through Configure
7258 $test X"$html3dir" = "X" && html3dir=' '
7259
7260 : determine whether to install perl also as /usr/bin/perl
7261
7262 echo " "
7263 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7264         $cat <<EOM
7265 Many scripts expect perl to be installed as /usr/bin/perl.
7266
7267 If you want to, I can install the perl you are about to compile
7268 as /usr/bin/perl (in addition to $bin/perl).
7269 EOM
7270         if test -f /usr/bin/perl; then
7271             $cat <<EOM
7272
7273 However, please note that because you already have a /usr/bin/perl,
7274 overwriting that with a new Perl would very probably cause problems.
7275 Therefore I'm assuming you don't want to do that (unless you insist).
7276
7277 EOM
7278             case "$installusrbinperl" in
7279             "$define"|[yY]*)    dflt='y';;
7280             *)                  dflt='n';;
7281             esac
7282         else
7283             $cat <<EOM
7284
7285 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7286
7287 EOM
7288             case "$installusrbinperl" in
7289             "$undef"|[nN]*)     dflt='n';;
7290             *)                  dflt='y';;
7291             esac
7292         fi
7293         rp="Do you want to install perl as /usr/bin/perl?"
7294         . ./myread
7295         case "$ans" in
7296         [yY]*)  val="$define";;
7297         *)      val="$undef" ;;
7298         esac
7299 else
7300         val="$undef"
7301 fi
7302 set installusrbinperl
7303 eval $setvar
7304
7305 : Check if we are using the GNU C library
7306 echo " "
7307 echo "Checking for GNU C Library..." >&4
7308 cat >try.c <<'EOCP'
7309 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7310    alone are insufficient to distinguish different versions, such as
7311    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7312    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7313 */
7314 #include <stdio.h>
7315 int main(void)
7316 {
7317 #ifdef __GLIBC__
7318 #   ifdef __GLIBC_MINOR__
7319 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7320 #           include <gnu/libc-version.h>
7321             printf("%s\n",  gnu_get_libc_version());
7322 #       else
7323             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7324 #       endif
7325 #   else
7326         printf("%d\n",  __GLIBC__);
7327 #   endif
7328     return 0;
7329 #else
7330     return 1;
7331 #endif
7332 }
7333 EOCP
7334 set try
7335 if eval $compile_ok && $run ./try > glibc.ver; then
7336         val="$define"
7337         gnulibc_version=`$cat glibc.ver`
7338         echo "You are using the GNU C Library version $gnulibc_version"
7339 else
7340         val="$undef"
7341         gnulibc_version=''
7342         echo "You are not using the GNU C Library"
7343 fi
7344 $rm_try glibc.ver
7345 set d_gnulibc
7346 eval $setvar
7347
7348 : see if nm is to be used to determine whether a symbol is defined or not
7349 case "$usenm" in
7350 '')
7351         dflt=''
7352         case "$d_gnulibc" in
7353         "$define")
7354                 echo " "
7355                 echo "nm probably won't work on the GNU C Library." >&4
7356                 dflt=n
7357                 ;;
7358         esac
7359         case "$dflt" in
7360         '') 
7361                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7362                         echo " "
7363                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7364                         echo "'nm' won't be sufficient on this sytem." >&4
7365                         dflt=n
7366                 fi
7367                 ;;
7368         esac
7369         case "$dflt" in
7370         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7371                 if $test $dflt -gt 20; then
7372                         dflt=y
7373                 else
7374                         dflt=n
7375                 fi
7376                 ;;
7377         esac
7378         ;;
7379 *)
7380         case "$usenm" in
7381         true|$define) dflt=y;;
7382         *) dflt=n;;
7383         esac
7384         ;;
7385 esac
7386 $cat <<EOM
7387
7388 I can use $nm to extract the symbols from your C libraries. This
7389 is a time consuming task which may generate huge output on the disk (up
7390 to 3 megabytes) but that should make the symbols extraction faster. The
7391 alternative is to skip the 'nm' extraction part and to compile a small
7392 test program instead to determine whether each symbol is present. If
7393 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7394 this may be the best solution.
7395
7396 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7397
7398 EOM
7399 rp="Shall I use $nm to extract C symbols from the libraries?"
7400 . ./myread
7401 case "$ans" in
7402 [Nn]*) usenm=false;;
7403 *) usenm=true;;
7404 esac
7405
7406 runnm=$usenm
7407 case "$reuseval" in
7408 true) runnm=false;;
7409 esac
7410
7411 : nm options which may be necessary
7412 case "$nm_opt" in
7413 '') if $test -f /mach_boot; then
7414                 nm_opt=''       # Mach
7415         elif $test -d /usr/ccs/lib; then
7416                 nm_opt='-p'     # Solaris (and SunOS?)
7417         elif $test -f /dgux; then
7418                 nm_opt='-p'     # DG-UX
7419         elif $test -f /lib64/rld; then
7420                 nm_opt='-p'     # 64-bit Irix
7421         else
7422                 nm_opt=''
7423         fi;;
7424 esac
7425
7426 : nm options which may be necessary for shared libraries but illegal
7427 : for archive libraries.  Thank you, Linux.
7428 case "$nm_so_opt" in
7429 '')     case "$myuname" in
7430         *linux*|gnu*)
7431                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7432                         nm_so_opt='--dynamic'
7433                 fi
7434                 ;;
7435         esac
7436         ;;
7437 esac
7438
7439 : Figure out where the libc is located
7440 case "$runnm" in
7441 true)
7442 : get list of predefined functions in a handy place
7443 echo " "
7444 case "$libc" in
7445 '') libc=unknown
7446         case "$libs" in
7447         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7448         esac
7449         ;;
7450 esac
7451 case "$libs" in
7452 '') ;;
7453 *)  for thislib in $libs; do
7454         case "$thislib" in
7455         -lc|-lc_s)
7456                 : Handle C library specially below.
7457                 ;;
7458         -l*)
7459                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7460                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7461                         :
7462                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7463                         :
7464                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7465                         :
7466                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7473                         :
7474                 else
7475                         try=''
7476                 fi
7477                 libnames="$libnames $try"
7478                 ;;
7479         *) libnames="$libnames $thislib" ;;
7480         esac
7481         done
7482         ;;
7483 esac
7484 xxx=normal
7485 case "$libc" in
7486 unknown)
7487         set /lib/libc.$so
7488         for xxx in $libpth; do
7489                 $test -r $1 || set $xxx/libc.$so
7490                 : The messy sed command sorts on library version numbers.
7491                 $test -r $1 || \
7492                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7493                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7494                                 h
7495                                 s/[0-9][0-9]*/0000&/g
7496                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7497                                 G
7498                                 s/\n/ /' | \
7499                          $sort | $sed -e 's/^.* //'`
7500                 eval set \$$#
7501         done
7502         $test -r $1 || set /usr/ccs/lib/libc.$so
7503         $test -r $1 || set /lib/libsys_s$_a
7504         ;;
7505 *)
7506         set blurfl
7507         ;;
7508 esac
7509 if $test -r "$1"; then
7510         echo "Your (shared) C library seems to be in $1."
7511         libc="$1"
7512 elif $test -r /lib/libc && $test -r /lib/clib; then
7513         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7514         xxx=apollo
7515         libc='/lib/clib /lib/libc'
7516         if $test -r /lib/syslib; then
7517                 echo "(Your math library is in /lib/syslib.)"
7518                 libc="$libc /lib/syslib"
7519         fi
7520 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7521         echo "Your C library seems to be in $libc, as you said before."
7522 elif $test -r $incpath/usr/lib/libc$_a; then
7523         libc=$incpath/usr/lib/libc$_a;
7524         echo "Your C library seems to be in $libc.  That's fine."
7525 elif $test -r /lib/libc$_a; then
7526         libc=/lib/libc$_a;
7527         echo "Your C library seems to be in $libc.  You're normal."
7528 else
7529         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7530                 :
7531         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7532                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7533         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7534                 :
7535         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7536                 :
7537         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7538                 :
7539         else
7540                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7541         fi
7542         if $test -r "$tans"; then
7543                 echo "Your C library seems to be in $tans, of all places."
7544                 libc=$tans
7545         else
7546                 libc='blurfl'
7547         fi
7548 fi
7549 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7550         dflt="$libc"
7551         cat <<EOM
7552
7553 If the guess above is wrong (which it might be if you're using a strange
7554 compiler, or your machine supports multiple models), you can override it here.
7555
7556 EOM
7557 else
7558         dflt=''
7559         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7560         cat >&4 <<EOM
7561 I can't seem to find your C library.  I've looked in the following places:
7562
7563 EOM
7564         $sed 's/^/      /' libpath
7565         cat <<EOM
7566
7567 None of these seems to contain your C library. I need to get its name...
7568
7569 EOM
7570 fi
7571 fn=f
7572 rp='Where is your C library?'
7573 . ./getfile
7574 libc="$ans"
7575
7576 echo " "
7577 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7578 set X `cat libnames`
7579 shift
7580 xxx=files
7581 case $# in 1) xxx=file; esac
7582 echo "Extracting names from the following $xxx for later perusal:" >&4
7583 echo " "
7584 $sed 's/^/      /' libnames >&4
7585 echo " "
7586 $echo $n "This may take a while...$c" >&4
7587
7588 for file in $*; do
7589         case $file in
7590         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7591         *) $nm $nm_opt $file 2>/dev/null;;
7592         esac
7593 done >libc.tmp
7594
7595 $echo $n ".$c"
7596 $grep fprintf libc.tmp > libc.ptf
7597 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7598 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7599 xxx='[ADTSIWi]'
7600 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7601         eval $xscan;\
7602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7603                 eval $xrun
7604 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7605         eval $xscan;\
7606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7607                 eval $xrun
7608 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7625                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7626         eval $xscan;\
7627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628                 eval $xrun
7629 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7630         eval $xscan;\
7631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632                 eval $xrun
7633 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7638         eval $xscan;\
7639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640                 eval $xrun
7641 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7642         eval $xscan;\
7643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644                 eval $xrun
7645 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 else
7658         $nm -p $* 2>/dev/null >libc.tmp
7659         $grep fprintf libc.tmp > libc.ptf
7660         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7661                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7662         then
7663                 nm_opt='-p'
7664                 eval $xrun
7665         else
7666                 echo " "
7667                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7668                 com=''
7669                 if $ar t $libc > libc.tmp && \
7670                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7671                 then
7672                         for thisname in $libnames $libc; do
7673                                 $ar t $thisname >>libc.tmp
7674                         done
7675                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7676                         echo "Ok." >&4
7677                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7678                         for thisname in $libnames $libc; do
7679                                 $ar tv $thisname >>libc.tmp
7680                                 emximp -o tmp.imp $thisname \
7681                                     2>/dev/null && \
7682                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7683                                     < tmp.imp >>libc.tmp
7684                                 $rm -f tmp.imp
7685                         done
7686                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7687                         echo "Ok." >&4
7688                 else
7689                         echo "$ar didn't seem to work right." >&4
7690                         echo "Maybe this is a Cray...trying bld instead..." >&4
7691                         if  bld t $libc | \
7692                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7693                                 $test -s libc.list
7694                         then
7695                                 for thisname in $libnames; do
7696                                         bld t $libnames | \
7697                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7698                                         $ar t $thisname >>libc.tmp
7699                                 done
7700                                 echo "Ok." >&4
7701                         else
7702                                 echo "That didn't work either.  Giving up." >&4
7703                                 exit 1
7704                         fi
7705                 fi
7706         fi
7707 fi
7708 nm_extract="$com"
7709 case "$PASE" in
7710 define)
7711     echo " "
7712     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7713     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7714     ;;
7715 *)  if $test -f /lib/syscalls.exp; then
7716         echo " "
7717         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7718         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7719                 /lib/syscalls.exp >>libc.list
7720     fi
7721     ;;
7722 esac
7723 ;;
7724 esac
7725 $rm -f libnames libpath
7726
7727 : see if dld is available
7728 set dld.h i_dld
7729 eval $inhdr
7730
7731 : Check if we are using C++
7732 echo " "
7733 echo "Checking for C++..." >&4
7734 $cat >try.c <<'EOCP'
7735 #include <stdio.h>
7736 int main(void)
7737 {
7738 #ifdef __cplusplus
7739     return 0;
7740 #else
7741     return 1;
7742 #endif
7743 }
7744 EOCP
7745 set try
7746 if eval $compile_ok && $run ./try; then
7747         val="$define"
7748         echo "You are using a C++ compiler."
7749 else
7750         val="$undef"
7751         echo "You are not using a C++ compiler."
7752 fi
7753 $rm_try cplusplus$$
7754 set d_cplusplus
7755 eval $setvar
7756
7757 : is a C symbol defined?
7758 csym='tlook=$1;
7759 case "$3" in
7760 -v) tf=libc.tmp; tdc="";;
7761 -a) tf=libc.tmp; tdc="[]";;
7762 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7763 esac;
7764 case "$d_cplusplus" in
7765     $define)    extern_C="extern \"C\"" ;;
7766     *)          extern_C="extern"       ;;
7767 esac;
7768 tx=yes;
7769 case "$reuseval-$4" in
7770 true-) ;;
7771 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7772 esac;
7773 case "$tx" in
7774 yes)
7775         tval=false;
7776         if $test "$runnm" = true; then
7777                 if $contains $tlook $tf >/dev/null 2>&1; then
7778                         tval=true;
7779                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7780                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7781                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7782                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7783                         $rm_try;
7784                 fi;
7785         else
7786                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7787                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7788                 $rm_try;
7789         fi;
7790         ;;
7791 *)
7792         case "$tval" in
7793         $define) tval=true;;
7794         *) tval=false;;
7795         esac;
7796         ;;
7797 esac;
7798 eval "$2=$tval"'
7799
7800 : define an is-in-libc? function
7801 inlibc='echo " "; td=$define; tu=$undef;
7802 sym=$1; var=$2; eval "was=\$$2";
7803 tx=yes;
7804 case "$reuseval$was" in
7805 true) ;;
7806 true*) tx=no;;
7807 esac;
7808 case "$tx" in
7809 yes)
7810         set $sym tres -f;
7811         eval $csym;
7812         case "$tres" in
7813         true)
7814                 echo "$sym() found." >&4;
7815                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7816         *)
7817                 echo "$sym() NOT found." >&4;
7818                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7819         esac;;
7820 *)
7821         case "$was" in
7822         $define) echo "$sym() found." >&4;;
7823         *) echo "$sym() NOT found." >&4;;
7824         esac;;
7825 esac'
7826
7827 : see if dlopen exists
7828 xxx_runnm="$runnm"
7829 xxx_ccflags="$ccflags"
7830 runnm=false
7831 : with g++ one needs -shared to get is-in-libc to work for dlopen
7832 case "$gccversion" in
7833 '')     ;;
7834 *)      case "$d_cplusplus" in
7835         "$define") ccflags="$ccflags -shared" ;;
7836         esac
7837         ;;
7838 esac
7839 set dlopen d_dlopen
7840 eval $inlibc
7841 runnm="$xxx_runnm"
7842 ccflags="$xxx_ccflags"
7843
7844 : see if this is a unistd.h system
7845 set unistd.h i_unistd
7846 eval $inhdr
7847
7848 : determine which dynamic loading, if any, to compile in
7849 echo " "
7850 dldir="ext/DynaLoader"
7851 case "$usedl" in
7852 $define|y|true)
7853         dflt='y'
7854         usedl="$define"
7855         ;;
7856 $undef|n|false)
7857         dflt='n'
7858         usedl="$undef"
7859         ;;
7860 *)
7861         dflt='n'
7862         case "$d_dlopen" in
7863             $define) dflt='y' ;;
7864         esac
7865         case "$i_dld" in
7866             $define) dflt='y' ;;
7867         esac
7868         : Does a dl_xxx.xs file exist for this operating system
7869         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7870         ;;
7871 esac
7872 rp="Do you wish to use dynamic loading?"
7873 . ./myread
7874 usedl="$ans"
7875 bin_ELF="$undef"
7876 case "$ans" in
7877 y*) usedl="$define"
7878         case "$dlsrc" in
7879         '')
7880                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7881                         dflt="$dldir/dl_${osname}.xs"
7882                 elif $test "$d_dlopen" = "$define" ; then
7883                         dflt="$dldir/dl_dlopen.xs"
7884                 elif $test "$i_dld" = "$define" ; then
7885                         dflt="$dldir/dl_dld.xs"
7886                 else
7887                         dflt=''
7888                 fi
7889                 ;;
7890         *)      dflt="$dldir/$dlsrc"
7891                 ;;
7892         esac
7893     echo "The following dynamic loading files are available:"
7894         : Can not go over to $dldir because getfile has path hard-coded in.
7895         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7896         rp="Source file to use for dynamic loading"
7897         fn="fne"
7898         gfpth="$src"
7899         . ./getfile
7900         usedl="$define"
7901         : emulate basename
7902         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7903
7904         $cat << EOM
7905
7906 Some systems may require passing special flags to $cc -c to
7907 compile modules that will be used to create a shared library.
7908 To use no flags, say "none".
7909
7910 EOM
7911     case "$cccdlflags" in
7912     '') case "$gccversion" in
7913                 '') case "$osname" in
7914                         hpux)   dflt='+z' ;;
7915                         next)   dflt='none' ;;
7916                         irix*)  dflt='-KPIC' ;;
7917                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7918                         sunos)  dflt='-pic' ;;
7919                         *)      dflt='none' ;;
7920                     esac
7921                         ;;
7922                 *)  case "$osname" in
7923                         darwin) dflt='none' ;;
7924                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7925                         *)      dflt='-fpic' ;;
7926                     esac ;;
7927             esac ;;
7928         ' ') dflt='none' ;;
7929     *)  dflt="$cccdlflags" ;;
7930     esac
7931     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7932     . ./myread
7933     case "$ans" in
7934     none) cccdlflags=' ' ;;
7935     *) cccdlflags="$ans" ;;
7936     esac
7937
7938     cat << EOM
7939
7940 Some systems use ld to create libraries that can be dynamically loaded,
7941 while other systems (such as those using ELF) use $cc.
7942
7943 EOM
7944         case "$ld" in
7945         '')     $cat >try.c <<EOM
7946 /* Test for whether ELF binaries are produced */
7947 #include <fcntl.h>
7948 #$i_stdlib I_STDLIB
7949 #ifdef I_STDLIB
7950 #include <stdlib.h>
7951 #endif
7952 #$i_unistd I_UNISTD
7953 #ifdef I_UNISTD
7954 #include <unistd.h>
7955 #endif
7956 int main() {
7957         char b[4];
7958         int i = open("a.out",O_RDONLY);
7959         if(i == -1)
7960                 exit(1); /* fail */
7961         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7962                 exit(0); /* succeed (yes, it's ELF) */
7963         else
7964                 exit(1); /* fail */
7965 }
7966 EOM
7967                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7968                         cat <<EOM
7969 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7970 EOM
7971                         dflt="$cc"
7972                         bin_ELF="$define"
7973                 else
7974                         echo "I'll use ld to build dynamic libraries."
7975                         dflt='ld'
7976                 fi
7977                 $rm_try
7978                 ;;
7979         *)      dflt="$ld"
7980                 ;;
7981         esac
7982
7983     rp="What command should be used to create dynamic libraries?"
7984     . ./myread
7985         ld="$ans"
7986
7987     cat << EOM
7988
7989 Some systems may require passing special flags to $ld to create a
7990 library that can be dynamically loaded.  If your ld flags include
7991 -L/other/path options to locate libraries outside your loader's normal
7992 search path, you may need to specify those -L options here as well.  To
7993 use no flags, say "none".
7994
7995 EOM
7996     case "$lddlflags" in
7997     '') case "$osname" in
7998                         beos) dflt='-nostart' ;;
7999                         haiku) dflt='-shared' ;;
8000                         hpux) dflt='-b';
8001                               case "$gccversion" in
8002                               '') dflt="$dflt +vnocompatwarnings" ;;
8003                               esac
8004                               ;;
8005                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8006                         next)  dflt='none' ;;
8007                         solaris) dflt='-G' ;;
8008                         sunos) dflt='-assert nodefinitions' ;;
8009                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8010                 *)     dflt='none' ;;
8011                         esac
8012                         ;;
8013     *) dflt="$lddlflags" ;;
8014     esac
8015
8016         : Try to guess additional flags to pick up local libraries.
8017         : Be careful not to append to a plain 'none'
8018         case "$dflt" in
8019         none) dflt='' ;;
8020         esac
8021         for thisflag in $ldflags; do
8022                 case "$thisflag" in
8023                 -L*|-R*|-Wl,-R*)
8024                         case " $dflt " in
8025                         *" $thisflag "*) ;;
8026                         *) dflt="$dflt $thisflag" ;;
8027                         esac
8028                         ;;
8029                 esac
8030         done
8031
8032         case "$dflt" in
8033         ''|' ') dflt='none' ;;
8034         esac
8035
8036         case "$ldflags" in
8037         *-fstack-protector*)
8038             case "$dflt" in
8039                         *-fstack-protector*) ;; # Don't add it again
8040                         *) dflt="$dflt -fstack-protector" ;; 
8041                 esac
8042                 ;;
8043         esac
8044
8045
8046     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8047     . ./myread
8048     case "$ans" in
8049     none) lddlflags=' ' ;;
8050     *) lddlflags="$ans" ;;
8051     esac
8052
8053         cat <<EOM
8054
8055 Some systems may require passing special flags to $cc to indicate that
8056 the resulting executable will use dynamic linking.  To use no flags,
8057 say "none".
8058
8059 EOM
8060     case "$ccdlflags" in
8061     '') case "$osname" in
8062             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8063             next|sunos) dflt='none' ;;
8064             *)          dflt='none' ;;
8065             esac ;;
8066     ' ')  dflt='none' ;;
8067     *)  dflt="$ccdlflags" ;;
8068     esac
8069     rp="Any special flags to pass to $cc to use dynamic linking?"
8070     . ./myread
8071     case "$ans" in
8072     none) ccdlflags=' ' ;;
8073     *) ccdlflags="$ans" ;;
8074     esac
8075     ;;
8076 *)  usedl="$undef"
8077         ld='ld'
8078     dlsrc='dl_none.xs'
8079     lddlflags=''
8080     ccdlflags=''
8081     ;;
8082 esac
8083
8084 : Do we want a shared libperl?
8085 also=''
8086 case "$usedl" in
8087 $undef)
8088         # No dynamic loading being used, so don't bother even to prompt.
8089         useshrplib='false'
8090         ;;
8091 *)      case "$useshrplib" in
8092         '')     case "$osname" in
8093                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8094                         dflt=y
8095                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8096                         ;;
8097                 next*)
8098                         case "$osvers" in
8099                         4*)     dflt=y
8100                                 also='Building a shared libperl is needed for MAB support.'
8101                                 ;;
8102                         *)      dflt=n
8103                                 ;;
8104                         esac
8105                         ;;
8106                 *)      dflt=n
8107                         ;;
8108                 esac
8109                 ;;
8110         $define|true|[Yy]*)
8111                 dflt=y
8112                 ;;
8113         *)      dflt=n
8114                 ;;
8115         esac
8116         $cat << EOM
8117
8118 The perl executable is normally obtained by linking perlmain.c with
8119 libperl${_a}, any static extensions (usually just DynaLoader), and
8120 any other libraries needed on this system (such as -lm, etc.).  Since
8121 your system supports dynamic loading, it is probably possible to build
8122 a shared libperl.$so.  If you will have more than one executable linked
8123 to libperl.$so, this will significantly reduce the size of each
8124 executable, but it may have a noticeable effect on performance.  The
8125 default is probably sensible for your system.
8126 $also
8127
8128 EOM
8129         rp="Build a shared libperl.$so (y/n)"
8130         . ./myread
8131         case "$ans" in
8132         true|$define|[Yy]*)
8133                 useshrplib='true'  ;;
8134         *)      useshrplib='false' ;;
8135         esac
8136         ;;
8137 esac
8138
8139 case "$useshrplib" in
8140 true)
8141         case "$userelocatableinc" in
8142         true|define)
8143                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8144                 echo "See INSTALL for an explanation why that won't work." >&4
8145                 exit 4
8146                 ;;
8147         esac
8148         case "$libperl" in
8149         '')
8150                 # Figure out a good name for libperl.so.  Since it gets stored in
8151                 # a version-specific architecture-dependent library, the version
8152                 # number isn't really that important, except for making cc/ld happy.
8153                 #
8154                 # A name such as libperl.so.10.1
8155                 majmin="libperl.$so.$patchlevel.$subversion"
8156                 # A name such as libperl.so.100
8157                 majonly=`echo $patchlevel $subversion |
8158                         $awk '{printf "%d%02d", $1, $2}'`
8159                 majonly=libperl.$so.$majonly
8160                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8161                 # rely on figuring it out from the naming of libc.
8162                 case "${osname}${osvers}" in
8163                 next4*)
8164                         dflt=libperl.5.$so
8165                         # XXX How handle the --version stuff for MAB?
8166                         ;;
8167                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8168                         dflt=libperl.$so
8169                         ;;
8170                 cygwin*) # ld links now against the dll directly
8171                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8172                         majonly=`echo $patchlevel $subversion |
8173                                 $awk '{printf "%03d%03d", $1, $2}'`
8174                         majonly=cygperl5.$majonly.$so
8175                         dflt=$majmin
8176                         ;;
8177                 *)      # Try to guess based on whether libc has major.minor.
8178                         case "$libc" in
8179                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8180                         *libc.$so.[0-9]*) dflt=$majonly ;;
8181                         *)      dflt=libperl.$so ;;
8182                         esac
8183                         ;;
8184                 esac
8185                 ;;
8186         *)      dflt=$libperl
8187                 ;;
8188         esac
8189         cat << EOM
8190
8191 I need to select a good name for the shared libperl.  If your system uses
8192 library names with major and minor numbers, then you might want something
8193 like $majmin.  Alternatively, if your system uses a single version
8194 number for shared libraries, then you might want to use $majonly.
8195 Or, your system might be quite happy with a simple libperl.$so.
8196
8197 Since the shared libperl will get installed into a version-specific
8198 architecture-dependent directory, the version number of the shared perl
8199 library probably isn't important, so the default should be o.k.
8200
8201 EOM
8202         rp='What name do you want to give to the shared libperl?'
8203         . ./myread
8204         libperl=$ans
8205         echo "Ok, I'll use $libperl"
8206         ;;
8207 *)
8208         libperl="libperl${_a}"
8209         ;;
8210 esac
8211
8212 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8213 case "$shrpdir" in
8214 '') ;;
8215 *)      $cat >&4 <<EOM
8216 WARNING:  Use of the shrpdir variable for the installation location of
8217 the shared $libperl is not supported.  It was never documented and
8218 will not work in this version.  Let me (perlbug@perl.org)
8219 know of any problems this may cause.
8220
8221 EOM
8222         case "$shrpdir" in
8223         "$archlibexp/CORE")
8224                 $cat >&4 <<EOM
8225 But your current setting of $shrpdir is
8226 the default anyway, so it's harmless.
8227 EOM
8228                 ;;
8229         *)
8230                 $cat >&4 <<EOM
8231 Further, your current attempted setting of $shrpdir
8232 conflicts with the value of $archlibexp/CORE
8233 that installperl will use.
8234 EOM
8235                 ;;
8236         esac
8237         ;;
8238 esac
8239
8240 # How will the perl executable find the installed shared $libperl?
8241 # Add $xxx to ccdlflags.
8242 # If we can't figure out a command-line option, use $shrpenv to
8243 # set env LD_RUN_PATH.  The main perl makefile uses this.
8244 shrpdir=$archlibexp/CORE
8245 xxx=''
8246 tmp_shrpenv=''
8247 if "$useshrplib"; then
8248     case "$osname" in
8249         aix)
8250                 # We'll set it in Makefile.SH...
8251                 ;;
8252         solaris)
8253                 xxx="-R $shrpdir"
8254                 ;;
8255         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8256                 xxx="-Wl,-R$shrpdir"
8257                 ;;
8258         bsdos|linux|irix*|dec_osf|gnu*)
8259                 xxx="-Wl,-rpath,$shrpdir"
8260                 ;;
8261         next)
8262                 # next doesn't like the default...
8263                 ;;
8264         beos)
8265                 # beos doesn't like the default, either.
8266                 ;;
8267         haiku)
8268                 # Haiku doesn't like the default, either.
8269                 ;;
8270         hpux*)
8271                 # hpux doesn't like the default, either.
8272                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8273                 ;;
8274         cygwin)
8275                 # cygwin needs only ldlibpth
8276                 ;;
8277         *)
8278                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8279                 ;;
8280         esac
8281         case "$xxx" in
8282         '') ;;
8283         *)
8284                 # Only add $xxx if it isn't already in ccdlflags.
8285                 case " $ccdlflags " in
8286                 *" $xxx "*)     ;;
8287                 *)      ccdlflags="$ccdlflags $xxx"
8288                         cat <<EOM >&4
8289
8290 Adding $xxx to the flags
8291 passed to $ld so that the perl executable will find the
8292 installed shared $libperl.
8293
8294 EOM
8295                         ;;
8296                 esac
8297                 ;;
8298         esac
8299 fi
8300 # Fix ccdlflags in AIX for building external extensions.
8301 # (For building Perl itself bare -bE:perl.exp is needed,
8302 #  Makefile.SH takes care of this.)
8303 case "$osname" in
8304 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8305 esac
8306 # Respect a hint or command-line value.
8307 case "$shrpenv" in
8308 '') shrpenv="$tmp_shrpenv" ;;
8309 esac
8310 case "$ldlibpthname" in
8311 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8312 none)   ldlibpthname='' ;;
8313 esac
8314
8315 : determine where manual pages are on this system
8316 echo " "
8317 case "$sysman" in
8318 '') 
8319         syspath='/usr/share/man/man1 /usr/man/man1'
8320         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8321         syspath="$syspath /usr/man/u_man/man1"
8322         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8323         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8324         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8325         sysman=`./loc . /usr/man/man1 $syspath`
8326         ;;
8327 esac
8328 if $test -d "$sysman"; then
8329         echo "System manual is in $sysman." >&4
8330 else
8331         echo "Could not find manual pages in source form." >&4
8332 fi
8333
8334 : determine where manual pages go
8335 set man1dir man1dir none
8336 eval $prefixit
8337 $cat <<EOM
8338
8339 $spackage has manual pages available in source form.
8340 EOM
8341 case "$nroff" in
8342 nroff)
8343         echo "However, you don't have nroff, so they're probably useless to you."
8344         case "$man1dir" in
8345         '') man1dir="none";;
8346         esac;;
8347 esac
8348 echo "If you don't want the manual sources installed, answer 'none'."
8349 case "$man1dir" in
8350 ' ') dflt=none
8351         ;;
8352 '')
8353         lookpath="$prefixexp/share/man/man1"
8354         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8355         lookpath="$lookpath $prefixexp/man/p_man/man1"
8356         lookpath="$lookpath $prefixexp/man/u_man/man1"
8357         lookpath="$lookpath $prefixexp/man/man.1"
8358         case "$sysman" in
8359         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8360         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8361         esac
8362         set dflt
8363         eval $prefixup
8364         ;;
8365 *)  dflt="$man1dir"
8366         ;;
8367 esac
8368 echo " "
8369 fn=dn+~
8370 rp="Where do the main $spackage manual pages (source) go?"
8371 . ./getfile
8372 if $test "X$man1direxp" != "X$ansexp"; then
8373         installman1dir=''
8374 fi
8375 prefixvar=man1dir
8376 . ./setprefixvar
8377
8378 case "$man1dir" in
8379 '')     man1dir=' '
8380         installman1dir='';;
8381 esac
8382
8383 : What suffix to use on installed man pages
8384
8385 case "$man1dir" in
8386 ' ')
8387         man1ext='0'
8388         ;;
8389 *)
8390         rp="What suffix should be used for the main $spackage man pages?"
8391         case "$man1ext" in
8392         '')     case "$man1dir" in
8393                 *1)  dflt=1 ;;
8394                 *1p) dflt=1p ;;
8395                 *1pm) dflt=1pm ;;
8396                 *l) dflt=l;;
8397                 *n) dflt=n;;
8398                 *o) dflt=o;;
8399                 *p) dflt=p;;
8400                 *C) dflt=C;;
8401                 *L) dflt=L;;
8402                 *L1) dflt=L1;;
8403                 *) dflt=1;;
8404                 esac
8405                 ;;
8406         *)      dflt="$man1ext";;
8407         esac
8408         . ./myread
8409         man1ext="$ans"
8410         ;;
8411 esac
8412
8413 : see if we can have long filenames
8414 echo " "
8415 first=123456789abcdef
8416 $rm -f $first
8417 if (echo hi >$first) 2>/dev/null; then
8418         if $test -f 123456789abcde; then
8419                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8420                 val="$undef"
8421         else
8422                 echo 'You can have filenames longer than 14 characters.'>&4
8423                 val="$define"
8424         fi
8425 else
8426         $cat <<'EOM'
8427 You can't have filenames longer than 14 chars.
8428 You can't even think about them!
8429 EOM
8430         val="$undef"
8431 fi
8432 set d_flexfnam
8433 eval $setvar
8434 $rm -rf 123456789abcde*
8435
8436 : determine where library module manual pages go
8437 set man3dir man3dir none
8438 eval $prefixit
8439 $cat <<EOM
8440
8441 $spackage has manual pages for many of the library modules.
8442 EOM
8443
8444 case "$nroff" in
8445 nroff)
8446         $cat <<'EOM'
8447 However, you don't have nroff, so they're probably useless to you.
8448 EOM
8449         case "$man3dir" in
8450         '') man3dir="none";;
8451         esac;;
8452 esac
8453
8454 case "$d_flexfnam" in
8455 undef)
8456         $cat <<'EOM'
8457 However, your system can't handle the long file names like File::Basename.3.
8458 EOM
8459         case "$man3dir" in
8460         '') man3dir="none";;
8461         esac;;
8462 esac
8463
8464 echo "If you don't want the manual sources installed, answer 'none'."
8465 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8466 case "$man3dir" in
8467 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8468         if $test -d "$privlib/man/man3"; then
8469                 cat <<EOM >&4
8470
8471 WARNING:  Previous versions of perl installed man3 pages into
8472 $privlib/man/man3.  This version will suggest a
8473 new default of $dflt.
8474 EOM
8475                 tdflt=$dflt
8476                 dflt='n'
8477                 rp='Do you wish to preserve the old behavior?(y/n)'
8478                 . ./myread
8479                 case "$ans" in
8480                 y*) dflt="$privlib/man/man3" ;;
8481                 *)  dflt=$tdflt ;;
8482                 esac
8483     fi
8484         ;;
8485 *)      dflt="$man3dir" ;;
8486 esac
8487 case "$dflt" in
8488 ' ') dflt=none ;;
8489 esac
8490 echo " "
8491 fn=dn+~
8492 rp="Where do the $package library man pages (source) go?"
8493 . ./getfile
8494 prefixvar=man3dir
8495 . ./setprefixvar
8496
8497 case "$man3dir" in
8498 '')     man3dir=' '
8499         installman3dir='';;
8500 esac
8501
8502 : What suffix to use on installed man pages
8503 case "$man3dir" in
8504 ' ')
8505         man3ext='0'
8506         ;;
8507 *)
8508         rp="What suffix should be used for the $package library man pages?"
8509         case "$man3ext" in
8510         '')     case "$man3dir" in
8511                 *3)  dflt=3 ;;
8512                 *3p) dflt=3p ;;
8513                 *3pm) dflt=3pm ;;
8514                 *l) dflt=l;;
8515                 *n) dflt=n;;
8516                 *o) dflt=o;;
8517                 *p) dflt=p;;
8518                 *C) dflt=C;;
8519                 *L) dflt=L;;
8520                 *L3) dflt=L3;;
8521                 *) dflt=3;;
8522                 esac
8523                 ;;
8524         *)      dflt="$man3ext";;
8525         esac
8526         . ./myread
8527         man3ext="$ans"
8528         ;;
8529 esac
8530
8531 : see if we have to deal with yellow pages, now NIS.
8532 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8533         if $test -f /usr/etc/nibindd; then
8534                 echo " "
8535                 echo "I'm fairly confident you're on a NeXT."
8536                 echo " "
8537                 rp='Do you get the hosts file via NetInfo?'
8538                 dflt=y
8539                 case "$hostcat" in
8540                 nidump*) ;;
8541                 '') ;;
8542                 *) dflt=n;;
8543                 esac
8544                 . ./myread
8545                 case "$ans" in
8546                 y*) hostcat='nidump hosts .';;
8547                 *)      case "$hostcat" in
8548                         nidump*) hostcat='';;
8549                         esac
8550                         ;;
8551                 esac
8552         fi
8553         case "$hostcat" in
8554         nidump*) ;;
8555         *)
8556                 case "$hostcat" in
8557                 *ypcat*) dflt=y;;
8558                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8559                                 dflt=y
8560                         else
8561                                 dflt=n
8562                         fi;;
8563                 *) dflt=n;;
8564                 esac
8565                 echo " "
8566                 rp='Are you getting the hosts file via yellow pages?'
8567                 . ./myread
8568                 case "$ans" in
8569                 y*) hostcat='ypcat hosts';;
8570                 *) hostcat='cat /etc/hosts';;
8571                 esac
8572                 ;;
8573         esac
8574 fi
8575 case "$hostcat" in
8576 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8577 esac
8578 case "$groupcat" in
8579 '') test -f /etc/group && groupcat='cat /etc/group';;
8580 esac
8581 case "$passcat" in
8582 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8583 esac
8584
8585 : now get the host name
8586 echo " "
8587 echo "Figuring out host name..." >&4
8588 case "$myhostname" in
8589 '') cont=true
8590         echo 'Maybe "hostname" will work...'
8591         if tans=`sh -c hostname 2>&1` ; then
8592                 myhostname=$tans
8593                 phostname=hostname
8594                 cont=''
8595         fi
8596         ;;
8597 *) cont='';;
8598 esac
8599 if $test "$cont"; then
8600         if ./xenix; then
8601                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8602                 if tans=`cat /etc/systemid 2>&1` ; then
8603                         myhostname=$tans
8604                         phostname='cat /etc/systemid'
8605                         echo "Whadyaknow.  Xenix always was a bit strange..."
8606                         cont=''
8607                 fi
8608         elif $test -r /etc/systemid; then
8609                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8610         fi
8611 fi
8612 if $test "$cont"; then
8613         echo 'No, maybe "uuname -l" will work...'
8614         if tans=`sh -c 'uuname -l' 2>&1` ; then
8615                 myhostname=$tans
8616                 phostname='uuname -l'
8617         else
8618                 echo 'Strange.  Maybe "uname -n" will work...'
8619                 if tans=`sh -c 'uname -n' 2>&1` ; then
8620                         myhostname=$tans
8621                         phostname='uname -n'
8622                 else
8623                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8624                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8625                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8626                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8627                         else
8628                                 case "$myhostname" in
8629                                 '') echo "Does this machine have an identity crisis or something?"
8630                                         phostname='';;
8631                                 *)
8632                                         echo "Well, you said $myhostname before..."
8633                                         phostname='echo $myhostname';;
8634                                 esac
8635                         fi
8636                 fi
8637         fi
8638 fi
8639 case "$myhostname" in
8640 '') myhostname=noname ;;
8641 esac
8642 : you do not want to know about this
8643 set $myhostname
8644 myhostname=$1
8645
8646 : verify guess
8647 if $test "$myhostname" ; then
8648         dflt=y
8649         rp='Your host name appears to be "'$myhostname'".'" Right?"
8650         . ./myread
8651         case "$ans" in
8652         y*) ;;
8653         *) myhostname='';;
8654         esac
8655 fi
8656
8657 : bad guess or no guess
8658 while $test "X$myhostname" = X ; do
8659         dflt=''
8660         rp="Please type the (one word) name of your host:"
8661         . ./myread
8662         myhostname="$ans"
8663 done
8664
8665 : translate upper to lower if necessary
8666 case "$myhostname" in
8667 *[A-Z]*)
8668         echo "(Normalizing case in your host name)"
8669         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8670         ;;
8671 esac
8672
8673 case "$myhostname" in
8674 *.*)
8675         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8676         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8677         echo "(Trimming domain name from host name--host name is now $myhostname)"
8678         ;;
8679 *) case "$mydomain" in
8680         '')
8681                 {
8682                         test "X$hostcat" = "Xypcat hosts" &&
8683                         ypmatch "$myhostname" hosts 2>/dev/null |\
8684                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8685                         $test -s hosts
8686                 } || {
8687                         test "X$hostcat" != "X" &&
8688                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8689                                         /[       ]$myhostname[  . ]/p" > hosts
8690                 }
8691                 tmp_re="[       . ]"
8692                 if $test -f hosts; then
8693                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8694                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8695                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8696                                 hosts | $sort | $uniq | \
8697                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8698                         case `$echo X$dflt` in
8699                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8700                                 dflt=.
8701                                 ;;
8702                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8703                                 ;;
8704                         esac
8705                 else
8706                         echo "(I cannot locate a hosts database anywhere)"
8707                         dflt=.
8708                 fi
8709                 case "$dflt" in
8710                 .)
8711                         tans=`./loc resolv.conf X /etc /usr/etc`
8712                         if $test -f "$tans"; then
8713                                 echo "(Attempting domain name extraction from $tans)"
8714                                 dflt=.`$sed -n -e 's/   / /g' \
8715                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8716                                   -e 1q 2>/dev/null`
8717                                 case "$dflt" in
8718                                 .) dflt=.`$sed -n -e 's/        / /g' \
8719                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8720                                      -e 1q 2>/dev/null`
8721                                         ;;
8722                                 esac
8723                         fi
8724                         ;;
8725                 esac
8726                 case "$dflt" in
8727                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8728                         dflt=.`sh -c domainname 2>/dev/null`
8729                         case "$dflt" in
8730                         '') dflt='.';;
8731                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8732                         esac
8733                         ;;
8734                 esac
8735                 case "$dflt$osname" in
8736                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8737                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8738                         ;;
8739                 esac
8740                 case "$dflt" in
8741                 .) echo "(Lost all hope -- silly guess then)"
8742                         dflt='.nonet'
8743                         ;;
8744                 esac
8745                 $rm -f hosts
8746                 ;;
8747         *) dflt="$mydomain";;
8748         esac;;
8749 esac
8750 echo " "
8751 rp="What is your domain name?"
8752 . ./myread
8753 tans="$ans"
8754 case "$ans" in
8755 '') ;;
8756 .*) ;;
8757 *) tans=".$tans";;
8758 esac
8759 mydomain="$tans"
8760
8761 : translate upper to lower if necessary
8762 case "$mydomain" in
8763 *[A-Z]*)
8764         echo "(Normalizing case in your domain name)"
8765         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8766         ;;
8767 esac
8768
8769 : a little sanity check here
8770 case "$phostname" in
8771 '') ;;
8772 *)
8773         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8774         $myhostname$mydomain|$myhostname) ;;
8775         *)
8776                 case "$phostname" in
8777                 sed*)
8778                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8779                         ;;
8780                 *)
8781                         echo "(That doesn't agree with your $phostname command, by the way.)"
8782                         ;;
8783                 esac
8784         ;;
8785         esac
8786         ;;
8787 esac
8788
8789 : determine the e-mail address of the user who is running us
8790 $cat <<EOM
8791
8792 I need to get your e-mail address in Internet format if possible, i.e.
8793 something like user@host.domain. Please answer accurately since I have
8794 no easy means to double check it. The default value provided below
8795 is most probably close to reality but may not be valid from outside
8796 your organization...
8797
8798 EOM
8799 cont=x
8800 while test "$cont"; do
8801         case "$cf_email" in
8802         '') dflt="$cf_by@$myhostname$mydomain";;
8803         *) dflt="$cf_email";;
8804         esac
8805         rp='What is your e-mail address?'
8806         . ./myread
8807         cf_email="$ans"
8808         case "$cf_email" in
8809         *@*.*) cont='' ;;
8810         *)
8811                 rp='Address does not look like an Internet one.  Use it anyway?'
8812                 case "$fastread" in
8813                 yes) dflt=y ;;
8814                 *) dflt=n ;;
8815                 esac
8816                 . ./myread
8817                 case "$ans" in
8818                 y*) cont='' ;;
8819                 *) echo " " ;;
8820                 esac
8821                 ;;
8822         esac
8823 done
8824
8825 : Ask e-mail of administrator
8826 $cat <<EOM
8827
8828 If you or somebody else will be maintaining perl at your site, please
8829 fill in the correct e-mail address here so that they may be contacted
8830 if necessary. Currently, the "perlbug" program included with perl
8831 will send mail to this address in addition to perlbug@perl.org. You may
8832 enter "none" for no administrator.
8833
8834 EOM
8835 case "$perladmin" in
8836 '') dflt="$cf_email";;
8837 *) dflt="$perladmin";;
8838 esac
8839 rp='Perl administrator e-mail address'
8840 . ./myread
8841 perladmin="$ans"
8842
8843 : determine whether to only install version-specific parts.
8844 echo " "
8845 $cat <<EOM
8846 Do you want to install only the version-specific parts of the perl
8847 distribution?  Usually you do *not* want to do this.
8848 EOM
8849 case "$versiononly" in
8850 "$define"|[Yy]*|true) dflt='y' ;;
8851 *) dflt='n';
8852 esac
8853 rp="Do you want to install only the version-specific parts of perl?"
8854 . ./myread
8855 case "$ans" in
8856 [yY]*)  val="$define";;
8857 *)      val="$undef" ;;
8858 esac
8859 set versiononly
8860 eval $setvar
8861
8862 case "$versiononly" in
8863 "$define") inc_version_list=''
8864            inc_version_list_init=0
8865            ;;
8866 esac
8867
8868 : figure out how to guarantee perl startup
8869 : XXX Note that this currently takes advantage of the bug that binexp ignores
8870 :     the Configure -Dinstallprefix setting, which in turn means that under
8871 :     relocatable @INC, initialinstalllocation is what binexp started as.
8872 case "$startperl" in
8873 '')
8874         case "$sharpbang" in
8875         *!)
8876                 $cat <<EOH
8877
8878 I can use the #! construct to start perl on your system. This will
8879 make startup of perl scripts faster, but may cause problems if you
8880 want to share those scripts and perl is not in a standard place
8881 ($initialinstalllocation/perl) on all your platforms. The alternative
8882 is to force a shell by starting the script with a single ':' character.
8883
8884 EOH
8885                 case "$versiononly" in
8886                 "$define")      dflt="$initialinstalllocation/perl$version";;
8887                 *)              dflt="$initialinstalllocation/perl";;
8888                 esac
8889                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8890                 . ./myread
8891                 case "$ans" in
8892                 none)   startperl=": # use perl";;
8893                 *)      startperl="#!$ans"
8894                         if $test 30 -lt `echo "$ans" | wc -c`; then
8895                                 $cat >&4 <<EOM
8896
8897 WARNING:  Some systems limit the #! command to 32 characters.
8898 If you experience difficulty running Perl scripts with #!, try
8899 installing Perl in a directory with a shorter pathname.
8900
8901 EOM
8902                         fi ;;
8903                 esac
8904                 ;;
8905         *) startperl=": # use perl"
8906                 ;;
8907         esac
8908         ;;
8909 esac
8910 echo "I'll use $startperl to start perl scripts."
8911
8912 : figure best path for perl in scripts
8913 case "$perlpath" in
8914 '')
8915         case "$versiononly" in
8916         "$define")      perlpath="$initialinstalllocation/perl$version";;
8917         *)              perlpath="$initialinstalllocation/perl";;
8918         esac
8919         case "$startperl" in
8920         *!*) ;;
8921         *)
8922                 $cat <<EOH
8923
8924 I will use the "eval 'exec'" idiom to start Perl on your system.
8925 I can use the full path of your Perl binary for this purpose, but
8926 doing so may cause problems if you want to share those scripts and
8927 Perl is not always in a standard place ($initialinstalllocation/perl).
8928
8929 EOH
8930                 dflt="$initialinstalllocation/perl"
8931                 rp="What path shall I use in \"eval 'exec'\"?"
8932                 . ./myread
8933                 perlpath="$ans"
8934                 ;;
8935         esac
8936         ;;
8937 esac
8938 case "$startperl" in
8939 *!*)    ;;
8940 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8941 esac
8942
8943 : determine where public executable scripts go
8944 set scriptdir scriptdir
8945 eval $prefixit
8946 case "$scriptdir" in
8947 '')
8948         dflt="$bin"
8949         : guess some guesses
8950         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8951         $test -d /usr/share/bin     && dflt=/usr/share/bin
8952         $test -d /usr/local/script  && dflt=/usr/local/script
8953         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8954         $test -d $prefixexp/script  && dflt=$prefixexp/script
8955         set dflt
8956         eval $prefixup
8957         ;;
8958 *)  dflt="$scriptdir"
8959         ;;
8960 esac
8961 $cat <<EOM
8962
8963 Some installations have a separate directory just for executable scripts so
8964 that they can mount it across multiple architectures but keep the scripts in
8965 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8966 Or you might just lump your scripts in with all your other executables.
8967
8968 EOM
8969 fn=d~
8970 rp='Where do you keep publicly executable scripts?'
8971 . ./getfile
8972 if $test "X$ansexp" != "X$scriptdirexp"; then
8973         installscript=''
8974 fi
8975 installscriptdir=''
8976 prefixvar=scriptdir
8977 . ./setprefixvar
8978 : A little fix up for an irregularly named variable.
8979 installscript="$installscriptdir"
8980
8981 : determine where add-on public executables go
8982 case "$sitebin" in
8983 '')     dflt=$siteprefix/bin ;;
8984 *)      dflt=$sitebin ;;
8985 esac
8986 fn=d~
8987 rp='Pathname where the add-on public executables should be installed?'
8988 . ./getfile
8989 prefixvar=sitebin
8990 . ./setprefixvar
8991
8992 : determine where add-on html pages go
8993 : There is no standard location, so try to copy the previously-selected
8994 : directory structure for the core html pages.
8995 case "$sitehtml1dir" in
8996 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8997 *)     dflt=$sitehtml1dir ;;
8998 esac
8999 case "$dflt" in
9000 ''|' ') dflt=none ;;
9001 esac
9002 fn=dn+~
9003 rp='Pathname where the site-specific html pages should be installed?'
9004 . ./getfile
9005 prefixvar=sitehtml1dir
9006 . ./setprefixvar
9007
9008 : determine where add-on library html pages go
9009 : There is no standard location, so try to copy the previously-selected
9010 : directory structure for the core html pages.
9011 case "$sitehtml3dir" in
9012 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9013 *)     dflt=$sitehtml3dir ;;
9014 esac
9015 case "$dflt" in
9016 ''|' ') dflt=none ;;
9017 esac
9018 fn=dn+~
9019 rp='Pathname where the site-specific library html pages should be installed?'
9020 . ./getfile
9021 prefixvar=sitehtml3dir
9022 . ./setprefixvar
9023
9024 : determine where add-on manual pages go
9025 case "$siteman1dir" in
9026 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9027 *)      dflt=$siteman1dir ;;
9028 esac
9029 case "$dflt" in
9030 ''|' ') dflt=none ;;
9031 esac
9032 fn=dn+~
9033 rp='Pathname where the site-specific manual pages should be installed?'
9034 . ./getfile
9035 prefixvar=siteman1dir
9036 . ./setprefixvar
9037
9038 : determine where add-on library man pages go
9039 case "$siteman3dir" in
9040 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9041 *)      dflt=$siteman3dir ;;
9042 esac
9043 case "$dflt" in
9044 ''|' ') dflt=none ;;
9045 esac
9046 fn=dn+~
9047 rp='Pathname where the site-specific library manual pages should be installed?'
9048 . ./getfile
9049 prefixvar=siteman3dir
9050 . ./setprefixvar
9051
9052 : determine where add-on public executable scripts go
9053 case "$sitescript" in
9054 '')     dflt=$siteprefix/script
9055         $test -d $dflt || dflt=$sitebin ;;
9056 *)  dflt="$sitescript" ;;
9057 esac
9058 fn=d~+
9059 rp='Pathname where add-on public executable scripts should be installed?'
9060 . ./getfile
9061 prefixvar=sitescript
9062 . ./setprefixvar
9063
9064 : Check if faststdio is requested and available
9065 case "$usefaststdio" in
9066 $define|true|[yY]*|'')
9067         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9068         case "$xversion" in
9069         [68])   dflt='y' ;;
9070         *)      dflt='n' ;;
9071         esac
9072         ;;
9073 *) dflt='n';;
9074 esac
9075 cat <<EOM
9076
9077 Perl can be built to use 'fast stdio', which means using the stdio
9078 library but also directly manipulating the stdio buffers to enable
9079 faster I/O.  Using stdio is better for backward compatibility (especially
9080 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9081 interface has been preferred instead of stdio.
9082
9083 If this doesn't make any sense to you, just accept the default '$dflt'.
9084 EOM
9085 rp='Use the "fast stdio" if available?'
9086 . ./myread
9087 case "$ans" in
9088 y|Y)    val="$define" ;;
9089 *)      val="$undef" ;;
9090 esac
9091 set usefaststdio
9092 eval $setvar
9093
9094
9095 : define an is-a-typedef? function
9096 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9097 case "$inclist" in
9098 "") inclist="sys/types.h";;
9099 esac;
9100 eval "varval=\$$var";
9101 case "$varval" in
9102 "")
9103         $rm -f temp.c;
9104         for inc in $inclist; do
9105                 echo "#include <$inc>" >>temp.c;
9106         done;
9107         echo "#ifdef $type" >> temp.c;
9108         echo "printf(\"We have $type\");" >> temp.c;
9109         echo "#endif" >> temp.c;
9110         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9111         if $contains $type temp.E >/dev/null 2>&1; then
9112                 eval "$var=\$type";
9113         else
9114                 eval "$var=\$def";
9115         fi;
9116         $rm -f temp.?;;
9117 *) eval "$var=\$varval";;
9118 esac'
9119
9120 : define an is-a-typedef? function that prompts if the type is not available.
9121 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9122 case "$inclist" in
9123 "") inclist="sys/types.h";;
9124 esac;
9125 eval "varval=\$$var";
9126 case "$varval" in
9127 "")
9128         $rm -f temp.c;
9129         for inc in $inclist; do
9130                 echo "#include <$inc>" >>temp.c;
9131         done;
9132         echo "#ifdef $type" >> temp.c;
9133         echo "printf(\"We have $type\");" >> temp.c;
9134         echo "#endif" >> temp.c;
9135         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9136         echo " " ;
9137         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9138         if $contains $type temp.E >/dev/null 2>&1; then
9139                 echo "$type found." >&4;
9140                 eval "$var=\$type";
9141         else
9142                 echo "$type NOT found." >&4;
9143                 dflt="$def";
9144                 . ./myread ;
9145                 eval "$var=\$ans";
9146         fi;
9147         $rm -f temp.?;;
9148 *) eval "$var=\$varval";;
9149 esac'
9150
9151 : see what type lseek is declared as in the kernel
9152 rp="What is the type used for lseek's offset on this system?"
9153 set off_t lseektype long stdio.h sys/types.h
9154 eval $typedef_ask
9155
9156 echo " "
9157 echo "Checking to see how big your file offsets are..." >&4
9158 $cat >try.c <<EOCP
9159 #include <sys/types.h>
9160 #include <stdio.h>
9161 int main()
9162 {
9163     printf("%d\n", (int)sizeof($lseektype));
9164     return(0);
9165 }
9166 EOCP
9167 set try
9168 if eval $compile_ok; then
9169         lseeksize=`$run ./try`
9170         echo "Your file offsets are $lseeksize bytes long."
9171 else
9172         dflt=$longsize
9173         echo " "
9174         echo "(I can't seem to compile the test program.  Guessing...)"
9175         rp="What is the size of your file offsets (in bytes)?"
9176         . ./myread
9177         lseeksize="$ans"
9178 fi
9179 $rm_try
9180
9181 : see what type file positions are declared as in the library
9182 rp="What is the type for file position used by fsetpos()?"
9183 set fpos_t fpostype long stdio.h sys/types.h
9184 eval $typedef_ask
9185
9186 : Check size for Fpos_t
9187 echo " "
9188 case "$fpostype" in
9189 *_t) zzz="$fpostype"    ;;
9190 *)   zzz="fpos_t"       ;;
9191 esac
9192 echo "Checking the size of $zzz..." >&4
9193 cat > try.c <<EOCP
9194 #include <sys/types.h>
9195 #include <stdio.h>
9196 #$i_stdlib I_STDLIB
9197 #ifdef I_STDLIB
9198 #include <stdlib.h>
9199 #endif
9200 int main() {
9201     printf("%d\n", (int)sizeof($fpostype));
9202     exit(0);
9203 }
9204 EOCP
9205 set try
9206 if eval $compile_ok; then
9207         yyy=`$run ./try`
9208         case "$yyy" in
9209         '')     fpossize=4
9210                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9211                 ;;
9212         *)      fpossize=$yyy
9213                 echo "Your $zzz is $fpossize bytes long."
9214                 ;;
9215         esac
9216 else
9217         dflt="$longsize"
9218         echo " " >&4
9219         echo "(I can't compile the test program.  Guessing...)" >&4
9220         rp="What is the size of your file positions (in bytes)?"
9221         . ./myread
9222         fpossize="$ans"
9223 fi
9224
9225 : Check for large file support
9226 # Backward compatibility (uselfs is deprecated).
9227 case "$uselfs" in
9228 "$define"|true|[yY]*)
9229         cat <<EOM >&4
9230
9231 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9232 EOM
9233         uselargefiles="$define"
9234         ;;
9235 esac
9236
9237 case "$lseeksize:$fpossize" in
9238 8:8) cat <<EOM
9239
9240 You can have files larger than 2 gigabytes.
9241 EOM
9242    val="$define" ;;
9243 *)    case "$uselargefiles" in
9244    "$undef"|false|[nN]*) dflt='n' ;;
9245    *)   dflt='y' ;;
9246    esac
9247    cat <<EOM
9248
9249 Perl can be built to understand large files (files larger than 2 gigabytes)
9250 on some systems.  To do so, Configure can be run with -Duselargefiles.
9251
9252 If this doesn't make any sense to you, just accept the default '$dflt'.
9253 EOM
9254    rp='Try to understand large files, if available?'
9255    . ./myread
9256    case "$ans" in
9257    y|Y)         val="$define" ;;
9258    *)           val="$undef"  ;;
9259    esac
9260    ;;
9261 esac
9262 set uselargefiles
9263 eval $setvar
9264 : Look for a hint-file generated 'call-back-unit'.  If the
9265 : user has specified that a large files perl is to be built,
9266 : we may need to set or change some other defaults.
9267 if $test -f uselargefiles.cbu; then
9268         echo "Your platform has some specific hints regarding large file builds, using them..."
9269         . ./uselargefiles.cbu
9270 fi
9271 case "$uselargefiles" in
9272 "$define")
9273         if $test -f uselargefiles.cbu; then
9274                 echo " "
9275                 echo "Rechecking to see how big your file offsets are..." >&4
9276                 $cat >try.c <<EOCP
9277 #include <sys/types.h>
9278 #include <stdio.h>
9279 int main()
9280 {
9281     printf("%d\n", (int)sizeof($lseektype));
9282     return(0);
9283 }
9284 EOCP
9285                 set try
9286                 if eval $compile_ok; then
9287                         lseeksize=`$run ./try`
9288                         $echo "Your file offsets are now $lseeksize bytes long."
9289                 else
9290                         dflt="$lseeksize"
9291                         echo " "
9292                         echo "(I can't seem to compile the test program.  Guessing...)"
9293                         rp="What is the size of your file offsets (in bytes)?"
9294                         . ./myread
9295                         lseeksize="$ans"
9296                 fi
9297                 case "$fpostype" in
9298                 *_t) zzz="$fpostype"    ;;
9299                 *)   zzz="fpos_t"       ;;
9300                 esac
9301                 $echo $n "Rechecking the size of $zzz...$c" >&4
9302                 $cat > try.c <<EOCP
9303 #include <sys/types.h>
9304 #include <stdio.h>
9305 #$i_stdlib I_STDLIB
9306 #ifdef I_STDLIB
9307 #include <stdlib.h>
9308 #endif
9309 int main() {
9310     printf("%d\n", (int)sizeof($fpostype));
9311     return(0);
9312 }
9313 EOCP
9314                 set try
9315                 if eval $compile_ok; then
9316                         yyy=`$run ./try`
9317                         dflt="$lseeksize"
9318                         case "$yyy" in
9319                         '')     echo " "
9320                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9321                                 ;;
9322                         *)      fpossize=$yyy
9323                                 echo " $fpossize bytes." >&4
9324                                 ;;
9325                         esac
9326                 else
9327                         dflt="$fpossize"
9328                         echo " "
9329                         echo "(I can't compile the test program.  Guessing...)" >&4
9330                         rp="What is the size of your file positions (in bytes)?"
9331                         . ./myread
9332                         fpossize="$ans"
9333                 fi
9334                 $rm_try
9335         fi
9336         ;;
9337 esac
9338
9339 : Check if we want perlio
9340 useperlio="$define"
9341
9342 : Set the vendorbin variables
9343 case "$vendorprefix" in
9344 '')     d_vendorbin="$undef"
9345         vendorbin=''
9346         vendorbinexp=''
9347         ;;
9348 *)      d_vendorbin="$define"
9349         : determine where vendor-supplied executables go.
9350         case "$vendorbin" in
9351         '') dflt=$vendorprefix/bin ;;
9352         *)      dflt="$vendorbin" ;;
9353         esac
9354         fn=d~+
9355         rp='Pathname for the vendor-supplied executables directory?'
9356         . ./getfile
9357         vendorbin="$ans"
9358         vendorbinexp="$ansexp"
9359         ;;
9360 esac
9361 prefixvar=vendorbin
9362 . ./installprefix
9363
9364 : Set the vendorhtml1dir variables
9365 case "$vendorprefix" in
9366 '')     vendorhtml1dir=''
9367         vendorhtml1direxp=''
9368         ;;
9369 *)      : determine where vendor-supplied html pages go.
9370         : There is no standard location, so try to copy the previously-selected
9371         : directory structure for the core html pages.
9372         : XXX Better default suggestions would be welcome.
9373         case "$vendorhtml1dir" in
9374         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9375         *)      dflt=$vendorhtml1dir ;;
9376         esac
9377         case "$dflt" in
9378         ''|' ') dflt=none ;;
9379         esac
9380         fn=dn+~
9381         rp='Pathname for the vendor-supplied html pages?'
9382         . ./getfile
9383         vendorhtml1dir="$ans"
9384         vendorhtml1direxp="$ansexp"
9385         ;;
9386 esac
9387 : Use ' ' for none so value is preserved next time through Configure
9388 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9389 prefixvar=vendorhtml1dir
9390 . ./installprefix
9391
9392 : Set the vendorhtml3dir variables
9393 case "$vendorprefix" in
9394 '')     vendorhtml3dir=''
9395         vendorhtml3direxp=''
9396         ;;
9397 *)      : determine where vendor-supplied module html pages go.
9398         : There is no standard location, so try to copy the previously-selected
9399         : directory structure for the core html pages.
9400         : XXX Better default suggestions would be welcome.
9401         case "$vendorhtml3dir" in
9402         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9403         *)      dflt=$vendorhtml3dir ;;
9404         esac
9405         case "$dflt" in
9406         ''|' ') dflt=none ;;
9407         esac
9408         fn=dn+~
9409         rp='Pathname for the vendor-supplied html pages?'
9410         . ./getfile
9411         vendorhtml3dir="$ans"
9412         vendorhtml3direxp="$ansexp"
9413         ;;
9414 esac
9415 : Use ' ' for none so value is preserved next time through Configure
9416 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9417 prefixvar=vendorhtml3dir
9418 . ./installprefix
9419
9420 : Set the vendorman1dir variables
9421 case "$vendorprefix" in
9422 '')     vendorman1dir=''
9423         vendorman1direxp=''
9424         ;;
9425 *)      : determine where vendor-supplied manual pages go.
9426         case "$vendorman1dir" in
9427         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9428         *)      dflt=$vendorman1dir ;;
9429         esac
9430         case "$dflt" in
9431         ''|' ') dflt=none ;;
9432         esac
9433         fn=nd~+
9434         rp='Pathname for the vendor-supplied manual section 1 pages?'
9435         . ./getfile
9436         vendorman1dir="$ans"
9437         vendorman1direxp="$ansexp"
9438         ;;
9439 esac
9440 : Use ' ' for none so value is preserved next time through Configure
9441 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9442 prefixvar=vendorman1dir
9443 . ./installprefix
9444
9445 : Set the vendorman3dir variables
9446 case "$vendorprefix" in
9447 '')     vendorman3dir=''
9448         vendorman3direxp=''
9449         ;;
9450 *)      : determine where vendor-supplied module manual pages go.
9451         case "$vendorman3dir" in
9452         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9453         *)      dflt=$vendorman3dir ;;
9454         esac
9455         case "$dflt" in
9456         ''|' ') dflt=none ;;
9457         esac
9458         fn=nd~+
9459         rp='Pathname for the vendor-supplied manual section 3 pages?'
9460         . ./getfile
9461         vendorman3dir="$ans"
9462         vendorman3direxp="$ansexp"
9463         ;;
9464 esac
9465 : Use ' ' for none so value is preserved next time through Configure
9466 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9467 prefixvar=vendorman3dir
9468 . ./installprefix
9469
9470 : Set the vendorscript variables
9471 case "$vendorprefix" in
9472 '')     d_vendorscript="$undef"
9473         vendorscript=''
9474         vendorscriptexp=''
9475         ;;
9476 *)      d_vendorscript="$define"
9477         : determine where vendor-supplied scripts go.
9478         case "$vendorscript" in
9479         '')     dflt=$vendorprefix/script
9480                 $test -d $dflt || dflt=$vendorbin ;;
9481         *)  dflt="$vendorscript" ;;
9482         esac
9483         $cat <<EOM
9484
9485 The installation process will create a directory for
9486 vendor-supplied scripts.
9487
9488 EOM
9489         fn=d~+
9490         rp='Pathname for the vendor-supplied scripts directory?'
9491         . ./getfile
9492         vendorscript="$ans"
9493         vendorscriptexp="$ansexp"
9494         ;;
9495 esac
9496 prefixvar=vendorscript
9497 . ./installprefix
9498
9499 : script used to emit important warnings
9500 cat >warn <<EOS
9501 $startsh
9502 if test \$# -gt 0; then
9503         echo "\$@" >msg
9504 else
9505         cat >msg
9506 fi
9507 echo "*** WARNING:" >&4
9508 sed -e 's/^/*** /' <msg >&4
9509 echo "*** " >&4
9510 cat msg >>config.msg
9511 echo " " >>config.msg
9512 rm -f msg
9513 EOS
9514 chmod +x warn
9515 $eunicefix warn
9516
9517 : see which of string.h or strings.h is needed
9518 echo " "
9519 strings=`./findhdr string.h`
9520 if $test "$strings" && $test -r "$strings"; then
9521         echo "Using <string.h> instead of <strings.h>." >&4
9522         val="$define"
9523 else
9524         val="$undef"
9525         strings=`./findhdr strings.h`
9526         if $test "$strings" && $test -r "$strings"; then
9527                 echo "Using <strings.h> instead of <string.h>." >&4
9528         else
9529                 ./warn "No string header found -- You'll surely have problems."
9530         fi
9531 fi
9532 set i_string
9533 eval $setvar
9534 case "$i_string" in
9535 "$undef") strings=`./findhdr strings.h`;;
9536 *)        strings=`./findhdr string.h`;;
9537 esac
9538
9539 : see if qgcvt exists
9540 set qgcvt d_qgcvt
9541 eval $inlibc
9542
9543 : Check print/scan long double stuff
9544 echo " "
9545
9546 if $test X"$d_longdbl" = X"$define"; then
9547
9548 echo "Checking how to print long doubles..." >&4
9549
9550 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9551         $cat >try.c <<'EOCP'
9552 #include <sys/types.h>
9553 #include <stdio.h>
9554 int main() {
9555   double d = 123.456;
9556   printf("%.3f\n", d);
9557 }
9558 EOCP
9559         set try
9560         if eval $compile; then
9561                 yyy=`$run ./try`
9562                 case "$yyy" in
9563                 123.456)
9564                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9565                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9566                         echo "We will use %f."
9567                         ;;
9568                 esac
9569         fi
9570 fi
9571
9572 if $test X"$sPRIfldbl" = X; then
9573         $cat >try.c <<'EOCP'
9574 #include <sys/types.h>
9575 #include <stdio.h>
9576 int main() {
9577   long double d = 123.456;
9578   printf("%.3Lf\n", d);
9579 }
9580 EOCP
9581         set try
9582         if eval $compile; then
9583                 yyy=`$run ./try`
9584                 case "$yyy" in
9585                 123.456)
9586                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9587                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9588                         echo "We will use %Lf."
9589                         ;;
9590                 esac
9591         fi
9592 fi
9593
9594 if $test X"$sPRIfldbl" = X; then
9595         $cat >try.c <<'EOCP'
9596 #include <sys/types.h>
9597 #include <stdio.h>
9598 int main() {
9599   long double d = 123.456;
9600   printf("%.3llf\n", d);
9601 }
9602 EOCP
9603         set try
9604         if eval $compile; then
9605                 yyy=`$run ./try`
9606                 case "$yyy" in
9607                 123.456)
9608                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9609                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9610                         echo "We will use %llf."
9611                         ;;
9612                 esac
9613         fi
9614 fi
9615
9616 if $test X"$sPRIfldbl" = X; then
9617         $cat >try.c <<'EOCP'
9618 #include <sys/types.h>
9619 #include <stdio.h>
9620 int main() {
9621   long double d = 123.456;
9622   printf("%.3lf\n", d);
9623 }
9624 EOCP
9625         set try
9626         if eval $compile; then
9627                 yyy=`$run ./try`
9628                 case "$yyy" in
9629                 123.456)
9630                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9631                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9632                         echo "We will use %lf."
9633                         ;;
9634                 esac
9635         fi
9636 fi
9637
9638 if $test X"$sPRIfldbl" = X; then
9639         echo "Cannot figure out how to print long doubles." >&4
9640 else
9641         sSCNfldbl=$sPRIfldbl    # expect consistency
9642 fi
9643
9644 $rm_try
9645
9646 fi # d_longdbl
9647
9648 case "$sPRIfldbl" in
9649 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9650         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9651         d_SCNfldbl="$undef";
9652         ;;
9653 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9654         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9655         d_SCNfldbl="$define";
9656         ;;
9657 esac
9658
9659 : Check how to convert floats to strings.
9660
9661 if test "X$d_Gconvert" = X; then
9662
9663 echo " "
9664 echo "Checking for an efficient way to convert floats to strings."
9665 echo " " > try.c
9666 case "$uselongdouble" in
9667 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9668 esac
9669 case "$d_longdbl" in
9670 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9671 esac
9672 case "$d_PRIgldbl" in
9673 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9674 esac
9675 $cat >>try.c <<EOP
9676 #ifdef TRY_gconvert
9677 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9678 char *myname = "gconvert";
9679 #endif
9680 #ifdef TRY_gcvt
9681 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9682 char *myname = "gcvt";
9683 #endif
9684 #ifdef TRY_qgcvt
9685 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9686 char *myname = "qgcvt";
9687 #define DOUBLETYPE long double
9688 #endif
9689 #ifdef TRY_sprintf
9690 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9691 #ifdef HAS_PRIgldbl
9692 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9693 #else
9694 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9695 #endif
9696 #else
9697 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9698 #endif
9699 char *myname = "sprintf";
9700 #endif
9701
9702 #ifndef DOUBLETYPE
9703 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9704 #define DOUBLETYPE long double
9705 #else
9706 #define DOUBLETYPE double
9707 #endif
9708 #endif
9709
9710 #include <stdio.h>
9711
9712 #$i_stdlib I_STDLIB
9713 #ifdef I_STDLIB
9714 #include <stdlib.h>
9715 #endif
9716 #$i_string I_STRING
9717 #ifdef I_STRING
9718 #  include <string.h>
9719 #else
9720 #  include <strings.h>
9721 #endif
9722
9723 int checkit(char *expect, char *got)
9724 {
9725     if (strcmp(expect, got)) {
9726                 printf("%s oddity:  Expected %s, got %s\n",
9727                         myname, expect, got);
9728                 exit(1);
9729         }
9730 }
9731
9732 int main()
9733 {
9734         char buf[64];
9735         buf[63] = '\0';
9736
9737         /* This must be 1st test on (which?) platform */
9738         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9739         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9740         checkit("0.1", buf);
9741
9742         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9743         checkit("0.01", buf);
9744
9745         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9746         checkit("0.001", buf);
9747
9748         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9749         checkit("0.0001", buf);
9750
9751         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9752         if (strlen(buf) > 5)
9753             checkit("9e-005", buf); /* for Microsoft ?? */
9754         else
9755             checkit("9e-05", buf);
9756
9757         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9758         checkit("1", buf);
9759
9760         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9761         checkit("1.1", buf);
9762
9763         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9764         checkit("1.01", buf);
9765
9766         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9767         checkit("1.001", buf);
9768
9769         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9770         checkit("1.0001", buf);
9771
9772         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9773         checkit("1.00001", buf);
9774
9775         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9776         checkit("1.000001", buf);
9777
9778         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9779         checkit("0", buf);
9780
9781         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9782         checkit("-1", buf);
9783
9784         /* Some Linux gcvt's give 1.e+5 here. */
9785         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9786         checkit("100000", buf);
9787
9788         /* Some Linux gcvt's give -1.e+5 here. */
9789         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9790         checkit("-100000", buf);
9791
9792         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9793         checkit("123.456", buf);
9794
9795         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9796         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9797         /* 34 should be enough to scare even long double
9798          * places into using the e notation. */
9799         if (strlen(buf) > 5)
9800             checkit("1e+034", buf); /* for Microsoft */
9801         else
9802             checkit("1e+34", buf);
9803
9804         /* For Perl, if you add additional tests here, also add them to
9805          * t/base/num.t for benefit of platforms not using Configure or
9806          * overriding d_Gconvert */
9807
9808         exit(0);
9809 }
9810 EOP
9811 : first add preferred functions to our list
9812 xxx_list=""
9813 for xxx_convert in $gconvert_preference; do
9814     case $xxx_convert in
9815     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9816     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9817     esac
9818 done
9819 : then add any others
9820 for xxx_convert in gconvert gcvt sprintf; do
9821     case "$xxx_list" in
9822     *$xxx_convert*) ;;
9823     *) xxx_list="$xxx_list $xxx_convert" ;;
9824     esac
9825 done
9826
9827 case "$d_longdbl$uselongdouble" in
9828 "$define$define")
9829     : again, add preferred functions to our list first
9830     xxx_ld_list=""
9831     for xxx_convert in $gconvert_ld_preference; do
9832         case $xxx_convert in
9833         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9834         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9835         esac
9836     done
9837     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9838     for xxx_convert in qgcvt sprintf $xxx_list; do
9839         case "$xxx_ld_list" in
9840         $xxx_convert*|*" $xxx_convert"*) ;;
9841         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9842         esac
9843     done
9844     : if sprintf cannot do long doubles, move it to the end
9845     if test "$d_PRIgldbl" != "$define"; then
9846         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9847     fi
9848     : if no qgcvt, remove it
9849     if test "$d_qgcvt" != "$define"; then
9850         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9851     fi
9852     : use the ld_list
9853     xxx_list="$xxx_ld_list"
9854     ;;
9855 esac
9856
9857 for xxx_convert in $xxx_list; do
9858         echo "Trying $xxx_convert..."
9859         $rm -f try try$_o core
9860         set try -DTRY_$xxx_convert
9861         if eval $compile; then
9862                 echo "$xxx_convert() found." >&4
9863                 if $run ./try; then
9864                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9865                         break;
9866                 else
9867                         echo "...But $xxx_convert didn't work as I expected."
9868                         xxx_convert=''
9869                 fi
9870         else
9871                 echo "$xxx_convert NOT found." >&4
9872         fi
9873 done
9874
9875 if test X$xxx_convert = X; then
9876     echo "*** WHOA THERE!!! ***" >&4
9877     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9878     xxx_convert=sprintf
9879 fi
9880
9881 case "$xxx_convert" in
9882 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9883 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9884 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9885 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9886    "$define$define$define")
9887       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9888    "$define$define$undef")
9889       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9890    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9891    esac
9892    ;;
9893 esac
9894
9895 fi
9896 $rm_try
9897
9898 : see if _fwalk exists
9899 set fwalk d__fwalk
9900 eval $inlibc
9901
9902 : Initialize h_fcntl
9903 h_fcntl=false
9904
9905 : Initialize h_sysfile
9906 h_sysfile=false
9907
9908 : access call always available on UNIX
9909 set access d_access
9910 eval $inlibc
9911
9912 : locate the flags for 'access()'
9913 case "$d_access" in
9914 "$define")
9915         echo " "
9916         $cat >access.c <<EOCP
9917 #include <sys/types.h>
9918 #ifdef I_FCNTL
9919 #include <fcntl.h>
9920 #endif
9921 #ifdef I_SYS_FILE
9922 #include <sys/file.h>
9923 #endif
9924 #ifdef I_UNISTD
9925 #include <unistd.h>
9926 #endif
9927 #$i_stdlib I_STDLIB
9928 #ifdef I_STDLIB
9929 #include <stdlib.h>
9930 #endif
9931 int main() {
9932         exit(R_OK);
9933 }
9934 EOCP
9935         : check sys/file.h first, no particular reason here
9936         if $test `./findhdr sys/file.h` && \
9937                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9938                 h_sysfile=true;
9939                 echo "<sys/file.h> defines the *_OK access constants." >&4
9940         elif $test `./findhdr fcntl.h` && \
9941                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9942                 h_fcntl=true;
9943                 echo "<fcntl.h> defines the *_OK access constants." >&4
9944         elif $test `./findhdr unistd.h` && \
9945                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9946                 echo "<unistd.h> defines the *_OK access constants." >&4
9947         else
9948                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9949         fi
9950         ;;
9951 esac
9952 $rm -f access*
9953
9954 : see if accessx exists
9955 set accessx d_accessx
9956 eval $inlibc
9957
9958 : see if aintl exists
9959 set aintl d_aintl
9960 eval $inlibc
9961
9962 : see if alarm exists
9963 set alarm d_alarm
9964 eval $inlibc
9965
9966 : see if 64bit time functions exists
9967
9968 set ctime64 d_ctime64
9969 eval $inlibc
9970
9971 set localtime64 d_localtime64
9972 eval $inlibc
9973
9974 set gmtime64 d_gmtime64
9975 eval $inlibc
9976
9977 set mktime64 d_mktime64
9978 eval $inlibc
9979
9980 set difftime64 d_difftime64
9981 eval $inlibc
9982
9983 set asctime64 d_asctime64
9984 eval $inlibc
9985
9986 : see if POSIX threads are available
9987 set pthread.h i_pthread
9988 eval $inhdr
9989
9990 : define a function to check prototypes
9991 $cat > protochk <<EOSH
9992 $startsh
9993 cc="$cc"
9994 optimize="$optimize"
9995 ccflags="$ccflags"
9996 prototype="$prototype"
9997 define="$define"
9998 rm_try="$rm_try"
9999 usethreads=$usethreads
10000 i_pthread=$i_pthread
10001 pthread_h_first=$pthread_h_first
10002 EOSH
10003
10004 $cat >> protochk <<'EOSH'
10005
10006 $rm_try
10007 foo="$1"
10008 shift
10009 while test $# -ge 2; do
10010         case "$1" in
10011                 $define) echo "#include <$2>" >> try.c ;;
10012                 literal) echo "$2" >> try.c ;;
10013         esac
10014     # Extra magic for the benefit of systems that need pthread.h
10015     # to be included early to correctly detect threadsafe functions.
10016     # Such functions must guarantee themselves, though, that the usethreads
10017     # and i_pthread have been defined, before calling protochk.
10018     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10019         echo "#include <pthread.h>" >> try.c
10020         pthread_h_done=yes
10021     fi
10022     shift 2
10023 done
10024 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10025 cat >> try.c <<'EOCP'
10026 #ifdef CAN_PROTOTYPE
10027 #define _(args) args
10028 #else
10029 #define _(args) ()
10030 #endif
10031 EOCP
10032 echo "$foo" >> try.c
10033 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10034 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10035 status=$?
10036 $rm_try
10037 exit $status
10038 EOSH
10039 chmod +x protochk
10040 $eunicefix protochk
10041
10042 : Define hasproto macro for Configure internal use
10043 hasproto='varname=$1; func=$2; shift; shift;
10044 while $test $# -ge 2; do
10045         case "$1" in
10046         $define) echo "#include <$2>";;
10047         esac ;
10048     shift 2;
10049 done > try.c;
10050 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10051 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10052         echo "$func() prototype found.";
10053         val="$define";
10054 else
10055         echo "$func() prototype NOT found.";
10056         val="$undef";
10057 fi;
10058 set $varname;
10059 eval $setvar;
10060 $rm_try tryout.c'
10061
10062 : see if sys/types.h has to be included
10063 set sys/types.h i_systypes
10064 eval $inhdr
10065
10066 : see if sys/select.h has to be included
10067 set sys/select.h i_sysselct
10068 eval $inhdr
10069
10070 : Define hasfield macro for Configure internal use
10071 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10072 while $test $# -ge 2; do
10073         case "$1" in
10074         $define) echo "#include <$2>";;
10075         esac ;
10076     shift 2;
10077 done > try.c;
10078 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10079 set try;
10080 if eval $compile; then
10081         val="$define";
10082 else
10083         val="$undef";
10084 fi;
10085 set $varname;
10086 eval $setvar;
10087 $rm_try'
10088
10089 : see if we should include time.h, sys/time.h, or both
10090 echo " "
10091 if test "X$timeincl" = X; then
10092         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10093         $echo $n "I'm now running the test program...$c"
10094         $cat >try.c <<EOCP
10095 #include <sys/types.h>
10096 #ifdef I_TIME
10097 #include <time.h>
10098 #endif
10099 #ifdef I_SYSTIME
10100 #ifdef SYSTIMEKERNEL
10101 #define KERNEL
10102 #endif
10103 #include <sys/time.h>
10104 #endif
10105 #ifdef I_SYSSELECT
10106 #include <sys/select.h>
10107 #endif
10108 #$i_stdlib I_STDLIB
10109 #ifdef I_STDLIB
10110 #include <stdlib.h>
10111 #endif
10112 int main()
10113 {
10114         struct tm foo;
10115 #ifdef S_TIMEVAL
10116         struct timeval bar;
10117 #endif
10118 #ifdef S_TIMEZONE
10119         struct timezone tzp;
10120 #endif
10121         if (foo.tm_sec == foo.tm_sec)
10122                 exit(0);
10123 #ifdef S_TIMEVAL
10124         if (bar.tv_sec == bar.tv_sec)
10125                 exit(0);
10126 #endif
10127         exit(1);
10128 }
10129 EOCP
10130         flags=''
10131         for s_timezone in '-DS_TIMEZONE' ''; do
10132         sysselect=''
10133         for s_timeval in '-DS_TIMEVAL' ''; do
10134         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10135         for i_time in '' '-DI_TIME'; do
10136         for i_systime in '-DI_SYSTIME' ''; do
10137                 case "$flags" in
10138                 '') $echo $n ".$c"
10139                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10140                         if eval $compile; then
10141                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10142                                 shift
10143                                 flags="$*"
10144                                 echo " "
10145                                 $echo $n "Succeeded with $flags$c"
10146                         fi
10147                         ;;
10148                 esac
10149         done
10150         done
10151         done
10152         done
10153         done
10154         timeincl=''
10155         echo " "
10156         case "$flags" in
10157         *SYSTIMEKERNEL*) i_systimek="$define"
10158                 timeincl=`./findhdr sys/time.h`
10159                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10160         *) i_systimek="$undef";;
10161         esac
10162         case "$flags" in
10163         *I_TIME*) i_time="$define"
10164                 timeincl=`./findhdr time.h`" $timeincl"
10165                 echo "We'll include <time.h>." >&4;;
10166         *) i_time="$undef";;
10167         esac
10168         case "$flags" in
10169         *I_SYSTIME*) i_systime="$define"
10170                 timeincl=`./findhdr sys/time.h`" $timeincl"
10171                 echo "We'll include <sys/time.h>." >&4;;
10172         *) i_systime="$undef";;
10173         esac
10174         $rm_try
10175 fi
10176 : see if struct tm knows about tm_zone
10177 case "$i_systime$i_time" in
10178 *$define*)
10179         echo " "
10180         echo "Checking to see if your struct tm has tm_zone field..." >&4
10181         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10182         eval $hasfield
10183         ;;
10184 *)      val="$undef"
10185         set d_tm_tm_zone
10186         eval $setvar
10187         ;;
10188 esac
10189 case "$d_tm_tm_zone" in
10190 "$define")      echo "Yes, it does."   ;;
10191 *)              echo "No, it doesn't." ;;
10192 esac
10193 : see if struct tm knows about tm_gmtoff
10194 case "$i_systime$i_time" in
10195 *$define*)
10196         echo " "
10197         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10198         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10199         eval $hasfield
10200         ;;
10201 *)      val="$undef"
10202         set d_tm_tm_gmtoff
10203         eval $setvar
10204         ;;
10205 esac
10206 case "$d_tm_tm_gmtoff" in
10207 "$define")      echo "Yes, it does."   ;;
10208 *)              echo "No, it doesn't." ;;
10209 esac
10210
10211 : see if asctime_r exists
10212 set asctime_r d_asctime_r
10213 eval $inlibc
10214 case "$d_asctime_r" in
10215 "$define")
10216         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10217         case "$d_asctime_r_proto:$usethreads" in
10218         ":define")      d_asctime_r_proto=define
10219                 set d_asctime_r_proto asctime_r $hdrs
10220                 eval $hasproto ;;
10221         *)      ;;
10222         esac
10223         case "$d_asctime_r_proto" in
10224         define)
10225         case "$asctime_r_proto" in
10226         ''|0) try='char* asctime_r(const struct tm*, char*);'
10227         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10228         esac
10229         case "$asctime_r_proto" in
10230         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10231         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10232         esac
10233         case "$asctime_r_proto" in
10234         ''|0) try='int asctime_r(const struct tm*, char*);'
10235         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10236         esac
10237         case "$asctime_r_proto" in
10238         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10239         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10240         esac
10241         case "$asctime_r_proto" in
10242         ''|0)   d_asctime_r=undef
10243                 asctime_r_proto=0
10244                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10245         * )     case "$asctime_r_proto" in
10246                 REENTRANT_PROTO*) ;;
10247                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10248                 esac
10249                 echo "Prototype: $try" ;;
10250         esac
10251         ;;
10252         *)      case "$usethreads" in
10253                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10254                 esac
10255                 d_asctime_r=undef
10256                 asctime_r_proto=0
10257                 ;;
10258         esac
10259         ;;
10260 *)      asctime_r_proto=0
10261         ;;
10262 esac
10263
10264 : see if atolf exists
10265 set atolf d_atolf
10266 eval $inlibc
10267
10268 : see if atoll exists
10269 set atoll d_atoll
10270 eval $inlibc
10271
10272 : Look for GCC-style attribute format
10273 case "$d_attribute_format" in
10274 '')
10275 echo " "
10276 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10277 $cat >attrib.c <<'EOCP'
10278 #include <stdio.h>
10279 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10280 EOCP
10281 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10282         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10283                 echo "Your C compiler doesn't support __attribute__((format))."
10284                 val="$undef"
10285         else
10286                 echo "Your C compiler supports __attribute__((format))."
10287                 val="$define"
10288         fi
10289 else
10290         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10291         val="$undef"
10292 fi
10293 ;;
10294 *) val="$d_attribute_format" ;;
10295 esac
10296 set d_attribute_format
10297 eval $setvar
10298 $rm -f attrib*
10299
10300 : Look for GCC-style attribute format with null format allowed
10301 case "$d_printf_format_null" in
10302 '') case "$d_attribute_format" in
10303     $define)
10304         echo " "
10305         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10306 $cat >attrib.c <<EOCP
10307 #include <stdio.h>
10308 #$i_stdlib I_STDLIB
10309 #ifdef I_STDLIB
10310 #include <stdlib.h>
10311 #endif
10312 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10313 int null_printf (char* pat,...) { return (int)pat; }
10314 int main () { exit(null_printf(NULL)); }
10315 EOCP
10316         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10317             : run the executable in case it produces a run-time warning
10318             if $run ./attrib >>attrib.out 2>&1; then
10319                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10320                     echo "Your C compiler doesn't allow __printf__ format to be null."
10321                     val="$undef"
10322                 else
10323                     echo "Your C compiler allows __printf__ format to be null."
10324                     val="$define"
10325                 fi
10326             else
10327             echo "Your C compiler executable failed with __printf__ format null."
10328             val="$undef"
10329         fi
10330     else
10331         echo "Your C compiler fails with __printf__ format null."
10332         val="$undef"
10333     fi
10334     ;;
10335     *)  val="$undef" ;;
10336     esac
10337 ;;
10338 *)  val="$d_printf_format_null" ;;
10339 esac
10340 set d_printf_format_null
10341 eval $setvar
10342 $rm -f attrib*
10343
10344 : Look for GCC-style attribute malloc
10345 case "$d_attribute_malloc" in
10346 '')
10347 echo " "
10348 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10349 $cat >attrib.c <<'EOCP'
10350 #include <stdio.h>
10351 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10352 EOCP
10353 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10354         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10355                 echo "Your C compiler doesn't support __attribute__((malloc))."
10356                 val="$undef"
10357         else
10358                 echo "Your C compiler supports __attribute__((malloc))."
10359                 val="$define"
10360         fi
10361 else
10362         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10363         val="$undef"
10364 fi
10365 ;;
10366 *) val="$d_attribute_malloc" ;;
10367 esac
10368 set d_attribute_malloc
10369 eval $setvar
10370 $rm -f attrib*
10371
10372 : Look for GCC-style attribute nonnull
10373 case "$d_attribute_nonnull" in
10374 '')
10375 echo " "
10376 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10377 $cat >attrib.c <<'EOCP'
10378 #include <stdio.h>
10379 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10380 EOCP
10381 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10382         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10383                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10384                 val="$undef"
10385         else
10386                 echo "Your C compiler supports __attribute__((nonnull))."
10387                 val="$define"
10388         fi
10389 else
10390         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10391         val="$undef"
10392 fi
10393 ;;
10394 *) val="$d_attribute_nonnull" ;;
10395 esac
10396 set d_attribute_nonnull
10397 eval $setvar
10398 $rm -f attrib*
10399
10400 : Look for GCC-style attribute noreturn
10401 case "$d_attribute_noreturn" in
10402 '')
10403 echo " "
10404 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10405 $cat >attrib.c <<'EOCP'
10406 #include <stdio.h>
10407 void fall_over_dead( void ) __attribute__((noreturn));
10408 EOCP
10409 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10410         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10411                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10412                 val="$undef"
10413         else
10414                 echo "Your C compiler supports __attribute__((noreturn))."
10415                 val="$define"
10416         fi
10417 else
10418         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10419         val="$undef"
10420 fi
10421 ;;
10422 *) val="$d_attribute_noreturn" ;;
10423 esac
10424 set d_attribute_noreturn
10425 eval $setvar
10426 $rm -f attrib*
10427
10428 : Look for GCC-style attribute pure
10429 case "$d_attribute_pure" in
10430 '')
10431 echo " "
10432 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10433 $cat >attrib.c <<'EOCP'
10434 #include <stdio.h>
10435 int square( int n ) __attribute__((pure));
10436 EOCP
10437 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10438         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10439                 echo "Your C compiler doesn't support __attribute__((pure))."
10440                 val="$undef"
10441         else
10442                 echo "Your C compiler supports __attribute__((pure))."
10443                 val="$define"
10444         fi
10445 else
10446         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10447         val="$undef"
10448 fi
10449 ;;
10450 *) val="$d_attribute_pure" ;;
10451 esac
10452 set d_attribute_pure
10453 eval $setvar
10454 $rm -f attrib*
10455
10456 : Look for GCC-style attribute unused
10457 case "$d_attribute_unused" in
10458 '')
10459 echo " "
10460 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10461 $cat >attrib.c <<'EOCP'
10462 #include <stdio.h>
10463 int do_something( int dummy __attribute__((unused)), int n );
10464 EOCP
10465 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10466         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10467                 echo "Your C compiler doesn't support __attribute__((unused))."
10468                 val="$undef"
10469         else
10470                 echo "Your C compiler supports __attribute__((unused))."
10471                 val="$define"
10472         fi
10473 else
10474         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10475         val="$undef"
10476 fi
10477 ;;
10478 *) val="$d_attribute_unused" ;;
10479 esac
10480 set d_attribute_unused
10481 eval $setvar
10482 $rm -f attrib*
10483
10484 : Look for GCC-style attribute deprecated
10485 case "$d_attribute_deprecated" in
10486 '')
10487 echo " "
10488 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10489 $cat >attrib.c <<'EOCP'
10490 #include <stdio.h>
10491 int I_am_deprecated(void) __attribute__((deprecated));
10492 EOCP
10493 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10494         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10495                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10496                 val="$undef"
10497         else
10498                 echo "Your C compiler supports __attribute__((deprecated))."
10499                 val="$define"
10500         fi
10501 else
10502         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10503         val="$undef"
10504 fi
10505 ;;
10506 *) val="$d_attribute_deprecated" ;;
10507 esac
10508 set d_attribute_deprecated
10509 eval $setvar
10510 $rm -f attrib*
10511
10512 : Look for GCC-style attribute warn_unused_result
10513 case "$d_attribute_warn_unused_result" in
10514 '')
10515 echo " "
10516 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10517 $cat >attrib.c <<'EOCP'
10518 #include <stdio.h>
10519 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10520 EOCP
10521 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10522         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10523                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10524                 val="$undef"
10525         else
10526                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10527                 val="$define"
10528         fi
10529 else
10530         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10531         val="$undef"
10532 fi
10533 ;;
10534 *) val="$d_attribute_warn_unused_result" ;;
10535 esac
10536 set d_attribute_warn_unused_result
10537 eval $setvar
10538 $rm -f attrib*
10539
10540 : see if bcmp exists
10541 set bcmp d_bcmp
10542 eval $inlibc
10543
10544 : see if bcopy exists
10545 set bcopy d_bcopy
10546 eval $inlibc
10547
10548 : see if getpgrp exists
10549 set getpgrp d_getpgrp
10550 eval $inlibc
10551
10552 case "$d_getpgrp" in
10553 "$define")
10554         echo " "
10555         echo "Checking to see which flavor of getpgrp is in use..."
10556         $cat >try.c <<EOP
10557 #$i_unistd I_UNISTD
10558 #include <sys/types.h>
10559 #ifdef I_UNISTD
10560 #  include <unistd.h>
10561 #endif
10562 #$i_stdlib I_STDLIB
10563 #ifdef I_STDLIB
10564 #include <stdlib.h>
10565 #endif
10566 int main()
10567 {
10568         if (getuid() == 0) {
10569                 printf("(I see you are running Configure as super-user...)\n");
10570                 setuid(1);
10571         }
10572 #ifdef TRY_BSD_PGRP
10573         if (getpgrp(1) == 0)
10574                 exit(0);
10575 #else
10576         if (getpgrp() > 0)
10577                 exit(0);
10578 #endif
10579         exit(1);
10580 }
10581 EOP
10582         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10583                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10584                 val="$define"
10585         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10586                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10587                 val="$undef"
10588         else
10589                 echo "I can't seem to compile and run the test program."
10590                 if ./usg; then
10591                         xxx="a USG one, i.e. you use getpgrp()."
10592                 else
10593                         # SVR4 systems can appear rather BSD-ish.
10594                         case "$i_unistd" in
10595                         $undef)
10596                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10597                                 val="$define"
10598                                 ;;
10599                         $define)
10600                                 xxx="probably a USG one, i.e. you use getpgrp()."
10601                                 val="$undef"
10602                                 ;;
10603                         esac
10604                 fi
10605                 echo "Assuming your getpgrp is $xxx" >&4
10606         fi
10607         ;;
10608 *) val="$undef";;
10609 esac
10610 set d_bsdgetpgrp
10611 eval $setvar
10612 $rm_try
10613
10614 : see if setpgrp exists
10615 set setpgrp d_setpgrp
10616 eval $inlibc
10617
10618 case "$d_setpgrp" in
10619 "$define")
10620         echo " "
10621         echo "Checking to see which flavor of setpgrp is in use..."
10622         $cat >try.c <<EOP
10623 #$i_unistd I_UNISTD
10624 #include <sys/types.h>
10625 #ifdef I_UNISTD
10626 #  include <unistd.h>
10627 #endif
10628 #$i_stdlib I_STDLIB
10629 #ifdef I_STDLIB
10630 #include <stdlib.h>
10631 #endif
10632 int main()
10633 {
10634         if (getuid() == 0) {
10635                 printf("(I see you are running Configure as super-user...)\n");
10636                 setuid(1);
10637         }
10638 #ifdef TRY_BSD_PGRP
10639         if (-1 == setpgrp(1, 1))
10640                 exit(0);
10641 #else
10642         if (setpgrp() != -1)
10643                 exit(0);
10644 #endif
10645         exit(1);
10646 }
10647 EOP
10648         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10649                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10650                 val="$define"
10651         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10652                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10653                 val="$undef"
10654         else
10655                 echo "(I can't seem to compile and run the test program.)"
10656                 if ./usg; then
10657                         xxx="a USG one, i.e. you use setpgrp()."
10658                 else
10659                         # SVR4 systems can appear rather BSD-ish.
10660                         case "$i_unistd" in
10661                         $undef)
10662                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10663                                 val="$define"
10664                                 ;;
10665                         $define)
10666                                 xxx="probably a USG one, i.e. you use setpgrp()."
10667                                 val="$undef"
10668                                 ;;
10669                         esac
10670                 fi
10671                 echo "Assuming your setpgrp is $xxx" >&4
10672         fi
10673         ;;
10674 *) val="$undef";;
10675 esac
10676 set d_bsdsetpgrp
10677 eval $setvar
10678 $rm_try
10679
10680 : Look for GCC-style __builtin_choose_expr
10681 case "$d_builtin_choose_expr" in
10682 '')
10683     echo " "
10684     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10685     $cat >try.c <<'EOCP'
10686 #include <assert.h>
10687 #include <stdlib.h>
10688 #include <stdio.h>
10689
10690 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10691
10692 int main(void) {
10693     assert( SYRINX(1) == 2112 );
10694     assert( SYRINX(1) != 5150 );
10695     assert( SYRINX(0) == 5150 );
10696     assert( SYRINX(0) != 2112 );
10697     puts( "All good!" );
10698     exit(0);
10699 }
10700
10701 EOCP
10702     set try
10703     if eval $compile && $run ./try; then
10704         echo "Your C compiler supports __builtin_choose_expr."
10705         val="$define"
10706     else
10707         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10708         val="$undef"
10709     fi
10710 ;;
10711 *) val="$d_builtin_choose_expr" ;;
10712 esac
10713
10714 set d_builtin_choose_expr
10715 eval $setvar
10716 $rm_try
10717
10718 : Look for GCC-style __builtin_expect
10719 case "$d_builtin_expect" in
10720 '')
10721     echo " "
10722     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10723     $cat >try.c <<'EOCP'
10724 int main(void) {
10725     int n = 50;
10726     if ( __builtin_expect(n, 0) ) n = 1;
10727     /* Remember shell exit code truth is 0, C truth is non-zero */
10728     return !(n == 1);
10729 }
10730 EOCP
10731     set try
10732     if eval $compile && $run ./try; then
10733         echo "Your C compiler supports __builtin_expect."
10734         val="$define"
10735     else
10736         echo "Your C compiler doesn't seem to understand __builtin_expect."
10737         val="$undef"
10738     fi
10739     ;;
10740 *) val="$d_builtin_expect" ;;
10741 esac
10742
10743 set d_builtin_expect
10744 eval $setvar
10745 $rm_try
10746
10747 : see if bzero exists
10748 set bzero d_bzero
10749 eval $inlibc
10750
10751 : see if stdarg is available
10752 echo " "
10753 if $test `./findhdr stdarg.h`; then
10754         echo "<stdarg.h> found." >&4
10755         valstd="$define"
10756 else
10757         echo "<stdarg.h> NOT found." >&4
10758         valstd="$undef"
10759 fi
10760
10761 : see if varags is available
10762 echo " "
10763 if $test `./findhdr varargs.h`; then
10764         echo "<varargs.h> found." >&4
10765 else
10766         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10767 fi
10768
10769 : set up the varargs testing programs
10770 $cat > varargs.c <<EOP
10771 #ifdef I_STDARG
10772 #include <stdarg.h>
10773 #endif
10774 #ifdef I_VARARGS
10775 #include <varargs.h>
10776 #endif
10777
10778 #ifdef I_STDARG
10779 int f(char *p, ...)
10780 #else
10781 int f(va_alist)
10782 va_dcl
10783 #endif
10784 {
10785         va_list ap;
10786 #ifndef I_STDARG
10787         char *p;
10788 #endif
10789 #ifdef I_STDARG
10790         va_start(ap,p);
10791 #else
10792         va_start(ap);
10793         p = va_arg(ap, char *);
10794 #endif
10795         va_end(ap);
10796         return 0;
10797 }
10798 EOP
10799 $cat > varargs <<EOP
10800 $startsh
10801 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10802         echo "true"
10803 else
10804         echo "false"
10805 fi
10806 $rm -f varargs$_o
10807 EOP
10808 chmod +x varargs
10809
10810 : now check which varargs header should be included
10811 echo " "
10812 i_varhdr=''
10813 case "$valstd" in
10814 "$define")
10815         if `./varargs I_STDARG`; then
10816                 val='stdarg.h'
10817         elif `./varargs I_VARARGS`; then
10818                 val='varargs.h'
10819         fi
10820         ;;
10821 *)
10822         if `./varargs I_VARARGS`; then
10823                 val='varargs.h'
10824         fi
10825         ;;
10826 esac
10827 case "$val" in
10828 '')
10829 echo "I could not find the definition for va_dcl... You have problems..." >&4
10830         val="$undef"; set i_stdarg; eval $setvar
10831         val="$undef"; set i_varargs; eval $setvar
10832         ;;
10833 *)
10834         set i_varhdr
10835         eval $setvar
10836         case "$i_varhdr" in
10837         stdarg.h)
10838                 val="$define"; set i_stdarg; eval $setvar
10839                 val="$undef"; set i_varargs; eval $setvar
10840                 ;;
10841         varargs.h)
10842                 val="$undef"; set i_stdarg; eval $setvar
10843                 val="$define"; set i_varargs; eval $setvar
10844                 ;;
10845         esac
10846         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10847 esac
10848 $rm -f varargs*
10849
10850 : see if the Compiler supports C99 variadic macros
10851 case "$i_stdarg$i_stdlib" in
10852     "$define$define")
10853     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10854     $cat >try.c <<EOCP
10855 #include <stdio.h>
10856 #include <stdarg.h>
10857
10858 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10859
10860 int main() {
10861   char buf[20];
10862   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10863   puts(buf);
10864   return 0;
10865 }
10866 EOCP
10867     set try
10868     if eval $compile && $run ./try 2>&1 >/dev/null; then
10869         case "`$run ./try`" in
10870             "123 456 789")
10871             echo "You have C99 variadic macros." >&4
10872             d_c99_variadic_macros="$define"
10873             ;;
10874             *)
10875             echo "You don't have functional C99 variadic macros." >&4
10876             d_c99_variadic_macros="$undef"
10877             ;;
10878         esac
10879     else
10880         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10881         d_c99_variadic_macros="$undef"
10882     fi
10883     $rm_try
10884     ;;
10885     *)
10886     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10887     d_c99_variadic_macros="$undef"
10888     ;;
10889 esac
10890
10891 : see if signal is declared as pointer to function returning int or void
10892 echo " "
10893 xxx=`./findhdr signal.h`
10894 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10895 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10896         echo "You have int (*signal())() instead of void." >&4
10897         val="$undef"
10898 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10899         echo "You have void (*signal())()." >&4
10900         val="$define"
10901 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10902         echo "You have int (*signal())() instead of void." >&4
10903         val="$undef"
10904 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10905         echo "You have void (*signal())()." >&4
10906         val="$define"
10907 else
10908         case "$d_voidsig" in
10909         '')
10910         echo "I can't determine whether signal handler returns void or int..." >&4
10911                 dflt=void
10912                 rp="What type does your signal handler return?"
10913                 . ./myread
10914                 case "$ans" in
10915                 v*) val="$define";;
10916                 *) val="$undef";;
10917                 esac;;
10918         "$define")
10919                 echo "As you already told me, signal handler returns void." >&4
10920                 val="$define"
10921                 ;;
10922         *)      echo "As you already told me, signal handler returns int." >&4
10923                 val="$undef"
10924                 ;;
10925         esac
10926 fi
10927 set d_voidsig
10928 eval $setvar
10929 case "$d_voidsig" in
10930 "$define") signal_t="void";;
10931 *) signal_t="int";;
10932 esac
10933 $rm -f $$.tmp
10934
10935 : check for ability to cast large floats to 32-bit ints.
10936 echo " "
10937 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10938 if $test "$intsize" -ge 4; then
10939         xxx=int
10940 else
10941         xxx=long
10942 fi
10943 $cat >try.c <<EOCP
10944 #include <stdio.h>
10945 #$i_stdlib I_STDLIB
10946 #ifdef I_STDLIB
10947 #include <stdlib.h>
10948 #endif
10949 #include <sys/types.h>
10950 #include <signal.h>
10951 $signal_t blech(int s) { exit(3); }
10952 int main()
10953 {
10954         $xxx i32;
10955         double f, g;
10956         int result = 0;
10957         char str[16];
10958         signal(SIGFPE, blech);
10959
10960         /* Don't let compiler optimize the test away.  Store the number
10961            in a writable string for gcc to pass to sscanf under HP-UX.
10962         */
10963         sprintf(str, "2147483647");
10964         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10965         g = 10 * f;
10966         i32  = ($xxx) g;
10967
10968         /* x86 processors will probably give 0x8000 0000, which is a
10969            sign change.  We don't want that.  We want to mimic SPARC
10970            behavior here, which is to preserve the sign and give
10971            back 0x7fff ffff.
10972         */
10973         if (i32 != ($xxx) f)
10974                 result |= 1;
10975         exit(result);
10976 }
10977 EOCP
10978 set try
10979 if eval $compile_ok; then
10980         $run ./try
10981         yyy=$?
10982 else
10983         echo "(I can't seem to compile the test program--assuming it can't)"
10984         yyy=1
10985 fi
10986 case "$yyy" in
10987 0)      val="$define"
10988         echo "Yup, it can."
10989         ;;
10990 *)      val="$undef"
10991         echo "Nope, it can't."
10992         ;;
10993 esac
10994 set d_casti32
10995 eval $setvar
10996 $rm_try
10997
10998 : check for ability to cast negative floats to unsigned
10999 echo " "
11000 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11001 $cat >try.c <<EOCP
11002 #include <stdio.h>
11003 #$i_stdlib I_STDLIB
11004 #ifdef I_STDLIB
11005 #include <stdlib.h>
11006 #endif
11007 #include <sys/types.h>
11008 #include <signal.h>
11009 $signal_t blech(int s) { exit(7); }
11010 $signal_t blech_in_list(int s) { exit(4); }
11011 unsigned long dummy_long(unsigned long p) { return p; }
11012 unsigned int dummy_int(unsigned int p) { return p; }
11013 unsigned short dummy_short(unsigned short p) { return p; }
11014 int main()
11015 {
11016         double f;
11017         unsigned long along;
11018         unsigned int aint;
11019         unsigned short ashort;
11020         int result = 0;
11021         char str[16];
11022
11023         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11024            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11025            optimized the whole file away
11026         */
11027         /* Store the number in a writable string for gcc to pass to
11028            sscanf under HP-UX.
11029         */
11030         sprintf(str, "-123");
11031         sscanf(str, "%lf", &f);  /* f = -123.; */
11032
11033         signal(SIGFPE, blech);
11034         along = (unsigned long)f;
11035         aint = (unsigned int)f;
11036         ashort = (unsigned short)f;
11037         if (along != (unsigned long)-123)
11038                 result |= 1;
11039         if (aint != (unsigned int)-123)
11040                 result |= 1;
11041         if (ashort != (unsigned short)-123)
11042                 result |= 1;
11043         sprintf(str, "1073741824.");
11044         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11045         f = f + f;
11046         along = 0;
11047         along = (unsigned long)f;
11048         if (along != 0x80000000)
11049                 result |= 2;
11050         f -= 1.;
11051         along = 0;
11052         along = (unsigned long)f;
11053         if (along != 0x7fffffff)
11054                 result |= 1;
11055         f += 2.;
11056         along = 0;
11057         along = (unsigned long)f;
11058         if (along != 0x80000001)
11059                 result |= 2;
11060         if (result)
11061                 exit(result);
11062         signal(SIGFPE, blech_in_list);
11063         sprintf(str, "123.");
11064         sscanf(str, "%lf", &f);  /* f = 123.; */
11065         along = dummy_long((unsigned long)f);
11066         aint = dummy_int((unsigned int)f);
11067         ashort = dummy_short((unsigned short)f);
11068         if (along != (unsigned long)123)
11069                 result |= 4;
11070         if (aint != (unsigned int)123)
11071                 result |= 4;
11072         if (ashort != (unsigned short)123)
11073                 result |= 4;
11074         exit(result);
11075
11076 }
11077 EOCP
11078 set try
11079 if eval $compile_ok; then
11080         $run ./try
11081         castflags=$?
11082 else
11083         echo "(I can't seem to compile the test program--assuming it can't)"
11084         castflags=7
11085 fi
11086 case "$castflags" in
11087 0)      val="$define"
11088         echo "Yup, it can."
11089         ;;
11090 *)      val="$undef"
11091         echo "Nope, it can't."
11092         ;;
11093 esac
11094 set d_castneg
11095 eval $setvar
11096 $rm_try
11097
11098 : see if vprintf exists
11099 echo " "
11100 if set vprintf val -f d_vprintf; eval $csym; $val; then
11101         echo 'vprintf() found.' >&4
11102         val="$define"
11103         $cat >try.c <<EOF
11104 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11105 #$i_varargs I_VARARGS
11106
11107 #$i_stdlib I_STDLIB
11108 #$i_unistd I_UNISTD
11109
11110 #ifdef I_STDARG
11111 #  include <stdarg.h>
11112 #else /* I_VARARGS */
11113 #  include <varargs.h>
11114 #endif
11115
11116 #ifdef I_UNISTD
11117 #  include <unistd.h>
11118 #endif
11119
11120 #ifdef I_STDLIB
11121 #  include <stdlib.h>
11122 #endif
11123
11124 #include <stdio.h> /* vsprintf prototype */
11125
11126 #ifdef I_STDARG
11127 void xxx(int n, ...)
11128 {
11129     va_list args;
11130     char buf[10];
11131     va_start(args, n);
11132     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11133 }
11134 int main() { xxx(1, "foo"); }
11135
11136 #else /* I_VARARGS */
11137
11138 xxx(va_alist)
11139 va_dcl
11140 {
11141     va_list args;
11142     char buf[10];
11143     va_start(args);
11144     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11145 }
11146 int main() { xxx("foo"); }
11147
11148 #endif
11149
11150 EOF
11151         set try
11152         if eval $compile_ok; then
11153                 if $run ./try; then
11154                         echo "Your vsprintf() returns (int)." >&4
11155                         val2="$undef"
11156                 else
11157                         echo "Your vsprintf() returns (char*)." >&4
11158                         val2="$define"
11159                 fi
11160         else
11161                 echo 'I am unable to compile the vsprintf() test program.' >&4
11162                 # We shouldn't get here.  If we do, assume the standard signature,
11163                 # not the old BSD one.
11164                 echo 'Guessing that vsprintf() returns (int).' >&4
11165                 val2="$undef"
11166         fi
11167 else
11168         echo 'vprintf() NOT found.' >&4
11169         val="$undef"
11170         val2="$undef"
11171 fi
11172 $rm_try
11173 set d_vprintf
11174 eval $setvar
11175 val=$val2
11176 set d_charvspr
11177 eval $setvar
11178
11179 : see if chown exists
11180 set chown d_chown
11181 eval $inlibc
11182
11183 : see if chroot exists
11184 set chroot d_chroot
11185 eval $inlibc
11186
11187 : see if chsize exists
11188 set chsize d_chsize
11189 eval $inlibc
11190
11191 : see if class exists
11192 set class d_class
11193 eval $inlibc
11194
11195 : see if clearenv exists
11196 set clearenv d_clearenv
11197 eval $inlibc
11198
11199 : Define hasstruct macro for Configure internal use
11200 hasstruct='varname=$1; struct=$2; shift; shift;
11201 while $test $# -ge 2; do
11202         case "$1" in
11203         $define) echo "#include <$2>";;
11204         esac ;
11205     shift 2;
11206 done > try.c;
11207 echo "int main () { struct $struct foo; }" >> try.c;
11208 set try;
11209 if eval $compile; then
11210         val="$define";
11211 else
11212         val="$undef";
11213 fi;
11214 set $varname;
11215 eval $setvar;
11216 $rm_try'
11217
11218 : see whether socket exists
11219 socketlib=''
11220 sockethdr=''
11221 echo " "
11222 $echo $n "Hmm... $c" >&4
11223 if set socket val -f d_socket; eval $csym; $val; then
11224         echo "Looks like you have Berkeley networking support." >&4
11225         d_socket="$define"
11226         if set setsockopt val -f; eval $csym; $val; then
11227                 d_oldsock="$undef"
11228         else
11229                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11230                 d_oldsock="$define"
11231         fi
11232 else
11233         if $contains socklib libc.list >/dev/null 2>&1; then
11234                 echo "Looks like you have Berkeley networking support." >&4
11235                 d_socket="$define"
11236                 : we will have to assume that it supports the 4.2 BSD interface
11237                 d_oldsock="$undef"
11238         else
11239                 echo "You don't have Berkeley networking in libc$_a..." >&4
11240                 if test "X$d_socket" = "X$define"; then
11241                    echo "...but you seem to believe that you have sockets." >&4
11242                 else
11243                         for net in net socket
11244                         do
11245                                 if test -f /usr/lib/lib$net$_a; then
11246                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11247                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11248                                         if $contains socket libc.list >/dev/null 2>&1; then
11249                                                 d_socket="$define"
11250                                                 socketlib="-l$net"
11251                                                 case "$net" in
11252                                                 net)
11253                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11254                                                         sockethdr="-I/usr/netinclude"
11255                                                         ;;
11256                                                 esac
11257                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11258                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11259                                                         d_oldsock="$undef"
11260                                                 else
11261                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11262                                                         d_oldsock="$define"
11263                                                 fi
11264                                                 break
11265                                         fi
11266                                 fi
11267                         done
11268                         if test "X$d_socket" != "X$define"; then
11269                            echo "or anywhere else I see." >&4
11270                            d_socket="$undef"
11271                            d_oldsock="$undef"
11272                         fi
11273                 fi
11274         fi
11275 fi
11276
11277 : see if socketpair exists
11278 set socketpair d_sockpair
11279 eval $inlibc
11280
11281
11282 echo " "
11283 echo "Checking the availability sa_len in the sock struct ..." >&4
11284 $cat >try.c <<EOF
11285 #include <sys/types.h>
11286 #include <sys/socket.h>
11287 int main() {
11288 struct sockaddr sa;
11289 return (sa.sa_len);
11290 }
11291 EOF
11292 val="$undef"
11293 set try; if eval $compile; then
11294         val="$define"
11295 fi
11296 set d_sockaddr_sa_len; eval $setvar
11297 $rm_try
11298
11299 echo " "
11300 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11301 $cat >try.c <<EOF
11302 #include <sys/types.h>
11303 #include <sys/socket.h>
11304 #include <netinet/in.h>
11305 int main() {
11306 struct sockaddr_in6 sin6;
11307 return (sin6.sin6_scope_id);
11308 }
11309 EOF
11310 val="$undef"
11311 set try; if eval $compile; then
11312         val="$define"
11313 fi
11314 set d_sin6_scope_id; eval $setvar
11315 $rm_try
11316
11317 echo " "
11318 echo "Checking the availability of certain socket constants..." >&4
11319 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11320         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11321         $cat >try.c <<EOF
11322 #include <sys/types.h>
11323 #include <sys/socket.h>
11324 int main() {
11325     int i = $ENUM;
11326 }
11327 EOF
11328         val="$undef"
11329         set try; if eval $compile; then
11330                 val="$define"
11331         fi
11332         set d_${enum}; eval $setvar
11333         $rm_try
11334 done
11335
11336 : see if this is a sys/uio.h system
11337 set sys/uio.h i_sysuio
11338 eval $inhdr
11339
11340 : Check for cmsghdr support
11341 echo " "
11342 echo "Checking to see if your system supports struct cmsghdr..." >&4
11343 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11344 eval $hasstruct
11345 case "$d_cmsghdr_s" in
11346 "$define")      echo "Yes, it does."   ;;
11347 *)              echo "No, it doesn't." ;;
11348 esac
11349
11350
11351 : check for const keyword
11352 echo " "
11353 echo 'Checking to see if your C compiler knows about "const"...' >&4
11354 $cat >const.c <<'EOCP'
11355 typedef struct spug { int drokk; } spug;
11356 int main()
11357 {
11358         const char *foo;
11359         const spug y = { 0 };
11360 }
11361 EOCP
11362 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11363         val="$define"
11364         echo "Yup, it does."
11365 else
11366         val="$undef"
11367         echo "Nope, it doesn't."
11368 fi
11369 set d_const
11370 eval $setvar
11371
11372 : see if copysignl exists
11373 set copysignl d_copysignl
11374 eval $inlibc
11375
11376 : see if crypt exists
11377 echo " "
11378 set crypt d_crypt
11379 eval $inlibc
11380 case "$d_crypt" in
11381 $define) cryptlib='' ;;
11382 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11383                 echo 'crypt() found.' >&4
11384                 val="$define"
11385                 cryptlib=''
11386         else
11387                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11388                 if $test -z "$cryptlib"; then
11389                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11390                 else
11391                         cryptlib=-lcrypt
11392                 fi
11393                 if $test -z "$cryptlib"; then
11394                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11395                 else
11396                         cryptlib=-lcrypt
11397                 fi
11398                 if $test -z "$cryptlib"; then
11399                         cryptlib=`./loc libcrypt$_a "" $libpth`
11400                 else
11401                         cryptlib=-lcrypt
11402                 fi
11403                 if $test -z "$cryptlib"; then
11404                         echo 'crypt() NOT found.' >&4
11405                         val="$undef"
11406                 else
11407                         val="$define"
11408                 fi
11409         fi
11410         set d_crypt
11411         eval $setvar
11412         ;;
11413 esac
11414
11415 : see if this is a crypt.h system
11416 set crypt.h i_crypt
11417 eval $inhdr
11418
11419 : see if crypt_r exists
11420 set crypt_r d_crypt_r
11421 eval $inlibc
11422 case "$d_crypt_r" in
11423 "$define")
11424         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11425         case "$d_crypt_r_proto:$usethreads" in
11426         ":define")      d_crypt_r_proto=define
11427                 set d_crypt_r_proto crypt_r $hdrs
11428                 eval $hasproto ;;
11429         *)      ;;
11430         esac
11431         case "$d_crypt_r_proto" in
11432         define)
11433         case "$crypt_r_proto" in
11434         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11435         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11436         esac
11437         case "$crypt_r_proto" in
11438         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11439         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11440         esac
11441         case "$crypt_r_proto" in
11442         ''|0)   d_crypt_r=undef
11443                 crypt_r_proto=0
11444                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11445         * )     case "$crypt_r_proto" in
11446                 REENTRANT_PROTO*) ;;
11447                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11448                 esac
11449                 echo "Prototype: $try" ;;
11450         esac
11451         ;;
11452         *)      case "$usethreads" in
11453                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11454                 esac
11455                 d_crypt_r=undef
11456                 crypt_r_proto=0
11457                 ;;
11458         esac
11459         ;;
11460 *)      crypt_r_proto=0
11461         ;;
11462 esac
11463
11464 : get csh whereabouts
11465 case "$csh" in
11466 'csh') val="$undef" ;;
11467 *) val="$define" ;;
11468 esac
11469 set d_csh
11470 eval $setvar
11471 : Respect a hint or command line value for full_csh.
11472 case "$full_csh" in
11473 '') full_csh=$csh ;;
11474 esac
11475
11476 : see if ctermid exists
11477 set ctermid d_ctermid
11478 eval $inlibc
11479
11480 : see if ctermid_r exists
11481 set ctermid_r d_ctermid_r
11482 eval $inlibc
11483 case "$d_ctermid_r" in
11484 "$define")
11485         hdrs="$i_systypes sys/types.h define stdio.h "
11486         case "$d_ctermid_r_proto:$usethreads" in
11487         ":define")      d_ctermid_r_proto=define
11488                 set d_ctermid_r_proto ctermid_r $hdrs
11489                 eval $hasproto ;;
11490         *)      ;;
11491         esac
11492         case "$d_ctermid_r_proto" in
11493         define)
11494         case "$ctermid_r_proto" in
11495         ''|0) try='char* ctermid_r(char*);'
11496         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11497         esac
11498         case "$ctermid_r_proto" in
11499         ''|0)   d_ctermid_r=undef
11500                 ctermid_r_proto=0
11501                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11502         * )     case "$ctermid_r_proto" in
11503                 REENTRANT_PROTO*) ;;
11504                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11505                 esac
11506                 echo "Prototype: $try" ;;
11507         esac
11508         ;;
11509         *)      case "$usethreads" in
11510                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11511                 esac
11512                 d_ctermid_r=undef
11513                 ctermid_r_proto=0
11514                 ;;
11515         esac
11516         ;;
11517 *)      ctermid_r_proto=0
11518         ;;
11519 esac
11520
11521 : see if ctime_r exists
11522 set ctime_r d_ctime_r
11523 eval $inlibc
11524 case "$d_ctime_r" in
11525 "$define")
11526         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11527         case "$d_ctime_r_proto:$usethreads" in
11528         ":define")      d_ctime_r_proto=define
11529                 set d_ctime_r_proto ctime_r $hdrs
11530                 eval $hasproto ;;
11531         *)      ;;
11532         esac
11533         case "$d_ctime_r_proto" in
11534         define)
11535         case "$ctime_r_proto" in
11536         ''|0) try='char* ctime_r(const time_t*, char*);'
11537         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11538         esac
11539         case "$ctime_r_proto" in
11540         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11541         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11542         esac
11543         case "$ctime_r_proto" in
11544         ''|0) try='int ctime_r(const time_t*, char*);'
11545         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11546         esac
11547         case "$ctime_r_proto" in
11548         ''|0) try='int ctime_r(const time_t*, char*, int);'
11549         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11550         esac
11551         case "$ctime_r_proto" in
11552         ''|0)   d_ctime_r=undef
11553                 ctime_r_proto=0
11554                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11555         * )     case "$ctime_r_proto" in
11556                 REENTRANT_PROTO*) ;;
11557                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11558                 esac
11559                 echo "Prototype: $try" ;;
11560         esac
11561         ;;
11562         *)      case "$usethreads" in
11563                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11564                 esac
11565                 d_ctime_r=undef
11566                 ctime_r_proto=0
11567                 ;;
11568         esac
11569         ;;
11570 *)      ctime_r_proto=0
11571         ;;
11572 esac
11573
11574 : see if cuserid exists
11575 set cuserid d_cuserid
11576 eval $inlibc
11577
11578 : see if this is a limits.h system
11579 set limits.h i_limits
11580 eval $inhdr
11581
11582 : see if this is a float.h system
11583 set float.h i_float
11584 eval $inhdr
11585
11586 : See if number of significant digits in a double precision number is known
11587 echo " "
11588 $cat >dbl_dig.c <<EOM
11589 #$i_limits I_LIMITS
11590 #$i_float I_FLOAT
11591 #ifdef I_LIMITS
11592 #include <limits.h>
11593 #endif
11594 #ifdef I_FLOAT
11595 #include <float.h>
11596 #endif
11597 #ifdef DBL_DIG
11598 printf("Contains DBL_DIG");
11599 #endif
11600 EOM
11601 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11602 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11603         echo "DBL_DIG found." >&4
11604         val="$define"
11605 else
11606         echo "DBL_DIG NOT found." >&4
11607         val="$undef"
11608 fi
11609 $rm -f dbl_dig.?
11610 set d_dbl_dig
11611 eval $setvar
11612
11613 : see if dbm.h is available
11614 : see if dbmclose exists
11615 set dbmclose d_dbmclose
11616 eval $inlibc
11617
11618 case "$d_dbmclose" in
11619 $define)
11620         set dbm.h i_dbm
11621         eval $inhdr
11622         case "$i_dbm" in
11623         $define)
11624                 val="$undef"
11625                 set i_rpcsvcdbm
11626                 eval $setvar
11627                 ;;
11628         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11629                 eval $inhdr
11630                 ;;
11631         esac
11632         ;;
11633 *)      echo "We won't be including <dbm.h>"
11634         val="$undef"
11635         set i_dbm
11636         eval $setvar
11637         val="$undef"
11638         set i_rpcsvcdbm
11639         eval $setvar
11640         ;;
11641 esac
11642
11643 : see if prototype for dbminit is available
11644 echo " "
11645 set d_dbminitproto dbminit $i_dbm dbm.h
11646 eval $hasproto
11647
11648 : see if difftime exists
11649 set difftime d_difftime
11650 eval $inlibc
11651
11652 : see if this is a dirent system
11653 echo " "
11654 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11655         val="$define"
11656         echo "<dirent.h> found." >&4
11657 else
11658         val="$undef"
11659         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11660                 echo "<sys/dir.h> found." >&4
11661                 echo " "
11662         else
11663                 xinc=`./findhdr sys/ndir.h`
11664         fi
11665         echo "<dirent.h> NOT found." >&4
11666 fi
11667 set i_dirent
11668 eval $setvar
11669
11670 : Look for type of directory structure.
11671 echo " "
11672 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11673
11674 case "$direntrytype" in
11675 ''|' ')
11676         case "$i_dirent" in
11677         $define) guess1='struct dirent' ;;
11678         *) guess1='struct direct'  ;;
11679         esac
11680         ;;
11681 *)      guess1="$direntrytype"
11682         ;;
11683 esac
11684
11685 case "$guess1" in
11686 'struct dirent') guess2='struct direct' ;;
11687 *) guess2='struct dirent' ;;
11688 esac
11689
11690 if $contains "$guess1" try.c >/dev/null 2>&1; then
11691         direntrytype="$guess1"
11692         echo "Your directory entries are $direntrytype." >&4
11693 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11694         direntrytype="$guess2"
11695         echo "Your directory entries seem to be $direntrytype." >&4
11696 else
11697         echo "I don't recognize your system's directory entries." >&4
11698         rp="What type is used for directory entries on this system?"
11699         dflt="$guess1"
11700         . ./myread
11701         direntrytype="$ans"
11702 fi
11703 $rm_try
11704
11705 : see if the directory entry stores field length
11706 echo " "
11707 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11708 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11709         echo "Good, your directory entry keeps length information in d_namlen." >&4
11710         val="$define"
11711 else
11712         echo "Your directory entry does not know about the d_namlen field." >&4
11713         val="$undef"
11714 fi
11715 set d_dirnamlen
11716 eval $setvar
11717 $rm_try
11718
11719 : Look for DIR.dd_fd
11720 case "$i_dirent" in
11721 "$define")
11722     echo "Checking to see if DIR has a dd_fd member variable" >&4
11723     $cat >try.c <<EOCP
11724 #$i_stdlib I_STDLIB
11725 #ifdef I_STDLIB
11726 #include <stdlib.h>
11727 #endif
11728 #include <dirent.h>
11729
11730 int main() {
11731     DIR dir;
11732     dir.dd_fd = 1;
11733     return 0;
11734 }
11735 EOCP
11736     val=$undef
11737     set try
11738     if eval $compile; then
11739         echo "Yes, it does."
11740         val="$define"
11741     else
11742         echo "No, it does not."
11743         val="$undef"
11744     fi
11745     ;;
11746 *)
11747     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11748     val="$undef"
11749     ;;
11750 esac
11751 set d_dir_dd_fd
11752 eval $setvar
11753 $rm_try
11754
11755 : see if this is an sysdir system
11756 set sys/dir.h i_sysdir
11757 eval $inhdr
11758
11759 : see if this is an sysndir system
11760 set sys/ndir.h i_sysndir
11761 eval $inhdr
11762
11763 : Look for dirfd
11764 echo " "
11765 $cat >dirfd.c <<EOM
11766 #include <stdio.h>
11767 #$i_stdlib I_STDLIB
11768 #ifdef I_STDLIB
11769 #include <stdlib.h>
11770 #endif
11771 #$i_dirent I_DIRENT             /**/
11772 #$i_sysdir I_SYS_DIR            /**/
11773 #$i_sysndir I_SYS_NDIR          /**/
11774 #$i_systypes I_SYS_TYPES        /**/
11775 #if defined(I_SYS_TYPES)
11776 #include <sys/types.h>
11777 #endif
11778 #if defined(I_DIRENT)
11779 #include <dirent.h>
11780 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11781 #include <sys/dir.h>
11782 #endif
11783 #else
11784 #ifdef I_SYS_NDIR
11785 #include <sys/ndir.h>
11786 #else
11787 #ifdef I_SYS_DIR
11788 #ifdef hp9000s500
11789 #include <ndir.h>       /* may be wrong in the future */
11790 #else
11791 #include <sys/dir.h>
11792 #endif
11793 #endif
11794 #endif
11795 #endif 
11796 int main() {
11797         DIR *dirp = opendir(".");
11798         if (dirfd(dirp) >= 0)
11799                 exit(0);
11800         else
11801                 exit(1);
11802 }
11803 EOM
11804 val=$undef
11805 set dirfd
11806 if eval $compile; then
11807         val="$define"
11808 fi
11809 case "$val" in
11810 $define)        echo "dirfd() found." >&4       ;;
11811 *)              echo "dirfd() NOT found." >&4   ;;
11812 esac
11813 set d_dirfd
11814 eval $setvar
11815 $rm -f dirfd*
11816
11817 : see if dlerror exists
11818 xxx_runnm="$runnm"
11819 runnm=false
11820 set dlerror d_dlerror
11821 eval $inlibc
11822 runnm="$xxx_runnm"
11823
11824 : see if dlfcn is available
11825 set dlfcn.h i_dlfcn
11826 eval $inhdr
11827
11828 : Check what extension to use for shared libs
11829 case "$usedl" in
11830 $define|y|true)
11831         $cat << EOM
11832
11833 On a few systems, the dynamically loaded modules that perl generates and uses
11834 will need a different extension than shared libs. The default will probably
11835 be appropriate.
11836
11837 EOM
11838         case "$dlext" in
11839         '')     dflt="$so" ;;
11840         *)      dflt="$dlext" ;;
11841         esac
11842         rp='What is the extension of dynamically loaded modules'
11843         . ./myread
11844         dlext="$ans"
11845         ;;
11846 *)
11847         dlext="none"
11848         ;;
11849 esac
11850
11851 : Check if dlsym need a leading underscore
11852 echo " "
11853 val="$undef"
11854
11855 case "$dlsrc" in
11856 dl_dlopen.xs)
11857         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11858         $cat >dyna.c <<'EOM'
11859 fred () { }
11860 EOM
11861
11862 $cat >fred.c<<EOM
11863
11864 #include <stdio.h>
11865 #$i_stdlib I_STDLIB
11866 #ifdef I_STDLIB
11867 #include <stdlib.h>
11868 #endif
11869 #$i_dlfcn I_DLFCN
11870 #ifdef I_DLFCN
11871 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11872 #else
11873 #include <sys/types.h>
11874 #include <nlist.h>
11875 #include <link.h>
11876 #endif
11877
11878 extern int fred() ;
11879
11880 int main()
11881 {
11882     void * handle ;
11883     void * symbol ;
11884 #ifndef RTLD_LAZY
11885     int mode = 1 ;
11886 #else
11887     int mode = RTLD_LAZY ;
11888 #endif
11889     handle = dlopen("./dyna.$dlext", mode) ;
11890     if (handle == NULL) {
11891         printf ("1\n") ;
11892         fflush (stdout) ;
11893         exit(0);
11894     }
11895     symbol = dlsym(handle, "fred") ;
11896     if (symbol == NULL) {
11897         /* try putting a leading underscore */
11898         symbol = dlsym(handle, "_fred") ;
11899         if (symbol == NULL) {
11900             printf ("2\n") ;
11901             fflush (stdout) ;
11902             exit(0);
11903         }
11904         printf ("3\n") ;
11905     }
11906     else
11907         printf ("4\n") ;
11908     fflush (stdout) ;
11909     exit(0);
11910 }
11911 EOM
11912         : Call the object file tmp-dyna.o in case dlext=o.
11913         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11914                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11915                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11916                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11917                 xxx=`$run ./fred`
11918                 case $xxx in
11919                 1)      echo "Test program failed using dlopen." >&4
11920                         echo "Perhaps you should not use dynamic loading." >&4;;
11921                 2)      echo "Test program failed using dlsym." >&4
11922                         echo "Perhaps you should not use dynamic loading." >&4;;
11923                 3)      echo "dlsym needs a leading underscore" >&4
11924                         val="$define" ;;
11925                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11926                 esac
11927         else
11928                 echo "I can't compile and run the test program." >&4
11929                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11930         fi
11931         ;;
11932 esac
11933
11934 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11935
11936 set d_dlsymun
11937 eval $setvar
11938
11939 : see if drand48_r exists
11940 set drand48_r d_drand48_r
11941 eval $inlibc
11942 case "$d_drand48_r" in
11943 "$define")
11944         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11945         case "$d_drand48_r_proto:$usethreads" in
11946         ":define")      d_drand48_r_proto=define
11947                 set d_drand48_r_proto drand48_r $hdrs
11948                 eval $hasproto ;;
11949         *)      ;;
11950         esac
11951         case "$d_drand48_r_proto" in
11952         define)
11953         case "$drand48_r_proto" in
11954         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11955         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11956         esac
11957         case "$drand48_r_proto" in
11958         ''|0)   d_drand48_r=undef
11959                 drand48_r_proto=0
11960                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11961         * )     case "$drand48_r_proto" in
11962                 REENTRANT_PROTO*) ;;
11963                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11964                 esac
11965                 echo "Prototype: $try" ;;
11966         esac
11967         ;;
11968         *)      case "$usethreads" in
11969                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11970                 esac
11971                 d_drand48_r=undef
11972                 drand48_r_proto=0
11973                 ;;
11974         esac
11975         ;;
11976 *)      drand48_r_proto=0
11977         ;;
11978 esac
11979
11980 : see if prototype for drand48 is available
11981 echo " "
11982 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11983 eval $hasproto
11984
11985 : see if dup2 exists
11986 set dup2 d_dup2
11987 eval $inlibc
11988
11989 : see if eaccess exists
11990 set eaccess d_eaccess
11991 eval $inlibc
11992
11993 : see if endgrent exists
11994 set endgrent d_endgrent
11995 eval $inlibc
11996
11997 : see if this is an grp system
11998 set grp.h i_grp
11999 eval $inhdr
12000
12001 case "$i_grp" in
12002 $define)
12003         xxx=`./findhdr grp.h`
12004         $cppstdin $cppflags $cppminus < $xxx >$$.h
12005
12006         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12007                 val="$define"
12008         else
12009                 val="$undef"
12010         fi
12011         set d_grpasswd
12012         eval $setvar
12013
12014         $rm -f $$.h
12015         ;;
12016 *)
12017         val="$undef";
12018         set d_grpasswd; eval $setvar
12019         ;;
12020 esac
12021
12022 : see if endgrent_r exists
12023 set endgrent_r d_endgrent_r
12024 eval $inlibc
12025 case "$d_endgrent_r" in
12026 "$define")
12027         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12028         case "$d_endgrent_r_proto:$usethreads" in
12029         ":define")      d_endgrent_r_proto=define
12030                 set d_endgrent_r_proto endgrent_r $hdrs
12031                 eval $hasproto ;;
12032         *)      ;;
12033         esac
12034         case "$d_endgrent_r_proto" in
12035         define)
12036         case "$endgrent_r_proto" in
12037         ''|0) try='int endgrent_r(FILE**);'
12038         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12039         esac
12040         case "$endgrent_r_proto" in
12041         ''|0) try='void endgrent_r(FILE**);'
12042         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12043         esac
12044         case "$endgrent_r_proto" in
12045         ''|0)   d_endgrent_r=undef
12046                 endgrent_r_proto=0
12047                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12048         * )     case "$endgrent_r_proto" in
12049                 REENTRANT_PROTO*) ;;
12050                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12051                 esac
12052                 echo "Prototype: $try" ;;
12053         esac
12054         ;;
12055         *)      case "$usethreads" in
12056                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12057                 esac
12058                 d_endgrent_r=undef
12059                 endgrent_r_proto=0
12060                 ;;
12061         esac
12062         ;;
12063 *)      endgrent_r_proto=0
12064         ;;
12065 esac
12066
12067 : see if endhostent exists
12068 set endhostent d_endhent
12069 eval $inlibc
12070
12071 : see if this is a netdb.h system
12072 set netdb.h i_netdb
12073 eval $inhdr
12074
12075 : see if endhostent_r exists
12076 set endhostent_r d_endhostent_r
12077 eval $inlibc
12078 case "$d_endhostent_r" in
12079 "$define")
12080         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12081         case "$d_endhostent_r_proto:$usethreads" in
12082         ":define")      d_endhostent_r_proto=define
12083                 set d_endhostent_r_proto endhostent_r $hdrs
12084                 eval $hasproto ;;
12085         *)      ;;
12086         esac
12087         case "$d_endhostent_r_proto" in
12088         define)
12089         case "$endhostent_r_proto" in
12090         ''|0) try='int endhostent_r(struct hostent_data*);'
12091         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12092         esac
12093         case "$endhostent_r_proto" in
12094         ''|0) try='void endhostent_r(struct hostent_data*);'
12095         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12096         esac
12097         case "$endhostent_r_proto" in
12098         ''|0)   d_endhostent_r=undef
12099                 endhostent_r_proto=0
12100                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12101         * )     case "$endhostent_r_proto" in
12102                 REENTRANT_PROTO*) ;;
12103                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12104                 esac
12105                 echo "Prototype: $try" ;;
12106         esac
12107         ;;
12108         *)      case "$usethreads" in
12109                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12110                 esac
12111                 d_endhostent_r=undef
12112                 endhostent_r_proto=0
12113                 ;;
12114         esac
12115         ;;
12116 *)      endhostent_r_proto=0
12117         ;;
12118 esac
12119
12120 : see if endnetent exists
12121 set endnetent d_endnent
12122 eval $inlibc
12123
12124 : see if endnetent_r exists
12125 set endnetent_r d_endnetent_r
12126 eval $inlibc
12127 case "$d_endnetent_r" in
12128 "$define")
12129         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12130         case "$d_endnetent_r_proto:$usethreads" in
12131         ":define")      d_endnetent_r_proto=define
12132                 set d_endnetent_r_proto endnetent_r $hdrs
12133                 eval $hasproto ;;
12134         *)      ;;
12135         esac
12136         case "$d_endnetent_r_proto" in
12137         define)
12138         case "$endnetent_r_proto" in
12139         ''|0) try='int endnetent_r(struct netent_data*);'
12140         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12141         esac
12142         case "$endnetent_r_proto" in
12143         ''|0) try='void endnetent_r(struct netent_data*);'
12144         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12145         esac
12146         case "$endnetent_r_proto" in
12147         ''|0)   d_endnetent_r=undef
12148                 endnetent_r_proto=0
12149                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12150         * )     case "$endnetent_r_proto" in
12151                 REENTRANT_PROTO*) ;;
12152                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12153                 esac
12154                 echo "Prototype: $try" ;;
12155         esac
12156         ;;
12157         *)      case "$usethreads" in
12158                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12159                 esac
12160                 d_endnetent_r=undef
12161                 endnetent_r_proto=0
12162                 ;;
12163         esac
12164         ;;
12165 *)      endnetent_r_proto=0
12166         ;;
12167 esac
12168
12169 : see if endprotoent exists
12170 set endprotoent d_endpent
12171 eval $inlibc
12172
12173 : see if endprotoent_r exists
12174 set endprotoent_r d_endprotoent_r
12175 eval $inlibc
12176 case "$d_endprotoent_r" in
12177 "$define")
12178         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12179         case "$d_endprotoent_r_proto:$usethreads" in
12180         ":define")      d_endprotoent_r_proto=define
12181                 set d_endprotoent_r_proto endprotoent_r $hdrs
12182                 eval $hasproto ;;
12183         *)      ;;
12184         esac
12185         case "$d_endprotoent_r_proto" in
12186         define)
12187         case "$endprotoent_r_proto" in
12188         ''|0) try='int endprotoent_r(struct protoent_data*);'
12189         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12190         esac
12191         case "$endprotoent_r_proto" in
12192         ''|0) try='void endprotoent_r(struct protoent_data*);'
12193         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12194         esac
12195         case "$endprotoent_r_proto" in
12196         ''|0)   d_endprotoent_r=undef
12197                 endprotoent_r_proto=0
12198                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12199         * )     case "$endprotoent_r_proto" in
12200                 REENTRANT_PROTO*) ;;
12201                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12202                 esac
12203                 echo "Prototype: $try" ;;
12204         esac
12205         ;;
12206         *)      case "$usethreads" in
12207                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12208                 esac
12209                 d_endprotoent_r=undef
12210                 endprotoent_r_proto=0
12211                 ;;
12212         esac
12213         ;;
12214 *)      endprotoent_r_proto=0
12215         ;;
12216 esac
12217
12218 : see if endpwent exists
12219 set endpwent d_endpwent
12220 eval $inlibc
12221
12222 : see if this is a pwd.h system
12223 set pwd.h i_pwd
12224 eval $inhdr
12225
12226 case "$i_pwd" in
12227 $define)
12228         xxx=`./findhdr pwd.h`
12229         $cppstdin $cppflags $cppminus < $xxx >$$.h
12230
12231         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12232                 val="$define"
12233         else
12234                 val="$undef"
12235         fi
12236         set d_pwquota
12237         eval $setvar
12238
12239         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12240                 val="$define"
12241         else
12242                 val="$undef"
12243         fi
12244         set d_pwage
12245         eval $setvar
12246
12247         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12248                 val="$define"
12249         else
12250                 val="$undef"
12251         fi
12252         set d_pwchange
12253         eval $setvar
12254
12255         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12256                 val="$define"
12257         else
12258                 val="$undef"
12259         fi
12260         set d_pwclass
12261         eval $setvar
12262
12263         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12264                 val="$define"
12265         else
12266                 val="$undef"
12267         fi
12268         set d_pwexpire
12269         eval $setvar
12270
12271         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12272                 val="$define"
12273         else
12274                 val="$undef"
12275         fi
12276         set d_pwcomment
12277         eval $setvar
12278
12279         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12280                 val="$define"
12281         else
12282                 val="$undef"
12283         fi
12284         set d_pwgecos
12285         eval $setvar
12286
12287         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12288                 val="$define"
12289         else
12290                 val="$undef"
12291         fi
12292         set d_pwpasswd
12293         eval $setvar
12294
12295         $rm -f $$.h
12296         ;;
12297 *)
12298         val="$undef"; 
12299         set d_pwquota; eval $setvar
12300         set d_pwage; eval $setvar
12301         set d_pwchange; eval $setvar
12302         set d_pwclass; eval $setvar
12303         set d_pwexpire; eval $setvar
12304         set d_pwcomment; eval $setvar
12305         set d_pwgecos; eval $setvar
12306         set d_pwpasswd; eval $setvar
12307         ;;
12308 esac
12309
12310 : see if endpwent_r exists
12311 set endpwent_r d_endpwent_r
12312 eval $inlibc
12313 case "$d_endpwent_r" in
12314 "$define")
12315         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12316         case "$d_endpwent_r_proto:$usethreads" in
12317         ":define")      d_endpwent_r_proto=define
12318                 set d_endpwent_r_proto endpwent_r $hdrs
12319                 eval $hasproto ;;
12320         *)      ;;
12321         esac
12322         case "$d_endpwent_r_proto" in
12323         define)
12324         case "$endpwent_r_proto" in
12325         ''|0) try='int endpwent_r(FILE**);'
12326         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12327         esac
12328         case "$endpwent_r_proto" in
12329         ''|0) try='void endpwent_r(FILE**);'
12330         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12331         esac
12332         case "$endpwent_r_proto" in
12333         ''|0)   d_endpwent_r=undef
12334                 endpwent_r_proto=0
12335                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12336         * )     case "$endpwent_r_proto" in
12337                 REENTRANT_PROTO*) ;;
12338                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12339                 esac
12340                 echo "Prototype: $try" ;;
12341         esac
12342         ;;
12343         *)      case "$usethreads" in
12344                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12345                 esac
12346                 d_endpwent_r=undef
12347                 endpwent_r_proto=0
12348                 ;;
12349         esac
12350         ;;
12351 *)      endpwent_r_proto=0
12352         ;;
12353 esac
12354
12355 : see if endservent exists
12356 set endservent d_endsent
12357 eval $inlibc
12358
12359 : see if endservent_r exists
12360 set endservent_r d_endservent_r
12361 eval $inlibc
12362 case "$d_endservent_r" in
12363 "$define")
12364         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12365         case "$d_endservent_r_proto:$usethreads" in
12366         ":define")      d_endservent_r_proto=define
12367                 set d_endservent_r_proto endservent_r $hdrs
12368                 eval $hasproto ;;
12369         *)      ;;
12370         esac
12371         case "$d_endservent_r_proto" in
12372         define)
12373         case "$endservent_r_proto" in
12374         ''|0) try='int endservent_r(struct servent_data*);'
12375         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12376         esac
12377         case "$endservent_r_proto" in
12378         ''|0) try='void endservent_r(struct servent_data*);'
12379         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12380         esac
12381         case "$endservent_r_proto" in
12382         ''|0)   d_endservent_r=undef
12383                 endservent_r_proto=0
12384                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12385         * )     case "$endservent_r_proto" in
12386                 REENTRANT_PROTO*) ;;
12387                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12388                 esac
12389                 echo "Prototype: $try" ;;
12390         esac
12391         ;;
12392         *)      case "$usethreads" in
12393                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12394                 esac
12395                 d_endservent_r=undef
12396                 endservent_r_proto=0
12397                 ;;
12398         esac
12399         ;;
12400 *)      endservent_r_proto=0
12401         ;;
12402 esac
12403
12404 : Locate the flags for 'open()'
12405 echo " "
12406 $cat >try.c <<EOCP
12407 #include <sys/types.h>
12408 #ifdef I_FCNTL
12409 #include <fcntl.h>
12410 #endif
12411 #ifdef I_SYS_FILE
12412 #include <sys/file.h>
12413 #endif
12414 #$i_stdlib I_STDLIB
12415 #ifdef I_STDLIB
12416 #include <stdlib.h>
12417 #endif
12418 int main() {
12419         if(O_RDONLY);
12420 #ifdef O_TRUNC
12421         exit(0);
12422 #else
12423         exit(1);
12424 #endif
12425 }
12426 EOCP
12427 : check sys/file.h first to get FREAD on Sun
12428 if $test `./findhdr sys/file.h` && \
12429                 set try -DI_SYS_FILE && eval $compile; then
12430         h_sysfile=true;
12431         echo "<sys/file.h> defines the O_* constants..." >&4
12432         if $run ./try; then
12433                 echo "and you have the 3 argument form of open()." >&4
12434                 val="$define"
12435         else
12436                 echo "but not the 3 argument form of open().  Oh, well." >&4
12437                 val="$undef"
12438         fi
12439 elif $test `./findhdr fcntl.h` && \
12440                 set try -DI_FCNTL && eval $compile; then
12441         h_fcntl=true;
12442         echo "<fcntl.h> defines the O_* constants..." >&4
12443         if $run ./try; then
12444                 echo "and you have the 3 argument form of open()." >&4
12445                 val="$define"
12446         else
12447                 echo "but not the 3 argument form of open().  Oh, well." >&4
12448                 val="$undef"
12449         fi
12450 else
12451         val="$undef"
12452         echo "I can't find the O_* constant definitions!  You got problems." >&4
12453 fi
12454 set d_open3
12455 eval $setvar
12456 $rm_try
12457
12458 : see if this is a sys/file.h system
12459 val=''
12460 set sys/file.h val
12461 eval $inhdr
12462
12463 : do we need to include sys/file.h ?
12464 case "$val" in
12465 "$define")
12466         echo " "
12467         if $h_sysfile; then
12468                 val="$define"
12469                 echo "We'll be including <sys/file.h>." >&4
12470         else
12471                 val="$undef"
12472                 echo "We won't be including <sys/file.h>." >&4
12473         fi
12474         ;;
12475 *)
12476         h_sysfile=false
12477         ;;
12478 esac
12479 set i_sysfile
12480 eval $setvar
12481
12482 : see if fcntl.h is there
12483 val=''
12484 set fcntl.h val
12485 eval $inhdr
12486
12487 : see if we can include fcntl.h
12488 case "$val" in
12489 "$define")
12490         echo " "
12491         if $h_fcntl; then
12492                 val="$define"
12493                 echo "We'll be including <fcntl.h>." >&4
12494         else
12495                 val="$undef"
12496                 if $h_sysfile; then
12497         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12498                 else
12499                         echo "We won't be including <fcntl.h>." >&4
12500                 fi
12501         fi
12502         ;;
12503 *)
12504         h_fcntl=false
12505         val="$undef"
12506         ;;
12507 esac
12508 set i_fcntl
12509 eval $setvar
12510
12511 : see if fork exists
12512 set fork d_fork
12513 eval $inlibc
12514
12515 : see if pipe exists
12516 set pipe d_pipe
12517 eval $inlibc
12518
12519 : check for non-blocking I/O stuff
12520 case "$h_sysfile" in
12521 true) echo "#include <sys/file.h>" > head.c;;
12522 *)
12523        case "$h_fcntl" in
12524        true) echo "#include <fcntl.h>" > head.c;;
12525        *) echo "#include <sys/fcntl.h>" > head.c;;
12526        esac
12527        ;;
12528 esac
12529 echo " "
12530 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12531 case "$o_nonblock" in
12532 '')
12533         $cat head.c > try.c
12534         $cat >>try.c <<EOCP
12535 #include <stdio.h>
12536 #$i_stdlib I_STDLIB
12537 #ifdef I_STDLIB
12538 #include <stdlib.h>
12539 #endif
12540 #$i_fcntl I_FCNTL
12541 #ifdef I_FCNTL
12542 #include <fcntl.h>
12543 #endif
12544 int main() {
12545 #ifdef O_NONBLOCK
12546         printf("O_NONBLOCK\n");
12547         exit(0);
12548 #endif
12549 #ifdef O_NDELAY
12550         printf("O_NDELAY\n");
12551         exit(0);
12552 #endif
12553 #ifdef FNDELAY
12554         printf("FNDELAY\n");
12555         exit(0);
12556 #endif
12557         exit(0);
12558 }
12559 EOCP
12560         set try
12561         if eval $compile_ok; then
12562                 o_nonblock=`$run ./try`
12563                 case "$o_nonblock" in
12564                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12565                 *) echo "Seems like we can use $o_nonblock.";;
12566                 esac
12567         else
12568                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12569         fi
12570         ;;
12571 *) echo "Using $hint value $o_nonblock.";;
12572 esac
12573 $rm_try
12574
12575 echo " "
12576 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12577 case "$eagain" in
12578 '')
12579         case "$d_fork:$d_pipe" in
12580         define:define)
12581         $cat head.c > try.c
12582         $cat >>try.c <<EOCP
12583 #include <errno.h>
12584 #include <sys/types.h>
12585 #include <signal.h>
12586 #include <stdio.h>
12587 #$i_stdlib I_STDLIB
12588 #ifdef I_STDLIB
12589 #include <stdlib.h>
12590 #endif
12591 #$i_fcntl I_FCNTL
12592 #ifdef I_FCNTL
12593 #include <fcntl.h>
12594 #endif
12595 #define MY_O_NONBLOCK $o_nonblock
12596 #ifndef errno  /* XXX need better Configure test */
12597 extern int errno;
12598 #endif
12599 #$i_unistd I_UNISTD
12600 #ifdef I_UNISTD
12601 #include <unistd.h>
12602 #endif
12603 #$i_string I_STRING
12604 #ifdef I_STRING
12605 #include <string.h>
12606 #else
12607 #include <strings.h>
12608 #endif
12609 $signal_t blech(int x) { exit(3); }
12610 EOCP
12611         $cat >> try.c <<'EOCP'
12612 int main()
12613 {
12614         int pd[2];
12615         int pu[2];
12616         char buf[1];
12617         char string[100];
12618
12619         pipe(pd);       /* Down: child -> parent */
12620         pipe(pu);       /* Up: parent -> child */
12621         if (0 != fork()) {
12622                 int ret;
12623                 close(pd[1]);   /* Parent reads from pd[0] */
12624                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12625 #ifdef F_SETFL
12626                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12627                         exit(1);
12628 #else
12629                 exit(4);
12630 #endif
12631                 signal(SIGALRM, blech);
12632                 alarm(5);
12633                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12634                         exit(2);
12635                 sprintf(string, "%d\n", ret);
12636                 write(2, string, strlen(string));
12637                 alarm(0);
12638 #ifdef EAGAIN
12639                 if (errno == EAGAIN) {
12640                         printf("EAGAIN\n");
12641                         goto ok;
12642                 }
12643 #endif
12644 #ifdef EWOULDBLOCK
12645                 if (errno == EWOULDBLOCK)
12646                         printf("EWOULDBLOCK\n");
12647 #endif
12648         ok:
12649                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12650                 sleep(2);                               /* Give it time to close our pipe */
12651                 alarm(5);
12652                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12653                 alarm(0);
12654                 sprintf(string, "%d\n", ret);
12655                 write(4, string, strlen(string));
12656                 exit(0);
12657         }
12658
12659         close(pd[0]);                   /* We write to pd[1] */
12660         close(pu[1]);                   /* We read from pu[0] */
12661         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12662         close(pd[1]);                   /* Pipe pd is now fully closed! */
12663         exit(0);                                /* Bye bye, thank you for playing! */
12664 }
12665 EOCP
12666         set try
12667         if eval $compile_ok; then
12668                 echo "$startsh" >mtry
12669                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12670                 chmod +x mtry
12671                 ./mtry >/dev/null 2>&1
12672                 case $? in
12673                 0) eagain=`$cat try.out`;;
12674                 1) echo "Could not perform non-blocking setting!";;
12675                 2) echo "I did a successful read() for something that was not there!";;
12676                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12677                 4) echo "Could not find F_SETFL!";;
12678                 *) echo "Something terribly wrong happened during testing.";;
12679                 esac
12680                 rd_nodata=`$cat try.ret`
12681                 echo "A read() system call with no data present returns $rd_nodata."
12682                 case "$rd_nodata" in
12683                 0|-1) ;;
12684                 *)
12685                         echo "(That's peculiar, fixing that to be -1.)"
12686                         rd_nodata=-1
12687                         ;;
12688                 esac
12689                 case "$eagain" in
12690                 '')
12691                         echo "Forcing errno EAGAIN on read() with no data available."
12692                         eagain=EAGAIN
12693                         ;;
12694                 *)
12695                         echo "Your read() sets errno to $eagain when no data is available."
12696                         ;;
12697                 esac
12698                 status=`$cat try.err`
12699                 case "$status" in
12700                 0) echo "And it correctly returns 0 to signal EOF.";;
12701                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12702                 *) echo "However, your read() returns '$status' on EOF??";;
12703                 esac
12704                 val="$define"
12705                 if test "$status" = "$rd_nodata"; then
12706                         echo "WARNING: you can't distinguish between EOF and no data!"
12707                         val="$undef"
12708                 fi
12709         else
12710                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12711                 eagain=EAGAIN
12712         fi
12713         ;;
12714         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12715                 eagain=EAGAIN
12716                 val="$define"
12717                 ;;
12718         esac
12719         set d_eofnblk
12720         eval $setvar
12721         ;;
12722 *)
12723         echo "Using $hint value $eagain."
12724         echo "Your read() returns $rd_nodata when no data is present."
12725         case "$d_eofnblk" in
12726         "$define") echo "And you can see EOF because read() returns 0.";;
12727         "$undef") echo "But you can't see EOF status from read() returned value.";;
12728         *)
12729                 echo "(Assuming you can't see EOF status from read anyway.)"
12730                 d_eofnblk=$undef
12731                 ;;
12732         esac
12733         ;;
12734 esac
12735 $rm_try head.c mtry
12736
12737 : see if _ptr and _cnt from stdio act std
12738 echo " "
12739
12740 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12741         echo "(Looks like you have stdio.h from BSD.)"
12742         case "$stdio_ptr" in
12743         '') stdio_ptr='((fp)->_p)'
12744                 ptr_lval=$define
12745                 ;;
12746         *)      ptr_lval=$d_stdio_ptr_lval;;
12747         esac
12748         case "$stdio_cnt" in
12749         '') stdio_cnt='((fp)->_r)'
12750                 cnt_lval=$define
12751                 ;;
12752         *)      cnt_lval=$d_stdio_cnt_lval;;
12753         esac
12754         case "$stdio_base" in
12755         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12756         esac
12757         case "$stdio_bufsiz" in
12758         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12759         esac
12760 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12761         echo "(Looks like you have stdio.h from Linux.)"
12762         case "$stdio_ptr" in
12763         '') stdio_ptr='((fp)->_IO_read_ptr)'
12764                 ptr_lval=$define
12765                 ;;
12766         *)      ptr_lval=$d_stdio_ptr_lval;;
12767         esac
12768         case "$stdio_cnt" in
12769         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12770                 cnt_lval=$undef
12771                 ;;
12772         *)      cnt_lval=$d_stdio_cnt_lval;;
12773         esac
12774         case "$stdio_base" in
12775         '') stdio_base='((fp)->_IO_read_base)';;
12776         esac
12777         case "$stdio_bufsiz" in
12778         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12779         esac
12780 else
12781         case "$stdio_ptr" in
12782         '') stdio_ptr='((fp)->_ptr)'
12783                 ptr_lval=$define
12784                 ;;
12785         *)      ptr_lval=$d_stdio_ptr_lval;;
12786         esac
12787         case "$stdio_cnt" in
12788         '') stdio_cnt='((fp)->_cnt)'
12789                 cnt_lval=$define
12790                 ;;
12791         *)      cnt_lval=$d_stdio_cnt_lval;;
12792         esac
12793         case "$stdio_base" in
12794         '') stdio_base='((fp)->_base)';;
12795         esac
12796         case "$stdio_bufsiz" in
12797         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12798         esac
12799 fi
12800
12801 : test whether _ptr and _cnt really work
12802 echo "Checking how std your stdio is..." >&4
12803 $cat >try.c <<EOP
12804 #include <stdio.h>
12805 #$i_stdlib I_STDLIB
12806 #ifdef I_STDLIB
12807 #include <stdlib.h>
12808 #endif
12809 #define FILE_ptr(fp)    $stdio_ptr
12810 #define FILE_cnt(fp)    $stdio_cnt
12811 int main() {
12812         FILE *fp = fopen("try.c", "r");
12813         char c = getc(fp);
12814         if (
12815                 18 <= FILE_cnt(fp) &&
12816                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12817         )
12818                 exit(0);
12819         exit(1);
12820 }
12821 EOP
12822 val="$undef"
12823 set try
12824 if eval $compile && $to try.c; then
12825         if $run ./try; then
12826                 echo "Your stdio acts pretty std."
12827                 val="$define"
12828         else
12829                 echo "Your stdio isn't very std."
12830         fi
12831 else
12832         echo "Your stdio doesn't appear very std."
12833 fi
12834 $rm_try
12835
12836 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12837 # direct buffer manipulation no longer works.  The Configure tests
12838 # should be changed to correctly detect this, but until then,
12839 # the following check should at least let perl compile and run.
12840 # (This quick fix should be updated before 5.8.1.)
12841 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12842 # A. Dougherty, June 3, 2002.
12843 case "$d_gnulibc" in
12844 $define)
12845         case "$gnulibc_version" in
12846         2.[01]*)  ;;
12847         2.2) ;;
12848         2.2.[0-9]) ;;
12849         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12850                 val="$undef"
12851                 ;;
12852         esac
12853         ;;
12854 esac
12855 set d_stdstdio
12856 eval $setvar
12857
12858 : Can _ptr be used as an lvalue?
12859 case "$d_stdstdio$ptr_lval" in
12860 $define$define) val=$define ;;
12861 *) val=$undef ;;
12862 esac
12863 set d_stdio_ptr_lval
12864 eval $setvar
12865
12866 : Can _cnt be used as an lvalue?
12867 case "$d_stdstdio$cnt_lval" in
12868 $define$define) val=$define ;;
12869 *) val=$undef ;;
12870 esac
12871 set d_stdio_cnt_lval
12872 eval $setvar
12873
12874
12875 : test whether setting _ptr sets _cnt as a side effect
12876 d_stdio_ptr_lval_sets_cnt="$undef"
12877 d_stdio_ptr_lval_nochange_cnt="$undef"
12878 case "$d_stdio_ptr_lval$d_stdstdio" in
12879 $define$define)
12880         echo "Checking to see what happens if we set the stdio ptr..." >&4
12881 $cat >try.c <<EOP
12882 #include <stdio.h>
12883 /* Can we scream? */
12884 /* Eat dust sed :-) */
12885 /* In the buffer space, no one can hear you scream. */
12886 #$i_stdlib I_STDLIB
12887 #ifdef I_STDLIB
12888 #include <stdlib.h>
12889 #endif
12890 #define FILE_ptr(fp)    $stdio_ptr
12891 #define FILE_cnt(fp)    $stdio_cnt
12892 #include <sys/types.h>
12893 int main() {
12894         FILE *fp = fopen("try.c", "r");
12895         int c;
12896         char *ptr;
12897         size_t cnt;
12898         if (!fp) {
12899             puts("Fail even to read");
12900             exit(1);
12901         }
12902         c = getc(fp); /* Read away the first # */
12903         if (c == EOF) {
12904             puts("Fail even to read");
12905             exit(1);
12906         }
12907         if (!(
12908                 18 <= FILE_cnt(fp) &&
12909                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12910         )) {
12911                 puts("Fail even to read");
12912                 exit (1);
12913         }
12914         ptr = (char*) FILE_ptr(fp);
12915         cnt = (size_t)FILE_cnt(fp);
12916
12917         FILE_ptr(fp) += 42;
12918
12919         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12920                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12921                 exit (1);
12922         }
12923         if (FILE_cnt(fp) <= 20) {
12924                 printf ("Fail (<20 chars to test)");
12925                 exit (1);
12926         }
12927         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12928                 puts("Fail compare");
12929                 exit (1);
12930         }
12931         if (cnt == FILE_cnt(fp)) {
12932                 puts("Pass_unchanged");
12933                 exit (0);
12934         }
12935         if (FILE_cnt(fp) == (cnt - 42)) {
12936                 puts("Pass_changed");
12937                 exit (0);
12938         }
12939         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12940         return 1;
12941
12942 }
12943 EOP
12944         set try
12945         if eval $compile && $to try.c; then
12946                 case `$run ./try` in
12947                 Pass_changed)
12948                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12949                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12950                 Pass_unchanged)
12951                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12952                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12953                 Fail*)
12954                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12955                 *)
12956                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12957         esac
12958         else
12959                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12960         fi
12961         $rm_try
12962         ;;
12963 esac
12964
12965 : see if _base is also standard
12966 val="$undef"
12967 case "$d_stdstdio" in
12968 $define)
12969         $cat >try.c <<EOP
12970 #include <stdio.h>
12971 #$i_stdlib I_STDLIB
12972 #ifdef I_STDLIB
12973 #include <stdlib.h>
12974 #endif
12975 #define FILE_base(fp)   $stdio_base
12976 #define FILE_bufsiz(fp) $stdio_bufsiz
12977 int main() {
12978         FILE *fp = fopen("try.c", "r");
12979         char c = getc(fp);
12980         if (
12981                 19 <= FILE_bufsiz(fp) &&
12982                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12983         )
12984                 exit(0);
12985         exit(1);
12986 }
12987 EOP
12988         set try
12989         if eval $compile && $to try.c; then
12990                 if $run ./try; then
12991                         echo "And its _base field acts std."
12992                         val="$define"
12993                 else
12994                         echo "But its _base field isn't std."
12995                 fi
12996         else
12997                 echo "However, it seems to be lacking the _base field."
12998         fi
12999         $rm_try
13000         ;;
13001 esac
13002 set d_stdiobase
13003 eval $setvar
13004
13005 : see if fast_stdio exists
13006 val="$undef"
13007 case "$d_stdstdio:$d_stdio_ptr_lval" in
13008 "$define:$define")
13009         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13010         *$define*)
13011                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13012                 val="$define"
13013                 ;;
13014         esac
13015         ;;
13016 esac
13017 set d_faststdio
13018 eval $setvar
13019
13020
13021
13022 : see if fchdir exists
13023 set fchdir d_fchdir
13024 eval $inlibc
13025
13026 : see if fchmod exists
13027 set fchmod d_fchmod
13028 eval $inlibc
13029
13030 : see if fchown exists
13031 set fchown d_fchown
13032 eval $inlibc
13033
13034 : see if this is an fcntl system
13035 set fcntl d_fcntl
13036 eval $inlibc
13037
13038 : See if fcntl-based locking works.
13039 echo " "
13040 $cat >try.c <<EOCP
13041 #$i_stdlib I_STDLIB
13042 #ifdef I_STDLIB
13043 #include <stdlib.h>
13044 #endif
13045 #include <unistd.h>
13046 #include <fcntl.h>
13047 #include <signal.h>
13048 $signal_t blech(int x) { exit(3); }
13049 int main() {
13050 #if defined(F_SETLK) && defined(F_SETLKW)
13051      struct flock flock;
13052      int retval, fd;
13053      fd = open("try.c", O_RDONLY);
13054      flock.l_type = F_RDLCK;
13055      flock.l_whence = SEEK_SET;
13056      flock.l_start = flock.l_len = 0;
13057      signal(SIGALRM, blech);
13058      alarm(10);
13059      retval = fcntl(fd, F_SETLK, &flock);
13060      close(fd);
13061      (retval < 0 ? exit(2) : exit(0));
13062 #else
13063      exit(2);
13064 #endif
13065 }
13066 EOCP
13067 echo "Checking if fcntl-based file locking works... "
13068 case "$d_fcntl" in
13069 "$define")
13070         set try
13071         if eval $compile_ok; then
13072                 if $run ./try; then
13073                         echo "Yes, it seems to work."
13074                         val="$define"
13075                 else
13076                         echo "Nope, it didn't work."
13077                         val="$undef"
13078                         case "$?" in
13079                         3) $cat >&4 <<EOM
13080 ***
13081 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13082 *** This is (almost) impossible.
13083 *** If your NFS lock daemons are not feeling well, something like
13084 *** this may happen, please investigate.  Cannot continue, aborting.
13085 ***
13086 EOM
13087                                 exit 1
13088                                 ;;
13089                         esac
13090                 fi
13091         else
13092                 echo "I'm unable to compile the test program, so I'll assume not."
13093                 val="$undef"
13094         fi
13095         ;;
13096 *) val="$undef";
13097         echo "Nope, since you don't even have fcntl()."
13098         ;;
13099 esac
13100 set d_fcntl_can_lock
13101 eval $setvar
13102 $rm_try
13103
13104 : check for fd_set items
13105 $cat <<EOM
13106
13107 Checking to see how well your C compiler handles fd_set and friends ...
13108 EOM
13109 $cat >try.c <<EOCP
13110 #$i_stdlib I_STDLIB
13111 #ifdef I_STDLIB
13112 #include <stdlib.h>
13113 #endif
13114 #$i_systime I_SYS_TIME
13115 #$i_sysselct I_SYS_SELECT
13116 #$d_socket HAS_SOCKET
13117 #include <sys/types.h>
13118 #ifdef HAS_SOCKET
13119 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13120 #endif
13121 #ifdef I_SYS_TIME
13122 #include <sys/time.h>
13123 #endif
13124 #ifdef I_SYS_SELECT
13125 #include <sys/select.h>
13126 #endif
13127 int main() {
13128         fd_set fds;
13129
13130 #ifdef TRYBITS
13131         if(fds.fds_bits);
13132 #endif
13133
13134 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13135         exit(0);
13136 #else
13137         exit(1);
13138 #endif
13139 }
13140 EOCP
13141 set try -DTRYBITS
13142 if eval $compile; then
13143         d_fds_bits="$define"
13144         d_fd_set="$define"
13145         echo "Well, your system knows about the normal fd_set typedef..." >&4
13146         if $run ./try; then
13147                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13148                 d_fd_macros="$define"
13149         else
13150                 $cat >&4 <<'EOM'
13151 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13152 EOM
13153                 d_fd_macros="$undef"
13154         fi
13155 else
13156         $cat <<'EOM'
13157 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13158 EOM
13159         set try
13160         if eval $compile; then
13161                 d_fds_bits="$undef"
13162                 d_fd_set="$define"
13163                 echo "Well, your system has some sort of fd_set available..." >&4
13164                 if $run ./try; then
13165                         echo "and you have the normal fd_set macros." >&4
13166                         d_fd_macros="$define"
13167                 else
13168                         $cat <<'EOM'
13169 but not the normal fd_set macros!  Gross!  More work for me...
13170 EOM
13171                         d_fd_macros="$undef"
13172                 fi
13173         else
13174         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13175                 d_fd_set="$undef"
13176                 d_fds_bits="$undef"
13177                 d_fd_macros="$undef"
13178         fi
13179 fi
13180 $rm_try
13181
13182 : see if fgetpos exists
13183 set fgetpos d_fgetpos
13184 eval $inlibc
13185
13186 : see if finite exists
13187 set finite d_finite
13188 eval $inlibc
13189
13190 : see if finitel exists
13191 set finitel d_finitel
13192 eval $inlibc
13193
13194 : see if flock exists
13195 set flock d_flock
13196 eval $inlibc
13197
13198 : see if prototype for flock is available
13199 echo " "
13200 set d_flockproto flock $i_sysfile sys/file.h
13201 eval $hasproto
13202
13203 : see if fp_class exists
13204 set fp_class d_fp_class
13205 eval $inlibc
13206
13207 : see if pathconf exists
13208 set pathconf d_pathconf
13209 eval $inlibc
13210
13211 : see if fpathconf exists
13212 set fpathconf d_fpathconf
13213 eval $inlibc
13214
13215 : see if fpclass exists
13216 set fpclass d_fpclass
13217 eval $inlibc
13218
13219 : see if fpclassify exists
13220 set fpclassify d_fpclassify
13221 eval $inlibc
13222
13223 : see if fpclassl exists
13224 set fpclassl d_fpclassl
13225 eval $inlibc
13226
13227 : check for fpos64_t
13228 echo " "
13229 echo "Checking to see if you have fpos64_t..." >&4
13230 $cat >try.c <<EOCP
13231 #include <stdio.h>
13232 int main() { fpos64_t x = 7; }
13233 EOCP
13234 set try
13235 if eval $compile; then
13236         val="$define"
13237         echo "You have fpos64_t."
13238 else
13239         val="$undef"
13240         echo "You do not have fpos64_t."
13241         case "$fpossize" in
13242         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13243         esac
13244 fi
13245 $rm_try
13246 set d_fpos64_t
13247 eval $setvar
13248
13249 : see if frexpl exists
13250 set frexpl d_frexpl
13251 eval $inlibc
13252
13253 : see if this is a sys/param system
13254 set sys/param.h i_sysparam
13255 eval $inhdr
13256
13257 : see if this is a sys/mount.h system
13258 set sys/mount.h i_sysmount
13259 eval $inhdr
13260
13261 : Check for fs_data_s
13262 echo " "
13263 echo "Checking to see if your system supports struct fs_data..." >&4
13264 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13265 eval $hasstruct
13266 case "$d_fs_data_s" in
13267 "$define")      echo "Yes, it does."   ;;
13268 *)              echo "No, it doesn't." ;;
13269 esac
13270
13271 : see if fseeko exists
13272 set fseeko d_fseeko
13273 eval $inlibc
13274 case "$longsize" in
13275 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13276 esac
13277
13278 : see if fsetpos exists
13279 set fsetpos d_fsetpos
13280 eval $inlibc
13281
13282 : see if fstatfs exists
13283 set fstatfs d_fstatfs
13284 eval $inlibc
13285
13286 : see if statvfs exists
13287 set statvfs d_statvfs
13288 eval $inlibc
13289
13290 : see if fstatvfs exists
13291 set fstatvfs d_fstatvfs
13292 eval $inlibc
13293
13294
13295 : see if fsync exists
13296 set fsync d_fsync
13297 eval $inlibc
13298
13299 : see if ftello exists
13300 set ftello d_ftello
13301 eval $inlibc
13302 case "$longsize" in
13303 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13304 esac
13305
13306 : check for a working futimes
13307 d_futimes="$undef"
13308 echo " "
13309 echo "Checking if you have a working futimes()" >&4
13310 $cat >try.c <<EOCP
13311 #include <stdio.h>
13312 #include <sys/time.h>
13313 #include <errno.h>
13314 #include <fcntl.h>
13315
13316 int main ()
13317 {
13318     int fd, rv;
13319     fd = open ("try.c", O_RDWR);
13320     if (-1 == fd) exit (1);
13321     rv = futimes (fd, NULL);
13322     exit (rv == -1 ? errno : 0);
13323 }
13324 EOCP
13325 set try
13326 if eval $compile; then
13327     `$run ./try`
13328     rc=$?
13329     case "$rc" in
13330         0)  echo "Yes, you have" >&4
13331             d_futimes="$define"
13332             ;;
13333         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13334             ;;
13335     esac
13336 else
13337     echo "No, it does not (probably harmless)" >&4
13338 fi
13339 $rm_try
13340
13341 : see if ndbm.h is available
13342 set ndbm.h i_ndbm
13343 eval $inhdr
13344 : Compatibility location for RedHat 7.1
13345 set gdbm/ndbm.h i_gdbmndbm
13346 eval $inhdr
13347 : Compatibility location for Debian 4.0
13348 set gdbm-ndbm.h i_gdbm_ndbm
13349 eval $inhdr
13350
13351 val="$undef"
13352 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13353         : see if dbm_open exists
13354         set dbm_open d_dbm_open
13355         eval $inlibc
13356         case "$d_dbm_open" in
13357         $undef)
13358                 i_ndbm="$undef"
13359                 i_gdbmndbm="$undef"
13360                 i_gdbm_ndbm="$undef"
13361                 echo "We won't be including <ndbm.h>"
13362                 val="$undef"
13363                 ;;
13364         *) val="$define"
13365            ;;
13366         esac
13367 fi
13368 set d_ndbm
13369 eval $setvar
13370
13371 ndbm_hdr_protochk='name=$1; hdr=$2;
13372 eval "ihdr=\$""i_$name";
13373 val="$undef";
13374 if $test "$ihdr" = "$define"; then
13375         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13376         case "$d_cplusplus" in
13377         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13378         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13379         esac;
13380         case "$val" in
13381         $define) $echo "Your <$hdr> seems to have prototypes";;
13382         *) $echo "Your <$hdr> does not seem to have prototypes";;
13383         esac;
13384 fi;
13385 set "d_${name}_h_uses_prototypes";
13386 eval $setvar'
13387
13388 set ndbm ndbm.h
13389 eval $ndbm_hdr_protochk
13390 set gdbmndbm gdbm/ndbm.h
13391 eval $ndbm_hdr_protochk
13392 set gdbm_ndbm gdbm-ndbm.h
13393 eval $ndbm_hdr_protochk
13394
13395 : see if getaddrinfo exists
13396 set getaddrinfo d_getaddrinfo
13397 eval $inlibc
13398
13399 : see if getcwd exists
13400 set getcwd d_getcwd
13401 eval $inlibc
13402
13403 : see if getespwnam exists
13404 set getespwnam d_getespwnam
13405 eval $inlibc
13406
13407 : see if getfsstat exists
13408 set getfsstat d_getfsstat
13409 eval $inlibc
13410
13411 : see if getgrent exists
13412 set getgrent d_getgrent
13413 eval $inlibc
13414
13415 : see if getgrent_r exists
13416 set getgrent_r d_getgrent_r
13417 eval $inlibc
13418 case "$d_getgrent_r" in
13419 "$define")
13420         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13421         case "$d_getgrent_r_proto:$usethreads" in
13422         ":define")      d_getgrent_r_proto=define
13423                 set d_getgrent_r_proto getgrent_r $hdrs
13424                 eval $hasproto ;;
13425         *)      ;;
13426         esac
13427         case "$d_getgrent_r_proto" in
13428         define)
13429         case "$getgrent_r_proto" in
13430         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13431         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13432         esac
13433         case "$getgrent_r_proto" in
13434         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13435         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13436         esac
13437         case "$getgrent_r_proto" in
13438         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13439         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13440         esac
13441         case "$getgrent_r_proto" in
13442         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13443         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13444         esac
13445         case "$getgrent_r_proto" in
13446         ''|0) try='int getgrent_r(struct group*, char*, int);'
13447         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13448         esac
13449         case "$getgrent_r_proto" in
13450         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13451         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13452         esac
13453         case "$getgrent_r_proto" in
13454         ''|0)   d_getgrent_r=undef
13455                 getgrent_r_proto=0
13456                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13457         * )     case "$getgrent_r_proto" in
13458                 REENTRANT_PROTO*) ;;
13459                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13460                 esac
13461                 echo "Prototype: $try" ;;
13462         esac
13463         ;;
13464         *)      case "$usethreads" in
13465                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13466                 esac
13467                 d_getgrent_r=undef
13468                 getgrent_r_proto=0
13469                 ;;
13470         esac
13471         ;;
13472 *)      getgrent_r_proto=0
13473         ;;
13474 esac
13475
13476 : see if getgrgid_r exists
13477 set getgrgid_r d_getgrgid_r
13478 eval $inlibc
13479 case "$d_getgrgid_r" in
13480 "$define")
13481         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13482         case "$d_getgrgid_r_proto:$usethreads" in
13483         ":define")      d_getgrgid_r_proto=define
13484                 set d_getgrgid_r_proto getgrgid_r $hdrs
13485                 eval $hasproto ;;
13486         *)      ;;
13487         esac
13488         case "$d_getgrgid_r_proto" in
13489         define)
13490         case "$getgrgid_r_proto" in
13491         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13492         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13493         esac
13494         case "$getgrgid_r_proto" in
13495         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13496         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13497         esac
13498         case "$getgrgid_r_proto" in
13499         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13500         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13501         esac
13502         case "$getgrgid_r_proto" in
13503         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13504         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13505         esac
13506         case "$getgrgid_r_proto" in
13507         ''|0)   d_getgrgid_r=undef
13508                 getgrgid_r_proto=0
13509                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13510         * )     case "$getgrgid_r_proto" in
13511                 REENTRANT_PROTO*) ;;
13512                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13513                 esac
13514                 echo "Prototype: $try" ;;
13515         esac
13516         ;;
13517         *)      case "$usethreads" in
13518                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13519                 esac
13520                 d_getgrgid_r=undef
13521                 getgrgid_r_proto=0
13522                 ;;
13523         esac
13524         ;;
13525 *)      getgrgid_r_proto=0
13526         ;;
13527 esac
13528
13529 : see if getgrnam_r exists
13530 set getgrnam_r d_getgrnam_r
13531 eval $inlibc
13532 case "$d_getgrnam_r" in
13533 "$define")
13534         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13535         case "$d_getgrnam_r_proto:$usethreads" in
13536         ":define")      d_getgrnam_r_proto=define
13537                 set d_getgrnam_r_proto getgrnam_r $hdrs
13538                 eval $hasproto ;;
13539         *)      ;;
13540         esac
13541         case "$d_getgrnam_r_proto" in
13542         define)
13543         case "$getgrnam_r_proto" in
13544         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13545         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13546         esac
13547         case "$getgrnam_r_proto" in
13548         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13549         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13550         esac
13551         case "$getgrnam_r_proto" in
13552         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13553         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13554         esac
13555         case "$getgrnam_r_proto" in
13556         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13557         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13558         esac
13559         case "$getgrnam_r_proto" in
13560         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13561         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13562         esac
13563         case "$getgrnam_r_proto" in
13564         ''|0)   d_getgrnam_r=undef
13565                 getgrnam_r_proto=0
13566                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13567         * )     case "$getgrnam_r_proto" in
13568                 REENTRANT_PROTO*) ;;
13569                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13570                 esac
13571                 echo "Prototype: $try" ;;
13572         esac
13573         ;;
13574         *)      case "$usethreads" in
13575                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13576                 esac
13577                 d_getgrnam_r=undef
13578                 getgrnam_r_proto=0
13579                 ;;
13580         esac
13581         ;;
13582 *)      getgrnam_r_proto=0
13583         ;;
13584 esac
13585
13586 : see if gethostbyaddr exists
13587 set gethostbyaddr d_gethbyaddr
13588 eval $inlibc
13589
13590 : see if gethostbyname exists
13591 set gethostbyname d_gethbyname
13592 eval $inlibc
13593
13594 : see if gethostent exists
13595 set gethostent d_gethent
13596 eval $inlibc
13597
13598 : see how we will look up host name
13599 echo " "
13600 call=''
13601 if set gethostname val -f d_gethname; eval $csym; $val; then
13602         echo 'gethostname() found.' >&4
13603         d_gethname="$define"
13604         call=gethostname
13605 fi
13606 if set uname val -f d_uname; eval $csym; $val; then
13607         if ./xenix; then
13608                 $cat <<'EOM'
13609 uname() was found, but you're running xenix, and older versions of xenix
13610 have a broken uname(). If you don't really know whether your xenix is old
13611 enough to have a broken system call, use the default answer.
13612
13613 EOM
13614                 dflt=y
13615                 case "$d_uname" in
13616                 "$define") dflt=n;;
13617                 esac
13618                 rp='Is your uname() broken?'
13619                 . ./myread
13620                 case "$ans" in
13621                 n*) d_uname="$define"; call=uname;;
13622                 esac
13623         else
13624                 echo 'uname() found.' >&4
13625                 d_uname="$define"
13626                 case "$call" in
13627                 '') call=uname ;;
13628                 esac
13629         fi
13630 fi
13631 case "$d_gethname" in
13632 '') d_gethname="$undef";;
13633 esac
13634 case "$d_uname" in
13635 '') d_uname="$undef";;
13636 esac
13637 case "$d_uname$d_gethname" in
13638 *define*)
13639         dflt=n
13640         cat <<EOM
13641
13642 Every now and then someone has a $call() that lies about the hostname
13643 but can't be fixed for political or economic reasons.  If you wish, I can
13644 pretend $call() isn't there and maybe compute hostname at run-time
13645 thanks to the '$phostname' command.
13646
13647 EOM
13648         rp="Shall I ignore $call() from now on?"
13649         . ./myread
13650         case "$ans" in
13651         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13652         esac;;
13653 esac
13654 case "$phostname" in
13655 '') aphostname='';;
13656 *) case "$aphostname" in
13657         /*) ;;
13658         *) set X $phostname
13659                 shift
13660                 file=$1
13661                 shift
13662                 file=`./loc $file $file $pth`
13663                 aphostname=`echo $file $*`
13664                 ;;
13665         esac
13666         ;;
13667 esac
13668 case "$d_uname$d_gethname" in
13669 *define*) ;;
13670 *)
13671         case "$phostname" in
13672         '')
13673                 echo "There will be no way for $package to get your hostname." >&4;;
13674         *)
13675         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13676                 ;;
13677         esac;;
13678 esac
13679 case "$d_phostname" in
13680 '') d_phostname="$undef";;
13681 esac
13682
13683 : see if gethostbyaddr_r exists
13684 set gethostbyaddr_r d_gethostbyaddr_r
13685 eval $inlibc
13686 case "$d_gethostbyaddr_r" in
13687 "$define")
13688         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13689         case "$d_gethostbyaddr_r_proto:$usethreads" in
13690         ":define")      d_gethostbyaddr_r_proto=define
13691                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13692                 eval $hasproto ;;
13693         *)      ;;
13694         esac
13695         case "$d_gethostbyaddr_r_proto" in
13696         define)
13697         case "$gethostbyaddr_r_proto" in
13698         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13699         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13700         esac
13701         case "$gethostbyaddr_r_proto" in
13702         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13703         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13704         esac
13705         case "$gethostbyaddr_r_proto" in
13706         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13707         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13708         esac
13709         case "$gethostbyaddr_r_proto" in
13710         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13711         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13712         esac
13713         case "$gethostbyaddr_r_proto" in
13714         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13715         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13716         esac
13717         case "$gethostbyaddr_r_proto" in
13718         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13719         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13720         esac
13721         case "$gethostbyaddr_r_proto" in
13722         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13723         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13724         esac
13725         case "$gethostbyaddr_r_proto" in
13726         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13727         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13728         esac
13729         case "$gethostbyaddr_r_proto" in
13730         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13731         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13732         esac
13733         case "$gethostbyaddr_r_proto" in
13734         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13735         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13736         esac
13737         case "$gethostbyaddr_r_proto" in
13738         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13740         esac
13741         case "$gethostbyaddr_r_proto" in
13742         ''|0)   d_gethostbyaddr_r=undef
13743                 gethostbyaddr_r_proto=0
13744                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13745         * )     case "$gethostbyaddr_r_proto" in
13746                 REENTRANT_PROTO*) ;;
13747                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13748                 esac
13749                 echo "Prototype: $try" ;;
13750         esac
13751         ;;
13752         *)      case "$usethreads" in
13753                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13754                 esac
13755                 d_gethostbyaddr_r=undef
13756                 gethostbyaddr_r_proto=0
13757                 ;;
13758         esac
13759         ;;
13760 *)      gethostbyaddr_r_proto=0
13761         ;;
13762 esac
13763
13764 : see if gethostbyname_r exists
13765 set gethostbyname_r d_gethostbyname_r
13766 eval $inlibc
13767 case "$d_gethostbyname_r" in
13768 "$define")
13769         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13770         case "$d_gethostbyname_r_proto:$usethreads" in
13771         ":define")      d_gethostbyname_r_proto=define
13772                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13773                 eval $hasproto ;;
13774         *)      ;;
13775         esac
13776         case "$d_gethostbyname_r_proto" in
13777         define)
13778         case "$gethostbyname_r_proto" in
13779         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13780         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13781         esac
13782         case "$gethostbyname_r_proto" in
13783         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13784         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13785         esac
13786         case "$gethostbyname_r_proto" in
13787         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13788         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13789         esac
13790         case "$gethostbyname_r_proto" in
13791         ''|0)   d_gethostbyname_r=undef
13792                 gethostbyname_r_proto=0
13793                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13794         * )     case "$gethostbyname_r_proto" in
13795                 REENTRANT_PROTO*) ;;
13796                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13797                 esac
13798                 echo "Prototype: $try" ;;
13799         esac
13800         ;;
13801         *)      case "$usethreads" in
13802                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13803                 esac
13804                 d_gethostbyname_r=undef
13805                 gethostbyname_r_proto=0
13806                 ;;
13807         esac
13808         ;;
13809 *)      gethostbyname_r_proto=0
13810         ;;
13811 esac
13812
13813 : see if gethostent_r exists
13814 set gethostent_r d_gethostent_r
13815 eval $inlibc
13816 case "$d_gethostent_r" in
13817 "$define")
13818         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13819         case "$d_gethostent_r_proto:$usethreads" in
13820         ":define")      d_gethostent_r_proto=define
13821                 set d_gethostent_r_proto gethostent_r $hdrs
13822                 eval $hasproto ;;
13823         *)      ;;
13824         esac
13825         case "$d_gethostent_r_proto" in
13826         define)
13827         case "$gethostent_r_proto" in
13828         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13829         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13830         esac
13831         case "$gethostent_r_proto" in
13832         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13833         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13834         esac
13835         case "$gethostent_r_proto" in
13836         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13837         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13838         esac
13839         case "$gethostent_r_proto" in
13840         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13841         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13842         esac
13843         case "$gethostent_r_proto" in
13844         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13845         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13846         esac
13847         case "$gethostent_r_proto" in
13848         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13849         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13850         esac
13851         case "$gethostent_r_proto" in
13852         ''|0)   d_gethostent_r=undef
13853                 gethostent_r_proto=0
13854                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13855         * )     case "$gethostent_r_proto" in
13856                 REENTRANT_PROTO*) ;;
13857                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13858                 esac
13859                 echo "Prototype: $try" ;;
13860         esac
13861         ;;
13862         *)      case "$usethreads" in
13863                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13864                 esac
13865                 d_gethostent_r=undef
13866                 gethostent_r_proto=0
13867                 ;;
13868         esac
13869         ;;
13870 *)      gethostent_r_proto=0
13871         ;;
13872 esac
13873
13874 : see if prototypes for various gethostxxx netdb.h functions are available
13875 echo " "
13876 set d_gethostprotos gethostent $i_netdb netdb.h
13877 eval $hasproto
13878
13879 : see if getitimer exists
13880 set getitimer d_getitimer
13881 eval $inlibc
13882
13883 : see if getlogin exists
13884 set getlogin d_getlogin
13885 eval $inlibc
13886
13887 : see if getlogin_r exists
13888 set getlogin_r d_getlogin_r
13889 eval $inlibc
13890 case "$d_getlogin_r" in
13891 "$define")
13892         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13893         case "$d_getlogin_r_proto:$usethreads" in
13894         ":define")      d_getlogin_r_proto=define
13895                 set d_getlogin_r_proto getlogin_r $hdrs
13896                 eval $hasproto ;;
13897         *)      ;;
13898         esac
13899         case "$d_getlogin_r_proto" in
13900         define)
13901         case "$getlogin_r_proto" in
13902         ''|0) try='int getlogin_r(char*, size_t);'
13903         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13904         esac
13905         case "$getlogin_r_proto" in
13906         ''|0) try='int getlogin_r(char*, int);'
13907         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13908         esac
13909         case "$getlogin_r_proto" in
13910         ''|0) try='char* getlogin_r(char*, size_t);'
13911         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13912         esac
13913         case "$getlogin_r_proto" in
13914         ''|0) try='char* getlogin_r(char*, int);'
13915         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13916         esac
13917         case "$getlogin_r_proto" in
13918         ''|0)   d_getlogin_r=undef
13919                 getlogin_r_proto=0
13920                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13921         * )     case "$getlogin_r_proto" in
13922                 REENTRANT_PROTO*) ;;
13923                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13924                 esac
13925                 echo "Prototype: $try" ;;
13926         esac
13927         ;;
13928         *)      case "$usethreads" in
13929                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13930                 esac
13931                 d_getlogin_r=undef
13932                 getlogin_r_proto=0
13933                 ;;
13934         esac
13935         ;;
13936 *)      getlogin_r_proto=0
13937         ;;
13938 esac
13939
13940 : see if getmnt exists
13941 set getmnt d_getmnt
13942 eval $inlibc
13943
13944 : see if getmntent exists
13945 set getmntent d_getmntent
13946 eval $inlibc
13947
13948 : see if getnameinfo exists
13949 set getnameinfo d_getnameinfo
13950 eval $inlibc
13951
13952 : see if getnetbyaddr exists
13953 set getnetbyaddr d_getnbyaddr
13954 eval $inlibc
13955
13956 : see if getnetbyname exists
13957 set getnetbyname d_getnbyname
13958 eval $inlibc
13959
13960 : see if getnetent exists
13961 set getnetent d_getnent
13962 eval $inlibc
13963
13964 : see if getnetbyaddr_r exists
13965 set getnetbyaddr_r d_getnetbyaddr_r
13966 eval $inlibc
13967 case "$d_getnetbyaddr_r" in
13968 "$define")
13969         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13970         case "$d_getnetbyaddr_r_proto:$usethreads" in
13971         ":define")      d_getnetbyaddr_r_proto=define
13972                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13973                 eval $hasproto ;;
13974         *)      ;;
13975         esac
13976         case "$d_getnetbyaddr_r_proto" in
13977         define)
13978         case "$getnetbyaddr_r_proto" in
13979         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13980         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13981         esac
13982         case "$getnetbyaddr_r_proto" in
13983         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13984         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13985         esac
13986         case "$getnetbyaddr_r_proto" in
13987         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13988         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13989         esac
13990         case "$getnetbyaddr_r_proto" in
13991         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13992         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13993         esac
13994         case "$getnetbyaddr_r_proto" in
13995         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13996         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13997         esac
13998         case "$getnetbyaddr_r_proto" in
13999         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14000         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14001         esac
14002         case "$getnetbyaddr_r_proto" in
14003         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14004         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14005         esac
14006         case "$getnetbyaddr_r_proto" in
14007         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14008         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14009         esac
14010         case "$getnetbyaddr_r_proto" in
14011         ''|0)   d_getnetbyaddr_r=undef
14012                 getnetbyaddr_r_proto=0
14013                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14014         * )     case "$getnetbyaddr_r_proto" in
14015                 REENTRANT_PROTO*) ;;
14016                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14017                 esac
14018                 echo "Prototype: $try" ;;
14019         esac
14020         ;;
14021         *)      case "$usethreads" in
14022                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14023                 esac
14024                 d_getnetbyaddr_r=undef
14025                 getnetbyaddr_r_proto=0
14026                 ;;
14027         esac
14028         ;;
14029 *)      getnetbyaddr_r_proto=0
14030         ;;
14031 esac
14032
14033 : see if getnetbyname_r exists
14034 set getnetbyname_r d_getnetbyname_r
14035 eval $inlibc
14036 case "$d_getnetbyname_r" in
14037 "$define")
14038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14039         case "$d_getnetbyname_r_proto:$usethreads" in
14040         ":define")      d_getnetbyname_r_proto=define
14041                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14042                 eval $hasproto ;;
14043         *)      ;;
14044         esac
14045         case "$d_getnetbyname_r_proto" in
14046         define)
14047         case "$getnetbyname_r_proto" in
14048         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14049         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14050         esac
14051         case "$getnetbyname_r_proto" in
14052         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14053         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14054         esac
14055         case "$getnetbyname_r_proto" in
14056         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14057         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14058         esac
14059         case "$getnetbyname_r_proto" in
14060         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14061         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14062         esac
14063         case "$getnetbyname_r_proto" in
14064         ''|0)   d_getnetbyname_r=undef
14065                 getnetbyname_r_proto=0
14066                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14067         * )     case "$getnetbyname_r_proto" in
14068                 REENTRANT_PROTO*) ;;
14069                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14070                 esac
14071                 echo "Prototype: $try" ;;
14072         esac
14073         ;;
14074         *)      case "$usethreads" in
14075                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14076                 esac
14077                 d_getnetbyname_r=undef
14078                 getnetbyname_r_proto=0
14079                 ;;
14080         esac
14081         ;;
14082 *)      getnetbyname_r_proto=0
14083         ;;
14084 esac
14085
14086 : see if getnetent_r exists
14087 set getnetent_r d_getnetent_r
14088 eval $inlibc
14089 case "$d_getnetent_r" in
14090 "$define")
14091         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14092         case "$d_getnetent_r_proto:$usethreads" in
14093         ":define")      d_getnetent_r_proto=define
14094                 set d_getnetent_r_proto getnetent_r $hdrs
14095                 eval $hasproto ;;
14096         *)      ;;
14097         esac
14098         case "$d_getnetent_r_proto" in
14099         define)
14100         case "$getnetent_r_proto" in
14101         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14102         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14103         esac
14104         case "$getnetent_r_proto" in
14105         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14106         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14107         esac
14108         case "$getnetent_r_proto" in
14109         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14110         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14111         esac
14112         case "$getnetent_r_proto" in
14113         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14114         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14115         esac
14116         case "$getnetent_r_proto" in
14117         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14118         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14119         esac
14120         case "$getnetent_r_proto" in
14121         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14122         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14123         esac
14124         case "$getnetent_r_proto" in
14125         ''|0)   d_getnetent_r=undef
14126                 getnetent_r_proto=0
14127                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14128         * )     case "$getnetent_r_proto" in
14129                 REENTRANT_PROTO*) ;;
14130                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14131                 esac
14132                 echo "Prototype: $try" ;;
14133         esac
14134         ;;
14135         *)      case "$usethreads" in
14136                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14137                 esac
14138                 d_getnetent_r=undef
14139                 getnetent_r_proto=0
14140                 ;;
14141         esac
14142         ;;
14143 *)      getnetent_r_proto=0
14144         ;;
14145 esac
14146
14147 : see if prototypes for various getnetxxx netdb.h functions are available
14148 echo " "
14149 set d_getnetprotos getnetent $i_netdb netdb.h
14150 eval $hasproto
14151
14152 : see if getpagesize exists
14153 set getpagesize d_getpagsz
14154 eval $inlibc
14155
14156 : Optional checks for getprotobyname and getprotobynumber
14157
14158 : see if getprotobyname exists
14159 set getprotobyname d_getpbyname
14160 eval $inlibc
14161
14162 : see if getprotobynumber exists
14163 set getprotobynumber d_getpbynumber
14164 eval $inlibc
14165
14166 : see if getprotoent exists
14167 set getprotoent d_getpent
14168 eval $inlibc
14169
14170 : see if getpgid exists
14171 set getpgid d_getpgid
14172 eval $inlibc
14173
14174 : see if getpgrp2 exists
14175 set getpgrp2 d_getpgrp2
14176 eval $inlibc
14177
14178 : see if getppid exists
14179 set getppid d_getppid
14180 eval $inlibc
14181
14182 : see if getpriority exists
14183 set getpriority d_getprior
14184 eval $inlibc
14185
14186 : see if getprotobyname_r exists
14187 set getprotobyname_r d_getprotobyname_r
14188 eval $inlibc
14189 case "$d_getprotobyname_r" in
14190 "$define")
14191         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14192         case "$d_getprotobyname_r_proto:$usethreads" in
14193         ":define")      d_getprotobyname_r_proto=define
14194                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14195                 eval $hasproto ;;
14196         *)      ;;
14197         esac
14198         case "$d_getprotobyname_r_proto" in
14199         define)
14200         case "$getprotobyname_r_proto" in
14201         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14202         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14203         esac
14204         case "$getprotobyname_r_proto" in
14205         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14206         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14207         esac
14208         case "$getprotobyname_r_proto" in
14209         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14210         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14211         esac
14212         case "$getprotobyname_r_proto" in
14213         ''|0)   d_getprotobyname_r=undef
14214                 getprotobyname_r_proto=0
14215                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14216         * )     case "$getprotobyname_r_proto" in
14217                 REENTRANT_PROTO*) ;;
14218                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14219                 esac
14220                 echo "Prototype: $try" ;;
14221         esac
14222         ;;
14223         *)      case "$usethreads" in
14224                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14225                 esac
14226                 d_getprotobyname_r=undef
14227                 getprotobyname_r_proto=0
14228                 ;;
14229         esac
14230         ;;
14231 *)      getprotobyname_r_proto=0
14232         ;;
14233 esac
14234
14235 : see if getprotobynumber_r exists
14236 set getprotobynumber_r d_getprotobynumber_r
14237 eval $inlibc
14238 case "$d_getprotobynumber_r" in
14239 "$define")
14240         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14241         case "$d_getprotobynumber_r_proto:$usethreads" in
14242         ":define")      d_getprotobynumber_r_proto=define
14243                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14244                 eval $hasproto ;;
14245         *)      ;;
14246         esac
14247         case "$d_getprotobynumber_r_proto" in
14248         define)
14249         case "$getprotobynumber_r_proto" in
14250         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14251         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14252         esac
14253         case "$getprotobynumber_r_proto" in
14254         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14255         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14256         esac
14257         case "$getprotobynumber_r_proto" in
14258         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14259         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14260         esac
14261         case "$getprotobynumber_r_proto" in
14262         ''|0)   d_getprotobynumber_r=undef
14263                 getprotobynumber_r_proto=0
14264                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14265         * )     case "$getprotobynumber_r_proto" in
14266                 REENTRANT_PROTO*) ;;
14267                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14268                 esac
14269                 echo "Prototype: $try" ;;
14270         esac
14271         ;;
14272         *)      case "$usethreads" in
14273                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14274                 esac
14275                 d_getprotobynumber_r=undef
14276                 getprotobynumber_r_proto=0
14277                 ;;
14278         esac
14279         ;;
14280 *)      getprotobynumber_r_proto=0
14281         ;;
14282 esac
14283
14284 : see if getprotoent_r exists
14285 set getprotoent_r d_getprotoent_r
14286 eval $inlibc
14287 case "$d_getprotoent_r" in
14288 "$define")
14289         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14290         case "$d_getprotoent_r_proto:$usethreads" in
14291         ":define")      d_getprotoent_r_proto=define
14292                 set d_getprotoent_r_proto getprotoent_r $hdrs
14293                 eval $hasproto ;;
14294         *)      ;;
14295         esac
14296         case "$d_getprotoent_r_proto" in
14297         define)
14298         case "$getprotoent_r_proto" in
14299         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14300         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14301         esac
14302         case "$getprotoent_r_proto" in
14303         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14304         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14305         esac
14306         case "$getprotoent_r_proto" in
14307         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14308         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14309         esac
14310         case "$getprotoent_r_proto" in
14311         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14312         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14313         esac
14314         case "$getprotoent_r_proto" in
14315         ''|0)   d_getprotoent_r=undef
14316                 getprotoent_r_proto=0
14317                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14318         * )     case "$getprotoent_r_proto" in
14319                 REENTRANT_PROTO*) ;;
14320                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14321                 esac
14322                 echo "Prototype: $try" ;;
14323         esac
14324         ;;
14325         *)      case "$usethreads" in
14326                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14327                 esac
14328                 d_getprotoent_r=undef
14329                 getprotoent_r_proto=0
14330                 ;;
14331         esac
14332         ;;
14333 *)      getprotoent_r_proto=0
14334         ;;
14335 esac
14336
14337 : see if prototypes for various getprotoxxx netdb.h functions are available
14338 echo " "
14339 set d_getprotoprotos getprotoent $i_netdb netdb.h
14340 eval $hasproto
14341
14342 : see if getprpwnam exists
14343 set getprpwnam d_getprpwnam
14344 eval $inlibc
14345
14346 : see if getpwent exists
14347 set getpwent d_getpwent
14348 eval $inlibc
14349
14350 : see if getpwent_r exists
14351 set getpwent_r d_getpwent_r
14352 eval $inlibc
14353 case "$d_getpwent_r" in
14354 "$define")
14355         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14356         case "$d_getpwent_r_proto:$usethreads" in
14357         ":define")      d_getpwent_r_proto=define
14358                 set d_getpwent_r_proto getpwent_r $hdrs
14359                 eval $hasproto ;;
14360         *)      ;;
14361         esac
14362         case "$d_getpwent_r_proto" in
14363         define)
14364         case "$getpwent_r_proto" in
14365         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14366         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14367         esac
14368         case "$getpwent_r_proto" in
14369         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14370         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14371         esac
14372         case "$getpwent_r_proto" in
14373         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14374         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14375         esac
14376         case "$getpwent_r_proto" in
14377         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14378         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14379         esac
14380         case "$getpwent_r_proto" in
14381         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14382         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14383         esac
14384         case "$getpwent_r_proto" in
14385         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14386         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14387         esac
14388         case "$getpwent_r_proto" in
14389         ''|0)   d_getpwent_r=undef
14390                 getpwent_r_proto=0
14391                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14392         * )     case "$getpwent_r_proto" in
14393                 REENTRANT_PROTO*) ;;
14394                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14395                 esac
14396                 echo "Prototype: $try" ;;
14397         esac
14398         ;;
14399         *)      case "$usethreads" in
14400                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14401                 esac
14402                 d_getpwent_r=undef
14403                 getpwent_r_proto=0
14404                 ;;
14405         esac
14406         ;;
14407 *)      getpwent_r_proto=0
14408         ;;
14409 esac
14410
14411 : see if getpwnam_r exists
14412 set getpwnam_r d_getpwnam_r
14413 eval $inlibc
14414 case "$d_getpwnam_r" in
14415 "$define")
14416         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14417         case "$d_getpwnam_r_proto:$usethreads" in
14418         ":define")      d_getpwnam_r_proto=define
14419                 set d_getpwnam_r_proto getpwnam_r $hdrs
14420                 eval $hasproto ;;
14421         *)      ;;
14422         esac
14423         case "$d_getpwnam_r_proto" in
14424         define)
14425         case "$getpwnam_r_proto" in
14426         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14427         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14428         esac
14429         case "$getpwnam_r_proto" in
14430         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14431         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14432         esac
14433         case "$getpwnam_r_proto" in
14434         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14435         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14436         esac
14437         case "$getpwnam_r_proto" in
14438         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14439         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14440         esac
14441         case "$getpwnam_r_proto" in
14442         ''|0)   d_getpwnam_r=undef
14443                 getpwnam_r_proto=0
14444                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14445         * )     case "$getpwnam_r_proto" in
14446                 REENTRANT_PROTO*) ;;
14447                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14448                 esac
14449                 echo "Prototype: $try" ;;
14450         esac
14451         ;;
14452         *)      case "$usethreads" in
14453                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14454                 esac
14455                 d_getpwnam_r=undef
14456                 getpwnam_r_proto=0
14457                 ;;
14458         esac
14459         ;;
14460 *)      getpwnam_r_proto=0
14461         ;;
14462 esac
14463
14464 : see if getpwuid_r exists
14465 set getpwuid_r d_getpwuid_r
14466 eval $inlibc
14467 case "$d_getpwuid_r" in
14468 "$define")
14469         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14470         case "$d_getpwuid_r_proto:$usethreads" in
14471         ":define")      d_getpwuid_r_proto=define
14472                 set d_getpwuid_r_proto getpwuid_r $hdrs
14473                 eval $hasproto ;;
14474         *)      ;;
14475         esac
14476         case "$d_getpwuid_r_proto" in
14477         define)
14478         case "$getpwuid_r_proto" in
14479         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14480         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14481         esac
14482         case "$getpwuid_r_proto" in
14483         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14484         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14485         esac
14486         case "$getpwuid_r_proto" in
14487         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14488         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14489         esac
14490         case "$getpwuid_r_proto" in
14491         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14492         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14493         esac
14494         case "$getpwuid_r_proto" in
14495         ''|0)   d_getpwuid_r=undef
14496                 getpwuid_r_proto=0
14497                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14498         * )     case "$getpwuid_r_proto" in
14499                 REENTRANT_PROTO*) ;;
14500                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14501                 esac
14502                 echo "Prototype: $try" ;;
14503         esac
14504         ;;
14505         *)      case "$usethreads" in
14506                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14507                 esac
14508                 d_getpwuid_r=undef
14509                 getpwuid_r_proto=0
14510                 ;;
14511         esac
14512         ;;
14513 *)      getpwuid_r_proto=0
14514         ;;
14515 esac
14516
14517 : Optional checks for getsbyname and getsbyport
14518
14519 : see if getservbyname exists
14520 set getservbyname d_getsbyname
14521 eval $inlibc
14522
14523 : see if getservbyport exists
14524 set getservbyport d_getsbyport
14525 eval $inlibc
14526
14527 : see if getservent exists
14528 set getservent d_getsent
14529 eval $inlibc
14530
14531 : see if getservbyname_r exists
14532 set getservbyname_r d_getservbyname_r
14533 eval $inlibc
14534 case "$d_getservbyname_r" in
14535 "$define")
14536         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14537         case "$d_getservbyname_r_proto:$usethreads" in
14538         ":define")      d_getservbyname_r_proto=define
14539                 set d_getservbyname_r_proto getservbyname_r $hdrs
14540                 eval $hasproto ;;
14541         *)      ;;
14542         esac
14543         case "$d_getservbyname_r_proto" in
14544         define)
14545         case "$getservbyname_r_proto" in
14546         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14547         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14548         esac
14549         case "$getservbyname_r_proto" in
14550         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14551         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14552         esac
14553         case "$getservbyname_r_proto" in
14554         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14555         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14556         esac
14557         case "$getservbyname_r_proto" in
14558         ''|0)   d_getservbyname_r=undef
14559                 getservbyname_r_proto=0
14560                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14561         * )     case "$getservbyname_r_proto" in
14562                 REENTRANT_PROTO*) ;;
14563                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14564                 esac
14565                 echo "Prototype: $try" ;;
14566         esac
14567         ;;
14568         *)      case "$usethreads" in
14569                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14570                 esac
14571                 d_getservbyname_r=undef
14572                 getservbyname_r_proto=0
14573                 ;;
14574         esac
14575         ;;
14576 *)      getservbyname_r_proto=0
14577         ;;
14578 esac
14579
14580 : see if getservbyport_r exists
14581 set getservbyport_r d_getservbyport_r
14582 eval $inlibc
14583 case "$d_getservbyport_r" in
14584 "$define")
14585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14586         case "$d_getservbyport_r_proto:$usethreads" in
14587         ":define")      d_getservbyport_r_proto=define
14588                 set d_getservbyport_r_proto getservbyport_r $hdrs
14589                 eval $hasproto ;;
14590         *)      ;;
14591         esac
14592         case "$d_getservbyport_r_proto" in
14593         define)
14594         case "$getservbyport_r_proto" in
14595         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14596         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14597         esac
14598         case "$getservbyport_r_proto" in
14599         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14600         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14601         esac
14602         case "$getservbyport_r_proto" in
14603         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14604         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14605         esac
14606         case "$getservbyport_r_proto" in
14607         ''|0)   d_getservbyport_r=undef
14608                 getservbyport_r_proto=0
14609                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14610         * )     case "$getservbyport_r_proto" in
14611                 REENTRANT_PROTO*) ;;
14612                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14613                 esac
14614                 echo "Prototype: $try" ;;
14615         esac
14616         ;;
14617         *)      case "$usethreads" in
14618                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14619                 esac
14620                 d_getservbyport_r=undef
14621                 getservbyport_r_proto=0
14622                 ;;
14623         esac
14624         ;;
14625 *)      getservbyport_r_proto=0
14626         ;;
14627 esac
14628
14629 : see if getservent_r exists
14630 set getservent_r d_getservent_r
14631 eval $inlibc
14632 case "$d_getservent_r" in
14633 "$define")
14634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14635         case "$d_getservent_r_proto:$usethreads" in
14636         ":define")      d_getservent_r_proto=define
14637                 set d_getservent_r_proto getservent_r $hdrs
14638                 eval $hasproto ;;
14639         *)      ;;
14640         esac
14641         case "$d_getservent_r_proto" in
14642         define)
14643         case "$getservent_r_proto" in
14644         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14645         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14646         esac
14647         case "$getservent_r_proto" in
14648         ''|0) try='int getservent_r(struct servent*, char*, int);'
14649         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14650         esac
14651         case "$getservent_r_proto" in
14652         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14653         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14654         esac
14655         case "$getservent_r_proto" in
14656         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14657         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14658         esac
14659         case "$getservent_r_proto" in
14660         ''|0)   d_getservent_r=undef
14661                 getservent_r_proto=0
14662                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14663         * )     case "$getservent_r_proto" in
14664                 REENTRANT_PROTO*) ;;
14665                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14666                 esac
14667                 echo "Prototype: $try" ;;
14668         esac
14669         ;;
14670         *)      case "$usethreads" in
14671                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14672                 esac
14673                 d_getservent_r=undef
14674                 getservent_r_proto=0
14675                 ;;
14676         esac
14677         ;;
14678 *)      getservent_r_proto=0
14679         ;;
14680 esac
14681
14682 : see if prototypes for various getservxxx netdb.h functions are available
14683 echo " "
14684 set d_getservprotos getservent $i_netdb netdb.h
14685 eval $hasproto
14686
14687 : see if getspnam exists
14688 set getspnam d_getspnam
14689 eval $inlibc
14690
14691 : see if this is a shadow.h system
14692 set shadow.h i_shadow
14693 eval $inhdr
14694
14695 : see if getspnam_r exists
14696 set getspnam_r d_getspnam_r
14697 eval $inlibc
14698 case "$d_getspnam_r" in
14699 "$define")
14700         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14701         case "$d_getspnam_r_proto:$usethreads" in
14702         ":define")      d_getspnam_r_proto=define
14703                 set d_getspnam_r_proto getspnam_r $hdrs
14704                 eval $hasproto ;;
14705         *)      ;;
14706         esac
14707         case "$d_getspnam_r_proto" in
14708         define)
14709         case "$getspnam_r_proto" in
14710         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14711         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14712         esac
14713         case "$getspnam_r_proto" in
14714         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14715         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14716         esac
14717         case "$getspnam_r_proto" in
14718         ''|0)   d_getspnam_r=undef
14719                 getspnam_r_proto=0
14720                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14721         * )     case "$getspnam_r_proto" in
14722                 REENTRANT_PROTO*) ;;
14723                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14724                 esac
14725                 echo "Prototype: $try" ;;
14726         esac
14727         ;;
14728         *)      case "$usethreads" in
14729                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14730                 esac
14731                 d_getspnam_r=undef
14732                 getspnam_r_proto=0
14733                 ;;
14734         esac
14735         ;;
14736 *)      getspnam_r_proto=0
14737         ;;
14738 esac
14739
14740 : see if gettimeofday or ftime exists
14741 set gettimeofday d_gettimeod
14742 eval $inlibc
14743 case "$d_gettimeod" in
14744 "$undef")
14745         set ftime d_ftime 
14746         eval $inlibc
14747         ;;
14748 *)
14749         val="$undef"; set d_ftime; eval $setvar
14750         ;;
14751 esac
14752 case "$d_gettimeod$d_ftime" in
14753 "$undef$undef")
14754         echo " "
14755         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14756         ;;
14757 esac
14758
14759 : see if gmtime_r exists
14760 set gmtime_r d_gmtime_r
14761 eval $inlibc
14762 case "$d_gmtime_r" in
14763 "$define")
14764         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14765         case "$d_gmtime_r_proto:$usethreads" in
14766         ":define")      d_gmtime_r_proto=define
14767                 set d_gmtime_r_proto gmtime_r $hdrs
14768                 eval $hasproto ;;
14769         *)      ;;
14770         esac
14771         case "$d_gmtime_r_proto" in
14772         define)
14773         case "$gmtime_r_proto" in
14774         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14775         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14776         esac
14777         case "$gmtime_r_proto" in
14778         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14779         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14780         esac
14781         case "$gmtime_r_proto" in
14782         ''|0)   d_gmtime_r=undef
14783                 gmtime_r_proto=0
14784                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14785         * )     case "$gmtime_r_proto" in
14786                 REENTRANT_PROTO*) ;;
14787                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14788                 esac
14789                 echo "Prototype: $try" ;;
14790         esac
14791         ;;
14792         *)      case "$usethreads" in
14793                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14794                 esac
14795                 d_gmtime_r=undef
14796                 gmtime_r_proto=0
14797                 ;;
14798         esac
14799         ;;
14800 *)      gmtime_r_proto=0
14801         ;;
14802 esac
14803
14804 : see if hasmntopt exists
14805 set hasmntopt d_hasmntopt
14806 eval $inlibc
14807
14808 : see if this is a netinet/in.h or sys/in.h system
14809 set netinet/in.h i_niin sys/in.h i_sysin
14810 eval $inhdr
14811
14812 : see if arpa/inet.h has to be included
14813 set arpa/inet.h i_arpainet
14814 eval $inhdr
14815
14816 : see if htonl --and friends-- exists
14817 val=''
14818 set htonl val
14819 eval $inlibc
14820
14821 : Maybe they are macros.
14822 case "$val" in
14823 $undef)
14824         $cat >htonl.c <<EOM
14825 #include <stdio.h>
14826 #include <sys/types.h>
14827 #$i_niin I_NETINET_IN
14828 #$i_sysin I_SYS_IN
14829 #$i_arpainet I_ARPA_INET
14830 #ifdef I_NETINET_IN
14831 #include <netinet/in.h>
14832 #endif
14833 #ifdef I_SYS_IN
14834 #include <sys/in.h>
14835 #endif
14836 #ifdef I_ARPA_INET
14837 #include <arpa/inet.h>
14838 #endif
14839 #ifdef htonl
14840 printf("Defined as a macro.");
14841 #endif
14842 EOM
14843         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14844         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14845                 val="$define"
14846                 echo "But it seems to be defined as a macro." >&4
14847         fi
14848         $rm -f htonl.?
14849         ;;
14850 esac
14851 set d_htonl
14852 eval $setvar
14853
14854 : see if ilogbl exists
14855 set ilogbl d_ilogbl
14856 eval $inlibc
14857
14858 : index or strchr
14859 echo " "
14860 if set index val -f; eval $csym; $val; then
14861         if set strchr val -f d_strchr; eval $csym; $val; then
14862                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14863                         val="$define"
14864                         vali="$undef"
14865                         echo "strchr() found." >&4
14866                 else
14867                         val="$undef"
14868                         vali="$define"
14869                         echo "index() found." >&4
14870                 fi
14871         else
14872                 val="$undef"
14873                 vali="$define"
14874                 echo "index() found." >&4
14875         fi
14876 else
14877         if set strchr val -f d_strchr; eval $csym; $val; then
14878                 val="$define"
14879                 vali="$undef"
14880                 echo "strchr() found." >&4
14881         else
14882                 echo "No index() or strchr() found!" >&4
14883                 val="$undef"
14884                 vali="$undef"
14885         fi
14886 fi
14887 set d_strchr; eval $setvar
14888 val="$vali"
14889 set d_index; eval $setvar
14890
14891 : check whether inet_aton exists
14892 set inet_aton d_inetaton
14893 eval $inlibc
14894
14895 : see if inet_ntop exists
14896 set inet_ntop d_inetntop
14897 eval $inlibc
14898
14899 : see if inet_pton exists
14900 set inet_pton d_inetpton
14901 eval $inlibc
14902
14903 : Look for isascii
14904 echo " "
14905 $cat >isascii.c <<EOCP
14906 #include <stdio.h>
14907 #include <ctype.h>
14908 #$i_stdlib I_STDLIB
14909 #ifdef I_STDLIB
14910 #include <stdlib.h>
14911 #endif
14912 int main() {
14913         int c = 'A';
14914         if (isascii(c))
14915                 exit(0);
14916         else
14917                 exit(1);
14918 }
14919 EOCP
14920 set isascii
14921 if eval $compile; then
14922         echo "isascii() found." >&4
14923         val="$define"
14924 else
14925         echo "isascii() NOT found." >&4
14926         val="$undef"
14927 fi
14928 set d_isascii
14929 eval $setvar
14930 $rm -f isascii*
14931
14932 : see if isfinite exists
14933 set isfinite d_isfinite
14934 eval $inlibc
14935
14936 : see if isinf exists
14937 set isinf d_isinf
14938 eval $inlibc
14939
14940 : see if isnan exists
14941 set isnan d_isnan
14942 eval $inlibc
14943
14944 : see if isnanl exists
14945 set isnanl d_isnanl
14946 eval $inlibc
14947
14948 : see if killpg exists
14949 set killpg d_killpg
14950 eval $inlibc
14951
14952 : see if lchown exists
14953 echo " "
14954 $cat > try.c <<'EOCP'
14955 /* System header to define __stub macros and hopefully few prototypes,
14956     which can conflict with char lchown(); below.  */
14957 #include <assert.h>
14958 /* Override any gcc2 internal prototype to avoid an error.  */
14959 /* We use char because int might match the return type of a gcc2
14960    builtin and then its argument prototype would still apply.  */
14961 char lchown();
14962 int main() {
14963     /*  The GNU C library defines this for functions which it implements
14964         to always fail with ENOSYS.  Some functions are actually named
14965         something starting with __ and the normal name is an alias.  */
14966 #if defined (__stub_lchown) || defined (__stub___lchown)
14967 choke me
14968 #else
14969 lchown();
14970 #endif
14971 ; return 0; }
14972 EOCP
14973 set try
14974 if eval $compile; then
14975     $echo "lchown() found." >&4
14976     val="$define"
14977 else
14978     $echo "lchown() NOT found." >&4
14979     val="$undef"
14980 fi
14981 set d_lchown
14982 eval $setvar
14983
14984 : See if number of significant digits in a double precision number is known
14985 echo " "
14986 $cat >ldbl_dig.c <<EOM
14987 #$i_limits I_LIMITS
14988 #$i_float I_FLOAT
14989 #ifdef I_LIMITS
14990 #include <limits.h>
14991 #endif
14992 #ifdef I_FLOAT
14993 #include <float.h>
14994 #endif
14995 #ifdef LDBL_DIG
14996 printf("Contains LDBL_DIG");
14997 #endif
14998 EOM
14999 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15000 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15001         echo "LDBL_DIG found." >&4
15002         val="$define"
15003 else
15004         echo "LDBL_DIG NOT found." >&4
15005         val="$undef"
15006 fi
15007 $rm -f ldbl_dig.?
15008 set d_ldbl_dig
15009 eval $setvar
15010
15011 : see if this is a math.h system
15012 set math.h i_math
15013 eval $inhdr
15014
15015 : check to see if math.h defines _LIB_VERSION
15016 d_libm_lib_version="$undef"
15017 case $i_math in
15018     $define)
15019         echo " "
15020         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15021         $cat >try.c <<EOCP
15022 #include <unistd.h>
15023 #include <math.h>
15024 int main (int argc, char *argv[])
15025 {
15026     printf ("%d\n", _LIB_VERSION);
15027     return (0);
15028     } /* main */
15029 EOCP
15030         set try
15031         if eval $compile; then
15032             foo=`$run ./try`
15033             echo "Yes, it does ($foo)" >&4
15034             d_libm_lib_version="$define"
15035         else
15036             echo "No, it does not (probably harmless)" >&4
15037             fi
15038         $rm_try
15039         ;;
15040
15041     esac
15042
15043 : see if link exists
15044 set link d_link
15045 eval $inlibc
15046
15047 : see if localtime_r exists
15048 set localtime_r d_localtime_r
15049 eval $inlibc
15050 case "$d_localtime_r" in
15051 "$define")
15052         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15053         case "$d_localtime_r_proto:$usethreads" in
15054         ":define")      d_localtime_r_proto=define
15055                 set d_localtime_r_proto localtime_r $hdrs
15056                 eval $hasproto ;;
15057         *)      ;;
15058         esac
15059         case "$d_localtime_r_proto" in
15060         define)
15061         case "$localtime_r_proto" in
15062         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15063         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15064         esac
15065         case "$localtime_r_proto" in
15066         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15067         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15068         esac
15069         case "$localtime_r_proto" in
15070         ''|0)   d_localtime_r=undef
15071                 localtime_r_proto=0
15072                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15073         * )     case "$localtime_r_proto" in
15074                 REENTRANT_PROTO*) ;;
15075                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15076                 esac
15077                 echo "Prototype: $try" ;;
15078         esac
15079         ;;
15080         *)      case "$usethreads" in
15081                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15082                 esac
15083                 d_localtime_r=undef
15084                 localtime_r_proto=0
15085                 ;;
15086         esac
15087         ;;
15088 *)      localtime_r_proto=0
15089         ;;
15090 esac
15091
15092 : see if localtime_r calls tzset
15093 case "$localtime_r_proto" in
15094 REENTRANT_PROTO*)
15095         $cat >try.c <<EOCP
15096 /*  Does our libc's localtime_r call tzset ?
15097  *  return 0 if so, 1 otherwise.
15098  */
15099 #$i_systypes    I_SYS_TYPES
15100 #$i_unistd      I_UNISTD
15101 #$i_time        I_TIME
15102 #$i_stdlib      I_STDLIB
15103 #$i_string      I_STRING
15104 #$i_malloc      I_MALLOC
15105 #ifdef I_SYS_TYPES
15106 #  include <sys/types.h>
15107 #endif
15108 #ifdef I_UNISTD
15109 #  include <unistd.h>
15110 #endif
15111 #ifdef I_TIME
15112 #  include <time.h>
15113 #endif
15114 #ifdef I_STDLIB
15115 #include <stdlib.h>
15116 #endif
15117 #ifdef I_STRING
15118 #  include <string.h>
15119 #else
15120 #  include <strings.h>
15121 #endif
15122 #ifdef I_MALLOC
15123 #  include <malloc.h>
15124 #endif
15125 int main()
15126 {
15127     time_t t = time(0L);
15128     char w_tz[]="TZ" "=GMT+5",
15129          e_tz[]="TZ" "=GMT-5",
15130         *tz_e = (char*)malloc(16),
15131         *tz_w = (char*)malloc(16);
15132     struct tm tm_e, tm_w;
15133     memset(&tm_e,'\0',sizeof(struct tm));
15134     memset(&tm_w,'\0',sizeof(struct tm));
15135     strcpy(tz_e,e_tz);
15136     strcpy(tz_w,w_tz);
15137
15138     putenv(tz_e);
15139     localtime_r(&t, &tm_e);
15140
15141     putenv(tz_w);
15142     localtime_r(&t, &tm_w);
15143
15144     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15145         return 1;
15146     return 0;
15147 }
15148 EOCP
15149         set try
15150         if eval $compile; then
15151             if $run ./try; then
15152                 d_localtime_r_needs_tzset=undef;
15153             else
15154                 d_localtime_r_needs_tzset=define;
15155             fi;
15156         else
15157             d_localtime_r_needs_tzset=undef;
15158         fi;
15159      ;;
15160   *)
15161      d_localtime_r_needs_tzset=undef;
15162      ;;
15163 esac
15164 $rm_try
15165
15166 : see if localeconv exists
15167 set localeconv d_locconv
15168 eval $inlibc
15169
15170 : see if lockf exists
15171 set lockf d_lockf
15172 eval $inlibc
15173
15174 : see if prototype for lseek is available
15175 echo " "
15176 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15177 eval $hasproto
15178
15179 : see if lstat exists
15180 set lstat d_lstat
15181 eval $inlibc
15182
15183 : see if madvise exists
15184 set madvise d_madvise
15185 eval $inlibc
15186
15187 : see if malloc_size exists
15188 set malloc_size d_malloc_size
15189 eval $inlibc
15190
15191 : see if malloc_size_good exists
15192 set malloc_good_size d_malloc_good_size
15193 eval $inlibc
15194
15195 : see if mblen exists
15196 set mblen d_mblen
15197 eval $inlibc
15198
15199 : see if mbstowcs exists
15200 set mbstowcs d_mbstowcs
15201 eval $inlibc
15202
15203 : see if mbtowc exists
15204 set mbtowc d_mbtowc
15205 eval $inlibc
15206
15207 : see if memchr exists
15208 set memchr d_memchr
15209 eval $inlibc
15210
15211 : see if memcmp exists
15212 set memcmp d_memcmp
15213 eval $inlibc
15214
15215 : see if memcpy exists
15216 set memcpy d_memcpy
15217 eval $inlibc
15218
15219 : see if memmove exists
15220 set memmove d_memmove
15221 eval $inlibc
15222
15223 : see if memset exists
15224 set memset d_memset
15225 eval $inlibc
15226
15227 : see if mkdir exists
15228 set mkdir d_mkdir
15229 eval $inlibc
15230
15231 : see if mkdtemp exists
15232 set mkdtemp d_mkdtemp
15233 eval $inlibc
15234
15235 : see if mkfifo exists
15236 set mkfifo d_mkfifo
15237 eval $inlibc
15238
15239 : see if mkstemp exists
15240 set mkstemp d_mkstemp
15241 eval $inlibc
15242
15243 : see if mkstemps exists
15244 set mkstemps d_mkstemps
15245 eval $inlibc
15246
15247 : see if mktime exists
15248 set mktime d_mktime
15249 eval $inlibc
15250
15251 : see if this is a sys/mman.h system
15252 set sys/mman.h i_sysmman
15253 eval $inhdr
15254
15255 : see if mmap exists
15256 set mmap d_mmap
15257 eval $inlibc
15258 : see what shmat returns
15259 : default to something harmless
15260 mmaptype='void *'
15261 case "$i_sysmman$d_mmap" in
15262 "$define$define")
15263         $cat >mmap.c <<'END'
15264 #include <sys/mman.h>
15265 void *mmap();
15266 END
15267         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15268                 mmaptype='void *'
15269         else
15270                 mmaptype='caddr_t'
15271         fi
15272         echo "and it returns ($mmaptype)." >&4
15273         ;;
15274 esac
15275
15276
15277
15278 : see if sqrtl exists
15279 set sqrtl d_sqrtl
15280 eval $inlibc
15281
15282 : see if scalbnl exists
15283 set scalbnl d_scalbnl
15284 eval $inlibc
15285
15286 : see if modfl exists
15287 set modfl d_modfl
15288 eval $inlibc
15289
15290 : see if prototype for modfl is available
15291 echo " "
15292 set d_modflproto modfl $i_math math.h
15293 eval $hasproto
15294
15295 d_modfl_pow32_bug="$undef"
15296
15297 case "$d_longdbl$d_modfl" in
15298 $define$define)
15299         $cat <<EOM
15300 Checking to see whether your modfl() is okay for large values...
15301 EOM
15302 $cat >try.c <<EOCP
15303 #include <math.h>
15304 #include <stdio.h>
15305 EOCP
15306 if $test "X$d_modflproto" != "X$define"; then
15307         $cat >>try.c <<EOCP
15308 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15309 long double modfl (long double, long double *);
15310 EOCP
15311 fi
15312 $cat >>try.c <<EOCP
15313 int main() {
15314     long double nv = 4294967303.15;
15315     long double v, w;
15316     v = modfl(nv, &w);
15317 #ifdef __GLIBC__
15318     printf("glibc");
15319 #endif
15320     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15321     return 0;
15322 }
15323 EOCP
15324         case "$osname:$gccversion" in
15325         aix:)   saveccflags="$ccflags"
15326                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15327         esac
15328         set try
15329         if eval $compile; then
15330                 foo=`$run ./try`
15331                 case "$foo" in
15332                 *" 4294967303.150000 1.150000 4294967302.000000")
15333                         echo >&4 "Your modfl() is broken for large values."
15334                         d_modfl_pow32_bug="$define"
15335                         case "$foo" in
15336                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15337                         ;;
15338                         esac
15339                         ;;
15340                 *" 4294967303.150000 0.150000 4294967303.000000")
15341                         echo >&4 "Your modfl() seems okay for large values."
15342                         ;;
15343                 *)      echo >&4 "I don't understand your modfl() at all."
15344                         d_modfl="$undef"
15345                         ;;
15346                 esac
15347                 $rm_try
15348         else
15349                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15350                 d_modfl="$undef"
15351         fi
15352         case "$osname:$gccversion" in
15353         aix:)   ccflags="$saveccflags" ;; # restore
15354         esac
15355         ;;
15356 esac
15357
15358 if $test "$uselongdouble" = "$define"; then
15359     message=""
15360     if $test "$d_sqrtl" != "$define"; then
15361         message="$message sqrtl"
15362     fi
15363     if $test "$d_modfl" != "$define"; then
15364         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15365             echo "You have both aintl and copysignl, so I can emulate modfl."
15366         else
15367             message="$message modfl"
15368         fi
15369     fi
15370     if $test "$d_frexpl" != "$define"; then
15371         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15372             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15373         else
15374             message="$message frexpl"
15375         fi
15376     fi
15377
15378     if $test "$message" != ""; then
15379         $cat <<EOM >&4
15380
15381 *** You requested the use of long doubles but you do not seem to have
15382 *** the following mathematical functions needed for long double support:
15383 ***    $message
15384 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15385 *** Cannot continue, aborting.
15386
15387 EOM
15388
15389         exit 1
15390     fi
15391 fi
15392
15393 : see if mprotect exists
15394 set mprotect d_mprotect
15395 eval $inlibc
15396
15397 : see if msgctl exists
15398 set msgctl d_msgctl
15399 eval $inlibc
15400
15401 : see if msgget exists
15402 set msgget d_msgget
15403 eval $inlibc
15404
15405 : see if msgsnd exists
15406 set msgsnd d_msgsnd
15407 eval $inlibc
15408
15409 : see if msgrcv exists
15410 set msgrcv d_msgrcv
15411 eval $inlibc
15412
15413 : see how much of the 'msg*(2)' library is present.
15414 h_msg=true
15415 echo " "
15416 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15417 *"$undef"*) h_msg=false;;
15418 esac
15419 case "$osname" in
15420 freebsd)
15421     case "`ipcs 2>&1`" in
15422     "SVID messages"*"not configured"*)
15423         echo "Your $osname does not have the msg*(2) configured." >&4
15424         h_msg=false
15425         val="$undef"
15426         set msgctl d_msgctl
15427         eval $setvar
15428         set msgget d_msgget
15429         eval $setvar
15430         set msgsnd d_msgsnd
15431         eval $setvar
15432         set msgrcv d_msgrcv
15433         eval $setvar
15434         ;;
15435     esac
15436     ;;
15437 esac
15438 : we could also check for sys/ipc.h ...
15439 if $h_msg && $test `./findhdr sys/msg.h`; then
15440         echo "You have the full msg*(2) library." >&4
15441         val="$define"
15442 else
15443         echo "You don't have the full msg*(2) library." >&4
15444         val="$undef"
15445 fi
15446 set d_msg
15447 eval $setvar
15448
15449 : Check for msghdr_s
15450 echo " "
15451 echo "Checking to see if your system supports struct msghdr..." >&4
15452 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15453 eval $hasstruct
15454 case "$d_msghdr_s" in
15455 "$define")      echo "Yes, it does."   ;;
15456 *)              echo "No, it doesn't." ;;
15457 esac
15458
15459
15460 : see if msync exists
15461 set msync d_msync
15462 eval $inlibc
15463
15464 : see if munmap exists
15465 set munmap d_munmap
15466 eval $inlibc
15467
15468 : see if nice exists
15469 set nice d_nice
15470 eval $inlibc
15471
15472 : see if this is a langinfo.h system
15473 set langinfo.h i_langinfo
15474 eval $inhdr
15475
15476 : see if nl_langinfo exists
15477 set nl_langinfo d_nl_langinfo
15478 eval $inlibc
15479
15480 : check for volatile keyword
15481 echo " "
15482 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15483 $cat >try.c <<'EOCP'
15484 int main()
15485 {
15486         typedef struct _goo_struct goo_struct;
15487         goo_struct * volatile goo = ((goo_struct *)0);
15488         struct _goo_struct {
15489                 long long_int;
15490                 int reg_int;
15491                 char char_var;
15492         };
15493         typedef unsigned short foo_t;
15494         char *volatile foo;
15495         volatile int bar;
15496         volatile foo_t blech;
15497         foo = foo;
15498 }
15499 EOCP
15500 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15501         val="$define"
15502         echo "Yup, it does."
15503 else
15504         val="$undef"
15505         echo "Nope, it doesn't."
15506 fi
15507 set d_volatile
15508 eval $setvar
15509 $rm_try
15510
15511 : Check basic sizes
15512 echo " "
15513 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15514
15515 case "$use64bitint:$d_quad:$quadtype" in
15516 define:define:?*)
15517         ivtype="$quadtype"
15518         uvtype="$uquadtype"
15519         ivsize=8
15520         uvsize=8
15521         ;;
15522 *)      ivtype="long"
15523         uvtype="unsigned long"
15524         ivsize=$longsize
15525         uvsize=$longsize
15526         ;;
15527 esac
15528
15529 case "$uselongdouble:$d_longdbl" in
15530 define:define)
15531         nvtype="long double"
15532         nvsize=$longdblsize
15533         ;;
15534 *)      nvtype=double
15535         nvsize=$doublesize
15536         ;;
15537 esac
15538
15539 $echo "(IV will be "$ivtype", $ivsize bytes)"
15540 $echo "(UV will be "$uvtype", $uvsize bytes)"
15541 $echo "(NV will be "$nvtype", $nvsize bytes)"
15542
15543 $cat >try.c <<EOCP
15544 #$i_inttypes I_INTTYPES
15545 #ifdef I_INTTYPES
15546 #include <inttypes.h>
15547 #endif
15548 #include <stdio.h>
15549 int main() {
15550 #ifdef INT8
15551    int8_t i =  INT8_MAX;
15552   uint8_t u = UINT8_MAX;
15553   printf("int8_t\n");
15554 #endif
15555 #ifdef INT16
15556    int16_t i =  INT16_MAX;
15557   uint16_t i = UINT16_MAX;
15558   printf("int16_t\n");
15559 #endif
15560 #ifdef INT32
15561    int32_t i =  INT32_MAX;
15562   uint32_t u = UINT32_MAX;
15563   printf("int32_t\n");
15564 #endif
15565 }
15566 EOCP
15567
15568 i8type="signed char"
15569 u8type="unsigned char"
15570 i8size=1
15571 u8size=1
15572
15573 case "$i16type" in
15574 '')     case "$shortsize" in
15575         2)      i16type=short
15576                 u16type="unsigned short"
15577                 i16size=$shortsize
15578                 u16size=$shortsize
15579                 ;;
15580         esac
15581         ;;
15582 esac
15583 case "$i16type" in
15584 '')     set try -DINT16
15585         if eval $compile; then
15586                 case "`$run ./try`" in
15587                 int16_t)
15588                         i16type=int16_t
15589                         u16type=uint16_t
15590                         i16size=2
15591                         u16size=2
15592                         ;;
15593                 esac
15594         fi
15595         ;;
15596 esac
15597 case "$i16type" in
15598 '')     if $test $shortsize -ge 2; then
15599                 i16type=short
15600                 u16type="unsigned short"
15601                 i16size=$shortsize
15602                 u16size=$shortsize
15603         fi
15604         ;;
15605 esac
15606
15607 case "$i32type" in
15608 '')     case "$longsize" in
15609         4)      i32type=long
15610                 u32type="unsigned long"
15611                 i32size=$longsize
15612                 u32size=$longsize
15613                 ;;
15614         *)      case "$intsize" in
15615                 4)      i32type=int
15616                         u32type="unsigned int"
15617                         i32size=$intsize
15618                         u32size=$intsize
15619                         ;;
15620                 esac
15621                 ;;
15622         esac
15623         ;;
15624 esac
15625 case "$i32type" in
15626 '')     set try -DINT32
15627         if eval $compile; then
15628                 case "`$run ./try`" in
15629                 int32_t)
15630                         i32type=int32_t
15631                         u32type=uint32_t
15632                         i32size=4
15633                         u32size=4
15634                         ;;
15635                 esac
15636         fi
15637         ;;
15638 esac
15639 case "$i32type" in
15640 '')     if $test $intsize -ge 4; then
15641                 i32type=int
15642                 u32type="unsigned int"
15643                 i32size=$intsize
15644                 u32size=$intsize
15645         fi
15646         ;;
15647 esac
15648
15649 case "$i64type" in
15650 '')     case "$d_quad:$quadtype" in
15651         define:?*)
15652                 i64type="$quadtype"
15653                 u64type="$uquadtype"
15654                 i64size=8
15655                 u64size=8
15656                 ;;
15657         esac
15658         ;;
15659 esac
15660
15661 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15662 : volatile so that the compiler has to store it out to memory.
15663 if test X"$d_volatile" = X"$define"; then
15664         volatile=volatile
15665 fi
15666 $cat <<EOP >try.c
15667 #include <stdio.h>
15668 #$i_stdlib I_STDLIB
15669 #ifdef I_STDLIB
15670 #include <stdlib.h>
15671 #endif
15672 #include <sys/types.h>
15673 #include <signal.h>
15674 #ifdef SIGFPE
15675 $volatile int bletched = 0;
15676 $signal_t blech(int s) { bletched = 1; }
15677 #endif
15678 int main() {
15679     $uvtype u = 0;
15680     $nvtype d;
15681     int     n = 8 * $uvsize;
15682     int     i;
15683 #ifdef SIGFPE
15684     signal(SIGFPE, blech);
15685 #endif
15686
15687     for (i = 0; i < n; i++) {
15688       u = u << 1 | ($uvtype)1;
15689       d = ($nvtype)u;
15690       if (($uvtype)d != u)
15691         break;
15692       if (d <= 0)
15693         break;
15694       d = ($nvtype)(u - 1);
15695       if (($uvtype)d != (u - 1))
15696         break;
15697 #ifdef SIGFPE
15698       if (bletched)
15699         break;
15700 #endif
15701     }
15702     printf("%d\n", ((i == n) ? -n : i));
15703     exit(0);
15704 }
15705 EOP
15706 set try
15707
15708 d_nv_preserves_uv="$undef"
15709 if eval $compile; then
15710         nv_preserves_uv_bits="`$run ./try`"
15711 fi
15712 case "$nv_preserves_uv_bits" in
15713 \-[1-9]*)
15714         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15715         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15716         d_nv_preserves_uv="$define"
15717         ;;
15718 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15719         d_nv_preserves_uv="$undef" ;;
15720 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15721         nv_preserves_uv_bits="0" ;;
15722 esac
15723 $rm_try
15724
15725 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15726 : volatile so that the compiler has to store it out to memory.
15727 if test X"$d_volatile" = X"$define"; then
15728         volatile=volatile
15729 fi
15730 $cat <<EOP >try.c
15731 #include <stdio.h>
15732
15733 typedef $nvtype NV;
15734
15735 int
15736 main() {
15737   NV value = 2;
15738   int count = 1;
15739
15740   while(count < 256) {
15741     $volatile NV up = value + 1.0;
15742     $volatile NV negated = -value;
15743     $volatile NV down = negated - 1.0;
15744     $volatile NV got_up = up - value;
15745     int up_good = got_up == 1.0;
15746     int got_down = down - negated;
15747     int down_good = got_down == -1.0;
15748
15749     if (down_good != up_good) {
15750       fprintf(stderr,
15751               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15752               up_good, (double) got_up, down_good, (double) got_down,
15753               count, (double) value);
15754       return 1;
15755     }
15756     if (!up_good) {
15757       while (1) {
15758         if (count > 8) {
15759           count -= 8;
15760           fputs("256.0", stdout);
15761         } else {
15762           count--;
15763           fputs("2.0", stdout);
15764         }
15765         if (!count) {
15766           puts("");
15767           return 0;
15768         }
15769         fputs("*", stdout);
15770       }
15771     }
15772     value *= 2;
15773     ++count;
15774   }
15775   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15776           count, (double) value);
15777   return 1;
15778 }
15779 EOP
15780 set try
15781
15782 nv_overflows_integers_at='0'
15783 if eval $compile; then
15784     xxx="`$run ./try`"
15785     case "$?" in
15786         0)
15787             case "$xxx" in
15788                 2*)  cat >&4 <<EOM
15789 The largest integer your NVs can preserve is equal to $xxx
15790 EOM
15791                     nv_overflows_integers_at="$xxx"
15792                     ;;
15793                 *)  cat >&4 <<EOM
15794 Cannot determine the largest integer value your NVs can hold, unexpected output
15795 '$xxx'
15796 EOM
15797                     ;;
15798             esac
15799             ;;
15800         *)  cat >&4 <<EOM
15801 Cannot determine the largest integer value your NVs can hold
15802 EOM
15803             ;;
15804     esac
15805 fi
15806 $rm_try
15807
15808 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15809 : volatile so that the compiler has to store it out to memory.
15810 if test X"$d_volatile" = X"$define"; then
15811         volatile=volatile
15812 fi
15813 $cat <<EOP >try.c
15814 #include <stdio.h>
15815 #$i_stdlib I_STDLIB
15816 #ifdef I_STDLIB
15817 #include <stdlib.h>
15818 #endif
15819 #$i_string I_STRING
15820 #ifdef I_STRING
15821 #  include <string.h>
15822 #else
15823 #  include <strings.h>
15824 #endif
15825 #include <sys/types.h>
15826 #include <signal.h>
15827 #ifdef SIGFPE
15828 $volatile int bletched = 0;
15829 $signal_t blech(int s) { bletched = 1; }
15830 #endif
15831
15832 int checkit($nvtype d, char *where) {
15833     unsigned char *p = (char *)&d;
15834     unsigned char *end = p + sizeof(d);
15835     int fail = 0;
15836
15837     while (p < end)
15838         fail += *p++;
15839
15840     if (!fail)
15841         return 0;
15842
15843     p = (char *)&d;
15844     printf("No - %s: 0x", where);
15845     while (p < end)
15846         printf ("%02X", *p++);
15847     printf("\n");
15848     return 1;
15849 }
15850
15851 int main(int argc, char **argv) {
15852     $nvtype d = 0.0;
15853     int fail = 0;
15854     fail += checkit(d, "0.0");
15855
15856     /* The compiler shouldn't be assuming that bletched is 0  */
15857     d = bletched;
15858
15859     fail += checkit(d, "bleched");
15860
15861 #ifdef SIGFPE
15862     signal(SIGFPE, blech);
15863 #endif
15864
15865     /* Paranoia - the compiler should have no way of knowing that ANSI says
15866        that argv[argc] will always be NULL.  Actually, if it did assume this it
15867        would be buggy, as this is C and main() can be called from elsewhere in
15868        the program.  */
15869     d = argv[argc] ? 1 : 0;
15870
15871     if (d) {
15872         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15873     }
15874
15875     fail += checkit(d, "ternary");
15876
15877     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15878
15879     if (d != 0.0) {
15880         printf("No - memset doesn't give 0.0\n");
15881         /* This might just blow up:  */
15882         printf("(gives %g)\n", d);
15883         return 1;
15884     }
15885
15886 #ifdef SIGFPE
15887     if (bletched) {
15888         printf("No - something bleched\n");
15889         return 1;
15890     }
15891 #endif
15892     if (fail) {
15893       printf("No - %d fail(s)\n", fail);
15894       return 1;
15895     }
15896     printf("Yes\n");
15897     return 0;
15898 }
15899 EOP
15900 set try
15901
15902 d_nv_zero_is_allbits_zero="$undef"
15903 if eval $compile; then
15904     xxx="`$run ./try`"
15905     case "$?" in
15906         0)
15907             case "$xxx" in
15908                 Yes)  cat >&4 <<EOM
15909 0.0 is represented as all bits zero in memory
15910 EOM
15911                     d_nv_zero_is_allbits_zero="$define"
15912                     ;;
15913                 *)  cat >&4 <<EOM
15914 0.0 is not represented as all bits zero in memory
15915 EOM
15916                     d_nv_zero_is_allbits_zero="$undef"
15917                     ;;
15918             esac
15919             ;;
15920         *)  cat >&4 <<EOM
15921 0.0 is not represented as all bits zero in memory
15922 EOM
15923             d_nv_zero_is_allbits_zero="$undef"
15924             ;;
15925     esac
15926 fi
15927 $rm_try
15928
15929 : check for off64_t
15930 echo " "
15931 echo "Checking to see if you have off64_t..." >&4
15932 $cat >try.c <<EOCP
15933 #include <sys/types.h>
15934 #include <unistd.h>
15935 int main() { off64_t x = 7; }
15936 EOCP
15937 set try
15938 if eval $compile; then
15939         val="$define"
15940         echo "You have off64_t."
15941 else
15942         val="$undef"
15943         echo "You do not have off64_t."
15944         case "$lseeksize" in
15945         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15946         esac
15947 fi
15948 $rm_try
15949 set d_off64_t
15950 eval $setvar
15951
15952 : how to create joinable pthreads
15953 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15954         echo " "
15955         echo "Checking what constant to use for creating joinable pthreads..." >&4
15956         $cat >try.c <<'EOCP'
15957 #include <pthread.h>
15958 int main() {
15959     int detachstate = JOINABLE;
15960 }
15961 EOCP
15962         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15963         if eval $compile; then
15964                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15965                 val="$undef" # Yes, undef.
15966                 set d_old_pthread_create_joinable
15967                 eval $setvar
15968                 val=""
15969                 set old_pthread_create_joinable
15970                 eval $setvar
15971         else
15972                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15973                 if eval $compile; then
15974                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15975                         val="$define"
15976                         set d_old_pthread_create_joinable
15977                         eval $setvar
15978                         val=PTHREAD_CREATE_UNDETACHED
15979                         set old_pthread_create_joinable
15980                         eval $setvar
15981                 else
15982                         set try -DJOINABLE=__UNDETACHED
15983                         if eval $compile; then
15984                                 echo "You seem to use __UNDETACHED." >&4
15985                                 val="$define"
15986                                 set d_old_pthread_create_joinable
15987                                 eval $setvar
15988                                 val=__UNDETACHED
15989                                 set old_pthread_create_joinable
15990                                 eval $setvar
15991                         else
15992                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15993                                 val="$define"
15994                                 set d_old_pthread_create_joinable
15995                                 eval $setvar
15996                                 val=0
15997                                 set old_pthread_create_joinable
15998                                 eval $setvar
15999                         fi
16000                 fi
16001         fi
16002         $rm_try
16003 else
16004     d_old_pthread_create_joinable="$undef"
16005     old_pthread_create_joinable=""
16006 fi
16007
16008 : see if pause exists
16009 set pause d_pause
16010 eval $inlibc
16011
16012 : see if poll exists
16013 set poll d_poll
16014 eval $inlibc
16015
16016 : see if prctl exists
16017 set prctl d_prctl
16018 eval $inlibc
16019
16020 : see if prctl supports PR_SET_NAME
16021 d_prctl_set_name=$undef
16022 case $d_prctl in
16023     $define)
16024         $cat >try.c <<EOM
16025 #include <sys/prctl.h>
16026
16027 int main (int argc, char *argv[])
16028 {
16029     return (prctl (PR_SET_NAME, "Test"));
16030     } /* main */
16031 EOM
16032         set try
16033         if eval $compile_ok && $run ./try; then
16034             echo "Your prctl (PR_SET_NAME, ...) works"
16035             d_prctl_set_name=$define
16036             fi
16037         $rm_try
16038         ;;
16039     esac
16040
16041 : see if readlink exists
16042 set readlink d_readlink
16043 eval $inlibc
16044
16045 : Check if exe is symlink to abs path of executing program
16046 echo " "
16047 procselfexe=''
16048 val="$undef"
16049 case "$d_readlink" in
16050     "$define")
16051         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16052         : more tidy to avoid an extra level of symlink
16053         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16054         while test $# -gt 0; do
16055             type=$1; try=$2
16056             shift; shift
16057             if $issymlink $try; then
16058                 $ls -l $try > reflect
16059                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16060                     echo "You have $type-like $try."
16061                     procselfexe='"'$try'"'
16062                     val="$define"
16063                     : This will break out of the loop
16064                     set X; shift
16065                 fi
16066             fi
16067         done
16068         ;;
16069 esac
16070 $rm -f reflect
16071 set d_procselfexe
16072 eval $setvar
16073
16074 : backward compatibility for d_hvfork
16075 if test X$d_hvfork != X; then
16076         d_vfork="$d_hvfork"
16077         d_hvfork=''
16078 fi
16079 : see if there is a vfork
16080 val=''
16081 set vfork val
16082 eval $inlibc
16083
16084 d_pseudofork=$undef
16085
16086 : Ok, but do we want to use it. vfork is reportedly unreliable in
16087 : perl on Solaris 2.x, and probably elsewhere.
16088 case "$val" in
16089 $define)
16090         echo " "
16091         case "$usevfork" in
16092         false) dflt='n';;
16093         *) dflt='y';;
16094         esac
16095         cat <<'EOM'
16096
16097 Perl can only use a vfork() that doesn't suffer from strict
16098 restrictions on calling functions or modifying global data in
16099 the child.  For example, glibc-2.1 contains such a vfork()
16100 that is unsuitable.  If your system provides a proper fork()
16101 call, chances are that you do NOT want perl to use vfork().
16102
16103 EOM
16104         rp="Do you still want to use vfork()?"
16105         . ./myread
16106         case "$ans" in
16107         y|Y) ;;
16108         *)
16109                 echo "Ok, we won't use vfork()."
16110                 val="$undef"
16111                 ;;
16112         esac
16113         ;;
16114 esac
16115 set d_vfork
16116 eval $setvar
16117 case "$d_vfork" in
16118 $define) usevfork='true';;
16119 *) usevfork='false';;
16120 esac
16121
16122 : see whether the pthread_atfork exists
16123 $cat >try.c <<EOP
16124 #include <pthread.h>
16125 #include <stdio.h>
16126 int main() {
16127 #ifdef  PTHREAD_ATFORK
16128         pthread_atfork(NULL,NULL,NULL);
16129 #endif
16130 }
16131 EOP
16132
16133 : see if pthread_atfork exists
16134 set try -DPTHREAD_ATFORK
16135 if eval $compile; then
16136     val="$define"
16137 else
16138     val="$undef"
16139 fi
16140 case "$usethreads" in
16141 $define)
16142         case "$val" in
16143         $define) echo 'pthread_atfork found.' >&4        ;;
16144         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16145         esac
16146 esac
16147 set d_pthread_atfork
16148 eval $setvar
16149
16150 : see if pthread_attr_setscope exists
16151 set pthread_attr_setscope d_pthread_attr_setscope
16152 eval $inlibc
16153
16154 : see whether the various POSIXish _yields exist
16155 $cat >try.c <<EOP
16156 #include <pthread.h>
16157 #include <stdio.h>
16158 int main() {
16159 #ifdef SCHED_YIELD
16160         sched_yield();
16161 #else
16162 #ifdef PTHREAD_YIELD
16163         pthread_yield();
16164 #else
16165 #ifdef PTHREAD_YIELD_NULL
16166         pthread_yield(NULL);
16167 #endif
16168 #endif
16169 #endif
16170 }
16171 EOP
16172 : see if sched_yield exists
16173 set try -DSCHED_YIELD
16174 if eval $compile; then
16175     val="$define"
16176     sched_yield='sched_yield()'
16177 else
16178     val="$undef"
16179 fi
16180 case "$usethreads" in
16181 $define)
16182         case "$val" in
16183         $define) echo 'sched_yield() found.' >&4        ;;
16184         *)       echo 'sched_yield() NOT found.' >&4    ;;
16185         esac
16186 esac
16187 set d_sched_yield
16188 eval $setvar
16189
16190 : see if pthread_yield exists
16191 set try -DPTHREAD_YIELD
16192 if eval $compile; then
16193     val="$define"
16194     case "$sched_yield" in
16195     '') sched_yield='pthread_yield()' ;;
16196     esac
16197 else
16198     set try -DPTHREAD_YIELD_NULL
16199     if eval $compile; then
16200         val="$define"
16201         case "$sched_yield" in
16202         '') sched_yield='pthread_yield(NULL)' ;;
16203         esac
16204     else
16205         val="$undef"
16206     fi
16207 fi
16208 case "$usethreads" in
16209 $define)
16210         case "$val" in
16211         $define) echo 'pthread_yield() found.' >&4      ;;
16212         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16213         esac
16214         ;;
16215 esac
16216 set d_pthread_yield
16217 eval $setvar
16218 case "$sched_yield" in
16219 '') sched_yield=undef ;;
16220 esac
16221 $rm_try
16222
16223 : see if random_r exists
16224 set random_r d_random_r
16225 eval $inlibc
16226 case "$d_random_r" in
16227 "$define")
16228         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16229         case "$d_random_r_proto:$usethreads" in
16230         ":define")      d_random_r_proto=define
16231                 set d_random_r_proto random_r $hdrs
16232                 eval $hasproto ;;
16233         *)      ;;
16234         esac
16235         case "$d_random_r_proto" in
16236         define)
16237         case "$random_r_proto" in
16238         ''|0) try='int random_r(int*, struct random_data*);'
16239         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16240         esac
16241         case "$random_r_proto" in
16242         ''|0) try='int random_r(long*, struct random_data*);'
16243         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16244         esac
16245         case "$random_r_proto" in
16246         ''|0) try='int random_r(struct random_data*, int32_t*);'
16247         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16248         esac
16249         case "$random_r_proto" in
16250         ''|0)   d_random_r=undef
16251                 random_r_proto=0
16252                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16253         * )     case "$random_r_proto" in
16254                 REENTRANT_PROTO*) ;;
16255                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16256                 esac
16257                 echo "Prototype: $try" ;;
16258         esac
16259         ;;
16260         *)      case "$usethreads" in
16261                 define) echo "random_r has no prototype, not using it." >&4 ;;
16262                 esac
16263                 d_random_r=undef
16264                 random_r_proto=0
16265                 ;;
16266         esac
16267         ;;
16268 *)      random_r_proto=0
16269         ;;
16270 esac
16271
16272 : see if readdir and friends exist
16273 set readdir d_readdir
16274 eval $inlibc
16275 set seekdir d_seekdir
16276 eval $inlibc
16277 set telldir d_telldir
16278 eval $inlibc
16279 set rewinddir d_rewinddir
16280 eval $inlibc
16281
16282 : see if readdir64_r exists
16283 set readdir64_r d_readdir64_r
16284 eval $inlibc
16285 case "$d_readdir64_r" in
16286 "$define")
16287         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16288         case "$d_readdir64_r_proto:$usethreads" in
16289         ":define")      d_readdir64_r_proto=define
16290                 set d_readdir64_r_proto readdir64_r $hdrs
16291                 eval $hasproto ;;
16292         *)      ;;
16293         esac
16294         case "$d_readdir64_r_proto" in
16295         define)
16296         case "$readdir64_r_proto" in
16297         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16298         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16299         esac
16300         case "$readdir64_r_proto" in
16301         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16302         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16303         esac
16304         case "$readdir64_r_proto" in
16305         ''|0)   d_readdir64_r=undef
16306                 readdir64_r_proto=0
16307                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16308         * )     case "$readdir64_r_proto" in
16309                 REENTRANT_PROTO*) ;;
16310                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16311                 esac
16312                 echo "Prototype: $try" ;;
16313         esac
16314         ;;
16315         *)      case "$usethreads" in
16316                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16317                 esac
16318                 d_readdir64_r=undef
16319                 readdir64_r_proto=0
16320                 ;;
16321         esac
16322         ;;
16323 *)      readdir64_r_proto=0
16324         ;;
16325 esac
16326
16327 : see if readdir_r exists
16328 set readdir_r d_readdir_r
16329 eval $inlibc
16330 case "$d_readdir_r" in
16331 "$define")
16332         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16333         case "$d_readdir_r_proto:$usethreads" in
16334         ":define")      d_readdir_r_proto=define
16335                 set d_readdir_r_proto readdir_r $hdrs
16336                 eval $hasproto ;;
16337         *)      ;;
16338         esac
16339         case "$d_readdir_r_proto" in
16340         define)
16341         case "$readdir_r_proto" in
16342         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16343         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16344         esac
16345         case "$readdir_r_proto" in
16346         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16347         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16348         esac
16349         case "$readdir_r_proto" in
16350         ''|0)   d_readdir_r=undef
16351                 readdir_r_proto=0
16352                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16353         * )     case "$readdir_r_proto" in
16354                 REENTRANT_PROTO*) ;;
16355                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16356                 esac
16357                 echo "Prototype: $try" ;;
16358         esac
16359         ;;
16360         *)      case "$usethreads" in
16361                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16362                 esac
16363                 d_readdir_r=undef
16364                 readdir_r_proto=0
16365                 ;;
16366         esac
16367         ;;
16368 *)      readdir_r_proto=0
16369         ;;
16370 esac
16371
16372 : see if readv exists
16373 set readv d_readv
16374 eval $inlibc
16375
16376 : see if recvmsg exists
16377 set recvmsg d_recvmsg
16378 eval $inlibc
16379
16380 : see if rename exists
16381 set rename d_rename
16382 eval $inlibc
16383
16384 : see if rmdir exists
16385 set rmdir d_rmdir
16386 eval $inlibc
16387
16388 : see if memory.h is available.
16389 val=''
16390 set memory.h val
16391 eval $inhdr
16392
16393 : See if it conflicts with string.h
16394 case "$val" in
16395 $define)
16396         case "$strings" in
16397         '') ;;
16398         *)
16399                 $cppstdin $cppflags $cppminus < $strings > mem.h
16400                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16401                         echo " "
16402                         echo "We won't be including <memory.h>."
16403                         val="$undef"
16404                 fi
16405                 $rm -f mem.h
16406                 ;;
16407         esac
16408 esac
16409 set i_memory
16410 eval $setvar
16411
16412 : can bcopy handle overlapping blocks?
16413 echo " "
16414 val="$undef"
16415 case "$d_memmove" in
16416 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16417 *)      case "$d_bcopy" in
16418         "$define")
16419                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16420                 $cat >try.c <<EOCP
16421 #$i_memory I_MEMORY
16422 #$i_stdlib I_STDLIB
16423 #$i_string I_STRING
16424 #$i_unistd I_UNISTD
16425 EOCP
16426         $cat >>try.c <<'EOCP'
16427 #include <stdio.h>
16428 #ifdef I_MEMORY
16429 #  include <memory.h>
16430 #endif
16431 #ifdef I_STDLIB
16432 #  include <stdlib.h>
16433 #endif
16434 #ifdef I_STRING
16435 #  include <string.h>
16436 #else
16437 #  include <strings.h>
16438 #endif
16439 #ifdef I_UNISTD
16440 #  include <unistd.h>  /* Needed for NetBSD */
16441 #endif
16442 int main()
16443 {
16444 char buf[128], abc[128];
16445 char *b;
16446 int len;
16447 int off;
16448 int align;
16449
16450 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16451    try to store the string in read-only memory. */
16452 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16453
16454 for (align = 7; align >= 0; align--) {
16455         for (len = 36; len; len--) {
16456                 b = buf+align;
16457                 bcopy(abc, b, len);
16458                 for (off = 1; off <= len; off++) {
16459                         bcopy(b, b+off, len);
16460                         bcopy(b+off, b, len);
16461                         if (bcmp(b, abc, len))
16462                                 exit(1);
16463                 }
16464         }
16465 }
16466 exit(0);
16467 }
16468 EOCP
16469                 set try
16470                 if eval $compile_ok; then
16471                         if $run ./try 2>/dev/null; then
16472                                 echo "Yes, it can."
16473                                 val="$define"
16474                         else
16475                                 echo "It can't, sorry."
16476                         fi
16477                 else
16478                         echo "(I can't compile the test program, so we'll assume not...)"
16479                 fi
16480                 ;;
16481         esac
16482         $rm_try
16483         ;;
16484 esac
16485 set d_safebcpy
16486 eval $setvar
16487
16488 : can memcpy handle overlapping blocks?
16489 echo " "
16490 val="$undef"
16491 case "$d_memmove" in
16492 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16493 *)      case "$d_memcpy" in
16494         "$define")
16495                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16496                 $cat >try.c <<EOCP
16497 #$i_memory I_MEMORY
16498 #$i_stdlib I_STDLIB
16499 #$i_string I_STRING
16500 #$i_unistd I_UNISTD
16501 EOCP
16502         $cat >>try.c <<'EOCP'
16503 #include <stdio.h>
16504 #ifdef I_MEMORY
16505 #  include <memory.h>
16506 #endif
16507 #ifdef I_STDLIB
16508 #  include <stdlib.h>
16509 #endif
16510 #ifdef I_STRING
16511 #  include <string.h>
16512 #else
16513 #  include <strings.h>
16514 #endif
16515 #ifdef I_UNISTD
16516 #  include <unistd.h>  /* Needed for NetBSD */
16517 #endif
16518 int main()
16519 {
16520 char buf[128], abc[128];
16521 char *b;
16522 int len;
16523 int off;
16524 int align;
16525
16526 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16527    try to store the string in read-only memory. */
16528 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16529
16530 for (align = 7; align >= 0; align--) {
16531         for (len = 36; len; len--) {
16532                 b = buf+align;
16533                 memcpy(b, abc, len);
16534                 for (off = 1; off <= len; off++) {
16535                         memcpy(b+off, b, len);
16536                         memcpy(b, b+off, len);
16537                         if (memcmp(b, abc, len))
16538                                 exit(1);
16539                 }
16540         }
16541 }
16542 exit(0);
16543 }
16544 EOCP
16545                 set try
16546                 if eval $compile_ok; then
16547                         if $run ./try 2>/dev/null; then
16548                                 echo "Yes, it can."
16549                                 val="$define"
16550                         else
16551                                 echo "It can't, sorry."
16552                         fi
16553                 else
16554                         echo "(I can't compile the test program, so we'll assume not...)"
16555                 fi
16556                 ;;
16557         esac
16558         $rm_try
16559         ;;
16560 esac
16561 set d_safemcpy
16562 eval $setvar
16563
16564 : can memcmp be trusted to compare relative magnitude?
16565 val="$undef"
16566 case "$d_memcmp" in
16567 "$define")
16568         echo " "
16569         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16570         $cat >try.c <<EOCP
16571 #$i_memory I_MEMORY
16572 #$i_stdlib I_STDLIB
16573 #$i_string I_STRING
16574 #$i_unistd I_UNISTD
16575 EOCP
16576         $cat >>try.c <<'EOCP'
16577 #include <stdio.h>
16578 #ifdef I_MEMORY
16579 #  include <memory.h>
16580 #endif
16581 #ifdef I_STDLIB
16582 #  include <stdlib.h>
16583 #endif
16584 #ifdef I_STRING
16585 #  include <string.h>
16586 #else
16587 #  include <strings.h>
16588 #endif
16589 #ifdef I_UNISTD
16590 #  include <unistd.h>  /* Needed for NetBSD */
16591 #endif
16592 int main()
16593 {
16594 char a = -1;
16595 char b = 0;
16596 if ((a < b) && memcmp(&a, &b, 1) < 0)
16597         exit(1);
16598 exit(0);
16599 }
16600 EOCP
16601         set try
16602         if eval $compile_ok; then
16603                 if $run ./try 2>/dev/null; then
16604                         echo "Yes, it can."
16605                         val="$define"
16606                 else
16607                         echo "No, it can't (it uses signed chars)."
16608                 fi
16609         else
16610                 echo "(I can't compile the test program, so we'll assume not...)"
16611         fi
16612         ;;
16613 esac
16614 $rm_try
16615 set d_sanemcmp
16616 eval $setvar
16617
16618 : see if prototype for sbrk is available
16619 echo " "
16620 set d_sbrkproto sbrk $i_unistd unistd.h
16621 eval $hasproto
16622
16623 : see if select exists
16624 set select d_select
16625 eval $inlibc
16626
16627 : see if semctl exists
16628 set semctl d_semctl
16629 eval $inlibc
16630
16631 : see if semget exists
16632 set semget d_semget
16633 eval $inlibc
16634
16635 : see if semop exists
16636 set semop d_semop
16637 eval $inlibc
16638
16639 : see how much of the 'sem*(2)' library is present.
16640 h_sem=true
16641 echo " "
16642 case "$d_semctl$d_semget$d_semop" in
16643 *"$undef"*) h_sem=false;;
16644 esac
16645 case "$osname" in
16646 freebsd)
16647     case "`ipcs 2>&1`" in
16648     "SVID messages"*"not configured"*)
16649         echo "Your $osname does not have the sem*(2) configured." >&4
16650         h_sem=false
16651         val="$undef"
16652         set semctl d_semctl
16653         eval $setvar
16654         set semget d_semget
16655         eval $setvar
16656         set semop d_semop
16657         eval $setvar
16658         ;;
16659     esac
16660     ;;
16661 esac
16662 : we could also check for sys/ipc.h ...
16663 if $h_sem && $test `./findhdr sys/sem.h`; then
16664         echo "You have the full sem*(2) library." >&4
16665         val="$define"
16666 else
16667         echo "You don't have the full sem*(2) library." >&4
16668         val="$undef"
16669 fi
16670 set d_sem
16671 eval $setvar
16672
16673 : see whether sys/sem.h defines union semun
16674 echo " "
16675 $cat > try.c <<'END'
16676 #include <sys/types.h>
16677 #include <sys/ipc.h>
16678 #include <sys/sem.h>
16679 int main () { union semun semun; semun.buf = 0; }
16680 END
16681 set try
16682 if eval $compile; then
16683     echo "You have union semun in <sys/sem.h>." >&4
16684     val="$define"
16685 else
16686     echo "You do not have union semun in <sys/sem.h>." >&4
16687     val="$undef"
16688 fi
16689 $rm_try
16690 set d_union_semun
16691 eval $setvar
16692
16693 : see how to do semctl IPC_STAT
16694 case "$d_sem" in
16695 $define)
16696     echo " "
16697     $cat > tryh.h <<END
16698 #ifndef S_IRUSR
16699 #   ifdef S_IREAD
16700 #       define S_IRUSR S_IREAD
16701 #       define S_IWUSR S_IWRITE
16702 #       define S_IXUSR S_IEXEC
16703 #   else
16704 #       define S_IRUSR 0400
16705 #       define S_IWUSR 0200
16706 #       define S_IXUSR 0100
16707 #   endif
16708 #   define S_IRGRP (S_IRUSR>>3)
16709 #   define S_IWGRP (S_IWUSR>>3)
16710 #   define S_IXGRP (S_IXUSR>>3)
16711 #   define S_IROTH (S_IRUSR>>6)
16712 #   define S_IWOTH (S_IWUSR>>6)
16713 #   define S_IXOTH (S_IXUSR>>6)
16714 #endif
16715 #ifndef S_IRWXU
16716 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16717 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16718 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16719 #endif
16720 END
16721     : see whether semctl IPC_STAT can use union semun
16722     case "$d_semctl_semun" in
16723     '')
16724       val="$undef"
16725       $cat > try.c <<END
16726 #include <sys/types.h>
16727 #include <sys/ipc.h>
16728 #include <sys/sem.h>
16729 #include <sys/stat.h>
16730 #include <stdio.h>
16731 #include <errno.h>
16732 #include "tryh.h"
16733 #ifndef errno
16734 extern int errno;
16735 #endif
16736 #$d_union_semun HAS_UNION_SEMUN
16737 int main() {
16738     union semun
16739 #ifndef HAS_UNION_SEMUN
16740     {
16741         int val;
16742         struct semid_ds *buf;
16743         unsigned short *array;
16744     }
16745 #endif
16746     arg;
16747     int sem, st;
16748
16749 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16750     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16751     if (sem > -1) {
16752         struct semid_ds argbuf;
16753         arg.buf = &argbuf;
16754 #       ifdef IPC_STAT
16755         st = semctl(sem, 0, IPC_STAT, arg);
16756         if (st == 0)
16757             printf("semun\n");
16758         else
16759 #       endif /* IPC_STAT */
16760             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16761 #       ifdef IPC_RMID
16762         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16763 #       endif /* IPC_RMID */
16764             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16765     } else
16766 #endif /* IPC_PRIVATE && ... */
16767         printf("semget failed: errno = %d\n", errno);
16768   return 0;
16769 }
16770 END
16771       set try
16772       if eval $compile; then
16773           xxx=`$run ./try`
16774           case "$xxx" in
16775           semun) val="$define" ;;
16776           esac
16777       fi
16778       $rm_try
16779       set d_semctl_semun
16780       eval $setvar
16781       ;;
16782     esac
16783     case "$d_semctl_semun" in
16784     $define)
16785         echo "You can use union semun for semctl IPC_STAT." >&4
16786         also='also'
16787         ;;
16788     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16789         also=''
16790         ;;
16791     esac
16792
16793     : see whether semctl IPC_STAT can use struct semid_ds pointer
16794     case "$d_semctl_semid_ds" in
16795     '')
16796       val="$undef"
16797       $cat > try.c <<'END'
16798 #include <sys/types.h>
16799 #include <sys/ipc.h>
16800 #include <sys/sem.h>
16801 #include <sys/stat.h>
16802 #include "tryh.h"
16803 #include <stdio.h>
16804 #include <errno.h>
16805 #ifndef errno
16806 extern int errno;
16807 #endif
16808 int main() {
16809     struct semid_ds arg;
16810     int sem, st;
16811
16812 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16813     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16814     if (sem > -1) {
16815 #       ifdef IPC_STAT
16816         st = semctl(sem, 0, IPC_STAT, &arg);
16817         if (st == 0)
16818             printf("semid_ds\n");
16819         else
16820 #       endif /* IPC_STAT */
16821             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16822 #       ifdef IPC_RMID
16823         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16824 #       endif /* IPC_RMID */
16825             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16826     } else
16827 #endif /* IPC_PRIVATE && ... */
16828         printf("semget failed: errno = %d\n", errno);
16829
16830     return 0;
16831 }
16832 END
16833       set try
16834       if eval $compile; then
16835           xxx=`$run ./try`
16836           case "$xxx" in
16837           semid_ds) val="$define" ;;
16838           esac
16839       fi
16840       $rm_try
16841       set d_semctl_semid_ds
16842       eval $setvar
16843       ;;
16844     esac
16845     case "$d_semctl_semid_ds" in
16846     $define)
16847         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16848         ;;
16849     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16850         ;;
16851     esac
16852     ;;
16853 *)  val="$undef"
16854
16855     # We do not have the full sem*(2) library, so assume we can not
16856     # use either.
16857
16858     set d_semctl_semun
16859     eval $setvar
16860
16861     set d_semctl_semid_ds
16862     eval $setvar
16863     ;;
16864 esac
16865 $rm_try tryh.h
16866
16867 : see if sendmsg exists
16868 set sendmsg d_sendmsg
16869 eval $inlibc
16870
16871 : see if setegid exists
16872 set setegid d_setegid
16873 eval $inlibc
16874
16875 : see if seteuid exists
16876 set seteuid d_seteuid
16877 eval $inlibc
16878
16879 : see if setgrent exists
16880 set setgrent d_setgrent
16881 eval $inlibc
16882
16883 : see if setgrent_r exists
16884 set setgrent_r d_setgrent_r
16885 eval $inlibc
16886 case "$d_setgrent_r" in
16887 "$define")
16888         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16889         case "$d_setgrent_r_proto:$usethreads" in
16890         ":define")      d_setgrent_r_proto=define
16891                 set d_setgrent_r_proto setgrent_r $hdrs
16892                 eval $hasproto ;;
16893         *)      ;;
16894         esac
16895         case "$d_setgrent_r_proto" in
16896         define)
16897         case "$setgrent_r_proto" in
16898         ''|0) try='int setgrent_r(FILE**);'
16899         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16900         esac
16901         case "$setgrent_r_proto" in
16902         ''|0) try='void setgrent_r(FILE**);'
16903         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16904         esac
16905         case "$setgrent_r_proto" in
16906         ''|0)   d_setgrent_r=undef
16907                 setgrent_r_proto=0
16908                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16909         * )     case "$setgrent_r_proto" in
16910                 REENTRANT_PROTO*) ;;
16911                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16912                 esac
16913                 echo "Prototype: $try" ;;
16914         esac
16915         ;;
16916         *)      case "$usethreads" in
16917                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16918                 esac
16919                 d_setgrent_r=undef
16920                 setgrent_r_proto=0
16921                 ;;
16922         esac
16923         ;;
16924 *)      setgrent_r_proto=0
16925         ;;
16926 esac
16927
16928 : see if sethostent exists
16929 set sethostent d_sethent
16930 eval $inlibc
16931
16932 : see if sethostent_r exists
16933 set sethostent_r d_sethostent_r
16934 eval $inlibc
16935 case "$d_sethostent_r" in
16936 "$define")
16937         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16938         case "$d_sethostent_r_proto:$usethreads" in
16939         ":define")      d_sethostent_r_proto=define
16940                 set d_sethostent_r_proto sethostent_r $hdrs
16941                 eval $hasproto ;;
16942         *)      ;;
16943         esac
16944         case "$d_sethostent_r_proto" in
16945         define)
16946         case "$sethostent_r_proto" in
16947         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16948         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16949         esac
16950         case "$sethostent_r_proto" in
16951         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16952         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16953         esac
16954         case "$sethostent_r_proto" in
16955         ''|0)   d_sethostent_r=undef
16956                 sethostent_r_proto=0
16957                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16958         * )     case "$sethostent_r_proto" in
16959                 REENTRANT_PROTO*) ;;
16960                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16961                 esac
16962                 echo "Prototype: $try" ;;
16963         esac
16964         ;;
16965         *)      case "$usethreads" in
16966                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16967                 esac
16968                 d_sethostent_r=undef
16969                 sethostent_r_proto=0
16970                 ;;
16971         esac
16972         ;;
16973 *)      sethostent_r_proto=0
16974         ;;
16975 esac
16976
16977 : see if setitimer exists
16978 set setitimer d_setitimer
16979 eval $inlibc
16980
16981 : see if setlinebuf exists
16982 set setlinebuf d_setlinebuf
16983 eval $inlibc
16984
16985 : see if setlocale exists
16986 set setlocale d_setlocale
16987 eval $inlibc
16988
16989 : see if locale.h is available
16990 set locale.h i_locale
16991 eval $inhdr
16992
16993 : see if setlocale_r exists
16994 set setlocale_r d_setlocale_r
16995 eval $inlibc
16996 case "$d_setlocale_r" in
16997 "$define")
16998         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16999         case "$d_setlocale_r_proto:$usethreads" in
17000         ":define")      d_setlocale_r_proto=define
17001                 set d_setlocale_r_proto setlocale_r $hdrs
17002                 eval $hasproto ;;
17003         *)      ;;
17004         esac
17005         case "$d_setlocale_r_proto" in
17006         define)
17007         case "$setlocale_r_proto" in
17008         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17009         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17010         esac
17011         case "$setlocale_r_proto" in
17012         ''|0)   d_setlocale_r=undef
17013                 setlocale_r_proto=0
17014                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17015         * )     case "$setlocale_r_proto" in
17016                 REENTRANT_PROTO*) ;;
17017                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17018                 esac
17019                 echo "Prototype: $try" ;;
17020         esac
17021         ;;
17022         *)      case "$usethreads" in
17023                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17024                 esac
17025                 d_setlocale_r=undef
17026                 setlocale_r_proto=0
17027                 ;;
17028         esac
17029         ;;
17030 *)      setlocale_r_proto=0
17031         ;;
17032 esac
17033
17034 : see if setnetent exists
17035 set setnetent d_setnent
17036 eval $inlibc
17037
17038 : see if setnetent_r exists
17039 set setnetent_r d_setnetent_r
17040 eval $inlibc
17041 case "$d_setnetent_r" in
17042 "$define")
17043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17044         case "$d_setnetent_r_proto:$usethreads" in
17045         ":define")      d_setnetent_r_proto=define
17046                 set d_setnetent_r_proto setnetent_r $hdrs
17047                 eval $hasproto ;;
17048         *)      ;;
17049         esac
17050         case "$d_setnetent_r_proto" in
17051         define)
17052         case "$setnetent_r_proto" in
17053         ''|0) try='int setnetent_r(int, struct netent_data*);'
17054         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17055         esac
17056         case "$setnetent_r_proto" in
17057         ''|0) try='void setnetent_r(int, struct netent_data*);'
17058         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17059         esac
17060         case "$setnetent_r_proto" in
17061         ''|0)   d_setnetent_r=undef
17062                 setnetent_r_proto=0
17063                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17064         * )     case "$setnetent_r_proto" in
17065                 REENTRANT_PROTO*) ;;
17066                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17067                 esac
17068                 echo "Prototype: $try" ;;
17069         esac
17070         ;;
17071         *)      case "$usethreads" in
17072                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17073                 esac
17074                 d_setnetent_r=undef
17075                 setnetent_r_proto=0
17076                 ;;
17077         esac
17078         ;;
17079 *)      setnetent_r_proto=0
17080         ;;
17081 esac
17082
17083 : see if setprotoent exists
17084 set setprotoent d_setpent
17085 eval $inlibc
17086
17087 : see if setpgid exists
17088 set setpgid d_setpgid
17089 eval $inlibc
17090
17091 : see if setpgrp2 exists
17092 set setpgrp2 d_setpgrp2
17093 eval $inlibc
17094
17095 : see if setpriority exists
17096 set setpriority d_setprior
17097 eval $inlibc
17098
17099 : see if setproctitle exists
17100 set setproctitle d_setproctitle
17101 eval $inlibc
17102
17103 : see if setprotoent_r exists
17104 set setprotoent_r d_setprotoent_r
17105 eval $inlibc
17106 case "$d_setprotoent_r" in
17107 "$define")
17108         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17109         case "$d_setprotoent_r_proto:$usethreads" in
17110         ":define")      d_setprotoent_r_proto=define
17111                 set d_setprotoent_r_proto setprotoent_r $hdrs
17112                 eval $hasproto ;;
17113         *)      ;;
17114         esac
17115         case "$d_setprotoent_r_proto" in
17116         define)
17117         case "$setprotoent_r_proto" in
17118         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17119         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17120         esac
17121         case "$setprotoent_r_proto" in
17122         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17123         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17124         esac
17125         case "$setprotoent_r_proto" in
17126         ''|0)   d_setprotoent_r=undef
17127                 setprotoent_r_proto=0
17128                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17129         * )     case "$setprotoent_r_proto" in
17130                 REENTRANT_PROTO*) ;;
17131                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17132                 esac
17133                 echo "Prototype: $try" ;;
17134         esac
17135         ;;
17136         *)      case "$usethreads" in
17137                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17138                 esac
17139                 d_setprotoent_r=undef
17140                 setprotoent_r_proto=0
17141                 ;;
17142         esac
17143         ;;
17144 *)      setprotoent_r_proto=0
17145         ;;
17146 esac
17147
17148 : see if setpwent exists
17149 set setpwent d_setpwent
17150 eval $inlibc
17151
17152 : see if setpwent_r exists
17153 set setpwent_r d_setpwent_r
17154 eval $inlibc
17155 case "$d_setpwent_r" in
17156 "$define")
17157         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17158         case "$d_setpwent_r_proto:$usethreads" in
17159         ":define")      d_setpwent_r_proto=define
17160                 set d_setpwent_r_proto setpwent_r $hdrs
17161                 eval $hasproto ;;
17162         *)      ;;
17163         esac
17164         case "$d_setpwent_r_proto" in
17165         define)
17166         case "$setpwent_r_proto" in
17167         ''|0) try='int setpwent_r(FILE**);'
17168         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17169         esac
17170         case "$setpwent_r_proto" in
17171         ''|0) try='void setpwent_r(FILE**);'
17172         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17173         esac
17174         case "$setpwent_r_proto" in
17175         ''|0)   d_setpwent_r=undef
17176                 setpwent_r_proto=0
17177                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17178         * )     case "$setpwent_r_proto" in
17179                 REENTRANT_PROTO*) ;;
17180                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17181                 esac
17182                 echo "Prototype: $try" ;;
17183         esac
17184         ;;
17185         *)      case "$usethreads" in
17186                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17187                 esac
17188                 d_setpwent_r=undef
17189                 setpwent_r_proto=0
17190                 ;;
17191         esac
17192         ;;
17193 *)      setpwent_r_proto=0
17194         ;;
17195 esac
17196
17197 : see if setregid exists
17198 set setregid d_setregid
17199 eval $inlibc
17200 set setresgid d_setresgid
17201 eval $inlibc
17202
17203 : see if setreuid exists
17204 set setreuid d_setreuid
17205 eval $inlibc
17206 set setresuid d_setresuid
17207 eval $inlibc
17208
17209 : see if setrgid exists
17210 set setrgid d_setrgid
17211 eval $inlibc
17212
17213 : see if setruid exists
17214 set setruid d_setruid
17215 eval $inlibc
17216
17217 : see if setservent exists
17218 set setservent d_setsent
17219 eval $inlibc
17220
17221 : see if setservent_r exists
17222 set setservent_r d_setservent_r
17223 eval $inlibc
17224 case "$d_setservent_r" in
17225 "$define")
17226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17227         case "$d_setservent_r_proto:$usethreads" in
17228         ":define")      d_setservent_r_proto=define
17229                 set d_setservent_r_proto setservent_r $hdrs
17230                 eval $hasproto ;;
17231         *)      ;;
17232         esac
17233         case "$d_setservent_r_proto" in
17234         define)
17235         case "$setservent_r_proto" in
17236         ''|0) try='int setservent_r(int, struct servent_data*);'
17237         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17238         esac
17239         case "$setservent_r_proto" in
17240         ''|0) try='void setservent_r(int, struct servent_data*);'
17241         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17242         esac
17243         case "$setservent_r_proto" in
17244         ''|0)   d_setservent_r=undef
17245                 setservent_r_proto=0
17246                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17247         * )     case "$setservent_r_proto" in
17248                 REENTRANT_PROTO*) ;;
17249                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17250                 esac
17251                 echo "Prototype: $try" ;;
17252         esac
17253         ;;
17254         *)      case "$usethreads" in
17255                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17256                 esac
17257                 d_setservent_r=undef
17258                 setservent_r_proto=0
17259                 ;;
17260         esac
17261         ;;
17262 *)      setservent_r_proto=0
17263         ;;
17264 esac
17265
17266 : see if setsid exists
17267 set setsid d_setsid
17268 eval $inlibc
17269
17270 : see if setvbuf exists
17271 set setvbuf d_setvbuf
17272 eval $inlibc
17273
17274 : see if sfio.h is available
17275 set sfio.h i_sfio
17276 eval $inhdr
17277
17278 : see if sfio library is available
17279 case "$i_sfio" in
17280 $define)
17281         val=''
17282         set sfreserve val
17283         eval $inlibc
17284         ;;
17285 *)
17286         val="$undef"
17287         ;;
17288 esac
17289 : Ok, but do we want to use it.
17290 case "$val" in
17291 $define)
17292         case "$usesfio" in
17293         true|$define|[yY]*) dflt='y';;
17294         *) dflt='n';;
17295         esac
17296         echo "$package can use the sfio library, but it is experimental."
17297         rp="You seem to have sfio available, do you want to try using it?"
17298         . ./myread
17299         case "$ans" in
17300         y|Y)    echo "Ok, turning on sfio then."
17301                 val="$define"
17302                 ;;
17303         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17304                 val="$undef"
17305                 ;;
17306         esac
17307         ;;
17308 *)      case "$usesfio" in
17309         true|$define|[yY]*)
17310                 echo "Sorry, cannot find sfio on this machine." >&4
17311                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17312                 val="$undef"
17313                 ;;
17314         esac
17315         ;;
17316 esac
17317 set d_sfio
17318 eval $setvar
17319 case "$d_sfio" in
17320 $define) usesfio='true';;
17321 *) usesfio='false';;
17322 esac
17323 case "$d_sfio" in
17324 $define) ;;
17325 *)      : Remove sfio from list of libraries to use
17326         case "$libs" in
17327         *-lsfio*)
17328                 echo "Removing unneeded -lsfio from library list" >&4
17329                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17330                 shift
17331                 libs="$*"
17332                 echo "libs = $libs" >&4
17333                 ;;
17334         esac
17335 ;;
17336 esac
17337
17338
17339 : see if shmctl exists
17340 set shmctl d_shmctl
17341 eval $inlibc
17342
17343 : see if shmget exists
17344 set shmget d_shmget
17345 eval $inlibc
17346
17347 : see if shmat exists
17348 set shmat d_shmat
17349 eval $inlibc
17350 : see what shmat returns
17351 case "$d_shmat" in
17352 "$define")
17353         $cat >shmat.c <<'END'
17354 #include <sys/shm.h>
17355 void *shmat();
17356 END
17357         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17358                 shmattype='void *'
17359         else
17360                 shmattype='char *'
17361         fi
17362         echo "and it returns ($shmattype)." >&4
17363         : see if a prototype for shmat is available
17364         xxx=`./findhdr sys/shm.h`
17365         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17366         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17367                 val="$define"
17368         else
17369                 val="$undef"
17370         fi
17371         $rm -f shmat.[co]
17372         ;;
17373 *)
17374         val="$undef"
17375         ;;
17376 esac
17377 set d_shmatprototype
17378 eval $setvar
17379
17380 : see if shmdt exists
17381 set shmdt d_shmdt
17382 eval $inlibc
17383
17384 : see how much of the 'shm*(2)' library is present.
17385 h_shm=true
17386 echo " "
17387 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17388 *"$undef"*) h_shm=false;;
17389 esac
17390 case "$osname" in
17391 freebsd)
17392     case "`ipcs 2>&1`" in
17393     "SVID shared memory"*"not configured"*)
17394         echo "Your $osname does not have the shm*(2) configured." >&4
17395         h_shm=false
17396         val="$undef"
17397         set shmctl d_shmctl
17398         evat $setvar
17399         set shmget d_shmget
17400         evat $setvar
17401         set shmat d_shmat
17402         evat $setvar
17403         set shmdt d_shmdt
17404         evat $setvar
17405         ;;
17406     esac
17407     ;;
17408 esac
17409 : we could also check for sys/ipc.h ...
17410 if $h_shm && $test `./findhdr sys/shm.h`; then
17411         echo "You have the full shm*(2) library." >&4
17412         val="$define"
17413 else
17414         echo "You don't have the full shm*(2) library." >&4
17415         val="$undef"
17416 fi
17417 set d_shm
17418 eval $setvar
17419
17420 : see if we have sigaction
17421 echo " "
17422 if set sigaction val -f d_sigaction; eval $csym; $val; then
17423         echo 'sigaction() found.' >&4
17424         $cat > try.c <<EOP
17425 #include <stdio.h>
17426 #include <sys/types.h>
17427 #include <signal.h>
17428 #$i_stdlib I_STDLIB
17429 #ifdef I_STDLIB
17430 #include <stdlib.h>
17431 #endif
17432 int main()
17433 {
17434     struct sigaction act, oact;
17435     act.sa_flags = 0;
17436     oact.sa_handler = 0;
17437     /* so that act and oact are used */
17438     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17439 }
17440 EOP
17441         set try
17442         if eval $compile_ok; then
17443                 val="$define"
17444         else
17445                 echo "But you don't seem to have a useable struct sigaction." >&4
17446                 val="$undef"
17447         fi
17448 else
17449         echo 'sigaction NOT found.' >&4
17450         val="$undef"
17451 fi
17452 set d_sigaction; eval $setvar
17453 $rm_try
17454
17455 : see if this is a sunmath.h system
17456 set sunmath.h i_sunmath
17457 eval $inhdr
17458
17459 : see if signbit exists
17460 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17461 $cat >try.c <<EOCP
17462 #$i_math I_MATH
17463 #$i_sunmath I_SUNMATH
17464 #ifdef I_MATH
17465 #  include <math.h>
17466 #endif
17467 #ifdef I_SUNMATH  /* Solaris special math library */
17468 #  include <sunmath.h>
17469 #endif
17470 #define NV $nvtype
17471 int main(int argc, char **argv)
17472 {
17473     NV x = 0.0;
17474     NV y = -0.0;
17475     if ((signbit(x) == 0) && (signbit(y) != 0))
17476         return 0;
17477     else
17478         return 1;
17479 }
17480 EOCP
17481 val="$undef"
17482 set try
17483 if eval $compile; then
17484     if $run ./try; then
17485         $echo "Yes." >&4
17486         val="$define"
17487     else
17488         $echo "Signbit seems to be available, but doesn't work as I expected."
17489         $echo "I won't use it." >&4
17490         val="$undef"
17491     fi
17492 else
17493     $echo "Nope." >&4
17494     dflt="$undef"
17495 fi
17496 set d_signbit
17497 eval $setvar
17498 $rm_try
17499
17500 : see if sigprocmask exists
17501 set sigprocmask d_sigprocmask
17502 eval $inlibc
17503
17504 : see if sigsetjmp exists
17505 echo " "
17506 case "$d_sigsetjmp" in
17507 '')
17508         $cat >try.c <<EOP
17509 #include <setjmp.h>
17510 #$i_stdlib I_STDLIB
17511 #ifdef I_STDLIB
17512 #include <stdlib.h>
17513 #endif
17514 sigjmp_buf env;
17515 int set = 1;
17516 int main()
17517 {
17518         if (sigsetjmp(env,1))
17519                 exit(set);
17520         set = 0;
17521         siglongjmp(env, 1);
17522         exit(1);
17523 }
17524 EOP
17525         set try
17526         if eval $compile; then
17527                 if $run ./try >/dev/null 2>&1; then
17528                         echo "POSIX sigsetjmp found." >&4
17529                         val="$define"
17530                 else
17531                         $cat >&4 <<EOM
17532 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17533 I'll ignore them.
17534 EOM
17535                         val="$undef"
17536                 fi
17537         else
17538                 echo "sigsetjmp not found." >&4
17539                 val="$undef"
17540         fi
17541         ;;
17542 *) val="$d_sigsetjmp"
17543         case "$d_sigsetjmp" in
17544         $define) echo "POSIX sigsetjmp found." >&4;;
17545         $undef) echo "sigsetjmp not found." >&4;;
17546         esac
17547         ;;
17548 esac
17549 set d_sigsetjmp
17550 eval $setvar
17551 $rm_try
17552
17553 : see if snprintf exists
17554 set snprintf d_snprintf
17555 eval $inlibc
17556
17557 : see if vsnprintf exists
17558 set vsnprintf d_vsnprintf
17559 eval $inlibc
17560
17561 case "$d_snprintf-$d_vsnprintf" in
17562 "$define-$define")
17563     $cat <<EOM
17564 Checking whether your snprintf() and vsnprintf() work okay...
17565 EOM
17566     $cat >try.c <<'EOCP'
17567 /* v?snprintf testing logic courtesy of Russ Allbery.
17568  * According to C99:
17569  * - if the buffer is too short it still must be \0-terminated
17570  * - if the buffer is too short the potentially required length
17571  *   must be returned and not -1
17572  * - if the buffer is NULL the potentially required length
17573  *   must be returned and not -1 or core dump
17574  */
17575 #include <stdio.h>
17576 #include <stdarg.h>
17577
17578 char buf[2];
17579
17580 int test (char *format, ...)
17581 {
17582     va_list args;
17583     int count;
17584
17585     va_start (args, format);
17586     count = vsnprintf (buf, sizeof buf, format, args);
17587     va_end (args);
17588     return count;
17589 }
17590
17591 int main ()
17592 {
17593     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17594              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17595 }
17596 EOCP
17597     set try
17598     if eval $compile; then
17599         `$run ./try`
17600         case "$?" in
17601         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17602         *) cat <<EOM >&4
17603 Your snprintf() and snprintf() don't seem to be working okay.
17604 EOM
17605            d_snprintf="$undef"
17606            d_vsnprintf="$undef"
17607            ;;
17608         esac
17609     else
17610         echo "(I can't seem to compile the test program--assuming they don't)"
17611         d_snprintf="$undef"
17612         d_vsnprintf="$undef"
17613     fi
17614     $rm_try
17615     ;;
17616 esac
17617
17618 : see if sockatmark exists
17619 set sockatmark d_sockatmark
17620 eval $inlibc
17621
17622 : see if prototype for sockatmark is available
17623 echo " "
17624 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17625 eval $hasproto
17626
17627 : see if socks5_init exists
17628 set socks5_init d_socks5_init
17629 eval $inlibc
17630
17631 : see if sprintf returns the length of the string in the buffer as per ANSI
17632 $echo "Checking whether sprintf returns the length of the string..." >&4
17633 $cat <<EOP >try.c
17634 #include <stdio.h>
17635 #$i_stdlib I_STDLIB
17636 #ifdef I_STDLIB
17637 #include <stdlib.h>
17638 #endif
17639 #$i_string I_STRING
17640 #ifdef I_STRING
17641 #  include <string.h>
17642 #else
17643 #  include <strings.h>
17644 #endif
17645 #$i_math I_MATH
17646 #ifdef I_MATH
17647 #include <math.h>
17648 #endif
17649
17650 char buffer[256];
17651
17652 int check (size_t expect, int test) {
17653   size_t got = strlen(buffer);
17654   if (expect == got)
17655     return 0;
17656
17657   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17658        test, buffer);
17659   exit (test);
17660 }
17661
17662 int main(int argc, char **argv) {
17663   int test = 0;
17664
17665   check(sprintf(buffer, ""), ++test);
17666   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17667   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17668
17669   return 0;
17670 }
17671 EOP
17672 set try
17673
17674 if eval $compile; then
17675     xxx="`$run ./try`"
17676     case "$?" in
17677         0) cat >&4 <<EOM
17678 sprintf returns the length of the string (as ANSI says it should)
17679 EOM
17680         d_sprintf_returns_strlen="$define"
17681         ;;
17682         *) cat >&4 <<EOM
17683 sprintf does not return the length of the string (how old is this system?)
17684 EOM
17685         d_sprintf_returns_strlen="$undef"
17686         ;;
17687     esac
17688 else
17689     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17690     d_sprintf_returns_strlen="$undef"
17691 fi
17692 $rm_try
17693
17694 : see if srand48_r exists
17695 set srand48_r d_srand48_r
17696 eval $inlibc
17697 case "$d_srand48_r" in
17698 "$define")
17699         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17700         case "$d_srand48_r_proto:$usethreads" in
17701         ":define")      d_srand48_r_proto=define
17702                 set d_srand48_r_proto srand48_r $hdrs
17703                 eval $hasproto ;;
17704         *)      ;;
17705         esac
17706         case "$d_srand48_r_proto" in
17707         define)
17708         case "$srand48_r_proto" in
17709         ''|0) try='int srand48_r(long, struct drand48_data*);'
17710         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17711         esac
17712         case "$srand48_r_proto" in
17713         ''|0)   d_srand48_r=undef
17714                 srand48_r_proto=0
17715                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17716         * )     case "$srand48_r_proto" in
17717                 REENTRANT_PROTO*) ;;
17718                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17719                 esac
17720                 echo "Prototype: $try" ;;
17721         esac
17722         ;;
17723         *)      case "$usethreads" in
17724                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17725                 esac
17726                 d_srand48_r=undef
17727                 srand48_r_proto=0
17728                 ;;
17729         esac
17730         ;;
17731 *)      srand48_r_proto=0
17732         ;;
17733 esac
17734
17735 : see if srandom_r exists
17736 set srandom_r d_srandom_r
17737 eval $inlibc
17738 case "$d_srandom_r" in
17739 "$define")
17740         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17741         case "$d_srandom_r_proto:$usethreads" in
17742         ":define")      d_srandom_r_proto=define
17743                 set d_srandom_r_proto srandom_r $hdrs
17744                 eval $hasproto ;;
17745         *)      ;;
17746         esac
17747         case "$d_srandom_r_proto" in
17748         define)
17749         case "$srandom_r_proto" in
17750         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17751         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17752         esac
17753         case "$srandom_r_proto" in
17754         ''|0)   d_srandom_r=undef
17755                 srandom_r_proto=0
17756                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17757         * )     case "$srandom_r_proto" in
17758                 REENTRANT_PROTO*) ;;
17759                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17760                 esac
17761                 echo "Prototype: $try" ;;
17762         esac
17763         ;;
17764         *)      case "$usethreads" in
17765                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17766                 esac
17767                 d_srandom_r=undef
17768                 srandom_r_proto=0
17769                 ;;
17770         esac
17771         ;;
17772 *)      srandom_r_proto=0
17773         ;;
17774 esac
17775
17776 : see if prototype for setresgid is available
17777 echo " "
17778 set d_sresgproto setresgid $i_unistd unistd.h
17779 eval $hasproto
17780
17781 : see if prototype for setresuid is available
17782 echo " "
17783 set d_sresuproto setresuid $i_unistd unistd.h
17784 eval $hasproto
17785
17786 : see if sys/stat.h is available
17787 set sys/stat.h i_sysstat
17788 eval $inhdr
17789
17790 : see if stat knows about block sizes
17791 echo " "
17792 echo "Checking to see if your struct stat has st_blocks field..." >&4
17793 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17794 eval $hasfield
17795
17796 : see if this is a sys/vfs.h system
17797 set sys/vfs.h i_sysvfs
17798 eval $inhdr
17799
17800 : see if this is a sys/statfs.h system
17801 set sys/statfs.h i_sysstatfs
17802 eval $inhdr
17803
17804 : Check for statfs_s
17805 echo " "
17806 echo "Checking to see if your system supports struct statfs..." >&4
17807 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
17808 eval $hasstruct
17809 case "$d_statfs_s" in
17810 "$define")      echo "Yes, it does."   ;;
17811 *)              echo "No, it doesn't." ;;
17812 esac
17813
17814
17815 : see if struct statfs knows about f_flags
17816 case "$d_statfs_s" in
17817 define)
17818         echo " "
17819         echo "Checking to see if your struct statfs has f_flags field..." >&4
17820         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
17821         eval $hasfield
17822         ;;
17823 *)      val="$undef"
17824         set d_statfs_f_flags
17825         eval $setvar
17826         ;;
17827 esac
17828 case "$d_statfs_f_flags" in
17829 "$define")      echo "Yes, it does."   ;;
17830 *)              echo "No, it doesn't." ;;
17831 esac
17832
17833 : see what flavor, if any, of static inline is supported
17834 echo " "
17835 echo "Checking to see if your system supports static inline..."
17836 $cat > try.c <<'EOCP'
17837 #include <stdlib.h>
17838 extern int f_via_a(int x);
17839 extern int f_via_b(int x);
17840 int main(int argc, char **argv)
17841 {
17842     int y;
17843
17844     y = f_via_a(0);
17845 #ifdef USE_B
17846     y = f_via_b(0);
17847 #endif
17848     if (y == 42) {
17849         return EXIT_SUCCESS;
17850     }
17851     else {
17852         return EXIT_FAILURE;
17853     }
17854 }
17855 EOCP
17856 $cat > a.c <<'EOCP'
17857 static INLINE int f(int x) {
17858     int y;
17859     y = x + 42;
17860     return y;
17861 }
17862
17863 int f_via_a(int x)
17864 {
17865     return f(x);
17866 }
17867 EOCP
17868 $cat > b.c <<'EOCP'
17869 extern int f(int x);
17870
17871 int f_via_b(int x)
17872 {
17873     return f(x);
17874 }
17875 EOCP
17876
17877 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17878 case "$perl_static_inline" in
17879 '')     # Check the various possibilities, and break out on success.
17880         # For gcc, prefer __inline__, which will still permit 
17881         # cflags.SH to add in -ansi.
17882         case "$gccversion" in
17883                 '') xxx="inline __inline__ __inline _inline";;
17884                 *)  xxx="__inline__ inline __inline _inline";;
17885         esac
17886         for inline in $xxx; do
17887                 set try -DINLINE=$inline a.c
17888                 if eval $compile && $run ./try; then
17889                         # Now make sure there is no external linkage of static
17890                         # functions
17891                         set try -DINLINE=$inline -DUSE_B a.c b.c
17892                         if eval $compile && $run ./try; then
17893                                 $echo "Your compiler supports static $inline, " >&4
17894                                 $echo "but it also creates an external definition," >&4
17895                                 $echo "so I won't use it." >&4
17896                                 val=$undef
17897                         else
17898                                 $echo "Your compiler supports static $inline." >&4
17899                                 val=$define
17900                                 perl_static_inline="static $inline";
17901                                 break;
17902                         fi
17903                 else
17904                         $echo "Your compiler does NOT support static $inline." >&4
17905                         val="$undef"
17906                 fi
17907         done
17908         ;;
17909 *inline*) # Some variant of inline exists.
17910         echo "Keeping your $hint value of $perl_static_inline."
17911         val=$define
17912         ;;
17913 static)  # No inline capabilities
17914         echo "Keeping your $hint value of $perl_static_inline."
17915         val=$undef
17916         ;;
17917 *)  # Unrecognized previous value -- blindly trust the supplied
17918         # value and hope it makes sense.  Use old value for
17919         # d_static_inline, if there is one.
17920         echo "Keeping your $hint value of $perl_static_inline."
17921         case "$d_static_inline" in
17922                 '') val=$define ;;
17923                 *)  val=$d_static_inline ;;
17924         esac
17925         ;;
17926 esac
17927 # Fallback to plain 'static' if nothing worked.
17928 case "$perl_static_inline" in
17929 '')
17930         perl_static_inline="static"
17931         val=$undef
17932         ;;
17933 esac
17934 set d_static_inline
17935 eval $setvar
17936 $rm -f a.[co] b.[co]
17937 $rm_try
17938
17939 : Check stream access
17940 $cat >&4 <<EOM
17941 Checking how to access stdio streams by file descriptor number...
17942 EOM
17943 case "$stdio_stream_array" in
17944 '')     $cat >try.c <<EOCP
17945 #include <stdio.h>
17946 int main() {
17947   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17948     printf("yes\n");
17949 }
17950 EOCP
17951         for s in _iob __iob __sF
17952         do
17953                 set try -DSTDIO_STREAM_ARRAY=$s
17954                 if eval $compile; then
17955                         case "`$run ./try`" in
17956                         yes)    stdio_stream_array=$s; break ;;
17957                         esac
17958                 fi
17959         done
17960         $rm_try
17961 esac
17962 case "$stdio_stream_array" in
17963 '')     $cat >&4 <<EOM
17964 I can't figure out how to access stdio streams by file descriptor number.
17965 EOM
17966         d_stdio_stream_array="$undef"
17967         ;;
17968 *)      $cat >&4 <<EOM
17969 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17970 EOM
17971         d_stdio_stream_array="$define"
17972         ;;
17973 esac
17974
17975 : see if strcoll exists
17976 set strcoll d_strcoll
17977 eval $inlibc
17978
17979 : check for structure copying
17980 echo " "
17981 echo "Checking to see if your C compiler can copy structs..." >&4
17982 $cat >try.c <<'EOCP'
17983 int main()
17984 {
17985         struct blurfl {
17986                 int dyick;
17987         } foo, bar;
17988
17989         foo = bar;
17990 }
17991 EOCP
17992 if $cc -c try.c >/dev/null 2>&1 ; then
17993         val="$define"
17994         echo "Yup, it can."
17995 else
17996         val="$undef"
17997         echo "Nope, it can't."
17998 fi
17999 set d_strctcpy
18000 eval $setvar
18001 $rm_try
18002
18003 : see if strerror and/or sys_errlist[] exist
18004 echo " "
18005 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18006     if set strerror val -f d_strerror; eval $csym; $val; then
18007                 echo 'strerror() found.' >&4
18008                 d_strerror="$define"
18009                 d_strerrm='strerror(e)'
18010                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18011                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18012                         d_syserrlst="$define"
18013                 else
18014                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18015                         d_syserrlst="$undef"
18016                 fi
18017     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18018                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18019                 echo 'strerror() found in string header.' >&4
18020                 d_strerror="$define"
18021                 d_strerrm='strerror(e)'
18022                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18023                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18024                                 d_syserrlst="$define"
18025                 else
18026                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18027                         d_syserrlst="$undef"
18028                 fi
18029     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18030                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18031                 d_strerror="$undef"
18032                 d_syserrlst="$define"
18033                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18034     else
18035                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18036                 d_strerror="$undef"
18037                 d_syserrlst="$undef"
18038                 d_strerrm='"unknown"'
18039     fi
18040 fi
18041
18042 : see if strerror_r exists
18043 set strerror_r d_strerror_r
18044 eval $inlibc
18045 case "$d_strerror_r" in
18046 "$define")
18047         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18048         case "$d_strerror_r_proto:$usethreads" in
18049         ":define")      d_strerror_r_proto=define
18050                 set d_strerror_r_proto strerror_r $hdrs
18051                 eval $hasproto ;;
18052         *)      ;;
18053         esac
18054         case "$d_strerror_r_proto" in
18055         define)
18056         case "$strerror_r_proto" in
18057         ''|0) try='int strerror_r(int, char*, size_t);'
18058         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18059         esac
18060         case "$strerror_r_proto" in
18061         ''|0) try='int strerror_r(int, char*, int);'
18062         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18063         esac
18064         case "$strerror_r_proto" in
18065         ''|0) try='char* strerror_r(int, char*, size_t);'
18066         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18067         esac
18068         case "$strerror_r_proto" in
18069         ''|0)   d_strerror_r=undef
18070                 strerror_r_proto=0
18071                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18072         * )     case "$strerror_r_proto" in
18073                 REENTRANT_PROTO*) ;;
18074                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18075                 esac
18076                 echo "Prototype: $try" ;;
18077         esac
18078         ;;
18079         *)      case "$usethreads" in
18080                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18081                 esac
18082                 d_strerror_r=undef
18083                 strerror_r_proto=0
18084                 ;;
18085         esac
18086         ;;
18087 *)      strerror_r_proto=0
18088         ;;
18089 esac
18090
18091 : see if strftime exists
18092 set strftime d_strftime
18093 eval $inlibc
18094
18095 : see if strlcat exists
18096 set strlcat d_strlcat
18097 eval $inlibc
18098
18099 : see if strlcpy exists
18100 set strlcpy d_strlcpy
18101 eval $inlibc
18102
18103 : see if strtod exists
18104 set strtod d_strtod
18105 eval $inlibc
18106
18107 : see if strtol exists
18108 set strtol d_strtol
18109 eval $inlibc
18110
18111 : see if strtold exists
18112 set strtold d_strtold
18113 eval $inlibc
18114
18115 : see if strtoll exists
18116 set strtoll d_strtoll
18117 eval $inlibc
18118
18119 case "$d_longlong-$d_strtoll" in
18120 "$define-$define")
18121         $cat <<EOM
18122 Checking whether your strtoll() works okay...
18123 EOM
18124         $cat >try.c <<'EOCP'
18125 #include <errno.h>
18126 #ifdef __hpux
18127 #define strtoll __strtoll
18128 #endif
18129 #ifdef __EMX__
18130 #define strtoll _strtoll
18131 #endif
18132 #include <stdio.h>
18133 extern long long int strtoll(char *s, char **, int);
18134 static int bad = 0;
18135 int check(char *s, long long ell, int een) {
18136         long long gll;
18137         errno = 0;
18138         gll = strtoll(s, 0, 10);
18139         if (!((gll == ell) && (errno == een)))
18140                 bad++;
18141 }
18142 int main() {
18143         check(" 1",                                      1LL, 0);
18144         check(" 0",                                      0LL, 0);
18145         check("-1",                                     -1LL, 0);
18146         check("-9223372036854775808", -9223372036854775808LL, 0);
18147         check("-9223372036854775808", -9223372036854775808LL, 0);
18148         check(" 9223372036854775807",  9223372036854775807LL, 0);
18149         check("-9223372036854775808", -9223372036854775808LL, 0);
18150         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18151         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18152         if (!bad)
18153                 printf("ok\n");
18154 }
18155 EOCP
18156         set try
18157         if eval $compile; then
18158                 yyy=`$run ./try`
18159                 case "$yyy" in
18160                 ok) echo "Your strtoll() seems to be working okay." ;;
18161                 *) cat <<EOM >&4
18162 Your strtoll() doesn't seem to be working okay.
18163 EOM
18164                    d_strtoll="$undef"
18165                    ;;
18166                 esac
18167         else
18168                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18169                 d_strtoll="$undef"
18170         fi
18171         ;;
18172 esac
18173
18174 : see if strtoq exists
18175 set strtoq d_strtoq
18176 eval $inlibc
18177
18178 : see if strtoul exists
18179 set strtoul d_strtoul
18180 eval $inlibc
18181
18182 case "$d_strtoul" in
18183 "$define")
18184         $cat <<EOM
18185 Checking whether your strtoul() works okay...
18186 EOM
18187         $cat >try.c <<'EOCP'
18188 #include <errno.h>
18189 #include <stdio.h>
18190 extern unsigned long int strtoul(char *s, char **, int);
18191 static int bad = 0;
18192 void check(char *s, unsigned long eul, int een) {
18193         unsigned long gul;
18194         errno = 0;
18195         gul = strtoul(s, 0, 10);
18196         if (!((gul == eul) && (errno == een)))
18197                 bad++;
18198 }
18199 int main() {
18200         check(" 1", 1L, 0);
18201         check(" 0", 0L, 0);
18202 EOCP
18203         case "$longsize" in
18204         8)
18205             $cat >>try.c <<'EOCP'
18206         check("18446744073709551615", 18446744073709551615UL, 0);
18207         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18208 #if 0 /* strtoul() for /^-/ strings is undefined. */
18209         check("-1", 18446744073709551615UL, 0);
18210         check("-18446744073709551614", 2, 0);
18211         check("-18446744073709551615", 1, 0);
18212         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18213         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18214 #endif
18215 EOCP
18216                 ;;
18217         4)
18218                     $cat >>try.c <<'EOCP'
18219         check("4294967295", 4294967295UL, 0);
18220         check("4294967296", 4294967295UL, ERANGE);
18221 #if 0 /* strtoul() for /^-/ strings is undefined. */
18222         check("-1", 4294967295UL, 0);
18223         check("-4294967294", 2, 0);
18224         check("-4294967295", 1, 0);
18225         check("-4294967296", 4294967295UL, ERANGE);
18226         check("-4294967297", 4294967295UL, ERANGE);
18227 #endif
18228 EOCP
18229                 ;;
18230         *)
18231 : Should we write these tests to be more portable by sprintf-ing
18232 : ~0 and then manipulating that char string as input for strtol?
18233                 ;;
18234         esac
18235         $cat >>try.c <<'EOCP'
18236         if (!bad)
18237                 printf("ok\n");
18238         return 0;
18239 }
18240 EOCP
18241         set try
18242         if eval $compile; then
18243                 case "`$run ./try`" in
18244                 ok) echo "Your strtoul() seems to be working okay." ;;
18245                 *) cat <<EOM >&4
18246 Your strtoul() doesn't seem to be working okay.
18247 EOM
18248                    d_strtoul="$undef"
18249                    ;;
18250                 esac
18251         else
18252                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18253                 d_strtoul="$undef"
18254         fi
18255         ;;
18256 esac
18257
18258 : see if strtoull exists
18259 set strtoull d_strtoull
18260 eval $inlibc
18261
18262 case "$d_longlong-$d_strtoull" in
18263 "$define-$define")
18264         $cat <<EOM
18265 Checking whether your strtoull() works okay...
18266 EOM
18267         $cat >try.c <<'EOCP'
18268 #include <errno.h>
18269 #ifdef __hpux
18270 #define strtoull __strtoull
18271 #endif
18272 #include <stdio.h>
18273 extern unsigned long long int strtoull(char *s, char **, int);
18274 static int bad = 0;
18275 int check(char *s, long long eull, int een) {
18276         long long gull;
18277         errno = 0;
18278         gull = strtoull(s, 0, 10);
18279         if (!((gull == eull) && (errno == een)))
18280                 bad++;
18281 }
18282 int main() {
18283         check(" 1",                                        1LL, 0);
18284         check(" 0",                                        0LL, 0);
18285         check("18446744073709551615",  18446744073709551615ULL, 0);
18286         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18287 #if 0 /* strtoull() for /^-/ strings is undefined. */
18288         check("-1",                    18446744073709551615ULL, 0);
18289         check("-18446744073709551614",                     2LL, 0);
18290         check("-18446744073709551615",                     1LL, 0);
18291         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18292         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18293 #endif
18294         if (!bad)
18295                 printf("ok\n");
18296 }
18297 EOCP
18298         set try
18299         if eval $compile; then
18300                 case "`$run ./try`" in
18301                 ok) echo "Your strtoull() seems to be working okay." ;;
18302                 *) cat <<EOM >&4
18303 Your strtoull() doesn't seem to be working okay.
18304 EOM
18305                    d_strtoull="$undef"
18306                    ;;
18307                 esac
18308         else
18309                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18310                 d_strtoull="$undef"
18311         fi
18312         ;;
18313 esac
18314
18315 : see if strtouq exists
18316 set strtouq d_strtouq
18317 eval $inlibc
18318
18319 case "$d_strtouq" in
18320 "$define")
18321         $cat <<EOM
18322 Checking whether your strtouq() works okay...
18323 EOM
18324         $cat >try.c <<'EOCP'
18325 #include <errno.h>
18326 #include <stdio.h>
18327 extern unsigned long long int strtouq(char *s, char **, int);
18328 static int bad = 0;
18329 void check(char *s, unsigned long long eull, int een) {
18330         unsigned long long gull;
18331         errno = 0;
18332         gull = strtouq(s, 0, 10);
18333         if (!((gull == eull) && (errno == een)))
18334                 bad++;
18335 }
18336 int main() {
18337         check(" 1",                                        1LL, 0);
18338         check(" 0",                                        0LL, 0);
18339         check("18446744073709551615",  18446744073709551615ULL, 0);
18340         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18341 #if 0 /* strtouq() for /^-/ strings is undefined. */
18342         check("-1",                    18446744073709551615ULL, 0);
18343         check("-18446744073709551614",                     2LL, 0);
18344         check("-18446744073709551615",                     1LL, 0);
18345         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18346         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18347 #endif
18348         if (!bad)
18349                 printf("ok\n");
18350         return 0;
18351 }
18352 EOCP
18353         set try
18354         if eval $compile; then
18355                 case "`$run ./try`" in
18356                 ok) echo "Your strtouq() seems to be working okay." ;;
18357                 *) cat <<EOM >&4
18358 Your strtouq() doesn't seem to be working okay.
18359 EOM
18360                    d_strtouq="$undef"
18361                    ;;
18362                 esac
18363         else
18364                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18365                 d_strtouq="$undef"
18366         fi
18367         ;;
18368 esac
18369
18370 : see if strxfrm exists
18371 set strxfrm d_strxfrm
18372 eval $inlibc
18373
18374 : see if symlink exists
18375 set symlink d_symlink
18376 eval $inlibc
18377
18378 : see if syscall exists
18379 set syscall d_syscall
18380 eval $inlibc
18381
18382 : see if prototype for syscall is available
18383 echo " "
18384 set d_syscallproto syscall $i_unistd unistd.h
18385 eval $hasproto
18386
18387 : see if sysconf exists
18388 set sysconf d_sysconf
18389 eval $inlibc
18390
18391 : see if system exists
18392 set system d_system
18393 eval $inlibc
18394
18395 : see if tcgetpgrp exists
18396 set tcgetpgrp d_tcgetpgrp
18397 eval $inlibc
18398
18399 : see if tcsetpgrp exists
18400 set tcsetpgrp d_tcsetpgrp
18401 eval $inlibc
18402
18403 : see if prototype for telldir is available
18404 echo " "
18405 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18406 eval $hasproto
18407
18408 : see if time exists
18409 echo " "
18410 if test "X$d_time" = X -o X"$timetype" = X; then
18411     if set time val -f d_time; eval $csym; $val; then
18412                 echo 'time() found.' >&4
18413                 val="$define"
18414                 rp="What is the type returned by time() on this system?"
18415                 set time_t timetype long stdio.h sys/types.h
18416                 eval $typedef_ask
18417     else
18418                 echo 'time() not found, hope that will do.' >&4
18419                 val="$undef"
18420                 timetype='int';
18421     fi
18422     set d_time
18423     eval $setvar
18424 fi
18425
18426 : see if timegm exists
18427 set timegm d_timegm
18428 eval $inlibc
18429
18430 : see if this is a sys/times.h system
18431 set sys/times.h i_systimes
18432 eval $inhdr
18433
18434 : see if times exists
18435 echo " "
18436 if set times val -f d_times; eval $csym; $val; then
18437         echo 'times() found.' >&4
18438         d_times="$define"
18439         inc=''
18440         case "$i_systimes" in
18441         "$define") inc='sys/times.h';;
18442         esac
18443         rp="What is the type returned by times() on this system?"
18444         set clock_t clocktype long stdio.h sys/types.h $inc
18445         eval $typedef_ask
18446 else
18447         echo 'times() NOT found, hope that will do.' >&4
18448         d_times="$undef"
18449         clocktype='int'
18450 fi
18451
18452 : see if tmpnam_r exists
18453 set tmpnam_r d_tmpnam_r
18454 eval $inlibc
18455 case "$d_tmpnam_r" in
18456 "$define")
18457         hdrs="$i_systypes sys/types.h define stdio.h "
18458         case "$d_tmpnam_r_proto:$usethreads" in
18459         ":define")      d_tmpnam_r_proto=define
18460                 set d_tmpnam_r_proto tmpnam_r $hdrs
18461                 eval $hasproto ;;
18462         *)      ;;
18463         esac
18464         case "$d_tmpnam_r_proto" in
18465         define)
18466         case "$tmpnam_r_proto" in
18467         ''|0) try='char* tmpnam_r(char*);'
18468         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18469         esac
18470         case "$tmpnam_r_proto" in
18471         ''|0)   d_tmpnam_r=undef
18472                 tmpnam_r_proto=0
18473                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18474         * )     case "$tmpnam_r_proto" in
18475                 REENTRANT_PROTO*) ;;
18476                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18477                 esac
18478                 echo "Prototype: $try" ;;
18479         esac
18480         ;;
18481         *)      case "$usethreads" in
18482                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18483                 esac
18484                 d_tmpnam_r=undef
18485                 tmpnam_r_proto=0
18486                 ;;
18487         esac
18488         ;;
18489 *)      tmpnam_r_proto=0
18490         ;;
18491 esac
18492
18493 : see if truncate exists
18494 set truncate d_truncate
18495 eval $inlibc
18496
18497 : see if ttyname_r exists
18498 set ttyname_r d_ttyname_r
18499 eval $inlibc
18500 case "$d_ttyname_r" in
18501 "$define")
18502         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18503         case "$d_ttyname_r_proto:$usethreads" in
18504         ":define")      d_ttyname_r_proto=define
18505                 set d_ttyname_r_proto ttyname_r $hdrs
18506                 eval $hasproto ;;
18507         *)      ;;
18508         esac
18509         case "$d_ttyname_r_proto" in
18510         define)
18511         case "$ttyname_r_proto" in
18512         ''|0) try='int ttyname_r(int, char*, size_t);'
18513         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18514         esac
18515         case "$ttyname_r_proto" in
18516         ''|0) try='int ttyname_r(int, char*, int);'
18517         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18518         esac
18519         case "$ttyname_r_proto" in
18520         ''|0) try='char* ttyname_r(int, char*, int);'
18521         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18522         esac
18523         case "$ttyname_r_proto" in
18524         ''|0)   d_ttyname_r=undef
18525                 ttyname_r_proto=0
18526                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18527         * )     case "$ttyname_r_proto" in
18528                 REENTRANT_PROTO*) ;;
18529                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18530                 esac
18531                 echo "Prototype: $try" ;;
18532         esac
18533         ;;
18534         *)      case "$usethreads" in
18535                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18536                 esac
18537                 d_ttyname_r=undef
18538                 ttyname_r_proto=0
18539                 ;;
18540         esac
18541         ;;
18542 *)      ttyname_r_proto=0
18543         ;;
18544 esac
18545
18546 : see if tzname[] exists
18547 echo " "
18548 if set tzname val -a d_tzname; eval $csym; $val; then
18549         val="$define"
18550         echo 'tzname[] found.' >&4
18551 else
18552         val="$undef"
18553         echo 'tzname[] NOT found.' >&4
18554 fi
18555 set d_tzname
18556 eval $setvar
18557
18558 : Check if is a multiplatform env
18559 case "$osname" in
18560 next|rhapsody|darwin) multiarch="$define" ;;
18561 esac
18562 case "$multiarch" in
18563 ''|[nN]*) multiarch="$undef" ;;
18564 esac
18565
18566 : check for ordering of bytes in a UV
18567 echo " "
18568 case "$usecrosscompile$multiarch" in
18569 *$define*)
18570         $cat <<EOM
18571 You seem to be either cross-compiling or doing a multiarchitecture build,
18572 skipping the byteorder check.
18573
18574 EOM
18575         byteorder='ffff'
18576         ;;
18577 *)
18578         case "$byteorder" in
18579         '')
18580                 $cat <<'EOM'
18581 In the following, larger digits indicate more significance.  A big-endian
18582 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18583 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18584 machines may have weird orders like 3412.  A Cray will report 87654321,
18585 an Alpha will report 12345678. If the test program works the default is
18586 probably right.
18587 I'm now running the test program...
18588 EOM
18589                 $cat >try.c <<EOCP
18590 #include <stdio.h>
18591 #$i_stdlib I_STDLIB
18592 #ifdef I_STDLIB
18593 #include <stdlib.h>
18594 #endif
18595 #include <sys/types.h>
18596 typedef $uvtype UV;
18597 int main()
18598 {
18599         int i;
18600         union {
18601                 UV l;
18602                 char c[$uvsize];
18603         } u;
18604
18605         if ($uvsize > 4)
18606                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18607         else
18608                 u.l = (UV)0x04030201;
18609         for (i = 0; i < $uvsize; i++)
18610                 printf("%c", u.c[i]+'0');
18611         printf("\n");
18612         exit(0);
18613 }
18614 EOCP
18615                 xxx_prompt=y
18616                 set try
18617                 if eval $compile && $run ./try > /dev/null; then
18618                         dflt=`$run ./try`
18619                         case "$dflt" in
18620                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18621                                 echo "(The test program ran ok.)"
18622                                 echo "byteorder=$dflt"
18623                                 xxx_prompt=n
18624                         ;;
18625                         ????|????????) echo "(The test program ran ok.)" ;;
18626                         *) echo "(The test program didn't run right for some reason.)" ;;
18627                         esac
18628                 else
18629                         dflt='4321'
18630                         cat <<'EOM'
18631 (I can't seem to compile the test program.  Guessing big-endian...)
18632 EOM
18633                 fi
18634                 case "$xxx_prompt" in
18635                 y)
18636                         rp="What is the order of bytes in $uvtype?"
18637                         . ./myread
18638                         byteorder="$ans"
18639                         ;;
18640                 *)      byteorder=$dflt
18641                         ;;
18642                 esac
18643                 ;;
18644         esac
18645         $rm_try
18646         ;;
18647 esac
18648
18649 : Checking 32bit alignedness
18650 $cat <<EOM
18651
18652 Checking to see whether you can access character data unalignedly...
18653 EOM
18654 case "$d_u32align" in
18655 '')   $cat >try.c <<EOCP
18656 #include <stdio.h>
18657 #$i_stdlib I_STDLIB
18658 #ifdef I_STDLIB
18659 #include <stdlib.h>
18660 #endif
18661 #define U32 $u32type
18662 #define BYTEORDER 0x$byteorder
18663 #define U8 $u8type
18664 #include <signal.h>
18665 #ifdef SIGBUS
18666 $signal_t bletch(int s) { exit(4); }
18667 #endif
18668 int main() {
18669 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18670     volatile U8 buf[8];
18671     volatile U32 *up;
18672     int i;
18673
18674     if (sizeof(U32) != 4) {
18675         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18676         exit(1);
18677     }
18678
18679     fflush(stdout);
18680
18681 #ifdef SIGBUS
18682     signal(SIGBUS, bletch);
18683 #endif
18684
18685     buf[0] = 0;
18686     buf[1] = 0;
18687     buf[2] = 0;
18688     buf[3] = 1;
18689     buf[4] = 0;
18690     buf[5] = 0;
18691     buf[6] = 0;
18692     buf[7] = 1;
18693
18694     for (i = 0; i < 4; i++) {
18695         up = (U32*)(buf + i);
18696         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18697                (*up == 1 << (8*(3-i)))  /* little-endian */
18698               )
18699            )
18700         {
18701             printf("read failed (%x)\n", *up);
18702             exit(2);
18703         }
18704     }
18705
18706     /* write test */
18707     for (i = 0; i < 4; i++) {
18708         up = (U32*)(buf + i);
18709         *up = 0xBeef;
18710         if (*up != 0xBeef) {
18711             printf("write failed (%x)\n", *up);
18712             exit(3);
18713         }
18714     }
18715
18716     exit(0);
18717 #else
18718     printf("1\n");
18719     exit(1);
18720 #endif
18721     return 0;
18722 }
18723 EOCP
18724 set try
18725 if eval $compile_ok; then
18726         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18727         $run ./try 2>&1 >/dev/null
18728         case "$?" in
18729         0)      cat >&4 <<EOM
18730 You can access character data pretty unalignedly.
18731 EOM
18732                 d_u32align="$undef"
18733                 ;;
18734         *)      cat >&4 <<EOM
18735 It seems that you must access character data in an aligned manner.
18736 EOM
18737                 d_u32align="$define"
18738                 ;;
18739         esac
18740 else
18741         rp='Can you access character data at unaligned addresses?'
18742         dflt='n'
18743         . ./myread
18744         case "$ans" in
18745         [yY]*)  d_u32align="$undef"  ;;
18746         *)      d_u32align="$define" ;;
18747         esac
18748 fi
18749 $rm_try
18750 ;;
18751 esac
18752
18753 : see if ualarm exists
18754 set ualarm d_ualarm
18755 eval $inlibc
18756
18757 : see if umask exists
18758 set umask d_umask
18759 eval $inlibc
18760
18761 : see if unordered exists
18762 set unordered d_unordered
18763 eval $inlibc
18764
18765 : see if unsetenv exists
18766 set unsetenv d_unsetenv
18767 eval $inlibc
18768
18769 : see if usleep exists
18770 set usleep d_usleep
18771 eval $inlibc
18772
18773 : see if prototype for usleep is available
18774 echo " "
18775 set d_usleepproto usleep $i_unistd unistd.h
18776 eval $hasproto
18777
18778 : see if ustat exists
18779 set ustat d_ustat
18780 eval $inlibc
18781
18782 : see if closedir exists
18783 set closedir d_closedir
18784 eval $inlibc
18785
18786 case "$d_closedir" in
18787 "$define")
18788         echo " "
18789         echo "Checking whether closedir() returns a status..." >&4
18790         cat > try.c <<EOM
18791 #$i_dirent I_DIRENT             /**/
18792 #$i_sysdir I_SYS_DIR            /**/
18793 #$i_sysndir I_SYS_NDIR          /**/
18794 #$i_systypes I_SYS_TYPES        /**/
18795
18796 #if defined(I_SYS_TYPES)
18797 #include <sys/types.h>
18798 #endif
18799 #if defined(I_DIRENT)
18800 #include <dirent.h>
18801 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18802 #include <sys/dir.h>
18803 #endif
18804 #else
18805 #ifdef I_SYS_NDIR
18806 #include <sys/ndir.h>
18807 #else
18808 #ifdef I_SYS_DIR
18809 #ifdef hp9000s500
18810 #include <ndir.h>       /* may be wrong in the future */
18811 #else
18812 #include <sys/dir.h>
18813 #endif
18814 #endif
18815 #endif
18816 #endif
18817 int main() { return closedir(opendir(".")); }
18818 EOM
18819         set try
18820         if eval $compile_ok; then
18821                 if $run ./try > /dev/null 2>&1 ; then
18822                         echo "Yes, it does."
18823                         val="$undef"
18824                 else
18825                         echo "No, it doesn't."
18826                         val="$define"
18827                 fi
18828         else
18829                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18830                 val="$define"
18831         fi
18832         ;;
18833 *)
18834         val="$undef";
18835         ;;
18836 esac
18837 set d_void_closedir
18838 eval $setvar
18839 $rm_try
18840
18841 : see if there is a wait4
18842 set wait4 d_wait4
18843 eval $inlibc
18844
18845 : see if waitpid exists
18846 set waitpid d_waitpid
18847 eval $inlibc
18848
18849 : see if wcstombs exists
18850 set wcstombs d_wcstombs
18851 eval $inlibc
18852
18853 : see if wctomb exists
18854 set wctomb d_wctomb
18855 eval $inlibc
18856
18857 : see if writev exists
18858 set writev d_writev
18859 eval $inlibc
18860
18861 : preserve RCS keywords in files with variable substitution, grrr
18862 Date='$Date'
18863 Id='$Id'
18864 Log='$Log'
18865 RCSfile='$RCSfile'
18866 Revision='$Revision'
18867
18868 : check for alignment requirements
18869 echo " "
18870 case "$usecrosscompile$multiarch" in
18871 *$define*)
18872         $cat <<EOM
18873 You seem to be either cross-compiling or doing a multiarchitecture build,
18874 skipping the memory alignment check.
18875
18876 EOM
18877         case "$alignbytes" in
18878         '') alignbytes=8 ;;
18879         esac
18880         ;;
18881 *)
18882         case "$alignbytes" in
18883         '') echo "Checking alignment constraints..." >&4
18884                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18885                         $cat >try.c <<'EOCP'
18886 typedef long double NV;
18887 EOCP
18888                 else
18889                         $cat >try.c <<'EOCP'
18890 typedef double NV;
18891 EOCP
18892                 fi
18893                 $cat >>try.c <<'EOCP'
18894 #include <stdio.h>
18895 struct foobar {
18896         char foo;
18897         NV bar;
18898 } try_algn;
18899 int main()
18900 {
18901     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18902     return(0);
18903 }
18904 EOCP
18905                 set try
18906                 if eval $compile_ok; then
18907                         dflt=`$run ./try`
18908                 else
18909                         dflt='8'
18910                         echo "(I can't seem to compile the test program...)"
18911                 fi
18912                 ;;
18913         *) dflt="$alignbytes"
18914                 ;;
18915         esac
18916         rp="Doubles must be aligned on a how-many-byte boundary?"
18917         . ./myread
18918         alignbytes="$ans"
18919         $rm_try
18920         ;;
18921 esac
18922
18923
18924 : set the base revision
18925 baserev=5.0
18926
18927 : length of character in bytes. Is always 1, otherwise it isnt C
18928 : This used to be a test using sizeof
18929 charsize=1
18930
18931 : Check for the number of bits in a character
18932 case "$charbits" in
18933 '')     echo "Checking how long a character is (in bits)..." >&4
18934         $cat >try.c <<EOCP
18935 #include <stdio.h>
18936 int main ()
18937 {
18938     int n;
18939     unsigned char c;
18940     for (c = 1, n = 0; c; c <<= 1, n++) ;
18941     printf ("%d\n", n);
18942     return (0);
18943     }
18944 EOCP
18945         set try
18946         if eval $compile_ok; then
18947                 dflt=`$run ./try`
18948         else
18949                 dflt='8'
18950                 echo "(I can't seem to compile the test program.  Guessing...)"
18951         fi
18952         ;;
18953 *)
18954         dflt="$charbits"
18955         ;;
18956 esac
18957 rp="What is the length of a character (in bits)?"
18958 . ./myread
18959 charbits="$ans"
18960 $rm_try
18961 case "$charbits" in
18962 8)      ;;
18963 *)      cat >&4 << EOM
18964 Your system has an unsigned character size of $charbits bits, which
18965 is rather unusual (normally it is 8 bits).  Perl likely will not work
18966 correctly on your system, with subtle bugs in various places.
18967 EOM
18968         rp='Do you really want to continue?'
18969         dflt='n'
18970         . ./myread
18971         case "$ans" in
18972                 [yY])   echo >&4 "Okay, continuing."    ;;
18973                 *)      exit 1                          ;;
18974         esac
18975 esac
18976
18977 : how do we concatenate cpp tokens here?
18978 echo " "
18979 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18980 $cat >cpp_stuff.c <<'EOCP'
18981 #define RCAT(a,b)a/**/b
18982 #define ACAT(a,b)a ## b
18983 RCAT(Rei,ser)
18984 ACAT(Cir,cus)
18985 EOCP
18986 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18987 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18988         echo "Oh!  Smells like ANSI's been here." >&4
18989         echo "We can catify or stringify, separately or together!"
18990         cpp_stuff=42
18991 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18992         echo "Ah, yes!  The good old days!" >&4
18993         echo "However, in the good old days we don't know how to stringify and"
18994         echo "catify at the same time."
18995         cpp_stuff=1
18996 else
18997         $cat >&4 <<EOM
18998 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18999 You're going to have to edit the values of CAT[2-5] in config.h...
19000 EOM
19001         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19002 fi
19003 $rm -f cpp_stuff.*
19004
19005 : see if this is a db.h system
19006 set db.h i_db
19007 eval $inhdr
19008
19009 case "$i_db" in
19010 $define)
19011         : Check db version.
19012         echo " "
19013         echo "Checking Berkeley DB version ..." >&4
19014         $cat >try.c <<EOCP
19015 #$d_const HASCONST
19016 #ifndef HASCONST
19017 #define const
19018 #endif
19019 #include <sys/types.h>
19020 #include <stdio.h>
19021 #$i_stdlib I_STDLIB
19022 #ifdef I_STDLIB
19023 #include <stdlib.h>
19024 #endif
19025 #include <db.h>
19026 int main(int argc, char *argv[])
19027 {
19028 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19029     int Major, Minor, Patch ;
19030     unsigned long Version ;
19031     (void)db_version(&Major, &Minor, &Patch) ;
19032     if (argc == 2) {
19033         printf("%d %d %d %d %d %d\n",
19034                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19035                Major, Minor, Patch);
19036         exit(0);
19037     }
19038     printf("You have Berkeley DB Version 2 or greater.\n");
19039
19040     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19041                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19042     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19043                 Major, Minor, Patch) ;
19044
19045     /* check that db.h & libdb are compatible */
19046     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19047         printf("db.h and libdb are incompatible.\n") ;
19048         exit(3);
19049     }
19050
19051     printf("db.h and libdb are compatible.\n") ;
19052
19053     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19054                 + DB_VERSION_PATCH ;
19055
19056     /* needs to be >= 2.3.4 */
19057     if (Version < 2003004) {
19058     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19059         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19060         exit(2);
19061     }
19062
19063     exit(0);
19064 #else
19065 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19066     if (argc == 2) {
19067         printf("1 0 0\n");
19068         exit(0);
19069     }
19070     printf("You have Berkeley DB Version 1.\n");
19071     exit(0);    /* DB version < 2: the coast is clear. */
19072 #else
19073     exit(1);    /* <db.h> not Berkeley DB? */
19074 #endif
19075 #endif
19076 }
19077 EOCP
19078         set try
19079         if eval $compile_ok && $run ./try; then
19080                 echo 'Looks OK.' >&4
19081                 set `$run ./try 1`
19082                 db_version_major=$1
19083                 db_version_minor=$2
19084                 db_version_patch=$3
19085         else
19086                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19087                 i_db=$undef
19088                 case " $libs " in
19089                 *"-ldb "*)
19090                         : Remove db from list of libraries to use
19091                         echo "Removing unusable -ldb from library list" >&4
19092                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19093                         shift
19094                         libs="$*"
19095                         echo "libs = $libs" >&4
19096                         ;;
19097                 esac
19098         fi
19099         $rm_try
19100         ;;
19101 esac
19102
19103 case "$i_db" in
19104 define)
19105         : Check the return type needed for hash
19106         echo " "
19107         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19108         $cat >try.c <<EOCP
19109 #$d_const HASCONST
19110 #ifndef HASCONST
19111 #define const
19112 #endif
19113 #include <sys/types.h>
19114 #include <db.h>
19115
19116 #ifndef DB_VERSION_MAJOR
19117 u_int32_t hash_cb (ptr, size)
19118 const void *ptr;
19119 size_t size;
19120 {
19121 }
19122 HASHINFO info;
19123 int main()
19124 {
19125         info.hash = hash_cb;
19126 }
19127 #endif
19128 EOCP
19129         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19130                 if $contains warning try.out >>/dev/null 2>&1 ; then
19131                         db_hashtype='int'
19132                 else
19133                         db_hashtype='u_int32_t'
19134                 fi
19135         else
19136                 : XXX Maybe we should just give up here.
19137                 db_hashtype=u_int32_t
19138                 $cat try.out >&4
19139                 echo "Help:  I can't seem to compile the db test program." >&4
19140                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19141         fi
19142         $rm_try
19143         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19144         ;;
19145 *)      db_hashtype=u_int32_t
19146         ;;
19147 esac
19148 case "$i_db" in
19149 define)
19150         : Check the return type needed for prefix
19151         echo " "
19152         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19153         cat >try.c <<EOCP
19154 #$d_const HASCONST
19155 #ifndef HASCONST
19156 #define const
19157 #endif
19158 #include <sys/types.h>
19159 #include <db.h>
19160
19161 #ifndef DB_VERSION_MAJOR
19162 size_t prefix_cb (key1, key2)
19163 const DBT *key1;
19164 const DBT *key2;
19165 {
19166 }
19167 BTREEINFO info;
19168 int main()
19169 {
19170         info.prefix = prefix_cb;
19171 }
19172 #endif
19173 EOCP
19174         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19175                 if $contains warning try.out >>/dev/null 2>&1 ; then
19176                         db_prefixtype='int'
19177                 else
19178                         db_prefixtype='size_t'
19179                 fi
19180         else
19181                 db_prefixtype='size_t'
19182                 : XXX Maybe we should just give up here.
19183                 $cat try.out >&4
19184                 echo "Help:  I can't seem to compile the db test program." >&4
19185                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19186         fi
19187         $rm_try
19188         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19189         ;;
19190 *)      db_prefixtype='size_t'
19191         ;;
19192 esac
19193
19194 : How can we generate normalized random numbers ?
19195 echo " "
19196 echo "Looking for a random number function..." >&4
19197 case "$randfunc" in
19198 '')
19199         if set drand48 val -f; eval $csym; $val; then
19200                 dflt="drand48"
19201                 echo "Good, found drand48()." >&4
19202         elif set random val -f; eval $csym; $val; then
19203                 dflt="random"
19204                 echo "OK, found random()." >&4
19205         else
19206                 dflt="rand"
19207                 echo "Yick, looks like I have to use rand()." >&4
19208         fi
19209         echo " "
19210         ;;
19211 *)
19212         dflt="$randfunc"
19213         ;;
19214 esac
19215 cont=true
19216
19217 case "$ccflags" in
19218 *-Dmy_rand=*|*-Dmy_srand=*)
19219         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19220         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19221         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19222         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19223         ;;
19224 esac
19225
19226 while $test "$cont"; do
19227         rp="Use which function to generate random numbers?"
19228         . ./myread
19229         if $test "$ans" = "$dflt"; then
19230                 : null
19231         else
19232                 randbits=''
19233         fi
19234         randfunc="$ans"
19235         if set $ans val -f; eval $csym; $val; then
19236                 cont=''
19237         else
19238                 dflt=y
19239                 rp="I cannot find function $ans. Use that name anyway?"
19240                 . ./myread
19241                 dflt=rand
19242                 case "$ans" in
19243                         [yY]*) cont='';;
19244                 esac
19245         fi
19246         case "$cont" in
19247         '')
19248                 case "$randfunc" in
19249                 drand48)
19250                         drand01="drand48()"
19251                         seedfunc="srand48"
19252                         randbits=48
19253                         randseedtype=long
19254                         ;;
19255                 rand|random)
19256                         case "$randbits" in
19257                         '')
19258 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19259                                 $cat >try.c <<EOCP
19260 #$i_unistd I_UNISTD
19261 #$i_stdlib I_STDLIB
19262 #include <stdio.h>
19263 #ifdef I_UNISTD
19264 #  include <unistd.h>
19265 #endif
19266 #ifdef I_STDLIB
19267 #  include <stdlib.h>
19268 #endif
19269 int main()
19270 {
19271         register int i;
19272         register unsigned long tmp;
19273         register unsigned long max = 0L;
19274
19275         for (i = 1000; i; i--) {
19276                 tmp = (unsigned long) $randfunc();
19277                 if (tmp > max) max = tmp;
19278         }
19279         for (i = 0; max; i++)
19280                 max /= 2;
19281         printf("%d\n",i);
19282 }
19283 EOCP
19284                                 set try
19285                                 if eval $compile_ok; then
19286                                         dflt=`try`
19287                                 else
19288                                         dflt='?'
19289                                         echo "(I can't seem to compile the test program...)"
19290                                 fi
19291                                 ;;
19292                         *)
19293                                 dflt="$randbits"
19294                                 ;;
19295                         esac
19296                         rp="How many bits does your $randfunc() function produce?"
19297                         . ./myread
19298                         randbits="$ans"
19299                         $rm_try
19300                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19301                         seedfunc="s$randfunc"
19302                         randseedtype=unsigned
19303                         ;;
19304                 *)
19305                         dflt="31"
19306                         rp="How many bits does your $randfunc() function produce?"
19307                         . ./myread
19308                         randbits="$ans"
19309                         seedfunc="s$randfunc"
19310                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19311                         if set $seedfunc val -f; eval $csym; $val; then
19312                                 echo "(Using $seedfunc() to seed random generator)"
19313                         else
19314                                 echo "(Warning: no $seedfunc() to seed random generator)"
19315                                 seedfunc=rand
19316                         fi
19317                         randseedtype=unsigned
19318                         ;;
19319                 esac
19320                 ;;
19321         esac
19322 done
19323
19324 : Determine if this is an EBCDIC system
19325 echo " "
19326 echo "Determining whether or not we are on an EBCDIC system..." >&4
19327 $cat >try.c <<'EOM'
19328 int main()
19329 {
19330   if ('M'==0xd4) return 0;
19331   return 1;
19332 }
19333 EOM
19334
19335 val=$undef
19336 set try
19337 if eval $compile_ok; then
19338         if $run ./try; then
19339                 echo "You seem to speak EBCDIC." >&4
19340                 val="$define"
19341         else
19342                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19343         fi
19344 else
19345         echo "I'm unable to compile the test program." >&4
19346         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19347 fi
19348 $rm_try
19349 set ebcdic
19350 eval $setvar
19351
19352 : Check how to flush
19353 echo " "
19354 $cat >&4 <<EOM
19355 Checking how to flush all pending stdio output...
19356 EOM
19357 # I only know how to find the first 32 possibly open files on SunOS.
19358 # See also hints/sunos_4_1.sh and util.c  --AD
19359 case "$osname" in
19360 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19361 esac
19362 $cat >>try.c <<EOCP
19363 #include <stdio.h>
19364 #$i_stdlib I_STDLIB
19365 #ifdef I_STDLIB
19366 #include <stdlib.h>
19367 #endif
19368 #$i_unistd I_UNISTD
19369 #ifdef I_UNISTD
19370 # include <unistd.h>
19371 #endif
19372 #$d_sysconf HAS_SYSCONF
19373 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19374 #ifdef HAS_STDIO_STREAM_ARRAY
19375 # define STDIO_STREAM_ARRAY $stdio_stream_array
19376 #endif
19377 int main() {
19378   FILE* p;
19379   unlink("try.out");
19380   p = fopen("try.out", "w");
19381 #ifdef TRY_FPUTC
19382   fputc('x', p);
19383 #else
19384 # ifdef TRY_FPRINTF
19385   fprintf(p, "x");
19386 # endif
19387 #endif
19388 #ifdef TRY_FFLUSH_NULL
19389   fflush(NULL);
19390 #endif
19391 #ifdef TRY_FFLUSH_ALL
19392   {
19393     long open_max = -1;
19394 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19395     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19396 # else
19397 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19398     open_max = sysconf(_SC_OPEN_MAX);
19399 #  else
19400 #   ifdef FOPEN_MAX
19401     open_max = FOPEN_MAX;
19402 #   else
19403 #    ifdef OPEN_MAX
19404     open_max = OPEN_MAX;
19405 #    else
19406 #     ifdef _NFILE
19407     open_max = _NFILE;
19408 #     endif
19409 #    endif
19410 #   endif
19411 #  endif
19412 # endif
19413 # ifdef HAS_STDIO_STREAM_ARRAY
19414     if (open_max > 0) {
19415       long i;
19416       for (i = 0; i < open_max; i++)
19417             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19418                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19419                 STDIO_STREAM_ARRAY[i]._flag)
19420                 fflush(&STDIO_STREAM_ARRAY[i]);
19421     }
19422   }
19423 # endif
19424 #endif
19425   _exit(42);
19426 }
19427 EOCP
19428 : first we have to find out how _not_ to flush
19429 $to try.c
19430 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19431     output=''
19432     set try -DTRY_FPUTC
19433     if eval $compile; then
19434             $run ./try 2>/dev/null
19435             code="$?"
19436             $from try.out
19437             if $test ! -s try.out -a "X$code" = X42; then
19438                 output=-DTRY_FPUTC
19439             fi
19440     fi
19441     case "$output" in
19442     '')
19443             set try -DTRY_FPRINTF
19444             if eval $compile; then
19445                     $run ./try 2>/dev/null
19446                     code="$?"
19447                     $from try.out
19448                     if $test ! -s try.out -a "X$code" = X42; then
19449                         output=-DTRY_FPRINTF
19450                     fi
19451             fi
19452         ;;
19453     esac
19454 fi
19455 : check for fflush NULL behaviour
19456 case "$fflushNULL" in
19457 '')     set try -DTRY_FFLUSH_NULL $output
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                         fflushNULL="`$cat try.out`"
19464                 else
19465                         if $test "X$code" != X42; then
19466                                 $cat >&4 <<EOM
19467 (If this test failed, don't worry, we'll try another method shortly.)
19468 EOM
19469                         fi
19470                 fi
19471         fi
19472         $rm -f core try.core core.try.*
19473         case "$fflushNULL" in
19474         x)      $cat >&4 <<EOM
19475 Your fflush(NULL) works okay for output streams.
19476 Let's see if it clobbers input pipes...
19477 EOM
19478 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19479 # bug that improperly flushes the input end of pipes.  So we avoid the
19480 # autoflush on fork/system/exec support for now. :-(
19481 $cat >tryp.c <<EOCP
19482 #include <stdio.h>
19483 int
19484 main(int argc, char **argv)
19485 {
19486     char buf[1024];
19487     int i;
19488     char *bp = buf;
19489     while (1) {
19490         while ((i = getc(stdin)) != -1
19491                && (*bp++ = i) != '\n'
19492                && bp < &buf[1024])
19493         /* DO NOTHING */ ;
19494         *bp = '\0';
19495         fprintf(stdout, "%s", buf);
19496         fflush(NULL);
19497         if (i == -1)
19498             return 0;
19499         bp = buf;
19500     }
19501 }
19502 EOCP
19503                 fflushNULL="$define"
19504                 set tryp
19505                 if eval $compile; then
19506                     $rm -f tryp.out
19507                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19508                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19509                        $cat >&4 <<EOM
19510 fflush(NULL) seems to behave okay with input streams.
19511 EOM
19512                         fflushNULL="$define"
19513                     else
19514                         $cat >&4 <<EOM
19515 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19516 EOM
19517                         fflushNULL="$undef"
19518                     fi
19519                 fi
19520                 $rm -f core tryp.c tryp.core core.tryp.*
19521                 ;;
19522         '')     $cat >&4 <<EOM
19523 Your fflush(NULL) isn't working (contrary to ANSI C).
19524 EOM
19525                 fflushNULL="$undef"
19526                 ;;
19527         *)      $cat >&4 <<EOM
19528 Cannot figure out whether your fflush(NULL) works or not.
19529 I'm assuming it doesn't (contrary to ANSI C).
19530 EOM
19531                 fflushNULL="$undef"
19532                 ;;
19533         esac
19534         ;;
19535 $define|true|[yY]*)
19536         fflushNULL="$define"
19537         ;;
19538 *)
19539         fflushNULL="$undef"
19540         ;;
19541 esac
19542 : check explicit looping only if NULL did not work, and if the pipe
19543 : bug does not show up on an explicit flush too
19544 case "$fflushNULL" in
19545 "$undef")
19546         $cat >tryp.c <<EOCP
19547 #include <stdio.h>
19548 int
19549 main(int argc, char **argv)
19550 {
19551     char buf[1024];
19552     int i;
19553     char *bp = buf;
19554     while (1) {
19555         while ((i = getc(stdin)) != -1
19556                && (*bp++ = i) != '\n'
19557                && bp < &buf[1024])
19558         /* DO NOTHING */ ;
19559         *bp = '\0';
19560         fprintf(stdout, "%s", buf);
19561         fflush(stdin);
19562         if (i == -1)
19563             return 0;
19564         bp = buf;
19565     }
19566 }
19567 EOCP
19568         set tryp
19569         if eval $compile; then
19570             $rm -f tryp.out
19571             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19572             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19573                $cat >&4 <<EOM
19574 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19575 EOM
19576                 : now check for fflushall behaviour
19577                 case "$fflushall" in
19578                 '')     set try -DTRY_FFLUSH_ALL $output
19579                         if eval $compile; then
19580                                 $cat >&4 <<EOM
19581 (Now testing the other method--but note that this also may fail.)
19582 EOM
19583                                 $run ./try 2>/dev/null
19584                                 code=$?
19585                                 $from try.out
19586                                 if $test -s try.out -a "X$code" = X42; then
19587                                         fflushall="`$cat try.out`"
19588                                 fi
19589                         fi
19590                         $rm_try
19591                         case "$fflushall" in
19592                         x)      $cat >&4 <<EOM
19593 Whew. Flushing explicitly all the stdio streams works.
19594 EOM
19595                                 fflushall="$define"
19596                                 ;;
19597                         '')     $cat >&4 <<EOM
19598 Sigh. Flushing explicitly all the stdio streams doesn't work.
19599 EOM
19600                                 fflushall="$undef"
19601                                 ;;
19602                         *)      $cat >&4 <<EOM
19603 Cannot figure out whether flushing stdio streams explicitly works or not.
19604 I'm assuming it doesn't.
19605 EOM
19606                                 fflushall="$undef"
19607                                 ;;
19608                         esac
19609                         ;;
19610                 "$define"|true|[yY]*)
19611                         fflushall="$define"
19612                         ;;
19613                 *)
19614                         fflushall="$undef"
19615                         ;;
19616                 esac
19617             else
19618                 $cat >&4 <<EOM
19619 All is futile.  Even fflush(stdin) clobbers input pipes!
19620 EOM
19621                 fflushall="$undef"
19622             fi
19623         else
19624             fflushall="$undef"
19625         fi
19626         $rm -f core tryp.c tryp.core core.tryp.*
19627         ;;
19628 *)      fflushall="$undef"
19629         ;;
19630 esac
19631
19632 case "$fflushNULL$fflushall" in
19633 undefundef)
19634         $cat <<EOM
19635 OK, I give up.  I cannot figure out how to flush pending stdio output.
19636 We won't be flushing handles at all before fork/exec/popen.
19637 EOM
19638         ;;
19639 esac
19640 $rm_try tryp
19641
19642 : Store the full pathname to the ar program for use in the C program
19643 : Respect a hint or command line value for full_ar.
19644 case "$full_ar" in
19645 '') full_ar=$ar ;;
19646 esac
19647
19648 : Store the full pathname to the sed program for use in the C program
19649 full_sed=$sed
19650
19651 : see what type gids are declared as in the kernel
19652 echo " "
19653 echo "Looking for the type for group ids returned by getgid()."
19654 set gid_t gidtype xxx stdio.h sys/types.h
19655 eval $typedef
19656 case "$gidtype" in
19657 xxx)
19658         xxx=`./findhdr sys/user.h`
19659         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19660         case $1 in
19661         unsigned) dflt="$1 $2" ;;
19662         *) dflt="$1" ;;
19663         esac
19664         ;;
19665 *) dflt="$gidtype";;
19666 esac
19667 case "$gidtype" in
19668 gid_t) echo "gid_t found." ;;
19669 *)      rp="What is the type for group ids returned by getgid()?"
19670         . ./myread
19671         gidtype="$ans"
19672         ;;
19673 esac
19674
19675 : Check the size of GID
19676 echo " "
19677 case "$gidtype" in
19678 *_t) zzz="$gidtype"     ;;
19679 *)   zzz="gid"          ;;
19680 esac
19681 echo "Checking the size of $zzz..." >&4
19682 cat > try.c <<EOCP
19683 #include <sys/types.h>
19684 #include <stdio.h>
19685 #$i_stdlib I_STDLIB
19686 #ifdef I_STDLIB
19687 #include <stdlib.h>
19688 #endif
19689 int main() {
19690     printf("%d\n", (int)sizeof($gidtype));
19691     exit(0);
19692 }
19693 EOCP
19694 set try
19695 if eval $compile_ok; then
19696         yyy=`$run ./try`
19697         case "$yyy" in
19698         '')     gidsize=4
19699                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19700                 ;;
19701         *)      gidsize=$yyy
19702                 echo "Your $zzz is $gidsize bytes long."
19703                 ;;
19704         esac
19705 else
19706         gidsize=4
19707         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19708 fi
19709
19710
19711 : Check if GID is signed
19712 echo " "
19713 case "$gidtype" in
19714 *_t) zzz="$gidtype"     ;;
19715 *)   zzz="gid"          ;;
19716 esac
19717 echo "Checking the sign of $zzz..." >&4
19718 cat > try.c <<EOCP
19719 #include <sys/types.h>
19720 #include <stdio.h>
19721 int main() {
19722         $gidtype foo = -1;
19723         if (foo < 0)
19724                 printf("-1\n");
19725         else
19726                 printf("1\n");
19727 }
19728 EOCP
19729 set try
19730 if eval $compile; then
19731         yyy=`$run ./try`
19732         case "$yyy" in
19733         '')     gidsign=1
19734                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19735                 ;;
19736         *)      gidsign=$yyy
19737                 case "$gidsign" in
19738                  1) echo "Your $zzz is unsigned." ;;
19739                 -1) echo "Your $zzz is signed."   ;;
19740                 esac
19741                 ;;
19742         esac
19743 else
19744         gidsign=1
19745         echo "(I can't compile the test program--guessing unsigned.)" >&4
19746 fi
19747
19748
19749 : Check 64bit sizes
19750 echo " "
19751
19752 if $test X"$quadtype" != X; then
19753
19754 echo "Checking how to print 64-bit integers..." >&4
19755
19756 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19757         $cat >try.c <<'EOCP'
19758 #include <sys/types.h>
19759 #include <stdio.h>
19760 int main() {
19761   int q = 12345678901;
19762   printf("%ld\n", q);
19763 }
19764 EOCP
19765         set try
19766         if eval $compile; then
19767                 yyy=`$run ./try`
19768                 case "$yyy" in
19769                 12345678901)
19770                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19771                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19772                         echo "We will use %d."
19773                         ;;
19774                 esac
19775         fi
19776 fi
19777
19778 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19779         $cat >try.c <<'EOCP'
19780 #include <sys/types.h>
19781 #include <stdio.h>
19782 int main() {
19783   long q = 12345678901;
19784   printf("%ld\n", q);
19785 }
19786 EOCP
19787         set try
19788         if eval $compile; then
19789                 yyy=`$run ./try`
19790                 case "$yyy" in
19791                 12345678901)
19792                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19793                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19794                         echo "We will use %ld."
19795                         ;;
19796                 esac
19797         fi
19798 fi
19799
19800 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19801         $cat >try.c <<'EOCP'
19802 #include <sys/types.h>
19803 #include <inttypes.h>
19804 #include <stdio.h>
19805 int main() {
19806   int64_t q = 12345678901;
19807   printf("%" PRId64 "\n", q);
19808 }
19809 EOCP
19810         set try
19811         if eval $compile; then
19812                 yyy=`$run ./try`
19813                 case "$yyy" in
19814                 12345678901)
19815                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19816                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19817                         echo "We will use the C9X style."
19818                         ;;
19819                 esac
19820         fi
19821 fi
19822
19823 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19824         $cat >try.c <<EOCP
19825 #include <sys/types.h>
19826 #include <stdio.h>
19827 int main() {
19828   $quadtype q = 12345678901;
19829   printf("%Ld\n", q);
19830 }
19831 EOCP
19832         set try
19833         if eval $compile; then
19834                 yyy=`$run ./try`
19835                 case "$yyy" in
19836                 12345678901)
19837                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19838                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19839                         echo "We will use %Ld."
19840                         ;;
19841                 esac
19842         fi
19843 fi
19844
19845 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19846         $cat >try.c <<'EOCP'
19847 #include <sys/types.h>
19848 #include <stdio.h>
19849 int main() {
19850   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19851   printf("%lld\n", q);
19852 }
19853 EOCP
19854         set try
19855         if eval $compile; then
19856                 yyy=`$run ./try`
19857                 case "$yyy" in
19858                 12345678901)
19859                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19860                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19861                         echo "We will use the %lld style."
19862                         ;;
19863                 esac
19864         fi
19865 fi
19866
19867 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19868         $cat >try.c <<EOCP
19869 #include <sys/types.h>
19870 #include <stdio.h>
19871 int main() {
19872   $quadtype q = 12345678901;
19873   printf("%qd\n", q);
19874 }
19875 EOCP
19876         set try
19877         if eval $compile; then
19878                 yyy=`$run ./try`
19879                 case "$yyy" in
19880                 12345678901)
19881                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19882                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19883                         echo "We will use %qd."
19884                         ;;
19885                 esac
19886         fi
19887 fi
19888
19889 if $test X"$sPRId64" = X; then
19890         echo "Cannot figure out how to print 64-bit integers." >&4
19891 fi
19892 $rm_try
19893
19894 fi
19895
19896 case "$sPRId64" in
19897 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19898         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19899         ;;
19900 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19901         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19902         ;;
19903 esac
19904
19905 : Check format strings for internal types
19906 echo " "
19907 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19908
19909 if $test X"$ivsize" = X8; then
19910         ivdformat="$sPRId64"
19911         uvuformat="$sPRIu64"
19912         uvoformat="$sPRIo64"
19913         uvxformat="$sPRIx64"
19914         uvXUformat="$sPRIXU64"
19915 else
19916         if $test X"$ivsize" = X"$longsize"; then
19917                 ivdformat='"ld"'
19918                 uvuformat='"lu"'
19919                 uvoformat='"lo"'
19920                 uvxformat='"lx"'
19921                 uvXUformat='"lX"'
19922         else
19923                 if $test X"$ivsize" = X"$intsize"; then
19924                         ivdformat='"d"'
19925                         uvuformat='"u"'
19926                         uvoformat='"o"'
19927                         uvxformat='"x"'
19928                         uvXUformat='"X"'
19929                 else
19930                         : far out
19931                         if $test X"$ivsize" = X"$shortsize"; then
19932                                 ivdformat='"hd"'
19933                                 uvuformat='"hu"'
19934                                 uvoformat='"ho"'
19935                                 uvxformat='"hx"'
19936                                 uvXUformat='"hX"'
19937                         fi
19938                 fi
19939         fi
19940 fi
19941
19942 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19943         nveformat="$sPRIeldbl"
19944         nvfformat="$sPRIfldbl"
19945         nvgformat="$sPRIgldbl"
19946         nvEUformat="$sPRIEUldbl"
19947         nvFUformat="$sPRIFUldbl"
19948         nvGUformat="$sPRIGUldbl"
19949 else
19950         nveformat='"e"'
19951         nvfformat='"f"'
19952         nvgformat='"g"'
19953         nvEUformat='"E"'
19954         nvFUformat='"F"'
19955         nvGUformat='"G"'
19956 fi
19957
19958 case "$ivdformat" in
19959 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19960     exit 1
19961     ;;
19962 esac
19963
19964 : Check format string for GID
19965
19966 echo " "
19967 $echo "Checking the format string to be used for gids..." >&4
19968
19969 case "$gidsign" in
19970 -1)     if $test X"$gidsize" = X"$ivsize"; then
19971                 gidformat="$ivdformat"
19972         else
19973                 if $test X"$gidsize" = X"$longsize"; then
19974                         gidformat='"ld"'
19975                 else
19976                         if $test X"$gidsize" = X"$intsize"; then
19977                                 gidformat='"d"'
19978                         else
19979                                 if $test X"$gidsize" = X"$shortsize"; then
19980                                         gidformat='"hd"'
19981                                 fi
19982                         fi
19983                 fi
19984         fi
19985         ;;
19986 *)      if $test X"$gidsize" = X"$uvsize"; then
19987                 gidformat="$uvuformat"
19988         else
19989                 if $test X"$gidsize" = X"$longsize"; then
19990                         gidformat='"lu"'
19991                 else
19992                         if $test X"$gidsize" = X"$intsize"; then
19993                                 gidformat='"u"'
19994                         else
19995                                 if $test X"$gidsize" = X"$shortsize"; then
19996                                         gidformat='"hu"'
19997                                 fi
19998                         fi
19999                 fi
20000         fi
20001         ;;
20002 esac
20003
20004 : see if getgroups exists
20005 set getgroups d_getgrps
20006 eval $inlibc
20007
20008 : see if setgroups exists
20009 set setgroups d_setgrps
20010 eval $inlibc
20011
20012 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20013 echo " "
20014 case "$d_getgrps$d_setgrps" in
20015 *define*)
20016         case "$groupstype" in
20017         '') dflt="$gidtype" ;;
20018         *)  dflt="$groupstype" ;;
20019         esac
20020         $cat <<EOM
20021 What type of pointer is the second argument to getgroups() and setgroups()?
20022 Usually this is the same as group ids, $gidtype, but not always.
20023
20024 EOM
20025         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20026         . ./myread
20027         groupstype="$ans"
20028         ;;
20029 *)  groupstype="$gidtype";;
20030 esac
20031
20032 : MAD = Misc Attribute Definition
20033
20034 if $test $patchlevel -lt 9; then
20035 : MAD is not available in 5.8.x or earlier.
20036     ans=n;
20037 else
20038     case "$mad" in
20039     $define|true|[yY]*) dflt='y' ;;
20040     *)                  dflt='n' ;;
20041     esac
20042     cat <<EOM
20043
20044 Would you like to build with Misc Attribute Decoration? This is development
20045 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20046 overhead on the interpreter.
20047
20048 If this doesn't make any sense to you, just accept the default '$dflt'.
20049 EOM
20050     rp='Build Perl with MAD?'
20051     . ./myread
20052 fi
20053 case "$ans" in
20054 y|Y)    val="$define"
20055         madlyh='madly.h madly.act madly.tab'
20056         madlysrc='madly.c'
20057         madlyobj="madly$_o" ;;
20058 *)      val="$undef"
20059         madlyh=''
20060         madlysrc=''
20061         madlyobj='' ;;
20062 esac
20063 set mad
20064 eval $setvar
20065
20066 : check whether make sets MAKE
20067 echo " "
20068 echo "Checking if your $make program sets \$(MAKE)..." >&4
20069 case "$make_set_make" in
20070 '')
20071         $sed 's/^X //' > testmake.mak << 'EOF'
20072 Xall:
20073 X       @echo 'maketemp="$(MAKE)"'
20074 EOF
20075         case "`$make -f testmake.mak 2>/dev/null`" in
20076         *maketemp=*) make_set_make='#' ;;
20077         *)      make_set_make="MAKE=$make" ;;
20078         esac
20079         $rm -f testmake.mak
20080         ;;
20081 esac
20082 case "$make_set_make" in
20083 '#') echo "Yup, it does.";;
20084 *) echo "Nope, it doesn't.";;
20085 esac
20086
20087 : see what type is used for mode_t
20088 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20089 set mode_t modetype int stdio.h sys/types.h
20090 eval $typedef_ask
20091
20092 : see if we need va_copy
20093 echo " "
20094 case "$i_stdarg" in
20095 "$define")
20096         $cat >try.c <<EOCP
20097 #include <stdarg.h>
20098 #include <stdio.h>
20099 #$i_stdlib I_STDLIB
20100 #ifdef I_STDLIB
20101 #include <stdlib.h>
20102 #endif
20103 #include <signal.h>
20104
20105 int
20106 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20107 {
20108   return vfprintf(f, fmt, *valp);
20109 }
20110
20111 int
20112 myvfprintf(FILE *f, const  char *fmt, va_list val)
20113 {
20114   return ivfprintf(f, fmt, &val);
20115 }
20116
20117 int
20118 myprintf(char *fmt, ...)
20119 {
20120   va_list val;
20121   va_start(val, fmt);
20122   return myvfprintf(stdout, fmt, val);
20123 }
20124
20125 int
20126 main(int ac, char **av)
20127 {
20128   signal(SIGSEGV, exit);
20129
20130   myprintf("%s%cs all right, then\n", "that", '\'');
20131   exit(0);
20132 }
20133 EOCP
20134         set try
20135         if eval $compile && $run ./try 2>&1 >/dev/null; then
20136                 case "`$run ./try`" in
20137                 "that's all right, then")
20138                         okay=yes
20139                         ;;
20140                 esac
20141         fi
20142         case "$okay" in
20143         yes)    echo "It seems that you don't need va_copy()." >&4
20144                 need_va_copy="$undef"
20145                 ;;
20146         *)      echo "It seems that va_copy() or similar will be needed." >&4
20147                 need_va_copy="$define"
20148                 ;;
20149         esac
20150         $rm_try
20151         ;;
20152 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20153         ;;
20154 esac
20155
20156 : see what type is used for size_t
20157 rp="What is the type used for the length parameter for string functions?"
20158 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20159 eval $typedef_ask
20160
20161 : check for type of arguments to gethostbyaddr. 
20162 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20163         case "$d_gethbyaddr" in
20164         $define)
20165                 $cat <<EOM
20166
20167 Checking to see what type of arguments are accepted by gethostbyaddr().
20168 EOM
20169                 hdrs="$define sys/types.h
20170                         $d_socket sys/socket.h 
20171                         $i_niin netinet/in.h 
20172                         $i_netdb netdb.h
20173                         $i_unistd unistd.h"
20174                 : The first arg can 'char *' or 'void *'
20175                 : The second arg is some of integral type
20176                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20177                         for yyy in size_t long int; do
20178                                 case "$netdb_host_type" in
20179                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20180                                         if ./protochk "$try" $hdrs; then
20181                                                 echo "Your system accepts $xxx for the first arg."
20182                                                 echo "...and $yyy for the second arg."
20183                                                 netdb_host_type="$xxx"
20184                                                 netdb_hlen_type="$yyy"
20185                                         fi
20186                                         ;;
20187                                 esac
20188                         done
20189                 done
20190                 : In case none of those worked, prompt the user.
20191                 case "$netdb_host_type" in
20192                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20193                         dflt='char *'
20194                         . ./myread
20195                         netdb_host_type=$ans
20196                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20197                         dflt="$sizetype"
20198                         . ./myread
20199                         netdb_hlen_type=$ans
20200                         ;;
20201                 esac
20202                 ;;
20203         *)      : no gethostbyaddr, so pick harmless defaults
20204                 netdb_host_type='char *'
20205                 netdb_hlen_type="$sizetype"
20206                 ;;
20207         esac
20208         # Remove the "const" if needed. -- but then we'll have a 
20209         # prototype clash!
20210         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20211 fi
20212
20213 : check for type of argument to gethostbyname. 
20214 if test "X$netdb_name_type" = X ; then
20215         case "$d_gethbyname" in
20216         $define)
20217                 $cat <<EOM
20218
20219 Checking to see what type of argument is accepted by gethostbyname().
20220 EOM
20221                 hdrs="$define sys/types.h
20222                         $d_socket sys/socket.h 
20223                         $i_niin netinet/in.h 
20224                         $i_netdb netdb.h
20225                         $i_unistd unistd.h"
20226                 for xxx in "const char *" "char *"; do
20227                         case "$netdb_name_type" in
20228                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20229                                 if ./protochk "$try" $hdrs; then
20230                                         echo "Your system accepts $xxx."
20231                                         netdb_name_type="$xxx"
20232                                 fi
20233                                 ;;
20234                         esac
20235                 done
20236                 : In case none of those worked, prompt the user.
20237                 case "$netdb_name_type" in
20238                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20239                         dflt='char *'
20240                         . ./myread
20241                         netdb_name_type=$ans
20242                         ;;
20243                 esac
20244                 ;;
20245         *)      : no gethostbyname, so pick harmless default
20246                 netdb_name_type='char *'
20247                 ;;
20248         esac
20249 fi
20250
20251 : check for type of 1st argument to getnetbyaddr. 
20252 if test "X$netdb_net_type" = X ; then
20253         case "$d_getnbyaddr" in
20254         $define)
20255                 $cat <<EOM
20256
20257 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20258 EOM
20259                 hdrs="$define sys/types.h
20260                         $d_socket sys/socket.h 
20261                         $i_niin netinet/in.h 
20262                         $i_netdb netdb.h
20263                         $i_unistd unistd.h"
20264                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20265                         case "$netdb_net_type" in
20266                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20267                                 if ./protochk "$try" $hdrs; then
20268                                         echo "Your system accepts $xxx."
20269                                         netdb_net_type="$xxx"
20270                                 fi
20271                                 ;;
20272                         esac
20273                 done
20274                 : In case none of those worked, prompt the user.
20275                 case "$netdb_net_type" in
20276                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20277                         dflt='long'
20278                         . ./myread
20279                         netdb_net_type=$ans
20280                         ;;
20281                 esac
20282                 ;;
20283         *)      : no getnetbyaddr, so pick harmless default
20284                 netdb_net_type='long'
20285                 ;;
20286         esac
20287 fi
20288 : locate the preferred pager for this system
20289 fn=f/
20290 case "$pager" in
20291 '')
20292         dflt=''
20293         case "$pg" in
20294         /*) dflt=$pg;;
20295         [a-zA-Z]:/*) dflt=$pg;;
20296         esac
20297         case "$more" in
20298         /*) dflt=$more;;
20299         [a-zA-Z]:/*) dflt=$more;;
20300         esac
20301         case "$less" in
20302         /*) dflt=$less;;
20303         [a-zA-Z]:/*) dflt=$less;;
20304         esac
20305         case "$dflt" in
20306         '') dflt=/usr/ucb/more;;
20307         esac
20308         ;;
20309 *)      dflt="$pager"
20310         fn="f/($pager)"
20311         ;;
20312 esac
20313 echo " "
20314 rp='What pager is used on your system?'
20315 . ./getfile
20316 pager="$ans"
20317
20318 : see what type pids are declared as in the kernel
20319 rp="What is the type of process ids on this system?"
20320 set pid_t pidtype int stdio.h sys/types.h
20321 eval $typedef_ask
20322
20323 : see if ar generates random libraries by itself
20324 echo " "
20325 echo "Checking how to generate random libraries on your machine..." >&4
20326 echo 'int bar1() { return bar2(); }' > bar1.c
20327 echo 'int bar2() { return 2; }' > bar2.c
20328 $cat > foo.c <<EOP
20329 #$i_stdlib I_STDLIB
20330 #ifdef I_STDLIB
20331 #include <stdlib.h>
20332 #endif
20333 int main() { printf("%d\n", bar1()); exit(0); }
20334 EOP
20335 $cc $ccflags -c bar1.c >/dev/null 2>&1
20336 $cc $ccflags -c bar2.c >/dev/null 2>&1
20337 $cc $ccflags -c foo.c >/dev/null 2>&1
20338 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20339 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20340         $run ./foobar >/dev/null 2>&1; then
20341         echo "$ar appears to generate random libraries itself."
20342         orderlib=false
20343         if [ "X$ranlib" = "X" ]; then
20344             ranlib=":"
20345         fi
20346 elif $ar s bar$_a >/dev/null 2>&1 &&
20347         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20348         $run ./foobar >/dev/null 2>&1; then
20349                 echo "a table of contents needs to be added with '$ar s'."
20350                 orderlib=false
20351                 ranlib="$ar s"
20352 elif $ar ts bar$_a >/dev/null 2>&1 &&
20353         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20354         $run ./foobar >/dev/null 2>&1; then
20355                 echo "a table of contents needs to be added with '$ar ts'."
20356                 orderlib=false
20357                 ranlib="$ar ts"
20358 else
20359         case "$ranlib" in
20360         :) ranlib='';;
20361         '')
20362                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20363                 $test -f $ranlib || ranlib=''
20364                 ;;
20365         esac
20366         if $test -n "$ranlib"; then
20367                 echo "your system has '$ranlib'; we'll use that."
20368                 orderlib=false
20369         else
20370                 echo "your system doesn't seem to support random libraries"
20371                 echo "so we'll use lorder and tsort to order the libraries."
20372                 orderlib=true
20373                 ranlib=":"
20374         fi
20375 fi
20376 $rm -f foo* bar*
20377
20378 : see if this is a values.h system
20379 set values.h i_values
20380 eval $inhdr
20381
20382 : Check the max offset that gmtime and localtime accept
20383 echo "Checking max offsets that gmtime () accepts"
20384
20385 case $i_values in
20386     define) yyy="#include <values.h>" ;;
20387     *)      yyy="" ;;
20388     esac
20389
20390 case "$sGMTIME_min/$sGMTIME_max" in
20391     0/0|/)
20392         $cat >try.c <<EOCP
20393 #include <sys/types.h>
20394 #include <stdio.h>
20395 #include <time.h>
20396 $yyy
20397
20398 int i;
20399 struct tm *tmp;
20400 time_t pt;
20401
20402 void gm_check (time_t t, int min_year, int max_year)
20403 {
20404     tmp = gmtime (&t);
20405     if ( tmp == NULL ||
20406         /* Check tm_year overflow */
20407          tmp->tm_year < min_year || tmp->tm_year > max_year)
20408         tmp = NULL;
20409     else
20410         pt = t;
20411     } /* gm_check */
20412
20413 int check_max ()
20414 {
20415     tmp = NULL;
20416     pt  = 0;
20417 #ifdef MAXLONG
20418     gm_check (MAXLONG, 69, 0x7fffffff);
20419 #endif
20420     if (tmp == NULL || tmp->tm_year < 0) {
20421         for (i = 63; i >= 0; i--) {
20422             time_t x = pt | ((time_t)1 << i);
20423             if (x < 0 || x < pt) continue;
20424             gm_check (x, 69, 0x7fffffff);
20425             }
20426         }
20427     printf ("sGMTIME_max=%ld\n", pt);
20428     return (0);
20429     } /* check_max */
20430
20431 int check_min ()
20432 {
20433     tmp = NULL;
20434     pt  = 0;
20435 #ifdef MINLONG
20436     gm_check (MINLONG, -1900, 70);
20437 #endif
20438     if (tmp == NULL) {
20439         for (i = 36; i >= 0; i--) {
20440             time_t x = pt - ((time_t)1 << i);
20441             if (x > 0) continue;
20442             gm_check (x, -1900, 70);
20443             }
20444         }
20445     printf ("sGMTIME_min=%ld\n", pt);
20446     return (0);
20447     } /* check_min */
20448
20449 int main (int argc, char *argv[])
20450 {
20451     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20452     check_max ();
20453     check_min ();
20454     return (0);
20455     } /* main */
20456 EOCP
20457         set try
20458         if eval $compile; then
20459             eval `$run ./try`
20460         else
20461             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20462             fi
20463         $rm_try
20464         ;;
20465     esac
20466
20467 echo "Checking max offsets that localtime () accepts"
20468
20469 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20470     0/0|/)
20471         $cat >try.c <<EOCP
20472 #include <sys/types.h>
20473 #include <stdio.h>
20474 #include <time.h>
20475 $yyy
20476
20477 int i;
20478 struct tm *tmp;
20479 time_t pt;
20480
20481 void local_check (time_t t, int min_year, int max_year)
20482 {
20483     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20484         tmp = NULL;
20485     else
20486         tmp = localtime (&t);
20487     if ( tmp == NULL ||
20488         /* Check tm_year overflow */
20489          tmp->tm_year < min_year || tmp->tm_year > max_year)
20490         tmp = NULL;
20491     else
20492         pt = t;
20493     } /* local_check */
20494
20495 int check_max ()
20496 {
20497     tmp = NULL;
20498     pt  = 0;
20499 #ifdef MAXLONG
20500     local_check (MAXLONG, 69, 0x7fffffff);
20501 #endif
20502     if (tmp == NULL || tmp->tm_year < 0) {
20503         for (i = 63; i >= 0; i--) {
20504             time_t x = pt | ((time_t)1 << i);
20505             if (x < 0 || x < pt) continue;
20506             local_check (x, 69, 0x7fffffff);
20507             }
20508         }
20509     printf ("sLOCALTIME_max=%ld\n", pt);
20510     return (0);
20511    } /* check_max */
20512
20513 int check_min ()
20514 {
20515     tmp = NULL;
20516     pt  = 0;
20517 #ifdef MINLONG
20518     local_check (MINLONG, -1900, 70);
20519 #endif
20520     if (tmp == NULL) {
20521         for (i = 36; i >= 0; i--) {
20522             time_t x = pt - ((time_t)1 << i);
20523             if (x > 0) continue;
20524             local_check (x, -1900, 70);
20525             }
20526         }
20527     printf ("sLOCALTIME_min=%ld\n", pt);
20528     return (0);
20529     } /* check_min */
20530
20531 int main (int argc, char *argv[])
20532 {
20533     check_max ();
20534     check_min ();
20535     return (0);
20536     } /* main */
20537 EOCP
20538         set try
20539         if eval $compile; then
20540             eval `$run ./try`
20541         else
20542             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20543             fi
20544         $rm_try
20545         ;;
20546     esac
20547
20548 : check for type of arguments to select.
20549 case "$selecttype" in
20550 '') case "$d_select" in
20551         $define)
20552                 echo " "
20553                 $cat <<EOM
20554 Checking to see what type of arguments are accepted by select().
20555 EOM
20556                 hdrs="$define sys/types.h
20557                         $i_systime sys/time.h
20558                         $i_sysselct sys/select.h
20559                         $d_socket sys/socket.h"
20560                 : The first arg can be int, unsigned, or size_t
20561                 : The last arg may or may not be 'const'
20562                 val=''
20563                 : void pointer has been seen but using that
20564                 : breaks the selectminbits test
20565                 for xxx in 'fd_set *' 'int *'; do
20566                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20567                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20568                                         case "$val" in
20569                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20570                                                 if ./protochk "$try" $hdrs; then
20571                                                         echo "Your system accepts $xxx."
20572                                                         val="$xxx"
20573                                                 fi
20574                                                 ;;
20575                                         esac
20576                                 done
20577                         done
20578                 done
20579                 case "$val" in
20580                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20581                         case "$d_fd_set" in
20582                                 $define) dflt="fd_set *" ;;
20583                                 *)              dflt="int *" ;;
20584                         esac
20585                         . ./myread
20586                         val=$ans
20587                         ;;
20588                 esac
20589                 selecttype="$val"
20590                 ;;
20591         *)      : no select, so pick a harmless default
20592                 selecttype='int *'
20593                 ;;
20594         esac
20595         ;;
20596 esac
20597
20598 : check for the select 'width'
20599 case "$selectminbits" in
20600 '') safebits=`expr $ptrsize \* 8`
20601     case "$d_select" in
20602         $define)
20603                 $cat <<EOM
20604
20605 Checking to see on how many bits at a time your select() operates...
20606 EOM
20607                 $cat >try.c <<EOCP
20608 #include <sys/types.h>
20609 #$i_time I_TIME
20610 #$i_systime I_SYS_TIME
20611 #$i_systimek I_SYS_TIME_KERNEL
20612 #ifdef I_TIME
20613 #   include <time.h>
20614 #endif
20615 #ifdef I_SYS_TIME
20616 #   ifdef I_SYS_TIME_KERNEL
20617 #       define KERNEL
20618 #   endif
20619 #   include <sys/time.h>
20620 #   ifdef I_SYS_TIME_KERNEL
20621 #       undef KERNEL
20622 #   endif
20623 #endif
20624 #$i_sysselct I_SYS_SELECT
20625 #ifdef I_SYS_SELECT
20626 #include <sys/select.h>
20627 #endif
20628 #$d_socket HAS_SOCKET
20629 #ifdef HAS_SOCKET
20630 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20631 #endif
20632 #include <stdio.h>
20633 #$i_stdlib I_STDLIB
20634 #ifdef I_STDLIB
20635 #include <stdlib.h>
20636 #endif
20637 $selecttype b;
20638 #define S sizeof(*(b))
20639 #define MINBITS 64
20640 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20641 #define NBITS  (NBYTES * 8)
20642 int main() {
20643     char *s = (char *)malloc(NBYTES);
20644     struct timeval t;
20645     int i;
20646     FILE* fp;
20647     int fd;
20648
20649     if (!s)
20650         exit(1);
20651     fclose(stdin);
20652     fp = fopen("try.c", "r");
20653     if (fp == 0)
20654       exit(2);
20655     fd = fileno(fp);
20656     if (fd < 0)
20657       exit(3);
20658     b = ($selecttype)s;
20659     for (i = 0; i < NBITS; i++)
20660         FD_SET(i, b);
20661     t.tv_sec  = 0;
20662     t.tv_usec = 0;
20663     select(fd + 1, b, 0, 0, &t);
20664     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20665     free(s);
20666     printf("%d\n", i + 1);
20667     return 0;
20668 }
20669 EOCP
20670                 set try
20671                 if eval $compile_ok; then
20672                         selectminbits=`$run ./try`
20673                         case "$selectminbits" in
20674                         '')     cat >&4 <<EOM
20675 Cannot figure out on how many bits at a time your select() operates.
20676 I'll play safe and guess it is $safebits bits.
20677 EOM
20678                                 selectminbits=$safebits
20679                                 bits="$safebits bits"
20680                                 ;;
20681                         1)      bits="1 bit" ;;
20682                         *)      bits="$selectminbits bits" ;;
20683                         esac
20684                         echo "Your select() operates on $bits at a time." >&4
20685                 else
20686                         rp='What is the minimum number of bits your select() operates on?'
20687                         case "$byteorder" in
20688                         12345678)       dflt=64 ;;
20689                         1234)           dflt=32 ;;
20690                         *)              dflt=1  ;;
20691                         esac
20692                         . ./myread
20693                         val=$ans
20694                         selectminbits="$val"
20695                 fi
20696                 $rm_try
20697                 ;;
20698         *)      : no select, so pick a harmless default
20699                 selectminbits=$safebits
20700                 ;;
20701         esac
20702         ;;
20703 esac
20704
20705 : Trace out the files included by signal.h, then look for SIGxxx names.
20706 if [ "X$fieldn" = X ]; then
20707         : Just make some guesses.  We check them later.
20708         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20709 else
20710         xxx=`echo '#include <signal.h>' |
20711         $cppstdin $cppminus $cppflags 2>/dev/null |
20712         $grep '^[       ]*#.*include' |
20713         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20714                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20715 fi
20716 xxxfiles=''
20717 for xx in $xxx /dev/null ; do
20718         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20719 done
20720 case "$xxxfiles" in
20721 '')     xxxfiles=`./findhdr signal.h` ;;
20722 esac
20723 xxx=`awk '
20724 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20725         print substr($2, 4, 20)
20726 }
20727 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20728         print substr($3, 4, 20)
20729 }' $xxxfiles`
20730 : Append some common names just in case the awk scan failed.
20731 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20732 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20733 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20734 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20735 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20736
20737 : generate a few handy files for later
20738 $cat > signal.c <<EOCP
20739 #include <sys/types.h>
20740 #include <signal.h>
20741 #$i_stdlib I_STDLIB
20742 #ifdef I_STDLIB
20743 #include <stdlib.h>
20744 #endif
20745 #include <stdio.h>
20746 int main() {
20747
20748 /* Strange style to avoid deeply-nested #if/#else/#endif */
20749 #ifndef NSIG
20750 #  ifdef _NSIG
20751 #    define NSIG (_NSIG)
20752 #  endif
20753 #endif
20754
20755 #ifndef NSIG
20756 #  ifdef SIGMAX
20757 #    define NSIG (SIGMAX+1)
20758 #  endif
20759 #endif
20760
20761 #ifndef NSIG
20762 #  ifdef SIG_MAX
20763 #    define NSIG (SIG_MAX+1)
20764 #  endif
20765 #endif
20766
20767 #ifndef NSIG
20768 #  ifdef _SIG_MAX
20769 #    define NSIG (_SIG_MAX+1)
20770 #  endif
20771 #endif
20772
20773 #ifndef NSIG
20774 #  ifdef MAXSIG
20775 #    define NSIG (MAXSIG+1)
20776 #  endif
20777 #endif
20778
20779 #ifndef NSIG
20780 #  ifdef MAX_SIG
20781 #    define NSIG (MAX_SIG+1)
20782 #  endif
20783 #endif
20784
20785 #ifndef NSIG
20786 #  ifdef SIGARRAYSIZE
20787 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20788 #  endif
20789 #endif
20790
20791 #ifndef NSIG
20792 #  ifdef _sys_nsig
20793 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20794 #  endif
20795 #endif
20796
20797 /* Default to some arbitrary number that's big enough to get most
20798    of the common signals.
20799 */
20800 #ifndef NSIG
20801 #    define NSIG 50
20802 #endif
20803
20804 printf("NSIG %d\n", NSIG);
20805
20806 #ifndef JUST_NSIG
20807
20808 EOCP
20809
20810 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20811 {
20812         printf "#ifdef SIG"; printf $1; printf "\n"
20813         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20814         printf $1; printf ");\n"
20815         printf "#endif\n"
20816 }
20817 END {
20818         printf "#endif /* JUST_NSIG */\n";
20819         printf "exit(0);\n}\n";
20820 }
20821 ' >>signal.c
20822 $cat >signal.awk <<'EOP'
20823 BEGIN { ndups = 0 }
20824 $1 ~ /^NSIG$/ { nsig = $2 }
20825 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20826     if ($2 > maxsig) { maxsig = $2 }
20827     if (sig_name[$2]) {
20828         dup_name[ndups] = $1
20829         dup_num[ndups] = $2
20830         ndups++
20831     }
20832     else {
20833         sig_name[$2] = $1
20834         sig_num[$2] = $2
20835     }
20836 }
20837 END {
20838     if (nsig == 0) {
20839         nsig = maxsig + 1
20840     }
20841     printf("NSIG %d\n", nsig);
20842     for (n = 1; n < nsig; n++) {
20843         if (sig_name[n]) {
20844             printf("%s %d\n", sig_name[n], sig_num[n])
20845         }
20846         else {
20847             printf("NUM%d %d\n", n, n)
20848         }
20849     }
20850     for (n = 0; n < ndups; n++) {
20851         printf("%s %d\n", dup_name[n], dup_num[n])
20852     }
20853 }
20854 EOP
20855 $cat >signal_cmd <<EOS
20856 $startsh
20857 if $test -s signal.lst; then
20858     echo "Using your existing signal.lst file"
20859         exit 0
20860 fi
20861 xxx="$xxx"
20862 EOS
20863 $cat >>signal_cmd <<'EOS'
20864
20865 set signal
20866 if eval $compile_ok; then
20867         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20868                 $uniq | $awk -f signal.awk >signal.lst
20869 else
20870         echo "(I can't seem be able to compile the whole test program)" >&4
20871         echo "(I'll try it in little pieces.)" >&4
20872         set signal -DJUST_NSIG
20873         if eval $compile_ok; then
20874                 $run ./signal$_exe > signal.nsg
20875                 $cat signal.nsg
20876         else
20877                 echo "I can't seem to figure out how many signals you have." >&4
20878                 echo "Guessing 50." >&4
20879                 echo 'NSIG 50' > signal.nsg
20880         fi
20881         : Now look at all the signal names, one at a time.
20882         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20883                 $cat > signal.c <<EOCP
20884 #include <sys/types.h>
20885 #include <signal.h>
20886 #include <stdio.h>
20887 int main() {
20888 printf("$xx %d\n", SIG${xx});
20889 return 0;
20890 }
20891 EOCP
20892                 set signal
20893                 if eval $compile; then
20894                         echo "SIG${xx} found."
20895                         $run ./signal$_exe  >> signal.ls1
20896                 else
20897                         echo "SIG${xx} NOT found."
20898                 fi
20899         done
20900         if $test -s signal.ls1; then
20901                 $cat signal.nsg signal.ls1 |
20902                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20903         fi
20904
20905 fi
20906 if $test -s signal.lst; then
20907         :
20908 else
20909         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20910         echo 'kill -l' >signal
20911         set X `csh -f <signal`
20912         $rm -f signal
20913         shift
20914         case $# in
20915         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20916         esac
20917         echo $@ | $tr ' ' $trnl | \
20918             $awk '{ printf "%s %d\n", $1, ++s; }
20919                   END { printf "NSIG %d\n", ++s }' >signal.lst
20920 fi
20921 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20922 EOS
20923 chmod a+x signal_cmd
20924 $eunicefix signal_cmd
20925
20926 : generate list of signal names
20927 echo " "
20928 case "$sig_name_init" in
20929 '') doinit=yes ;;
20930 *)  case "$sig_num_init" in
20931     ''|*,*) doinit=yes ;;
20932     esac ;;
20933 esac
20934 case "$doinit" in
20935 yes)
20936         echo "Generating a list of signal names and numbers..." >&4
20937         . ./signal_cmd
20938         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20939         sig_name=`$awk 'BEGIN { printf "ZERO " }
20940                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20941         sig_num=`$awk  'BEGIN { printf "0 " }
20942                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20943         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20944                              !/^NSIG/   { printf "\"%s\", ", $1 }
20945                              END        { printf "0\n" }' signal.lst`
20946         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20947                              !/^NSIG/   { printf "%d, ", $2}
20948                              END        { printf "0\n"}' signal.lst`
20949         ;;
20950 esac
20951 echo "The following $sig_count signals are available:"
20952 echo " "
20953 echo $sig_name | $awk \
20954 'BEGIN { linelen = 0 }
20955 {
20956         for (i = 1; i <= NF; i++) {
20957                 name = "SIG" $i " "
20958                 linelen = linelen + length(name)
20959                 if (linelen > 70) {
20960                         printf "\n"
20961                         linelen = length(name)
20962                 }
20963                 printf "%s", name
20964         }
20965         printf "\n"
20966 }'
20967 sig_size=`echo $sig_name | awk '{print NF}'`
20968 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20969
20970 : Check size of size
20971 echo " "
20972 case "$sizetype" in
20973 *_t) zzz="$sizetype"    ;;
20974 *)   zzz="filesize"     ;;
20975 esac
20976 echo "Checking the size of $zzz..." >&4
20977 cat > try.c <<EOCP
20978 #include <sys/types.h>
20979 #include <stdio.h>
20980 #$i_stdlib I_STDLIB
20981 #ifdef I_STDLIB
20982 #include <stdlib.h>
20983 #endif
20984 int main() {
20985     printf("%d\n", (int)sizeof($sizetype));
20986     exit(0);
20987 }
20988 EOCP
20989 set try
20990 if eval $compile_ok; then
20991         yyy=`$run ./try`
20992         case "$yyy" in
20993         '')     sizesize=4
20994                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20995                 ;;
20996         *)      sizesize=$yyy
20997                 echo "Your $zzz size is $sizesize bytes."
20998                 ;;
20999         esac
21000 else
21001         sizesize=4
21002         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21003 fi
21004
21005
21006 : check for socklen_t
21007 echo " "
21008 echo "Checking to see if you have socklen_t..." >&4
21009 $cat >try.c <<EOCP
21010 #include <sys/types.h>
21011 #$d_socket HAS_SOCKET
21012 #ifdef HAS_SOCKET
21013 #include <sys/socket.h>
21014 #endif
21015 int main() { socklen_t x = 16; }
21016 EOCP
21017 set try
21018 if eval $compile; then
21019         val="$define"
21020         echo "You have socklen_t."
21021 else
21022         val="$undef"
21023         echo "You do not have socklen_t."
21024         case "$sizetype" in
21025         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21026         esac
21027 fi
21028 $rm_try
21029 set d_socklen_t
21030 eval $setvar
21031
21032 : see if this is a socks.h system
21033 set socks.h i_socks
21034 eval $inhdr
21035
21036 : check for type of the size argument to socket calls
21037 case "$d_socket" in
21038 "$define")
21039         $cat <<EOM
21040
21041 Checking to see what type is the last argument of accept().
21042 EOM
21043         yyy=''
21044         case "$d_socklen_t" in
21045         "$define") yyy="$yyy socklen_t"
21046         esac
21047         yyy="$yyy $sizetype int long unsigned"
21048         for xxx in $yyy; do
21049                 case "$socksizetype" in
21050                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21051                         case "$usesocks" in
21052                         "$define")
21053                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21054                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21055                                         socksizetype="$xxx"
21056                                 fi
21057                                 ;;
21058                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21059                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21060                                         socksizetype="$xxx"
21061                                 fi
21062                                 ;;
21063                         esac
21064                         ;;
21065                 esac
21066         done
21067 : In case none of those worked, prompt the user.
21068         case "$socksizetype" in
21069         '')     rp='What is the type for socket address structure sizes?'
21070                 dflt='int'
21071                 . ./myread
21072                 socksizetype=$ans
21073                 ;;
21074         esac
21075         ;;
21076 *)      : no sockets, so pick relatively harmless default
21077         socksizetype='int'
21078         ;;
21079 esac
21080
21081 : see what type is used for signed size_t
21082 set ssize_t ssizetype int stdio.h sys/types.h
21083 eval $typedef
21084 dflt="$ssizetype"
21085 $cat > try.c <<EOM
21086 #include <stdio.h>
21087 #$i_stdlib I_STDLIB
21088 #ifdef I_STDLIB
21089 #include <stdlib.h>
21090 #endif
21091 #include <sys/types.h>
21092 #define Size_t $sizetype
21093 #define SSize_t $dflt
21094 int main()
21095 {
21096         if (sizeof(Size_t) == sizeof(SSize_t))
21097                 printf("$dflt\n");
21098         else if (sizeof(Size_t) == sizeof(int))
21099                 printf("int\n");
21100         else
21101                 printf("long\n");
21102         exit(0);
21103 }
21104 EOM
21105 echo " "
21106 set try
21107 if eval $compile_ok && $run ./try > /dev/null; then
21108         ssizetype=`$run ./try`
21109         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21110 else
21111         $cat >&4 <<EOM
21112 Help! I can't compile and run the ssize_t test program: please enlighten me!
21113 (This is probably a misconfiguration in your system or libraries, and
21114 you really ought to fix it.  Still, I'll try anyway.)
21115
21116 I need a type that is the same size as $sizetype, but is guaranteed to
21117 be signed.  Common values are ssize_t, int and long.
21118
21119 EOM
21120         rp="What signed type is the same size as $sizetype?"
21121         . ./myread
21122         ssizetype="$ans"
21123 fi
21124 $rm_try
21125
21126 : Check the size of st_ino
21127 $echo " "
21128 $echo "Checking the size of st_ino..." >&4
21129 $cat > try.c <<EOCP
21130 #include <sys/stat.h>
21131 #include <stdio.h>
21132 #$i_stdlib I_STDLIB
21133 #ifdef I_STDLIB
21134 #include <stdlib.h>
21135 #endif
21136 int main() {
21137     struct stat st;
21138     printf("%d\n", (int)sizeof(st.st_ino));
21139     exit(0);
21140 }
21141 EOCP
21142 set try
21143 if eval $compile_ok; then
21144         val=`$run ./try`
21145         case "$val" in
21146         '')     st_ino_size=4
21147                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21148                 ;;
21149         *)      st_ino_size=$val
21150                 $echo "Your st_ino is $st_ino_size bytes long."
21151                 ;;
21152         esac
21153 else
21154         st_ino_size=4
21155         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21156 fi
21157 $rm_try
21158
21159 : Check if st_ino is signed
21160 $echo " "
21161 $echo "Checking the sign of st_ino..." >&4
21162 $cat > try.c <<EOCP
21163 #include <sys/stat.h>
21164 #include <stdio.h>
21165 int main() {
21166         struct stat foo;
21167         foo.st_ino = -1;
21168         if (foo.st_ino < 0)
21169                 printf("-1\n");
21170         else
21171                 printf("1\n");
21172 }
21173 EOCP
21174 set try
21175 if eval $compile; then
21176         val=`$run ./try`
21177         case "$val" in
21178         '')     st_ino_sign=1
21179                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21180                 ;;
21181         *)      st_ino_sign=$val
21182                 case "$st_ino_sign" in
21183                  1) $echo "Your st_ino is unsigned." ;;
21184                 -1) $echo "Your st_ino is signed."   ;;
21185                 esac
21186                 ;;
21187         esac
21188 else
21189         st_ino_sign=1
21190         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21191 fi
21192 $rm_try
21193
21194 : see what type of char stdio uses.
21195 echo " "
21196 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21197 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21198         echo "Your stdio uses unsigned chars." >&4
21199         stdchar="unsigned char"
21200 else
21201         echo "Your stdio uses signed chars." >&4
21202         stdchar="char"
21203 fi
21204 $rm -f stdioh
21205
21206 : see what type uids are declared as in the kernel
21207 echo " "
21208 echo "Looking for the type for user ids returned by getuid()."
21209 set uid_t uidtype xxx stdio.h sys/types.h
21210 eval $typedef
21211 case "$uidtype" in
21212 xxx)
21213         xxx=`./findhdr sys/user.h`
21214         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21215         case $1 in
21216         unsigned) dflt="$1 $2" ;;
21217         *) dflt="$1" ;;
21218         esac
21219         ;;
21220 *) dflt="$uidtype";;
21221 esac
21222 case "$uidtype" in
21223 uid_t)  echo "uid_t found." ;;
21224 *)      rp="What is the type for user ids returned by getuid()?"
21225         . ./myread
21226         uidtype="$ans"
21227         ;;
21228 esac
21229
21230 : Check size of UID
21231 echo " "
21232 case "$uidtype" in
21233 *_t) zzz="$uidtype"     ;;
21234 *)   zzz="uid"          ;;
21235 esac
21236 echo "Checking the size of $zzz..." >&4
21237 cat > try.c <<EOCP
21238 #include <sys/types.h>
21239 #include <stdio.h>
21240 #$i_stdlib I_STDLIB
21241 #ifdef I_STDLIB
21242 #include <stdlib.h>
21243 #endif
21244 int main() {
21245     printf("%d\n", (int)sizeof($uidtype));
21246     exit(0);
21247 }
21248 EOCP
21249 set try
21250 if eval $compile_ok; then
21251         yyy=`$run ./try`
21252         case "$yyy" in
21253         '')     uidsize=4
21254                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21255                 ;;
21256         *)      uidsize=$yyy
21257                 echo "Your $zzz is $uidsize bytes long."
21258                 ;;
21259         esac
21260 else
21261         uidsize=4
21262         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21263 fi
21264
21265 : Check if UID is signed
21266 echo " "
21267 case "$uidtype" in
21268 *_t) zzz="$uidtype"     ;;
21269 *)   zzz="uid"          ;;
21270 esac
21271 echo "Checking the sign of $zzz..." >&4
21272 cat > try.c <<EOCP
21273 #include <sys/types.h>
21274 #include <stdio.h>
21275 int main() {
21276         $uidtype foo = -1;
21277         if (foo < 0)
21278                 printf("-1\n");
21279         else
21280                 printf("1\n");
21281 }
21282 EOCP
21283 set try
21284 if eval $compile; then
21285         yyy=`$run ./try`
21286         case "$yyy" in
21287         '')     uidsign=1
21288                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21289                 ;;
21290         *)      uidsign=$yyy
21291                 case "$uidsign" in
21292                  1) echo "Your $zzz is unsigned." ;;
21293                 -1) echo "Your $zzz is signed."   ;;
21294                 esac
21295                 ;;
21296         esac
21297 else
21298         uidsign=1
21299         echo "(I can't compile the test program--guessing unsigned.)" >&4
21300 fi
21301
21302
21303 : Check format string for UID
21304 echo " "
21305 $echo "Checking the format string to be used for uids..." >&4
21306
21307 case "$uidsign" in
21308 -1)     if $test X"$uidsize" = X"$ivsize"; then
21309                 uidformat="$ivdformat"
21310         else
21311                 if $test X"$uidsize" = X"$longsize"; then
21312                         uidformat='"ld"'
21313                 else
21314                         if $test X"$uidsize" = X"$intsize"; then
21315                                 uidformat='"d"'
21316                         else
21317                                 if $test X"$uidsize" = X"$shortsize"; then
21318                                         uidformat='"hd"'
21319                                 fi
21320                         fi
21321                 fi
21322         fi
21323         ;;
21324 *)      if $test X"$uidsize" = X"$uvsize"; then
21325                 uidformat="$uvuformat"
21326         else
21327                 if $test X"$uidsize" = X"$longsize"; then
21328                         uidformat='"lu"'
21329                 else
21330                         if $test X"$uidsize" = X"$intsize"; then
21331                                 uidformat='"u"'
21332                         else
21333                                 if $test X"$uidsize" = X"$shortsize"; then
21334                                         uidformat='"hu"'
21335                                 fi
21336                         fi
21337                 fi
21338         fi
21339         ;;
21340 esac
21341
21342 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21343 echo " "
21344 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21345 $cat >try.c <<'EOM'
21346 /* Intentionally a long probe as I'd like to sanity check that the exact
21347    approach is going to work, as thinking it will work, but only having it
21348    part working at runtime is worse than not having it.  */
21349
21350 #include <sys/types.h>
21351 #include <sys/sysctl.h>
21352 #include <sys/param.h>
21353 #include <stdio.h>
21354 #include <string.h>
21355 #include <stdlib.h>
21356 #include <unistd.h>
21357
21358 int
21359 main(int argc, char **argv) {
21360     char *buffer;
21361     char *argv_leaf = strrchr(argv[0], '/');
21362     char *buffer_leaf;
21363     size_t size = 0;
21364     int mib[4];
21365
21366     mib[0] = CTL_KERN;
21367     mib[1] = KERN_PROC;
21368     mib[2] = KERN_PROC_PATHNAME;
21369     mib[3] = -1;
21370
21371     if (!argv_leaf) {
21372         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21373         return 1;
21374     }
21375
21376     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21377         perror("sysctl");
21378         return 2;
21379     }
21380
21381     if (size < strlen(argv_leaf) + 1) {
21382         fprintf(stderr, "size %lu is too short for a path\n",
21383                 (unsigned long) size);
21384         return 3;
21385     }
21386
21387     if (size > MAXPATHLEN * MAXPATHLEN) {
21388         fprintf(stderr, "size %lu is too long for a path\n",
21389                 (unsigned long) size);
21390         return 4;
21391     }
21392
21393     buffer = malloc(size);
21394     if (!buffer) {
21395         perror("malloc");
21396         return 5;
21397     }
21398
21399     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21400         perror("sysctl");
21401         return 6;
21402     }
21403
21404     if (strlen(buffer) + 1 != size) {
21405         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21406                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21407         return 7;
21408     }
21409
21410
21411     if (*buffer != '/') {
21412         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21413         return 8;
21414     }
21415
21416     if (strstr(buffer, "/./")) {
21417         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21418         return 9;
21419     }
21420
21421     if (strstr(buffer, "/../")) {
21422         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21423         return 10;
21424     }
21425
21426     buffer_leaf = strrchr(buffer, '/');
21427     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21428         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21429         return 11;
21430     }
21431
21432     free(buffer);
21433
21434     return 0;
21435 }
21436 EOM
21437
21438 val=$undef
21439 set try
21440 if eval $compile_ok; then
21441         if $run ./try; then
21442                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21443                 val="$define"
21444         else
21445                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21446                 val="$undef"
21447         fi
21448 else
21449         echo "I'm unable to compile the test program." >&4
21450         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21451         val="$undef"
21452 fi
21453 $rm_try
21454 set usekernprocpathname
21455 eval $setvar
21456
21457 : Determine if we can use _NSGetExecutablePath to find executing program
21458 echo " "
21459 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21460 $cat >try.c <<'EOM'
21461 /* Intentionally a long probe as I'd like to sanity check that the exact
21462    approach is going to work, as thinking it will work, but only having it
21463    part working at runtime is worse than not having it.  */
21464 #include <mach-o/dyld.h>
21465 #include <stdio.h>
21466 #include <stdlib.h>
21467 #include <sys/param.h>
21468 #include <string.h>
21469
21470 int
21471 main(int argc, char **argv) {
21472     char buf[1];
21473     uint32_t size = sizeof(buf);
21474     int result;
21475     char *buffer;
21476     char *tidied;
21477     char *argv_leaf = strrchr(argv[0], '/');
21478     char *tidied_leaf;
21479
21480     if (!argv_leaf) {
21481         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21482         return 1;
21483     }
21484
21485     _NSGetExecutablePath(buf, &size);
21486     if (size > MAXPATHLEN * MAXPATHLEN) {
21487         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21488                 (unsigned int) size);
21489         return 2;
21490     }
21491
21492     buffer = malloc(size);
21493     if (!buffer) {
21494         perror("malloc");
21495         return 3;
21496     }
21497
21498     result = _NSGetExecutablePath(buffer, &size);
21499     if (result != 0) {
21500         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21501                 result, (unsigned int) size);
21502         return 4;
21503     }
21504
21505     tidied = realpath(buffer, NULL);
21506     if (!tidied) {
21507         perror("realpath");
21508         return 5;
21509     }
21510
21511     free(buffer);
21512
21513     if (*tidied != '/') {
21514         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21515         return 6;
21516     }
21517
21518     if (strstr(tidied, "/./")) {
21519         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21520         return 7;
21521     }
21522
21523     if (strstr(tidied, "/../")) {
21524         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21525         return 8;
21526     }
21527
21528     tidied_leaf = strrchr(tidied, '/');
21529     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21530         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21531         return 9;
21532     }
21533
21534     free(tidied);
21535
21536     return 0;
21537 }
21538 EOM
21539
21540 val=$undef
21541 set try
21542 if eval $compile_ok; then
21543         if $run ./try; then
21544                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21545                 val="$define"
21546         else
21547                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21548         fi
21549 else
21550         echo "I'm unable to compile the test program." >&4
21551         echo "I'll assume no _NSGetExecutablePath here." >&4
21552 fi
21553 $rm_try
21554 set usensgetexecutablepath
21555 eval $setvar
21556
21557 : Check if site customization support was requested
21558 case "$usesitecustomize" in
21559     $define|true|[Yy]*)
21560         usesitecustomize="$define"
21561         ;;
21562     *)
21563         usesitecustomize="$undef"
21564         ;;
21565     esac
21566
21567 : see if prototypes support variable argument declarations
21568 echo " "
21569 case "$prototype$i_stdarg" in
21570 $define$define)
21571         echo "It appears we'll be able to prototype varargs functions." >&4
21572         val="$define"
21573         ;;
21574 *)
21575         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21576         val="$undef"
21577         ;;
21578 esac
21579 set vaproto
21580 eval $setvar
21581
21582 : determine compiler compiler
21583 case "$yacc" in
21584 '')
21585         dflt=yacc;;
21586 *)
21587         dflt="$yacc";;
21588 esac
21589 echo " "
21590 comp='yacc'
21591 if $test -f "$byacc$_exe"; then
21592         dflt="$byacc"
21593         comp="byacc or $comp"
21594 fi
21595 if $test -f "$bison$_exe"; then
21596         comp="$comp or bison -y"
21597 fi
21598 rp="Which compiler compiler ($comp) shall I use?"
21599 . ./myread
21600 yacc="$ans"
21601 case "$yacc" in
21602 *bis*)
21603         case "$yacc" in
21604         *-y*) ;;
21605         *)
21606                 yacc="$yacc -y"
21607                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21608                 ;;
21609         esac
21610         ;;
21611 esac
21612
21613 : see if this is a assert.h system
21614 set assert.h i_assert
21615 eval $inhdr
21616
21617 : see if this is a fp.h system
21618 set fp.h i_fp
21619 eval $inhdr
21620
21621 : see if this is a fp_class.h system
21622 set fp_class.h i_fp_class
21623 eval $inhdr
21624
21625 : see if gdbm.h is available
21626 set gdbm.h t_gdbm
21627 eval $inhdr
21628 case "$t_gdbm" in
21629 $define)
21630         : see if gdbm_open exists
21631         set gdbm_open d_gdbm_open
21632         eval $inlibc
21633         case "$d_gdbm_open" in
21634         $undef)
21635                 t_gdbm="$undef"
21636                 echo "We won't be including <gdbm.h>"
21637                 ;;
21638         esac
21639         ;;
21640 esac
21641 val="$t_gdbm"
21642 set i_gdbm
21643 eval $setvar
21644
21645 : see if this is a ieeefp.h system
21646 case "$i_ieeefp" in
21647 '' ) set ieeefp.h i_ieeefp
21648      eval $inhdr
21649      ;;
21650 esac
21651
21652 : see if this is a libutil.h system
21653 set libutil.h i_libutil
21654 eval $inhdr
21655
21656 : see if mach cthreads are available
21657 if test "X$usethreads" = "X$define"; then
21658         set mach/cthreads.h i_machcthr
21659         eval $inhdr
21660 else
21661         i_machcthr="$undef"
21662 fi
21663
21664 : see if this is a mntent.h system
21665 set mntent.h i_mntent
21666 eval $inhdr
21667
21668 : see if net/errno.h is available
21669 val=''
21670 set net/errno.h val
21671 eval $inhdr
21672
21673 : Unfortunately, it causes problems on some systems.  Arrgh.
21674 case "$val" in
21675 $define)
21676         cat > try.c <<'EOM'
21677 #include <stdio.h>
21678 #include <errno.h>
21679 #include <net/errno.h>
21680 int func()
21681 {
21682         return ENOTSOCK;
21683 }
21684 EOM
21685         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21686                 echo "We'll be including <net/errno.h>." >&4
21687         else
21688                 echo "We won't be including <net/errno.h>." >&4
21689                 val="$undef"
21690         fi
21691         $rm_try
21692         ;;
21693 esac
21694 set i_neterrno
21695 eval $setvar
21696
21697 : see if netinet/tcp.h is available
21698 set netinet/tcp.h i_netinettcp
21699 eval $inhdr
21700
21701 : see if this is a poll.h system
21702 set poll.h i_poll
21703 eval $inhdr
21704
21705 : see if this is a prot.h system
21706 set prot.h i_prot
21707 eval $inhdr
21708
21709 : Preprocessor symbols
21710 echo " "
21711 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21712 $cat <<'EOSH' > Cppsym.know
21713 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21714 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21715 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21716 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21717 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21718 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21719 bull c cadmus clipper CMU COFF COMPILER_VERSION
21720 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21721 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21722 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21723 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21724 GLIBC GLIBC_MINOR
21725 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21726 H3050R H3050RX hbullx20 hcx host_mips
21727 hp200 hp300 hp700 HP700 hp800 hp9000
21728 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21729 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21730 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21731 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21732 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21733 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21734 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21735 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21736 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21737 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21738 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21739 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21740 MATH_HAS_NO_SIDE_EFFECTS
21741 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21742 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21743 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21744 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21745 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21746 NetBSD news1500 news1700 news1800 news1900 news3700
21747 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21748 ns32016 ns32332 ns32k nsc32000
21749 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21750 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21751 pc532 pdp11 PGC PIC plexus PORTAR posix
21752 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21753 POSIX_C_SOURCE POSIX_SOURCE POWER
21754 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21755 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21756 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21757 sony sony_news sonyrisc sparc sparclite spectrum
21758 stardent stdc STDC_EXT stratos sun sun3 sun386
21759 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21760 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21761 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21762 sysV68 sysV88 Tek4132 Tek4300 titan
21763 TM3200 TM5400 TM5600
21764 tower tower32 tower32_200 tower32_600 tower32_700
21765 tower32_800 tower32_850 tss
21766 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21767 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21768 unix UNIX95 UNIX99 unixpc unos
21769 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21770 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21771 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21772 USGr4 USGr4_2
21773 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21774 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21775 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21776 z8000
21777 EOSH
21778 # Maybe put other stuff here too.
21779 cat <<EOSH >>Cppsym.know
21780 $osname
21781 EOSH
21782 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21783 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21784 $cat Cppsym.know > Cppsym.c
21785 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21786 $rm -f Cppsym.a Cppsym.b Cppsym.c
21787 cat <<EOSH > Cppsym
21788 $startsh
21789 if $test \$# -gt 0; then
21790     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21791     if $test -s Cppsym.got; then
21792         $rm -f Cppsym.got
21793         exit 0
21794     fi
21795     $rm -f Cppsym.got
21796     exit 1
21797 else
21798     $tr " " "$trnl" | ./Cppsym.try
21799     exit 0
21800 fi
21801 EOSH
21802 chmod +x Cppsym
21803 $eunicefix Cppsym
21804 cat <<EOSH > Cppsym.try
21805 $startsh
21806 cat <<'EOCP' > try.c
21807 #include <stdio.h>
21808 #if cpp_stuff == 1
21809 #define STRINGIFY(a)    "a"
21810 #endif
21811 #if cpp_stuff == 42
21812 #define StGiFy(a)  #a
21813 #define STRINGIFY(a)    StGiFy(a)
21814 #endif
21815 #if $cpp_stuff != 1 && $cpp_stuff != 42
21816 #   include "Bletch: How does this C preprocessor stringify macros?"
21817 #endif
21818 int main() {
21819 EOCP
21820 $awk \\
21821 EOSH
21822 cat <<'EOSH' >> Cppsym.try
21823 'length($1) > 0 {
21824     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21825     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21826     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21827     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21828 }'       >> try.c
21829 echo 'return 0;}' >> try.c
21830 EOSH
21831 cat <<EOSH >> Cppsym.try
21832 ccflags="$ccflags"
21833 case "$osname-$gccversion" in
21834 irix-) ccflags="\$ccflags -woff 1178" ;;
21835 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21836 esac
21837 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21838 EOSH
21839 chmod +x Cppsym.try
21840 $eunicefix Cppsym.try
21841 ./Cppsym < Cppsym.know > Cppsym.true
21842 : Add in any linux cpp "predefined macros":
21843 case "$osname::$gccversion" in
21844   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21845     tHdrH=_tmpHdr
21846     rm -f $tHdrH'.h' $tHdrH
21847     touch $tHdrH'.h'
21848     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21849        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21850        if [ -s $tHdrH'_cppsym.real' ]; then
21851           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21852        fi
21853     fi
21854     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21855   ;;
21856 esac
21857 : now check the C compiler for additional symbols
21858 postprocess_cc_v=''
21859 case "$osname" in
21860 aix) postprocess_cc_v="|$tr , ' '" ;;
21861 esac
21862 $cat >ccsym <<EOS
21863 $startsh
21864 $cat >tmp.c <<EOF
21865 extern int foo;
21866 EOF
21867 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21868 do
21869         case "\$i" in
21870         -D*) echo "\$i" | $sed 's/^-D//';;
21871         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21872         esac
21873 done
21874 $rm_try
21875 EOS
21876 postprocess_cc_v=''
21877 chmod +x ccsym
21878 $eunicefix ccsym
21879 ./ccsym > ccsym1.raw
21880 if $test -s ccsym1.raw; then
21881        $sort ccsym1.raw | $uniq >ccsym.raw
21882 else
21883        mv ccsym1.raw ccsym.raw
21884 fi
21885
21886 $awk '/\=/ { print $0; next }
21887         { print $0"=1" }' ccsym.raw >ccsym.list
21888 $comm -13 Cppsym.true ccsym.list >ccsym.own
21889 $comm -12 Cppsym.true ccsym.list >ccsym.com
21890 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21891 also=''
21892 if $test -z ccsym.raw; then
21893         echo "Your C compiler doesn't seem to define any symbols!" >&4
21894         echo " "
21895         echo "However, your C preprocessor defines the following symbols:"
21896         $cat Cppsym.true
21897         ccsymbols=''
21898         cppsymbols=`$cat Cppsym.true`
21899         cppsymbols=`echo $cppsymbols`
21900         cppccsymbols="$cppsymbols"
21901 else
21902         if $test -s ccsym.com; then
21903                 echo "Your C compiler and pre-processor define these symbols:"
21904                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21905                 also='also '
21906                 symbols='ones'
21907                 cppccsymbols=`$cat ccsym.com`
21908                 cppccsymbols=`echo $cppccsymbols`
21909                 $test "$silent" || sleep 1
21910         fi
21911         if $test -s ccsym.cpp; then
21912                 $test "$also" && echo " "
21913                 echo "Your C pre-processor ${also}defines the following symbols:"
21914                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21915                 also='further '
21916                 cppsymbols=`$cat ccsym.cpp`
21917                 cppsymbols=`echo $cppsymbols`
21918                 $test "$silent" || sleep 1
21919         fi
21920         if $test -s ccsym.own; then
21921                 $test "$also" && echo " "
21922                 echo "Your C compiler ${also}defines the following cpp symbols:"
21923                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21924                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21925                 ccsymbols=`$cat ccsym.own`
21926                 ccsymbols=`echo $ccsymbols`
21927                 $test "$silent" || sleep 1
21928         fi
21929 fi
21930
21931 : see if this is a termio system
21932 val="$undef"
21933 val2="$undef"
21934 val3="$undef"
21935 if $test `./findhdr termios.h`; then
21936         set tcsetattr i_termios
21937         eval $inlibc
21938         val3="$i_termios"
21939 fi
21940 echo " "
21941 case "$val3" in
21942 "$define") echo "You have POSIX termios.h... good!" >&4;;
21943 *) if ./Cppsym pyr; then
21944                 case "`/bin/universe`" in
21945                 ucb) if $test `./findhdr sgtty.h`; then
21946                                 val2="$define"
21947                                 echo "<sgtty.h> found." >&4
21948                         else
21949                                 echo "System is pyramid with BSD universe."
21950                                 ./warn "<sgtty.h> not found--you could have problems."
21951                         fi;;
21952                 *) if $test `./findhdr termio.h`; then
21953                                 val="$define"
21954                                 echo "<termio.h> found." >&4
21955                         else
21956                                 echo "System is pyramid with USG universe."
21957                                 ./warn "<termio.h> not found--you could have problems."
21958                         fi;;
21959                 esac
21960         elif ./usg; then
21961                 if $test `./findhdr termio.h`; then
21962                         echo "<termio.h> found." >&4
21963                         val="$define"
21964                 elif $test `./findhdr sgtty.h`; then
21965                         echo "<sgtty.h> found." >&4
21966                         val2="$define"
21967                 else
21968                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21969                 fi
21970         else
21971                 if $test `./findhdr sgtty.h`; then
21972                         echo "<sgtty.h> found." >&4
21973                         val2="$define"
21974                 elif $test `./findhdr termio.h`; then
21975                         echo "<termio.h> found." >&4
21976                         val="$define"
21977                 else
21978                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21979                 fi
21980         fi;;
21981 esac
21982 set i_termio; eval $setvar
21983 val=$val2; set i_sgtty; eval $setvar
21984 val=$val3; set i_termios; eval $setvar
21985
21986 : see if stdbool is available
21987 : we want a real compile instead of Inhdr because some Solaris systems
21988 : have stdbool.h, but it can only be used if the compiler indicates it
21989 : is sufficiently c99-compliant.
21990 echo " "
21991 $cat >try.c <<EOCP
21992 #include <stdio.h>
21993 #include <stdbool.h>
21994 int func(bool x)
21995 {
21996     return x ? 1 : 0;
21997 }
21998 int main(int argc, char **argv)
21999 {
22000     return func(0);
22001 }
22002 EOCP
22003 set try
22004 if eval $compile; then
22005         echo "<stdbool.h> found." >&4
22006         val="$define"
22007 else
22008         echo "<stdbool.h> NOT found." >&4
22009         val="$undef"
22010 fi
22011 $rm_try
22012 set i_stdbool
22013 eval $setvar
22014
22015 : see if stddef is available
22016 set stddef.h i_stddef
22017 eval $inhdr
22018
22019 : see if sys/access.h is available
22020 set sys/access.h i_sysaccess
22021 eval $inhdr
22022
22023 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22024 set sys/filio.h i_sysfilio
22025 eval $inhdr
22026 echo " "
22027 if $test `./findhdr sys/ioctl.h`; then
22028         val="$define"
22029         echo '<sys/ioctl.h> found.' >&4
22030 else
22031         val="$undef"
22032         if $test $i_sysfilio = "$define"; then
22033             echo '<sys/ioctl.h> NOT found.' >&4
22034         else
22035                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22036                 $test $i_termio = "$define" && xxx="termio.h"
22037                 $test $i_termios = "$define" && xxx="termios.h"
22038 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22039         fi
22040 fi
22041 set i_sysioctl
22042 eval $setvar
22043
22044 : see if socket ioctl defs are in sys/sockio.h
22045 echo " "
22046 xxx=`./findhdr sys/sockio.h`
22047 if $test "$xxx"; then
22048         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22049                 val="$define"
22050                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22051         else
22052                 val="$undef"
22053                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22054         fi
22055 else
22056         val="$undef"
22057         $cat <<EOM
22058 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22059 EOM
22060 fi
22061 set i_syssockio
22062 eval $setvar
22063
22064 : see if this is a syslog.h system
22065 set syslog.h i_syslog
22066 eval $inhdr
22067
22068 : see if this is a sys/mode.h system
22069 set sys/mode.h i_sysmode
22070 eval $inhdr
22071
22072 : see if there is a sys/poll.h file
22073 set sys/poll.h i_syspoll
22074 eval $inhdr
22075
22076 : see if sys/resource.h has to be included
22077 set sys/resource.h i_sysresrc
22078 eval $inhdr
22079
22080 : see if sys/security.h is available
22081 set sys/security.h i_syssecrt
22082 eval $inhdr
22083
22084 : see if this is a sys/statvfs.h system
22085 set sys/statvfs.h i_sysstatvfs
22086 eval $inhdr
22087
22088 : see if this is a sys/un.h system
22089 set sys/un.h i_sysun
22090 eval $inhdr
22091
22092 : see if this is a sys/utsname.h system
22093 set sys/utsname.h i_sysutsname
22094 eval $inhdr
22095
22096 : see if this is a syswait system
22097 set sys/wait.h i_syswait
22098 eval $inhdr
22099
22100 : see if this is a ustat.h system
22101 set ustat.h i_ustat
22102 eval $inhdr
22103
22104 : see if this is an utime system
22105 set utime.h i_utime
22106 eval $inhdr
22107
22108 : see if this is a vfork system
22109 case "$d_vfork" in
22110 "$define")
22111         set vfork.h i_vfork
22112         eval $inhdr
22113         ;;
22114 *)
22115         i_vfork="$undef"
22116         ;;
22117 esac
22118
22119 : Check extensions
22120 echo " "
22121 echo "Looking for extensions..." >&4
22122 : If we are using the old config.sh, known_extensions may contain
22123 : old or inaccurate or duplicate values.
22124 known_extensions=''
22125 nonxs_extensions=''
22126 : We do not use find because it might not be available.
22127 : We do not just use MANIFEST because the user may have dropped
22128 : some additional extensions into the source tree and expect them
22129 : to be built.
22130
22131 : Function to recursively find available extensions, ignoring DynaLoader
22132 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22133 : In 5.10.1 and later, extensions are stored in directories
22134 : like File-Glob instead of the older File/Glob/.
22135 find_extensions='
22136     for xxx in *; do
22137         case "$xxx" in
22138             DynaLoader|dynaload) ;;
22139             *)
22140             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22141             leaf=`echo $xxx | $sed -e s/.*-//`;
22142             if $test -d File; then
22143                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22144                     known_extensions="$known_extensions $1$this_ext";
22145                 elif $test -f $xxx/Makefile.PL; then
22146                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22147                 else
22148                     if $test -d $xxx -a $# -lt 10; then
22149                         set $1$xxx/ $*;
22150                         cd "$xxx";
22151                         eval $find_extensions;
22152                         cd ..;
22153                         shift;
22154                     fi;
22155                 fi;
22156             else
22157                 $ls -1 $xxx > $$.tmp;
22158                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22159                     known_extensions="$known_extensions $this_ext";
22160                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22161                     known_extensions="$known_extensions $this_ext";
22162                 elif $test -d $xxx; then
22163                     nonxs_extensions="$nonxs_extensions $this_ext";
22164                 fi;
22165                 $rm -f $$.tmp;
22166             fi
22167             ;;
22168         esac;
22169     done'
22170 tdir=`pwd`
22171 cd "$rsrc/cpan"
22172 set X
22173 shift
22174 eval $find_extensions
22175 cd "$rsrc/dist"
22176 set X
22177 shift
22178 eval $find_extensions
22179 cd "$rsrc/ext"
22180 set X
22181 shift
22182 eval $find_extensions
22183 if $test -d File-Glob; then
22184     : All ext/ flattened
22185 else
22186     # Special case:  Add in modules that nest beyond the first level.
22187     # Currently threads/shared and Hash/Util/FieldHash, since they are
22188     # not picked up by the recursive find above (and adding in general
22189     # recursive finding breaks SDBM_File/sdbm).
22190     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22191     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22192 fi
22193 set X $known_extensions
22194 shift
22195 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22196 set X $nonxs_extensions
22197 shift
22198 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22199 cd "$tdir"
22200
22201 : Now see which are supported on this system.
22202 avail_ext=''
22203 for xxx in $known_extensions ; do
22204         case "$xxx" in
22205         DB_File|db_file)
22206                 case "$i_db" in
22207                 $define) avail_ext="$avail_ext $xxx" ;;
22208                 esac
22209                 ;;
22210         GDBM_File|gdbm_fil)
22211                 case "$i_gdbm" in
22212                 $define) avail_ext="$avail_ext $xxx" ;;
22213                 esac
22214                 ;;
22215         I18N/Langinfo|i18n_lan)
22216                 case "$i_langinfo$d_nl_langinfo" in
22217                 $define$define) avail_ext="$avail_ext $xxx" ;;
22218                 esac
22219                 ;;
22220         IPC/SysV|ipc/sysv)
22221                 : XXX Do we need a useipcsysv variable here
22222                 case "${d_msg}${d_sem}${d_shm}" in
22223                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22224                 esac
22225                 ;;
22226         NDBM_File|ndbm_fil)
22227                 case "$d_ndbm" in
22228                 $define)
22229                     case "$osname-$use64bitint" in
22230                     hpux-define)
22231                         case "$libs" in
22232                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22233                         esac
22234                         ;;
22235                     *) avail_ext="$avail_ext $xxx" ;;
22236                     esac
22237                     ;;
22238                 esac
22239                 ;;
22240         ODBM_File|odbm_fil)
22241                 case "${i_dbm}${i_rpcsvcdbm}" in
22242                 *"${define}"*)
22243                     case "$d_cplusplus" in
22244                     define) ;; # delete as a function name will not work
22245                     *)  case "$osname-$use64bitint" in
22246                         hpux-define)
22247                             case "$libs" in
22248                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22249                             esac
22250                             ;;
22251                         *) avail_ext="$avail_ext $xxx" ;;
22252                         esac
22253                         ;;
22254                     esac
22255                     ;;
22256                 esac
22257                 ;;
22258         Opcode|opcode)
22259                 case "$useopcode" in
22260                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22261                 esac
22262                 ;;
22263         POSIX|posix)
22264                 case "$useposix" in
22265                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22266                 esac
22267                 ;;
22268         Socket|socket)
22269                 case "$d_socket" in
22270                 true|$define|y)
22271                     case "$osname" in
22272                     beos) ;; # not unless BONE
22273                     *) avail_ext="$avail_ext $xxx" ;;
22274                     esac
22275                     ;;
22276                 esac
22277                 ;;
22278         Sys/Syslog|sys/syslog)
22279                 : XXX syslog requires socket
22280                 case "$d_socket" in
22281                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22282                 esac
22283                 ;;
22284         Thread|thread)
22285                 case "$usethreads" in
22286                 true|$define|y)
22287                         case "$use5005threads" in
22288                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22289                         esac
22290                 esac
22291                 ;;
22292         threads|threads/shared)
22293                 # threads and threads::shared are special cases.
22294                 # To stop people from asking "Perl 5.8.0 was supposed
22295                 # to have this new fancy threads implementation but my
22296                 # perl doesn't have it" and from people trying to
22297                 # (re)install the threads module using CPAN.pm and
22298                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22299                 # the threads.pm and threads/shared.pm will always be
22300                 # there, croaking informatively ("you need to rebuild
22301                 # all of Perl with threads, sorry") when threads haven't
22302                 # been compiled in.
22303                 # --jhi
22304                 avail_ext="$avail_ext $xxx"
22305                 ;;
22306         VMS*)
22307                 ;;
22308         Win32*)
22309                 case "$osname" in
22310                 cygwin) avail_ext="$avail_ext $xxx" ;;
22311                 esac
22312                 ;;
22313         XS/APItest|xs/apitest)
22314                 # This is just for testing.  Skip it unless we have dynamic loading.
22315
22316                 case "$usedl" in
22317                 $define) avail_ext="$avail_ext $xxx" ;;
22318                 esac
22319                 ;;
22320         XS/Typemap|xs/typemap)
22321                 # This is just for testing.  Skip it unless we have dynamic loading.
22322                 case "$usedl" in
22323                 $define) avail_ext="$avail_ext $xxx" ;;
22324                 esac
22325                 ;;
22326         *)      avail_ext="$avail_ext $xxx"
22327                 ;;
22328         esac
22329 done
22330
22331 set X $avail_ext
22332 shift
22333 avail_ext="$*"
22334
22335 case "$onlyextensions" in
22336 '') ;;
22337 *)  keepextensions=''
22338     echo "You have requested that only certain extensions be included..." >&4
22339     for i in $onlyextensions; do
22340         case " $avail_ext " in
22341         *" $i "*)
22342             echo "Keeping extension $i."
22343             keepextensions="$keepextensions $i"
22344             ;;
22345         *) echo "Ignoring extension $i." ;;
22346         esac
22347     done
22348     avail_ext="$keepextensions"
22349     ;;
22350 esac
22351
22352 case "$noextensions" in
22353 '') ;;
22354 *)  keepextensions=''
22355     echo "You have requested that certain extensions be ignored..." >&4
22356     for i in $avail_ext; do
22357         case " $noextensions " in
22358         *" $i "*) echo "Ignoring extension $i." ;;
22359         *) echo "Keeping extension $i.";
22360            keepextensions="$keepextensions $i"
22361            ;;
22362         esac
22363     done
22364     avail_ext="$keepextensions"
22365     ;;
22366 esac
22367
22368 : Now see which nonxs extensions are supported on this system.
22369 : For now assume all are.
22370 nonxs_ext=''
22371 for xxx in $nonxs_extensions ; do
22372         case "$xxx" in
22373         *)      nonxs_ext="$nonxs_ext $xxx"
22374                 ;;
22375         esac
22376 done
22377
22378 set X $nonxs_ext
22379 shift
22380 nonxs_ext="$*"
22381
22382 case $usedl in
22383 $define)
22384         $cat <<EOM
22385 A number of extensions are supplied with $package.  You may choose to
22386 compile these extensions for dynamic loading (the default), compile
22387 them into the $package executable (static loading), or not include
22388 them at all.  Answer "none" to include no extensions.
22389 Note that DynaLoader is always built and need not be mentioned here.
22390
22391 EOM
22392         case "$dynamic_ext" in
22393         '')
22394                 : Exclude those listed in static_ext
22395                 dflt=''
22396                 for xxx in $avail_ext; do
22397                         case " $static_ext " in
22398                         *" $xxx "*) ;;
22399                         *) dflt="$dflt $xxx" ;;
22400                         esac
22401                 done
22402                 set X $dflt
22403                 shift
22404                 dflt="$*"
22405                 ;;
22406         *)      dflt="$dynamic_ext"
22407                 # Perhaps we are reusing an old out-of-date config.sh.
22408                 case "$hint" in
22409                 previous)
22410                         if test X"$dynamic_ext" != X"$avail_ext"; then
22411                                 $cat <<EOM
22412 NOTICE:  Your previous config.sh list may be incorrect.
22413 The extensions now available to you are
22414         ${avail_ext}
22415 but the default list from your previous config.sh is
22416         ${dynamic_ext}
22417
22418 EOM
22419                         fi
22420                         ;;
22421                 esac
22422                 ;;
22423         esac
22424         case "$dflt" in
22425         '')     dflt=none;;
22426         esac
22427         rp="What extensions do you wish to load dynamically?"
22428         . ./myread
22429         case "$ans" in
22430         none) dynamic_ext=' ' ;;
22431         *) dynamic_ext="$ans" ;;
22432         esac
22433
22434         case "$static_ext" in
22435         '')
22436                 : Exclude those already listed in dynamic linking
22437                 dflt=''
22438                 for xxx in $avail_ext; do
22439                         case " $dynamic_ext " in
22440                         *" $xxx "*) ;;
22441                         *) dflt="$dflt $xxx" ;;
22442                         esac
22443                 done
22444                 set X $dflt
22445                 shift
22446                 dflt="$*"
22447                 ;;
22448         *)  dflt="$static_ext"
22449                 ;;
22450         esac
22451
22452         case "$dflt" in
22453         '')     dflt=none;;
22454         esac
22455         rp="What extensions do you wish to load statically?"
22456         . ./myread
22457         case "$ans" in
22458         none) static_ext=' ' ;;
22459         *) static_ext="$ans" ;;
22460         esac
22461         ;;
22462 *)
22463         $cat <<EOM
22464 A number of extensions are supplied with $package.  Answer "none"
22465 to include no extensions.
22466 Note that DynaLoader is always built and need not be mentioned here.
22467
22468 EOM
22469         case "$static_ext" in
22470         '') dflt="$avail_ext" ;;
22471         *)      dflt="$static_ext"
22472                 # Perhaps we are reusing an old out-of-date config.sh.
22473                 case "$hint" in
22474                 previous)
22475                         if test X"$static_ext" != X"$avail_ext"; then
22476                                 $cat <<EOM
22477 NOTICE:  Your previous config.sh list may be incorrect.
22478 The extensions now available to you are
22479         ${avail_ext}
22480 but the default list from your previous config.sh is
22481         ${static_ext}
22482
22483 EOM
22484                         fi
22485                         ;;
22486                 esac
22487                 ;;
22488         esac
22489         : Exclude those that are not xs extensions
22490         case "$dflt" in
22491         '')     dflt=none;;
22492         esac
22493         rp="What extensions do you wish to include?"
22494         . ./myread
22495         case "$ans" in
22496         none) static_ext=' ' ;;
22497         *) static_ext="$ans" ;;
22498         esac
22499         ;;
22500 esac
22501 #
22502 # Encode is a special case.  If we are building Encode as a static
22503 # extension, we need to explicitly list its subextensions as well.
22504 # For other nested extensions, this is handled automatically by
22505 # the appropriate Makefile.PL.
22506 case " $static_ext " in
22507         *" Encode "*) # Add the subextensions of Encode
22508         cd "$rsrc/cpan"
22509         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22510                 static_ext="$static_ext Encode/$xxx"
22511         done
22512         cd "$tdir"
22513         ;;
22514 esac
22515
22516 set X $dynamic_ext $static_ext $nonxs_ext
22517 shift
22518 extensions="$*"
22519
22520 # Sanity check:  We require an extension suitable for use with
22521 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22522 # should show up as failures in the test suite, but it's helpful to
22523 # catch them now.) The 'extensions' list is normally sorted
22524 # alphabetically, so we need to accept either
22525 #    DB_File ... Fcntl ... IO  ....
22526 # or something like
22527 #    Fcntl ... NDBM_File ... IO  ....
22528 case " $extensions"  in
22529 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22530 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22531 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22532 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22533    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22534    ;;
22535 esac
22536
22537 : Remove libraries needed only for extensions
22538 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22539 : The exception is SunOS 4.x, which needs them.
22540 case "${osname}X${osvers}" in
22541 sunos*X4*)
22542     perllibs="$libs"
22543     ;;
22544 *) case "$usedl" in
22545     $define|true|[yY]*)
22546             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22547             shift
22548             perllibs="$*"
22549             ;;
22550     *)  perllibs="$libs"
22551             ;;
22552     esac
22553     ;;
22554 esac
22555
22556 : Remove build directory name from cppstdin so it can be used from
22557 : either the present location or the final installed location.
22558 echo " "
22559 : Get out of the UU directory to get correct path name.
22560 cd ..
22561 case "$cppstdin" in
22562 `pwd`/cppstdin)
22563         echo "Stripping down cppstdin path name"
22564         cppstdin=cppstdin
22565         ;;
22566 esac
22567 cd UU
22568
22569 : end of configuration questions
22570 echo " "
22571 echo "End of configuration questions."
22572 echo " "
22573
22574 : back to where it started
22575 if test -d ../UU; then
22576         cd ..
22577 fi
22578
22579 : configuration may be unconditionally patched via a 'config.arch' file
22580 if $test -f config.arch; then
22581         echo "I see a config.arch file, loading it." >&4
22582         . ./config.arch
22583 fi
22584
22585 : configuration may be patched via a 'config.over' file
22586 if $test -f config.over; then
22587         echo " "
22588         dflt=y
22589         rp='I see a config.over file.  Do you wish to load it?'
22590         . UU/myread
22591         case "$ans" in
22592         n*) echo "OK, I'll ignore it.";;
22593         *)      . ./config.over
22594                 echo "Configuration override changes have been loaded."
22595                 ;;
22596         esac
22597 fi
22598
22599 : in case they want portability, strip down executable paths
22600 case "$d_portable" in
22601 "$define")
22602         echo " "
22603         echo "Stripping down executable paths..." >&4
22604         for file in $loclist $trylist; do
22605                 eval temp=\$$file
22606                 eval $file=`basename $temp`
22607         done
22608         ;;
22609 esac
22610
22611 : create config.sh file
22612 echo " "
22613 echo "Creating config.sh..." >&4
22614 $spitshell <<EOT >config.sh
22615 $startsh
22616 #
22617 # This file was produced by running the Configure script. It holds all the
22618 # definitions figured out by Configure. Should you modify one of these values,
22619 # do not forget to propagate your changes by running "Configure -der". You may
22620 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22621 #
22622
22623 # Package name      : $package
22624 # Source directory  : $src
22625 # Configuration time: $cf_time
22626 # Configured by     : $cf_by
22627 # Target system     : $myuname
22628
22629 EOT
22630 : Add in command line options if available
22631 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22632
22633 $spitshell <<EOT >>config.sh
22634
22635 Author='$Author'
22636 Date='$Date'
22637 Header='$Header'
22638 Id='$Id'
22639 Locker='$Locker'
22640 Log='$Log'
22641 RCSfile='$RCSfile'
22642 Revision='$Revision'
22643 Source='$Source'
22644 State='$State'
22645 _a='$_a'
22646 _exe='$_exe'
22647 _o='$_o'
22648 afs='$afs'
22649 afsroot='$afsroot'
22650 alignbytes='$alignbytes'
22651 ansi2knr='$ansi2knr'
22652 aphostname='$aphostname'
22653 api_revision='$api_revision'
22654 api_subversion='$api_subversion'
22655 api_version='$api_version'
22656 api_versionstring='$api_versionstring'
22657 ar='$ar'
22658 archlib='$archlib'
22659 archlibexp='$archlibexp'
22660 archname64='$archname64'
22661 archname='$archname'
22662 archobjs='$archobjs'
22663 asctime_r_proto='$asctime_r_proto'
22664 awk='$awk'
22665 baserev='$baserev'
22666 bash='$bash'
22667 bin='$bin'
22668 bin_ELF='$bin_ELF'
22669 binexp='$binexp'
22670 bison='$bison'
22671 byacc='$byacc'
22672 byteorder='$byteorder'
22673 c='$c'
22674 castflags='$castflags'
22675 cat='$cat'
22676 cc='$cc'
22677 cccdlflags='$cccdlflags'
22678 ccdlflags='$ccdlflags'
22679 ccflags='$ccflags'
22680 ccflags_uselargefiles='$ccflags_uselargefiles'
22681 ccname='$ccname'
22682 ccsymbols='$ccsymbols'
22683 ccversion='$ccversion'
22684 cf_by='$cf_by'
22685 cf_email='$cf_email'
22686 cf_time='$cf_time'
22687 charbits='$charbits'
22688 charsize='$charsize'
22689 chgrp='$chgrp'
22690 chmod='$chmod'
22691 chown='$chown'
22692 clocktype='$clocktype'
22693 comm='$comm'
22694 compress='$compress'
22695 contains='$contains'
22696 cp='$cp'
22697 cpio='$cpio'
22698 cpp='$cpp'
22699 cpp_stuff='$cpp_stuff'
22700 cppccsymbols='$cppccsymbols'
22701 cppflags='$cppflags'
22702 cpplast='$cpplast'
22703 cppminus='$cppminus'
22704 cpprun='$cpprun'
22705 cppstdin='$cppstdin'
22706 cppsymbols='$cppsymbols'
22707 crypt_r_proto='$crypt_r_proto'
22708 cryptlib='$cryptlib'
22709 csh='$csh'
22710 ctermid_r_proto='$ctermid_r_proto'
22711 ctime_r_proto='$ctime_r_proto'
22712 d_Gconvert='$d_Gconvert'
22713 d_PRIEUldbl='$d_PRIEUldbl'
22714 d_PRIFUldbl='$d_PRIFUldbl'
22715 d_PRIGUldbl='$d_PRIGUldbl'
22716 d_PRIXU64='$d_PRIXU64'
22717 d_PRId64='$d_PRId64'
22718 d_PRIeldbl='$d_PRIeldbl'
22719 d_PRIfldbl='$d_PRIfldbl'
22720 d_PRIgldbl='$d_PRIgldbl'
22721 d_PRIi64='$d_PRIi64'
22722 d_PRIo64='$d_PRIo64'
22723 d_PRIu64='$d_PRIu64'
22724 d_PRIx64='$d_PRIx64'
22725 d_SCNfldbl='$d_SCNfldbl'
22726 d__fwalk='$d__fwalk'
22727 d_access='$d_access'
22728 d_accessx='$d_accessx'
22729 d_aintl='$d_aintl'
22730 d_alarm='$d_alarm'
22731 d_archlib='$d_archlib'
22732 d_asctime64='$d_asctime64'
22733 d_asctime_r='$d_asctime_r'
22734 d_atolf='$d_atolf'
22735 d_atoll='$d_atoll'
22736 d_attribute_deprecated='$d_attribute_deprecated'
22737 d_attribute_format='$d_attribute_format'
22738 d_attribute_malloc='$d_attribute_malloc'
22739 d_attribute_nonnull='$d_attribute_nonnull'
22740 d_attribute_noreturn='$d_attribute_noreturn'
22741 d_attribute_pure='$d_attribute_pure'
22742 d_attribute_unused='$d_attribute_unused'
22743 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22744 d_bcmp='$d_bcmp'
22745 d_bcopy='$d_bcopy'
22746 d_bsd='$d_bsd'
22747 d_bsdgetpgrp='$d_bsdgetpgrp'
22748 d_bsdsetpgrp='$d_bsdsetpgrp'
22749 d_builtin_choose_expr='$d_builtin_choose_expr'
22750 d_builtin_expect='$d_builtin_expect'
22751 d_bzero='$d_bzero'
22752 d_c99_variadic_macros='$d_c99_variadic_macros'
22753 d_casti32='$d_casti32'
22754 d_castneg='$d_castneg'
22755 d_charvspr='$d_charvspr'
22756 d_chown='$d_chown'
22757 d_chroot='$d_chroot'
22758 d_chsize='$d_chsize'
22759 d_class='$d_class'
22760 d_clearenv='$d_clearenv'
22761 d_closedir='$d_closedir'
22762 d_cmsghdr_s='$d_cmsghdr_s'
22763 d_const='$d_const'
22764 d_copysignl='$d_copysignl'
22765 d_cplusplus='$d_cplusplus'
22766 d_crypt='$d_crypt'
22767 d_crypt_r='$d_crypt_r'
22768 d_csh='$d_csh'
22769 d_ctermid='$d_ctermid'
22770 d_ctermid_r='$d_ctermid_r'
22771 d_ctime64='$d_ctime64'
22772 d_ctime_r='$d_ctime_r'
22773 d_cuserid='$d_cuserid'
22774 d_dbl_dig='$d_dbl_dig'
22775 d_dbminitproto='$d_dbminitproto'
22776 d_difftime64='$d_difftime64'
22777 d_difftime='$d_difftime'
22778 d_dir_dd_fd='$d_dir_dd_fd'
22779 d_dirfd='$d_dirfd'
22780 d_dirnamlen='$d_dirnamlen'
22781 d_dlerror='$d_dlerror'
22782 d_dlopen='$d_dlopen'
22783 d_dlsymun='$d_dlsymun'
22784 d_dosuid='$d_dosuid'
22785 d_drand48_r='$d_drand48_r'
22786 d_drand48proto='$d_drand48proto'
22787 d_dup2='$d_dup2'
22788 d_eaccess='$d_eaccess'
22789 d_endgrent='$d_endgrent'
22790 d_endgrent_r='$d_endgrent_r'
22791 d_endhent='$d_endhent'
22792 d_endhostent_r='$d_endhostent_r'
22793 d_endnent='$d_endnent'
22794 d_endnetent_r='$d_endnetent_r'
22795 d_endpent='$d_endpent'
22796 d_endprotoent_r='$d_endprotoent_r'
22797 d_endpwent='$d_endpwent'
22798 d_endpwent_r='$d_endpwent_r'
22799 d_endsent='$d_endsent'
22800 d_endservent_r='$d_endservent_r'
22801 d_eofnblk='$d_eofnblk'
22802 d_eunice='$d_eunice'
22803 d_faststdio='$d_faststdio'
22804 d_fchdir='$d_fchdir'
22805 d_fchmod='$d_fchmod'
22806 d_fchown='$d_fchown'
22807 d_fcntl='$d_fcntl'
22808 d_fcntl_can_lock='$d_fcntl_can_lock'
22809 d_fd_macros='$d_fd_macros'
22810 d_fd_set='$d_fd_set'
22811 d_fds_bits='$d_fds_bits'
22812 d_fgetpos='$d_fgetpos'
22813 d_finite='$d_finite'
22814 d_finitel='$d_finitel'
22815 d_flexfnam='$d_flexfnam'
22816 d_flock='$d_flock'
22817 d_flockproto='$d_flockproto'
22818 d_fork='$d_fork'
22819 d_fp_class='$d_fp_class'
22820 d_fpathconf='$d_fpathconf'
22821 d_fpclass='$d_fpclass'
22822 d_fpclassify='$d_fpclassify'
22823 d_fpclassl='$d_fpclassl'
22824 d_fpos64_t='$d_fpos64_t'
22825 d_frexpl='$d_frexpl'
22826 d_fs_data_s='$d_fs_data_s'
22827 d_fseeko='$d_fseeko'
22828 d_fsetpos='$d_fsetpos'
22829 d_fstatfs='$d_fstatfs'
22830 d_fstatvfs='$d_fstatvfs'
22831 d_fsync='$d_fsync'
22832 d_ftello='$d_ftello'
22833 d_ftime='$d_ftime'
22834 d_futimes='$d_futimes'
22835 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22836 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22837 d_getaddrinfo='$d_getaddrinfo'
22838 d_getcwd='$d_getcwd'
22839 d_getespwnam='$d_getespwnam'
22840 d_getfsstat='$d_getfsstat'
22841 d_getgrent='$d_getgrent'
22842 d_getgrent_r='$d_getgrent_r'
22843 d_getgrgid_r='$d_getgrgid_r'
22844 d_getgrnam_r='$d_getgrnam_r'
22845 d_getgrps='$d_getgrps'
22846 d_gethbyaddr='$d_gethbyaddr'
22847 d_gethbyname='$d_gethbyname'
22848 d_gethent='$d_gethent'
22849 d_gethname='$d_gethname'
22850 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22851 d_gethostbyname_r='$d_gethostbyname_r'
22852 d_gethostent_r='$d_gethostent_r'
22853 d_gethostprotos='$d_gethostprotos'
22854 d_getitimer='$d_getitimer'
22855 d_getlogin='$d_getlogin'
22856 d_getlogin_r='$d_getlogin_r'
22857 d_getmnt='$d_getmnt'
22858 d_getmntent='$d_getmntent'
22859 d_getnameinfo='$d_getnameinfo'
22860 d_getnbyaddr='$d_getnbyaddr'
22861 d_getnbyname='$d_getnbyname'
22862 d_getnent='$d_getnent'
22863 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22864 d_getnetbyname_r='$d_getnetbyname_r'
22865 d_getnetent_r='$d_getnetent_r'
22866 d_getnetprotos='$d_getnetprotos'
22867 d_getpagsz='$d_getpagsz'
22868 d_getpbyname='$d_getpbyname'
22869 d_getpbynumber='$d_getpbynumber'
22870 d_getpent='$d_getpent'
22871 d_getpgid='$d_getpgid'
22872 d_getpgrp2='$d_getpgrp2'
22873 d_getpgrp='$d_getpgrp'
22874 d_getppid='$d_getppid'
22875 d_getprior='$d_getprior'
22876 d_getprotobyname_r='$d_getprotobyname_r'
22877 d_getprotobynumber_r='$d_getprotobynumber_r'
22878 d_getprotoent_r='$d_getprotoent_r'
22879 d_getprotoprotos='$d_getprotoprotos'
22880 d_getprpwnam='$d_getprpwnam'
22881 d_getpwent='$d_getpwent'
22882 d_getpwent_r='$d_getpwent_r'
22883 d_getpwnam_r='$d_getpwnam_r'
22884 d_getpwuid_r='$d_getpwuid_r'
22885 d_getsbyname='$d_getsbyname'
22886 d_getsbyport='$d_getsbyport'
22887 d_getsent='$d_getsent'
22888 d_getservbyname_r='$d_getservbyname_r'
22889 d_getservbyport_r='$d_getservbyport_r'
22890 d_getservent_r='$d_getservent_r'
22891 d_getservprotos='$d_getservprotos'
22892 d_getspnam='$d_getspnam'
22893 d_getspnam_r='$d_getspnam_r'
22894 d_gettimeod='$d_gettimeod'
22895 d_gmtime64='$d_gmtime64'
22896 d_gmtime_r='$d_gmtime_r'
22897 d_gnulibc='$d_gnulibc'
22898 d_grpasswd='$d_grpasswd'
22899 d_hasmntopt='$d_hasmntopt'
22900 d_htonl='$d_htonl'
22901 d_ilogbl='$d_ilogbl'
22902 d_inc_version_list='$d_inc_version_list'
22903 d_index='$d_index'
22904 d_inetaton='$d_inetaton'
22905 d_inetntop='$d_inetntop'
22906 d_inetpton='$d_inetpton'
22907 d_int64_t='$d_int64_t'
22908 d_isascii='$d_isascii'
22909 d_isfinite='$d_isfinite'
22910 d_isinf='$d_isinf'
22911 d_isnan='$d_isnan'
22912 d_isnanl='$d_isnanl'
22913 d_killpg='$d_killpg'
22914 d_lchown='$d_lchown'
22915 d_ldbl_dig='$d_ldbl_dig'
22916 d_libm_lib_version='$d_libm_lib_version'
22917 d_link='$d_link'
22918 d_localtime64='$d_localtime64'
22919 d_localtime_r='$d_localtime_r'
22920 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22921 d_locconv='$d_locconv'
22922 d_lockf='$d_lockf'
22923 d_longdbl='$d_longdbl'
22924 d_longlong='$d_longlong'
22925 d_lseekproto='$d_lseekproto'
22926 d_lstat='$d_lstat'
22927 d_madvise='$d_madvise'
22928 d_malloc_good_size='$d_malloc_good_size'
22929 d_malloc_size='$d_malloc_size'
22930 d_mblen='$d_mblen'
22931 d_mbstowcs='$d_mbstowcs'
22932 d_mbtowc='$d_mbtowc'
22933 d_memchr='$d_memchr'
22934 d_memcmp='$d_memcmp'
22935 d_memcpy='$d_memcpy'
22936 d_memmove='$d_memmove'
22937 d_memset='$d_memset'
22938 d_mkdir='$d_mkdir'
22939 d_mkdtemp='$d_mkdtemp'
22940 d_mkfifo='$d_mkfifo'
22941 d_mkstemp='$d_mkstemp'
22942 d_mkstemps='$d_mkstemps'
22943 d_mktime64='$d_mktime64'
22944 d_mktime='$d_mktime'
22945 d_mmap='$d_mmap'
22946 d_modfl='$d_modfl'
22947 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22948 d_modflproto='$d_modflproto'
22949 d_mprotect='$d_mprotect'
22950 d_msg='$d_msg'
22951 d_msg_ctrunc='$d_msg_ctrunc'
22952 d_msg_dontroute='$d_msg_dontroute'
22953 d_msg_oob='$d_msg_oob'
22954 d_msg_peek='$d_msg_peek'
22955 d_msg_proxy='$d_msg_proxy'
22956 d_msgctl='$d_msgctl'
22957 d_msgget='$d_msgget'
22958 d_msghdr_s='$d_msghdr_s'
22959 d_msgrcv='$d_msgrcv'
22960 d_msgsnd='$d_msgsnd'
22961 d_msync='$d_msync'
22962 d_munmap='$d_munmap'
22963 d_mymalloc='$d_mymalloc'
22964 d_ndbm='$d_ndbm'
22965 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22966 d_nice='$d_nice'
22967 d_nl_langinfo='$d_nl_langinfo'
22968 d_nv_preserves_uv='$d_nv_preserves_uv'
22969 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22970 d_off64_t='$d_off64_t'
22971 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22972 d_oldpthreads='$d_oldpthreads'
22973 d_oldsock='$d_oldsock'
22974 d_open3='$d_open3'
22975 d_pathconf='$d_pathconf'
22976 d_pause='$d_pause'
22977 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22978 d_phostname='$d_phostname'
22979 d_pipe='$d_pipe'
22980 d_poll='$d_poll'
22981 d_portable='$d_portable'
22982 d_prctl='$d_prctl'
22983 d_prctl_set_name='$d_prctl_set_name'
22984 d_printf_format_null='$d_printf_format_null'
22985 d_procselfexe='$d_procselfexe'
22986 d_pseudofork='$d_pseudofork'
22987 d_pthread_atfork='$d_pthread_atfork'
22988 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22989 d_pthread_yield='$d_pthread_yield'
22990 d_pwage='$d_pwage'
22991 d_pwchange='$d_pwchange'
22992 d_pwclass='$d_pwclass'
22993 d_pwcomment='$d_pwcomment'
22994 d_pwexpire='$d_pwexpire'
22995 d_pwgecos='$d_pwgecos'
22996 d_pwpasswd='$d_pwpasswd'
22997 d_pwquota='$d_pwquota'
22998 d_qgcvt='$d_qgcvt'
22999 d_quad='$d_quad'
23000 d_random_r='$d_random_r'
23001 d_readdir64_r='$d_readdir64_r'
23002 d_readdir='$d_readdir'
23003 d_readdir_r='$d_readdir_r'
23004 d_readlink='$d_readlink'
23005 d_readv='$d_readv'
23006 d_recvmsg='$d_recvmsg'
23007 d_rename='$d_rename'
23008 d_rewinddir='$d_rewinddir'
23009 d_rmdir='$d_rmdir'
23010 d_safebcpy='$d_safebcpy'
23011 d_safemcpy='$d_safemcpy'
23012 d_sanemcmp='$d_sanemcmp'
23013 d_sbrkproto='$d_sbrkproto'
23014 d_scalbnl='$d_scalbnl'
23015 d_sched_yield='$d_sched_yield'
23016 d_scm_rights='$d_scm_rights'
23017 d_seekdir='$d_seekdir'
23018 d_select='$d_select'
23019 d_sem='$d_sem'
23020 d_semctl='$d_semctl'
23021 d_semctl_semid_ds='$d_semctl_semid_ds'
23022 d_semctl_semun='$d_semctl_semun'
23023 d_semget='$d_semget'
23024 d_semop='$d_semop'
23025 d_sendmsg='$d_sendmsg'
23026 d_setegid='$d_setegid'
23027 d_seteuid='$d_seteuid'
23028 d_setgrent='$d_setgrent'
23029 d_setgrent_r='$d_setgrent_r'
23030 d_setgrps='$d_setgrps'
23031 d_sethent='$d_sethent'
23032 d_sethostent_r='$d_sethostent_r'
23033 d_setitimer='$d_setitimer'
23034 d_setlinebuf='$d_setlinebuf'
23035 d_setlocale='$d_setlocale'
23036 d_setlocale_r='$d_setlocale_r'
23037 d_setnent='$d_setnent'
23038 d_setnetent_r='$d_setnetent_r'
23039 d_setpent='$d_setpent'
23040 d_setpgid='$d_setpgid'
23041 d_setpgrp2='$d_setpgrp2'
23042 d_setpgrp='$d_setpgrp'
23043 d_setprior='$d_setprior'
23044 d_setproctitle='$d_setproctitle'
23045 d_setprotoent_r='$d_setprotoent_r'
23046 d_setpwent='$d_setpwent'
23047 d_setpwent_r='$d_setpwent_r'
23048 d_setregid='$d_setregid'
23049 d_setresgid='$d_setresgid'
23050 d_setresuid='$d_setresuid'
23051 d_setreuid='$d_setreuid'
23052 d_setrgid='$d_setrgid'
23053 d_setruid='$d_setruid'
23054 d_setsent='$d_setsent'
23055 d_setservent_r='$d_setservent_r'
23056 d_setsid='$d_setsid'
23057 d_setvbuf='$d_setvbuf'
23058 d_sfio='$d_sfio'
23059 d_shm='$d_shm'
23060 d_shmat='$d_shmat'
23061 d_shmatprototype='$d_shmatprototype'
23062 d_shmctl='$d_shmctl'
23063 d_shmdt='$d_shmdt'
23064 d_shmget='$d_shmget'
23065 d_sigaction='$d_sigaction'
23066 d_signbit='$d_signbit'
23067 d_sigprocmask='$d_sigprocmask'
23068 d_sigsetjmp='$d_sigsetjmp'
23069 d_sin6_scope_id='$d_sin6_scope_id'
23070 d_sitearch='$d_sitearch'
23071 d_snprintf='$d_snprintf'
23072 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23073 d_sockatmark='$d_sockatmark'
23074 d_sockatmarkproto='$d_sockatmarkproto'
23075 d_socket='$d_socket'
23076 d_socklen_t='$d_socklen_t'
23077 d_sockpair='$d_sockpair'
23078 d_socks5_init='$d_socks5_init'
23079 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23080 d_sqrtl='$d_sqrtl'
23081 d_srand48_r='$d_srand48_r'
23082 d_srandom_r='$d_srandom_r'
23083 d_sresgproto='$d_sresgproto'
23084 d_sresuproto='$d_sresuproto'
23085 d_statblks='$d_statblks'
23086 d_statfs_f_flags='$d_statfs_f_flags'
23087 d_statfs_s='$d_statfs_s'
23088 d_static_inline='$d_static_inline'
23089 d_statvfs='$d_statvfs'
23090 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23091 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23092 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23093 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23094 d_stdio_stream_array='$d_stdio_stream_array'
23095 d_stdiobase='$d_stdiobase'
23096 d_stdstdio='$d_stdstdio'
23097 d_strchr='$d_strchr'
23098 d_strcoll='$d_strcoll'
23099 d_strctcpy='$d_strctcpy'
23100 d_strerrm='$d_strerrm'
23101 d_strerror='$d_strerror'
23102 d_strerror_r='$d_strerror_r'
23103 d_strftime='$d_strftime'
23104 d_strlcat='$d_strlcat'
23105 d_strlcpy='$d_strlcpy'
23106 d_strtod='$d_strtod'
23107 d_strtol='$d_strtol'
23108 d_strtold='$d_strtold'
23109 d_strtoll='$d_strtoll'
23110 d_strtoq='$d_strtoq'
23111 d_strtoul='$d_strtoul'
23112 d_strtoull='$d_strtoull'
23113 d_strtouq='$d_strtouq'
23114 d_strxfrm='$d_strxfrm'
23115 d_suidsafe='$d_suidsafe'
23116 d_symlink='$d_symlink'
23117 d_syscall='$d_syscall'
23118 d_syscallproto='$d_syscallproto'
23119 d_sysconf='$d_sysconf'
23120 d_sysernlst='$d_sysernlst'
23121 d_syserrlst='$d_syserrlst'
23122 d_system='$d_system'
23123 d_tcgetpgrp='$d_tcgetpgrp'
23124 d_tcsetpgrp='$d_tcsetpgrp'
23125 d_telldir='$d_telldir'
23126 d_telldirproto='$d_telldirproto'
23127 d_time='$d_time'
23128 d_timegm='$d_timegm'
23129 d_times='$d_times'
23130 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23131 d_tm_tm_zone='$d_tm_tm_zone'
23132 d_tmpnam_r='$d_tmpnam_r'
23133 d_truncate='$d_truncate'
23134 d_ttyname_r='$d_ttyname_r'
23135 d_tzname='$d_tzname'
23136 d_u32align='$d_u32align'
23137 d_ualarm='$d_ualarm'
23138 d_umask='$d_umask'
23139 d_uname='$d_uname'
23140 d_union_semun='$d_union_semun'
23141 d_unordered='$d_unordered'
23142 d_unsetenv='$d_unsetenv'
23143 d_usleep='$d_usleep'
23144 d_usleepproto='$d_usleepproto'
23145 d_ustat='$d_ustat'
23146 d_vendorarch='$d_vendorarch'
23147 d_vendorbin='$d_vendorbin'
23148 d_vendorlib='$d_vendorlib'
23149 d_vendorscript='$d_vendorscript'
23150 d_vfork='$d_vfork'
23151 d_void_closedir='$d_void_closedir'
23152 d_voidsig='$d_voidsig'
23153 d_voidtty='$d_voidtty'
23154 d_volatile='$d_volatile'
23155 d_vprintf='$d_vprintf'
23156 d_vsnprintf='$d_vsnprintf'
23157 d_wait4='$d_wait4'
23158 d_waitpid='$d_waitpid'
23159 d_wcstombs='$d_wcstombs'
23160 d_wctomb='$d_wctomb'
23161 d_writev='$d_writev'
23162 d_xenix='$d_xenix'
23163 date='$date'
23164 db_hashtype='$db_hashtype'
23165 db_prefixtype='$db_prefixtype'
23166 db_version_major='$db_version_major'
23167 db_version_minor='$db_version_minor'
23168 db_version_patch='$db_version_patch'
23169 defvoidused='$defvoidused'
23170 direntrytype='$direntrytype'
23171 dlext='$dlext'
23172 dlsrc='$dlsrc'
23173 doublesize='$doublesize'
23174 drand01='$drand01'
23175 drand48_r_proto='$drand48_r_proto'
23176 dtrace='$dtrace'
23177 dynamic_ext='$dynamic_ext'
23178 eagain='$eagain'
23179 ebcdic='$ebcdic'
23180 echo='$echo'
23181 egrep='$egrep'
23182 emacs='$emacs'
23183 endgrent_r_proto='$endgrent_r_proto'
23184 endhostent_r_proto='$endhostent_r_proto'
23185 endnetent_r_proto='$endnetent_r_proto'
23186 endprotoent_r_proto='$endprotoent_r_proto'
23187 endpwent_r_proto='$endpwent_r_proto'
23188 endservent_r_proto='$endservent_r_proto'
23189 eunicefix='$eunicefix'
23190 exe_ext='$exe_ext'
23191 expr='$expr'
23192 extensions='$extensions'
23193 extern_C='$extern_C'
23194 extras='$extras'
23195 fflushNULL='$fflushNULL'
23196 fflushall='$fflushall'
23197 find='$find'
23198 firstmakefile='$firstmakefile'
23199 flex='$flex'
23200 fpossize='$fpossize'
23201 fpostype='$fpostype'
23202 freetype='$freetype'
23203 from='$from'
23204 full_ar='$full_ar'
23205 full_csh='$full_csh'
23206 full_sed='$full_sed'
23207 gccansipedantic='$gccansipedantic'
23208 gccosandvers='$gccosandvers'
23209 gccversion='$gccversion'
23210 getgrent_r_proto='$getgrent_r_proto'
23211 getgrgid_r_proto='$getgrgid_r_proto'
23212 getgrnam_r_proto='$getgrnam_r_proto'
23213 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23214 gethostbyname_r_proto='$gethostbyname_r_proto'
23215 gethostent_r_proto='$gethostent_r_proto'
23216 getlogin_r_proto='$getlogin_r_proto'
23217 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23218 getnetbyname_r_proto='$getnetbyname_r_proto'
23219 getnetent_r_proto='$getnetent_r_proto'
23220 getprotobyname_r_proto='$getprotobyname_r_proto'
23221 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23222 getprotoent_r_proto='$getprotoent_r_proto'
23223 getpwent_r_proto='$getpwent_r_proto'
23224 getpwnam_r_proto='$getpwnam_r_proto'
23225 getpwuid_r_proto='$getpwuid_r_proto'
23226 getservbyname_r_proto='$getservbyname_r_proto'
23227 getservbyport_r_proto='$getservbyport_r_proto'
23228 getservent_r_proto='$getservent_r_proto'
23229 getspnam_r_proto='$getspnam_r_proto'
23230 gidformat='$gidformat'
23231 gidsign='$gidsign'
23232 gidsize='$gidsize'
23233 gidtype='$gidtype'
23234 glibpth='$glibpth'
23235 gmake='$gmake'
23236 gmtime_r_proto='$gmtime_r_proto'
23237 gnulibc_version='$gnulibc_version'
23238 grep='$grep'
23239 groupcat='$groupcat'
23240 groupstype='$groupstype'
23241 gzip='$gzip'
23242 h_fcntl='$h_fcntl'
23243 h_sysfile='$h_sysfile'
23244 hint='$hint'
23245 hostcat='$hostcat'
23246 html1dir='$html1dir'
23247 html1direxp='$html1direxp'
23248 html3dir='$html3dir'
23249 html3direxp='$html3direxp'
23250 i16size='$i16size'
23251 i16type='$i16type'
23252 i32size='$i32size'
23253 i32type='$i32type'
23254 i64size='$i64size'
23255 i64type='$i64type'
23256 i8size='$i8size'
23257 i8type='$i8type'
23258 i_arpainet='$i_arpainet'
23259 i_assert='$i_assert'
23260 i_bsdioctl='$i_bsdioctl'
23261 i_crypt='$i_crypt'
23262 i_db='$i_db'
23263 i_dbm='$i_dbm'
23264 i_dirent='$i_dirent'
23265 i_dld='$i_dld'
23266 i_dlfcn='$i_dlfcn'
23267 i_fcntl='$i_fcntl'
23268 i_float='$i_float'
23269 i_fp='$i_fp'
23270 i_fp_class='$i_fp_class'
23271 i_gdbm='$i_gdbm'
23272 i_gdbm_ndbm='$i_gdbm_ndbm'
23273 i_gdbmndbm='$i_gdbmndbm'
23274 i_grp='$i_grp'
23275 i_ieeefp='$i_ieeefp'
23276 i_inttypes='$i_inttypes'
23277 i_langinfo='$i_langinfo'
23278 i_libutil='$i_libutil'
23279 i_limits='$i_limits'
23280 i_locale='$i_locale'
23281 i_machcthr='$i_machcthr'
23282 i_malloc='$i_malloc'
23283 i_mallocmalloc='$i_mallocmalloc'
23284 i_math='$i_math'
23285 i_memory='$i_memory'
23286 i_mntent='$i_mntent'
23287 i_ndbm='$i_ndbm'
23288 i_netdb='$i_netdb'
23289 i_neterrno='$i_neterrno'
23290 i_netinettcp='$i_netinettcp'
23291 i_niin='$i_niin'
23292 i_poll='$i_poll'
23293 i_prot='$i_prot'
23294 i_pthread='$i_pthread'
23295 i_pwd='$i_pwd'
23296 i_rpcsvcdbm='$i_rpcsvcdbm'
23297 i_sfio='$i_sfio'
23298 i_sgtty='$i_sgtty'
23299 i_shadow='$i_shadow'
23300 i_socks='$i_socks'
23301 i_stdarg='$i_stdarg'
23302 i_stdbool='$i_stdbool'
23303 i_stddef='$i_stddef'
23304 i_stdlib='$i_stdlib'
23305 i_string='$i_string'
23306 i_sunmath='$i_sunmath'
23307 i_sysaccess='$i_sysaccess'
23308 i_sysdir='$i_sysdir'
23309 i_sysfile='$i_sysfile'
23310 i_sysfilio='$i_sysfilio'
23311 i_sysin='$i_sysin'
23312 i_sysioctl='$i_sysioctl'
23313 i_syslog='$i_syslog'
23314 i_sysmman='$i_sysmman'
23315 i_sysmode='$i_sysmode'
23316 i_sysmount='$i_sysmount'
23317 i_sysndir='$i_sysndir'
23318 i_sysparam='$i_sysparam'
23319 i_syspoll='$i_syspoll'
23320 i_sysresrc='$i_sysresrc'
23321 i_syssecrt='$i_syssecrt'
23322 i_sysselct='$i_sysselct'
23323 i_syssockio='$i_syssockio'
23324 i_sysstat='$i_sysstat'
23325 i_sysstatfs='$i_sysstatfs'
23326 i_sysstatvfs='$i_sysstatvfs'
23327 i_systime='$i_systime'
23328 i_systimek='$i_systimek'
23329 i_systimes='$i_systimes'
23330 i_systypes='$i_systypes'
23331 i_sysuio='$i_sysuio'
23332 i_sysun='$i_sysun'
23333 i_sysutsname='$i_sysutsname'
23334 i_sysvfs='$i_sysvfs'
23335 i_syswait='$i_syswait'
23336 i_termio='$i_termio'
23337 i_termios='$i_termios'
23338 i_time='$i_time'
23339 i_unistd='$i_unistd'
23340 i_ustat='$i_ustat'
23341 i_utime='$i_utime'
23342 i_values='$i_values'
23343 i_varargs='$i_varargs'
23344 i_varhdr='$i_varhdr'
23345 i_vfork='$i_vfork'
23346 ignore_versioned_solibs='$ignore_versioned_solibs'
23347 inc_version_list='$inc_version_list'
23348 inc_version_list_init='$inc_version_list_init'
23349 incpath='$incpath'
23350 inews='$inews'
23351 initialinstalllocation='$initialinstalllocation'
23352 installarchlib='$installarchlib'
23353 installbin='$installbin'
23354 installhtml1dir='$installhtml1dir'
23355 installhtml3dir='$installhtml3dir'
23356 installman1dir='$installman1dir'
23357 installman3dir='$installman3dir'
23358 installprefix='$installprefix'
23359 installprefixexp='$installprefixexp'
23360 installprivlib='$installprivlib'
23361 installscript='$installscript'
23362 installsitearch='$installsitearch'
23363 installsitebin='$installsitebin'
23364 installsitehtml1dir='$installsitehtml1dir'
23365 installsitehtml3dir='$installsitehtml3dir'
23366 installsitelib='$installsitelib'
23367 installsiteman1dir='$installsiteman1dir'
23368 installsiteman3dir='$installsiteman3dir'
23369 installsitescript='$installsitescript'
23370 installstyle='$installstyle'
23371 installusrbinperl='$installusrbinperl'
23372 installvendorarch='$installvendorarch'
23373 installvendorbin='$installvendorbin'
23374 installvendorhtml1dir='$installvendorhtml1dir'
23375 installvendorhtml3dir='$installvendorhtml3dir'
23376 installvendorlib='$installvendorlib'
23377 installvendorman1dir='$installvendorman1dir'
23378 installvendorman3dir='$installvendorman3dir'
23379 installvendorscript='$installvendorscript'
23380 intsize='$intsize'
23381 issymlink='$issymlink'
23382 ivdformat='$ivdformat'
23383 ivsize='$ivsize'
23384 ivtype='$ivtype'
23385 known_extensions='$known_extensions'
23386 ksh='$ksh'
23387 ld='$ld'
23388 lddlflags='$lddlflags'
23389 ldflags='$ldflags'
23390 ldflags_uselargefiles='$ldflags_uselargefiles'
23391 ldlibpthname='$ldlibpthname'
23392 less='$less'
23393 lib_ext='$lib_ext'
23394 libc='$libc'
23395 libperl='$libperl'
23396 libpth='$libpth'
23397 libs='$libs'
23398 libsdirs='$libsdirs'
23399 libsfiles='$libsfiles'
23400 libsfound='$libsfound'
23401 libspath='$libspath'
23402 libswanted='$libswanted'
23403 libswanted_uselargefiles='$libswanted_uselargefiles'
23404 line='$line'
23405 lint='$lint'
23406 lkflags='$lkflags'
23407 ln='$ln'
23408 lns='$lns'
23409 localtime_r_proto='$localtime_r_proto'
23410 locincpth='$locincpth'
23411 loclibpth='$loclibpth'
23412 longdblsize='$longdblsize'
23413 longlongsize='$longlongsize'
23414 longsize='$longsize'
23415 lp='$lp'
23416 lpr='$lpr'
23417 ls='$ls'
23418 lseeksize='$lseeksize'
23419 lseektype='$lseektype'
23420 mad='$mad'
23421 madlyh='$madlyh'
23422 madlyobj='$madlyobj'
23423 madlysrc='$madlysrc'
23424 mail='$mail'
23425 mailx='$mailx'
23426 make='$make'
23427 make_set_make='$make_set_make'
23428 mallocobj='$mallocobj'
23429 mallocsrc='$mallocsrc'
23430 malloctype='$malloctype'
23431 man1dir='$man1dir'
23432 man1direxp='$man1direxp'
23433 man1ext='$man1ext'
23434 man3dir='$man3dir'
23435 man3direxp='$man3direxp'
23436 man3ext='$man3ext'
23437 mips_type='$mips_type'
23438 mistrustnm='$mistrustnm'
23439 mkdir='$mkdir'
23440 mmaptype='$mmaptype'
23441 modetype='$modetype'
23442 more='$more'
23443 multiarch='$multiarch'
23444 mv='$mv'
23445 myarchname='$myarchname'
23446 mydomain='$mydomain'
23447 myhostname='$myhostname'
23448 myuname='$myuname'
23449 n='$n'
23450 need_va_copy='$need_va_copy'
23451 netdb_hlen_type='$netdb_hlen_type'
23452 netdb_host_type='$netdb_host_type'
23453 netdb_name_type='$netdb_name_type'
23454 netdb_net_type='$netdb_net_type'
23455 nm='$nm'
23456 nm_opt='$nm_opt'
23457 nm_so_opt='$nm_so_opt'
23458 nonxs_ext='$nonxs_ext'
23459 nroff='$nroff'
23460 nvEUformat='$nvEUformat'
23461 nvFUformat='$nvFUformat'
23462 nvGUformat='$nvGUformat'
23463 nv_overflows_integers_at='$nv_overflows_integers_at'
23464 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23465 nveformat='$nveformat'
23466 nvfformat='$nvfformat'
23467 nvgformat='$nvgformat'
23468 nvsize='$nvsize'
23469 nvtype='$nvtype'
23470 o_nonblock='$o_nonblock'
23471 obj_ext='$obj_ext'
23472 old_pthread_create_joinable='$old_pthread_create_joinable'
23473 optimize='$optimize'
23474 orderlib='$orderlib'
23475 osname='$osname'
23476 osvers='$osvers'
23477 otherlibdirs='$otherlibdirs'
23478 package='$package'
23479 pager='$pager'
23480 passcat='$passcat'
23481 patchlevel='$patchlevel'
23482 path_sep='$path_sep'
23483 perl5='$perl5'
23484 perl='$perl'
23485 perl_patchlevel='$perl_patchlevel'
23486 perl_static_inline='$perl_static_inline'
23487 perladmin='$perladmin'
23488 perllibs='$perllibs'
23489 perlpath='$perlpath'
23490 pg='$pg'
23491 phostname='$phostname'
23492 pidtype='$pidtype'
23493 plibpth='$plibpth'
23494 pmake='$pmake'
23495 pr='$pr'
23496 prefix='$prefix'
23497 prefixexp='$prefixexp'
23498 privlib='$privlib'
23499 privlibexp='$privlibexp'
23500 procselfexe='$procselfexe'
23501 prototype='$prototype'
23502 ptrsize='$ptrsize'
23503 quadkind='$quadkind'
23504 quadtype='$quadtype'
23505 randbits='$randbits'
23506 randfunc='$randfunc'
23507 random_r_proto='$random_r_proto'
23508 randseedtype='$randseedtype'
23509 ranlib='$ranlib'
23510 rd_nodata='$rd_nodata'
23511 readdir64_r_proto='$readdir64_r_proto'
23512 readdir_r_proto='$readdir_r_proto'
23513 revision='$revision'
23514 rm='$rm'
23515 rm_try='$rm_try'
23516 rmail='$rmail'
23517 run='$run'
23518 runnm='$runnm'
23519 sGMTIME_max='$sGMTIME_max'
23520 sGMTIME_min='$sGMTIME_min'
23521 sLOCALTIME_max='$sLOCALTIME_max'
23522 sLOCALTIME_min='$sLOCALTIME_min'
23523 sPRIEUldbl='$sPRIEUldbl'
23524 sPRIFUldbl='$sPRIFUldbl'
23525 sPRIGUldbl='$sPRIGUldbl'
23526 sPRIXU64='$sPRIXU64'
23527 sPRId64='$sPRId64'
23528 sPRIeldbl='$sPRIeldbl'
23529 sPRIfldbl='$sPRIfldbl'
23530 sPRIgldbl='$sPRIgldbl'
23531 sPRIi64='$sPRIi64'
23532 sPRIo64='$sPRIo64'
23533 sPRIu64='$sPRIu64'
23534 sPRIx64='$sPRIx64'
23535 sSCNfldbl='$sSCNfldbl'
23536 sched_yield='$sched_yield'
23537 scriptdir='$scriptdir'
23538 scriptdirexp='$scriptdirexp'
23539 sed='$sed'
23540 seedfunc='$seedfunc'
23541 selectminbits='$selectminbits'
23542 selecttype='$selecttype'
23543 sendmail='$sendmail'
23544 setgrent_r_proto='$setgrent_r_proto'
23545 sethostent_r_proto='$sethostent_r_proto'
23546 setlocale_r_proto='$setlocale_r_proto'
23547 setnetent_r_proto='$setnetent_r_proto'
23548 setprotoent_r_proto='$setprotoent_r_proto'
23549 setpwent_r_proto='$setpwent_r_proto'
23550 setservent_r_proto='$setservent_r_proto'
23551 sh='$sh'
23552 shar='$shar'
23553 sharpbang='$sharpbang'
23554 shmattype='$shmattype'
23555 shortsize='$shortsize'
23556 shrpenv='$shrpenv'
23557 shsharp='$shsharp'
23558 sig_count='$sig_count'
23559 sig_name='$sig_name'
23560 sig_name_init='$sig_name_init'
23561 sig_num='$sig_num'
23562 sig_num_init='$sig_num_init'
23563 sig_size='$sig_size'
23564 signal_t='$signal_t'
23565 sitearch='$sitearch'
23566 sitearchexp='$sitearchexp'
23567 sitebin='$sitebin'
23568 sitebinexp='$sitebinexp'
23569 sitehtml1dir='$sitehtml1dir'
23570 sitehtml1direxp='$sitehtml1direxp'
23571 sitehtml3dir='$sitehtml3dir'
23572 sitehtml3direxp='$sitehtml3direxp'
23573 sitelib='$sitelib'
23574 sitelib_stem='$sitelib_stem'
23575 sitelibexp='$sitelibexp'
23576 siteman1dir='$siteman1dir'
23577 siteman1direxp='$siteman1direxp'
23578 siteman3dir='$siteman3dir'
23579 siteman3direxp='$siteman3direxp'
23580 siteprefix='$siteprefix'
23581 siteprefixexp='$siteprefixexp'
23582 sitescript='$sitescript'
23583 sitescriptexp='$sitescriptexp'
23584 sizesize='$sizesize'
23585 sizetype='$sizetype'
23586 sleep='$sleep'
23587 smail='$smail'
23588 so='$so'
23589 sockethdr='$sockethdr'
23590 socketlib='$socketlib'
23591 socksizetype='$socksizetype'
23592 sort='$sort'
23593 spackage='$spackage'
23594 spitshell='$spitshell'
23595 srand48_r_proto='$srand48_r_proto'
23596 srandom_r_proto='$srandom_r_proto'
23597 src='$src'
23598 ssizetype='$ssizetype'
23599 st_ino_sign='$st_ino_sign'
23600 st_ino_size='$st_ino_size'
23601 startperl='$startperl'
23602 startsh='$startsh'
23603 static_ext='$static_ext'
23604 stdchar='$stdchar'
23605 stdio_base='$stdio_base'
23606 stdio_bufsiz='$stdio_bufsiz'
23607 stdio_cnt='$stdio_cnt'
23608 stdio_filbuf='$stdio_filbuf'
23609 stdio_ptr='$stdio_ptr'
23610 stdio_stream_array='$stdio_stream_array'
23611 strerror_r_proto='$strerror_r_proto'
23612 strings='$strings'
23613 submit='$submit'
23614 subversion='$subversion'
23615 sysman='$sysman'
23616 tail='$tail'
23617 tar='$tar'
23618 targetarch='$targetarch'
23619 tbl='$tbl'
23620 tee='$tee'
23621 test='$test'
23622 timeincl='$timeincl'
23623 timetype='$timetype'
23624 tmpnam_r_proto='$tmpnam_r_proto'
23625 to='$to'
23626 touch='$touch'
23627 tr='$tr'
23628 trnl='$trnl'
23629 troff='$troff'
23630 ttyname_r_proto='$ttyname_r_proto'
23631 u16size='$u16size'
23632 u16type='$u16type'
23633 u32size='$u32size'
23634 u32type='$u32type'
23635 u64size='$u64size'
23636 u64type='$u64type'
23637 u8size='$u8size'
23638 u8type='$u8type'
23639 uidformat='$uidformat'
23640 uidsign='$uidsign'
23641 uidsize='$uidsize'
23642 uidtype='$uidtype'
23643 uname='$uname'
23644 uniq='$uniq'
23645 uquadtype='$uquadtype'
23646 use5005threads='$use5005threads'
23647 use64bitall='$use64bitall'
23648 use64bitint='$use64bitint'
23649 usecrosscompile='$usecrosscompile'
23650 usedevel='$usedevel'
23651 usedl='$usedl'
23652 usedtrace='$usedtrace'
23653 usefaststdio='$usefaststdio'
23654 useithreads='$useithreads'
23655 usekernprocpathname='$usekernprocpathname'
23656 uselargefiles='$uselargefiles'
23657 uselongdouble='$uselongdouble'
23658 usemallocwrap='$usemallocwrap'
23659 usemorebits='$usemorebits'
23660 usemultiplicity='$usemultiplicity'
23661 usemymalloc='$usemymalloc'
23662 usenm='$usenm'
23663 usensgetexecutablepath='$usensgetexecutablepath'
23664 useopcode='$useopcode'
23665 useperlio='$useperlio'
23666 useposix='$useposix'
23667 usereentrant='$usereentrant'
23668 userelocatableinc='$userelocatableinc'
23669 usesfio='$usesfio'
23670 useshrplib='$useshrplib'
23671 usesitecustomize='$usesitecustomize'
23672 usesocks='$usesocks'
23673 usethreads='$usethreads'
23674 usevendorprefix='$usevendorprefix'
23675 usevfork='$usevfork'
23676 usrinc='$usrinc'
23677 uuname='$uuname'
23678 uvXUformat='$uvXUformat'
23679 uvoformat='$uvoformat'
23680 uvsize='$uvsize'
23681 uvtype='$uvtype'
23682 uvuformat='$uvuformat'
23683 uvxformat='$uvxformat'
23684 vaproto='$vaproto'
23685 vendorarch='$vendorarch'
23686 vendorarchexp='$vendorarchexp'
23687 vendorbin='$vendorbin'
23688 vendorbinexp='$vendorbinexp'
23689 vendorhtml1dir='$vendorhtml1dir'
23690 vendorhtml1direxp='$vendorhtml1direxp'
23691 vendorhtml3dir='$vendorhtml3dir'
23692 vendorhtml3direxp='$vendorhtml3direxp'
23693 vendorlib='$vendorlib'
23694 vendorlib_stem='$vendorlib_stem'
23695 vendorlibexp='$vendorlibexp'
23696 vendorman1dir='$vendorman1dir'
23697 vendorman1direxp='$vendorman1direxp'
23698 vendorman3dir='$vendorman3dir'
23699 vendorman3direxp='$vendorman3direxp'
23700 vendorprefix='$vendorprefix'
23701 vendorprefixexp='$vendorprefixexp'
23702 vendorscript='$vendorscript'
23703 vendorscriptexp='$vendorscriptexp'
23704 version='$version'
23705 version_patchlevel_string='$version_patchlevel_string'
23706 versiononly='$versiononly'
23707 vi='$vi'
23708 voidflags='$voidflags'
23709 xlibpth='$xlibpth'
23710 yacc='$yacc'
23711 yaccflags='$yaccflags'
23712 zcat='$zcat'
23713 zip='$zip'
23714 EOT
23715
23716 : add special variables
23717 $test -f $src/patchlevel.h && \
23718 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23719 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23720 echo "PERL_CONFIG_SH=true" >>config.sh
23721
23722 : propagate old symbols
23723 if $test -f UU/config.sh; then
23724         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23725         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23726                 config.sh config.sh UU/oldconfig.sh |\
23727                 $sort | $uniq -u >UU/oldsyms
23728         set X `$cat UU/oldsyms`
23729         shift
23730         case $# in
23731         0) ;;
23732         *)
23733                 $cat <<EOM
23734 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23735 EOM
23736                 echo ": Variables propagated from previous config.sh file." >>config.sh
23737                 for sym in `$cat UU/oldsyms`; do
23738                         echo "    Propagating $hint variable "'$'"$sym..."
23739                         eval 'tmp="$'"${sym}"'"'
23740                         echo "$tmp" | \
23741                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23742                 done
23743                 ;;
23744         esac
23745 fi
23746
23747 : Finish up by extracting the .SH files
23748 case "$alldone" in
23749 exit)
23750         $rm -rf UU
23751         echo "Extraction done."
23752         exit 0
23753         ;;
23754 cont)
23755         ;;
23756 '')
23757         dflt=''
23758         nostick=true
23759         $cat <<EOM
23760
23761 If you'd like to make any changes to the config.sh file before I begin
23762 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23763
23764 EOM
23765         rp="Press return or use a shell escape to edit config.sh:"
23766         . UU/myread
23767         nostick=''
23768         case "$ans" in
23769         '') ;;
23770         *) : in case they cannot read
23771                 sh 1>&4 -c "$ans";;
23772         esac
23773         ;;
23774 esac
23775
23776 : if this fails, just run all the .SH files by hand
23777 . ./config.sh
23778
23779 echo " "
23780 exec 1>&4
23781 pwd=`pwd`
23782 . ./UU/extract
23783 cd "$pwd"
23784
23785 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23786         dflt=y
23787         case "$silent" in
23788         true) ;;
23789         *)
23790                 $cat <<EOM
23791
23792 Now you need to generate make dependencies by running "$make depend".
23793 You might prefer to run it in background: "$make depend > makedepend.out &"
23794 It can take a while, so you might not want to run it right now.
23795
23796 EOM
23797                 ;;
23798         esac
23799         rp="Run $make depend now?"
23800         . UU/myread
23801         case "$ans" in
23802         y*)
23803                 $make depend && echo "Now you must run '$make'."
23804                 ;;
23805         *)
23806                 echo "You must run '$make depend' then '$make'."
23807                 ;;
23808         esac
23809 elif test -f [Mm]akefile; then
23810         echo " "
23811         echo "Now you must run a $make."
23812 else
23813         echo "Configure done."
23814 fi
23815
23816 if $test -f Policy.sh; then
23817     $cat <<EOM
23818
23819 If you compile $package on a different machine or from a different object
23820 directory, copy the Policy.sh file from this object directory to the
23821 new one before you run Configure -- this will help you with most of
23822 the policy defaults.
23823
23824 EOM
23825 fi
23826 if $test -f config.msg; then
23827     echo "Hmm.  I also noted the following information while running:"
23828     echo " "
23829     $cat config.msg >&4
23830     $rm -f config.msg
23831 fi
23832 $rm -f kit*isdone ark*isdone
23833 $rm -rf UU
23834
23835 : End of Configure
23836